* fix error/pedwarn inconsistency
@ 2007-11-05 10:07 Manuel López-Ibáñez
0 siblings, 0 replies; only message in thread
From: Manuel López-Ibáñez @ 2007-11-05 10:07 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 132 bytes --]
Mark pre-approved this patch here:
http://gcc.gnu.org/ml/gcc/2007-10/msg00000.html
Committed as revision 129898.
Cheers,
Manuel.
[-- Attachment #2: pointer-integer-comparison.diff --]
[-- Type: text/plain, Size: 2685 bytes --]
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (revision 129897)
+++ gcc/testsuite/ChangeLog (revision 129898)
@@ -1,3 +1,7 @@
+2007-11-05 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ * g++dg/warn/pointer-integer-comparison.C: New.
+
2007-11-05 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/33856
Index: gcc/testsuite/g++.dg/warn/pointer-integer-comparison.C
===================================================================
--- gcc/testsuite/g++.dg/warn/pointer-integer-comparison.C (revision 0)
+++ gcc/testsuite/g++.dg/warn/pointer-integer-comparison.C (revision 129898)
@@ -0,0 +1,26 @@
+// { dg-do compile }
+// { dg-options "-fsyntax-only -fpermissive" }
+
+int foo (int i, void *p)
+{
+ if (i == p) // { dg-warning "warning: ISO C.. forbids comparison between pointer and integer" }
+ return 0;
+ else if (i != p) // { dg-warning "warning: ISO C.. forbids comparison between pointer and integer" }
+ return 1;
+}
+
+int bar (int i, void *p)
+{
+ if (i < p) // { dg-warning "warning: ISO C.. forbids comparison between pointer and integer" }
+ return 0;
+ else if (i >= p) // { dg-warning "warning: ISO C.. forbids comparison between pointer and integer" }
+ return 1;
+}
+
+int baz (int i, void *p)
+{
+ if (i <= p) // { dg-warning "warning: ISO C.. forbids comparison between pointer and integer" }
+ return 0;
+ else if (i > p) // { dg-warning "warning: ISO C.. forbids comparison between pointer and integer" }
+ return 1;
+}
Index: gcc/cp/typeck.c
===================================================================
--- gcc/cp/typeck.c (revision 129897)
+++ gcc/cp/typeck.c (revision 129898)
@@ -3357,12 +3357,12 @@
else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
{
result_type = type0;
- error ("ISO C++ forbids comparison between pointer and integer");
+ pedwarn ("ISO C++ forbids comparison between pointer and integer");
}
else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE)
{
result_type = type1;
- error ("ISO C++ forbids comparison between pointer and integer");
+ pedwarn ("ISO C++ forbids comparison between pointer and integer");
}
else if (TYPE_PTRMEMFUNC_P (type0) && null_ptr_cst_p (op1))
{
Index: gcc/cp/ChangeLog
===================================================================
--- gcc/cp/ChangeLog (revision 129897)
+++ gcc/cp/ChangeLog (revision 129898)
@@ -1,3 +1,8 @@
+2007-11-05 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ * typeck.c (build_binary_op): Use pedwarn instead of error for
+ consistency.
+
2007-11-05 Jakub Jelinek <jakub@redhat.com>
PR c++/33836
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-11-05 10:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-05 10:07 fix error/pedwarn inconsistency Manuel López-Ibáñez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).