Message ID | 20230224191603.3935F20447@pchp3.se.axis.com |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1096024wrd; Fri, 24 Feb 2023 11:16:53 -0800 (PST) X-Google-Smtp-Source: AK7set87e+rSPqoM0ol11+M3VDYOPX1bRz/kPAKV8F1P8Kg9BaJWWoCXriPBleLRC7xUAn7kCtfP X-Received: by 2002:aa7:d297:0:b0:4af:63a7:7474 with SMTP id w23-20020aa7d297000000b004af63a77474mr9511436edq.17.1677266212899; Fri, 24 Feb 2023 11:16:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677266212; cv=none; d=google.com; s=arc-20160816; b=z+qL6TQG3I10XZDdnYVXJVTiO1y2/uumdzN/mWo7ZCyInL5ijJrQFyrmstN66GHpqA BJ7mdQ178jtarjrmuWa90mi7TLl1/KmjB9g9ZVr7ZFVicxAeKZUchgAYQEVBnRHOT0GM SExDeW3wWv28tmPjSfGLVCqft4dnWRg4enSgWuT+X9hDd0sWgt8wfVVpHOBBlVdv/nc4 OzIt/AeK4umavydMtGUieLd2pIs0Me2H5JM9bVaXchpKxnQowlR9KBRpC0h/TUfbKEIU FFr7NIEHZq54OU2QGi4dYBPc9IsntOMmM0hGmCE9AtLVRGN+6JshzBvABHbjNPz0Kyeq 6dtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:date:message-id :content-transfer-encoding:mime-version:subject:to:dmarc-filter :delivered-to:dkim-signature:dkim-filter; bh=dmDUoP7AfheEW7axIB/88pJwIRs4yNYXDZ1CcJNgh7Q=; b=Dx5/XBjd4+YO7RRaKykrs+PhE8p60i6y/cdgz5UcNEaqAiPhrRsk9sY+7ryPj884/i vSR0ot6NHgbqYWeZwUCDm3K5E83SJobg8hZ32Jz8VMZPELBWG15iBy1MON/MXnDk3zpd Lp4FFYrmXG4f0lrfIBJKbIkwVlqVTOskthtsVATah22T1kB2La6RBBjwammWI73TmPzQ SNMInxQsgoMd40Se0v0uEN0jTCbreUCn8Exs9BC6zGdXaTqxZ1N/EQhQS7yIpxsS1NXO Pkt5jaPuVLOxy1sxdusgrBXK2NhSB+RcTrJ8qGCyoKOBSnnScBf3wW1kC/gVxp3Yj4Fc s9Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=MU6JCkwY; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id f25-20020a170906739900b008b17cc2e38asi32415071ejl.582.2023.02.24.11.16.52 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Feb 2023 11:16:52 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=MU6JCkwY; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CF04F3851ABC for <ouuuleilei@gmail.com>; Fri, 24 Feb 2023 19:16:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF04F3851ABC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677266210; bh=dmDUoP7AfheEW7axIB/88pJwIRs4yNYXDZ1CcJNgh7Q=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=MU6JCkwY+Fpi57TGByQ9pQjd6mKxK5SWs5HrOecK+55EqHSVU843e6QRmRpeZxIWS 4owAVBhHCguz3oCv1bf26xvzbTWhHt0tEVdWi50sv5ApMUJYheozlCvpA0FuQ8iWqM JslAaC4AN/yqmXdfUe7FRIDgEgjjPzI5OQhjdkMM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by sourceware.org (Postfix) with ESMTPS id CE0C53857C45 for <gcc-patches@gcc.gnu.org>; Fri, 24 Feb 2023 19:16:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CE0C53857C45 To: <gcc-patches@gcc.gnu.org> 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Hans-Peter Nilsson via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Hans-Peter Nilsson <hp@axis.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758741096551585514?= X-GMAIL-MSGID: =?utf-8?q?1758741096551585514?= |
Series |
[1/2] testsuite: Provide means to regexp in multiline patterns
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Hans-Peter Nilsson
Feb. 24, 2023, 7:16 p.m. UTC
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(-)
Comments
Ping... > From: Hans-Peter Nilsson <hp@axis.com> > 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 >
Ok On Mar 3, 2023, at 5:58 PM, Hans-Peter Nilsson <hp@axis.com> wrote: > > Ping... > >> From: Hans-Peter Nilsson <hp@axis.com> >> Date: Fri, 24 Feb 2023 20:16:03 +0100 >> >> Ok to commit?
> From: Mike Stump <mikestump@comcast.net> > Date: Mon, 6 Mar 2023 02:05:35 -0800 > Ok Thanks! The server-side hook didn't like my ChangeLog entry: * lib/multiline.exp (_build_multiline_regex): Map "{re:" to "(", ":re}" to ")" and ":re?}" to ")?". It seems I forgot to validate that patch by contrib/gcc-changelog/git_check_commit.py, which complains: Checking c0debd6f586ef76f1ceabfed11d7eaf8f6d1b110: FAILED ERR: bad wrapping of parenthesis: " "{re:" to "(", ":re}" to ")" and ":re?}" to ")?"." I gave in and took the easy way out; not fixing the bug in that script, but instead "wrapped the parenthesis" to: * lib/multiline.exp (_build_multiline_regex): Map "{re:" to "(", similarly ")?" from ":re?}" and the same without question mark. I hope to make amends by fixing git_check_commit.py, if given guidance. brgds, H-P
On 3/7/23 01:32, Hans-Peter Nilsson wrote: >> From: Mike Stump <mikestump@comcast.net> >> Date: Mon, 6 Mar 2023 02:05:35 -0800 > >> Ok > > Thanks! The server-side hook didn't like my ChangeLog > entry: > > * lib/multiline.exp (_build_multiline_regex): Map > "{re:" to "(", ":re}" to ")" and ":re?}" to ")?". > > It seems I forgot to validate that patch by > contrib/gcc-changelog/git_check_commit.py, which complains: > > Checking c0debd6f586ef76f1ceabfed11d7eaf8f6d1b110: FAILED > ERR: bad wrapping of parenthesis: " "{re:" to "(", ":re}" to ")" and ":re?}" to ")?"." Hello. Yeah, that's quite interesting problem ;) > > I gave in and took the easy way out; not fixing the bug in > that script, but instead "wrapped the parenthesis" to: > > * lib/multiline.exp (_build_multiline_regex): Map > "{re:" to "(", similarly ")?" from ":re?}" and the > same without question mark. > > I hope to make amends by fixing git_check_commit.py, if > given guidance. Sure, you can take a look at: contrib/gcc-changelog/git_commit.py::process_parentheses where we might want to skip the stack push/pop if the character is wrapper in apostrophes or double quotes. Martin > > brgds, H-P
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\}" ")" + "^" "\\^" "(" "\\(" ")" "\\)" "[" "\\["