Re: how to deal with variable set but not used warnings?

From: Matthew Macy <mat.macy_at_gmail.com>
Date: Sun, 3 Jun 2018 14:43:47 -0700
On Sun, Jun 3, 2018 at 2:40 PM, Theron <theron.tarigo_at_gmail.com> wrote:
>> 4. Disable the stupid warning in the Makefile / build system. If you don't
>> care, and there's a good reason for what you are doing (sounds like there
>> is), better to just disable the warning as so much useless noise.
>>
>> Warner
>> _______________________________________________
>> freebsd-current_at_freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-current
>> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
>
> Or possibly, alongside a comment as in (3), use one of these:
> 5 - Disable warning pragma -
> http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html
> 6 - Use __attribute__((unused)) -
> https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#Common-Variable-Attributes


There is already an __unused alias for #6. It's what I've used to
annotate variables that are only used by INVARIANTS builds. It
legitimately finds a bunch of dead code. However, 90+% of the
instances of the warning are not interesting.
-M
Received on Sun Jun 03 2018 - 19:43:49 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:16 UTC