sem_ch8.adb (Analyze_Renamed_Entry): For a renaming_as_declaration...

2005-09-01  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch8.adb (Analyze_Renamed_Entry): For a renaming_as_declaration,
	verify that the procedure and the entry are mode conformant.
	(Analyze_Subprogram_Renaming): Emit a warning if an operator is renamed
	as a different operator, which is often a cut-and-paste error.

From-SVN: r103884
This commit is contained in:
Ed Schonberg 2005-09-05 10:02:37 +02:00 committed by Arnaud Charlet
parent 41251c605f
commit 725393ea91
1 changed files with 22 additions and 3 deletions

View File

@ -1047,6 +1047,11 @@ package body Sem_Ch8 is
Check_Subtype_Conformant (New_S, Old_S, N);
Generate_Reference (New_S, Defining_Entity (N), 'b');
Style.Check_Identifier (Defining_Entity (N), New_S);
else
-- Only mode conformance required for a renaming_as_declaration.
Check_Mode_Conformant (New_S, Old_S, N);
end if;
Inherit_Renamed_Profile (New_S, Old_S);
@ -1735,6 +1740,19 @@ package body Sem_Ch8 is
end;
end if;
-- A useful warning, suggested by Ada Bug Finder (Ada-Europe 2005)
if Comes_From_Source (N)
and then Present (Old_S)
and then Nkind (Old_S) = N_Defining_Operator_Symbol
and then Nkind (New_S) = N_Defining_Operator_Symbol
and then Chars (Old_S) /= Chars (New_S)
then
Error_Msg_NE
("?& is being renamed as a different operator",
New_S, Old_S);
end if;
Ada_Version := Save_AV;
Ada_Version_Explicit := Save_AV_Exp;
end Analyze_Subprogram_Renaming;
@ -2067,9 +2085,10 @@ package body Sem_Ch8 is
return;
end if;
Find_Type (Subtype_Mark (Spec));
Rewrite (Subtype_Mark (Spec),
New_Reference_To (Base_Type (Entity (Subtype_Mark (Spec))), Loc));
Find_Type (Result_Definition (Spec));
Rewrite (Result_Definition (Spec),
New_Reference_To (
Base_Type (Entity (Result_Definition (Spec))), Loc));
Body_Node :=
Make_Subprogram_Body (Loc,