Re: [COMMITTERS] pgsql: Add support for coordinating record typmodsamong parallel worke - Mailing list pgsql-committers

From Thomas Munro
Subject Re: [COMMITTERS] pgsql: Add support for coordinating record typmodsamong parallel worke
Date
Msg-id CAEepm=13KfNVsjzvdz_u4E_3_joAWfL+k6TNaFkr-=WTT_Ou=A@mail.gmail.com
Whole thread Raw
In response to Re: [COMMITTERS] pgsql: Add support for coordinating record typmods among parallel worke  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [COMMITTERS] pgsql: Add support for coordinating record typmodsamong parallel worke  (Thomas Munro <thomas.munro@enterprisedb.com>)
Re: [COMMITTERS] pgsql: Add support for coordinating record typmods among parallel worke  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-committers
On Fri, Sep 15, 2017 at 3:45 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Thomas Munro <thomas.munro@enterprisedb.com> writes:
>> My compiler, C++ and more recent C standards are OK with identical
>> redefinition of a typedef like that, but not the older standards or
>> those particular compilers.  D'oh.  (I should figure out how to make
>> my automatic patch tester this fussy).  I think we should probably
>> just do this:
>
> Our usual locution for this sort of thing is to use
> "struct SharedRecordTypmodRegistry" in headers instead of
> the typedef name, if we don't want to pull in the header
> where the typedef is defined.  It might be all right to do
> what you suggest, but we've been burnt in the past by circular
> dependencies and/or pulling some header into essentially
> the entire build (which tends to lead to a mess down the road).
> I'd generally lean in the direction of not adding #includes to
> header files except where absolutely necessary.

Here's a version that just forward declares SharedRecordTypmodRegistry
in session.h (but keeps the typedef in typcache.h where it is useful
for shorter function prototypes).  Neither GCC 6 -Wall -std=c89 not
Clang -Wall -std=c89 complained about this problem.  I found an old
GCC 4.3 compiler and it complained about the typedef redefinition and
also the use of an anonymous union, also fixed in the attached.  Sorry
about that -- clearly I need to test my patches on more compilers in
future.

-- 
Thomas Munro
http://www.enterprisedb.com

-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

Attachment

pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql: Add support for coordinating record typmods among parallel worke
Next
From: Thomas Munro
Date:
Subject: Re: [COMMITTERS] pgsql: Add support for coordinating record typmodsamong parallel worke