]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Try to correct configure script for warning flags with values
authorPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 21 Feb 2023 21:05:13 +0000 (22:05 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 21 Feb 2023 21:05:13 +0000 (22:05 +0100)
Some -W flags come with and without an =
(usually for warning levels)
But some only have the form -Wfoo=42 and -Wno-foo

configure.ac
memcheck/tests/Makefile.am

index 546e874b4b438b553d6b7a93f4460ba0d0389689..696c967ee1333d90697c8c0b18f80de3cf2922cc 100755 (executable)
@@ -2519,6 +2519,20 @@ AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
   CFLAGS=$safe_CFLAGS
 ])
 
+# A variation of the above for arguments that
+# take a value
+AC_DEFUN([AC_GCC_WARNING_SUBST_NO_VAL],[
+  AC_MSG_CHECKING([if gcc accepts -W$1=$2])
+  safe_CFLAGS=$CFLAGS
+  CFLAGS="-W$1=$2 -Werror"
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
+  AC_SUBST([$3], [-Wno-$1])
+  AC_MSG_RESULT([yes])], [
+  AC_SUBST([$3], [])
+  AC_MSG_RESULT([no])])
+  CFLAGS=$safe_CFLAGS
+])
+
 # Convenience function. Like AC_GCC_WARNING_SUBST_NO, except it substitutes
 # -W$1  (instead of -Wno-$1).
 AC_DEFUN([AC_GCC_WARNING_SUBST],[
@@ -2553,7 +2567,8 @@ AC_GCC_WARNING_SUBST_NO([stringop-truncation], [FLAG_W_NO_STRINGOP_TRUNCATION])
 AC_GCC_WARNING_SUBST_NO([format-overflow], [FLAG_W_NO_FORMAT_OVERFLOW])
 AC_GCC_WARNING_SUBST_NO([use-after-free], [FLAG_W_NO_USE_AFTER_FREE])
 AC_GCC_WARNING_SUBST_NO([free-nonheap-object], [FLAG_W_NO_FREE_NONHEAP_OBJECT])
-AC_GCC_WARNING_SUBST_NO([alloc-size-larger-than], [FLAG_W_NO_ALOC_SIZE_LARGER_THAN])
+
+AC_GCC_WARNING_SUBST_NO_VAL([alloc-size-larger-than], [1677216], [FLAG_W_NO_ALLOC_SIZE_LARGER_THAN])
 
 AC_GCC_WARNING_SUBST([write-strings], [FLAG_W_WRITE_STRINGS])
 AC_GCC_WARNING_SUBST([empty-body], [FLAG_W_EMPTY_BODY])
index 281d8f55a49a295c2f648fb932f82d3f8c035cd1..efffe7b1c23c599edb61ec7755803be8361d13fb 100644 (file)
@@ -525,11 +525,11 @@ leak_cpp_interior_SOURCES = leak_cpp_interior.cpp
 
 # Suppress various gcc warnings which are correct, but for things
 # we are actually testing for at runtime.
-accounting_CFLAGS      = $(AM_CFLAGS) @FLAG_W_NO_ALOC_SIZE_LARGER_THAN@
+accounting_CFLAGS      = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@
 badfree_CFLAGS         = $(AM_CFLAGS) @FLAG_W_NO_FREE_NONHEAP_OBJECT@
-bug155125_CFLAGS       = $(AM_CFLAGS) -Wno-unused-result @FLAG_W_NO_ALOC_SIZE_LARGER_THAN@
+bug155125_CFLAGS       = $(AM_CFLAGS) -Wno-unused-result @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@
 mallinfo_CFLAGS                = $(AM_CFLAGS) -Wno-deprecated-declarations
-malloc3_CFLAGS         = $(AM_CFLAGS) @FLAG_W_NO_ALOC_SIZE_LARGER_THAN@
+malloc3_CFLAGS         = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@
 sbfragment_CFLAGS      = $(AM_CFLAGS) -Wno-deprecated-declarations
 strchr_CFLAGS          = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@