From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 44FA138346BF; Tue, 10 May 2022 08:22:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 44FA138346BF MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-243] [Ada] Prevent search for references in postconditions from going too far X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: 8cec0688df7258e16b7c9d2614e16b5b9346da1d X-Git-Newrev: 35f10dc04029e7125c322acbbd71dd30e3c8f54f Message-Id: <20220510082223.44FA138346BF@sourceware.org> Date: Tue, 10 May 2022 08:22:23 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2022 08:22:23 -0000 https://gcc.gnu.org/g:35f10dc04029e7125c322acbbd71dd30e3c8f54f commit r13-243-g35f10dc04029e7125c322acbbd71dd30e3c8f54f Author: Piotr Trojanek Date: Sat Jan 22 14:51:27 2022 +0100 [Ada] Prevent search for references in postconditions from going too far Add a standard prevention against climbing the entire compilation unit. Cleanup only; behaviour of the compiler is unaffected. gcc/ada/ * sem_warn.adb (Within_Postcondition): Guard against search going too far. Diff: --- gcc/ada/sem_warn.adb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 31ba4d1e903..d1f2036e100 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -2007,6 +2007,11 @@ package body Sem_Warn is then return True; end if; + + -- Prevent the search from going too far + + elsif Is_Body_Or_Package_Declaration (Nod) then + exit; end if; Nod := Parent (Nod);