From: Paul Floyd Date: Tue, 10 Nov 2020 13:49:27 +0000 (+0100) Subject: Make memcheck/tests/sized_delete conditional upon the compiler having -fsized-dealloc... X-Git-Tag: VALGRIND_3_17_0~114 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6e5213028c9c37765b1be52bb5185a5bfcdb526d;p=thirdparty%2Fvalgrind.git Make memcheck/tests/sized_delete conditional upon the compiler having -fsized-deallocators, add 384729 to NEWS --- diff --git a/NEWS b/NEWS index f1ced278c4..563a9ef8c1 100644 --- 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) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/configure.ac b/configure.ac index 42b2a71448..f01dbff7fc 100755 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 28f26bbebe..e24bcc24d9 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -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@