From f39c518e3df5eb8236f24958cd1dd570ad153f33 Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Tue, 3 May 2022 14:55:16 +0100 Subject: [PATCH] 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 --- gcc/m2/gm2-lang.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 -- 2.47.2