This is the mail archive of the mailing list for the elfutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Avoid double-including config.h

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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]