From patchwork Thu Nov 17 21:02:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Reutner-Fischer X-Patchwork-Id: 1705299 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=gfpSCIVf; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NCspN0GQ8z1yhv for ; Fri, 18 Nov 2022 08:03:39 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1AC7D384F6CF for ; Thu, 17 Nov 2022 21:03:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1AC7D384F6CF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668719017; bh=sCFF6ynLOq9g+N2kMenc9mPfj05tYNBKhQuMQKZF4b4=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=gfpSCIVfSq1RLU5tyTrzCV+6R/USyMa3tKUrlx6kBEbR0Jtq9qijvfcH+SJqJ/E3I gj3y6xM2QEuwRDm61IAhjaC0cX6XsdzBtprXzjmU5pX8vzr2wvIt932ToNYH3rdFLX /aMCiB3rOTDsoQ1edElRvL/Gs78SbgPI8fj24JOc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id 43A40384F6EB; Thu, 17 Nov 2022 21:03:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 43A40384F6EB Received: by mail-ej1-x633.google.com with SMTP id f27so8290388eje.1; Thu, 17 Nov 2022 13:03:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sCFF6ynLOq9g+N2kMenc9mPfj05tYNBKhQuMQKZF4b4=; b=goE8ozvBiJJPHsXdti6l8qqE8tpv6OPhSGGKVnfvZrbBvKuJ5A28WdJlz6yW798MKS xxHJmwZDfhtgPfmx1+H8TFuypj/CE/N94/XxHvr61j+aeVWI9ZJzetL8bn41l2d2a0x4 mZwRJUMNoxYD5pkyFkO2qh1KV+OGfn9tO++Esn8AxeZZbqDQKRx4eI1nxcpW/g2hXopT JxPIg9gn/iiBYbHVwTHbGka/9e3tyitvvkzYVXjrhWKTtuk8hJaUGXuTzXlnP/PSlbVV dzp78APxNwiB8ZOj7GFkfzUM/2Td/DzWZFTBtfVCdg3viqsVnDngBzcPqn7MNjW5DSNE PS7g== X-Gm-Message-State: ANoB5pnPqn6NU28h/tB4aZlX5HCdddtyGMQvjdChM7R9NVVnlHVUo9KW 7a45hEdK/oqTCw2FVMcIXQvtHvQpKrc= X-Google-Smtp-Source: AA0mqf730SGat5RXYiANTYXR61CMTlKyl1HGG5rSK4yxGsy9WjqUQbF3dCTtl1mfpR7wdHsa6TD/IQ== X-Received: by 2002:a17:906:2743:b0:7b2:92ce:faf2 with SMTP id a3-20020a170906274300b007b292cefaf2mr3549206ejd.158.1668718991874; Thu, 17 Nov 2022 13:03:11 -0800 (PST) Received: from nbbrfq (80-110-214-113.static.upcbusiness.at. [80.110.214.113]) by smtp.gmail.com with ESMTPSA id n13-20020a17090695cd00b007aea50205a0sm810566ejy.187.2022.11.17.13.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 13:03:11 -0800 (PST) X-Google-Original-From: Bernhard Reutner-Fischer Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1ovm2Q-000eQ1-15; Thu, 17 Nov 2022 22:03:10 +0100 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer , Bernhard Reutner-Fischer Subject: [PATCH] libcpp: Add missing config for --enable-valgrind-annotations [PR107691] Date: Thu, 17 Nov 2022 22:02:59 +0100 Message-Id: <20221117210259.154569-1-aldot@gcc.gnu.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Bernhard Reutner-Fischer via Gcc-patches From: Bernhard Reutner-Fischer Reply-To: Bernhard Reutner-Fischer Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" --- ceb17928e5d1d5 copied (parts of) the valgrind annotation checks from gcc to libcpp. The above copies the missing pieces to libcpp to diagnose when libcpp is configured with --enable-valgrind-annotations but valgrind is not installed. Tested with --enable-valgrind-annotations without valgrind installed where it fixes errors thrown by test(1). And once with valgrind installed. Ok for trunk? libcpp/ChangeLog: PR preprocessor/107691 * configure.ac: Add valgrind header checks. * configure: Regenerate. --- libcpp/configure.ac | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/libcpp/configure.ac b/libcpp/configure.ac index 9b6042518e5..89ac99b04bd 100644 --- a/libcpp/configure.ac +++ b/libcpp/configure.ac @@ -226,6 +226,40 @@ case x$enable_languages in esac AC_SUBST(CET_HOST_FLAGS) +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 ) +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 + AC_ARG_ENABLE(valgrind-annotations, [AS_HELP_STRING([--enable-valgrind-annotations], [enable valgrind runtime interaction])], [], @@ -235,6 +269,7 @@ if test x$enable_valgrind_annotations != xno \ 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([*** valgrind annotations requested, but]) AC_MSG_ERROR([*** Can't find valgrind/memcheck.h, memcheck.h or valgrind.h]) fi AC_DEFINE(ENABLE_VALGRIND_ANNOTATIONS, 1,