+2010-10-26 Robert Dewar <dewar@adacore.com>
+
+ * opt.ads (Treat_Categorization_Errors_As_Warnings): New flag
+ * sem_cat.adb (Check_Categorization_Dependencies):
+ Use Check_Categorization_Dependencies
+ * switch-c.adb: GNAT Mode sets Treat_Categorization_Errors_As_Warnings
+ -gnateP sets Treat_Categorization_Errors_As_Warnings
+ * usage.adb: Add line for -gnateP switch
+
+2010-10-26 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch3.adb (Add_Internal_Interface_Entities): Handle primitives
+ inherited from the parent that cover interface primitives.
+ (Derive_Progenitor_Subprograms): Handle primitives inherited from
+ the parent that cover interface primitives.
+ * sem_disp.adb (Find_Primitive_Covering_Interface): When searching in
+ the list of primitives of the type extend the test to include inherited
+ private primitives.
+ * sem_ch6.ads (Is_Interface_Conformant): Add missing documentation.
+ * sem_ch7.adb (Declare_Inherited_Private_Subprograms): Add missing
+ barrier to the loop searching for explicit overriding primitives.
+ * sem_ch4.adb (Analyze_Indexed_Component_Form): Add missing barrier
+ before accessing attribute Entity.
+
+2010-10-26 Bob Duff <duff@adacore.com>
+
+ * make.adb: Call Namet.Finalize, so we can get statistics.
+
2010-10-26 Geert Bosch <bosch@adacore.com>
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Use the subprogram_body
Delete_All_Temp_Files;
+ -- Output Namet statistics
+
+ Namet.Finalize;
+
exception
when X : others =>
Set_Standard_Error;
with Hostparm; use Hostparm;
with Types; use Types;
-with System.WCh_Con; use System.WCh_Con;
-
pragma Warnings (Off);
+-- This package is used also by gnatcoll
with System.Strings; use System.Strings;
+with System.WCh_Con; use System.WCh_Con;
pragma Warnings (On);
package Opt is
-- Tolerate time stamp and other consistency errors. If this flag is set to
-- True (-t), then inconsistencies result in warnings rather than errors.
+ Treat_Categorization_Errors_As_Warnings : Boolean := False;
+ -- Normally categorization errors are true illegalities. If this switch
+ -- is set, then such errors result in warning messages rather than error
+ -- messages. Set True by -gnatg or -gnateP (P for Pure/Preelaborate).
+
Treat_Restrictions_As_Warnings : Boolean := False;
-- GNAT
-- Set True to treat pragma Restrictions as Restriction_Warnings. Set by
if Err then
- -- These messages are warnings in GNAT mode, to allow it to be
- -- judiciously turned off. Otherwise it is a real error.
+ -- These messages are warnings in GNAT mode or if the -gnateC switch
+ -- was set. Otherwise these are real errors for real illegalities.
- Error_Msg_Warn := GNAT_Mode;
+ Error_Msg_Warn := Treat_Categorization_Errors_As_Warnings;
-- Don't give error if main unit is not an internal unit, and the
-- unit generating the message is an internal unit. This is the
pragma Assert (Present (Prim));
+ -- Ada 2012 (AI05-0197): If the name of the covering primitive
+ -- differs from the name of the interface primitive then it is
+ -- a private primitive inherited from a parent type. In such
+ -- case, given that Tagged_Type covers the interface, the
+ -- inherited private primitive becomes visible. For such
+ -- purpose we add a new entity that renames the inherited
+ -- private primitive.
+
+ if Chars (Prim) /= Chars (Iface_Prim) then
+ pragma Assert (Has_Suffix (Prim, 'P'));
+ Derive_Subprogram
+ (New_Subp => New_Subp,
+ Parent_Subp => Iface_Prim,
+ Derived_Type => Tagged_Type,
+ Parent_Type => Iface);
+ Set_Alias (New_Subp, Prim);
+ Set_Is_Abstract_Subprogram (New_Subp,
+ Is_Abstract_Subprogram (Prim));
+ end if;
+
Derive_Subprogram
(New_Subp => New_Subp,
Parent_Subp => Iface_Prim,
Derive_Subprogram
(New_Subp, Iface_Subp, Tagged_Type, Iface);
+ -- Ada 2012 (AI05-0197): If the covering primitive's name
+ -- differs from the name of the interface primitive then it
+ -- is a private primitive inherited from a parent type. In
+ -- such case, given that Tagged_Type covers the interface,
+ -- the inherited private primitive becomes visible. For such
+ -- purpose we add a new entity that renames the inherited
+ -- private primitive.
+
+ elsif Chars (E) /= Chars (Iface_Subp) then
+ pragma Assert (Has_Suffix (E, 'P'));
+ Derive_Subprogram
+ (New_Subp, Iface_Subp, Tagged_Type, Iface);
+ Set_Alias (New_Subp, E);
+ Set_Is_Abstract_Subprogram (New_Subp,
+ Is_Abstract_Subprogram (E));
+
-- Propagate to the full view interface entities associated
-- with the partial view
P_T := Base_Type (Etype (P));
- if Is_Entity_Name (P) then
+ if Is_Entity_Name (P)
+ and then Present (Entity (P))
+ then
U_N := Entity (P);
if Is_Type (U_N) then
(Tagged_Type : Entity_Id;
Iface_Prim : Entity_Id;
Prim : Entity_Id) return Boolean;
- -- Returns true if both primitives have a matching name, they are type
- -- conformant, and Prim is defined in the scope of Tagged_Type. Special
- -- management is done for functions returning interfaces.
+ -- Returns true if both primitives have a matching name (including support
+ -- for names of inherited private primitives --which have suffix 'P'), they
+ -- are type conformant, and Prim is defined in the scope of Tagged_Type.
+ -- Special management is done for functions returning interfaces.
procedure List_Inherited_Pre_Post_Aspects (E : Entity_Id);
-- E is the entity for a subprogram or generic subprogram spec. This call
Op_Elmt_2 := Next_Elmt (Op_Elmt);
while Present (Op_Elmt_2) loop
+
+ -- Skip entities with attribute Interface_Alias since
+ -- they are not overriding primitives (these entities
+ -- link an interface primitive with their covering
+ -- primitive)
+
if Chars (Node (Op_Elmt_2)) = Chars (Parent_Subp)
and then Type_Conformant (Prim_Op, Node (Op_Elmt_2))
+ and then No (Interface_Alias (Node (Op_Elmt_2)))
then
-- The private inherited operation has been
-- overridden by an explicit subprogram: replace
end if;
end if;
+ -- Check if E covers the interface primitive (includes case in
+ -- which E is an inherited private primitive)
+
+ if Is_Interface_Conformant (Tagged_Type, Iface_Prim, E) then
+ return E;
+ end if;
+
-- Use the internal entity that links the interface primitive with
-- the covering primitive to locate the entity
Ptr := Max + 1;
+ -- -gnateP (Treat pragma Pure/Preelaborate errs as warnings)
+
+ when 'P' =>
+ Treat_Categorization_Errors_As_Warnings := True;
+
-- -gnatez (final delimiter of explicit switches)
-- All switches that come after -gnatez have been added by
Set_GNAT_Mode_Warnings;
Set_GNAT_Style_Check_Options;
+ -- Other special modes set by -gnatg
+
+ Treat_Categorization_Errors_As_Warnings := True;
+
-- Processing for G switch
when 'G' =>
Write_Switch_Char ("ep=?");
Write_Line ("Specify preprocessing data file, e.g. -gnatep=prep.data");
+ -- Line for -gnateP switch
+
+ Write_Switch_Char ("eP");
+ Write_Line ("Pure/Prelaborate errors generate warnings rather than errors");
+
-- Line for -gnateS switch
Write_Switch_Char ("eS");