From: Gaius Mulley Date: Tue, 3 May 2022 13:55:16 +0000 (+0100) Subject: PR-101392 BugFix assign main_input_filename prior to compilation. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f39c518e3df5eb8236f24958cd1dd570ad153f33;p=thirdparty%2Fgcc.git PR-101392 BugFix assign main_input_filename prior to compilation. 2022-05-03 Gaius Mulley 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 --- diff --git a/gcc/m2/gm2-lang.cc b/gcc/m2/gm2-lang.cc index 0642bb9883f1..385d42fc1df3 100644 --- a/gcc/m2/gm2-lang.cc +++ b/gcc/m2/gm2-lang.cc @@ -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