aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_warn.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-01-02 12:06:15 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2013-01-02 12:06:15 +0100
commitef7c5fa919b358f10946c832007a488c22753bb9 (patch)
tree0c40dcc14b5b2a9a02d9d7e8d295aa78b373e396 /gcc/ada/sem_warn.adb
parente9f80612564876fc089ae96504e0ceaa0c33e0e8 (diff)
downloadgcc-ef7c5fa919b358f10946c832007a488c22753bb9.zip
gcc-ef7c5fa919b358f10946c832007a488c22753bb9.tar.gz
gcc-ef7c5fa919b358f10946c832007a488c22753bb9.tar.bz2
[multiple changes]
2013-01-02 Robert Dewar <dewar@adacore.com> * gnat1drv.adb, targparm.adb, targparm.ads: Minor name change: add On_Target to Atomic_Sync_Default. 2013-01-02 Robert Dewar <dewar@adacore.com> * sem_warn.adb (Warn_On_Known_Condition): Suppress warning for comparison of attribute result with constant * a-ststio.adb, s-direio.adb, s-rannum.adb: Remove unnecessary pragma Warnings (Off, ".."); 2013-01-02 Yannick Moy <moy@adacore.com> * sem_prag.ads: Minor correction of comment. 2013-01-02 Thomas Quinot <quinot@adacore.com> * par_sco.adb (Traverse_Package_Declaration): The first declaration in a nested package is dominated by the preceding declaration in the enclosing scope. 2013-01-02 Pascal Obry <obry@adacore.com> * adaint.c, adaint.h (__gnat_get_module_name): Return the actual module containing a given address. From-SVN: r194798
Diffstat (limited to 'gcc/ada/sem_warn.adb')
-rw-r--r--gcc/ada/sem_warn.adb13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index e794039..e24e729 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -3175,9 +3175,20 @@ package body Sem_Warn is
if Constant_Condition_Warnings
and then Is_Known_Branch
- and then Comes_From_Source (Original_Node (C))
+ and then Comes_From_Source (Orig)
and then not In_Instance
then
+ -- Don't warn if comparison of result of attribute against a constant
+ -- value, since this is likely legitimate conditional compilation.
+
+ if Nkind (Orig) in N_Op_Compare
+ and then Compile_Time_Known_Value (Right_Opnd (Orig))
+ and then Nkind (Original_Node (Left_Opnd (Orig))) =
+ N_Attribute_Reference
+ then
+ return;
+ end if;
+
-- See if this is in a statement or a declaration
P := Parent (C);