[antlr-interest] Macro redefinition warnings from libantlr3c headers

Jim Idle jimi at temporal-wave.com
Thu Mar 4 11:08:55 PST 2010


I'll look at it. I did not want to include it in the C files as it makes them messy with #ifdef UNIX and so on.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Christopher L Conway
> Sent: Thursday, March 04, 2010 10:43 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Macro redefinition warnings from libantlr3c
> headers
> 
> I'm getting a lot of compiler warnings like the following when I
> compile against libantlr3c:
> 
> In file included from
> /home/chris/Tools/builds/libantlr3c/include/antlr3defs.h:217,
>                  from
> /home/chris/Tools/builds/libantlr3c/include/antlr3.h:33,
> ...
> /home/chris/Tools/builds/libantlr3c/include/antlr3config.h:92:1:
> warning: "PACKAGE" redefined
> 
> and so on for PACKAGE_BUGREPORT, PACKAGE_NAME, etc.
> 
> Apparently, this is due to Automake-generated symbols being exported
> in the public header files (we use Automake too, so we have the same
> symbols in our project). There's some information about errors like
> these in this StackOverflow question:
>     http://stackoverflow.com/questions/7398/how-to-avoid-redefining-
> version-package-etc
> 
> I'm not sure what the best fix for this is. There are at least two
> options:
> 
> 1. Rename antlr3config.h to config.h. I believe this will cause the
> #include in antlr3defs.h to pick up my project's config.h, which may
> or may not be a problem. I can confirm that this change makes the
> compiler warnings disappear.
> 
> 2. Make sure antlr3config.h in only #include'd from .c files, maybe by
> breaking antlr3defs.h into a public and private portion.
> 
> This is a minor thing, but it's apt to make my colleagues grouchy
> about adopting ANTLR3 (they like a clean build ;-)...
> 
> Regards,
> Chris
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address





More information about the antlr-interest mailing list