aboutsummaryrefslogtreecommitdiff
path: root/libcpp/include/cpplib.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2009-06-12 19:43:25 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2009-06-12 19:43:25 +0000
commit3d8b2a98ca3c4d46030c839ad89ed7f3800a9fbf (patch)
treeb9bfc85db3cdd44094798b79ced86e5d51c66281 /libcpp/include/cpplib.h
parent737142ced7510afcd0144c866d9169ac7cbf3fb6 (diff)
downloadgcc-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/include/cpplib.h')
-rw-r--r--libcpp/include/cpplib.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index effe9a0..a91f155 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -397,6 +397,9 @@ struct cpp_options
/* Nonzero means handle C++ alternate operator names. */
unsigned char operator_names;
+ /* Nonzero means warn about use of C++ alternate operator names. */
+ unsigned char warn_cxx_operator_names;
+
/* True for traditional preprocessing. */
unsigned char traditional;
@@ -555,7 +558,8 @@ extern const char *progname;
identifier that behaves like an operator such as "xor".
NODE_DIAGNOSTIC is for speed in lex_token: it indicates a
diagnostic may be required for this node. Currently this only
- applies to __VA_ARGS__ and poisoned identifiers. */
+ applies to __VA_ARGS__, poisoned identifiers, and -Wc++-compat
+ warnings about NODE_OPERATOR. */
/* Hash node flags. */
#define NODE_OPERATOR (1 << 0) /* C++ named operator. */
@@ -567,6 +571,7 @@ extern const char *progname;
#define NODE_MACRO_ARG (1 << 6) /* Used during #define processing. */
#define NODE_USED (1 << 7) /* Dumped with -dU. */
#define NODE_CONDITIONAL (1 << 8) /* Conditional macro */
+#define NODE_WARN_OPERATOR (1 << 9) /* Warn about C++ named operator. */
/* Different flavors of hash node. */
enum node_type
@@ -636,8 +641,8 @@ struct GTY(()) cpp_hashnode {
then index into directive table.
Otherwise, a NODE_OPERATOR. */
unsigned char rid_code; /* Rid code - for front ends. */
- ENUM_BITFIELD(node_type) type : 7; /* CPP node type. */
- unsigned int flags : 9; /* CPP flags. */
+ ENUM_BITFIELD(node_type) type : 6; /* CPP node type. */
+ unsigned int flags : 10; /* CPP flags. */
union _cpp_hashnode_value GTY ((desc ("CPP_HASHNODE_VALUE_IDX (%1)"))) value;
};