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

arch: comply to coding guidelines MISRA C:2012 Rule 14.4 #48065

Conversation

simhein
Copy link
Collaborator

@simhein simhein commented Jul 20, 2022

Fix coding guideline MISRA C:2012 Rule 14.4 in arch:

The controlling expression of an if statement
and the controlling expression of an iteration-statement shall have
essentially Boolean type.

This PR is part of the enhancement issue #48002 which port the coding guideline fixes done by BUGSENG on the https://github.com/zephyrproject-rtos/zephyr/tree/v2.7-auditable-branch back to main

The commit in this PR is a subset of the original auditable-branch commit:
5d02614

MISRA C:2012 Rule 14.4 (The controlling expression of an if statement
and the controlling expression of an iteration-statement shall have
essentially Boolean type.)

Use `do { ... } while (false)' instead of `do { ... } while (0)'.
Use comparisons with zero instead of implicitly testing integers.
Use comparisons with NULL instead of implicitly testing pointers.
Use comparisons with NUL instead of implicitly testing plain chars.

This commit is a subset of the original auditable-branch commit:
5d02614

Signed-off-by: Simon Hein <[email protected]>
@zephyrbot zephyrbot added area: ARM ARM (32-bit) Architecture area: X86 x86 Architecture (32-bit) area: NIOS2 NIOS2 Architecture labels Jul 20, 2022
@simhein simhein added area: MISRA-C area: Coding Guidelines Coding guidelines and style and removed area: ARM ARM (32-bit) Architecture area: X86 x86 Architecture (32-bit) area: NIOS2 NIOS2 Architecture labels Jul 20, 2022
@simhein simhein added area: ARM ARM (32-bit) Architecture area: X86 x86 Architecture (32-bit) area: NIOS2 NIOS2 Architecture labels Jul 20, 2022
@mmahadevan108 mmahadevan108 merged commit b5522ff into zephyrproject-rtos:main Jul 20, 2022
@jhedberg jhedberg mentioned this pull request Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ARM ARM (32-bit) Architecture area: Coding Guidelines Coding guidelines and style area: MISRA-C area: NIOS2 NIOS2 Architecture area: X86 x86 Architecture (32-bit)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants