Re: pgsql: Add support for coordinating record typmods among parallel worke

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Add support for coordinating record typmods among parallel worke
Date: 2017-09-15 04:34:10
Message-ID: CAEepm=13KfNVsjzvdz_u4E_3_joAWfL+k6TNaFkr-=WTT_Ou=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Fri, Sep 15, 2017 at 3:45 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)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

Attachment Content-Type Size
0001-Don-t-redefine-typedefs-or-use-anonymous-unions.patch application/octet-stream 4.2 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2017-09-15 04:42:50 Re: pgsql: Add support for coordinating record typmods among parallel worke
Previous Message Tom Lane 2017-09-15 04:29:48 Re: pgsql: Add support for coordinating record typmods among parallel worke

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2017-09-15 04:42:50 Re: pgsql: Add support for coordinating record typmods among parallel worke
Previous Message Tom Lane 2017-09-15 04:29:48 Re: pgsql: Add support for coordinating record typmods among parallel worke