diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-22 15:32:18 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-22 15:32:18 +0000 |
commit | ba99525e53848ffd9a25a0c737cbbefcb3f5d436 (patch) | |
tree | 51e37b610f5f0eae957aa2a3cee06eec9ab65abb /libcpp/init.c | |
parent | a7dc303d1c471cb8a4e708eff7f78bc93a597b3c (diff) | |
download | gcc-ba99525e53848ffd9a25a0c737cbbefcb3f5d436.tar.gz |
2009-04-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/14875
* c-common.c (c_parse_error): Take a token_flags parameter.
Use token_type for the token type instead.
Pass token_flags to cpp_type2name.
* c-common.h (c_parse_error): Update declaration.
* c-parser.c (c_parser_error): Pass 0 as token flags.
libcpp/
* lex.c (cpp_type2name): Take a flags parameter. Call
cpp_named_operator2name for named operators and cpp_digraph2name
for digraphs.
(cpp_digraph2name): New.
(cpp_spell_token): Use it.
(cpp_output_token): Likewise.
* include/cpplib.h (cpp_type2name): Update declaration.
* init.c (cpp_named_operator2name): New.
* internal.h (cpp_named_operator2name): Declare.
cp/
* parser.c (cp_parser_error): Pass token->flags to c_parse_error.
testsuite/
* g++.dg/parse/parser-pr14875.C: New.
* g++.dg/parse/parser-pr14875-2.C: New.
* g++.dg/parse/error6.C: Update match string.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146589 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/init.c')
-rw-r--r-- | libcpp/init.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libcpp/init.c b/libcpp/init.c index c21121707d3..aef39981792 100644 --- a/libcpp/init.c +++ b/libcpp/init.c @@ -381,6 +381,24 @@ mark_named_operators (cpp_reader *pfile) } } +/* Helper function of cpp_type2name. Return the string associated with + named operator TYPE. */ +const char * +cpp_named_operator2name (enum cpp_ttype type) +{ + const struct builtin_operator *b; + + for (b = operator_array; + b < (operator_array + ARRAY_SIZE (operator_array)); + b++) + { + if (type == b->value) + return (const char *) b->name; + } + + return NULL; +} + void cpp_init_special_builtins (cpp_reader *pfile) { |