[arch-general] problem with gcc and __unused function attribute

Michael Krauss hippodriver at gmx.net
Sat May 17 13:08:37 EDT 2008


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 at 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




More information about the arch-general mailing list