Project

General

Profile

Bug #2335 » 0041-Fix-configure-check-for-C-20-capture-this-on-clang.patch

S3_3 - Marko Lindqvist, 10/05/2026 09:11 PM

View differences:

configure.ac
WERROR_C_TEST_FLAGS=""
WERROR_CXX_TEST_FLAGS=""
FC_C_FLAGS([-Werror -Wall], [], [WERROR_C_TEST_FLAGS])
FC_CXX_FLAGS([-Werror -Wall], [], [WERROR_CXX_TEST_FLAGS])
FC_CXX_FLAGS([-Werror -Wall -Wno-c++20-extensions], [], [WERROR_CXX_TEST_FLAGS])
FC_C99_VARIADIC_MACROS
FC_C99_VARIABLE_ARRAYS
m4/debug.m4
FC_C_FLAGS([-Wno-tautological-compare],
[], [EXTRA_DEBUG_CFLAGS])
if test "x$cxx_works" = "xyes" ; then
FC_CXX_FLAGS([-Wno-tautological-compare -Wno-deprecated-declarations],
FC_CXX_FLAGS([-Wno-tautological-compare -Wno-deprecated-declarations \
-Wno-c++20-extensions],
[], [EXTRA_DEBUG_CXXFLAGS])
fi
meson.build
cpp_args = [
'-Wno-deprecated-declarations',
'-fPIC'
'-fPIC',
'-Wno-c++20-extensions'
]
foreach arg : c_args
......
pub_conf_data.set('FREECIV_SVG_FLAGS', 1)
endif
if cxx_build and cxx_compiler.compiles('''
if cxx_build
if cxx_compiler.has_argument('-Wno-c++20-extensions')
accept_cxx_20 = ['-Wno-c++20-extensions']
else
accept_cxx_20 = []
endif
if cxx_compiler.compiles('''
class me {
void top(); };
void me::top() { (void) [=, this]() { this->top(); }; };
''',
name: 'C++20 capture this',
args: ['-Werror', '-Wall'])
pub_conf_data.set('FREECIV_HAVE_CXX20_CAPTURE_THIS', 1)
name: 'C++20 capture this',
args: ['-Werror', '-Wall', accept_cxx_20])
pub_conf_data.set('FREECIV_HAVE_CXX20_CAPTURE_THIS', 1)
endif
endif
if not meson.is_cross_build()
(2-2/3)