diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-27 08:00:04 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-27 08:00:04 +0000 |
commit | d7503801e5662ff8d132df1e21bdfcbeaa3a5174 (patch) | |
tree | 6ecb94c4e9edb0c2004142e389531669ea20c416 /gcc/cpplib.h | |
parent | 15155f829e7ddc1a5dd4a45cecdcf9d173c74380 (diff) | |
download | gcc-d7503801e5662ff8d132df1e21bdfcbeaa3a5174.tar.gz |
* c-lex.c (cb_enter_file, cb_leave_file, cb_rename_file):
Combine into the new function cb_change_file.
(init_c_lex): Update.
* cppfiles.c (stack_include_file): Use _cpp_do_file_change.
(cpp_syshdr_flags): Delete.
* cpphash.h (_cpp_do_file_change): New prototype.
Move struct cpp_buffer here from...
* cpplib.h (struct cpp_buffer): ... here.
(enum cpp_fc_reason, struct cpp_file_loc,
struct_cpp_file_change, change_file): New.
(enter_file, leave_file, rename_file, cpp_syshdr_flags): Delete.
* cpplib.c (do_line): Update for new cb_change_file callback.
(_cpp_do_file_change): New function.
(_cpp_pop_buffer): Update to use it.
* cppmain.c (move_printer): Delete.
(main): Set up single callback cb_change_file.
(cb_enter_file, cb_leave_file, cb_rename_file): Delete.
(cb_change_file): New.
* fix-header.c (cur_file, cb_change_file): New.
(recognized_function, read_scan_file): Update.
* scan-decls.c (scan_decls): Update.
* scan.h (recognized_function): Update prototype.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37784 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplib.h')
-rw-r--r-- | gcc/cpplib.h | 76 |
1 files changed, 20 insertions, 56 deletions
diff --git a/gcc/cpplib.h b/gcc/cpplib.h index 4ad00461be5..18ad1cd29b2 100644 --- a/gcc/cpplib.h +++ b/gcc/cpplib.h @@ -249,58 +249,6 @@ struct cpp_context same reason we use unsigned char - to avoid signedness issues. */ typedef int cppchar_t; -struct cpp_buffer -{ - const unsigned char *cur; /* current position */ - const unsigned char *rlimit; /* end of valid data */ - const unsigned char *line_base; /* start of current line */ - cppchar_t read_ahead; /* read ahead character */ - cppchar_t extra_char; /* extra read-ahead for long tokens. */ - - struct cpp_reader *pfile; /* Owns this buffer. */ - struct cpp_buffer *prev; - - const unsigned char *buf; /* entire buffer */ - - /* Filename specified with #line command. */ - const char *nominal_fname; - - /* Actual directory of this file, used only for "" includes */ - struct file_name_list *actual_dir; - - /* Pointer into the include table. Used for include_next and - to record control macros. */ - struct include_file *inc; - - /* Value of if_stack at start of this file. - Used to prohibit unmatched #endif (etc) in an include file. */ - struct if_stack *if_stack; - - /* Token column position adjustment owing to tabs in whitespace. */ - unsigned int col_adjust; - - /* Line number at line_base (above). */ - unsigned int lineno; - - /* Because of the way the lexer works, -Wtrigraphs can sometimes - warn twice for the same trigraph. This helps prevent that. */ - const unsigned char *last_Wtrigraphs; - - /* True if we have already warned about C++ comments in this file. - The warning happens only for C89 extended mode with -pedantic on, - or for -Wtraditional, and only once per file (otherwise it would - be far too noisy). */ - unsigned char warned_cplusplus_comments; - - /* True if we don't process trigraphs and escaped newlines. True - for preprocessed input, command line directives, and _Pragma - buffers. */ - unsigned char from_stage3; - - /* Temporary storage for pfile->skipping whilst in a directive. */ - unsigned char was_skipping; -}; - /* Maximum nesting of cpp_buffers. We use a static limit, partly for efficiency, and partly to limit runaway recursion. */ #define CPP_STACK_MAX 200 @@ -523,6 +471,25 @@ struct spec_nodes cpp_hashnode *n__VA_ARGS__; /* C99 vararg macros */ }; +/* This structure is passed to the call back when changing file. */ +enum cpp_fc_reason {FC_ENTER = 0, FC_LEAVE, FC_RENAME}; + +struct cpp_file_loc +{ + const char *filename; + unsigned int lineno; +}; + +typedef struct cpp_file_change cpp_file_change; +struct cpp_file_change +{ + struct cpp_file_loc from; /* Line of #include or #line. */ + struct cpp_file_loc to; /* Line after #include or #line, or start. */ + enum cpp_fc_reason reason; /* Reason for change. */ + unsigned char sysp; /* Nonzero if system header. */ + unsigned char externc; /* Nonzero if wrapper needed. */ +}; + /* A cpp_reader encapsulates the "state" of a pre-processor run. Applying cpp_get_token repeatedly yields a stream of pre-processor tokens. Usually, there is only one cpp_reader object active. */ @@ -624,9 +591,7 @@ struct cpp_reader /* Call backs. */ struct { - void (*enter_file) PARAMS ((cpp_reader *)); - void (*leave_file) PARAMS ((cpp_reader *)); - void (*rename_file) PARAMS ((cpp_reader *)); + void (*change_file) PARAMS ((cpp_reader *, const cpp_file_change *)); void (*include) PARAMS ((cpp_reader *, const unsigned char *, const cpp_token *)); void (*define) PARAMS ((cpp_reader *, cpp_hashnode *)); @@ -826,7 +791,6 @@ extern void cpp_stop_lookahead PARAMS ((cpp_reader *, int)); extern int cpp_included PARAMS ((cpp_reader *, const char *)); extern int cpp_read_file PARAMS ((cpp_reader *, const char *)); extern void cpp_make_system_header PARAMS ((cpp_reader *, cpp_buffer *, int)); -extern const char *cpp_syshdr_flags PARAMS ((cpp_reader *, cpp_buffer *)); /* These are inline functions instead of macros so we can get type checking. */ |