Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MISRA C 2012 rule 8.6 errors #862

Merged
merged 14 commits into from
Dec 7, 2023

Conversation

chinglee-iot
Copy link
Member

@chinglee-iot chinglee-iot commented Oct 26, 2023

Fix MISRA C 2012 rule 8.6 errors

Description

MISRA C 2012 rule 8.6

An identifier with external linkage shall have exactly one external definition

MISRA violation
The following is an example of violation. xQueueCRSendFromISR is declared in the header file but configUSE_CO_ROUTINES is not defined to 1. Therefore, no definition for xQueueCRSendFromISR.

BaseType_t xQueueCRSendFromISR( QueueHandle_t xQueue,
                                const void * pvItemToQueue,
                                BaseType_t xCoRoutinePreviouslyWoken );

Fix in this PR

  • Use compile macro in header file to prevent functions declared without definition from compilation.

For example, in the example above use configUSE_CO_ROUTINES == 1 to ensure that the function is declared only when there is definition.

#if ( configUSE_CO_ROUTINES == 1 )
  BaseType_t xQueueCRSendFromISR( QueueHandle_t xQueue,
                                  const void * pvItemToQueue,
                                  BaseType_t xCoRoutinePreviouslyWoken );
#endif

Test Steps

N/A

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@chinglee-iot chinglee-iot requested a review from a team as a code owner October 26, 2023 08:01
@codecov
Copy link

codecov bot commented Oct 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (55094e2) 93.77% compared to head (e37d43e) 93.77%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #862   +/-   ##
=======================================
  Coverage   93.77%   93.77%           
=======================================
  Files           6        6           
  Lines        3183     3183           
  Branches      885      885           
=======================================
  Hits         2985     2985           
  Misses         91       91           
  Partials      107      107           
Flag Coverage Δ
unittests 93.77% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

moninom1
moninom1 previously approved these changes Oct 30, 2023
Copy link

sonarqubecloud bot commented Nov 1, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

moninom1
moninom1 previously approved these changes Dec 4, 2023
Copy link

sonarqubecloud bot commented Dec 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@kar-rahul-aws kar-rahul-aws merged commit 51437bf into FreeRTOS:main Dec 7, 2023
17 checks passed
@kar-rahul-aws kar-rahul-aws deleted the fix-misra-8.6 branch December 7, 2023 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants