summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-20 12:51:17 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-20 12:51:17 +0000
commit3e1a4cdb1591e332b95c1c49cab2ec8d380d3d03 (patch)
tree3acaae64e746b354a27b2162c0a3d1b8e3a75916
parent37099ab7a0d2067359ddec22f67e80ae918394cf (diff)
downloadppe42-gcc-3e1a4cdb1591e332b95c1c49cab2ec8d380d3d03.tar.gz
ppe42-gcc-3e1a4cdb1591e332b95c1c49cab2ec8d380d3d03.zip
2008-05-20 Robert Dewar <dewar@adacore.com>
* sem_res.adb (Resolve_Op_Not): Warn on double negation git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135644 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/sem_res.adb13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 39cd89514fb..9cc285f1100 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -6975,6 +6975,19 @@ package body Sem_Res is
Error_Msg_N ("?not expression should be parenthesized here!", N);
end if;
+ -- Warn on double negation if checking redundant constructs
+
+ if Warn_On_Redundant_Constructs
+ and then Comes_From_Source (N)
+ and then Comes_From_Source (Right_Opnd (N))
+ and then Root_Type (Typ) = Standard_Boolean
+ and then Nkind (Right_Opnd (N)) = N_Op_Not
+ then
+ Error_Msg_N ("redundant double negation?", N);
+ end if;
+
+ -- Complete resolution and evaluation of NOT
+
Resolve (Right_Opnd (N), B_Typ);
Check_Unset_Reference (Right_Opnd (N));
Set_Etype (N, B_Typ);
OpenPOWER on IntegriCloud