Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5102)

Issue 4250047: [4.7][gc-improv] PATCH: move Valgrind header checks from "valgrind" to "misc" checking

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 2 months ago by Laurynas Biveinis
Modified:
5 months, 3 weeks ago
Reviewers:
lauras
Base URL:
svn+ssh://gcc.gnu.org/svn/gcc/branches/gc-improv/
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+78 lines, -77 lines) Patch
M gcc/configure View 5 chunks +47 lines, -47 lines 0 comments Download
M gcc/configure.ac View 4 chunks +31 lines, -30 lines 0 comments Download

Messages

Total messages: 1
lauras_gcc10.fsffrance.org
13 years, 2 months ago (2011-03-01 10:59:47 UTC) #1
As discussed in the thread starting at
http://gcc.gnu.org/ml/gcc/2011-01/msg00363.html , 
this patch moves Valgrind header detection from "valgrind" checking to "misc"
and enables
the latter whenever the former is enabled.

If only "misc" is enabled, then Valgrind header presence is optional.

I plan to followup with another patch that adds new configure option 
--enable-valgrind-annotations that is orthogonal to checking and causes
configure to fail 
if headers are not present.  Also I will update wwwdocs once this is accepted to
trunk.

Tested on gc-improv for a last month or so.

Will commit to gc-improv shortly.  Ok for 4.7?

2011-02-28  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* configure.ac: Enable "misc" checking if "valgrind" checking is
	requested.  Move Valgrind header check from "valgrind" to "misc"
	checking.
	* configure: Regenerated.

Index: gcc/configure
===================================================================
--- gcc/configure	(revision 169049)
+++ gcc/configure	(working copy)
@@ -6585,7 +6585,7 @@
 	runtime)	ac_runtime_checking=1 ;;
 	tree)		ac_tree_checking=1 ;;
 	types)		ac_types_checking=1 ;;
-	valgrind)	ac_valgrind_checking=1 ;;
+	valgrind)	ac_checking=1 ; ac_valgrind_checking=1 ;;
 	*)	as_fn_error "unknown check category $check" "$LINENO" 5 ;;
 	esac
 done
@@ -6597,8 +6597,52 @@
 $as_echo "#define ENABLE_CHECKING 1" >>confdefs.h
 
   nocommon_flag=-fno-common
+  { $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_c_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.$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_c_try_cpp "$LINENO"; then :
+  gcc_cv_header_memcheck_h=yes
+else
+  gcc_cv_header_memcheck_h=no
+fi
+rm -f conftest.err 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
+fi
+
 if test x$ac_df_checking != x ; then
 
 $as_echo "#define ENABLE_DF_CHECKING 1" >>confdefs.h
@@ -6670,42 +6714,6 @@
 
 
 if test x$ac_valgrind_checking != x ; then
-  # 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_c_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.$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_c_try_cpp "$LINENO"; then :
-  gcc_cv_header_memcheck_h=yes
-else
-  gcc_cv_header_memcheck_h=no
-fi
-rm -f conftest.err 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; }
 
 # Prepare PATH_SEPARATOR.
 # The user is always right.
@@ -6773,6 +6781,8 @@
 $as_echo "no" >&6; }
 fi
 
+  # It is certainly possible that there's valgrind but no valgrind.h.
+  # GCC relies on making annotations so we must have both.
   if test "x$valgrind_path" = "x" \
     || (test $have_valgrind_h = no \
 	&& test $gcc_cv_header_memcheck_h = no \
@@ -6784,16 +6794,6 @@
 
 $as_echo "#define ENABLE_VALGRIND_CHECKING 1" >>confdefs.h
 
-  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
 fi
 
 
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 169049)
+++ gcc/configure.ac	(working copy)
@@ -414,7 +414,7 @@
 	runtime)	ac_runtime_checking=1 ;;
 	tree)		ac_tree_checking=1 ;;
 	types)		ac_types_checking=1 ;;
-	valgrind)	ac_valgrind_checking=1 ;;
+	valgrind)	ac_checking=1 ; ac_valgrind_checking=1 ;;
 	*)	AC_MSG_ERROR(unknown check category $check) ;;
 	esac
 done
@@ -424,8 +424,35 @@
 if test x$ac_checking != x ; then
   AC_DEFINE(ENABLE_CHECKING, 1,
 [Define if you want more run-time sanity checks.  This one gets a grab
-   bag of miscellaneous but relatively cheap checks.])
+   bag of miscellaneous but relatively cheap checks.  Additionally this 
+   enables the valgrind annotations if the required headers are present.])
   nocommon_flag=-fno-common
+  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
 fi
 AC_SUBST(nocommon_flag)
 if test x$ac_df_checking != x ; then
@@ -500,28 +527,10 @@
 AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)
 
 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])
   # 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)
-  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 \
@@ -533,14 +542,6 @@
   AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
 [Define if you want to run subprograms and generated programs
    through valgrind (a memory checker).  This is extremely expensive.])
-  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
 fi
 AC_SUBST(valgrind_path_defines)
 AC_SUBST(valgrind_command)

--
This patch is available for review at http://codereview.appspot.com/4250047
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b