RFC: architecture define probably masks variable names in header files

Christian Thalinger twisti at complang.tuwien.ac.at
Wed Jan 16 22:04:46 UTC 2008


Today I noticed that it's not a good idea to use an architecture define
as done in OpenJDK:


The -D$(ARCH) e.g. on an Alpha system makes big problems because a lot
of variables are called "alpha" in GUI code.

I tried to patch the OpenJDK code in IcedTea but then I reached a point
where it's not possible to fix the issue:


typedef struct png_color_8_struct
   png_byte red;   /* for use in red green blue files */
   png_byte green;
   png_byte blue;
   png_byte gray;  /* for use in grayscale files */
   png_byte alpha; /* for alpha channel files */
} png_color_8;

This won't work.

Normally build systems use architecture defines as __ALPHA__ or
__alpha__ (these are also defined by the C compiler).

Any chance to get this thing changed/fixed upstream in the OpenJDK code?
As I can't think of another solution of that problem...

Probably someone decides to name a function argument "sparc"
someday... ;-)

- twisti

More information about the build-dev mailing list