aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-lex.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2004-02-05 06:52:26 +0000
committerPer Bothner <per@bothner.com>2004-02-05 06:52:26 +0000
commitd7127d0f12c26914ebcab5a2648c354529b60ac1 (patch)
treea8cb79fee4ffa92207a17795cfa3750745b8d001 /gcc/c-lex.c
parent4bb64cb76650a2d5dcd4329cd42708f5ba08cd21 (diff)
Partially revert/redo 2003-10-01 change; fix -fworking-directory.
* c-ppoutput.c (pp_dir_change): New function. * c-common.h (pp_dir_change): New declaration. * cpplib.h (struct cpp_options): Remove working_directory field. * cppinit.c (cpp_find_main_file, cpp_push_main_file): Merge back to (cpp_read_main_file): as before 10-01. Call _cpp_stack_file. Don't handle -fworking_directory here, but in c_common_post_options. (read_original_directory): Don't back up when done. Don't clear no-longer used working_directory flag. * cpplib.h: Update declarations to match. * c-lex.c (cb_dir_change): Move to c-opts.c. (init_c_lex): Don't set dir_change callback here, since we want to set it even if flag_preprocess_only. * c-opts.c (cb_dir_change): Function moved from c-lex.c. (c_common_post_options): Set dir_change callback. Call pp_dir_change if approporiate. (finish_options): Don't call cpp_find_main_file here. Hence remove unneeded parameter and result. Do LC_RENAME for <built-in>. (c_common_post_options): Call cpp_read_main_file here instead. (c_common_init): Update accordingly. (push_command_line_include): Don't cpp_push_main_file. Do LC_RENAME rather than LC_LEASE to get back to main file. Compared to pre-10-01 version, inline cpp_rename_to_main_file. (c_common_parse_file): Call cpp_read_main_file for subsequent main files, but call finish_options for all files. * c-opts.c (sanitize_cpp_opts): Don't set cpp_opts->working_directory. * fix-header.c (read_scan_file): Call cpp_read_main_file instead of cpp_find_main_file + cpp_push_main_file. * c-lex.c (fe_file_change): Don't set main_input_filename here. * opts.c (handle_options): Only set main_input_filename first time. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@77303 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r--gcc/c-lex.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 64471259e43..aba571fab9a 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -69,7 +69,6 @@ static tree lex_charconst (const cpp_token *);
static void update_header_times (const char *);
static int dump_one_header (splay_tree_node, void *);
static void cb_line_change (cpp_reader *, const cpp_token *, int);
-static void cb_dir_change (cpp_reader *, const char *);
static void cb_ident (cpp_reader *, unsigned int, const cpp_string *);
static void cb_def_pragma (cpp_reader *, unsigned int);
static void cb_define (cpp_reader *, unsigned int, cpp_hashnode *);
@@ -96,7 +95,6 @@ init_c_lex (void)
cb = cpp_get_callbacks (parse_in);
cb->line_change = cb_line_change;
- cb->dir_change = cb_dir_change;
cb->ident = cb_ident;
cb->def_pragma = cb_def_pragma;
cb->valid_pch = c_common_valid_pch;
@@ -202,13 +200,6 @@ cb_line_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const cpp_token *token,
input_line = SOURCE_LINE (map, token->line);
}
-static void
-cb_dir_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const char *dir)
-{
- if (! set_src_pwd (dir))
- warning ("too late for # directive to set debug directory");
-}
-
void
fe_file_change (const struct line_map *new_map)
{
@@ -222,9 +213,7 @@ fe_file_change (const struct line_map *new_map)
{
/* Don't stack the main buffer on the input stack;
we already did in compile_file. */
- if (map == NULL)
- main_input_filename = new_map->to_file;
- else
+ if (map != NULL)
{
int included_at = SOURCE_LINE (new_map - 1, new_map->from_line - 1);