https://sourceware.org/cgit/valgrind/commit/?id=5b6a8d27e717dc71818e0b8b28b6d41e377f4b84
commit 5b6a8d27e717dc71818e0b8b28b6d41e377f4b84
Author: Paul Floyd <pj...@wa...>
Date: Mon Oct 13 08:38:09 2025 +0200
configure and make: add configure checks for C++ exception warnings
Add checks for -Wno-implicit-exception-spec-mismatch
(FLAG_W_NO_IMPLICIT_EXCEPTION_SPEC_MISMATCH)
and -Wno-missing-exception-spec
(FLAG_W_NO_MISSING_EXCEPTION_SPEC)
Also we should clean up C++ flag checking a bit. If all checks get
grouped together than just one AC_LANG(C++)/AC_LANG(C) would be
needed.
Diff:
---
configure.ac | 18 ++++++++++++++++++
massif/tests/Makefile.am | 2 +-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 1a7ea34d1b..9217aa0ac8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2638,6 +2638,24 @@ AC_GCC_WARNING_SUBST([logical-op], [FLAG_W_LOGICAL_OP])
AC_GCC_WARNING_SUBST([enum-conversion], [FLAG_W_ENUM_CONVERSION])
AC_GCC_WARNING_SUBST([implicit-fallthrough=2], [FLAG_W_IMPLICIT_FALLTHROUGH])
+# as above, C++ flags
+AC_DEFUN([AC_GXX_WARNING_SUBST_NO],[
+ AC_MSG_CHECKING([if g++ accepts -W$1])
+ safe_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="-W$1 -Werror"
+ AC_LANG_PUSH(C++)
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
+ AC_SUBST([$2], [-Wno-$1])
+ AC_LANG_POP()
+ AC_MSG_RESULT([yes])], [
+ AC_SUBST([$2], [])
+ AC_MSG_RESULT([no])])
+ CXXFLAGS=$safe_CXXFLAGS
+])
+
+AC_GXX_WARNING_SUBST_NO([missing-exception-spec], [FLAG_W_NO_MISSING_EXCEPTION_SPEC])
+AC_GXX_WARNING_SUBST_NO([implicit-exception-spec-mismatch], [FLAG_W_NO_IMPLICIT_EXCEPTION_SPEC_MISMATCH])
+
# Does this compiler support -Wformat-security ?
# Special handling is needed, because certain GCC versions require -Wformat
# being present if -Wformat-security is given. Otherwise a warning is issued.
diff --git a/massif/tests/Makefile.am b/massif/tests/Makefile.am
index d4d798f69c..b596592727 100644
--- a/massif/tests/Makefile.am
+++ b/massif/tests/Makefile.am
@@ -98,7 +98,7 @@ bug469146_CXXFLAGS = $(AM_CXXFLAGS) -O2 -fno-optimize-sibling-calls @FLAG_W_NO_U
new_cpp_SOURCES = new-cpp.cpp
overloaded_new_SOURCES = overloaded-new.cpp
# aligned new needs C++17
-overloaded_new_CXXFLAGS = $(AM_CXXFLAGS) -Wno-implicit-exception-spec-mismatch -Wno-missing-exception-spec -std=c++17
+overloaded_new_CXXFLAGS = $(AM_CXXFLAGS) @FLAG_W_NO_IMPLICIT_EXCEPTION_SPEC_MISMATCH@ @FLAG_W_NO_MISSING_EXCEPTION_SPEC@ -std=c++17
# Suppress warnings for issues we are testing for
alloc_fns_CFLAGS = $(AM_CFLAGS) -Wno-unused-result
|