OSDN Git Service

libitm: Remove unused code.
[pf3gnuchains/gcc-fork.git] / gcc / ada / par-tchk.adb
index 3d45932..6efb1e9 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2007, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -43,10 +43,10 @@ package body Tchk is
    --  position of the error message if the token is missing (see Wrong_Token)
 
    procedure Wrong_Token (T : Token_Type; P : Position);
-   --  Called when scanning a reserved keyword when the keyword is not
-   --  present. T is the token type for the keyword, and P indicates the
-   --  position to be used to place a message relative to the current
-   --  token if the keyword is not located nearby.
+   --  Called when scanning a reserved keyword when the keyword is not present.
+   --  T is the token type for the keyword, and P indicates the position to be
+   --  used to place a message relative to the current token if the keyword is
+   --  not located nearby.
 
    -----------------
    -- Check_Token --
@@ -83,15 +83,18 @@ 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 -- CODEFIX
+           ("|THEN should be ""='>""");
          Scan; -- past THEN used in place of =>
 
       elsif Token = Tok_Colon_Equal then
-         Error_Msg_SC (""":="" should be ""='>""");
+         Error_Msg_SC -- CODEFIX
+           ("|"":="" should be ""='>""");
          Scan; -- past := used in place of =>
 
       else
-         Error_Msg_AP ("missing ""='>""");
+         Error_Msg_AP -- CODEFIX
+           ("missing ""='>""");
       end if;
    end T_Arrow;
 
@@ -122,7 +125,8 @@ package body Tchk is
       if Token = Tok_Box then
          Scan;
       else
-         Error_Msg_AP ("missing ""'<'>""");
+         Error_Msg_AP -- CODEFIX
+           ("missing ""'<'>""");
       end if;
    end T_Box;
 
@@ -135,7 +139,8 @@ package body Tchk is
       if Token = Tok_Colon then
          Scan;
       else
-         Error_Msg_AP ("missing "":""");
+         Error_Msg_AP -- CODEFIX
+           ("missing "":""");
       end if;
    end T_Colon;
 
@@ -149,19 +154,23 @@ package body Tchk is
          Scan;
 
       elsif Token = Tok_Equal then
-         Error_Msg_SC ("""="" should be "":=""");
+         Error_Msg_SC -- CODEFIX
+           ("|""="" should be "":=""");
          Scan;
 
       elsif Token = Tok_Colon then
-         Error_Msg_SC (""":"" should be "":=""");
+         Error_Msg_SC -- CODEFIX
+           ("|"":"" should be "":=""");
          Scan;
 
       elsif Token = Tok_Is then
-         Error_Msg_SC ("IS should be "":=""");
+         Error_Msg_SC -- CODEFIX
+           ("|IS should be "":=""");
          Scan;
 
       else
-         Error_Msg_AP ("missing "":=""");
+         Error_Msg_AP -- CODEFIX
+           ("missing "":=""");
       end if;
    end T_Colon_Equal;
 
@@ -182,7 +191,8 @@ package body Tchk is
          if Token = Tok_Comma then
             Scan;
          else
-            Error_Msg_AP ("missing "",""");
+            Error_Msg_AP -- CODEFIX
+              ("missing "",""");
          end if;
       end if;
 
@@ -200,7 +210,8 @@ package body Tchk is
       if Token = Tok_Dot_Dot then
          Scan;
       else
-         Error_Msg_AP ("missing ""..""");
+         Error_Msg_AP -- CODEFIX
+           ("missing ""..""");
       end if;
    end T_Dot_Dot;
 
@@ -222,7 +233,8 @@ package body Tchk is
       if Token = Tok_Greater_Greater then
          Scan;
       else
-         Error_Msg_AP ("missing ""'>'>""");
+         Error_Msg_AP -- CODEFIX
+           ("missing ""'>'>""");
       end if;
    end T_Greater_Greater;
 
@@ -257,25 +269,43 @@ package body Tchk is
 
    procedure T_Is is
    begin
+      Ignore (Tok_Semicolon);
+
+      --  If we have IS scan past it
+
       if Token = Tok_Is then
          Scan;
 
+         --  And ignore any following semicolons
+
          Ignore (Tok_Semicolon);
 
       --  Allow OF, => or = to substitute for IS with complaint
 
-      elsif Token = Tok_Arrow
-        or else Token = Tok_Of
-        or else Token = Tok_Equal
-      then
-         Error_Msg_SC ("missing IS");
-         Scan; -- token used in place of IS
+      elsif Token = Tok_Arrow then
+         Error_Msg_SC -- CODEFIX
+           ("|""=>"" should be IS");
+         Scan; -- past =>
+
+      elsif Token = Tok_Of then
+         Error_Msg_SC -- CODEFIX
+           ("|OF should be IS");
+         Scan; -- past OF
+
+      elsif Token = Tok_Equal then
+         Error_Msg_SC -- CODEFIX
+           ("|""="" should be IS");
+         Scan; -- past =
+
       else
          Wrong_Token (Tok_Is, AP);
       end if;
 
