Skip to content

Conversation

@simhein
Copy link
Contributor

@simhein simhein commented Jul 26, 2022

Fix coding guideline MISRA C:2012 Rule 14.4 do-while and implicitly testing integers violations in drivers:

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

…hecks

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.

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

Signed-off-by: Simon Hein <SHein@baumer.com>
@nashif nashif merged commit d092101 into zephyrproject-rtos:main Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Coding Guidelines Coding guidelines and style area: MISRA-C

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants