diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-04-24 16:49:08 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-04-24 16:49:08 +0200 |
commit | 0d5fbf52732b39f55714baad348c3269db8bb1b9 (patch) | |
tree | 2e0534b116d60294d01b70485a5da625a229e180 /gcc/ada/sem_ch13.adb | |
parent | 3d67b2397ae7eb4d2c384a093cbcac138cf068c7 (diff) | |
download | gcc-0d5fbf52732b39f55714baad348c3269db8bb1b9.zip gcc-0d5fbf52732b39f55714baad348c3269db8bb1b9.tar.gz gcc-0d5fbf52732b39f55714baad348c3269db8bb1b9.tar.bz2 |
[multiple changes]
2013-04-24 Robert Dewar <dewar@adacore.com>
* sem_type.adb, exp_attr.adb, exp_ch4.adb: Minor reformatting.
2013-04-24 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document 'Update attribute.
* sem_attr.adb (Analyze_Attribute, case Update): Remove call
to S14_Attribute (S14_Attribute): removed.
2013-04-24 Robert Dewar <dewar@adacore.com>
* interfac.ads: Add size clauses for IEEE_Float_32/64
2013-04-24 Claire Dross <dross@adacore.com>
* gnat1drv.adb (Adjust_Global_Switches): Remove
special assignment of Use_Expression_With_Actions for SPARK_Mode.
2013-04-24 Hristian Kirtchev <kirtchev@adacore.com>
* checks.adb (Apply_Predicate_Check): Check for the presence
of the dynamic predicate aspect when trying to determine if the
predicate of a type is non-static.
* sem_ch5.adb (Analyze_Loop_Parameter_Specification): Check
for the presence of the dynamic predicate aspect when trying to
determine if the predicate of a type is non- static.
* sem_ch13.adb (Add_Call): Capture the nature of the
inherited ancestor predicate.
(Build_Predicate_Functions): Update comments. Rewrite the checks on
static predicate application. Complain about the form of a non-static
expression only when the type is static.
2013-04-24 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb: Add guard to tree traversal.
2013-04-24 Vincent Celier <celier@adacore.com>
* clean.adb (Clean): Remove local variable Root_Environment,
use Makeutl.Root_Environment instead.
* gnatcmd.adb: Remove local variable Root_Environment, use
Makeutl.Root_Environment instead.
* make.adb (Gnatmake): Remove local variable Root_Environment,
use Makeutl.Root_Environment instead.
* prj-makr.adb: Remove local variable Root_Environment, use
Makeutl.Root_Environment instead.
From-SVN: r198243
Diffstat (limited to 'gcc/ada/sem_ch13.adb')
-rw-r--r-- | gcc/ada/sem_ch13.adb | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 0d32aff..709947b 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -5767,7 +5767,7 @@ package body Sem_Ch13 is Dynamic_Predicate_Present : Boolean := False; -- Set True if a dynamic predicate is present, results in the entire - -- predicate being considered dynamic even if it looks static + -- predicate being considered dynamic even if it looks static. Static_Predicate_Present : Node_Id := Empty; -- Set to N_Pragma node for a static predicate if one is encountered @@ -5783,6 +5783,12 @@ package body Sem_Ch13 is if Present (T) and then Present (Predicate_Function (T)) then Set_Has_Predicates (Typ); + -- Capture the nature of the inherited ancestor predicate + + if Has_Dynamic_Predicate_Aspect (T) then + Dynamic_Predicate_Present := True; + end if; + -- Build the call to the predicate function of T Exp := @@ -5866,6 +5872,8 @@ package body Sem_Ch13 is if Nkind (Ritem) = N_Pragma and then Pragma_Name (Ritem) = Name_Predicate then + -- Capture the nature of the predicate + if Present (Corresponding_Aspect (Ritem)) then case Chars (Identifier (Corresponding_Aspect (Ritem))) is when Name_Dynamic_Predicate => @@ -6199,25 +6207,28 @@ package body Sem_Ch13 is end; end if; - -- Deal with static predicate case + if Is_Scalar_Type (Typ) then - -- ??? We don't currently deal with real types - -- ??? Why requiring that Typ is static? + -- Attempt to build a static predicate for a discrete or a real + -- subtype. This action may fail because the actual expression may + -- not be static. - if Ekind (Typ) in Discrete_Kind - and then Is_Static_Subtype (Typ) - and then not Dynamic_Predicate_Present - then - -- Only build the predicate for subtypes - - if Ekind_In (Typ, E_Enumeration_Subtype, + if Ekind_In (Typ, E_Decimal_Fixed_Point_Subtype, + E_Enumeration_Subtype, + E_Floating_Point_Subtype, E_Modular_Integer_Subtype, + E_Ordinary_Fixed_Point_Subtype, E_Signed_Integer_Subtype) then Build_Static_Predicate (Typ, Expr, Object_Name); + -- The predicate is categorized as static but its expression is + -- dynamic. Note that the predicate may become non-static when + -- inherited dynamic predicates are involved. + if Present (Static_Predicate_Present) - and No (Static_Predicate (Typ)) + and then No (Static_Predicate (Typ)) + and then not Dynamic_Predicate_Present then Error_Msg_F ("expression does not have required form for " |