aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_aggr.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2016-07-04 12:00:57 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2016-07-04 12:00:57 +0200
commit10edebe7b49ee1903bca94e03d4cf9c8194c3905 (patch)
tree8d1354391447c45564cc3f27fcc976c07d89e6bd /gcc/ada/sem_aggr.adb
parent15f6e0dac34a243341fba80f8ebdaeec78d766fe (diff)
downloadgcc-10edebe7b49ee1903bca94e03d4cf9c8194c3905.zip
gcc-10edebe7b49ee1903bca94e03d4cf9c8194c3905.tar.gz
gcc-10edebe7b49ee1903bca94e03d4cf9c8194c3905.tar.bz2
[multiple changes]
2016-07-04 Hristian Kirtchev <kirtchev@adacore.com> * exp_aggr.adb (Ctrl_Init_Expression): New routine. (Gen_Assign): Code cleanup. Perform in-place side effect removal when the expression denotes a controlled function call. * exp_util.adb (Remove_Side_Effects): Do not remove side effects on a function call which has this behavior suppressed. * sem_aggr.adb Code cleanup. * sinfo.adb (No_Side_Effect_Removal): New routine. (Set_Side_Effect_Removal): New routine. * sinfo.ads New attribute No_Side_Effect_Removal along with occurences in nodes. (No_Side_Effect_Removal): New routine along with pragma Inline. (Set_Side_Effect_Removal): New routine along with pragma Inline. 2016-07-04 Arnaud Charlet <charlet@adacore.com> * opt.ads, sem_prag.adb (Universal_Addressing_On_AAMP): Removed. Remove support for pragma No_Run_Time. Update comments. 2016-07-04 Pascal Obry <obry@adacore.com> * g-forstr.ads: More documentation for the Formatted_String support. 2016-07-04 Ed Schonberg <schonberg@adacore.com> * exp_ch13.adb (Expand_N_Attribute_Definition_Clause, case 'Address): If the address comes from an aspect specification and not a source attribute definition clause, do not remove side effects from the expression, because the expression must be elaborated at the freeze point of the object and not at the object declaration, because of the delayed analysis of aspect specifications. From-SVN: r237959
Diffstat (limited to 'gcc/ada/sem_aggr.adb')
-rw-r--r--gcc/ada/sem_aggr.adb64
1 files changed, 34 insertions, 30 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 8b65045..feb1a4a 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -1821,6 +1821,25 @@ package body Sem_Aggr is
end if;
Step_2 : declare
+ function Empty_Range (A : Node_Id) return Boolean;
+ -- If an association covers an empty range, some warnings on the
+ -- expression of the association can be disabled.
+
+ -----------------
+ -- Empty_Range --
+ -----------------
+
+ function Empty_Range (A : Node_Id) return Boolean is
+ R : constant Node_Id := First (Choices (A));
+ begin
+ return No (Next (R))
+ and then Nkind (R) = N_Range
+ and then Compile_Time_Compare
+ (Low_Bound (R), High_Bound (R), False) = GT;
+ end Empty_Range;
+
+ -- Local variables
+
Low : Node_Id;
High : Node_Id;
-- Denote the lowest and highest values in an aggregate choice
@@ -1845,23 +1864,6 @@ package body Sem_Aggr is
Errors_Posted_On_Choices : Boolean := False;
-- Keeps track of whether any choices have semantic errors
- function Empty_Range (A : Node_Id) return Boolean;
- -- If an association covers an empty range, some warnings on the
- -- expression of the association can be disabled.
-
- -----------------
- -- Empty_Range --
- -----------------
-
- function Empty_Range (A : Node_Id) return Boolean is
- R : constant Node_Id := First (Choices (A));
- begin
- return No (Next (R))
- and then Nkind (R) = N_Range
- and then Compile_Time_Compare
- (Low_Bound (R), High_Bound (R), False) = GT;
- end Empty_Range;
-
-- Start of processing for Step_2
begin
@@ -3429,10 +3431,6 @@ package body Sem_Aggr is
-----------------------
procedure Resolve_Aggr_Expr (Expr : Node_Id; Component : Node_Id) is
- Expr_Type : Entity_Id := Empty;
- New_C : Entity_Id := Component;
- New_Expr : Node_Id;
-
function Has_Expansion_Delayed (Expr : Node_Id) return Boolean;
-- If the expression is an aggregate (possibly qualified) then its
-- expansion is delayed until the enclosing aggregate is expanded
@@ -3442,15 +3440,6 @@ package body Sem_Aggr is
-- dynamic-sized aggregate in the code, something that gigi cannot
-- handle.
- Relocate : Boolean;
- -- Set to True if the resolved Expr node needs to be relocated when
- -- attached to the newly created association list. This node need not
- -- be relocated if its parent pointer is not set. In fact in this
- -- case Expr is the output of a New_Copy_Tree call. If Relocate is
- -- True then we have analyzed the expression node in the original
- -- aggregate and hence it needs to be relocated when moved over to
- -- the new association list.
-
---------------------------
-- Has_Expansion_Delayed --
---------------------------
@@ -3466,6 +3455,21 @@ package body Sem_Aggr is
and then Has_Expansion_Delayed (Expression (Expr)));
end Has_Expansion_Delayed;
+ -- Local variables
+
+ Expr_Type : Entity_Id := Empty;
+ New_C : Entity_Id := Component;
+ New_Expr : Node_Id;
+
+ Relocate : Boolean;
+ -- Set to True if the resolved Expr node needs to be relocated when
+ -- attached to the newly created association list. This node need not
+ -- be relocated if its parent pointer is not set. In fact in this
+ -- case Expr is the output of a New_Copy_Tree call. If Relocate is
+ -- True then we have analyzed the expression node in the original
+ -- aggregate and hence it needs to be relocated when moved over to
+ -- the new association list.
+
-- Start of processing for Resolve_Aggr_Expr
begin