From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58876 invoked by alias); 2 May 2017 11:49:06 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 58858 invoked by uid 89); 2 May 2017 11:49:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=price, sk:double, sk:double-, our X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 02 May 2017 11:49:04 +0000 Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 29C7930278C7; Tue, 2 May 2017 13:49:05 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 187434000295; Tue, 2 May 2017 13:49:05 +0200 (CEST) Message-ID: <1493725744.31726.157.camel@klomp.org> Subject: Re: [PATCH] Avoid double-including config.h From: Mark Wielaard To: Ulf Hermann Cc: elfutils-devel@sourceware.org Date: Tue, 02 May 2017 21:59:00 -0000 In-Reply-To: <5ee0f1d0-f5be-29d2-6c7c-d1fcae93003c@qt.io> References: <5ee0f1d0-f5be-29d2-6c7c-d1fcae93003c@qt.io> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.12.11 (3.12.11-22.el7) Mime-Version: 1.0 X-IsSubscribed: yes X-SW-Source: 2017-q2/txt/msg00133.txt.bz2 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. >=20 > 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