diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-02 23:03:31 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-02 23:03:31 +0000 |
commit | 386924596ca616f5ccd2725191d07828c8c6652f (patch) | |
tree | aedb0e3e4381261de71d4d7cee777f2ccde7880d /gcc/cppmain.c | |
parent | 5aea2c55a9ec5db0a3159aa12ba14f0795b32bc1 (diff) | |
download | gcc-386924596ca616f5ccd2725191d07828c8c6652f.tar.gz |
* line-map.c: New.
* line-map.h: New.
* Makefile.in (line-map.o): New.
(LIBCPP_OBJS, LIBCPP_DEPS): Update.
* c-lex.c (cb_file_change): Update for new cpp_file_change structure.
* cpperror.c (print_containing_files): Similarly.
(print_location): Update. Don't output a space before _Pragma.
* cppfiles.c (stack_include_file): Set to line 1 immediately.
(stack_include_filee, cpp_make_system_header): Update.
(_cpp_execute_include): Get logical line number right for calling
as-yet-unterminated #include.
* cpphash.h (struct cpp_reader): Add line_maps.
(_cpp_do_file_change): Update.
* cppinit.c (cpp_create_reader): Initialize line maps.
(cpp_destroy): Destroy line maps.
(cpp_start_read): Get logical line number right.
* cpplex.c (parse_string): Only warn once for multi-line strings.
Use boolean variable for null warning.
* cpplib.c (_cpp_handle_directive): End the directive if it isn't
already.
(do_include_common): End the directive early.
(do_line): Don't warn about out-of-range lines in preprocessed
source. Update. Remove unused variables.
(_cpp_do_file_change): Update for new line mapping.
(pragma_cb): New typedef.
(cpp_register_pragma): Stop looking ahead before calling the
handler. Clean up.
(do_pragma_system_header): End directive early.
(cpp_get_line_maps): New.
(cpp_pop_buffer): Fudge logical line. Update.
* cpplib.h: Include line-map.h
(enum cpp_fc_reason): Remove.
(struct cpp_file_change): Update.
(cpp_get_line_maps): New.
* cppmain.c (struct_printer): New member map.
(cb_file_change): Update for new mappings.
* fix-header.c (cb_file_change): Similarly.
testsuite:
* gcc.dg/cpp/19951025-1.c: Update.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44584 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cppmain.c')
-rw-r--r-- | gcc/cppmain.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/gcc/cppmain.c b/gcc/cppmain.c index 8f1982f5389..cc3b81d10bd 100644 --- a/gcc/cppmain.c +++ b/gcc/cppmain.c @@ -35,6 +35,7 @@ struct printer const char *syshdr_flags; /* system header flags, if any. */ unsigned int lineno; /* line currently being written. */ unsigned char printed; /* nonzero if something output at lineno. */ + struct line_map *map; /* logical to physical line mappings. */ }; int main PARAMS ((int, char **)); @@ -402,10 +403,11 @@ cb_file_change (pfile, fc) const cpp_file_change *fc; { /* Bring current file to correct line (except first file). */ - if (fc->reason == FC_ENTER && fc->from.filename) - maybe_print_line (fc->from.lineno); + if (fc->reason == LC_ENTER && !MAIN_FILE_P (fc->map)) + maybe_print_line (SOURCE_LINE (fc->map - 1, fc->line - 1)); - print.last_fname = fc->to.filename; + print.map = fc->map; + print.last_fname = fc->map->to_file; if (fc->externc) print.syshdr_flags = " 3 4"; else if (fc->sysp) @@ -417,10 +419,10 @@ cb_file_change (pfile, fc) { const char *flags = ""; - print.lineno = fc->to.lineno; - if (fc->reason == FC_ENTER) + print.lineno = SOURCE_LINE (fc->map, fc->line); + if (fc->reason == LC_ENTER) flags = " 1"; - else if (fc->reason == FC_LEAVE) + else if (fc->reason == LC_LEAVE) flags = " 2"; if (! options->no_line_commands) @@ -428,6 +430,8 @@ cb_file_change (pfile, fc) } } +/* Copy a #pragma directive to the preprocessed output. LINE is the + line of the current source file, not the logical line. */ static void cb_def_pragma (pfile) cpp_reader *pfile; |