diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-11-18 10:03:44 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-11-18 10:03:44 +0000 |
commit | 747426dbbe51f667e9717283acef75b193f3cc20 (patch) | |
tree | 51c383861941a122ba6296c8658ad90d4501fb03 /gcc/ada/sem_util.adb | |
parent | 1a4617375430ff36eb791481fe2bcaefe81f9271 (diff) | |
download | gcc-747426dbbe51f667e9717283acef75b193f3cc20.tar.gz |
2015-11-18 Hristian Kirtchev <kirtchev@adacore.com>
* sem_util.adb (Has_Full_Default_Initialization):
Perform the test for the presence of pragma
Default_Initial_Condition prior to the specialized type
checks. Add a missing case where the lack of a pragma argument
yields full default initialization.
2015-11-18 Hristian Kirtchev <kirtchev@adacore.com>
* sem_res.adb (Resolve_Entity_Name): Do not check
for elaboration issues when a variable appears as the name of
an object renaming declaration as this constitutes an aliasing,
not a read.
2015-11-18 Ed Schonberg <schonberg@adacore.com>
* checks.adb (Overlap_Check): An actual that is an aggregate
cannot overlap with another actual, and no check should be
generated for it.
* targparm.ads: Fix typos.
2015-11-18 Pascal Obry <obry@adacore.com>
* adaint.c: Routine __gnat_killprocesstree only implemented on
Linux and Windows.
2015-11-18 Pascal Obry <obry@adacore.com>
* g-ctrl_c.adb: Minor style fixes.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230523 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r-- | gcc/ada/sem_util.adb | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 435f03b90ec..036cc0cfe48 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -8852,9 +8852,41 @@ package body Sem_Util is ------------------------------------- function Has_Full_Default_Initialization (Typ : Entity_Id) return Boolean is + Arg : Node_Id; Comp : Entity_Id; + Prag : Node_Id; begin + -- A private type and its full view is fully default initialized when it + -- is subject to pragma Default_Initial_Condition without an argument or + -- with a non-null argument. Since any type may act as the full view of + -- a private type, this check must be performed prior to the specialized + -- tests below. + + if Has_Default_Init_Cond (Typ) + or else Has_Inherited_Default_Init_Cond (Typ) + then + Prag := Get_Pragma (Typ, Pragma_Default_Initial_Condition); + + -- Pragma Default_Initial_Condition must be present if one of the + -- related entity flags is set. + + pragma Assert (Present (Prag)); + Arg := First (Pragma_Argument_Associations (Prag)); + + -- A non-null argument guarantees full default initialization + + if Present (Arg) then + return Nkind (Arg) /= N_Null; + + -- Otherwise the missing argument defaults the pragma to "True" which + -- is considered a non-null argument (see above). + + else + return True; + end if; + end if; + -- A scalar type is fully default initialized if it is subject to aspect -- Default_Value. @@ -8911,20 +8943,6 @@ package body Sem_Util is elsif Is_Task_Type (Typ) then return True; - end if; - - -- A private type and by extension its full view is fully default - -- initialized if it is subject to pragma Default_Initial_Condition - -- with a non-null argument or inherits the pragma from a parent type. - -- Since any type can act as the full view of a private type, this check - -- is separated from the circuitry above. - - if Has_Default_Init_Cond (Typ) - or else Has_Inherited_Default_Init_Cond (Typ) - then - return - Nkind (First (Pragma_Argument_Associations (Get_Pragma - (Typ, Pragma_Default_Initial_Condition)))) /= N_Null; -- Otherwise the type is not fully default initialized |