Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fVLEa-0001y6-Lw for pgsql-committers@arkaria.postgresql.org; Tue, 19 Jun 2018 18:20:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fVLEZ-0003C8-9B for pgsql-committers@arkaria.postgresql.org; Tue, 19 Jun 2018 18:20:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fVLEZ-0003By-4a for pgsql-committers@lists.postgresql.org; Tue, 19 Jun 2018 18:20:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fVLEW-0001C5-B6 for pgsql-committers@lists.postgresql.org; Tue, 19 Jun 2018 18:20:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w5JIJur5002504; Tue, 19 Jun 2018 14:19:56 -0400 From: Tom Lane To: Andres Freund cc: Bruce Momjian , Stephen Frost , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Fix for globals.c- c.h must come first In-reply-to: <20180619181526.sherq6nnxdtvjvhl@alap3.anarazel.de> References: <20180619175834.GE3637@momjian.us> <1904.1529431755@sss.pgh.pa.us> <20180619181526.sherq6nnxdtvjvhl@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Tue, 19 Jun 2018 11:15:26 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2502.1529432396.1@sss.pgh.pa.us> Date: Tue, 19 Jun 2018 14:19:56 -0400 Message-ID: <2503.1529432396@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2018-06-19 14:09:15 -0400, Tom Lane wrote: >> Hm. You could imagine adding something like >> >> #ifdef some-relevant-macro >> #error include ordering problem, c.h must come before system headers >> #endif >> >> near the head of c.h. But I'm not sure how we'd get full coverage. >> The case presumably would only occur for off-the-beaten-path headers >> (this particular mistake was ), and there are lots of those. > If we were ok with doing this in a very platform specific manner, we > probably could make the dependency fairly generic. I.e. glibc IIRC will > pretty much always end up including features.h, so we could check for > that (#ifdef _FEATURES_H). I'd suspect other C libraries have similar > things. It'd probably be good enough if the error detection worked with glibc's headers. Even if nobody noticed before a particular patch went in, the buildfarm would surely find it. regards, tom lane