Re: C11 / VS 2019

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-07-01T08:31:38Z
Lists: pgsql-hackers
On 04.06.25 08:15, Peter Eisentraut wrote:
> 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.

I have committed this.



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Raise C requirement to C11

  2. meson: Move C99 test earlier

  3. Enable MSVC conforming preprocessor

  4. Make parseNodeString() C idiom compatible with Visual Studio 2015.