diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-06-25 11:34:02 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-06-25 11:34:02 +0200 |
commit | 2a31c32ba59f8772f3bdf62b7f74523d0a0a4583 (patch) | |
tree | e33ff61b64fe2dc5c8b03a655de538b8f1d30368 /gcc/ada/sem_ch3.ads | |
parent | fadcf3134557b94e1e52b8d9d6aa95e2ec2443ef (diff) | |
download | gcc-2a31c32ba59f8772f3bdf62b7f74523d0a0a4583.zip gcc-2a31c32ba59f8772f3bdf62b7f74523d0a0a4583.tar.gz gcc-2a31c32ba59f8772f3bdf62b7f74523d0a0a4583.tar.bz2 |
[multiple changes]
2009-06-25 Vincent Celier <celier@adacore.com>
* vms_data.ads: Minor comment change
2009-06-25 Gary Dismukes <dismukes@adacore.com>
* exp_ch5.adb (Expand_N_Extended_Return_Statement): Don't build an
assignment statement to targeting a caller-provided object when the
result type is an interface type.
* exp_ch6.adb (Expand_Call): Remove redundant test of
Is_Limited_Interface (Is_Inherently_Limited is sufficient).
(Is_Build_In_Place_Function): Remove test for Is_Limited_Interface.
* sem_aggr.adb (Check_Expr_OK_In_Limited_Aggregate): Add type in call
to OK_For_Limited_Init.
* sem_aux.adb (Is_Inherently_Limited_Type): Revise limited type
condition so that True is returned for all limited interfaces, not
just synchronized ones. Ignore components of an interface type when
checking for limited components (such a component can be a parent
component).
* sem_ch3.ads (OK_For_Limited_Init_In_05): Add type parameter.
(OK_For_Limited_Init): Add type parameter.
* sem_ch3.adb (Check_Initialization): Add type in call to
OK_For_Limited_Init.
(OK_For_Limited_Init): Add new type param in call to
OK_For_Limited_Init_In_05.
(OK_For_Limited_Init_In_05): Permit arbitrary expressions of a
nonlimited type when the context type is a limited interface. Add type
on recursive calls.
* sem_ch4.adb (Analyze_Allocator): Add type in call to
OK_For_Limited_Init.
* sem_ch6.adb (Check_Limited_Return): Add type in call to
OK_For_Limited_Init.
* sem_ch12.adb (Analyze_Formal_Object_Declaration): Add type in call to
OK_For_Limited_Init.
(Instantiate_Object): Add type in call to OK_For_Limited_Init.
* sem_type.adb (Interface_Present_In_Ancestor): In the case of a
class-wide interface, get the base type before applying Etype, in order
to account for class-wide subtypes.
From-SVN: r148938
Diffstat (limited to 'gcc/ada/sem_ch3.ads')
-rw-r--r-- | gcc/ada/sem_ch3.ads | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/gcc/ada/sem_ch3.ads b/gcc/ada/sem_ch3.ads index 93750701..c8fc885 100644 --- a/gcc/ada/sem_ch3.ads +++ b/gcc/ada/sem_ch3.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -182,18 +182,24 @@ package Sem_Ch3 is -- wide type is created at the same time, and therefore there is a private -- and a full declaration for the class-wide type as well. - function OK_For_Limited_Init_In_05 (Exp : Node_Id) return Boolean; - -- Presuming Exp is an expression of an inherently limited type, returns - -- True if the expression is allowed in an initialization context by the - -- rules of Ada 2005. We use the rule in RM-7.5(2.1/2), "...it is an - -- aggregate, a function_call, or a parenthesized expression or - -- qualified_expression whose operand is permitted...". Note that in Ada - -- 95 mode, we sometimes wish to give warnings based on whether the - -- program _would_ be legal in Ada 2005. Note that Exp must already have - -- been resolved, so we can know whether it's a function call (as opposed - -- to an indexed component, for example). - - function OK_For_Limited_Init (Exp : Node_Id) return Boolean; + function OK_For_Limited_Init_In_05 + (Typ : Entity_Id; + Exp : Node_Id) return Boolean; + -- Presuming Exp is an expression of an inherently limited type Typ, + -- returns True if the expression is allowed in an initialization context + -- by the rules of Ada 2005. We use the rule in RM-7.5(2.1/2), "...it is an + -- aggregate, a function_call, or a parenthesized expression or qualified + -- expression whose operand is permitted...". Note that in Ada 95 mode, + -- we sometimes wish to give warnings based on whether the program _would_ + -- be legal in Ada 2005. Note that Exp must already have been resolved, + -- so we can know whether it's a function call (as opposed to an indexed + -- component, for example). In the case where Typ is a limited interface's + -- class-wide type, then the expression is allowed to be of any kind if its + -- type is a nonlimited descendant of the interface. + + function OK_For_Limited_Init + (Typ : Entity_Id; + Exp : Node_Id) return Boolean; -- Always False in Ada 95 mode. Equivalent to OK_For_Limited_Init_In_05 in -- Ada 2005 mode. |