Re: jsonb is also breaking the rule against nameless unions

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: jsonb is also breaking the rule against nameless unions
Date: 2014-04-02 18:43:20
Message-ID: 20140402184320.GS3750@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-04-02 14:36:28 -0400, Tom Lane wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > On 2014-04-02 15:17:16 -0300, Alvaro Herrera wrote:
> >> Tom Lane wrote:
> >>> We really need to get a buildfarm member going that complains about this.
>
> >> Complain how? I find that gcc -std=c90 -pedantic emits these warnings about
> >> it:
> >> def.c:3:24: warning: ISO C90 doesn’t support unnamed structs/unions [-pedantic]
> >> def.c:1:8: warning: struct has no named members [-pedantic]
>
> > Last time I checked gcc builds of postgres using -pedantic are so
> > verbose that warnings don't have an effect anymore. Is that not the case
> > anymore?
>
> Well, in any case, people very seldom check to see if any buildfarm
> members are producing compiler warnings. You need the build to actually
> go red to get anyone's attention reliably.

Yea, we'd need to be able to turn on -Werror if it's going to have any
effect. I don't think our configure currently copes with that
unfortunately...

I just tried it on clang. It builds clean with -Wc11-extensions except
warning about _Static_assert(). That's possibly fixable with some
autoconf trickery.

> The non-C89 feature that I've been really worried about is flexible
> array members (which we intend to start using more heavily, so we need
> a complaint if someone leaves out the FLEXIBLE_ARRAY_MEMBER macro).
> Based on the last month or so I guess that anonymous unions are a big
> issue as well. I'd like to have a buildfarm member whose compiler
> doesn't recognize either of those ... and AFAICT, -pedantic is no
> help for the array case.

gcc's -pedantic warns about flexible array members here, but it doesn't
solve the problem with it being unusable :(

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-04-02 19:03:47 Re: jsonb is also breaking the rule against nameless unions
Previous Message Tom Lane 2014-04-02 18:42:39 Re: jsonb is also breaking the rule against nameless unions