Change ENABLE_VALGRIND_CHECKING to
authorMartin Liska <mliska@suse.cz>
Fri, 20 May 2016 08:03:25 +0000 (10:03 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Fri, 20 May 2016 08:03:25 +0000 (08:03 +0000)
* config.in: Regenerated.
* configure: Likewise.
* configure.ac: Handle --enable-valgrind-annotations.
* lex.c (new_buff): Use ENABLE_VALGRIND_ANNOTATIONS instead
of ENABLE_VALGRIND_CHECKING.
(_cpp_free_buff): Likewise.

From-SVN: r236496

libcpp/ChangeLog
libcpp/config.in
libcpp/configure
libcpp/configure.ac
libcpp/lex.c

index 1dc1c73bff23d3316ab77405f096dd8bf7bc03d3..d7a89d7d4951b083de764f68e2e624d9195beac4 100644 (file)
@@ -1,3 +1,12 @@
+2016-05-20  Martin Liska  <mliska@suse.cz>
+
+       * config.in: Regenerated.
+       * configure: Likewise.
+       * configure.ac: Handle --enable-valgrind-annotations.
+       * lex.c (new_buff): Use ENABLE_VALGRIND_ANNOTATIONS instead
+       of ENABLE_VALGRIND_CHECKING.
+       (_cpp_free_buff): Likewise.
+
 2016-04-28  Eduard Sanou  <dhole@openmailbox.org>
            Matthias Klose  <doko@debian.org>
 
index e02ac5efbadbdd2a7d9bd349dcd0e766b95e3d64..3bbffe7815e75e6f713cd01ac482e29fd857fe1e 100644 (file)
@@ -21,6 +21,9 @@
    language is requested. */
 #undef ENABLE_NLS
 
+/* Define to get calls to the valgrind runtime enabled. */
+#undef ENABLE_VALGRIND_ANNOTATIONS
+
 /* Define if you want to workaround valgrind (a memory checker) warnings about
    possible memory leaks because of libcpp use of interior pointers. */
 #undef ENABLE_VALGRIND_CHECKING
index 0342f163c9cbccab28dbbf9efaf0c4beed241e47..b6f129c48b9ac3aaebb8952b513e44ae7a978dd8 100755 (executable)
@@ -703,6 +703,7 @@ enable_maintainer_mode
 enable_checking
 enable_canonical_system_headers
 enable_host_shared
+enable_valgrind_annotations
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1343,6 +1344,8 @@ Optional Features:
   --enable-canonical-system-headers
                           enable or disable system headers canonicalization
   --enable-host-shared    build host code as shared libraries
+  --enable-valgrind-annotations
+                          enable valgrind runtime interaction
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -7355,6 +7358,25 @@ fi
 
 
 
+# Check whether --enable-valgrind-annotations was given.
+if test "${enable_valgrind_annotations+set}" = set; then :
+  enableval=$enable_valgrind_annotations;
+else
+  enable_valgrind_annotations=no
+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
+  fi
+
+$as_echo "#define ENABLE_VALGRIND_ANNOTATIONS 1" >>confdefs.h
+
+fi
+
 # Output.
 
 ac_config_headers="$ac_config_headers config.h:config.in"
index 0005c589fcda623bc0fb2ee0be1eaf32e3244208..3077ee09768b231f2d17b4a9783198bd79f5dfdc 100644 (file)
@@ -200,6 +200,21 @@ AC_ARG_ENABLE(host-shared,
 [PICFLAG=-fPIC], [PICFLAG=])
 AC_SUBST(PICFLAG)
 
+AC_ARG_ENABLE(valgrind-annotations,
+[AS_HELP_STRING([--enable-valgrind-annotations],
+               [enable valgrind runtime interaction])], [],
+[enable_valgrind_annotations=no])
+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])
+  fi
+  AC_DEFINE(ENABLE_VALGRIND_ANNOTATIONS, 1,
+[Define to get calls to the valgrind runtime enabled.])
+fi
+
 # Output.
 
 AC_CONFIG_HEADERS(config.h:config.in, [echo timestamp > stamp-h1])
index e5a0397f309995760429601fa204b6039dbe9c33..236418dd78136e63b7ff60753a85bce2fcbdcc86 100644 (file)
@@ -3147,7 +3147,7 @@ new_buff (size_t len)
     len = MIN_BUFF_SIZE;
   len = CPP_ALIGN (len);
 
-#ifdef ENABLE_VALGRIND_CHECKING
+#ifdef ENABLE_VALGRIND_ANNOTATIONS
   /* Valgrind warns about uses of interior pointers, so put _cpp_buff
      struct first.  */
   size_t slen = CPP_ALIGN2 (sizeof (_cpp_buff), 2 * DEFAULT_ALIGNMENT);
@@ -3244,7 +3244,7 @@ _cpp_free_buff (_cpp_buff *buff)
   for (; buff; buff = next)
     {
       next = buff->next;
-#ifdef ENABLE_VALGRIND_CHECKING
+#ifdef ENABLE_VALGRIND_ANNOTATIONS
       free (buff);
 #else
       free (buff->base);