diff options
author | Gaius Mulley <gaius.mulley@southwales.ac.uk> | 2022-05-03 14:55:16 +0100 |
---|---|---|
committer | Gaius Mulley <gaius.mulley@southwales.ac.uk> | 2022-05-03 14:55:16 +0100 |
commit | f39c518e3df5eb8236f24958cd1dd570ad153f33 (patch) | |
tree | bf069764302937dffd562da64286e4762d9c0864 | |
parent | b8c70285c3bb19aea0a7bfc0285271b2b1c0bbdd (diff) | |
download | gcc-f39c518e3df5eb8236f24958cd1dd570ad153f33.zip gcc-f39c518e3df5eb8236f24958cd1dd570ad153f33.tar.gz gcc-f39c518e3df5eb8236f24958cd1dd570ad153f33.tar.bz2 |
PR-101392 BugFix assign main_input_filename prior to compilation.
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>
-rw-r--r-- | gcc/m2/gm2-lang.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/m2/gm2-lang.cc b/gcc/m2/gm2-lang.cc index 0642bb9..385d42f 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 |