+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>
* g-socket-dummy.adb, s-osinte-linux.ads, g-socket-dummy.ads,
Config_Pragmas : List_Id;
P : Node_Id;
SR_Present : Boolean;
+ No_Body : Boolean;
Cunit_Error_Flag : Boolean := False;
-- This flag is set True if we have to scan for a compilation unit
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
Save_Scan_State (Scan_State);
Item := P_Pragma;
Save_Scan_State (Scan_State);
Item := P_Pragma;
+ if Item /= Error and then Pragma_Name (Item) = Name_No_Body then
+ No_Body := True;
+ end if;
+
if Item = Error
or else not Is_Configuration_Pragma_Name (Pragma_Name (Item))
then
else
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
Error_Msg_SC ("compilation unit expected");
Cunit_Error_Flag := True;
Make_Index (DS, LP);
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
-- inhibit spurious warnings.
-- of the real danger that different operators may be applied in
-- 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)
or else
Is_Potentially_Use_Visible (S))
elsif Nkind (S) = N_Defining_Operator_Symbol
and then
- Scope (
- Base_Type (Etype (First_Formal (S)))) /= Scope (S)
+ Scope (Base_Type (Etype (First_Formal (S)))) /= Scope (S)
then
Error_Msg_N
("declaration of & hides predefined operator?", S);