aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_eval.ads
diff options
context:
space:
mode:
authorGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-22 17:43:43 -0300
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-22 17:43:43 -0300
commita926878ddbd5a98b272c22171ce58663fc04c3e0 (patch)
tree86af256e5d9a9c06263c00adc90e5fe348008c43 /gcc/ada/sem_eval.ads
parent542730f087133690b47e036dfd43eb0db8a650ce (diff)
parent07cbaed8ba7d1b6e4ab3a9f44175502a4e1ecdb1 (diff)
downloadgcc-devel/autopar_devel.zip
gcc-devel/autopar_devel.tar.gz
gcc-devel/autopar_devel.tar.bz2
Merge branch 'autopar_rebase2' into autopar_develdevel/autopar_devel
Quickly commit changes in the rebase branch.
Diffstat (limited to 'gcc/ada/sem_eval.ads')
-rw-r--r--gcc/ada/sem_eval.ads47
1 files changed, 32 insertions, 15 deletions
diff --git a/gcc/ada/sem_eval.ads b/gcc/ada/sem_eval.ads
index 0a2bc64..76e4bdf 100644
--- a/gcc/ada/sem_eval.ads
+++ b/gcc/ada/sem_eval.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2020, 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- --
@@ -125,15 +125,18 @@ package Sem_Eval is
-----------------
procedure Check_Expression_Against_Static_Predicate
- (Expr : Node_Id;
- Typ : Entity_Id);
+ (Expr : Node_Id;
+ Typ : Entity_Id;
+ Static_Failure_Is_Error : Boolean := False);
-- Determine whether an arbitrary expression satisfies the static predicate
-- of a type. The routine does nothing if Expr is not known at compile time
- -- or Typ lacks a static predicate, otherwise it may emit a warning if the
- -- expression is prohibited by the predicate. If the expression is a static
- -- expression and it fails a predicate that was not explicitly stated to be
- -- a dynamic predicate, then an additional warning is given, and the flag
- -- Is_Static_Expression is reset on Expr.
+ -- or Typ lacks a static predicate; otherwise it may emit a warning if the
+ -- expression is prohibited by the predicate, or if Static_Failure_Is_Error
+ -- is True then an error will be flagged. If the expression is a static
+ -- expression, it fails a predicate that was not explicitly stated to be
+ -- a dynamic predicate, and Static_Failure_Is_Error is False, then an
+ -- additional warning is given, and the flag Is_Static_Expression is reset
+ -- on Expr.
procedure Check_Non_Static_Context (N : Node_Id);
-- Deals with the special check required for a static expression that
@@ -162,6 +165,14 @@ package Sem_Eval is
-- In the former case, if the target type, Ttyp is constrained, then a
-- check is made to see if the string literal is of appropriate length.
+ function Checking_Potentially_Static_Expression return Boolean;
+ -- Returns True if the checking for potentially static expressions is
+ -- enabled; otherwise returns False.
+
+ procedure Set_Checking_Potentially_Static_Expression (Value : Boolean);
+ -- Enables checking for potentially static expressions if Value is True,
+ -- and disables such checking if Value is False.
+
type Compare_Result is (LT, LE, EQ, GT, GE, NE, Unknown);
subtype Compare_GE is Compare_Result range EQ .. GE;
subtype Compare_LE is Compare_Result range LT .. EQ;
@@ -276,7 +287,9 @@ package Sem_Eval is
-- or character literals. In the latter two cases, the value returned is
-- the Pos value in the relevant enumeration type. It can also be used for
-- fixed-point values, in which case it returns the corresponding integer
- -- value. It cannot be used for floating-point values.
+ -- value, but it cannot be used for floating-point values. Finally, it can
+ -- also be used for the Null access value, as well as for the result of an
+ -- unchecked conversion of the aforementioned handled values.
function Expr_Value_E (N : Node_Id) return Entity_Id;
-- Returns the folded value of the expression. This function is called in
@@ -414,8 +427,6 @@ package Sem_Eval is
-- for compile time evaluation purposes. Use Compile_Time_Known_Value
-- instead (see section on "Compile-Time Known Values" above).
- -- WARNING: There is a matching C declaration of this subprogram in fe.h
-
function Is_OK_Static_Range (N : Node_Id) return Boolean;
-- Determines if range is static, as defined in RM 4.9(26), and also checks
-- that neither bound of the range raises constraint error, thus ensuring
@@ -476,11 +487,17 @@ package Sem_Eval is
-- it cannot (because the value of Lo or Hi is not known at compile time)
-- then it returns False.
+ function Predicates_Compatible (T1, T2 : Entity_Id) return Boolean;
+ -- In Ada 2012, subtypes are statically compatible if the predicates are
+ -- compatible as well. This function performs the required check that
+ -- predicates are compatible. Split from Subtypes_Statically_Compatible
+ -- so that it can be used in specializing error messages.
+
function Predicates_Match (T1, T2 : Entity_Id) return Boolean;
- -- In Ada 2012, subtypes statically match if their static predicates
- -- match as well. This function performs the required check that
- -- predicates match. Separated out from Subtypes_Statically_Match so
- -- that it can be used in specializing error messages.
+ -- In Ada 2012, subtypes statically match if their predicates match as
+ -- as well. This function performs the required check that predicates
+ -- match. Separated out from Subtypes_Statically_Match so that it can
+ -- be used in specializing error messages.
function Subtypes_Statically_Compatible
(T1 : Entity_Id;