-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, 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- --
if Token = Tok_Return then
Restore_Scan_State (Scan_State);
- Error_Msg_SC ("unexpected semicolon ignored");
+ Error_Msg_SC ("|extra "";"" ignored");
Scan; -- rescan past junk semicolon
-
else
Restore_Scan_State (Scan_State);
end if;
-- Note: in the case of OVERRIDING keyword used in Ada 95 mode, the
-- declaration circuit already gave an error message and changed the
- -- tokem to Tok_Overriding.
+ -- token to Tok_Overriding.
elsif Token = Tok_Overriding then
Scan; -- past OVERRIDING
-- already been given, so no need to give another message here.
-- An overriding indicator is allowed for subprogram declarations,
- -- bodies, renamings, stubs, and instantiations.
+ -- bodies, renamings, stubs, and instantiations. The test against
+ -- Pf_Decl_Pbod is added to account for the case of subprograms
+ -- declared in a protected type, where only subprogram declarations
+ -- and bodies can occur.
- if Pf_Flags /= Pf_Decl_Gins_Pbod_Rnam_Stub then
+ if Pf_Flags /= Pf_Decl_Gins_Pbod_Rnam_Stub
+ and then
+ Pf_Flags /= Pf_Decl_Pbod
+ then
Error_Msg_SC ("overriding indicator not allowed here!");
- elsif Token /= Tok_Function
- and then Token /= Tok_Procedure
- then
- Error_Msg_SC ("FUNCTION or PROCEDURE expected!");
+ elsif Token /= Tok_Function and then Token /= Tok_Procedure then
+ Error_Msg_SC -- CODEFIX
+ ("FUNCTION or PROCEDURE expected!");
end if;
end if;
end if;
Scope.Table (Scope.Last).Labl := Name_Node;
-
- if Token = Tok_Colon then
- Error_Msg_SC ("redundant colon ignored");
- Scan; -- past colon
- end if;
+ Ignore (Tok_Colon);
-- Deal with generic instantiation, the one case in which we do not
-- have a subprogram specification as part of whatever we are parsing
Discard_Junk_Node (P_Expression);
end if;
+ -- Deal with semicolon followed by IS. We want to treat this as IS
+
+ if Token = Tok_Semicolon then
+ Save_Scan_State (Scan_State);
+ Scan; -- past semicolon
+
+ if Token = Tok_Is then
+ Error_Msg_SP ("extra "";"" ignored");
+ else
+ Restore_Scan_State (Scan_State);
+ end if;
+ end if;
+
-- Deal with case of semicolon ending a subprogram declaration
if Token = Tok_Semicolon then
-- semicolon, and go process the body.
if Token = Tok_Is then
- Error_Msg_SP ("unexpected semicolon ignored");
- T_Is; -- ignroe redundant IS's
+ Error_Msg_SP ("|extra "";"" ignored");
+ T_Is; -- scan past IS
goto Subprogram_Body;
-- If BEGIN follows in an appropriate column, we immediately
elsif Token = Tok_Begin
and then Start_Column >= Scope.Table (Scope.Last).Ecol
then
- Error_Msg_SP (""";"" should be IS!");
+ Error_Msg_SP ("|"";"" should be IS!");
goto Subprogram_Body;
else
-- semicolon which should really be an IS
else
- Error_Msg_AP ("missing "";""");
+ Error_Msg_AP ("|missing "";""");
SIS_Missing_Semicolon_Message := Get_Msg_Id;
goto Subprogram_Declaration;
end if;
-- that semicolon should have been a right parenthesis and exit
if Token = Tok_Is or else Token = Tok_Return then
- Error_Msg_SP ("expected "")"" in place of "";""");
+ Error_Msg_SP ("|"";"" should be "")""");
exit Specification_Loop;
end if;
end if;
if Token = Tok_In then
- Error_Msg_SC ("IN must precede OUT in parameter mode");
+ Error_Msg_SC -- CODEFIX ???
+ ("IN must precede OUT in parameter mode");
Scan; -- past IN
Set_In_Present (Node, True);
end if;
Set_Constant_Present (Decl_Node);
if Token = Tok_Aliased then
- Error_Msg_SC ("ALIASED should be before CONSTANT");
+ Error_Msg_SC -- CODEFIX
+ ("ALIASED should be before CONSTANT");
Scan; -- past ALIASED
Set_Aliased_Present (Decl_Node);
end if;