This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix file names with IMI


My previous patch did prevent the errors coming out with
<command-line> but didn't actually produce the right filenames, which
also affected debugging.  This fixes it.

Bootstrapped & tested on powerpc-darwin, with --enable-intermodule.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-imisourcefile.patch===================
2003-07-17  Geoffrey Keating  <geoffk@apple.com>

	* c-opts.c (this_input_filename): New.
	(finish_options): Take new parameter, name of file being compiled.
	Update callers.  Set this_input_filename.
	(push_command_line_include): Use this_input_filename not
	main_input_filename.

Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.74
diff -u -p -u -p -r1.74 c-opts.c
--- c-opts.c	15 Jul 2003 05:48:15 -0000	1.74
+++ c-opts.c	17 Jul 2003 21:30:25 -0000
@@ -54,6 +55,7 @@ static cpp_options *cpp_opts;
 /* Input filename.  */
 static const char **in_fnames;
 static unsigned num_in_fnames;
+static const char *this_input_filename;
 
 /* Filename and stream for preprocessed output.  */
 static const char *out_fname;
@@ -109,7 +111,7 @@ static void sanitize_cpp_opts (void);
 static void add_prefixed_path (const char *, size_t);
 static void push_command_line_include (void);
 static void cb_file_change (cpp_reader *, const struct line_map *);
-static void finish_options (void);
+static void finish_options (const char *);
 
 #ifndef STDC_0_IN_SYSTEM_HEADERS
 #define STDC_0_IN_SYSTEM_HEADERS 0
@@ -1167,7 +1169,7 @@ c_common_init (void)
 
   if (flag_preprocess_only)
     {
-      finish_options ();
+      finish_options (in_fnames[0]);
       preprocess_file (parse_in);
       return false;
     }
@@ -1205,7 +1207,7 @@ c_common_parse_file (int set_yydebug ATT
 	  cpp_read_next_file (parse_in, in_fnames[file_index]);
 	}
 
-      finish_options();
+      finish_options(in_fnames[file_index]);
       if (file_index == 0)
 	pch_init();
       c_parse_file ();
@@ -1361,9 +1379,11 @@ add_prefixed_path (const char *suffix, s
   add_path (path, chain, 0);
 }
 
-/* Handle -D, -U, -A, -imacros, and the first -include.  */
+/* Handle -D, -U, -A, -imacros, and the first -include.  
+   TIF is the input file to which we will return after processing all
+   the includes.  */
 static void
-finish_options (void)
+finish_options (const char *tif)
 {
   if (!cpp_opts->preprocessed)
     {
@@ -1414,6 +1434,7 @@ finish_options (void)
     }
 
   include_cursor = 0;
+  this_input_filename = tif;
   push_command_line_include ();
 }
 
@@ -1435,7 +1456,7 @@ push_command_line_include (void)
   if (include_cursor == deferred_count)
     {
       /* Restore the line map from <command line>.  */
-      cpp_change_file (parse_in, LC_RENAME, main_input_filename);
+      cpp_change_file (parse_in, LC_RENAME, this_input_filename);
       /* -Wunused-macros should only warn about macros defined hereafter.  */
       cpp_opts->warn_unused_macros = warn_unused_macros;
       include_cursor++;
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]