diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-16 16:41:29 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-16 16:41:29 +0200 |
commit | 76241f8f2445434f7e9430d9bb4ccb97f253f96e (patch) | |
tree | ffaf0628968a447eb5a8ca927a1399f16fd18d3c /gcc/ada/sem_case.adb | |
parent | 36f6df662c5c857bf44d37bd609c8cb47e1d29c8 (diff) | |
download | gcc-76241f8f2445434f7e9430d9bb4ccb97f253f96e.zip gcc-76241f8f2445434f7e9430d9bb4ccb97f253f96e.tar.gz gcc-76241f8f2445434f7e9430d9bb4ccb97f253f96e.tar.bz2 |
[multiple changes]
2014-07-16 Gary Dismukes <dismukes@adacore.com>
* g-rewdat.adb, g-rewdat.ads: Minor reformatting.
2014-07-16 Doug Rupp <rupp@adacore.com>
* s-interr-hwint.adb: Casing error on parameter.
2014-07-16 Pascal Obry <obry@adacore.com>
* Makefile.rtl: Add g-rewdat.o dependencies in
GNATRTL_NONTASKING_OBJS.
2014-07-16 Ed Schonberg <schonberg@adacore.com>
* sem_case.adb: Code clean up.
From-SVN: r212660
Diffstat (limited to 'gcc/ada/sem_case.adb')
-rw-r--r-- | gcc/ada/sem_case.adb | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb index 3a2f815..30e79b2 100644 --- a/gcc/ada/sem_case.adb +++ b/gcc/ada/sem_case.adb @@ -23,7 +23,6 @@ -- -- ------------------------------------------------------------------------------ -with Aspects; use Aspects; with Atree; use Atree; with Einfo; use Einfo; with Errout; use Errout; @@ -647,6 +646,9 @@ package body Sem_Case is Bounds_Hi : constant Node_Id := Type_High_Bound (Bounds_Type); Bounds_Lo : constant Node_Id := Type_Low_Bound (Bounds_Type); Num_Choices : constant Nat := Choice_Table'Last; + Has_Predicate : constant Boolean := + Is_Static_Subtype (Bounds_Type) + and then Present (Static_Predicate (Bounds_Type)); Choice : Node_Id; Choice_Hi : Uint; @@ -679,17 +681,18 @@ package body Sem_Case is Sorting.Sort (Positive (Choice_Table'Last)); - -- If the type covered by the list of choices is actually a static - -- subtype subject to a static predicate, then the predicate defines - -- subsets of legal values and we must verify that the branches of the - -- case match those subsets. If there is no static_predicate there is no - -- compiler check to perform. In particular we don't want any checks on - -- a case expression that itself appears as the expression of a dynamic - -- predicate. A case expression that defines a static predicate is - -- expanded earlier into a membership test and is not subject to this - -- spurious self-check either. - - if Has_Aspect (Bounds_Type, Aspect_Static_Predicate) then + -- The type covered by the list of choices is actually a static subtype + -- subject to a static predicate. The predicate defines subsets of legal + -- values and requires finer grained analysis. + + -- Note that in GNAT the predicate is considered static if the predicate + -- expression is static, independently of whether the aspect mentions + -- Static explicitly. It is unclear whether this is RM-conforming, but + -- it's certainly useful, and GNAT source make use of this. The downside + -- is that currently case expressions cannot appear in predicates that + -- are not static. ??? + + if Has_Predicate then Pred := First (Static_Predicate (Bounds_Type)); Prev_Lo := Uint_Minus_1; Prev_Hi := Uint_Minus_1; |