diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-04-29 12:19:14 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-04-29 12:19:14 +0200 |
commit | 7f4c190364aeb00a399ac594d56099603323855d (patch) | |
tree | 2a20b57a33921a632c41cd8c70cdc6638ead147d /gcc | |
parent | 333748297bddb622fad377e66dc26e48e75add69 (diff) | |
download | gcc-7f4c190364aeb00a399ac594d56099603323855d.zip gcc-7f4c190364aeb00a399ac594d56099603323855d.tar.gz gcc-7f4c190364aeb00a399ac594d56099603323855d.tar.bz2 |
[multiple changes]
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.
From-SVN: r146944
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/ada/exp_aggr.adb | 28 | ||||
-rw-r--r-- | gcc/ada/sem_elim.adb | 22 |
3 files changed, 47 insertions, 14 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 421dc7e..e2eaa61 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +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 diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 0ffbb45..7c38cba 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -6,7 +6,7 @@ -- -- -- 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- -- @@ -35,6 +35,7 @@ with Exp_Ch3; use Exp_Ch3; 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; @@ -506,7 +507,7 @@ package body Exp_Aggr is -- 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); @@ -3735,24 +3736,43 @@ package body Exp_Aggr is -- 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; @@ -4989,7 +5009,7 @@ package body Exp_Aggr is -- 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. diff --git a/gcc/ada/sem_elim.adb b/gcc/ada/sem_elim.adb index 33ebfd1..e4c99fc 100644 --- a/gcc/ada/sem_elim.adb +++ b/gcc/ada/sem_elim.adb @@ -286,7 +286,7 @@ package body Sem_Elim is goto Continue; end if; - -- Find enclosing unit. + -- Find enclosing unit Scop := Cunit_Entity (Current_Sem_Unit); @@ -386,8 +386,8 @@ package body Sem_Elim is 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 -- @@ -441,17 +441,19 @@ package body Sem_Elim is 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; @@ -559,8 +561,8 @@ package body Sem_Elim is 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 @@ -658,7 +660,7 @@ package body Sem_Elim is 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) |