From e62d5b583306f95fdc41d51d56349598e341d30b Mon Sep 17 00:00:00 2001 From: Brendan Kehoe Date: Thu, 19 Feb 1998 09:55:51 +0000 Subject: [PATCH] typeck.c (build_unary_op): Only warn about incr/decr a pointer if pedantic || warn_pointer_arith. * typeck.c (build_unary_op): Only warn about incr/decr a pointer if pedantic || warn_pointer_arith. From-SVN: r18118 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/typeck.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0c5fff0538c..370d443d7b8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +1998-02-19 Brendan Kehoe + + * 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 * pt.c (unify): Handle TEMPLATE_DECL. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index f1689a8688b..851020f99af 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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) -- 2.30.2