diff options
author | Brendan Kehoe <brendan@cygnus.com> | 1998-02-19 09:55:51 +0000 |
---|---|---|
committer | Brendan Kehoe <brendan@gcc.gnu.org> | 1998-02-19 04:55:51 -0500 |
commit | e62d5b583306f95fdc41d51d56349598e341d30b (patch) | |
tree | d13425e0f4e525a9c09052a36ecd523cb4223104 | |
parent | 027905b46a074fd0443a6e529f92cbf198ba77b3 (diff) | |
download | gcc-e62d5b583306f95fdc41d51d56349598e341d30b.zip gcc-e62d5b583306f95fdc41d51d56349598e341d30b.tar.gz gcc-e62d5b583306f95fdc41d51d56349598e341d30b.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0c5fff0..370d443 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index f1689a8..851020f 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) |