public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Stronger assertion about flag for checking static expressions
@ 2021-07-07 16:25 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-07 16:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]

Ensure that Checking_For_Potentially_Static_Expression flag is
manipulated in a stack-like manner (with stack depth 1 at the most). The
previous assertion didn't prevent us from setting the flag to True or to
False twice in a row.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_eval.adb (Set_Checking_Potentially_Static_Expression):
	Stronger assertion.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 821 bytes --]

diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb
--- a/gcc/ada/sem_eval.adb
+++ b/gcc/ada/sem_eval.adb
@@ -6481,11 +6481,10 @@ package body Sem_Eval is
 
    procedure Set_Checking_Potentially_Static_Expression (Value : Boolean) is
    begin
-      --  Verify that we're not currently checking for a potentially static
-      --  expression unless we're disabling such checking.
+      --  Verify that we only start/stop checking for a potentially static
+      --  expression and do not start or stop it twice in a row.
 
-      pragma Assert
-        (not Checking_For_Potentially_Static_Expression or else not Value);
+      pragma Assert (Checking_For_Potentially_Static_Expression /= Value);
 
       Checking_For_Potentially_Static_Expression := Value;
    end Set_Checking_Potentially_Static_Expression;



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

only message in thread, other threads:[~2021-07-07 16:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 16:25 [Ada] Stronger assertion about flag for checking static expressions 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).