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 CE0C53857C45 for ; Fri, 24 Feb 2023 19:16:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CE0C53857C45 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=1677266165; x=1708802165; h=from:to:subject:mime-version:content-transfer-encoding: message-id:date; bh=dmDUoP7AfheEW7axIB/88pJwIRs4yNYXDZ1CcJNgh7Q=; b=LUUCvuRs3bKDKtwcB5qAzooRr8Rc95S+M6IQMftbb/YiU1FutD1oBHPd NNWJk8yTh3gT9JXYtzO40/MtwpXAORdk2ONTK2L+KlLaoFskR19NhiHws 2DbLBmZ92UM6ZnIxT3rcd/wTUY92uUpqb6/PnysVRQI5qPt0WAYVuE6UI 2UOM0t3Mqqfyezu64HqIMm7jSPflsi0kd16m/4d3gMG6nD0cnqIixhtSu fEb3BsjwvorUyyQvQg6pQkSfaq4T6hHT/B9SxylW9YGPt12nRb9RVcP9d yoSjOBLvVYPmi1sZNVEbIXsDAiOzYQxGpHBYwZJrD3Kp1SYAg0SkVUs4y w==; From: Hans-Peter Nilsson To: Subject: [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 Message-ID: <20230224191603.3935F20447@pchp3.se.axis.com> Date: Fri, 24 Feb 2023 20:16:03 +0100 X-Spam-Status: No, score=-11.0 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: 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