https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28901

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #11 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Paul Eggert from comment #10)
> In tzcode the problem can be worked around by using a #define rather than a
> static constant, but many C programmers nowadays prefer avoiding #define

__attribute__((unused)) should silence the warning when inappropriate.

Another alternative is to only warn if the variable is defined in the main file
(MAIN_FILE_P) as opposed to an included file.

> It'd be fine to add an option to enable the new warning, but please don't
> enable them merely because -Wall or -Wunused-variable is specified.

The problem with not adding options to at least -Wall or -Wextra is that they
will be almost never used, even if they are only noisy for a small percentage
of cases, which just may need a bit of fine-tuning or accepting some false
negatives to avoid some false positives. 

We have a lot of options that are not in Wall or Wextra just because they were
noisy in some particular cases, and it was easier to move them out of the way
than to fix them. Since they are not used, there is small motivation to ever
fix them.

Reply via email to