_GNU_SOURCE placement

Baurjan Ismagulov ibr@ata.cs.hun.edu.tr
Mon Nov 25 07:35:00 GMT 2002


Hello,

I need to use sighandler_t in my program. Why does the following code
compile:
#define _GNU_SOURCE
#include <signal.h>
#include <locale.h>
sighandler_t a;

and the following does not:
#include <locale.h>
#define _GNU_SOURCE
#include <signal.h>
sighandler_t a;

"gcc -c signal2.c" output:
signal2.c:4: parse error before `a'
signal2.c:4: warning: data definition has no type or storage class

I've checked cpp output, it really doesn't contain "typedef
__sighandler_t sighandler_t;". However, if I compile via "gcc -c
-D_GNU_SOURCE signal2.c", it complains about redefinition, but generates
the object file.

What is the problem?

I've searched google, gcc and gcc-help archives, but couldn't find how
to solve this problem. I would be very grateful for any help.

I'm running Debian sid on an i386-pc-linux-gnu. I've tried both 2.95 and
3.2.1.
ii  cpp-2.95       2.95.4-15      The GNU C preprocessor.
ii  cpp-3.2        3.2.1-0pre6    The GNU C preprocessor.
ii  gcc-2.95       2.95.4-15      The GNU C compiler.
ii  gcc-3.2        3.2.1-0pre6    The GNU C compiler.
ii  libc6-dev      2.3.1-3        GNU C Library: Development Libraries

Thanks in advance,
Baurjan.



More information about the Gcc-help mailing list