OSDN Git Service

Fix 4 execute/va-arg-26.c gcc testsuite failures.
[pf3gnuchains/gcc-fork.git] / gcc / ada / par-tchk.adb
index 4d49e7a..cdb5418 100644 (file)
@@ -6,9 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                            $Revision: 1.37 $
---                                                                          --
---          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2003 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- --
@@ -22,7 +20,7 @@
 -- MA 02111-1307, USA.                                                      --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
--- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
 --                                                                          --
 ------------------------------------------------------------------------------
 
@@ -86,15 +84,15 @@ package body Tchk is
       --  A little recovery helper, accept then in place of =>
 
       elsif Token = Tok_Then then
-         Error_Msg_BC ("missing ""=>""");
+         Error_Msg_BC ("missing ""='>""");
          Scan; -- past THEN used in place of =>
 
       elsif Token = Tok_Colon_Equal then
-         Error_Msg_SC (""":="" should be ""=>""");
+         Error_Msg_SC (""":="" should be ""='>""");
          Scan; -- past := used in place of =>
 
       else
-         Error_Msg_AP ("missing ""=>""");
+         Error_Msg_AP ("missing ""='>""");
       end if;
    end T_Arrow;
 
@@ -125,7 +123,7 @@ package body Tchk is
       if Token = Tok_Box then
          Scan;
       else
-         Error_Msg_AP ("missing ""<>""");
+         Error_Msg_AP ("missing ""'<'>""");
       end if;
    end T_Box;
 
@@ -225,7 +223,7 @@ package body Tchk is
       if Token = Tok_Greater_Greater then
          Scan;
       else
-         Error_Msg_AP ("missing "">>""");
+         Error_Msg_AP ("missing ""'>'>""");
       end if;
    end T_Greater_Greater;
 
@@ -401,17 +399,22 @@ package body Tchk is
             Scan;
          end if;
 
+         return;
+
       elsif Token = Tok_Colon then
          Error_Msg_SC (""":"" should be "";""");
          Scan;
+         return;
 
       elsif Token = Tok_Comma then
          Error_Msg_SC (""","" should be "";""");
          Scan;
+         return;
 
       elsif Token = Tok_Dot then
          Error_Msg_SC ("""."" should be "";""");
          Scan;
+         return;
 
       --  An interesting little kludge here. If the previous token is a
       --  semicolon, then there is no way that we can legitimately need
@@ -427,16 +430,29 @@ package body Tchk is
       --  place to suggest the possibility of a "C" confusion :-)
 
       elsif Token = Tok_Vertical_Bar then
-         Error_Msg_SC ("unexpected occurrence of ""|"", did you mean OR'?");
+         Error_Msg_SC ("unexpected occurrence of ""'|"", did you mean OR'?");
          Resync_Past_Semicolon;
+         return;
 
-      --  Otherwise we really do have a missing semicolon
+      --  Deal with pragma. If pragma is not at start of line, it is
+      --  considered misplaced otherwise we treat it as a normal
+      --  missing semicolong case.
 
-      else
-         Error_Msg_AP ("missing "";""");
-         return;
+      elsif Token = Tok_Pragma
+        and then not Token_Is_At_Start_Of_Line
+      then
+         P_Pragmas_Misplaced;
+
+         if Token = Tok_Semicolon then
+            Scan;
+            return;
+         end if;
       end if;
 
+      --  If none of those tests return, we really have a missing semicolon
+
+      Error_Msg_AP ("|missing "";""");
+      return;
    end T_Semicolon;
 
    ------------
@@ -662,7 +678,13 @@ package body Tchk is
          return;
 
       else
-         if Token = Tok_Pragma then
+         --  Deal with pragma. If pragma is not at start of line, it is
+         --  considered misplaced otherwise we treat it as a normal
+         --  missing semicolong case.
+
+         if Token = Tok_Pragma
+           and then not Token_Is_At_Start_Of_Line
+         then
             P_Pragmas_Misplaced;
 
             if Token = Tok_Semicolon then
@@ -671,7 +693,12 @@ package body Tchk is
             end if;
          end if;
 
-         T_Semicolon; -- give missing semicolon message
+         --  Here we definitely have a missing semicolon, so give message
+
+         T_Semicolon;
+
+         --  Scan out junk on rest of line
+
          Save_Scan_State (Scan_State); -- at start of junk tokens
 
          loop