From patchwork Fri Jan 4 09:18:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Ada] Better error message for aspect specification without Ada 2012 mode Date: Thu, 03 Jan 2013 23:18:44 -0000 From: Arnaud Charlet X-Patchwork-Id: 209418 Message-Id: <20130104091844.GA24883@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Ed Schonberg 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 * 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