public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-243] [Ada] Prevent search for references in postconditions from going too far
@ 2022-05-10  8:22 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-10  8:22 UTC (permalink / raw)
  To: gcc-cvs

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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-10  8:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10  8:22 [gcc r13-243] [Ada] Prevent search for references in postconditions from going too far Pierre-Marie de Rodat

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).