diff options
author | Neil Booth <neil@daikokuya.co.uk> | 2003-04-23 22:44:06 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2003-04-23 22:44:06 +0000 |
commit | 6338b35872d465cf27fdbbc43b5a146363c8f246 (patch) | |
tree | e4f819e101d1dc188ae9d2012e0cb8ab2239160d /gcc/cpplib.c | |
parent | 06f5e63748eeb66140858914bbffb149406789a9 (diff) | |
download | gcc-6338b35872d465cf27fdbbc43b5a146363c8f246.zip gcc-6338b35872d465cf27fdbbc43b5a146363c8f246.tar.gz gcc-6338b35872d465cf27fdbbc43b5a146363c8f246.tar.bz2 |
Makefile.in (c-lex.o, [...]): Update.
* Makefile.in (c-lex.o, LIBCPP_OBJS, cpplex.o): Update.
* c-lex.c (MULTIBYTE_CHARS): Remove conditionals.
(lex_string): Take cpp_string with full spelling.
(cb_ident): Update.
(c_lex): Update diagnostics.
* cpplex.c (SPELL_NUMBER, SPELL_STRING): Combine into SPELL_LITERAL.
(create_literal): New.
(lex_string): Unterminated literals have type CPP_OTHER.
(_cpp_lex_direct): Update calls to lex_string. Use create_literal
for CPP_OTHER.
(cpp_token_len, cpp_spell_token, cpp_output_token): Simplify.
(_cpp_equiv_tokens, cpp_interpret_charconst): Update.
* cpplib.c (parse_include, do_line, do_linemarker,
destringize_and_run): Update for token storing full spelling.
* cpplib.h: Update token spelling types.
* cppmacro.c (stringify_arg, check_trad_stringification):
Update for token storing full spelling.
cp:
* Make-lang.in (lex.o): Remove mbchar.h.
* lex.c (MULTIBYTE_CHARS): Lose.
* parser.c (cp_lexer_get_preprocessor_token): CPP_OTHER handled
in c-lex.c.
testsuite:
* gcc.dg/cpp/include2.c: Update.
* gcc.dg/cpp/multiline-2.c: New.
* gcc.dg/cpp/multiline.c: Update.
* gcc.dg/cpp/strify2.c: Update.
* gcc.dg/cpp/trad/literals-2.c: Update.
From-SVN: r66019
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r-- | gcc/cpplib.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c index 2829953..9b95ac9 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -627,9 +627,9 @@ parse_include (pfile, pangle_brackets) header = get_token_no_padding (pfile); if (header->type == CPP_STRING || header->type == CPP_HEADER_NAME) { - fname = xmalloc (header->val.str.len + 1); - memcpy (fname, header->val.str.text, header->val.str.len); - fname[header->val.str.len] = '\0'; + fname = xmalloc (header->val.str.len - 1); + memcpy (fname, header->val.str.text + 1, header->val.str.len - 2); + fname[header->val.str.len - 2] = '\0'; *pangle_brackets = header->type == CPP_HEADER_NAME; } else if (header->type == CPP_LESS) @@ -832,8 +832,8 @@ do_line (pfile) token = cpp_get_token (pfile); if (token->type == CPP_STRING) { - new_file = (const char *) dequote_string (pfile, token->val.str.text, - token->val.str.len); + new_file = (const char *) dequote_string (pfile, token->val.str.text + 1, + token->val.str.len - 2); check_eol (pfile); } else if (token->type != CPP_EOF) @@ -881,8 +881,8 @@ do_linemarker (pfile) token = cpp_get_token (pfile); if (token->type == CPP_STRING) { - new_file = (const char *) dequote_string (pfile, token->val.str.text, - token->val.str.len); + new_file = (const char *) dequote_string (pfile, token->val.str.text + 1, + token->val.str.len - 2); new_sysp = 0; flag = read_flag (pfile, 0); if (flag == 1) @@ -1369,8 +1369,10 @@ destringize_and_run (pfile, in) const unsigned char *src, *limit; char *dest, *result; - dest = result = alloca (in->len + 1); - for (src = in->text, limit = src + in->len; src < limit;) + dest = result = alloca (in->len - 1); + src = in->text + 1 + (in->text[0] == 'L'); + limit = in->text + in->len - 1; + while (src < limit) { /* We know there is a character following the backslash. */ if (*src == '\\' && (src[1] == '\\' || src[1] == '"')) |