summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_dim.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-01 10:07:24 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-01 10:07:24 +0000
commit22631b419cdf2889e3d298f8f6012ce939735a28 (patch)
tree91820ae56088b235e14ebd8b3e430343693d843a /gcc/ada/sem_dim.ads
parent3cc18861212f992470d0e8edce992792ca23872b (diff)
downloadgcc-22631b419cdf2889e3d298f8f6012ce939735a28.tar.gz
2012-10-01 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb (Process_Convention, Process_Import_Or_Interface): Adjust test so that when the pragma comes from an aspect specification it only applies to the entity in the original declaration. 2012-10-01 Thomas Quinot <quinot@adacore.com> * gnat_ugn.texi: Document new command line switch -fada-spec-parent. 2012-10-01 Thomas Quinot <quinot@adacore.com> * s-oscons-tmplt.c, g-socket.ads: Minor code improvement: use gcc builtin __alignof__ to get the alignment of struct fd_set. 2012-10-01 Vincent Pucci <pucci@adacore.com> * exp_ch6.adb (Expand_Call): Remove call to Remove_Dimension_In_Call. * sem_aggr.adb (Resolve_Array_Aggregate): Analyze dimension of components in array aggregate. (Resolve_Aggr_Expr): Propagate dimensions from the original expression Expr to the new created expression New_Expr when resolving the expression of a component in record aggregates. (Resolve_Record_Aggregate): Analyze dimension of components in record (or extension) aggregate. * sem_ch6.adb (Analyze_Subprogram_Specification): Analyze dimension of formals with default expressions in subprogram specification. * sem_ch8.adb (Analyze_Expanded_Name): Analyze dimension of expanded names. (Find_Selected_Component): Analyze dimension of selected component. * sem_dim.adb: Several dimension error messages reformatting. (Dimensions_Msg_Of): New flag Description_Needed in order to differentiate two different sort of dimension error messages. (Dim_Warning_For_Numeric_Literal): New routine. (Exists): New routine. (Move_Dimensions): Routine spec moved to spec file. * sem_dim.ads (String_From_Numeric_Literal): New routine. (Analyze_Dimension): Analyze dimension only when the node comes from source. Dimension analysis for expanded names added. (Analyze_Dimension_Array_Aggregate): New routine. (Analyze_Dimension_Call): New routine. (Analyze_Dimension_Component_Declaration): Warning if default expression is a numeric literal. (Analyze_Dimension_Extension_Or_Record_Aggregate): New routine. (Analyze_Dimension_Formals): New routine. (Analyze_Dimension_Object_Declaration): Warning if default expression is a numeric literal. (Symbol_Of): Return either the dimension subtype symbol or the dimension symbol built by From_Dim_To_Str_Of_Unit_Symbols. * sem_dim.ads (Analyze_Dimension_Array_Aggregate): New routine. (Analyze_Dimension_Call): New routine. (Analyze_Dimension_Extension_Or_Record_Aggregate): New routine. (Analyze_Dimension_Formals): New routine. (Move_Dimensions): Moved from sem_dim.adb. * s-dimmks.ads: Turn off the warnings for dimensioned object declaration. Dimensioned subtypes sorted in alphabetical order. New subtypes Area, Speed, Volume. * s-dmotpr.ads: Turn off the warnings for dimensioned object declaration. * sem_res.adb (Resolve_Call): Analyze dimension for calls. 2012-10-01 Thomas Quinot <quinot@adacore.com> * Make-generated.in: Minor cleanup of all targets: use MOVE_IF_CHANGE to put generated files in place, to avoid useless recompilations. 2012-10-01 Javier Miranda <miranda@adacore.com> * exp_disp.adb (Expand_Dispatching_Call): For functions returning interface types add an implicit conversion to the returned object to force the displacement of the pointer to the returned object to reference the corresponding secondary dispatch table. This is needed to handle well combined calls involving secondary dispatch tables (for example Obj.Prim1.Prim2). * exp_ch4.adb (Expand_Allocator_Expression): Declare internal access type as access to constant or access to variable depending on the context. Found working in this ticket. 2012-10-01 Ed Schonberg <schonberg@adacore.com> * checks.adb (Apply_Predicate_Check): Do not apply check to actual of predicate checking procedure, to prevent infinite recursion. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191910 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_dim.ads')
-rw-r--r--gcc/ada/sem_dim.ads39
1 files changed, 36 insertions, 3 deletions
diff --git a/gcc/ada/sem_dim.ads b/gcc/ada/sem_dim.ads
index 3799651a072..86ada35f367 100644
--- a/gcc/ada/sem_dim.ads
+++ b/gcc/ada/sem_dim.ads
@@ -108,16 +108,19 @@ package Sem_Dim is
procedure Analyze_Dimension (N : Node_Id);
-- N may denote any of the following contexts:
+ -- * aggregate
-- * assignment statement
-- * attribute reference
-- * binary operator
+ -- * call
-- * compontent declaration
-- * extended return statement
- -- * function call
+ -- * expanded name
-- * identifier
-- * indexed component
-- * object declaration
-- * object renaming declaration
+ -- * procedure call statement
-- * qualified expression
-- * selected component
-- * simple return statement
@@ -129,6 +132,36 @@ package Sem_Dim is
-- Depending on the context, ensure that all expressions and entities
-- involved do not violate the rules of a system.
+ procedure Analyze_Dimension_Array_Aggregate
+ (N : Node_Id;
+ Comp_Typ : Entity_Id);
+ -- Check, for each component of the array aggregate denoted by N, the
+ -- dimensions of the component expression match the dimensions of the
+ -- component type Comp_Typ.
+
+ procedure Analyze_Dimension_Call (N : Node_Id; Nam : Entity_Id);
+ -- This routine is split in two steps. Note the second step applies only to
+ -- function calls.
+ -- Step 1. Dimension checking:
+ -- * General case: check the dimensions of each actual parameter match
+ -- the dimensions of the corresponding formal parameter.
+ -- * Elementary function case: check each actual is dimensionless except
+ -- for Sqrt call.
+ -- Step 2. Dimension propagation (only for functions):
+ -- * General case: propagate the dimensions from the returned type to the
+ -- function call.
+ -- * Sqrt case: the resulting dimensions equal to half the dimensions of
+ -- the actual
+
+ procedure Analyze_Dimension_Extension_Or_Record_Aggregate (N : Node_Id);
+ -- Check, for each component of the extension or record aggregate denoted
+ -- by N, the dimensions of the component expression match the dimensions of
+ -- the component type.
+
+ procedure Analyze_Dimension_Formals (N : Node_Id; Formals : List_Id);
+ -- For sub spec N, issue a warning for each dimensioned formal with a
+ -- literal default value in the list of formals Formals.
+
procedure Eval_Op_Expon_For_Dimensioned_Type
(N : Node_Id;
Btyp : Entity_Id);
@@ -150,8 +183,8 @@ package Sem_Dim is
-- Return True if N is a package instantiation of System.Dim.Integer_IO or
-- of System.Dim.Float_IO.
- procedure Remove_Dimension_In_Call (Call : Node_Id);
- -- Remove the dimensions from all formal parameters of Call
+ procedure Move_Dimensions (From : Node_Id; To : Node_Id);
+ -- Copy dimension vector of From to To, delete dimension vector of From
procedure Remove_Dimension_In_Statement (Stmt : Node_Id);
-- Remove the dimensions associated with Stmt