Re: C11 / VS 2019 - Mailing list pgsql-hackers
From | David Rowley |
---|---|
Subject | Re: C11 / VS 2019 |
Date | |
Msg-id | CAApHDvq4jWB=zE8J27vY0+vQtAdiSRjtqYhTpJdgT+86k91_8g@mail.gmail.com Whole thread Raw |
In response to | Re: C11 / VS 2019 (Peter Eisentraut <peter@eisentraut.org>) |
Responses |
Re: C11 / VS 2019
Re: C11 / VS 2019 |
List | pgsql-hackers |
On Fri, 18 Jul 2025 at 23:12, Peter Eisentraut <peter@eisentraut.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' > > and then the test should decide that it needs to add another option to > override the C mode. This isn't quite my area of expertise, but I've been reviewing the patch and testing. I don't see any issues with VS2022. On Linux, doing a bit more testing using meson and clang, I tried with CC=clang CFLAGS=-std=c99 . I get: Checking if "C11" compiles: NO Checking if "C11 with -std=gnu11" compiles: YES But later: 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 ../src/backend/parser/gram.y:19362:12: error: call to undeclared function 'typeof'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 19362 | result = copyObject(p->argType); It's not quite clear to me why the C11 test passes but then the build fails. I assumed the mixed -std=gnu11 then -std=c99 are passed in the test as well. I don't know how to check. Strangely, if I swap the order of the c11_test_args so the test tries and uses -std=c11 first, it works ok. @@ -558,7 +558,7 @@ if not cc.compiles(c11_test, name: 'C11') if cc.get_id() == 'msvc' c11_test_args = ['/std:c11'] else - c11_test_args = ['-std=gnu11', '-std=c11'] + c11_test_args = ['-std=c11', '-std=gnu11'] endif Perhaps this isn't an issue. I just did this to try to test what would happen in a compiler that defaulted to c99. I'm unsure how clang processes conflicting compiler flags. David
pgsql-hackers by date: