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

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

Comments

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

Patch

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