-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 10.3 errors #860
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #860 +/- ##
=======================================
Coverage 93.64% 93.64%
=======================================
Files 6 6
Lines 3179 3179
Branches 885 885
=======================================
Hits 2977 2977
Misses 95 95
Partials 107 107
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Fix MISRA C 2012 Rule 10.3 errors
Description
MISRA C 2012 Rule 10.3
MISRA violation
The size of constant with suffix
UL
is different for different compiler.For example,
sizeof( 0x01000000UL )
is 4 if using 32-bits GCC compiler. However, it is 8 if using 64-btis GCC compiler. Therefore, assigning a constant with suffixUL
to auint32_t
can cause implicit conversion which may lead to unintended result.The following is an example of the violation. Size of constant eventEVENT_BITS_CONTROL_BYTES is 8 with 64-bits GCC compiler. The statement
uxReturn &= ~eventEVENT_BITS_CONTROL_BYTES;
causes implicit conversion.Fix In this PR
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.