Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YOwXt-0003QY-9Q for pgsql-committers@arkaria.postgresql.org; Fri, 20 Feb 2015 22:59:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YOwXs-0005lE-N8 for pgsql-committers@arkaria.postgresql.org; Fri, 20 Feb 2015 22:59:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YOwXs-0005l8-1m for pgsql-committers@postgresql.org; Fri, 20 Feb 2015 22:59:40 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YOwXi-00048s-Or for pgsql-committers@postgresql.org; Fri, 20 Feb 2015 22:59:39 +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 t1KMxOnP021331; Fri, 20 Feb 2015 17:59:24 -0500 From: Tom Lane To: Andres Freund cc: pgsql-committers@postgresql.org, Michael Paquier Subject: Re: pgsql: Use FLEXIBLE_ARRAY_MEMBER in a bunch more places. In-reply-to: <20150220154255.GD12653@awork2.anarazel.de> References: <20150220153914.GC12653@awork2.anarazel.de> <20150220154255.GD12653@awork2.anarazel.de> Comments: In-reply-to Andres Freund message dated "Fri, 20 Feb 2015 16:42:55 +0100" Date: Fri, 20 Feb 2015 17:59:24 -0500 Message-ID: <21330.1424473164@sss.pgh.pa.us> X-Pg-Spam-Score: -2.9 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org Andres Freund writes: > Even after that I get: > /home/andres/src/postgresql/src/backend/utils/adt/tsrank.c:201:2: warning: flexible array initialization is a GNU extension > [-Wgnu-flexible-array-initializer] > {0} > ^ > /home/andres/src/postgresql/src/include/tsearch/ts_type.h:66:15: note: initialized flexible array member 'pos' is here > WordEntryPos pos[FLEXIBLE_ARRAY_MEMBER]; > ^ I cleaned that up, and also committed most of Michael's other changes. What remains is the patch that flexible-izes HeapTupleHeaderData.t_bits. I think we should do that, but I'm not happy with the widespread changes like this: - MAXALIGN(sizeof(HeapTupleHeaderData)); + MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)); I think this coding exposes much more knowledge about the innards of HeapTupleHeaderData than we really want floating around in the places that currently use sizeof(HeapTupleHeaderData). Most of them are not that excited about having an exact answer anyway, and to the extent that it does need to be exact this would not give the same result as before. A relevant technique that's been used in a lot of our code is to define an intermediate macro, along the lines of #define SizeofHeapTupleHeader offsetof(HeapTupleHeaderData, t_bits) or maybe it would better be called HeapTupleHeaderFixedSize or HeapTupleHeaderOverhead. Not sure what reads most nicely. regards, tom lane -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers