public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Incorrect syntax errors when parsing protected type declarations
@ 2008-05-22  7:21 Arnaud Charlet
  0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2008-05-22  7:21 UTC (permalink / raw)
  To: gcc-patches; +Cc: Hristian Kirtchev

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

Tested on i686-linux, committed on trunk

This patch fixes the parsing mechanism of protected type declarations when
the type has at least one interface and no visible declarations.

See gnat.dg/specs/interface5.ads

2008-05-20  Hristian Kirtchev  <kirtchev@adacore.com>

	* par-ch9.adb
	(P_Protected): Update the error message on missing "-gnat05" switch when
	using interfaces in conjunction with protected types. Remove the
	incorrect error message associated with the presence of "private" after
	a "with".


[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 1972 bytes --]

Index: par-ch9.adb
===================================================================
--- par-ch9.adb	(revision 134945)
+++ par-ch9.adb	(working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2007, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2008, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -477,7 +477,7 @@ package body Ch9 is
             Scan; --  past NEW
 
             if Ada_Version < Ada_05 then
-               Error_Msg_SP ("task interface is an Ada 2005 extension");
+               Error_Msg_SP ("protected interface is an Ada 2005 extension");
                Error_Msg_SP ("\unit must be compiled with -gnat05 switch");
             end if;
 
@@ -496,11 +496,6 @@ package body Ch9 is
             end if;
 
             Scan; -- past WITH
-
-            if Token = Tok_Private then
-               Error_Msg_SP
-                 ("PRIVATE not allowed in protected type declaration");
-            end if;
          end if;
 
          Set_Protected_Definition (Protected_Node, P_Protected_Definition);
@@ -561,8 +556,8 @@ package body Ch9 is
          Append (Item_Node, Visible_Declarations (Def_Node));
       end loop;
 
-      --  Deal with PRIVATE part (including graceful handling
-      --  of multiple PRIVATE parts).
+      --  Deal with PRIVATE part (including graceful handling of multiple
+      --  PRIVATE parts).
 
       Private_Loop : while Token = Tok_Private loop
          if No (Private_Declarations (Def_Node)) then

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-22  7:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-22  7:21 [Ada] Incorrect syntax errors when parsing protected type declarations Arnaud Charlet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).