+2011-08-02 Javier Miranda <miranda@adacore.com>
+
+ * exp_disp.adb (Make_DT): Generate call to Check_TSD in Ada 2005 mode.
+
+2011-08-02 Robert Dewar <dewar@adacore.com>
+
+ * s-imenne.ads: Minor reformatting.
+
+2011-08-02 Robert Dewar <dewar@adacore.com>
+
+ * a-stunau.ads: Add pragma Suppress_Initialization for Big_String
+ * freeze.adb (Warn_Overlay): Don't warn if initialization suppressed
+ * s-stalib.ads: Add pragma Suppress_Initialization for Big_String
+
+2011-08-02 Robert Dewar <dewar@adacore.com>
+
+ * einfo.ads (Materialize_Entity): Document this is only for renamings
+ * exp_ch3.adb (Expand_N_Object_Declaration): Make sure we generate
+ required debug information in the case where we transform the object
+ declaration into a renaming declaration.
+ * exp_ch4.adb (Expand_Concatenate): Generate debug info for result
+ object
+ * exp_dbug.ads (Debug_Renaming_Declaration): Document setting of
+ Materialize_Entity.
+
2011-08-02 Robert Dewar <dewar@adacore.com>
* einfo.ads, einfo.adb (Suppress_Initialization): Replaces
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
pragma Preelaborate;
subtype Big_String is String (1 .. Positive'Last);
+ pragma Suppress_Initialization (Big_String);
+ -- Type used to obtain string access to given address. Initialization is
+ -- suppressed, since we never want to have variables of this type, and
+ -- we never want to attempt initialiazation of virtual variables of this
+ -- type (e.g. when pragma Normalize_Scalars is used).
+
type Big_String_Access is access all Big_String;
+ for Big_String_Access'Storage_Size use 0;
+ -- We use this access type to pass a pointer to an area of storage to be
+ -- accessed as a string. Of course when this pointer is used, it is the
+ -- responsibility of the accessor to ensure proper bounds. The storage
+ -- size clause ensures we do not allocate variables of this type.
procedure Get_String
(U : Unbounded_String;
-- used to reference tasks implementing such interface.
-- Materialize_Entity (Flag168)
--- Present in all entities. Set only for constant or renamed entities
--- which should be materialized for debugging purposes. In the case of
--- a constant, a memory location should be allocated containing the
--- value. In the case of a renaming, a memory location containing the
--- renamed address should be allocated.
+-- Present in all entities. Set only for renamed obects which should be
+-- materialized for debugging purposes. This means that a memory location
+-- containing the renamed address should be allocated. This is needed so
+-- that the debugger can find the entity.
-- Mechanism (Uint8) (returned as Mechanism_Type)
-- Present in functions and non-generic formal parameters. Indicates
with Exp_Ch7; use Exp_Ch7;
with Exp_Ch9; use Exp_Ch9;
with Exp_Ch11; use Exp_Ch11;
+with Exp_Dbug; use Exp_Dbug;
with Exp_Disp; use Exp_Disp;
with Exp_Dist; use Exp_Dist;
with Exp_Smem; use Exp_Smem;
Set_Renamed_Object (Defining_Identifier (N), Expr_Q);
Set_Analyzed (N);
+
+ -- We do need to deal with debug issues for this renaming
+
+ -- First, if entity comes from source, then mark it as needing
+ -- debug information, even though it is defined by a generated
+ -- renaming that does not come from source.
+
+ if Comes_From_Source (Defining_Identifier (N)) then
+ Set_Needs_Debug_Info (Defining_Identifier (N));
+ end if;
+
+ -- Now call the routine to generate debug info for the renaming
+
+ declare
+ Decl : constant Node_Id := Debug_Renaming_Declaration (N);
+ begin
+ if Present (Decl) then
+ Insert_Action (N, Decl);
+ end if;
+ end;
end if;
end if;
-- Now we construct an array object with appropriate bounds. We mark
-- the target as internal to prevent useless initialization when
- -- Initialize_Scalars is enabled.
+ -- Initialize_Scalars is enabled. Also since this is the actual result
+ -- entity, we make sure we have debug information for the result.
Ent := Make_Temporary (Loc, 'S');
Set_Is_Internal (Ent);
+ Set_Needs_Debug_Info (Ent);
-- If the bound is statically known to be out of range, we do not want
-- to abort, we want a warning and a runtime constraint error. Note that
function Debug_Renaming_Declaration (N : Node_Id) return Node_Id;
-- The argument N is a renaming declaration. The result is a variable
-- declaration as described in the above paragraphs. If N is not a special
- -- debug declaration, then Empty is returned.
+ -- debug declaration, then Empty is returned. This function also takes care
+ -- of setting Materialize_Entity on the renamed entity where required.
---------------------------
-- Packed Array Encoding --
-- Check_TSD (TSD'Unrestricted_Access);
- -- Seems wrong to restrict this BI to Ada 2012 ???
+ -- This check is a consequence of AI05-0113-1/06, so it officially
+ -- applies to Ada 2005 (and Ada 2012). It might be argued that it is
+ -- a desirable check to add in Ada 95 mode, but we hesitate to make
+ -- this change, as it would be incompatible, and could conceivably
+ -- cause a problem in existing Aa 95 code.
+
+ -- We check for No_Run_Time_Mode here, because we do not want to pick
+ -- up the RE_Check_TSD entity and call it in No_Run_Time mode.
if not No_Run_Time_Mode
- and then Ada_Version >= Ada_2012
+ and then Ada_Version >= Ada_2005
and then RTE_Available (RE_Check_TSD)
then
Append_To (Elab_Code,
-- tested for because predefined String types are initialized by inline
-- code rather than by an init_proc). Note that we do not give the
-- warning for Initialize_Scalars, since we suppressed initialization
- -- in this case.
+ -- in this case. Also, do not warn if Suppress_Initialization is set.
if Present (Expr)
and then not Is_Imported (Ent)
+ and then not Initialization_Suppressed (Typ)
and then (Has_Non_Null_Base_Init_Proc (Typ)
- or else Is_Access_Type (Typ)
- or else (Normalize_Scalars
- and then (Is_Scalar_Type (Typ)
- or else Is_String_Type (Typ))))
+ or else Is_Access_Type (Typ)
+ or else (Normalize_Scalars
+ and then (Is_Scalar_Type (Typ)
+ or else Is_String_Type (Typ))))
then
if Nkind (Expr) = N_Attribute_Reference
and then Is_Entity_Name (Prefix (Expr))
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2010, 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- --
P : out Natural;
Names : String;
Indexes : System.Address);
- -- Identical to Set_Image_Enumeration_8 except that it handles types
- -- using array (0 .. Num) of Natural_16 for the Indexes table.
+ -- Identical to Set_Image_Enumeration_8 except that it handles types using
+ -- array (0 .. Num) of Natural_16 for the Indexes table.
procedure Image_Enumeration_32
(Pos : Natural;
P : out Natural;
Names : String;
Indexes : System.Address);
- -- Identical to Set_Image_Enumeration_8 except that it handles types
- -- using array (0 .. Num) of Natural_32 for the Indexes table.
+ -- Identical to Set_Image_Enumeration_8 except that it handles types using
+ -- array (0 .. Num) of Natural_32 for the Indexes table.
end System.Img_Enum_New;
pragma Preelaborate_05;
pragma Warnings (On);
- type Big_String_Ptr is access all String (Positive);
+ subtype Big_String is String (1 .. Positive'Last);
+ pragma Suppress_Initialization (Big_String);
+ -- Type used to obtain string access to given address. Initialization is
+ -- suppressed, since we never want to have variables of this type, and
+ -- we never want to attempt initialiazation of virtual variables of this
+ -- type (e.g. when pragma Normalize_Scalars is used).
+
+ type Big_String_Ptr is access all Big_String;
for Big_String_Ptr'Storage_Size use 0;
- -- A non-fat pointer type for null terminated strings
+ -- We use this access type to pass a pointer to an area of storage to be
+ -- accessed as a string. Of course when this pointer is used, it is the
+ -- responsibility of the accessor to ensure proper bounds. The storage
+ -- size clause ensures we do not allocate variables of this type.
function To_Ptr is
new Ada.Unchecked_Conversion (System.Address, Big_String_Ptr);