aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-lex.c
diff options
context:
space:
mode:
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>2005-12-22 12:01:44 +0000
committerVolker Reichelt <reichelt@gcc.gnu.org>2005-12-22 12:01:44 +0000
commitab84748af1b9eb158f6a2cb0d2f8be97f196a5f2 (patch)
treeb94f65ebd41d3c48ba009c669b5ad7aae0e5fc93 /gcc/c-lex.c
parent110eec241d7bc08f91573738b449bafbb52e3498 (diff)
downloadgcc-ab84748af1b9eb158f6a2cb0d2f8be97f196a5f2.zip
gcc-ab84748af1b9eb158f6a2cb0d2f8be97f196a5f2.tar.gz
gcc-ab84748af1b9eb158f6a2cb0d2f8be97f196a5f2.tar.bz2
re PR c++/23333 (accepts invalid pure specifier)
2005-12-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de> PR c++/23333 * include/cpplib.h: Add PURE_ZERO to flags for the cpp_token structure. * c-lex.c (c_lex_with_flags): Add PURE_ZERO to cpp_flags if number is a single digit '0'. * parser.c (cp_parser_pure_specifier): Check for PURE_ZERO to identify a single '0'. * g++.dg/parse/error25.C: Add more tests. From-SVN: r108947
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r--gcc/c-lex.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index e745388..af3695f 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -333,6 +333,7 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags)
static bool no_more_pch;
const cpp_token *tok;
enum cpp_ttype type;
+ unsigned char add_flags = 0;
timevar_push (TV_CPP);
retry:
@@ -366,6 +367,10 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags)
break;
case CPP_N_INTEGER:
+ /* C++ uses '0' to mark virtual functions as pure.
+ Set PURE_ZERO to pass this information to the C++ parser. */
+ if (tok->val.str.len == 1 && *tok->val.str.text == '0')
+ add_flags = PURE_ZERO;
*value = interpret_integer (tok, flags);
break;
@@ -472,7 +477,7 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags)
}
if (cpp_flags)
- *cpp_flags = tok->flags;
+ *cpp_flags = tok->flags | add_flags;
if (!no_more_pch)
{