typeck.c (build_unary_op): Only warn about incr/decr a pointer if pedantic || warn_po...
authorBrendan Kehoe <brendan@cygnus.com>
Thu, 19 Feb 1998 09:55:51 +0000 (09:55 +0000)
committerBrendan Kehoe <brendan@gcc.gnu.org>
Thu, 19 Feb 1998 09:55:51 +0000 (04:55 -0500)
* typeck.c (build_unary_op): Only warn about incr/decr a pointer
if pedantic || warn_pointer_arith.

From-SVN: r18118

gcc/cp/ChangeLog
gcc/cp/typeck.c

index 0c5fff0538c424bb27619b3f0b17a92f94562e3e..370d443d7b8fcb019e84007b251571f72d0fd63a 100644 (file)
@@ -1,3 +1,8 @@
+1998-02-19  Brendan Kehoe  <brendan@cygnus.com>
+
+       * typeck.c (build_unary_op): Only warn about incr/decr a pointer
+       if pedantic || warn_pointer_arith.
+
 Thu Feb 19 09:37:21 1998  Kriang Lerdsuwanakij  <lerdsuwa@scf.usc.edu>
 
        * pt.c (unify): Handle TEMPLATE_DECL.
index f1689a8688beb9e722151820c9b06f7285467f4f..851020f99af2130a0b556bd3be4d06ee6ff37c27 100644 (file)
@@ -4341,8 +4341,9 @@ build_unary_op (code, xarg, noconvert)
                        ((code == PREINCREMENT_EXPR
                          || code == POSTINCREMENT_EXPR)
                         ? "increment" : "decrement"), TREE_TYPE (argtype));
-           else if (tmp == FUNCTION_TYPE || tmp == METHOD_TYPE
-                    || tmp == VOID_TYPE || tmp == OFFSET_TYPE)
+           else if ((pedantic || warn_pointer_arith)
+                    && (tmp == FUNCTION_TYPE || tmp == METHOD_TYPE
+                        || tmp == VOID_TYPE || tmp == OFFSET_TYPE))
              cp_pedwarn ("ANSI C++ forbids %sing a pointer of type `%T'",
                          ((code == PREINCREMENT_EXPR
                            || code == POSTINCREMENT_EXPR)