Unused warning
Eric Lemings
lemings@roguewave.com
Wed Feb 7 18:34:00 GMT 2007
Greetings,
Given the following:
[lemings@flame gcc]$ gcc --version
gcc (GCC) 3.4.4 20050721 (Red Hat 3.4.4-2)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
[lemings@flame gcc]$ g++ --version
g++ (GCC) 3.4.4 20050721 (Red Hat 3.4.4-2)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
[lemings@flame gcc]$ cat test03.c
const char* __attribute__((unused)) s1;
static const char* __attribute__((unused)) s2;
[lemings@flame gcc]$ diff test03.c test04.cpp
[lemings@flame gcc]$ make test03.o
gcc -g -Wall -c -o test03.o test03.c
[lemings@flame gcc]$ make test04.o
g++ -g -Wall -c -o test04.o test04.cpp
test04.cpp:3: warning: 's2' defined but not used
How do I silence the warning? The __attribute__((unused)) qualifier
doesn't seem to work.
Thanks,
Eric.
More information about the Gcc-help
mailing list