Is there interest to get rid of `-Wno-unused-parameter` warning suppression?
Hi there,
So, I did the above experiment for myself and there are lots of places which need to be fixed. However, the warnings also revealed few places with potential issues/bugs and I've opened issues here about them. You can find them by my user, I guess. Everything else seems to be purely mechanical work and I can do it if there is a desire for this. I just believe that warning suppression is bad because the warnings sometimes point to real issues/bugs and we should use any help from the compiler and the other tools to catch bugs as early as possible (preferably at compile time, instead at runtime). If there is a desire for this it needs to be decided how you want the changes. I mean that in the project currently there are 5 types of suppressing this warning:
ATS_UNUSEDafter the parameter name Drawbacks of this solution:
tscore/ink_defs.hneeds to be included in order of the above macro to be visible- it's easy to forget to remove this tag if the parameter becomes used in the future and this potentially may confuse some readers of the code
/* <parameter-name> ATS_UNUSED */or just/* <parameter-name> */Drawbacks of this solution:
- the solution which includes
ATS_UNUSEDin the commented part become a bit longer and too much (IMO) but is probably better for the readers?
[[maybe_unused]]Drawbacks of this solution:
- it's easy to forget to remove this attribute if the parameter becomes used in the future and this potentially may confuse some readers of the code
(void)<parameter-name>at the beginning of the function body Drawbacks of this solution:
- it's easy to forget to remove this suppression if the parameter becomes used in the future and the function is longer and this potentially may confuse some readers of the code
- the unused parameters are not visible from the function signature
- this way of changing will require more manual work compared to some of the above solutions.
- Just removing the name of the parameter Drawbacks of this solution:
- it becomes unclear in some cases what this parameter is supposed to be
Note that all of the above are currently used in the ATS code as far as I checked. The 5-th way is probably the least used but there are few places still. I'd personally go with 1, 2 or 3 and I'm leaning towards 2.
I just believe that warning suppression is bad because the warnings sometimes point to real issues/bugs and we should use any help from the compiler and the other tools to catch bugs as early as possible (preferably at compile time, instead at runtime).
I completely agree. And I feel like many of the inline suppressions in the ATS codebase are unnecessary (could be avoided), although some places may really need it.
If the suppression is necessary, I'd go with the standard way, maybe_unused attribute, because it potentially helps code analyzers and other tools. But it's just my opinion.
It'd be great if you could make Pull-Requests for this. There may be places that are debatable, and you may see some pushbacks but having Pull-Requests would be still nice. The only place I don't want you to touch for this is lib/, because it has third-party libraries.