diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-01-23 17:58:46 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-01-23 17:58:46 +0100 |
commit | c733429f54ace8a10f50c2a751a0c2c940b8c9ce (patch) | |
tree | 504fca99a9bcf9ba3be7e0ee603ba133db4c6a5b /gcc/ada/sem_util.adb | |
parent | 7e97e1742acd7bd89f44af38315ec93004b90207 (diff) | |
download | gcc-c733429f54ace8a10f50c2a751a0c2c940b8c9ce.zip gcc-c733429f54ace8a10f50c2a751a0c2c940b8c9ce.tar.gz gcc-c733429f54ace8a10f50c2a751a0c2c940b8c9ce.tar.bz2 |
[multiple changes]
2014-01-23 Tristan Gingold <gingold@adacore.com>
* gnat_rm.texi: Minor editing.
2014-01-23 Robert Dewar <dewar@adacore.com>
* opt.adb (Set_Opt_Config_Switches): Reset SPARK mode for
with'ed internal units.
* sem.adb (Semantics): Save and restore SPARK_Mode[_Pragma].
2014-01-23 Javier Miranda <miranda@adacore.com>
* lib-xref.adb (Generate_Reference): As part of processing the
"end-of-spec" reference generate an extra reference to the first
private entity of the package.
* xr_tabls.adb (Add_Reference): No action needed for the extra
'E' reference associated; similar to the processing of the
'e' reference.
2014-01-23 Bob Duff <duff@adacore.com>
* gnat_ugn.texi: Change "--&pp off" to "--!pp off".
2014-01-23 Ed Schonberg <schonberg@adacore.com>
* sem_util.ads, sem_util.adb (Is_Potentially_Unevaluated): new
predicate to implement rule given in 6.1.1 (20/3).
* sem_attr.adb (Analyze_Attribute, case 'Old): Reject prefix of
'Old in a postcondition, if it is potentially unevaluated and
it is not an entity name.
From-SVN: r206990
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r-- | gcc/ada/sem_util.adb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 392d555a..a315e5d 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -10249,6 +10249,48 @@ package body Sem_Util is end if; end Is_Partially_Initialized_Type; + -------------------------------- + -- Is_Potentially_Unevaluated -- + -------------------------------- + + function Is_Potentially_Unevaluated (N : Node_Id) return Boolean is + Par : Node_Id; + Expr : Node_Id; + + begin + Expr := N; + Par := Parent (N); + while not Nkind_In (Par, N_If_Expression, + N_Case_Expression, + N_And_Then, + N_Or_Else, + N_In, + N_Not_In) + loop + Expr := Par; + Par := Parent (Par); + if Nkind (Par) not in N_Subexpr then + return False; + end if; + end loop; + + if Nkind (Par) = N_If_Expression then + return Is_Elsif (Par) or else Expr /= First (Expressions (Par)); + + elsif Nkind (Par) = N_Case_Expression then + return Expr /= Expression (Par); + + elsif Nkind_In (Par, N_And_Then, N_Or_Else) then + return Expr = Right_Opnd (Par); + + elsif Nkind_In (Par, N_In, N_Not_In) then + return Expr /= Left_Opnd (Par); + + else + return False; + end if; + end Is_Potentially_Unevaluated; + ------------------------------------ -- Is_Potentially_Persistent_Type -- ------------------------------------ |