This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Andrew Pinski from comment #3)
> From the code:
>        /* We don't warn about "static const" variables because the
> 	  "rcs_id" idiom uses that construction.  */

That is not a good reason not to warn:

[hjl@gnu-mic-2 gcc]$ cat /tmp/w.c
static const int foo[0x1000];
[hjl@gnu-mic-2 gcc]$ gcc  -Wall -S /tmp/w.c
[hjl@gnu-mic-2 gcc]$ cat w.s
    .file    "w.c"
    .local    foo
    .comm    foo,16384,32
    .ident    "GCC: (GNU) 4.8.2 20140115 (Red Hat 4.8.2-11)"
    .section    .note.GNU-stack,"",@progbits
[hjl@gnu-mic-2 gcc]$ 

If we want to avoid rcs_id warning, we can check it explicitly and
not to warn it.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]