+      --  Ignore extra IS keywords
+
       while Token = Tok_Is loop
-         Error_Msg_SC ("extra IS ignored");
+         Error_Msg_SC -- CODEFIX
+           ("|extra IS ignored");
          Scan;
       end loop;
    end T_Is;
@@ -289,7 +319,8 @@ package body Tchk is
       if Token = Tok_Left_Paren then
          Scan;
       else
-         Error_Msg_AP ("missing ""(""");
+         Error_Msg_AP -- CODEFIX
+           ("missing ""(""");
       end if;
    end T_Left_Paren;
 
@@ -300,7 +331,8 @@ package body Tchk is
    procedure T_Loop is
    begin
       if Token = Tok_Do then
-         Error_Msg_SC ("LOOP expected");
+         Error_Msg_SC -- CODEFIX
+           ("LOOP expected");
          Scan;
       else
          Check_Token (Tok_Loop, AP);
@@ -379,7 +411,8 @@ package body Tchk is
       if Token = Tok_Right_Paren then
          Scan;
       else
-         Error_Msg_AP ("missing "")""");
+         Error_Msg_AP -- CODEFIX
+           ("|missing "")""");
       end if;
    end T_Right_Paren;
 
@@ -394,24 +427,28 @@ package body Tchk is
          Scan;
 
          if Token = Tok_Semicolon then
-            Error_Msg_SC ("extra "";"" ignored");
+            Error_Msg_SC -- CODEFIX
+              ("|extra "";"" ignored");
             Scan;
          end if;
 
          return;
 
       elsif Token = Tok_Colon then
-         Error_Msg_SC (""":"" should be "";""");
+         Error_Msg_SC -- CODEFIX
+           ("|"":"" should be "";""");
          Scan;
          return;
 
       elsif Token = Tok_Comma then
-         Error_Msg_SC (""","" should be "";""");
+         Error_Msg_SC -- CODEFIX
+           ("|"","" should be "";""");
          Scan;
          return;
 
       elsif Token = Tok_Dot then
-         Error_Msg_SC ("""."" should be "";""");
+         Error_Msg_SC -- CODEFIX
+           ("|""."" should be "";""");
          Scan;
          return;
 
@@ -429,12 +466,13 @@ package body Tchk is
       --  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 -- CODEFIX
+           ("unexpected occurrence of ""'|"", did you mean OR'?");
          Resync_Past_Semicolon;
          return;
 
       --  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.
+      --  misplaced otherwise we treat it as a normal missing semicolon case.
 
       elsif Token = Tok_Pragma
         and then not Token_Is_At_Start_Of_Line
@@ -449,7 +487,8 @@ package body Tchk is
 
       --  If none of those tests return, we really have a missing semicolon
 
-      Error_Msg_AP ("|missing "";""");
+      Error_Msg_AP -- CODEFIX
+        ("|missing "";""");
       return;
    end T_Semicolon;
 
@@ -631,7 +670,8 @@ package body Tchk is
          Scan; -- skip RETURN and we are done
 
       else
-         Error_Msg_SC ("missing RETURN");
+         Error_Msg_SC -- CODEFIX
+           ("missing RETURN");
          Save_Scan_State (Scan_State); -- at start of junk tokens
 
          loop
@@ -678,7 +718,7 @@ package body Tchk is
       else
          --  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.
+         --  missing semicolon case.
 
          if Token = Tok_Pragma
            and then not Token_Is_At_Start_Of_Line
@@ -799,7 +839,8 @@ package body Tchk is
       if Token = Tok_Left_Paren then
          Scan;
       else
-         Error_Msg_AP ("missing ""(""!");
+         Error_Msg_AP -- CODEFIX
+           ("missing ""(""!");
       end if;
    end U_Left_Paren;
 
@@ -812,7 +853,8 @@ package body Tchk is
       if Token = Tok_Right_Paren then
          Scan;
       else
-         Error_Msg_AP ("missing "")""!");
+         Error_Msg_AP -- CODEFIX
+           ("|missing "")""!");
       end if;
    end U_Right_Paren;
 
@@ -831,7 +873,8 @@ package body Tchk is
          Scan;
 
          if Token = T then
-            Error_Msg_SP ("extra "";"" ignored");
+            Error_Msg_SP -- CODEFIX
+              ("|extra "";"" ignored");
             Scan;
          else
             Error_Msg_SP (M);
@@ -841,7 +884,8 @@ package body Tchk is
          Scan;
 
          if Token = T then
-            Error_Msg_SP ("extra "","" ignored");
+            Error_Msg_SP -- CODEFIX
+              ("|extra "","" ignored");
             Scan;
 
          else