]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Avoid giving multiple errors on ghost argument
authorViljar Indus <indus@adacore.com>
Tue, 31 Mar 2026 09:04:37 +0000 (12:04 +0300)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 2 Jun 2026 08:42:21 +0000 (10:42 +0200)
Avoid marking multiple errors on the same line if the ghost
expression is both non-static and also would evaluate to False.

gcc/ada/ChangeLog:

* sem_prag.adb (Analyze_Abstract_State): make error checks
exclusive.

gcc/ada/sem_prag.adb

index e3f1ed0e08567aef447e004bccef51876849dba7..a22ae61cd55b3e51e9346ca944c5197ea20a888a 100644 (file)
@@ -13595,9 +13595,7 @@ package body Sem_Prag is
                                           & "in pragma % "
                                           & "must be static"),
                                        Expr);
-                                 end if;
-
-                                 if Is_False (Expr_Value (Expr)) then
+                                 elsif Is_False (Expr_Value (Expr)) then
                                     Is_Ghost := False;
 
                                     --  "Ghostness" cannot be turned off once