public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-243] [Ada] Prevent search for references in postconditions from going too far
Date: Tue, 10 May 2022 08:22:23 +0000 (GMT)	[thread overview]
Message-ID: <20220510082223.44FA138346BF@sourceware.org> (raw)

https://gcc.gnu.org/g:35f10dc04029e7125c322acbbd71dd30e3c8f54f

commit r13-243-g35f10dc04029e7125c322acbbd71dd30e3c8f54f
Author: Piotr Trojanek <trojanek@adacore.com>
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);


                 reply	other threads:[~2022-05-10  8:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220510082223.44FA138346BF@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).