-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Build] Stricter compiler warning settings #29209
Comments
It looks like
-Wunused-parameter we would want some way to annotate "this method uses none of its parameters".
|
@bzbarsky-apple wow, thanks for the detailed response! you are correct, |
* Fixes project-chip#29216 * Fixes project-chip#29209
* Fixes project-chip#29216 * Fixes project-chip#29209
Build issue(s)
It's not a bug as such, rather a suggestion/discussion. I'm a relative newcomer to the project, currently busy integrating CHIP/Matter support into our product line. In our environment we build with stricter compiler warnings, so I had to adapt.
In my opinion, some of them might be useful tot he project (and as an added benefit to us, we won't have to suppress warnings and patch sources). We compile with
-Wextra
, but specifically I am talking about:-Wundef
- I find it extremely useful. I actually got most of the CHIP to compile with-Wundef
with only a minor change (Convert if __ZEPHYR__ to if defined(__ZEPHYR__) #29172). It helped me a lot during porting, since it exposed the macros I had to define, instead of just assuming false value. I think any project would benefit from-Wundef
. For example, it exposed a minor bug.-Wunused-parameter
- I find it helpful to have compiler remind that an argument passed to a function is not used. Sometimes it leads to reconsidering the function signature to get rid of the paramter, and in legitimate cases it can be be easily cast to void or annotated with__attribute__((unused))
(usually via a macro).My proposal is thus to use
-Wextra
, at least for core components (as of today it already works, at least with clang-15), or at least add-Wundef
which seems to be clearly useful.-Wunused-parameter
is debatable but also a nice-to-have, in my opinion.Platform
all
Anything else?
No response
The text was updated successfully, but these errors were encountered: