Re: pgsql: Add configure infrastructure to detect support for C99's restric

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Add configure infrastructure to detect support for C99's restric
Date: 2017-10-12 17:45:44
Message-ID: 20171012174544.53kwdeyrt4id7hgg@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 2017-10-12 11:30:00 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > I've temporarily silenced that error by moving the stdlib.h include
> > before the definition of restrict, but that seems fairly fragile. I
> > primarily wanted to see whether there's other problems. At least thrips
> > is is now happy.
>
> > I see a number of options to continue:
> > - only define restrict on msvc 2013+ - for some reason woodlouse didn't
> > complain about this problem, but I'm very doubtful that that's
> > actually reliable.
> > - rename restrict to pg_restrict. That's annoying because we'd have to
> > copy the autoconf test.
> > - live with the hack of including stdlib.h early, in pg_config.h.win32.
> > - $better_idea
>
> I don't actually see why you need a #define at all --- "restrict" is the
> standard spelling of the keyword no?

It is, but a lot of compilers name it differently, e.g. __restrict in
the case of msvc.

> I really do not like the stdlib.h hack: that amounts to assuming that
> only stdlib.h does or ever will contain declspec(restrict). Maybe
> you could get away with that if you were applying it only to long-dead
> MSVC versions, but doing it "#if (_MSC_VER >= 1500)" is clearly going
> to break someday.

Yea, I dislike it quite a bit too. Unfortunately not even defining
restrict to empty as if it were unsupported looks viable to me :(

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2017-10-12 17:55:07 Re: pgsql: Add configure infrastructure to detect support for C99's restric
Previous Message Tom Lane 2017-10-12 17:03:59 Re: [HACKERS] pgsql: Add port/strnlen support to libpq and ecpg Makefiles.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-10-12 17:55:07 Re: pgsql: Add configure infrastructure to detect support for C99's restric
Previous Message Tom Lane 2017-10-12 17:44:25 Re: How does postgres store the join predicate for a relation in a given query