]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Tweak error messages on misplaced with keywords
authorRonan Desplanques <desplanques@adacore.com>
Wed, 9 Nov 2022 12:32:05 +0000 (13:32 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 21 Nov 2022 10:10:31 +0000 (11:10 +0100)
Before this patch, with clauses placed in declarative sections were
interpreted by the compiler as incorrect aspect specifications, which
led to confusing error messages.

This patch makes it so more syntax errors involving the with keyword
are diagnosed as intended with clauses instead of aspect
specifications.

gcc/ada/

* par-ch3.adb (P_Declarative_Item): Tweak handling of with keyword.

gcc/ada/par-ch3.adb

index aac45890c97c71f7556eaaba83bbb49aeaf10549..483f96d041f11583c64d1c6f3b084b20fad5c6cc 100644 (file)
@@ -4682,7 +4682,7 @@ package body Ch3 is
          when Tok_With =>
             Check_Bad_Layout;
 
-            if Aspect_Specifications_Present then
+            if Aspect_Specifications_Present (Strict => True) then
 
                --  If we are after a semicolon, complain that it was ignored.
                --  But we don't really ignore it, since we dump the aspects,