]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make memcheck/tests/sized_delete conditional upon the compiler having -fsized-dealloc...
authorPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 10 Nov 2020 13:49:27 +0000 (14:49 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 10 Nov 2020 13:52:19 +0000 (14:52 +0100)
NEWS
configure.ac
memcheck/tests/Makefile.am

diff --git a/NEWS b/NEWS
index f1ced278c4d313a82c17b94312d7d4dfd360f3a2..563a9ef8c1950b25188ee4944f71f2ae3ac21566 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -57,6 +57,7 @@ n-i-bz  helgrind: If hg_cli__realloc fails, return NULL.
 428648  s390_emit_load_mem panics due to 20-bit offset for vector load
 427400  PPC ISA 3.1 support is missing, part 4
 427401  PPC ISA 3.1 support is missing, part 5
+384729  __libc_freeres inhibits cross-platform valgrind
 
 Release 3.16.1 (?? June 2020)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index 42b2a714489acc0bfec3ef3aa91512f3ea3a147a..f01dbff7fcfae994a899f3d41b3c130bac74b063 100755 (executable)
@@ -2287,6 +2287,31 @@ AC_LANG(C)
 
 AC_SUBST(FLAG_FALIGNED_NEW)
 
+# does this compiler support -fsized-deallocation ?
+AC_MSG_CHECKING([if g++ accepts -fsized-deallocation])
+
+safe_CXXFLAGS=$CXXFLAGS
+CXXFLAGS="-fsized-deallocation -Werror"
+
+AC_LANG(C++)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+  return 0;
+]])], [
+FLAG_FSIZED_DEALLOCATION="-fsized-deallocation"
+ac_have_sized_deallocation=yes
+AC_MSG_RESULT([yes])
+], [
+FLAG_FSIZED_DEALLOCATION=""
+ac_have_sized_deallocation=no
+AC_MSG_RESULT([no])
+])
+CXXFLAGS=$safe_CXXFLAGS
+AC_LANG(C)
+
+AC_SUBST(FLAG_FSIZED_DEALLOCATION)
+AM_CONDITIONAL([HAVE_FSIZED_DEALLOCATION], [test x$ac_have_sized_deallocation = xyes])
+
+
 # does this compiler support -fno-stack-protector ?
 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
 
index 28f26bbebe73189ff7fc9861b3ff311a3a99a184..e24bcc24d91d9758cce195642dd1b0f6f0132e62 100644 (file)
@@ -399,7 +399,6 @@ check_PROGRAMS = \
        sendmsg \
        sh-mem sh-mem-random \
        sigaltstack signal2 sigprocmask static_malloc sigkill \
-       sized_delete \
        strchr \
        str_tester \
        supp_unknown supp1 supp2 suppfree \
@@ -552,8 +551,11 @@ sendmsg_CFLAGS             += -D_XOPEN_SOURCE=600
 sendmsg_LDADD          = -lsocket -lnsl
 endif
 
+if HAVE_FSIZED_DEALLOCATION
+check_PROGRAMS += sized_delete
 sized_delete_SOURCES   = sized_delete.cpp
-sized_delete_CXXFLAGS  = $(AM_CXXFLAGS) -fsized-deallocation
+sized_delete_CXXFLAGS  = $(AM_CXXFLAGS) @FLAG_FSIZED_DEALLOCATION@
+endif
 
 str_tester_CFLAGS      = $(AM_CFLAGS) -Wno-shadow \
                          @FLAG_W_NO_MEMSET_TRANSPOSED_ARGS@