+2014-02-04 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_aggr.adb: Change "runtime" to "run time" in warning message,
+ for consistency with other messages.
+
+2014-02-04 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch5.adb (Expand_Iterator_Loop): For a container element
+ iterator, indicate that the element is a constant if the container
+ type does not have a variable indexing aspect.
+ * sem_ch8.adb (Analyze_Object_Renaming): If the entity is already
+ marked as constant, do not reset its Ekind, to ensure that
+ container elements in an element loop are not modified if the
+ container (e.g. a hashed set) only has a constant indexing aspect.
+
+2014-02-04 Arnaud Charlet <charlet@adacore.com>
+
+ * g-souinf.ads: Subprograms in this unit are actually not pure.
+ * freeze.adb (Freeze_Subprogram): Do not reset Is_Pure for Intrinsics.
+ * einfo.ads (Is_Pure): Update doc to match implementation.
+
2014-02-04 Gary Dismukes <dismukes@adacore.com>
* exp_ch13.adb: Minor spelling fix.
-- Is_Pure (Flag44)
-- Defined in all entities. Set in all entities of a unit to which a
--- pragma Pure is applied, and also set for the entity of the unit
--- itself. In addition, this flag may be set for any other functions
--- or procedures that are known to be side effect free, so in the case
--- of subprograms, the Is_Pure flag may be used by the optimizer to
--- imply that it can assume freedom from side effects (other than those
--- resulting from assignment to out parameters, or to objects designated
--- by access parameters).
+-- pragma Pure is applied except for non intrinsic imported subprogram,
+-- and also set for the entity of the unit itself. In addition, this
+-- flag may be set for any other functions or procedures that are known
+-- to be side effect free, so in the case of subprograms, the Is_Pure
+-- flag may be used by the optimizer to imply that it can assume freedom
+-- from side effects (other than those resulting from assignment to out
+-- parameters, or to objects designated by access parameters).
-- Is_Pure_Unit_Access_Type (Flag189)
-- Defined in access type and subtype entities. Set if the type or
Set_Debug_Info_Needed (Id);
+ -- If the container does not have a variable indexing aspect,
+ -- the element is a constant in the loop.
+
+ if No (Find_Value_Of_Aspect
+ (Container_Typ, Aspect_Variable_Indexing))
+ then
+ Set_Ekind (Id, E_Constant);
+ end if;
+
-- If the container holds controlled objects, wrap the loop
-- statements and element renaming declaration with a block.
-- This ensures that the result of Element (Cusor) is
end if;
-- Reset the Pure indication on an imported subprogram unless an
- -- explicit Pure_Function pragma was present. We do this because
- -- otherwise it is an insidious error to call a non-pure function from
- -- pure unit and have calls mysteriously optimized away. What happens
- -- here is that the Import can bypass the normal check to ensure that
- -- pure units call only pure subprograms.
+ -- explicit Pure_Function pragma was present or the subprogram is an
+ -- intrinsic. We do this because otherwise it is an insidious error
+ -- to call a non-pure function from pure unit and have calls
+ -- mysteriously optimized away. What happens here is that the Import
+ -- can bypass the normal check to ensure that pure units call only pure
+ -- subprograms.
if Is_Imported (E)
and then Is_Pure (E)
and then not Has_Pragma_Pure_Function (E)
+ and then not Is_Intrinsic_Subprogram (E)
then
Set_Is_Pure (E, False);
end if;
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 AdaCore --
+-- Copyright (C) 2000-2013, 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- --
-- the name of the source file in which the exception is handled.
package GNAT.Source_Info is
- pragma Pure;
+ pragma Preelaborate;
+ -- Note that this unit is Preelaborate, but not Pure, that's because the
+ -- functions here such as Line are clearly not pure functions, and normally
+ -- we mark intrinsic functions in a Pure unit as Pure, even though they are
+ -- imported.
+ --
+ -- Historical note: this used to be Pure, but that was when we marked all
+ -- intrinsics as not Pure, even in Pure units, so no problems arose.
function File return String;
-- Return the name of the current file, not including the path information.
Error_Msg_N
("(Ada 2005) null not allowed in null-excluding component??", Expr);
Error_Msg_N
- ("\Constraint_Error will be raised at runtime?", Expr);
+ ("\Constraint_Error will be raised at run time?", Expr);
Rewrite (Expr,
Make_Raise_Constraint_Error
end;
end if;
- Set_Ekind (Id, E_Variable);
+ -- Set the Ekind of the entity, unless it has been set already, as is
+ -- the case for the iteration object over a container with no variable
+ -- indexing.
+
+ if Ekind (Id) /= E_Constant then
+ Set_Ekind (Id, E_Variable);
+ end if;
-- Initialize the object size and alignment. Note that we used to call
-- Init_Size_Align here, but that's wrong for objects which have only