diff options
author | Ian Lance Taylor <iant@google.com> | 2009-06-12 19:43:25 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2009-06-12 19:43:25 +0000 |
commit | 3d8b2a98ca3c4d46030c839ad89ed7f3800a9fbf (patch) | |
tree | b9bfc85db3cdd44094798b79ced86e5d51c66281 /libcpp/lex.c | |
parent | 737142ced7510afcd0144c866d9169ac7cbf3fb6 (diff) | |
download | gcc-3d8b2a98ca3c4d46030c839ad89ed7f3800a9fbf.zip gcc-3d8b2a98ca3c4d46030c839ad89ed7f3800a9fbf.tar.gz gcc-3d8b2a98ca3c4d46030c839ad89ed7f3800a9fbf.tar.bz2 |
cpplib.h (struct cpp_options): Add warn_cxx_operator_names field.
libcpp/:
* include/cpplib.h (struct cpp_options): Add
warn_cxx_operator_names field.
(NODE_WARN_OPERATOR): Define.
(struct cpp_hashnode): Increase flags field to 10 bits, decrease
type to 6 bits.
* init.c (mark_named_operators): Add flags parameter.
(cpp_post_options): Pick flags value to pass to
mark_named_operators.
* lex.c (lex_identifier): If NODE_WARN_OPERATOR is set, warn that
identifier is an operator name in C++.
gcc/:
* fold-const.c (fold_unary): Rename local variable and to
and_expr.
* c-opts.c (c_common_handle_option): For -Wc++-compat set
cpp_opts->warn_cxx_operator_names.
gcc/testsuite/:
* gcc.dg/Wcxx-compat-13.c: New testcase.
From-SVN: r148438
Diffstat (limited to 'libcpp/lex.c')
-rw-r--r-- | libcpp/lex.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libcpp/lex.c b/libcpp/lex.c index ca2f2ca..bab14a4 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -560,6 +560,12 @@ lex_identifier (cpp_reader *pfile, const uchar *base, bool starts_ucn, cpp_error (pfile, CPP_DL_PEDWARN, "__VA_ARGS__ can only appear in the expansion" " of a C99 variadic macro"); + + /* For -Wc++-compat, warn about use of C++ named operators. */ + if (result->flags & NODE_WARN_OPERATOR) + cpp_error (pfile, CPP_DL_WARNING, + "identifier \"%s\" is a special operator name in C++", + NODE_NAME (result)); } return result; |