Re: pg_attribute_noreturn(), MSVC, C11

From: Andres Freund <andres(at)anarazel(dot)de>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: pg_attribute_noreturn(), MSVC, C11
Date: 2024-12-15 15:53:12
Message-ID: s67xlw3h4wko4laxi53qizwctdapqfamgjz2vzjny2b4pt7tdx@4cvdfd4f2kgz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2024-12-14 18:15:13 +0100, Peter Eisentraut wrote:
> On 13.12.24 20:10, Andres Freund wrote:
> > (or alternatively include stdreturn if __STDC_VERSION__ indicates support and
> > define a bare 'noreturn' if not)
> >
> > For msvc that mean we'd need to add /std:c11 (or /std:c17) to the compiler
> > flags, as it otherwise it results in a weird mix of c89 an c99). But that
> > might be a good idea anyway. With one minor change [1] the tests pass with
> > msvc when using /std:c17.
>
> According to my notes, C11 requires MSVC 2019, and we currently require
> 2015, so this will require a bit of logic.

Yea. Not hard though:

@@ -298,6 +298,7 @@ elif host_system == 'windows'
if cc.get_id() == 'msvc'
ldflags += '/INCREMENTAL:NO'
ldflags += '/STACK:@0@'.format(cdata.get('WIN32_STACK_RLIMIT'))
+ cflags += cc.first_supported_argument('/std:c17', '/std:c11')
# ldflags += '/nxcompat' # generated by msbuild, should have it for ninja?
else
ldflags += '-Wl,--stack,@0@'.format(cdata.get('WIN32_STACK_RLIMIT'))

It's not quite the way meson wants you to do it (declare it in
default_options), but with our minimum meson version that's just a single
option, not a list...

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2024-12-15 16:15:23 Re: pg_attribute_noreturn(), MSVC, C11
Previous Message Tomas Vondra 2024-12-15 15:10:27 Re: Confine vacuum skip logic to lazy_scan_skip