FreeRTOS / FreeRTOS-Kernel

FreeRTOS kernel files only, submoduled into https://github.com/FreeRTOS/FreeRTOS and various other repos.
https://www.FreeRTOS.org
MIT License
2.52k stars 1.05k forks source link

Fix MISRA C 2012 Rule 13.3 Violations #985

Closed bradleysmith23 closed 5 months ago

bradleysmith23 commented 5 months ago

Description

MISRA C 2012 Rule 13.3 states that the increment/decrement(++/--) operators should contain the only side-effect in an expression. As a result, using ++/-- on a volatile results in a violation as reading a volatile qualified variable is a side-effect itself. To remediate this issue, the value of the volatile is assigned to temporary variables in these cases, then the temporary variable is incremented or decremented before being written back to the volatile qualified variable.

Test Steps

Checklist:

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.

bradleysmith23 commented 5 months ago

/bot run formatting

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (7284d84) 93.52% compared to head (1063466) 93.55%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #985 +/- ## ========================================== + Coverage 93.52% 93.55% +0.02% ========================================== Files 6 6 Lines 3199 3213 +14 Branches 889 889 ========================================== + Hits 2992 3006 +14 Misses 92 92 Partials 115 115 ``` | [Flag](https://app.codecov.io/gh/FreeRTOS/FreeRTOS-Kernel/pull/985/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FreeRTOS) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/FreeRTOS/FreeRTOS-Kernel/pull/985/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FreeRTOS) | `93.55% <100.00%> (+0.02%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FreeRTOS#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

bradleysmith23 commented 5 months ago

/bot run formatting

sonarcloud[bot] commented 5 months ago

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud