summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_aggr.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-22 10:42:35 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-22 10:42:35 +0000
commit2f80f1db7d09ac7edc2daae61f213a41711c5d2d (patch)
treeccd45d7c5ef76c1c0961900474477b7912a2b275 /gcc/ada/sem_aggr.adb
parent4437ef758b7c982d837ecf033092e0f6b23f58cc (diff)
downloadgcc-2f80f1db7d09ac7edc2daae61f213a41711c5d2d.tar.gz
2009-04-22 Robert Dewar <dewar@adacore.com>
* sem_aggr.adb: Minor reformatting. * sem_type.adb: Minor reformatting 2009-04-22 Vincent Celier <celier@adacore.com> * prj-attr.adb: New single project level attribute Separate_Run_Path_Options. * prj-nmsc.adb (Process_Project_Level_Simple_Attributes): Process attribute Seperate_Run_Path_Options. * prj.ads: (Project_Configuration): New Boolean component Separate_Run_Path_Options, defaulted to False. * snames.ads-tmpl: New standard name Seperate_Run_Path_Options git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146563 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_aggr.adb')
-rw-r--r--gcc/ada/sem_aggr.adb89
1 files changed, 43 insertions, 46 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 22557b74ce8..86c74cf6535 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -134,8 +134,8 @@ package body Sem_Aggr is
-- The algorithm of Resolve_Record_Aggregate proceeds as follows:
--
-- 1. Make sure that the record type against which the record aggregate
- -- has to be resolved is not abstract. Furthermore if the type is
- -- a null aggregate make sure the input aggregate N is also null.
+ -- has to be resolved is not abstract. Furthermore if the type is a
+ -- null aggregate make sure the input aggregate N is also null.
--
-- 2. Verify that the structure of the aggregate is that of a record
-- aggregate. Specifically, look for component associations and ensure
@@ -143,31 +143,29 @@ package body Sem_Aggr is
-- node. Also make sure that if present, the N_Others_Choice occurs
-- last and by itself.
--
- -- 3. If Typ contains discriminants, the values for each discriminant
- -- is looked for. If the record type Typ has variants, we check
- -- that the expressions corresponding to each discriminant ruling
- -- the (possibly nested) variant parts of Typ, are static. This
- -- allows us to determine the variant parts to which the rest of
- -- the aggregate must conform. The names of discriminants with their
- -- values are saved in a new association list, New_Assoc_List which
- -- is later augmented with the names and values of the remaining
- -- components in the record type.
+ -- 3. If Typ contains discriminants, the values for each discriminant is
+ -- looked for. If the record type Typ has variants, we check that the
+ -- expressions corresponding to each discriminant ruling the (possibly
+ -- nested) variant parts of Typ, are static. This allows us to determine
+ -- the variant parts to which the rest of the aggregate must conform.
+ -- The names of discriminants with their values are saved in a new
+ -- association list, New_Assoc_List which is later augmented with the
+ -- names and values of the remaining components in the record type.
--
-- During this phase we also make sure that every discriminant is
- -- assigned exactly one value. Note that when several values
- -- for a given discriminant are found, semantic processing continues
- -- looking for further errors. In this case it's the first
- -- discriminant value found which we will be recorded.
+ -- assigned exactly one value. Note that when several values for a given
+ -- discriminant are found, semantic processing continues looking for
+ -- further errors. In this case it's the first discriminant value found
+ -- which we will be recorded.
--
-- IMPORTANT NOTE: For derived tagged types this procedure expects
-- First_Discriminant and Next_Discriminant to give the correct list
-- of discriminants, in the correct order.
--
- -- 4. After all the discriminant values have been gathered, we can
- -- set the Etype of the record aggregate. If Typ contains no
- -- discriminants this is straightforward: the Etype of N is just
- -- Typ, otherwise a new implicit constrained subtype of Typ is
- -- built to be the Etype of N.
+ -- 4. After all the discriminant values have been gathered, we can set the
+ -- Etype of the record aggregate. If Typ contains no discriminants this
+ -- is straightforward: the Etype of N is just Typ, otherwise a new
+ -- implicit constrained subtype of Typ is built to be the Etype of N.
--
-- 5. Gather the remaining record components according to the discriminant
-- values. This involves recursively traversing the record type
@@ -176,41 +174,40 @@ package body Sem_Aggr is
-- derived tagged types since we need to retrieve the record structure
-- of all the ancestors of Typ.
--
- -- 6. After gathering the record components we look for their values
- -- in the record aggregate and emit appropriate error messages
- -- should we not find such values or should they be duplicated.
+ -- 6. After gathering the record components we look for their values in the
+ -- record aggregate and emit appropriate error messages should we not
+ -- find such values or should they be duplicated.
--
- -- 7. We then make sure no illegal component names appear in the
- -- record aggregate and make sure that the type of the record
- -- components appearing in a same choice list is the same.
- -- Finally we ensure that the others choice, if present, is
- -- used to provide the value of at least a record component.
+ -- 7. We then make sure no illegal component names appear in the record
+ -- aggregate and make sure that the type of the record components
+ -- appearing in a same choice list is the same. Finally we ensure that
+ -- the others choice, if present, is used to provide the value of at
+ -- least a record component.
--
- -- 8. The original aggregate node is replaced with the new named
- -- aggregate built in steps 3 through 6, as explained earlier.
+ -- 8. The original aggregate node is replaced with the new named aggregate
+ -- built in steps 3 through 6, as explained earlier.
--
- -- Given the complexity of record aggregate resolution, the primary
- -- goal of this routine is clarity and simplicity rather than execution
- -- and storage efficiency. If there are only positional components in the
- -- aggregate the running time is linear. If there are associations
- -- the running time is still linear as long as the order of the
- -- associations is not too far off the order of the components in the
- -- record type. If this is not the case the running time is at worst
- -- quadratic in the size of the association list.
+ -- Given the complexity of record aggregate resolution, the primary goal of
+ -- this routine is clarity and simplicity rather than execution and storage
+ -- efficiency. If there are only positional components in the aggregate the
+ -- running time is linear. If there are associations the running time is
+ -- still linear as long as the order of the associations is not too far off
+ -- the order of the components in the record type. If this is not the case
+ -- the running time is at worst quadratic in the size of the association
+ -- list.
procedure Check_Misspelled_Component
(Elements : Elist_Id;
Component : Node_Id);
- -- Give possible misspelling diagnostic if Component is likely to be
- -- a misspelling of one of the components of the Assoc_List.
- -- This is called by Resolve_Aggr_Expr after producing
- -- an invalid component error message.
+ -- Give possible misspelling diagnostic if Component is likely to be a
+ -- misspelling of one of the components of the Assoc_List. This is called
+ -- by Resolve_Aggr_Expr after producing an invalid component error message.
procedure Check_Static_Discriminated_Subtype (T : Entity_Id; V : Node_Id);
- -- An optimization: determine whether a discriminated subtype has a
- -- static constraint, and contains array components whose length is also
- -- static, either because they are constrained by the discriminant, or
- -- because the original component bounds are static.
+ -- An optimization: determine whether a discriminated subtype has a static
+ -- constraint, and contains array components whose length is also static,
+ -- either because they are constrained by the discriminant, or because the
+ -- original component bounds are static.
-----------------------------------------------------
-- Subprograms used for ARRAY AGGREGATE Processing --