Patchwork [Ada] Better error message for aspect specification without Ada 2012 mode

mail settings
Submitter Arnaud Charlet
Date Jan. 4, 2013, 9:18 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/209418/
State New
Headers show


Arnaud Charlet - Jan. 4, 2013, 9:18 a.m.
This patch improves the error message when compiling a unit with an aspect
specification in an older Ada mode, and the first aspect specification is for
a boolean aspect whose value is defaulted.

Compiling the following:

   gcc -c

must yield: aspect specification is an Ada 2012 feature unit must be compiled with -gnat2012 switch

package R1 is
   procedure Q with
     Pre => False;
end R1;

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

2013-01-04  Ed Schonberg  <>

	* par-ch13.adb (Aspect_Specifications_Present): In Strict mode,
	accept an aspect name followed by a comma, indicating a defaulted
	boolean aspect.


Index: par-ch13.adb
--- par-ch13.adb	(revision 194841)
+++ par-ch13.adb	(working copy)
@@ -105,6 +105,13 @@ 
             if Token = Tok_Arrow then
                Result := True;
+            --  The identifier may be the name of a boolean aspect with a
+            --  defaulted True value. Further checks when analyzing aspect
+            --  specification.
+            elsif Token = Tok_Comma then
+               Result := True;
             elsif Token = Tok_Apostrophe then
                Scan; -- past apostrophe