-
Notifications
You must be signed in to change notification settings - Fork 7.4k
drivers/flash: fix warnings about missing casts #21344
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
Conversation
fix warnings about missing casts in /include/drivers/flash.h on the dev->driver_api fixes #21290 Signed-off-by: András Szabó <[email protected]>
Some checks failed. Please fix and resubmit. Gitlint issues3: B2 Line has trailing whitespace: "fix warnings about missing casts " Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
is it possible that ${ZEPHYR_BASE}/scripts/checkpatch.pl check for 80 long lines, but the bot here checks if it is <72? |
@szundi It is referring to the commit message. |
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.
I think we should really establish guidelines on handling these C++ issues.
These implicit void pointer conversions are perfectly valid and even encouraged in C (e.g. when using malloc
), while C++ is very pedantic about it; in fact, the only reason we are not getting an error for this is that we specify -fpermissive
.
IMHO, since these headers primarily target C and such explicit casts involving void *
are both redundant and (arguably) ugly, I think we should leave them as is and ignore the warnings.
Normally rather need to fix current PR than close it and open its replacement |
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.
Normally rather need to fix current PR than close it and open its replacement
https://docs.zephyrproject.org/latest/contribute/index.html#contribution-workflow
Pleas fix commit message this way.
@stephanosio I feel you too, but default zephyr setting build should not spam warnings in my opinion. They need to make policy change, otherwise someone has to make these go away. Strategically I don't really see where this goes, so if it is against long term strategy, I am happy to see this fix trashed for good - otherwise I feel this beautiful 😉 |
I sympathize, but these headers provide the implementation of the flash API, and if they are incorrect the flash API can't be used. I was already reconsidering my approval, and so now I'm withdrawing it in favor of opening #21365 as the general case. I believe much of the conversion can be automated with Coccinelle. |
Ideally, these warnings should be allowed to be turned off as they were before; but unfortunately, the gcc guys are as much of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81787 I wonder if writing a wrapper for g++ that filters out the Alternatively, we could patch the g++ in the Zephyr SDK to add an option like |
fix warnings about missing casts fixes #21290 Signed-off-by: András Szabó <[email protected]>
This gcc patch idea is nice. Maybe this casting is just waste of work, does not mean any benefit when later something changes. However on Mac, there is no zephyr SDK. |
@szundi It seems that Clang is even more pedantic about it and, at that point, I suppose we have no other option but to appease the C++ specs. @pabigot is working on establishing the de facto guidelines for this (#21365, #21391, #21392). |
Superseded by #21391 |
fix warnings about missing casts in /include/drivers/flash.h on the dev->driver_api
fixes #21290
Signed-off-by: András Szabó [email protected]