From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by sourceware.org (Postfix) with ESMTPS id C502C3858D28 for ; Sat, 4 Mar 2023 01:58:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C502C3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=axis.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1677895107; x=1709431107; h=from:to:cc:in-reply-to:subject:mime-version: content-transfer-encoding:references:message-id:date; bh=s1wT9584J1/Q7LVqLXmK+UhzEAXlVn3Tm5MIY+vKh4M=; b=GOCk4+nqXlWKpwQROK5VBXCEjuqisE9HVb9D46uaHF64RTMD4pSjgc1T fWH+2slxrWtpi64Sjnc0flSJZpa3SkT7j6J6f+sLH7gNvfq46z/7JDrh3 AkaQW0e5qrFr6KzfC/Fq6Qy7/+zFE+aU2viznq6xO+ml2o+jRHSnKw7WX FidpH2uQzBrwKtR+tzZLi2Oq6FMeXcAOoPGFm8t/t+9fZPbiIxPvCmWZJ 69Z2mzODT5+eqd93x2SPNNNo86CQiV0GvjZ1BEZ2N2/AYQAwZ7LKR9Xgk IfKlvylP5g8Yi3BhH91h+7F8eFRIfESd6bYtcC1JDBd54I+vQz6A40EXU A==; From: Hans-Peter Nilsson To: CC: In-Reply-To: <20230224191603.3935F20447@pchp3.se.axis.com> (message from Hans-Peter Nilsson on Fri, 24 Feb 2023 20:16:03 +0100) Subject: Ping: [PATCH 1/2] testsuite: Provide means to regexp in multiline patterns MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT References: <20230224191603.3935F20447@pchp3.se.axis.com> Message-ID: <20230304015825.56CC220420@pchp3.se.axis.com> Date: Sat, 4 Mar 2023 02:58:25 +0100 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_PASS,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 List-Id: Ping... > From: Hans-Peter Nilsson > Date: Fri, 24 Feb 2023 20:16:03 +0100 > > Ok to commit? > -- >8 -- > Those multi-line-patterns are literal. Sometimes a regexp > needs to be matched. This is a start: just three elements > are supported: "(" ")" and the compound ")?" (and on second > thought, it can be argued that "(...)" alone is not useful). > Note that Tcl "string map" is documented to have the desired > effect: a once-over but no re-recognitions of previously > replaced mapped elements. Also, drop a doubled "containing". > > testsuite: > * lib/multiline.exp (_build_multiline_regex): Map > "{re:" to "(", ":re}" to ")" and ":re?}" to ")?". > --- > gcc/testsuite/lib/multiline.exp | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/gcc/testsuite/lib/multiline.exp b/gcc/testsuite/lib/multiline.exp > index 5eccf2bbebc1..f746bc3a618e 100644 > --- a/gcc/testsuite/lib/multiline.exp > +++ b/gcc/testsuite/lib/multiline.exp > @@ -297,7 +297,7 @@ proc _get_lines { filename first_line last_line } { > > # Convert $multiline from a list of strings to a multiline regex > # We need to support matching arbitrary followup text on each line, > -# to deal with comments containing containing DejaGnu directives. > +# to deal with comments containing DejaGnu directives. > > proc _build_multiline_regex { multiline index } { > verbose "_build_multiline_regex: $multiline $index" 4 > @@ -307,7 +307,10 @@ proc _build_multiline_regex { multiline index } { > verbose " line: $line" 4 > > # We need to escape "^" and other regexp metacharacters. > - set line [string map {"^" "\\^" > + set line [string map {"\{re:" "(" > + ":re?\}" ")?" > + ":re\}" ")" > + "^" "\\^" > "(" "\\(" > ")" "\\)" > "[" "\\[" > -- > 2.30.2 >