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/cppmain.c | |
parent | 15155f829e7ddc1a5dd4a45cecdcf9d173c74380 (diff) | |
download | ppe42-gcc-d7503801e5662ff8d132df1e21bdfcbeaa3a5174.tar.gz ppe42-gcc-d7503801e5662ff8d132df1e21bdfcbeaa3a5174.zip |
* 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/cppmain.c')
-rw-r--r-- | gcc/cppmain.c | 67 |
1 files changed, 26 insertions, 41 deletions
diff --git a/gcc/cppmain.c b/gcc/cppmain.c index 4e096c4abf9..7a597fbbaaf 100644 --- a/gcc/cppmain.c +++ b/gcc/cppmain.c @@ -46,7 +46,6 @@ static int dump_macro PARAMS ((cpp_reader *, cpp_hashnode *, void *)); static void print_line PARAMS ((const char *)); static void maybe_print_line PARAMS ((unsigned int)); -static void move_printer PARAMS ((cpp_reader *, unsigned int, const char *)); /* Callback routines for the parser. Most of these are active only in specific modes. */ @@ -55,9 +54,7 @@ static void cb_undef PARAMS ((cpp_reader *, cpp_hashnode *)); static void cb_include PARAMS ((cpp_reader *, const unsigned char *, const cpp_token *)); static void cb_ident PARAMS ((cpp_reader *, const cpp_string *)); -static void cb_enter_file PARAMS ((cpp_reader *)); -static void cb_leave_file PARAMS ((cpp_reader *)); -static void cb_rename_file PARAMS ((cpp_reader *)); +static void cb_change_file PARAMS ((cpp_reader *, const cpp_file_change *)); static void cb_def_pragma PARAMS ((cpp_reader *)); static void do_pragma_implementation PARAMS ((cpp_reader *)); @@ -108,11 +105,7 @@ main (argc, argv) pfile->cb.ident = cb_ident; pfile->cb.def_pragma = cb_def_pragma; if (! CPP_OPTION (pfile, no_line_commands)) - { - pfile->cb.enter_file = cb_enter_file; - pfile->cb.leave_file = cb_leave_file; - pfile->cb.rename_file = cb_rename_file; - } + pfile->cb.change_file = cb_change_file; } if (CPP_OPTION (pfile, dump_includes)) @@ -285,18 +278,6 @@ print_line (special_flags) print.lineno, print.last_fname, special_flags, print.syshdr_flags); } -static void -move_printer (pfile, line, special_flags) - cpp_reader *pfile; - unsigned int line; - const char *special_flags; -{ - print.lineno = line; - print.last_fname = pfile->buffer->nominal_fname; - print.syshdr_flags = cpp_syshdr_flags (pfile, pfile->buffer); - print_line (special_flags); -} - /* Callbacks */ static void @@ -354,29 +335,33 @@ cb_include (pfile, dir, header) } static void -cb_enter_file (pfile) - cpp_reader *pfile; +cb_change_file (pfile, fc) + cpp_reader *pfile ATTRIBUTE_UNUSED; + const cpp_file_change *fc; { - /* Bring current file to correct line (except main file). FIXME: we - may be using the same buffer via a # NUMBER "file" 1 directive. */ - if (pfile->done_initializing && pfile->buffer->prev) - maybe_print_line (pfile->buffer->prev->lineno); - - move_printer (pfile, 1, pfile->done_initializing ? " 1": ""); -} + const char *flags; + + /* Bring current file to correct line (except first file). */ + if (fc->reason == FC_ENTER && fc->from.filename) + maybe_print_line (fc->from.lineno); + + print.lineno = fc->to.lineno; + print.last_fname = fc->to.filename; + if (fc->externc) + print.syshdr_flags = " 3 4"; + else if (fc->sysp) + print.syshdr_flags = " 3"; + else + print.syshdr_flags = ""; -static void -cb_leave_file (pfile) - cpp_reader *pfile; -{ - move_printer (pfile, pfile->buffer->lineno + 1, " 2"); -} + switch (fc->reason) + { + case FC_ENTER : flags = fc->from.filename ? " 1": ""; break; + case FC_LEAVE : flags = " 2"; break; + case FC_RENAME: flags = ""; break; + } -static void -cb_rename_file (pfile) - cpp_reader *pfile; -{ - move_printer (pfile, pfile->buffer->lineno + 1, ""); + print_line (flags); } static void |