diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-02 15:39:08 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-02 15:39:08 +0200 |
commit | db72f10a75e878cf0c678e21bdc4b7222acca271 (patch) | |
tree | bb14d06f938e48886c3a29d49cfcab4c8a831a20 /gcc/ada/sem_res.adb | |
parent | 23685ae6ecac53a9365195feaf56c986d7c2eae0 (diff) | |
download | gcc-db72f10a75e878cf0c678e21bdc4b7222acca271.zip gcc-db72f10a75e878cf0c678e21bdc4b7222acca271.tar.gz gcc-db72f10a75e878cf0c678e21bdc4b7222acca271.tar.bz2 |
[multiple changes]
2011-08-02 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch5.adb (Expand_Iterator_Loop): Code cleanup and refactoring.
When a container is provided via a function call, generate a renaming
of the function result. This avoids the creation of a transient scope
and the premature finalization of the container.
* exp_ch7.adb (Is_Container_Cursor): Removed.
(Wrap_Transient_Declaration): Remove the supression of the finalization
of the list controller when the declaration denotes a container cursor,
it is not needed.
2011-08-02 Yannick Moy <moy@adacore.com>
* restrict.adb (Check_Formal_Restriction): only issue a warning if the
node is from source, instead of the original node being from source.
* sem_aggr.adb
(Resolve_Array_Aggregate): refine the check for a static expression, to
recognize also static ranges
* sem_ch3.adb, sem_ch3.ads (Analyze_Component_Declaration,
Array_Type_Declaration): postpone the test for the type being a subtype
mark after the type has been resolved, so that component-selection and
expanded-name are discriminated.
(Make_Index, Process_Range_Expr_In_Decl): add a parameter In_Iter_Schm
to distinguish the case of an iteration scheme, so that an error is
issed on a non-static range in SPARK except in an iteration scheme.
* sem_ch5.adb (Analyze_Iteration_Scheme): call Make_Index with
In_Iter_Schm = True.
* sem_ch6.adb (Analyze_Subprogram_Specification): refine the check for
user-defined operators so that they are allowed in renaming
* sem_ch8.adb
(Find_Selected_Component): refine the check for prefixing of operators
so that they are allowed in renaming. Move the checks for restrictions
on selector name after analysis discriminated between
component-selection and expanded-name.
* sem_res.adb (Resolve_Op_Concat_Arg): do not issue a warning on
concatenation argument of string type if it is static.
* sem_util.adb, sem_util.ads
(Check_Later_Vs_Basic_Declarations): add a new function
Is_Later_Declarative_Item to decice which declarations are allowed as
later items, in the two different modes Ada 83 and SPARK. In the SPARK
mode, add that renamings are considered as later items.
(Enclosing_Package): new function to return the enclosing package
(Enter_Name): correct the rule for homonyms in SPARK
(Is_SPARK_Initialization_Expr): default to returning True on nodes not
from source (result of expansion) to avoid issuing wrong warnings.
2011-08-02 Ed Schonberg <schonberg@adacore.com>
* errout.adb: On anything but an expression First_Node returns its
argument.
From-SVN: r177152
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r-- | gcc/ada/sem_res.adb | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index f32e052..3f778c3 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -6786,6 +6786,8 @@ package body Sem_Res is if Is_Array_Type (T) and then Base_Type (T) /= Standard_String and then Base_Type (Etype (L)) = Base_Type (Etype (R)) + and then Etype (L) /= Any_Composite -- or else L in error + and then Etype (R) /= Any_Composite -- or else R in error and then not Matching_Static_Array_Bounds (Etype (L), Etype (R)) then Check_Formal_Restriction @@ -7322,17 +7324,21 @@ package body Sem_Res is -- bounds. Of course the types have to match, so only check if operands -- are compatible and the node itself has no errors. - if Is_Array_Type (B_Typ) - and then Nkind (N) in N_Binary_Op - and then - Base_Type (Etype (Left_Opnd (N))) - = Base_Type (Etype (Right_Opnd (N))) - and then not Matching_Static_Array_Bounds (Etype (Left_Opnd (N)), - Etype (Right_Opnd (N))) - then - Check_Formal_Restriction - ("array types should have matching static bounds", N); - end if; + declare + Left_Typ : constant Node_Id := Etype (Left_Opnd (N)); + Right_Typ : constant Node_Id := Etype (Right_Opnd (N)); + begin + if Is_Array_Type (B_Typ) + and then Nkind (N) in N_Binary_Op + and then Base_Type (Left_Typ) = Base_Type (Right_Typ) + and then Left_Typ /= Any_Composite -- or else Left_Opnd in error + and then Right_Typ /= Any_Composite -- or else Right_Opnd in error + and then not Matching_Static_Array_Bounds (Left_Typ, Right_Typ) + then + Check_Formal_Restriction + ("array types should have matching static bounds", N); + end if; + end; end Resolve_Logical_Op; @@ -7702,9 +7708,9 @@ package body Sem_Res is end if; elsif Is_String_Type (Etype (Arg)) then - if Nkind (Arg) /= N_String_Literal then + if not Is_Static_Expression (Arg) then Check_Formal_Restriction - ("string operand for concatenation should be a literal", N); + ("string operand for concatenation should be static", N); end if; -- Do not issue error on an operand that is neither a character nor a @@ -7984,6 +7990,7 @@ package body Sem_Res is if Is_Array_Type (Target_Typ) and then Is_Array_Type (Etype (Expr)) + and then Etype (Expr) /= Any_Composite -- or else Expr in error and then not Matching_Static_Array_Bounds (Target_Typ, Etype (Expr)) then Check_Formal_Restriction @@ -9109,6 +9116,7 @@ package body Sem_Res is if Is_Array_Type (Target_Typ) and then Is_Array_Type (Operand_Typ) + and then Operand_Typ /= Any_Composite -- or else Operand in error and then not Matching_Static_Array_Bounds (Target_Typ, Operand_Typ) then Check_Formal_Restriction |