bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

config.h double inclusion


From: Alfred M. Szmidt
Subject: config.h double inclusion
Date: Thu, 16 Jun 2011 13:36:58 -0400

Hey,

in inetutils we have a problem of where sometimes <config.h> is
included twice, but gnulib redefines a macro that was already
specified in <config.h>, for example gnulib:lib/argp.h:

 #include <config.h> -- 
 
   #define HAVE_DECL_PROGRAM_INVOCATION_NAME 0
   #define GNULIB_PROGRAM_INVOCATION_NAME 1
 ...
 #include <argp.h> -- 
 
   #ifdef GNULIB_PROGRAM_INVOCATION_NAME
   extern char *program_invocation_name;
   # undef HAVE_DECL_PROGRAM_INVOCATION_NAME
   # define HAVE_DECL_PROGRAM_INVOCATION_NAME 1
   #endif

Which ends up redefining HAVE_DECL_PROGRAM_INVOCATION_NAME to 1; all
good so far since program_invocation_name is provided by gnulib.
 
A bit later, we do:

  #include <libinetutils.h>

which will cause warnings like:

  ../config.h:561:1: warning "HAVE_DECL_PROGRAM_INVOCATION_NAME" redefined
  In file included from syslogd.c:100:
  ../lib/argp.h:431:1: warning: this is the location of the previous definition

I'm thinking that maybe <config.h> should be generated with a double
inclusion guard (#ifndef CONFIG_H, #define CONFIG_H, ..., #endif)?  It
is easy enough to do it on a per project basis, but I see now reason
why this isn't the default.  Thoughts?

Cheers, Alfred.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]