-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
tests: Made pointer parameters explicitely const where non-const pointer parameters are not needed #72417
tests: Made pointer parameters explicitely const where non-const pointer parameters are not needed #72417
Conversation
6960f1a
to
08c5b8b
Compare
You changed:
How this can even not produce a warning given that Also the original cast is probably redundant and could be removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not do const-correctness piecewise. Const goes on function arguments and struct fields first, then propagates outwards as needed. Declaring local variables const is at best providing some tiny bit of safety in a single function, and as @npitre points out the cast on that pointer is just a noop as the argument is non-const.
- modified parameter types to receive a const pointer when a non-const pointer is not needed Signed-off-by: Hess Nathan <nhess@baumer.com>
08c5b8b
to
695ae33
Compare
You are right, i was planning on adding const thing seperately across the different modules of the project. I admit it was never ideal. As it turns out, it might be possible to remove the arch_buffer_validate method entirely, as it does not seem to be in use anymore. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still seems silly to have a whole PR just to flag one local variable const in a random test, but no reason not to approve I guess.
modified parameter types to receive a const pointer when a non-const pointer is not needed
This corresponds to following misra coding guideline:
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:
f953e92