mirror of
https://github.com/postgres/postgres.git
synced 2026-06-13 10:40:09 -04:00
Enable test_cplusplusext with MSVC
The test_cplusplusext test module has so far been disabled on MSVC. The only remaining problem now is that designated initializers, as used in PG_MODULE_MAGIC, require C++20. (With GCC and Clang they work in older C++ versions as well.) This adds another test in the top-level meson.build to check that the compiler supports C++20 designated initializers. This is not required, we are just checking and recording the answer. If yes, we can enable the test module. Most current compilers likely won't be in C++20 mode by default. This doesn't change that; we are not doing anything to try to switch the compiler into that mode. This might be a separate project, but for now we'll leave that for the user or the test scaffolding. The VS task on Cirrus CI is changed to provide the required flag to turn on C++20 mode. There is no equivalent change in configure, since this change mainly targets MSVC. Co-authored-by: Jelte Fennema-Nio <postgres@jeltef.nl> Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg%40mail.gmail.com
This commit is contained in:
parent
6b0550c45d
commit
c05ad248f9
3 changed files with 16 additions and 6 deletions
|
|
@ -782,6 +782,7 @@ task:
|
|||
CIRRUS_WINDOWS_ERROR_MODE: 0x8001
|
||||
|
||||
MESON_FEATURES:
|
||||
-Dcpp_args=/std:c++20
|
||||
-Dauto_features=disabled
|
||||
-Dldap=enabled
|
||||
-Dssl=openssl
|
||||
|
|
|
|||
14
meson.build
14
meson.build
|
|
@ -2176,6 +2176,20 @@ choke me
|
|||
endif
|
||||
|
||||
|
||||
# Check whether the C++ compiler supports designated initializers.
|
||||
# These are used by PG_MODULE_MAGIC, and we use the result of this
|
||||
# test to decide whether to enable the test_cplusplusext test module.
|
||||
# Designated initializers only got standardized in C++20. In GCC and
|
||||
# Clang they also work when using earlier C++ versions, but MSVC
|
||||
# really only supports them when its configured to be in C++20 mode or
|
||||
# higher.
|
||||
if have_cxx
|
||||
have_cxx_desinit = cxx.compiles('struct S { int x; } s = { .x = 1 };', name: 'C++ designated initializers')
|
||||
else
|
||||
have_cxx_desinit = false
|
||||
endif
|
||||
|
||||
|
||||
|
||||
###############################################################
|
||||
# Compiler flags
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
# Copyright (c) 2025-2026, PostgreSQL Global Development Group
|
||||
|
||||
if not have_cxx
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
# Currently not supported, to be fixed.
|
||||
if cc.get_id() == 'msvc'
|
||||
if not have_cxx or not have_cxx_desinit
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue