c-opts.c (this_input_filename): New.
authorGeoffrey Keating <geoffk@apple.com>
Thu, 17 Jul 2003 21:50:38 +0000 (21:50 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Thu, 17 Jul 2003 21:50:38 +0000 (21:50 +0000)
* 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.

From-SVN: r69526

gcc/ChangeLog
gcc/c-opts.c

index 3540c57b98d4585c96f4bab1e2cfe0b0d0c4b9ee..2ad26e382950d617bed3745eb453d74af7212892 100644 (file)
@@ -1,3 +1,11 @@
+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.
+
 2003-07-17  Neil Booth  <neil@daikokuya.co.uk>
 
        * Makefile.in: Depend .pot generation on options.c.
index 3925c445d6846f245a1d92968aed8c40e481ca25..1beb651fe915b0168b02e577dc4197bf53fe2ae1 100644 (file)
@@ -54,6 +54,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 +110,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 +1168,7 @@ c_common_init (void)
 
   if (flag_preprocess_only)
     {
-      finish_options ();
+      finish_options (in_fnames[0]);
       preprocess_file (parse_in);
       return false;
     }
@@ -1205,7 +1206,7 @@ c_common_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
          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 +1362,11 @@ add_prefixed_path (const char *suffix, size_t chain)
   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 +1417,7 @@ finish_options (void)
     }
 
   include_cursor = 0;
+  this_input_filename = tif;
   push_command_line_include ();
 }
 
@@ -1435,7 +1439,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++;