Re: pgbench is broken on strict-C89 compilers

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pgbench is broken on strict-C89 compilers
Date: 2014-05-18 05:59:08
Message-ID: 20140518055908.GT23662@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-05-18 00:36:34 -0400, Tom Lane wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > On 2014-05-17 19:15:15 -0400, Tom Lane wrote:
> >> ... It appears to me that
> >> the compiler is within its rights to refuse a nonconstant expression
> >> for an inner initializer according to C89, though I don't see any such
> >> restriction in C99.
>
> > Yea, I've complained about it in
> > http://www.postgresql.org/message-id/20140403152834.GG17307@awork2.anarazel.de
>
> Ah. I'd sort of ignored that patch because it didn't seem too relevant
> to the issues we were discussing at the time.

Well, I wanted to start a animal that quickly warns about the nameless
union stuff. That'd require a sensibly clean build.

> > That piece code is also confused about using static vs. const. For a lot
> > longer though...
>
> Well, "static" is also a good thing here because it eliminates the need
> for runtime initialization of a function-local array variable. But yeah,
> the code is way under-const-ified as well.

Well, const alone would do that too; without requiring checks on every
function invocation. The const variant should end up in the readonly
part of the binary...

> > I'd just duplicated the ddl structs. Seemed to be the least ugly thing I
> > could come up with. For from pretty tho.
>
> It works, anyway. If I don't think of something better, I'll do a bit
> more polishing and commit that tomorrow.

Ok, thanks.

Greetings,

Andres Freund

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-05-18 06:34:59 Re: btree_gist macaddr valgrind woes
Previous Message Andres Freund 2014-05-18 05:55:48 Re: Possible fix for occasional failures on castoroides etc