https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121629
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Gaius Mulley <[email protected]>: https://gcc.gnu.org/g:69faef01dff124cd2e657b7525ba6cc574626853 commit r16-3432-g69faef01dff124cd2e657b7525ba6cc574626853 Author: Gaius Mulley <[email protected]> Date: Thu Aug 28 12:08:33 2025 +0100 PR modula2/121629: adding third party modules This patch makes it easier to add third party modules. cc1gm2 now appends the search directory prefix/include/m2 to the search path for non dialect specific modules. Prior to this it appends the dialect specific subdirectories {m2pim,m2iso,m2log,m2min} with the appropriate dialect pathname. The patch also includes a new option -fm2-pathname-root=prefix which allow additional prefix/m2 directories to be searched before the default. gcc/ChangeLog: PR modula2/121629 * doc/gm2.texi (Module Search Path): New section. (Compiler options): New option -fm2-pathname-root=. New option -fm2-pathname-rootI. gcc/m2/ChangeLog: PR modula2/121629 * gm2-compiler/PathName.mod: Add copyright notice. * gm2-lang.cc (named_path): Add field lib_root. (push_back_Ipath): Set lib_root false. (push_back_lib_root): New function. (get_dir_sep_size): Ditto. (add_path_component): Ditto. (add_one_import_path): Ditto. (add_non_dialect_specific_path): Ditto. (foreach_lib_gen_import_path): Ditto. (get_module_source_dir): Ditto. (add_default_include_paths): Ditto. (assign_flibs): Ditto. (m2_pathname_root): Ditto. (add_m2_import_paths): Remove function. (gm2_langhook_post_options): Call assign_flibs. Check np.lib_root and call foreach_lib_gen_import_path. Replace call to add_m2_import_paths with a call to add_default_include_paths. (gm2_langhook_handle_option): Add case OPT_fm2_pathname_rootI_. * gm2spec.cc (named_path): Add field lib_root. (push_back_Ipath): Set lib_root false. (push_back_lib_root): New function. (add_m2_I_path): Add OPT_fm2_pathname_rootI_ option if np.lib_root. (lang_specific_driver): Add case OPT_fm2_pathname_root_. * lang.opt (fm2-pathname-root=): New option. (fm2-pathname-rootI=): Ditto. gcc/testsuite/ChangeLog: PR modula2/121629 * gm2/switches/pathnameroot/pass/switches-pathnameroot-pass.exp: New test. * gm2/switches/pathnameroot/pass/test.mod: New test. * gm2/switches/pathnameroot/pass/testlib/m2/foo.def: New test. * gm2/switches/pathnameroot/pass/testlib/m2/foo.mod: New test. Signed-off-by: Gaius Mulley <[email protected]>
