[PATCH] Avoid double-including config.h

Mark Wielaard mark@klomp.org
Tue May 2 21:59:00 GMT 2017

On Thu, 2017-04-20 at 16:31 +0200, Ulf Hermann wrote:
> config.h doesn't have include guards, so including it twice is bad. We
> deal with this by checking for PACKAGE_NAME, but only in some places.
> Once we start using gnulib, we will need to include config.h before any
> gnulib-generated headers. This is problematic if we include it
> transitively through our own private headers.
> In order to set a clear rule about inclusion of config.h, it is now
> included in every .c file as first header, but not in any header. This
> will definitely avoid double-inclusion and satisfy the condition that it
> has to be included before gnulib headers. It comes at the price of
> adding some redundancy, but there is no clean way to avoid this.

It seems a clear rule that is easy to follow. The only exceptions are
the crc32.c file which gets included itself and the
linux-kernel-modules.c which needs the ugly BAD_FTS check before
config.h (which your patch both handles). Maybe we can cleanup that last
one once we integrate gnulib (which I believe has a good/64-off_t fts.h

Applied to master.



More information about the Elfutils-devel mailing list