From patchwork Mon Jun 27 06:11:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Ruoyao X-Patchwork-Id: 55424 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 89091386DC53 for ; Mon, 27 Jun 2022 06:13:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 89091386DC53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1656310423; bh=8+3GFdrOday1Bt2fQRWgPtgzvHZLf+EM3Mm1rXftjyE=; h=Subject:To:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ruHgk4F3TKnpKv/KbchgAkMSeQpcWWgrpSGDZk6U/R8HRvA/e9Ocp8oH4gqgxkEB6 bEPH3H7yX0q9aURKyBNAu5nJkhVKcgBtmgaKMHV3n1ldS4NcxtRLCC2DGrvZmepVfz DG/ZXvvRrCB5pL3u7h3OHCX2YDAiWpasVj6dA6qg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id 8437E386DC66 for ; Mon, 27 Jun 2022 06:11:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8437E386DC66 Received: from [192.168.124.21] (unknown [113.140.11.126]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384)) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 3F53D66807; Mon, 27 Jun 2022 02:11:25 -0400 (EDT) Message-ID: <51908ccd68c022910f59a904556483c123ae428c.camel@xry111.site> Subject: [PATCH v2 5/7] testsuite: stop using obsoleted egrep To: gcc-patches@gcc.gnu.org Date: Mon, 27 Jun 2022 14:11:23 +0800 In-Reply-To: References: User-Agent: Evolution 3.44.2 MIME-Version: 1.0 X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FROM_SUSPICIOUS_NTLD, GIT_PATCH_0, LIKELY_SPAM_FROM, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_PASS, SPF_PASS, TXREP, T_PDS_OTHER_BAD_TLD, T_SCC_BODY_TEXT_LINE 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: Xi Ruoyao via Gcc-patches From: Xi Ruoyao Reply-To: Xi Ruoyao Cc: Bernhard Reutner-Fischer , Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" egrep has been deprecated in favor of grep -E for a long time, and the next grep release (3.8 or 4.0) will print a warning of egrep is used. Stop using egrep so we won't see the warning. However, simply replacing egrep with grep -E will break build on some systems (notably Solaris) w/o a POSIX-conform grep. We detect a suitable command with AC_PROG_EGREP, and pass it to run_acats.sh for Ada. For Go, simply use grep instead of egrep as the pattern does not need any ERE features. gcc/ChangeLog: * Makefile.in (EGREP): New variable. * configure.ac (AC_PROG_EGREP): Call it. * configure: Regenerate. gcc/ada/ChangeLog: * gcc-interface/Make-lang.in: Pass EGREP to run_acats.sh. gcc/testsuite/ChangeLog: * ada/acats/run_all.sh: Use $EGREP instead of egrep. * go.test/go-test.exp: Use grep intead of egrep. --- gcc/Makefile.in | 1 + gcc/ada/gcc-interface/Make-lang.in | 3 +- gcc/configure | 71 +++++++++++++++++++++++++++++- gcc/configure.ac | 1 + gcc/testsuite/ada/acats/run_all.sh | 8 +++- gcc/testsuite/go.test/go-test.exp | 2 +- 6 files changed, 81 insertions(+), 5 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index b6dcc45a58a..8b95ee20b46 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1090,6 +1090,7 @@ BACKENDLIBS = $(ISLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \ SYSLIBS = @GNAT_LIBEXC@ # Used from ada/gcc-interface/Make-lang.in +EGREP = @EGREP@ GNATBIND = @GNATBIND@ GNATMAKE = @GNATMAKE@ diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index 1e245ed3b0f..e0cbb6ab1ed 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -1050,7 +1050,8 @@ check-acats: rm -rf $(ACATSDIR)-parallel; \ mkdir $(ACATSDIR)-parallel; \ ( testdir=`cd ${srcdir}/${ACATSDIR} && ${PWD_COMMAND}`; \ - export testdir; \ + EGREP="$EGREP"; \ + export testdir EGREP; \ cd $(ACATSDIR) && $(SHELL) $${testdir}/$(ACATSCMD) NONE ) \ || exit 1; \ GCC_RUNTEST_PARALLELIZE_DIR=$$rootme/$(ACATSDIR)-parallel; \ diff --git a/gcc/configure b/gcc/configure index c58ec9b2273..8bd384c3fcc 100755 --- a/gcc/configure +++ b/gcc/configure @@ -8416,6 +8416,73 @@ case ${AWK} in "") as_fn_error $? "can't build without awk, bailing out" "$LINENO" 5 ;; esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } if ${gcc_cv_prog_LN_S+:} false; then : @@ -19675,7 +19742,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19678 "configure" +#line 19745 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19781,7 +19848,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19784 "configure" +#line 19851 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index 80bdd8ceef9..bfb124e9456 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1219,6 +1219,7 @@ case ${AWK} in "") AC_MSG_ERROR([can't build without awk, bailing out]) ;; esac +AC_PROG_EGREP gcc_AC_PROG_LN_S ACX_PROG_LN($LN_S) AC_PROG_RANLIB diff --git a/gcc/testsuite/ada/acats/run_all.sh b/gcc/testsuite/ada/acats/run_all.sh index ac2a86bea6c..81d3f9edd5c 100755 --- a/gcc/testsuite/ada/acats/run_all.sh +++ b/gcc/testsuite/ada/acats/run_all.sh @@ -53,6 +53,12 @@ if [ "$dir" = "$testdir" ]; then exit 1 fi +if [ -z "$EGREP" ]; then + # Set a default suitable for all "modern" system in case this script is + # not invoked by GCC building system. + EGREP="grep -E" +fi + GCC="$BASE/xgcc -B$BASE/" target_gnatchop () { @@ -367,7 +373,7 @@ for chapter in $chapters; do target_run $dir/tests/$chapter/$i/$binmain > $dir/tests/$chapter/$i/${i}.log 2>&1 cd $dir/tests/$chapter/$i cat ${i}.log >> $dir/acats.log - egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log > /dev/null 2>&1 + $EGREP -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log > /dev/null 2>&1 if [ $? -ne 0 ]; then grep 'tasking not implemented' ${i}.log > /dev/null 2>&1 diff --git a/gcc/testsuite/go.test/go-test.exp b/gcc/testsuite/go.test/go-test.exp index 11c178ad7ec..c9dbd72d16a 100644 --- a/gcc/testsuite/go.test/go-test.exp +++ b/gcc/testsuite/go.test/go-test.exp @@ -1207,7 +1207,7 @@ proc go-gc-tests { } { || $test_line == "// \$G \$D/empty.go && errchk \$G \$D/\$F.go" } { # These tests import the same package under two different # names, which gccgo does not support. - } elseif { $test_line == "// \$G -S \$D/\$F.go | egrep initdone >/dev/null && echo BUG sinit || true" } { + } elseif { $test_line == "// \$G -S \$D/\$F.go | grep initdone >/dev/null && echo BUG sinit || true" } { # This tests whether initializers are written out # statically. gccgo does not provide a way to test that, # as an initializer will be generated for any code which