From patchwork Fri Feb 24 19:16:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 61420 Return-Path: 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 (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 ; 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 ; Fri, 24 Feb 2023 19:16:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CE0C53857C45 To: Subject: [PATCH 1/2] testsuite: Provide means to regexp in multiline patterns MIME-Version: 1.0 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Hans-Peter Nilsson via Gcc-patches From: Hans-Peter Nilsson Reply-To: Hans-Peter Nilsson Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758741096551585514?= X-GMAIL-MSGID: =?utf-8?q?1758741096551585514?= 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\}" ")" + "^" "\\^" "(" "\\(" ")" "\\)" "[" "\\[" From patchwork Fri Feb 24 19:18:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 61421 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1097342wrd; Fri, 24 Feb 2023 11:19:29 -0800 (PST) X-Google-Smtp-Source: AK7set+CIjg0mEMogRekhOWwALX6Ri9S+aHY9G2L1zq31NHResU++xcV/Je3/uEOJoCI65j/NiYD X-Received: by 2002:a17:906:ce38:b0:8b2:8876:6a3c with SMTP id sd24-20020a170906ce3800b008b288766a3cmr27667786ejb.29.1677266369315; Fri, 24 Feb 2023 11:19:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677266369; cv=none; d=google.com; s=arc-20160816; b=t47bU9HUuuByJaPE8PFh75sFADXoTqkPWsu/3j4+Ez010uGJp48F90RxiBKq6XulCV 9tmzIQNv0zKBK1VY9sGLIP1iSuMjbotfa5E19SsUpmH5gRZICEAM2y5XqhIt3AH5q++w Arl/mMGB+fpRMWU9KMP8MXn6y6AFohwQGHO/BvGUY4RE+AS7SeyptQZTM6EH/i5t1dL1 UulNSz3I+8QqkQ00VThCI9HvMG3Sag9zKpPTdxXJWj4wtOfj1HOH75jukROmr15dHshM 0z1G3LS0QZFXBGPv7eGLNOJIOK6ZNCkY42jPhKTJTdXYfntg16RB9arN6yg8tb65QQq+ q2XQ== 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=eVPwrq4jX+Bs3axYfIV9Fiv36r2Kfr9EknjeytUL5Bw=; b=RdMxcEBnQM/EffzV4BzWvK94J1faUAkt8eDrdyxMBg+h8cGwg5QLStE6LNprTKd51e HUrycfy1W70Bk6Qaz0oBAYhHgRd7dgpMYbBmSLbvULBjgIRCFtZ1obc66jNlrb0shAib p5XRBCJGsYbbCOTwC5nyjC/KtndXNkPDM3H64SVxnknFxBpvUAhGZ5s9JDLTauRUGWU/ 07KZ0q11wGf/+jRSN/H8CFhVMX2EaS7oh0O6QWPrcl6bpLBvaST1grRAazdlv0QQrkab r9/idYh3A7mxHttMMak83ut7EN3n3acnUY1Lh/+8PswDngkeRHKcFMZPLnBzL8wCxMyv sVMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=njOwuU92; 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 30-20020a17090600de00b008c0f93e4de3si25805278eji.99.2023.02.24.11.19.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Feb 2023 11:19:29 -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=njOwuU92; 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 239363851C03 for ; Fri, 24 Feb 2023 19:19:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 239363851C03 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677266368; bh=eVPwrq4jX+Bs3axYfIV9Fiv36r2Kfr9EknjeytUL5Bw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=njOwuU929z3YN0XD21tE+QxjCDrko8ejKKAs8uXPd0K/ICgEuFOriEuzS4N5+MsKv CUZunqGVha5qtuSpsazhr9JOENew55gd+V6UNgnFXxwHDwMgkSMsmMh7+e2ie3bp1J Gz0NjbRv6SWaUSNzxxKntK8hhYuH229K+Oir7flQ= 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 8CE2F385840F for ; Fri, 24 Feb 2023 19:18:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8CE2F385840F To: Subject: [PATCH 2/2] testsuite: Fix gcc.dg/analyzer/allocation-size-multiline-3.c MIME-Version: 1.0 Message-ID: <20230224191843.729A520444@pchp3.se.axis.com> Date: Fri, 24 Feb 2023 20:18:43 +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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Hans-Peter Nilsson via Gcc-patches From: Hans-Peter Nilsson Reply-To: Hans-Peter Nilsson Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758741260612250445?= X-GMAIL-MSGID: =?utf-8?q?1758741260612250445?= I'll install this as obvious provided that the prerequisite multiline.exp patch is approved. -- >8 -- For 32-bit newlib targets (such as cris-elf and pru-elf), that int32_t is "long int". See other regexps in the testsuite matching "aka (long )?int" (with single-quotes where needed) where the pattern in allocation-size-multiline-3.c matches plain "int". Uses the special syntax recently introduced for multi-line patterns. testsuite: * gcc.dg/analyzer/allocation-size-multiline-3.c: Handle int32_t being "long int". --- gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c index e27364a8e839..b3de582368fc 100644 --- a/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c +++ b/gcc/testsuite/gcc.dg/analyzer/allocation-size-multiline-3.c @@ -21,7 +21,7 @@ void test_constant_99 (void) | ^~~~~~ | | | (1) allocated 99 bytes here - | (2) assigned to 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4' + | (2) assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4' | { dg-end-multiline-output "" } */ @@ -39,6 +39,6 @@ void test_symbolic (int n) | ^~~~~~ | | | (1) allocated 'n * 2' bytes here - | (2) assigned to 'int32_t *' {aka 'int *'} here; 'sizeof (int32_t {aka int})' is '4' + | (2) assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4' | { dg-end-multiline-output "" } */