[Bug c/28901] -Wunused-variable ignores unused const initialised variables

gang.chen.5i5j at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Jan 28 22:36:00 GMT 2016


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

--- Comment #22 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
(In reply to Mark Wielaard from comment #21)

[...]

> Although in C a static const is not really like a #define I suspect that
> there are cases where they are used as such in header files. If that is the
> major reason for why there are people opposed to the warning then what we
> could do is hide such (non-)usage of static const variables from header
> files behind -Wextra and only explicitly warn for static const variable
> defined (and then not used) in the main file.
> 

For me, what you said above sounds reasonable. :-)


More information about the Gcc-bugs mailing list