+2009-04-29 Thomas Quinot <quinot@adacore.com>
+
+ * sem_elim.adb: Minor reformatting
+
+2009-04-29 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_aggr.adb (Convert_To_Positional): if the current unit is a
+ predefined unit, allow arbitrary number of components in static
+ aggregate, to ensure that the same level of constant folding applies
+ for Ada 95 and Ada 05 versions of the file.
+
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_elim.adb (Check_Eliminated): Handle new improved eliminate
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, 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- --
with Exp_Ch7; use Exp_Ch7;
with Exp_Ch9; use Exp_Ch9;
with Exp_Tss; use Exp_Tss;
+with Fname; use Fname;
with Freeze; use Freeze;
with Itypes; use Itypes;
with Lib; use Lib;
-- 9. There cannot be any discriminated record components, since the
-- back end cannot handle this complex case.
- -- 10. No controlled actions need to be generated for components.
+ -- 10. No controlled actions need to be generated for components
function Backend_Processing_Possible (N : Node_Id) return Boolean is
Typ : constant Entity_Id := Etype (N);
-- Check for maximum others replication. Note that
-- we skip this test if either of the restrictions
-- No_Elaboration_Code or No_Implicit_Loops is
- -- active, or if this is a preelaborable unit.
+ -- active, if this is a preelaborable unit or a
+ -- predefined unit. This ensures that predefined
+ -- units get the same level of constant folding in
+ -- Ada 95 and Ada 05, where their categorization
+ -- has changed.
declare
P : constant Entity_Id :=
Cunit_Entity (Current_Sem_Unit);
begin
+ -- Check if duplication OK and if so continue
+ -- processing.
+
if Restriction_Active (No_Elaboration_Code)
or else Restriction_Active (No_Implicit_Loops)
or else Is_Preelaborated (P)
or else (Ekind (P) = E_Package_Body
and then
Is_Preelaborated (Spec_Entity (P)))
+ or else
+ Is_Predefined_File_Name
+ (Unit_File_Name (Get_Source_Unit (P)))
then
null;
+ -- If duplication not OK, then we return False
+ -- if the replication count is too high
+
elsif Rep_Count > Max_Others_Replicate then
return False;
+
+ -- Continue on if duplication not OK, but the
+ -- replication count is not excessive.
+
+ else
+ null;
end if;
end;
end if;
-- STEP 4
- -- Look if in place aggregate expansion is possible.
+ -- Look if in place aggregate expansion is possible
-- For object declarations we build the aggregate in place, unless
-- the array is bit-packed or the component is controlled.
goto Continue;
end if;
- -- Find enclosing unit.
+ -- Find enclosing unit
Scop := Cunit_Entity (Current_Sem_Unit);
function Skip_Spaces return Natural;
-- If Sloc_Trace (Idx) is not space character, returns
-- Idx. Otherwise returns the index of the nearest
- -- non-space character in Sloc_Trace to the right of
- -- Idx. Returns 0 if there is no such character.
+ -- non-space character in Sloc_Trace to the right of Idx.
+ -- Returns 0 if there is no such character.
-----------------------------
-- Different_Trace_Lengths --
end if;
end loop;
- -- Find last non-space before this colon. If there
- -- is no space character before this colon, then
- -- return False. Otherwise, End_Idx set to point to
- -- this non-space character.
+ -- Find last non-space before this colon. If there is
+ -- no space character before this colon, then return
+ -- False. Otherwise, End_Idx is set to point to this
+ -- non-space character.
End_Idx := Tmp_Idx;
loop
if End_Idx < Idx then
return False;
+
elsif Sloc_Trace (End_Idx) /= ' ' then
exit;
+
else
End_Idx := End_Idx - 1;
end if;
end;
end if;
- -- If we have a Result_Type, then we must have a function
- -- with the proper result type
+ -- If we have a Result_Type, then we must have a function with
+ -- the proper result type.
if Elmt.Result_Type /= No_Name then
if Ekind (E) /= E_Function
end if;
end loop;
- -- If this is an internal operation generated for a protected operation.
+ -- If this is an internal operation generated for a protected operation,
-- its name does not match the source name, so just report the error.
if not Comes_From_Source (E)