Enable unused parameter warning. Fix warnings.#1501
Enable unused parameter warning. Fix warnings.#1501Riksu9000 merged 1 commit intoInfiniTimeOrg:developfrom Riksu9000:warn-unused-parameter
Conversation
|
|
||
|
|
||
| set(COMMON_FLAGS -MP -MD -mthumb -mabi=aapcs -ftree-vrp -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin -fshort-enums -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fstack-usage -fno-exceptions -fno-non-call-exceptions) | ||
| set(WARNING_FLAGS -Wall -Wextra -Warray-bounds=2 -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wformat-nonliteral -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unknown-pragmas -Wno-expansion-to-defined -Wreturn-type -Werror=return-type) |
There was a problem hiding this comment.
What do you mean? Is there a problem with enabling the warning?
There was a problem hiding this comment.
I think there are places where it generated a lot of noise, e.g. in NimBLE bindings, does it not?
There was a problem hiding this comment.
I think it did, which is why I added the SYSTEM option when including directories from external projects, which quiets warnings that don't come from our code.
JF002
left a comment
There was a problem hiding this comment.
DebugPins was removed, since it's not used anywhere and was causing a warning.
Right! I used them when I was mostly working on a devboard, but I don't use this class anymore, and I doubt anyone does.
They can also cause bugs, like in the case of MotionService.
Oof! Good catch!
I think this is a good idea to explictly ignore parameters like you did in this PR, and the other code cleanings are more than welcome, thanks!
Fix warnings. Some clang-formatting was necessary. DebugPins is unused and was removed.
Unused parameters make the code confusing and intimidating. They can also cause bugs, like in the case of MotionService.
MotionService::OnNewMotionValues(x, y, z)is called before updating the values inside MotionController, but these parameters are ignored, instead using the values fromMotionController, which haven't been updated yet.DebugPins was removed, since it's not used anywhere and was causing a warning.
Include directories from other projects were marked
SYSTEM, to suppress their warnings.