diff options
author | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-02 07:25:03 +0000 |
---|---|---|
committer | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-02 07:25:03 +0000 |
commit | e2df3e75379da18409c584c2efb2064c282330de (patch) | |
tree | 84e0eefb07ad753e3c78543a164d0520082734c3 /gcc/c-opts.c | |
parent | 643868343396410b69fabc608598ef263a8f0b64 (diff) | |
download | gcc-e2df3e75379da18409c584c2efb2064c282330de.tar.gz |
* c-opts.c (c_common_post_options): Don't call cpp_find_main_file yet.
(c_common_parse_file): No longer need to call cpp_read_main_file
when file_index > 0 (as in multi-file or server compiation).
(finish_options): Change to <built-in> is an LC_ENTER, not LC_RENAME
as this now happens before cpp_push_main_file.
(push_command_line_include): When done with options, pass LC_LEAVE
instead of LC_RENAME to cpp_change_file and finally cpp_push_main_file.
(fe_file_change): Handle NULL new_map, and simplify.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72015 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r-- | gcc/c-opts.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 7763702262a..b15f31ce78e 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -1060,7 +1060,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) /* Post-switch processing. */ bool -c_common_post_options (const char **pfilename) +c_common_post_options (const char **pfilename ATTRIBUTE_UNUSED) { /* Canonicalize the input and output filenames. */ if (in_fnames == NULL) @@ -1152,9 +1152,6 @@ c_common_post_options (const char **pfilename) cpp_get_callbacks (parse_in)->file_change = cb_file_change; cpp_post_options (parse_in); - /* NOTE: we use in_fname here, not the one supplied. */ - *pfilename = cpp_read_main_file (parse_in, in_fnames[0]); - saved_lineno = input_line; input_line = 0; @@ -1221,7 +1218,6 @@ c_common_parse_file (int set_yydebug ATTRIBUTE_UNUSED) /* Reset cpplib's macros and start a new file. */ cpp_undef_all (parse_in); - cpp_read_main_file (parse_in, in_fnames[file_index]); } finish_options(in_fnames[file_index]); @@ -1399,7 +1395,7 @@ finish_options (const char *tif) { size_t i; - cpp_change_file (parse_in, LC_RENAME, _("<built-in>")); + cpp_change_file (parse_in, LC_ENTER, _("<built-in>")); cpp_init_builtins (parse_in, flag_hosted); c_cpp_builtins (parse_in); @@ -1445,6 +1441,7 @@ finish_options (const char *tif) include_cursor = 0; this_input_filename = tif; + cpp_find_main_file (parse_in, this_input_filename); push_command_line_include (); } @@ -1452,24 +1449,24 @@ finish_options (const char *tif) static void push_command_line_include (void) { - if (cpp_opts->preprocessed) - return; - while (include_cursor < deferred_count) { struct deferred_opt *opt = &deferred_opts[include_cursor++]; - if (opt->code == OPT_include && cpp_push_include (parse_in, opt->arg)) + if (! cpp_opts->preprocessed && opt->code == OPT_include + && cpp_push_include (parse_in, opt->arg)) return; } if (include_cursor == deferred_count) { + include_cursor++; /* Restore the line map from <command line>. */ - cpp_change_file (parse_in, LC_RENAME, this_input_filename); + if (! cpp_opts->preprocessed) + cpp_change_file (parse_in, LC_LEAVE, NULL); /* -Wunused-macros should only warn about macros defined hereafter. */ cpp_opts->warn_unused_macros = warn_unused_macros; - include_cursor++; + cpp_push_main_file (parse_in); } } @@ -1483,7 +1480,7 @@ cb_file_change (cpp_reader *pfile ATTRIBUTE_UNUSED, else fe_file_change (new_map); - if (new_map->reason == LC_LEAVE && MAIN_FILE_P (new_map)) + if (new_map == 0 || (new_map->reason == LC_LEAVE && MAIN_FILE_P (new_map))) push_command_line_include (); } |