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 1fVLAH-0001f8-Je for pgsql-committers@arkaria.postgresql.org; Tue, 19 Jun 2018 18:15:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fVLAF-0002ep-PG for pgsql-committers@arkaria.postgresql.org; Tue, 19 Jun 2018 18:15:35 +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 1fVLAF-0002eg-KB for pgsql-committers@lists.postgresql.org; Tue, 19 Jun 2018 18:15:35 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fVLAA-00019d-1R for pgsql-committers@lists.postgresql.org; Tue, 19 Jun 2018 18:15:35 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id EA0CF21B6A; Tue, 19 Jun 2018 14:15:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 19 Jun 2018 14:15:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=vHqXE2/ONXYWpMKOmy1n/6Si8bpDSWWlSQKDdKmixLQ=; b=tS9ROFjA YPOyZ6Ai+rH/6TBfR2+ANux62un7EakKbGegcIrMs4u4v/6BJjbhIaGfLSM7Q1Wr 5T+9a2ZsA6GkjYl0kGaDXIoeAfuWeXhRV+myLs5UwScSoVrSTleV9eA1dEcFghee efti1t3KtUpOcQQwgrgpzx70TV2C/itbjApZ/Y3CLqCLCCPASf0B7eF3MSov5xW+ YWj0m56BwxriyQCRk2Eb0+0reEnAq82g1bhBS4EOJCRqf9cOlAT94Lo+Yj4Kv436 RkdgaRs+xMb8GSI+88cP0aBztF5Oqd/3uTwu1aD07+6ufk5hzLYQGrM8UvISw/wi u+M9nkaLtZcX9A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=vHqXE2/ONXYWpMKOmy1n/6Si8bpDS WWlSQKDdKmixLQ=; b=ad9a1SAH81TUzQC3OtwG85c+SaPN0dJEUjVTwCBdq1MSO 7lgSByt/ogrlKShoga44Y2YeefQZp8dfQ5KyQ5hCNZs171qbIfspdNhRjW48r0T8 +yAtggc8tNYMimjGb3ZZNO9dTOAsVbz7nkOT2qYBIizgDs8JeUD9L4yACyrb00m5 WLTH/mnkgkUelmlK7YgITqJx50wgjMz6LRRxePa2BlHhb4xF8lLKIkqRgHt5HlDr 1QQ0PF/IHZZ0/ZwS3MD/OM+cUInaUby0+sRVs7/ScGJCdCDqK6wAiyw7pbXlYyZR 70XepU1PAW2/h5D51BKUWwnXRB/E4N4r/3CjNcN2A== X-ME-Proxy: X-ME-Sender: Received: from intern.anarazel.de (c-98-210-140-171.hsd1.ca.comcast.net [98.210.140.171]) by mail.messagingengine.com (Postfix) with ESMTPA id 74B9CE443C; Tue, 19 Jun 2018 14:15:27 -0400 (EDT) Date: Tue, 19 Jun 2018 11:15:26 -0700 From: Andres Freund To: Tom Lane Cc: Bruce Momjian , Stephen Frost , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Fix for globals.c- c.h must come first Message-ID: <20180619181526.sherq6nnxdtvjvhl@alap3.anarazel.de> References: <20180619175834.GE3637@momjian.us> <1904.1529431755@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1904.1529431755@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018-06-19 14:09:15 -0400, Tom Lane wrote: > Bruce Momjian writes: > > On Sat, May 19, 2018 at 01:20:47AM +0000, Stephen Frost wrote: > >> Commit da9b580 mistakenly put a system header before postgres.h (which > >> includes c.h). That can cause portability issues and broke (at least) > >> builds with older Windows compilers. > > > I assume there is no way to add defined and checks to globals.c and c.h > > to cause a compile error when this happens. > > 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. Greetings, Andres Freund