[LLVMbugs] Compile error on 64-bit x86 Solaris

Zeljko Vrba zvrba at ifi.uio.no
Wed Oct 24 09:55:01 PDT 2007

On Wed, Oct 24, 2007 at 09:32:32AM -0700, Dale Johannesen wrote:
> Those names are in the user namespace; it is incorrect for <signal.h>
> to be defining them.  Any chance of getting your headers fixed?
Hardly.  Theoretically, you're right, but even Linux uses some names
from the user namespace:

#define unix 1
#define linux 1
#define i386 1

(dump obtained by cpp -dM; and these are just macros predefined by
the cpp; w/o any other include files).

Practically, your point is moot because system headers (unfortunately)
*do* define a bunch of additional macros in the user namespace.  Try
to compile the following program in Linux and "get the developers
to fix the headers":

#include <signal.h>
#include <ucontext.h>

int f(int NGREG)
  return NGREG + 1;

Simple gcc -c <filename.c> is sufficient.  The only difference is that on
Solaris the <ucontext.h> gets pulled in by <signal.h>.  Or just substitute
NGREG by e.g. REG_GS.

IMHO, it is a bad coding style to name variables by a widely-accepted naming
convention "reserved" (again, by convention) for macros (i.e. all capitals).

More information about the llvm-bugs mailing list