On Thu, 17 Jul 2025 at 16:20, Tom Lane <t...@sss.pgh.pa.us> wrote: > > David Rowley <dgrowle...@gmail.com> writes: > > Unsure what other repercussions there are of compiling with C11 and > > have not looked into what it would take to adjust the meson build > > scripts to default to that for MSVC builds. > > In theory there should be no repercussions, because we already > support compiling with C11: C99 is a minimum not a maximum.
Oh, right. > But I've not checked the meson scripts either. The attached seems to work. It's my first time hacking on meson build scripts. I was surprised to see the "-std=c99" test just does not work for MSVC since the flag is spelt "/std:c99" for that compiler. The reason it's not causing trouble is due to the code compiling without that flag, so the test that passes the flag is never executed. For the test I added, I had to use the MSVC naming convention, which seems fine as it's only run when "cc.get_id() == 'msvc'". I've not gone over the other users of __builtin_constant_p() to replace them with the pg_builtin_constant(). That's probably a good exercise to do as I'm not sure how well the MSVC _Generic trick works or if there might be some expressions it doesn't work with. I also opted not to have the pg_builtin_constant() macro return 0 when it's unsupported as I was worred some code might make too many assumptions about the variability of the expression if that were to return false. I don't quite have a problem case in mind for that. Doing it that way was mostly erring on the side of caution. For now, I've left in a commented out "return NULL;". I get no compiler warnings from that. David
v2-0001-Detect-elog-ERROR-can-t-return-in-MSVC-when-using.patch
Description: Binary data