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

--- Comment #13 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Paul Eggert from comment #12)
> (In reply to Manuel López-Ibáñez from comment #11)
> 
> > Another alternative is to only warn if the variable is defined in the main
> > file (MAIN_FILE_P) as opposed to an included file.
> 
> Thanks, this is a reasonable suggestion; it would fix the cry-wolf problem
> for tzcode, which is what prompted me to object to the original proposal.
> 
> The alternative of littering the code with many instances of __attribute__
> ((unused)) (or is it __attribute ((used)? I can never remember) is less
> appealing.

https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-g_t_0040code_007bunused_007d-variable-attribute-3382

unused
    This attribute, attached to a variable, means that the variable is meant to
be possibly unused. GCC does not produce a warning for this variable.

used
    This attribute, attached to a variable with static storage, means that the
variable must be emitted even if it appears that the variable is not
referenced.

(I think "used" should also silence the warning).

Reply via email to