]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR-101392 BugFix assign main_input_filename prior to compilation.
authorGaius Mulley <gaius.mulley@southwales.ac.uk>
Tue, 3 May 2022 13:55:16 +0000 (14:55 +0100)
committerGaius Mulley <gaius.mulley@southwales.ac.uk>
Tue, 3 May 2022 13:55:16 +0000 (14:55 +0100)
2022-05-03   Gaius Mulley   <gaius.mulley@southwales.ac.uk>

gcc/m2/ChangeLog:

* gm2-lang.cc (gm2_langhook_post_options): Assign
main_input_filename.  (gm2_parse_input_files) Assign
main_input_filename before every source filename is compiled.

Signed-off-by: Gaius Mulley <gaius.mulley@southwales.ac.uk>
gcc/m2/gm2-lang.cc

index 0642bb9883f10823f133fb23ba57e3cc4c312c32..385d42fc1df358044f755422923c8ce6f550ba26 100644 (file)
@@ -449,16 +449,20 @@ gm2_langhook_handle_option (
 /* Run after parsing options.  */
 
 static bool
-gm2_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED)
+gm2_langhook_post_options (const char **pfilename)
 {
+  const char *filename = *pfilename;
   flag_excess_precision = EXCESS_PRECISION_FAST;
   M2Options_SetCC1Quiet (quiet_flag);
   M2Options_FinaliseOptions ();
+  main_input_filename = filename;
 
   /* Returning false means that the backend should be used.  */
   return false;
 }
 
+/* Call the compiler for every source filename on the command line.  */
+
 static void
 gm2_parse_input_files (const char **filenames, unsigned int filename_count)
 {
@@ -467,7 +471,10 @@ gm2_parse_input_files (const char **filenames, unsigned int filename_count)
 
   for (i = 0; i < filename_count; i++)
     if (!is_cpp_filename (i))
-      init_PerCompilationInit (filenames[i]);
+      {
+       main_input_filename = filenames[i];
+       init_PerCompilationInit (filenames[i]);
+      }
 }
 
 static void