diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-09-06 12:41:57 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-09-06 12:41:57 +0200 |
commit | 7d8272552fe9cf00fdebeb04145e7332a9589b9a (patch) | |
tree | 2f123430542ffbb783a77ede543ded15ef1d101f /gcc/ada/exp_aggr.adb | |
parent | a316b3fcd05624ce0aadca3478f6a3c7b494c2d0 (diff) | |
download | gcc-7d8272552fe9cf00fdebeb04145e7332a9589b9a.zip gcc-7d8272552fe9cf00fdebeb04145e7332a9589b9a.tar.gz gcc-7d8272552fe9cf00fdebeb04145e7332a9589b9a.tar.bz2 |
[multiple changes]
2017-09-06 Bob Duff <duff@adacore.com>
* a-comlin.ads, a-comlin.adb (Argument): Move the constraint
check back to the body, because SPARK is not yet ready for
"or else raise Constraint_Error".
2017-09-06 Ed Schonberg <schonberg@adacore.com>
* exp_ch6.adb (Expand_Call_Helper): Replace call to null
procedure by a single null statement, after evaluating the
actuals that require it.
2017-09-06 Javier Miranda <miranda@adacore.com>
* exp_aggr.adb (Backend_Processing_Possible.Component_Check):
Generating C code improve the code that checks the use of nested
aggregates to initialize object declarations.
2017-09-06 Yannick Moy <moy@adacore.com>
* sem_ch3.adb (Derived_Type_Declaration): Detect
violations of new rule SPARK RM 3.4(1). Also refactor existing
check to use the new function Find_Partial_View.
2017-09-06 Vincent Celier <celier@adacore.com>
* gnatcmd.adb: gnat ls -V -P... invokes gprls -V -P... The code
from the Prj hierarchy has been removed from the GNAT driver.
2017-09-06 Ed Schonberg <schonberg@adacore.com>
* sem_type.adb (Interface_Present_In_Ancestor): Within an
expression function, or within a spec expression (default value,
etc) a reference to an incomplete type is legal: legality of
the operation will be checked when some related entity (type,
object or subprogram) is frozen.
From-SVN: r251776
Diffstat (limited to 'gcc/ada/exp_aggr.adb')
-rw-r--r-- | gcc/ada/exp_aggr.adb | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 460b1c1..38d233b 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -644,15 +644,27 @@ package body Exp_Aggr is return False; end if; - -- Checks 11: (part of an object declaration) + -- Checks 11: The C code generator cannot handle aggregates that + -- are not part of an object declaration. - if Modify_Tree_For_C - and then Nkind (Parent (N)) /= N_Object_Declaration - and then - (Nkind (Parent (N)) /= N_Qualified_Expression - or else Nkind (Parent (Parent (N))) /= N_Object_Declaration) - then - return False; + if Modify_Tree_For_C then + declare + Par : Node_Id := Parent (N); + + begin + -- Skip enclosing nested aggregates and their qualified + -- expressions + + while Nkind (Par) = N_Aggregate + or else Nkind (Par) = N_Qualified_Expression + loop + Par := Parent (Par); + end loop; + + if Nkind (Par) /= N_Object_Declaration then + return False; + end if; + end; end if; -- Checks on components |