[antlr-interest] [C target] #define clashes: would it be possible to add ANTLR_ prefix to automatically generated macros?

Florent Teichteil florent.teichteil at gmail.com
Fri Aug 1 15:25:36 PDT 2008


Hi,

I have been using ANTLR C target with success for several months...
until I included a file from the BOOST C++ library set.

One of my ANTLR rule is DOMAIN.
ANTLR lexer (C target) automatically generates the macro "#define DOMAIN 4".
I include a BOOST header file (for hashtable support) after the lexer
header file. Then, I am not able to parse the DOMAIN rule because
BOOST redefines it to 1!

I think BOOST should prefix its macros, but it would be safer if ANTLR
added some prefix to macros it generates in header files.

What do you think about it?

Best,
Florent Teichteil


More information about the antlr-interest mailing list