Re: C11 / VS 2019 - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: C11 / VS 2019
Date
Msg-id b4af1f32-f90f-4670-9598-029e99b69f31@eisentraut.org
Whole thread Raw
In response to C11 / VS 2019  (Peter Eisentraut <peter@eisentraut.org>)
List pgsql-hackers
On 03.06.25 06:51, Michael Paquier wrote:
> Dropping VS 2015 and going up to VS 2019 brings other benefits,
> __VA_ARGS__ coming in mind.

Yes, this was going to be my next step.  As we're already talking about 
it, here is my proposed patch.

For an explanation, the background is that MSVC has a "traditional" 
preprocessor and a new "conforming" one.  The latter is available 
starting in VS 2019, but it's not the default.  We have some code, 
especially around __VA_ARGS__ that specifically caters to this 
traditional preprocessor.

Turning on C11 mode in MSVC (/std:c11) automatically turns on the 
conforming preprocessor, which would currently break compilation on MSVC 
because the code expects it to be in traditional mode.

So my first patch is that we fix that bit and turn on just the 
conforming preprocessor (/Zc:preprocessor), without turning on C11 yet. 
That way, we get that part out of the way, and we update the 
documentation about requiring VS 2019.  (And we'd flush out anyone who 
might still be running pre-VS-2019 build jobs somewhere.)  Later, when 
we turn on C11, we can remove the explicit /Zc:preprocessor option again.

(An alternative approach would be to turn on C11 and add another option 
to explicitly turn the traditional preprocessor back on, but that seems 
pointless, and the documentation also suggests that that combination is 
not well supported.)

So the attached patch is my proposal to commit early in PG19.

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Add --system-identifier / -s option to pg_resetwal
Next
From: Peter Eisentraut
Date:
Subject: Re: C11 / VS 2019