Commit 1f250383 by Arnaud Charlet

[multiple changes]

2011-08-01  Thomas Quinot  <quinot@adacore.com>

	* sem_ch6.adb (Enter_Overloaded_Entity): Do not warn about a
	declaration being hidden when overriding an implicit inherited
	subprogram.
	* par-ch10.adb (P_Compilation_Unit): In syntax check only mode
	(-gnats), do not complain about a source file that contains only a
	pragma No_Body.

2011-08-01  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch5.adb (Analyze_Iterator_Scheme): Do not overwrite type of loop
	variable if already set.

From-SVN: r177046
parent 5dabb19c
2011-08-01 Thomas Quinot <quinot@adacore.com>
* sem_ch6.adb (Enter_Overloaded_Entity): Do not warn about a
declaration being hidden when overriding an implicit inherited
subprogram.
* par-ch10.adb (P_Compilation_Unit): In syntax check only mode
(-gnats), do not complain about a source file that contains only a
pragma No_Body.
2011-08-01 Ed Schonberg <schonberg@adacore.com>
* sem_ch5.adb (Analyze_Iterator_Scheme): Do not overwrite type of loop
variable if already set.
2011-08-01 Arnaud Charlet <charlet@adacore.com> 2011-08-01 Arnaud Charlet <charlet@adacore.com>
* g-socket-dummy.adb, s-osinte-linux.ads, g-socket-dummy.ads, * g-socket-dummy.adb, s-osinte-linux.ads, g-socket-dummy.ads,
......
...@@ -114,6 +114,7 @@ package body Ch10 is ...@@ -114,6 +114,7 @@ package body Ch10 is
Config_Pragmas : List_Id; Config_Pragmas : List_Id;
P : Node_Id; P : Node_Id;
SR_Present : Boolean; SR_Present : Boolean;
No_Body : Boolean;
Cunit_Error_Flag : Boolean := False; Cunit_Error_Flag : Boolean := False;
-- This flag is set True if we have to scan for a compilation unit -- This flag is set True if we have to scan for a compilation unit
...@@ -145,6 +146,10 @@ package body Ch10 is ...@@ -145,6 +146,10 @@ package body Ch10 is
SR_Present := False; SR_Present := False;
-- If we see a pragma No_Body, remember not to complain about no body
No_Body := False;
if Token = Tok_Pragma then if Token = Tok_Pragma then
Save_Scan_State (Scan_State); Save_Scan_State (Scan_State);
Item := P_Pragma; Item := P_Pragma;
...@@ -179,6 +184,10 @@ package body Ch10 is ...@@ -179,6 +184,10 @@ package body Ch10 is
Save_Scan_State (Scan_State); Save_Scan_State (Scan_State);
Item := P_Pragma; Item := P_Pragma;
if Item /= Error and then Pragma_Name (Item) = Name_No_Body then
No_Body := True;
end if;
if Item = Error if Item = Error
or else not Is_Configuration_Pragma_Name (Pragma_Name (Item)) or else not Is_Configuration_Pragma_Name (Pragma_Name (Item))
then then
...@@ -301,7 +310,12 @@ package body Ch10 is ...@@ -301,7 +310,12 @@ package body Ch10 is
else else
if Operating_Mode = Check_Syntax and then Token = Tok_EOF then if Operating_Mode = Check_Syntax and then Token = Tok_EOF then
Error_Msg_SC ("?file contains no compilation units");
-- Do not complain if there is a pragma No_Body
if not No_Body then
Error_Msg_SC ("?file contains no compilation units");
end if;
else else
Error_Msg_SC ("compilation unit expected"); Error_Msg_SC ("compilation unit expected");
Cunit_Error_Flag := True; Cunit_Error_Flag := True;
......
...@@ -1947,7 +1947,16 @@ package body Sem_Ch5 is ...@@ -1947,7 +1947,16 @@ package body Sem_Ch5 is
Make_Index (DS, LP); Make_Index (DS, LP);
Set_Ekind (Id, E_Loop_Parameter); Set_Ekind (Id, E_Loop_Parameter);
Set_Etype (Id, Etype (DS));
-- If the loop is part of a predicate or precondition, it may
-- be analyzed twice, once in the source and once on the copy
-- used to check conformance. Preserve the original itype
-- because the second one may be created in a different scope,
-- e.g. a precondition procedure, leading to a crash in GIGI.
if No (Etype (Id)) or else Etype (Id) = Any_Type then
Set_Etype (Id, Etype (DS));
end if;
-- Treat a range as an implicit reference to the type, to -- Treat a range as an implicit reference to the type, to
-- inhibit spurious warnings. -- inhibit spurious warnings.
......
...@@ -6048,7 +6048,13 @@ package body Sem_Ch6 is ...@@ -6048,7 +6048,13 @@ package body Sem_Ch6 is
-- of the real danger that different operators may be applied in -- of the real danger that different operators may be applied in
-- various parts of the program. -- various parts of the program.
if (not Is_Overloadable (E) or else Subtype_Conformant (E, S)) -- Note that if E and S have the same scope, there is never any
-- hiding. Either the two conflict, and the program is illegal,
-- or S is overriding an implicit inherited subprogram.
if Scope (E) /= Scope (S)
and then (not Is_Overloadable (E)
or else Subtype_Conformant (E, S))
and then (Is_Immediately_Visible (E) and then (Is_Immediately_Visible (E)
or else or else
Is_Potentially_Use_Visible (S)) Is_Potentially_Use_Visible (S))
...@@ -6059,8 +6065,7 @@ package body Sem_Ch6 is ...@@ -6059,8 +6065,7 @@ package body Sem_Ch6 is
elsif Nkind (S) = N_Defining_Operator_Symbol elsif Nkind (S) = N_Defining_Operator_Symbol
and then and then
Scope ( Scope (Base_Type (Etype (First_Formal (S)))) /= Scope (S)
Base_Type (Etype (First_Formal (S)))) /= Scope (S)
then then
Error_Msg_N Error_Msg_N
("declaration of & hides predefined operator?", S); ("declaration of & hides predefined operator?", S);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment