From 5621a3645f8d24e20cb362058f3dc24c5bccff94 Mon Sep 17 00:00:00 2001 From: neil Date: Fri, 14 Sep 2001 22:04:46 +0000 Subject: * cpperror.c (print_location): Take line and column, for default positioning use the previously lexed token. (_cpp_begin_message): Take line and column. (cpp_ice, cpp_fatal, cpp_error, cpp_error_with_line, cpp_warning, cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line): Update. * cpphash.h (_cpp_begin_message): Update prototype. * cppinit.c (push_include): Don't set output line. * cpplex.c (_cpp_lex_token): Callback for start of new output lines. * cpplib.c (do_diagnostic, _cpp_pop_buffer): Update. (do_pragma): Kludge for front ends. Don't expand macros at all. * cpplib.h (cpp_lookahead, cpp_token_with_pos, cpp_get_line): Remove. (struct cpp_token): Remove output_line. (struct cpp_callbacks): New member line_change. * cppmacro.c (builtin_macro, paste_all_tokens, replace_args, cpp_get_token): Preserve BOL flag. (cpp_get_line): Remove. (_cpp_backup_tokens): Remove useless abort(). * cppmain.c (cb_line_change): New. (scan_translation_unit): Don't worry about starting new lines here. * scan-decls.c (scan_decls): Update. * c-lex.c (c_lex, init_c_lex): Update. (cb_line_change, src_lineno): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45613 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cpplib.h | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'gcc/cpplib.h') diff --git a/gcc/cpplib.h b/gcc/cpplib.h index ef6a1a56b01..77199956765 100644 --- a/gcc/cpplib.h +++ b/gcc/cpplib.h @@ -42,7 +42,6 @@ typedef struct cpp_string cpp_string; typedef struct cpp_hashnode cpp_hashnode; typedef struct cpp_macro cpp_macro; typedef struct cpp_lexer_pos cpp_lexer_pos; -typedef struct cpp_lookahead cpp_lookahead; typedef struct cpp_callbacks cpp_callbacks; struct answer; @@ -191,26 +190,9 @@ struct cpp_token struct cpp_lexer_pos { unsigned int line; - unsigned int output_line; unsigned short col; }; -typedef struct cpp_token_with_pos cpp_token_with_pos; -struct cpp_token_with_pos -{ - cpp_token token; - cpp_lexer_pos pos; -}; - -/* Token lookahead. */ -struct cpp_lookahead -{ - struct cpp_lookahead *next; - cpp_token_with_pos *tokens; - cpp_lexer_pos pos; - unsigned int cur, count, cap; -}; - /* A standalone character. We may want to make it unsigned for the same reason we use unsigned char - to avoid signedness issues. */ typedef int cppchar_t; @@ -390,13 +372,15 @@ struct cpp_options /* Call backs. */ struct cpp_callbacks { - void (*file_change) PARAMS ((cpp_reader *, const struct line_map *)); - void (*include) PARAMS ((cpp_reader *, unsigned int, - const unsigned char *, const cpp_token *)); - void (*define) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *)); - void (*undef) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *)); - void (*ident) PARAMS ((cpp_reader *, unsigned int, const cpp_string *)); - void (*def_pragma) PARAMS ((cpp_reader *, unsigned int)); + /* Called when a new line of preprocessed output is started. */ + void (*line_change) PARAMS ((cpp_reader *, const cpp_token *, int)); + void (*file_change) PARAMS ((cpp_reader *, const struct line_map *)); + void (*include) PARAMS ((cpp_reader *, unsigned int, + const unsigned char *, const cpp_token *)); + void (*define) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *)); + void (*undef) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *)); + void (*ident) PARAMS ((cpp_reader *, unsigned int, const cpp_string *)); + void (*def_pragma) PARAMS ((cpp_reader *, unsigned int)); }; #define CPP_FATAL_LIMIT 1000 @@ -522,7 +506,6 @@ extern int cpp_avoid_paste PARAMS ((cpp_reader *, const cpp_token *, extern enum cpp_ttype cpp_can_paste PARAMS ((cpp_reader *, const cpp_token *, const cpp_token *, int *)); extern void cpp_get_token PARAMS ((cpp_reader *, cpp_token *)); -extern const cpp_lexer_pos *cpp_get_line PARAMS ((cpp_reader *)); extern const unsigned char *cpp_macro_definition PARAMS ((cpp_reader *, const cpp_hashnode *)); extern void _cpp_backup_tokens PARAMS ((cpp_reader *, unsigned int)); -- cgit v1.2.3