diff options
author | Gabriel Dos Reis <gdr@nerim.net> | 2002-07-25 08:58:07 +0000 |
---|---|---|
committer | Gabriel Dos Reis <gdr@gcc.gnu.org> | 2002-07-25 08:58:07 +0000 |
commit | ea79391291786e58a29c963b6c407b71e55d5f34 (patch) | |
tree | e9d93010f8bf070bad0d387d2dd303dfd9b57502 /gcc/c-common.c | |
parent | ef6838b11c072f9a8b6be34f03e18bb24553f61e (diff) | |
download | gcc-ea79391291786e58a29c963b6c407b71e55d5f34.zip gcc-ea79391291786e58a29c963b6c407b71e55d5f34.tar.gz gcc-ea79391291786e58a29c963b6c407b71e55d5f34.tar.bz2 |
c-common.c (c_sizeof_or_alignof_type): Take a third argument for complaining.
* c-common.c (c_sizeof_or_alignof_type): Take a third argument for
complaining.
* c-common.h (c_sizeof): Adjust definition.
(c_alignof): Likewise.
* c-tree.h (c_sizeof_nowarn): Now macro.
* c-typeck.c (c_sizeof_nowarn): Remove definition.
cp/
* cp-tree.h (cxx_sizeof_nowarn): Now a macro.
(cxx_sizeof_or_alignof_type): Take a third argument.
(cxx_sizeof): Adjust definition.
(cxx_alignof): Likewise.
* init.c (build_delete): Use cxx_sizeof_nowarn to reflect reality.
* typeck.c (cxx_sizeof_or_alignof_type): Take a third argument for
complaining.
(c_sizeof_nowarn): Remove definition.
(build_unary_op): Use cxx_sizeof_nowarn.
From-SVN: r55744
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index d7be6c8..88c3ef5 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -2602,11 +2602,14 @@ c_common_get_alias_set (t) } /* Compute the value of 'sizeof (TYPE)' or '__alignof__ (TYPE)', where the - second parameter indicates which OPERATOR is being applied. */ + second parameter indicates which OPERATOR is being applied. The COMPLAIN + flag controls whether we should diagnose possibly ill-formed + constructs or not. */ tree -c_sizeof_or_alignof_type (type, op) +c_sizeof_or_alignof_type (type, op, complain) tree type; enum tree_code op; + int complain; { const char *op_name; tree value = NULL; @@ -2619,7 +2622,7 @@ c_sizeof_or_alignof_type (type, op) { if (op == SIZEOF_EXPR) { - if (pedantic || warn_pointer_arith) + if (complain && (pedantic || warn_pointer_arith)) pedwarn ("invalid application of `sizeof' to a function type"); value = size_one_node; } @@ -2628,13 +2631,15 @@ c_sizeof_or_alignof_type (type, op) } else if (type_code == VOID_TYPE || type_code == ERROR_MARK) { - if (type_code == VOID_TYPE && (pedantic || warn_pointer_arith)) + if (type_code == VOID_TYPE + && complain && (pedantic || warn_pointer_arith)) pedwarn ("invalid application of `%s' to a void type", op_name); value = size_one_node; } else if (!COMPLETE_TYPE_P (type)) { - error ("invalid application of `%s' to an incomplete type", op_name); + if (complain) + error ("invalid application of `%s' to an incomplete type", op_name); value = size_zero_node; } else |