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 20.12 deviations #157

Merged
merged 2 commits into from
Mar 14, 2024

Conversation

chinglee-iot
Copy link
Member

@chinglee-iot chinglee-iot commented Mar 13, 2024

Fix MISRA C 2012 20.12 deviations

Description

MISRA C 2012 rule 20.12

A macro parameter that is used as an operand of a # or ## operator is not expanded prior to being
used.

assert may be implemented using a # or ## operator. In this case, macro replacement is subjected to macro itself. The result may not be meet developer expectations.

In this PR:

  • Use a local variable here to prevent macro replacement is subjected to macro itself.

Test Steps

Issue #152 indicates this error.

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

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

* Use a local variable here to prevent macro replacement is subjected to
  macro itself.
@AniruddhaKanhere AniruddhaKanhere dismissed their stale review March 13, 2024 20:36

Have a comment to add.

Copy link
Member

@AniruddhaKanhere AniruddhaKanhere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

paulbartell
paulbartell previously approved these changes Mar 13, 2024
@chinglee-iot chinglee-iot merged commit e8fd5be into FreeRTOS:main Mar 14, 2024
11 checks passed
@chinglee-iot chinglee-iot mentioned this pull request Mar 14, 2024
@chinglee-iot chinglee-iot deleted the fix-assert-misra branch March 18, 2024 01:34
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.

5 participants