===================================================================
@@ -5874,15 +5874,16 @@
-- 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))
===================================================================
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
+-- 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 @@
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;
===================================================================
@@ -57,9 +57,19 @@
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);