From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id B37A83858425; Mon, 14 Nov 2022 13:51:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B37A83858425 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668433898; bh=2UAgG67058MPMvlKn+YFiewD8IKn7zb5/knR78Kg7aw=; h=From:To:Subject:Date:From; b=BF12h2If5IfNxicMAiLPGsOFjZiUBPJszpKo7EHEwWW1saCScyi3PE0YgdD2X961h ttbmWK+LvkjdCEOXYqZRPNpH5XxiURmwGWM4KExiiyD0TaCXcOBn6EbNX+Tt1M2oRM sEgBbTEmjb/IsW2rRq1LvsKhQsX6z3sBrB9bnSFI= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4012] ada: Fix non-capturing parentheses handling X-Act-Checkin: gcc X-Git-Author: Ronan Desplanques X-Git-Refname: refs/heads/master X-Git-Oldrev: 442886a99dae94012575bcc1cd3407284da42081 X-Git-Newrev: 0a2304a04925e43a50a345fb6a0b0c8ba180a973 Message-Id: <20221114135138.B37A83858425@sourceware.org> Date: Mon, 14 Nov 2022 13:51:38 +0000 (GMT) List-Id: https://gcc.gnu.org/g:0a2304a04925e43a50a345fb6a0b0c8ba180a973 commit r13-4012-g0a2304a04925e43a50a345fb6a0b0c8ba180a973 Author: Ronan Desplanques Date: Mon Oct 31 18:08:37 2022 +0100 ada: Fix non-capturing parentheses handling Before this patch, non-capturingly parenthesized expressions with more than one branch were processed incorrectly when part of a branch followed by another branch. This patch fixes this by aligning the handling of non-capturing parentheses with the handling of regular parentheses. gcc/ada/ * libgnat/s-regpat.adb (Parse): Fix handling of non-capturing parentheses. Diff: --- gcc/ada/libgnat/s-regpat.adb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gcc/ada/libgnat/s-regpat.adb b/gcc/ada/libgnat/s-regpat.adb index 3290f900544..3e9f880cd4e 100644 --- a/gcc/ada/libgnat/s-regpat.adb +++ b/gcc/ada/libgnat/s-regpat.adb @@ -920,18 +920,16 @@ package body System.Regpat is if Capturing then Ender := Emit_Node (CLOSE); Emit (Character'Val (Par_No)); - Link_Tail (IP, Ender); - else - -- Need to keep looking after the closing parenthesis - Ender := Emit_Ptr; + Ender := Emit_Node (NOTHING); end if; else Ender := Emit_Node (EOP); - Link_Tail (IP, Ender); end if; + Link_Tail (IP, Ender); + if Have_Branch and then Emit_Ptr <= PM.Size + 1 then -- Hook the tails of the branches to the closing node