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

Arnaud Charlet charlet@adacore.com
Fri Jan 4 09:18:00 GMT 2013


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 r1.ads

must yield:

   r1.ads:2:16: aspect specification is an Ada 2012 feature
   r1.ads:2:16: unit must be compiled with -gnat2012 switch

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

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

2013-01-04  Ed Schonberg  <schonberg@adacore.com>

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

-------------- next part --------------
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
 


More information about the Gcc-patches mailing list