diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-24 22:53:12 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-24 22:53:12 +0000 |
commit | f9b5f7426b95ed5809c2ef8257b962306844f87b (patch) | |
tree | f2b5dd04bb961bbe8dac8d988d52d574f0cb2b47 /gcc/c-lex.c | |
parent | 0be2ebc785cd4b366423534d0bfdce0499483e80 (diff) | |
download | gcc-f9b5f7426b95ed5809c2ef8257b962306844f87b.tar.gz |
* c-lex.c (cb_def_pragma): Update.
(c_lex): Update, and skip padding.
* cppexp.c (lex, parse_defined): Update, remove unused variable.
* cpphash.h (struct toklist): Delete.
(union utoken): New.
(struct cpp_context): Update.
(struct cpp_reader): New members eof, avoid_paste.
(_cpp_temp_token): New.
* cppinit.c (cpp_create_reader): Update.
* cpplex.c (_cpp_temp_token): New.
(_cpp_lex_direct): Add PREV_WHITE when parsing args.
(cpp_output_token): Don't print leading whitespace.
(cpp_output_line): Update.
* cpplib.c (glue_header_name, parse_include, get__Pragma_string,
do_include_common, do_line, do_ident, do_pragma,
do_pragma_dependency, _cpp_do__Pragma, parse_answer,
parse_assertion): Update.
(get_token_no_padding): New.
* cpplib.h (CPP_PADDING): New.
(AVOID_LPASTE): Delete.
(struct cpp_token): New union member source.
(cpp_get_token): Update.
* cppmacro.c (macro_arg): Convert to use pointers to const tokens.
(builtin_macro, paste_all_tokens, paste_tokens, funlike_invocation_p,
replace_args, quote_string, stringify_arg, parse_arg, next_context,
enter_macro_context, expand_arg, _cpp_pop_context, cpp_scan_nooutput,
_cpp_backup_tokens, _cpp_create_definition): Update.
(push_arg_context): Delete.
(padding_token, push_token_context, push_ptoken_context): New.
(make_string_token, make_number_token): Update, rename.
(cpp_get_token): Update to handle tokens as pointers to const,
and insert padding appropriately.
* cppmain.c (struct printer): New member prev.
(check_multiline_token): Constify.
(do_preprocessing, cb_line_change): Update.
(scan_translation_unit): Update to handle spacing.
* scan-decls.c (get_a_token): New.
(skip_to_closing_brace, scan_decls): Update.
* fix-header.c (read_scan_file): Update.
* doc/cpp.texi: Update.
* gcc.dg/cpp/macro10.c: New test.
* gcc.dg/cpp/strify3.c: New test.
* gcc.dg/cpp/spacing1.c: Add tests.
* gcc.dg/cpp/19990703-1.c: Remove bogus test.
* gcc.dg/cpp/20000625-2.c: Fudge to pass.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45793 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r-- | gcc/c-lex.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 3a80a74a550..8e6582f06db 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -335,13 +335,13 @@ cb_def_pragma (pfile, line) if (warn_unknown_pragmas > in_system_header) { const unsigned char *space, *name = 0; - cpp_token s; + const cpp_token *s; - cpp_get_token (pfile, &s); - space = cpp_token_as_text (pfile, &s); - cpp_get_token (pfile, &s); - if (s.type == CPP_NAME) - name = cpp_token_as_text (pfile, &s); + s = cpp_get_token (pfile); + space = cpp_token_as_text (pfile, s); + s = cpp_get_token (pfile); + if (s->type == CPP_NAME) + name = cpp_token_as_text (pfile, s); lineno = SOURCE_LINE (map, line); if (name) @@ -767,12 +767,13 @@ int c_lex (value) tree *value; { - cpp_token tok; - enum cpp_ttype type; + const cpp_token *tok; retry: timevar_push (TV_CPP); - cpp_get_token (parse_in, &tok); + do + tok = cpp_get_token (parse_in); + while (tok->type == CPP_PADDING); timevar_pop (TV_CPP); /* The C++ front end does horrible things with the current line @@ -781,37 +782,36 @@ c_lex (value) lineno = src_lineno; *value = NULL_TREE; - type = tok.type; - switch (type) + switch (tok->type) { case CPP_OPEN_BRACE: indent_level++; break; case CPP_CLOSE_BRACE: indent_level--; break; - /* Issue this error here, where we can get at tok.val.c. */ + /* Issue this error here, where we can get at tok->val.c. */ case CPP_OTHER: - if (ISGRAPH (tok.val.c)) - error ("stray '%c' in program", tok.val.c); + if (ISGRAPH (tok->val.c)) + error ("stray '%c' in program", tok->val.c); else - error ("stray '\\%o' in program", tok.val.c); + error ("stray '\\%o' in program", tok->val.c); goto retry; case CPP_NAME: - *value = HT_IDENT_TO_GCC_IDENT (HT_NODE (tok.val.node)); + *value = HT_IDENT_TO_GCC_IDENT (HT_NODE (tok->val.node)); break; case CPP_NUMBER: - *value = lex_number ((const char *)tok.val.str.text, tok.val.str.len); + *value = lex_number ((const char *)tok->val.str.text, tok->val.str.len); break; case CPP_CHAR: case CPP_WCHAR: - *value = lex_charconst (&tok); + *value = lex_charconst (tok); break; case CPP_STRING: case CPP_WSTRING: - *value = lex_string ((const char *)tok.val.str.text, - tok.val.str.len, tok.type == CPP_WSTRING); + *value = lex_string ((const char *)tok->val.str.text, + tok->val.str.len, tok->type == CPP_WSTRING); break; /* These tokens should not be visible outside cpplib. */ @@ -823,7 +823,7 @@ c_lex (value) default: break; } - return type; + return tok->type; } #define ERROR(msgid) do { error(msgid); goto syntax_error; } while(0) |