public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Alexander Monakov <amonakov@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-5824] gcc: configure: drop Valgrind 3.1 compatibility Date: Fri, 24 Nov 2023 13:18:57 +0000 (GMT) [thread overview] Message-ID: <20231124131857.A1D0C385800C@sourceware.org> (raw) https://gcc.gnu.org/g:f9a10e91499ec9291fe28f20c34f1f1e65c521e8 commit r14-5824-gf9a10e91499ec9291fe28f20c34f1f1e65c521e8 Author: Alexander Monakov <amonakov@ispras.ru> Date: Thu Nov 23 20:48:43 2023 +0300 gcc: configure: drop Valgrind 3.1 compatibility Our system.h and configure.ac try to accommodate valgrind-3.1, but it is more than 15 years old at this point. As Valgrind-based checking is a developer-oriented feature, drop the compatibility stuff and streamline the detection. gcc/ChangeLog: * config.in: Regenerate. * configure: Regenerate. * configure.ac: Delete manual checks for old Valgrind headers. * system.h (VALGRIND_MAKE_MEM_NOACCESS): Delete. (VALGRIND_MAKE_MEM_DEFINED): Delete. (VALGRIND_MAKE_MEM_UNDEFINED): Delete. (VALGRIND_MALLOCLIKE_BLOCK): Delete. (VALGRIND_FREELIKE_BLOCK): Delete. Diff: --- gcc/config.in | 12 --------- gcc/configure | 80 +++++++++----------------------------------------------- gcc/configure.ac | 49 ++++------------------------------ gcc/system.h | 23 +++------------- 4 files changed, 20 insertions(+), 144 deletions(-) diff --git a/gcc/config.in b/gcc/config.in index 2b7161a9b0a..fa40825d6d0 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -1886,12 +1886,6 @@ #endif -/* Define if valgrind's memcheck.h header is installed. */ -#ifndef USED_FOR_TARGET -#undef HAVE_MEMCHECK_H -#endif - - /* Define to 1 if you have the <memory.h> header file. */ #ifndef USED_FOR_TARGET #undef HAVE_MEMORY_H @@ -2154,12 +2148,6 @@ #endif -/* Define if valgrind's valgrind/memcheck.h header is installed. */ -#ifndef USED_FOR_TARGET -#undef HAVE_VALGRIND_MEMCHECK_H -#endif - - /* Define to 1 if you have the `vfork' function. */ #ifndef USED_FOR_TARGET #undef HAVE_VFORK diff --git a/gcc/configure b/gcc/configure index a1446cadc0c..de72cb1e1fe 100755 --- a/gcc/configure +++ b/gcc/configure @@ -7685,63 +7685,6 @@ $as_echo "#define ENABLE_FOLD_CHECKING 1" >>confdefs.h fi valgrind_path_defines= valgrind_command= - -ac_fn_cxx_check_header_mongrel "$LINENO" "valgrind.h" "ac_cv_header_valgrind_h" "$ac_includes_default" -if test "x$ac_cv_header_valgrind_h" = xyes; then : - have_valgrind_h=yes -else - have_valgrind_h=no -fi - - - -# It is certainly possible that there's valgrind but no valgrind.h. -# GCC relies on making annotations so we must have both. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for VALGRIND_DISCARD in <valgrind/memcheck.h>" >&5 -$as_echo_n "checking for VALGRIND_DISCARD in <valgrind/memcheck.h>... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <valgrind/memcheck.h> -#ifndef VALGRIND_DISCARD -#error VALGRIND_DISCARD not defined -#endif -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - gcc_cv_header_valgrind_memcheck_h=yes -else - gcc_cv_header_valgrind_memcheck_h=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_header_valgrind_memcheck_h" >&5 -$as_echo "$gcc_cv_header_valgrind_memcheck_h" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for VALGRIND_DISCARD in <memcheck.h>" >&5 -$as_echo_n "checking for VALGRIND_DISCARD in <memcheck.h>... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <memcheck.h> -#ifndef VALGRIND_DISCARD -#error VALGRIND_DISCARD not defined -#endif -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - gcc_cv_header_memcheck_h=yes -else - gcc_cv_header_memcheck_h=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_header_memcheck_h" >&5 -$as_echo "$gcc_cv_header_memcheck_h" >&6; } -if test $gcc_cv_header_valgrind_memcheck_h = yes; then - -$as_echo "#define HAVE_VALGRIND_MEMCHECK_H 1" >>confdefs.h - -fi -if test $gcc_cv_header_memcheck_h = yes; then - -$as_echo "#define HAVE_MEMCHECK_H 1" >>confdefs.h - -fi - if test x$ac_valgrind_checking != x ; then # Prepare PATH_SEPARATOR. @@ -7810,11 +7753,8 @@ else $as_echo "no" >&6; } fi - if test "x$valgrind_path" = "x" \ - || (test $have_valgrind_h = no \ - && test $gcc_cv_header_memcheck_h = no \ - && test $gcc_cv_header_valgrind_memcheck_h = no); then - as_fn_error $? "*** Can't find both valgrind and valgrind/memcheck.h, memcheck.h or valgrind.h" "$LINENO" 5 + if test "x$valgrind_path" = "x"; then + as_fn_error $? "*** Cannot find valgrind" "$LINENO" 5 fi valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"' valgrind_command="$valgrind_path -q" @@ -7870,12 +7810,16 @@ else enable_valgrind_annotations=no fi +ac_fn_cxx_check_header_mongrel "$LINENO" "valgrind/memcheck.h" "ac_cv_header_valgrind_memcheck_h" "$ac_includes_default" +if test "x$ac_cv_header_valgrind_memcheck_h" = xyes; then : + +fi + + if test x$enable_valgrind_annotations != xno \ || test x$ac_valgrind_checking != x; then - if (test $have_valgrind_h = no \ - && test $gcc_cv_header_memcheck_h = no \ - && test $gcc_cv_header_valgrind_memcheck_h = no); then - as_fn_error $? "*** Can't find valgrind/memcheck.h, memcheck.h or valgrind.h" "$LINENO" 5 + if test $ac_cv_header_valgrind_memcheck_h = no; then + as_fn_error $? "*** Cannot find valgrind/memcheck.h" "$LINENO" 5 fi $as_echo "#define ENABLE_VALGRIND_ANNOTATIONS 1" >>confdefs.h @@ -21625,7 +21569,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21628 "configure" +#line 21572 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -21731,7 +21675,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21734 "configure" +#line 21678 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index da3b50a4d89..21ba631482f 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -778,49 +778,11 @@ if test x$ac_fold_checking != x ; then fi valgrind_path_defines= valgrind_command= - -dnl # This check AC_REQUIREs various stuff, so it *must not* be inside -dnl # an if statement. This was the source of very frustrating bugs -dnl # in converting to autoconf 2.5x! -AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no) - -# It is certainly possible that there's valgrind but no valgrind.h. -# GCC relies on making annotations so we must have both. -AC_MSG_CHECKING(for VALGRIND_DISCARD in <valgrind/memcheck.h>) -AC_PREPROC_IFELSE([AC_LANG_SOURCE( - [[#include <valgrind/memcheck.h> -#ifndef VALGRIND_DISCARD -#error VALGRIND_DISCARD not defined -#endif]])], - [gcc_cv_header_valgrind_memcheck_h=yes], - [gcc_cv_header_valgrind_memcheck_h=no]) -AC_MSG_RESULT($gcc_cv_header_valgrind_memcheck_h) -AC_MSG_CHECKING(for VALGRIND_DISCARD in <memcheck.h>) -AC_PREPROC_IFELSE([AC_LANG_SOURCE( - [[#include <memcheck.h> -#ifndef VALGRIND_DISCARD -#error VALGRIND_DISCARD not defined -#endif]])], - [gcc_cv_header_memcheck_h=yes], - [gcc_cv_header_memcheck_h=no]) -AC_MSG_RESULT($gcc_cv_header_memcheck_h) -if test $gcc_cv_header_valgrind_memcheck_h = yes; then - AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1, - [Define if valgrind's valgrind/memcheck.h header is installed.]) -fi -if test $gcc_cv_header_memcheck_h = yes; then - AC_DEFINE(HAVE_MEMCHECK_H, 1, - [Define if valgrind's memcheck.h header is installed.]) -fi - if test x$ac_valgrind_checking != x ; then AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind, [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1]) - if test "x$valgrind_path" = "x" \ - || (test $have_valgrind_h = no \ - && test $gcc_cv_header_memcheck_h = no \ - && test $gcc_cv_header_valgrind_memcheck_h = no); then - AC_MSG_ERROR([*** Can't find both valgrind and valgrind/memcheck.h, memcheck.h or valgrind.h]) + if test "x$valgrind_path" = "x"; then + AC_MSG_ERROR([*** Cannot find valgrind]) fi valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"' valgrind_command="$valgrind_path -q" @@ -869,12 +831,11 @@ AC_ARG_ENABLE(valgrind-annotations, [AS_HELP_STRING([--enable-valgrind-annotations], [enable valgrind runtime interaction])], [], [enable_valgrind_annotations=no]) +AC_CHECK_HEADER(valgrind/memcheck.h) if test x$enable_valgrind_annotations != xno \ || test x$ac_valgrind_checking != x; then - if (test $have_valgrind_h = no \ - && test $gcc_cv_header_memcheck_h = no \ - && test $gcc_cv_header_valgrind_memcheck_h = no); then - AC_MSG_ERROR([*** Can't find valgrind/memcheck.h, memcheck.h or valgrind.h]) + if test $ac_cv_header_valgrind_memcheck_h = no; then + AC_MSG_ERROR([*** Cannot find valgrind/memcheck.h]) fi AC_DEFINE(ENABLE_VALGRIND_ANNOTATIONS, 1, [Define to get calls to the valgrind runtime enabled.]) diff --git a/gcc/system.h b/gcc/system.h index e924152ad4c..16db87bd5a9 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -1217,28 +1217,11 @@ helper_const_non_const_cast (const char *p) #endif #ifdef ENABLE_VALGRIND_ANNOTATIONS -# ifdef HAVE_VALGRIND_MEMCHECK_H -# include <valgrind/memcheck.h> -# elif defined HAVE_MEMCHECK_H -# include <memcheck.h> -# else -# include <valgrind.h> -# endif -/* Compatibility macros to let valgrind 3.1 work. */ -# ifndef VALGRIND_MAKE_MEM_NOACCESS -# define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS -# endif -# ifndef VALGRIND_MAKE_MEM_DEFINED -# define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE -# endif -# ifndef VALGRIND_MAKE_MEM_UNDEFINED -# define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE -# endif +#include <valgrind/memcheck.h> #else -/* Avoid #ifdef:s when we can help it. */ +/* VALGRIND_DISCARD unregisters the given block handle, + but our code misuses it for discarding annotations. */ #define VALGRIND_DISCARD(x) -#define VALGRIND_MALLOCLIKE_BLOCK(w,x,y,z) -#define VALGRIND_FREELIKE_BLOCK(x,y) #endif /* Macros to temporarily ignore some warnings. */
reply other threads:[~2023-11-24 13:18 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20231124131857.A1D0C385800C@sourceware.org \ --to=amonakov@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).