From: Arnaud Charlet Date: Tue, 2 Aug 2011 14:39:06 +0000 (+0200) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e526d0c765b77d4f41ce36ef42eda5a12c275e15;p=gcc.git [multiple changes] 2011-08-02 Javier Miranda * exp_disp.adb (Make_DT): Generate call to Check_TSD in Ada 2005 mode. 2011-08-02 Robert Dewar * s-imenne.ads: Minor reformatting. 2011-08-02 Robert Dewar * 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 * 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. From-SVN: r177162 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9f6b629264f..61efaa8bdb0 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,28 @@ +2011-08-02 Javier Miranda + + * exp_disp.adb (Make_DT): Generate call to Check_TSD in Ada 2005 mode. + +2011-08-02 Robert Dewar + + * s-imenne.ads: Minor reformatting. + +2011-08-02 Robert Dewar + + * 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 + + * 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 * einfo.ads, einfo.adb (Suppress_Initialization): Replaces diff --git a/gcc/ada/a-stunau.ads b/gcc/ada/a-stunau.ads index 8cff44f7151..fa82740b7de 100644 --- a/gcc/ada/a-stunau.ads +++ b/gcc/ada/a-stunau.ads @@ -6,7 +6,7 @@ -- -- -- 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- -- @@ -38,7 +38,18 @@ package Ada.Strings.Unbounded.Aux is 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; diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index e070e5ea4f1..ae8921269d9 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -2943,11 +2943,10 @@ package Einfo is -- 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 diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index eb1c6dc8148..561b138cc71 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -34,6 +34,7 @@ with Exp_Ch6; use Exp_Ch6; 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; @@ -5215,6 +5216,26 @@ package body Exp_Ch3 is 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; diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 85e9d572ba4..e92e1062a8e 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -2875,10 +2875,12 @@ package body Exp_Ch4 is -- 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 diff --git a/gcc/ada/exp_dbug.ads b/gcc/ada/exp_dbug.ads index 5dcbd91488e..ac722d7876f 100644 --- a/gcc/ada/exp_dbug.ads +++ b/gcc/ada/exp_dbug.ads @@ -1082,7 +1082,8 @@ package Exp_Dbug is 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 -- diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index 9a7b3308f91..541abe7b6aa 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -5995,10 +5995,17 @@ package body Exp_Disp is -- 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, diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index f1699db8a99..c9d47bd8a06 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -5874,15 +5874,16 @@ package body Freeze is -- 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)) diff --git a/gcc/ada/s-imenne.ads b/gcc/ada/s-imenne.ads index a76883d6f4d..7d0c1141dfa 100644 --- a/gcc/ada/s-imenne.ads +++ b/gcc/ada/s-imenne.ads @@ -6,7 +6,7 @@ -- -- -- 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- -- @@ -70,8 +70,8 @@ package System.Img_Enum_New is 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; @@ -79,7 +79,7 @@ package System.Img_Enum_New is 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; diff --git a/gcc/ada/s-stalib.ads b/gcc/ada/s-stalib.ads index 6b3d8645c63..4f1b90a6ed6 100644 --- a/gcc/ada/s-stalib.ads +++ b/gcc/ada/s-stalib.ads @@ -57,9 +57,19 @@ package System.Standard_Library is 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);