aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_warn.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-04-25 15:25:06 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2017-04-25 15:25:06 +0200
commit628078425bbdfc487c569bf949ad5a334c13a006 (patch)
tree1d950e330796613f55d665d41115455a1425692f /gcc/ada/sem_warn.adb
parentc66cda60fe7d35c2dfb2397d754461e9b1698c08 (diff)
downloadgcc-628078425bbdfc487c569bf949ad5a334c13a006.zip
gcc-628078425bbdfc487c569bf949ad5a334c13a006.tar.gz
gcc-628078425bbdfc487c569bf949ad5a334c13a006.tar.bz2
[multiple changes]
2017-04-25 Thomas Quinot <quinot@adacore.com> * sem_prag.adb (Analyze_Pragma, case Pragma_Check): Remove bogus circuitry for the case where Name is Predicate. 2017-04-25 Thomas Quinot <quinot@adacore.com> * par_sco.adb(Traverse_Declarations_Or_Statements.Traverse_Aspects): Create SCOs for Predicate aspects in disabled state initially, to be enabled later on by... * sem_ch13.adb (Build_Predicate_Functions.Add_Predicates): Mark SCO for predicate as enabled. 2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * comperr.adb (Compiler_Abort): Remove now obsolete pair of pragmas Warnings Off / On. * namet.adb (Finalize): Remove now obsolete pair of pragmas Warnings Off / On. * output.adb: Remove now obsolete pair of pragmas Warnings Off / On. * sem_warn.adb (Warn_On_Constant_Valid_Condition): Do not consider comparisons between static expressions because their values cannot be invalidated. * urealp.adb (Tree_Read): Remove now obsolete pair of pragmas Warnings Off / On. (Tree_Write): Remove now obsolete pair of pragmas Warnings Off / On. * usage.adb Remove now obsolete pair of pragmas Warnings Off / On. 2017-04-25 Bob Duff <duff@adacore.com> * sem_elab.adb (In_Task_Activation): Trace internal calls in task bodies. From-SVN: r247227
Diffstat (limited to 'gcc/ada/sem_warn.adb')
-rw-r--r--gcc/ada/sem_warn.adb29
1 files changed, 23 insertions, 6 deletions
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index d4f3e4f..52fc372 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -3267,22 +3267,39 @@ package body Sem_Warn is
--------------------------------------
procedure Warn_On_Constant_Valid_Condition (Op : Node_Id) is
+ Left : constant Node_Id := Left_Opnd (Op);
+ Right : constant Node_Id := Right_Opnd (Op);
+
True_Result : Boolean;
False_Result : Boolean;
begin
-- Determine the potential outcome of the comparison assuming that the
- -- operands are valid. Do not consider instances because the check was
- -- already performed in the generic. Do not consider comparison between
- -- an attribute reference and a compile-time known value since this is
- -- most likely a conditional compilation. Do not consider internal files
- -- in order to allow for various assertions and safeguards within our
- -- runtime.
+ -- operands are valid.
if Constant_Condition_Warnings
and then Comes_From_Source (Original_Node (Op))
+
+ -- Do not consider instances because the check was already performed
+ -- in the generic.
+
and then not In_Instance
+
+ -- Do not consider comparisons between two static expressions such as
+ -- constants or literals because those values cannot be invalidated.
+
+ and then not (Is_Static_Expression (Left)
+ and then Is_Static_Expression (Right))
+
+ -- Do not consider comparison between an attribute reference and a
+ -- compile-time known value since this is most likely a conditional
+ -- compilation.
+
and then not Is_Attribute_And_Known_Value_Comparison (Op)
+
+ -- Do not consider internal files to allow for various assertions and
+ -- safeguards within our runtime.
+
and then not Is_Internal_File_Name
(Unit_File_Name (Get_Source_Unit (Op)))
then