[arch-general] problem with gcc and __unused function attribute
Hello, dma is now running on Arch Linux but I found one odd thing: There is this function in net.c: static void sig_alarm(int signo __unused) { longjmp(timeout_alarm, 1); } ggc can't handle the __unused attribute: [mickraus@gandalf dma]\$ LANG=us gcc -DHAVE_CRYPTO -o dma dma.c conf.c crypto.c lex.yy.c y.tab.c net.c base64.c -lssl net.c:68: error: expected ';', ',' or ')' before '__unused' net.c: In function 'read_remote': net.c:105: error: 'sig_alarm' undeclared (first use in this function) net.c:105: error: (Each undeclared identifier is reported only once net.c:105: error: for each function it appears in.) After removing the attribute everything works. But in the gcc manual exactly this attribute is listed: http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Function-Attributes.html The original net.c file can be found here: http://opengrok.creo.hu/dragonfly/xref/src/libexec/dma/net.c To compile it on linux you have to include two additional headers: #ifdef __linux #include <stdarg.h> #include <err.h> #endif /* __linux */ Is there a compiler switch that I have overlooked? Kind Regards Michael Krauss
On Sat, May 17, 2008 at 05:08:37PM +0000, Michael Krauss wrote:
There is this function in net.c:
static void sig_alarm(int signo __unused) { longjmp(timeout_alarm, 1); }
ggc can't handle the __unused attribute:
gcc can handle an unused variable attribute, but a different syntax is used: static void sig_alarm(int signo __attribute__((unused))) { longjmp(timeout_alarm, 1); } -- Byron Clark
participants (2)
-
Byron Clark
-
Michael Krauss