Re: C11 / VS 2019

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: C11 / VS 2019
Date: 2025-07-29 12:57:07
Message-ID: 870393.1753793827@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Rowley <dgrowleyml(at)gmail(dot)com> writes:
> On Fri, 18 Jul 2025 at 23:12, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>> Note that gcc and clang switched to C11 by default a long time ago
>> (gcc-5 and clang-3.6), so for most users all these tests won't need to
>> do anything. If you want to test it, you could simulate an older
>> default like
>> ./configure CC='gcc -std=c99'

> On Linux, doing a bit more testing using meson and clang, I tried with
> CC=clang CFLAGS=-std=c99 . I get:

Note that that's not what Peter suggested. That leads to

> FAILED: src/backend/parser/parser.a.p/meson-generated_.._gram.c.o
> clang -Isrc/backend/parser/parser.a.p -Isrc/backend/parser
> -I../src/backend/parser -Isrc/include -I../src/include
> -I/usr/include/libxml2 -fdiagnostics-color=always
> -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O2 -g -std=gnu11
^^^^^^^^^^
> -fno-strict-aliasing -fwrapv -fexcess-precision=standard -D_GNU_SOURCE
> -Wmissing-prototypes -Wpointer-arith -Werror=vla
> -Werror=unguarded-availability-new -Wendif-labels
> -Wmissing-format-attribute -Wcast-function-type -Wformat-security
> -Wdeclaration-after-statement -Wmissing-variable-declarations
> -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro
> -Wno-format-truncation -Wno-cast-function-type-strict -std=c99 -fPIC
^^^^^^^^
> -pthread -DBUILDING_DLL -MD -MQ
> src/backend/parser/parser.a.p/meson-generated_.._gram.c.o -MF
> src/backend/parser/parser.a.p/meson-generated_.._gram.c.o.d -o
> src/backend/parser/parser.a.p/meson-generated_.._gram.c.o -c
> src/backend/parser/gram.c

Apparently we are not being too consistent about the order of
user-specified CFLAGS versus ones added by configuration?
The configuration test must have put the user CFLAGS first.

> Strangely, if I swap the order of the c11_test_args so the test tries
> and uses -std=c11 first, it works ok.

That is indeed weird.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-07-29 13:06:40 Re: Compilation error with buildtype = release
Previous Message vignesh C 2025-07-29 12:55:28 Re: 024_add_drop_pub.pl might fail due to deadlock