From patchwork Tue Mar 1 10:59:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lauras@gcc10.fsffrance.org X-Patchwork-Id: 84924 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id CB210B7146 for ; Tue, 1 Mar 2011 21:59:58 +1100 (EST) Received: (qmail 8613 invoked by alias); 1 Mar 2011 10:59:54 -0000 Received: (qmail 8605 invoked by uid 22791); 1 Mar 2011 10:59:53 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=BAYES_00, RCVD_IN_BRBL_LASTEXT, TW_WW X-Spam-Check-By: sourceware.org Received: from solo.fdn.fr (HELO solo.fdn.fr) (80.67.169.19) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 Mar 2011 10:59:47 +0000 Received: from gcc11.fsffrance.org (cmd10.fsffrance.org [86.65.39.10]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by smtp.fdn.fr (Postfix) with ESMTPS id CCFCE4476F; Tue, 1 Mar 2011 11:59:44 +0100 (CET) Received: from gcc10 ([10.73.37.169] helo=gcc10.fsffrance.org) by gcc11.fsffrance.org with esmtp (Exim 4.69) (envelope-from ) id 1PuNIu-0004vX-JD; Tue, 01 Mar 2011 11:59:44 +0100 Received: from lauras by gcc10.fsffrance.org with local (Exim 4.69) (envelope-from ) id 1PuNIO-0004NV-Rx; Tue, 01 Mar 2011 11:59:12 +0100 To: gcc-patches@gcc.gnu.org,reply@codereview.appspotmail.com Subject: [4.7][gc-improv] PATCH: move Valgrind header checks from valgrind to misc checking (issue4250047) Message-Id: From: lauras@gcc10.fsffrance.org Date: Tue, 01 Mar 2011 11:59:12 +0100 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * configure.ac: Enable "misc" checking if "valgrind" checking is requested. Move Valgrind header check from "valgrind" to "misc" checking. * configure: Regenerated. --- This patch is available for review at http://codereview.appspot.com/4250047 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 " >&5 +$as_echo_n "checking for VALGRIND_DISCARD in ... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#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 " >&5 +$as_echo_n "checking for VALGRIND_DISCARD in ... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#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 " >&5 -$as_echo_n "checking for VALGRIND_DISCARD in ... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#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 " >&5 -$as_echo_n "checking for VALGRIND_DISCARD in ... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#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 ) + AC_PREPROC_IFELSE([AC_LANG_SOURCE( + [[#include +#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 ) + AC_PREPROC_IFELSE([AC_LANG_SOURCE( + [[#include +#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 ) - AC_PREPROC_IFELSE([AC_LANG_SOURCE( - [[#include -#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 ) - AC_PREPROC_IFELSE([AC_LANG_SOURCE( - [[#include -#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)