diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-21 13:19:57 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-21 13:19:57 +0000 |
commit | 51ad5ad2cd723707b9d1bd0a95dee9d4a94e3b07 (patch) | |
tree | f10817861720e5be575f1049ddbaf8826f62e83b /gcc/ada/exp_prag.adb | |
parent | 6d081ca682d17682b70f7ba62ef64659f27d12ff (diff) | |
download | gcc-51ad5ad2cd723707b9d1bd0a95dee9d4a94e3b07.tar.gz |
2009-06-21 Thomas Quinot <quinot@adacore.com>
* exp_ch3.adb, exp_prag.adb, exp_util.adb, exp_util.ads, freeze.adb,
sem_ch13.adb, sem_elab.adb (Exp_Prag.Expand_Pragma_Import_Or_Interface):
Factor out code to new subprogram...
(Exp_Util.Find_Init_Call): New shared routine to find the init proc call
for a default initialized variable.
(Freeze.Check_Address_Clause): Do not reset Has_Delayed_Freeze on an
entity that has an associated freeze node.
(Sem_Ch13.Analyze_Attribute_Definition_Clause, case Address):
If there is an init call for the object, defer it to the object freeze
point.
(Check_Elab_Call.Find_Init_Call): Rename to Check_Init_Call, to avoid
name clash with new subprogram introduced in Exp_Util.
2009-06-21 Robert Dewar <dewar@adacore.com>
* einfo.ads: Minor reformatting
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148764 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_prag.adb')
-rw-r--r-- | gcc/ada/exp_prag.adb | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb index 3cb421b4bd3..529fadebdb9 100644 --- a/gcc/ada/exp_prag.adb +++ b/gcc/ada/exp_prag.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- -- @@ -29,7 +29,6 @@ with Debug; use Debug; with Einfo; use Einfo; with Errout; use Errout; with Exp_Ch11; use Exp_Ch11; -with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Expander; use Expander; with Namet; use Namet; @@ -485,29 +484,17 @@ package body Exp_Prag is procedure Expand_Pragma_Import_Or_Interface (N : Node_Id) is Def_Id : constant Entity_Id := Entity (Arg2 (N)); - Typ : Entity_Id; Init_Call : Node_Id; begin if Ekind (Def_Id) = E_Variable then - Typ := Etype (Def_Id); - -- Iterate from declaration of object to import pragma, to find - -- generated initialization call for object, if any. + -- Find generated initialization call for object, if any - Init_Call := Next (Parent (Def_Id)); - while Present (Init_Call) and then Init_Call /= N loop - if Has_Non_Null_Base_Init_Proc (Typ) - and then Nkind (Init_Call) = N_Procedure_Call_Statement - and then Is_Entity_Name (Name (Init_Call)) - and then Entity (Name (Init_Call)) = Base_Init_Proc (Typ) - then - Remove (Init_Call); - exit; - else - Next (Init_Call); - end if; - end loop; + Init_Call := Find_Init_Call (Def_Id, Rep_Clause => N); + if Present (Init_Call) then + Remove (Init_Call); + end if; -- Any default initialization expression should be removed -- (e.g., null defaults for access objects, zero initialization @@ -515,9 +502,7 @@ package body Exp_Prag is -- have explicit initialization, so the expression must have -- been generated by the compiler. - if Init_Call = N - and then Present (Expression (Parent (Def_Id))) - then + if No (Init_Call) and then Present (Expression (Parent (Def_Id))) then Set_Expression (Parent (Def_Id), Empty); end if; end if; |