mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 23:25:24 +02:00
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
This commit is contained in:
committed by
Ian Lance Taylor
parent
737142ced7
commit
3d8b2a98ca
@@ -28,7 +28,7 @@ along with this program; see the file COPYING3. If not see
|
||||
#include "localedir.h"
|
||||
|
||||
static void init_library (void);
|
||||
static void mark_named_operators (cpp_reader *);
|
||||
static void mark_named_operators (cpp_reader *, int);
|
||||
static void read_original_filename (cpp_reader *);
|
||||
static void read_original_directory (cpp_reader *);
|
||||
static void post_options (cpp_reader *);
|
||||
@@ -366,7 +366,7 @@ static const struct builtin_operator operator_array[] =
|
||||
|
||||
/* Mark the C++ named operators in the hash table. */
|
||||
static void
|
||||
mark_named_operators (cpp_reader *pfile)
|
||||
mark_named_operators (cpp_reader *pfile, int flags)
|
||||
{
|
||||
const struct builtin_operator *b;
|
||||
|
||||
@@ -375,7 +375,7 @@ mark_named_operators (cpp_reader *pfile)
|
||||
b++)
|
||||
{
|
||||
cpp_hashnode *hp = cpp_lookup (pfile, b->name, b->len);
|
||||
hp->flags |= NODE_OPERATOR;
|
||||
hp->flags |= flags;
|
||||
hp->is_directive = 0;
|
||||
hp->directive_index = b->value;
|
||||
}
|
||||
@@ -512,13 +512,20 @@ static void sanity_checks (cpp_reader *pfile)
|
||||
void
|
||||
cpp_post_options (cpp_reader *pfile)
|
||||
{
|
||||
int flags;
|
||||
|
||||
sanity_checks (pfile);
|
||||
|
||||
post_options (pfile);
|
||||
|
||||
/* Mark named operators before handling command line macros. */
|
||||
flags = 0;
|
||||
if (CPP_OPTION (pfile, cplusplus) && CPP_OPTION (pfile, operator_names))
|
||||
mark_named_operators (pfile);
|
||||
flags |= NODE_OPERATOR;
|
||||
if (CPP_OPTION (pfile, warn_cxx_operator_names))
|
||||
flags |= NODE_DIAGNOSTIC | NODE_WARN_OPERATOR;
|
||||
if (flags != 0)
|
||||
mark_named_operators (pfile, flags);
|
||||
}
|
||||
|
||||
/* Setup for processing input from the file named FNAME, or stdin if
|
||||
|
||||
Reference in New Issue
Block a user