This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [PATCH] Avoid double-including config.h
- From: Mark Wielaard <mark at klomp dot org>
- To: Ulf Hermann <ulf dot hermann at qt dot io>
- Cc: elfutils-devel at sourceware dot org
- Date: Tue, 02 May 2017 13:49:04 +0200
- Subject: Re: [PATCH] Avoid double-including config.h
- Authentication-results: sourceware.org; auth=none
- References: <5ee0f1d0-f5be-29d2-6c7c-d1fcae93003c@qt.io>
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
already).
Applied to master.
Thanks,
Mark