From patchwork Wed Nov 2 14:55:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 59791 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 328EC38576BF for ; Wed, 2 Nov 2022 14:58:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 328EC38576BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667401112; bh=MfgIp9Ztn0PSLry+pajECV5hJ48xvQTvIW1IGFgFSVE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=An2gzkWd4mBcgkEfeb7mUFMmk6ziuBb4LdCISfrxTQ7qr/vku9ddNNEWovt7sUZfF c+QGDRkzAspFigxwleuEI/p/f+8b5AQTyfBGOg3q8UM8Ty6R8KpI65adLgrew8iwWt XlHsigwWMDMNGspoQ5MFfj6M0VIyg/LgJR/+ivm8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oo1-xc35.google.com (mail-oo1-xc35.google.com [IPv6:2607:f8b0:4864:20::c35]) by sourceware.org (Postfix) with ESMTPS id 04D0B3857685 for ; Wed, 2 Nov 2022 14:56:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 04D0B3857685 Received: by mail-oo1-xc35.google.com with SMTP id g15-20020a4a894f000000b0047f8e899623so2518579ooi.5 for ; Wed, 02 Nov 2022 07:56:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MfgIp9Ztn0PSLry+pajECV5hJ48xvQTvIW1IGFgFSVE=; b=pHxNYUkRbyuPc352DtRsxELKT2pkVFpcrG8sY490TBUPcidCW4TGb77laXukcCvEVB yALts6qROE+ywRNztDm4MaHfeCuDt1nYBdZingUWjqG+kZ5BZoitZi9WewEO043u0+/J /BDQY/IdoGrLsV9sUzk7HEaeW+ruZMRB4t//RM8pHWWADej9z8Z7x9moFMXSrvBMivST 7BNqh+AeoC7v6a+33wutxl0eyTmgURY6eFmDOVuTwmNYNv7eddgqFHEBeI2GBtLo63td To6E28LDeHW5x3CEad0FuYqPPJ4voR9EOjn4aE005HEj3kWHm2hjKED2DIU+2w7GIa7N E8Dw== X-Gm-Message-State: ACrzQf0XWWochmnK0yzBuZqmBOmgz3apQlp/lfgg+HqbFTqEVbTJDMIE Jr0DZ1WvtJI3FSdoANEi+bBNwzl4wxhFf8SQ X-Google-Smtp-Source: AMsMyM6Gbr+irE43RSs/Oy5D8UEsVlCotXhjsslSERubgOCshKwSQcqTQUpcIgX4PIQ5cfJVGmHCHw== X-Received: by 2002:a05:6820:381:b0:49b:dee1:2677 with SMTP id r1-20020a056820038100b0049bdee12677mr5679320ooj.70.1667400974067; Wed, 02 Nov 2022 07:56:14 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:a9f4:967f:f7c:c187:85d7]) by smtp.gmail.com with ESMTPSA id 37-20020a9d0328000000b00661af2f9a1asm5205767otv.49.2022.11.02.07.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 07:56:13 -0700 (PDT) To: libc-alpha@sourceware.org, Fangrui Song Subject: [PATCH v2 2/4] Rewrite find_cxx_header config configure.ac Date: Wed, 2 Nov 2022 11:55:57 -0300 Message-Id: <20221102145559.1962008-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221102145559.1962008-1-adhemerval.zanella@linaro.org> References: <20221102145559.1962008-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" With clang If the main file is , the first non-main-file dependency is not listed in the -MP output. Although it was fixed on clang-16 [1], this change adds portability for older version. [1] https://github.com/llvm/llvm-project/commit/ff9576f74514b836e1ba0268409a2ecb919d7118 Reviewed-by: Fangrui Song --- configure | 4 ++-- configure.ac | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index fc3d7842de..e23ea95a49 100755 --- a/configure +++ b/configure @@ -5669,8 +5669,8 @@ fi # copy of those headers in Makerules. if test -n "$CXX"; then find_cxx_header () { - echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \ - | sed -n "\,$1:,{s/:\$//;p}" + echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \ + | awk '$1 == "."{print $2}' } CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)" CXX_CMATH_HEADER="$(find_cxx_header cmath)" diff --git a/configure.ac b/configure.ac index 9fc1fb1c1c..7275b53345 100644 --- a/configure.ac +++ b/configure.ac @@ -1137,8 +1137,8 @@ AC_SUBST(CXX_SYSINCLUDES) # copy of those headers in Makerules. if test -n "$CXX"; then find_cxx_header () { - echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \ - | sed -n "\,$1:,{s/:\$//;p}" + echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \ + | awk '$1 == "."{print $2}' } CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)" CXX_CMATH_HEADER="$(find_cxx_header cmath)"