diff options
author | Gaius Mulley <gaiusmod2@gmail.com> | 2023-03-22 16:39:12 +0000 |
---|---|---|
committer | Gaius Mulley <gaiusmod2@gmail.com> | 2023-03-22 16:39:12 +0000 |
commit | aae0d89e65c5da6ef45ec787e165dccb5ae7e2d0 (patch) | |
tree | cb7b9c8b2af0c3a824f1d1854eb74049ca5a6af2 | |
parent | 426cab4e3b46abaeae0813042b5addc789e3b2be (diff) | |
download | gcc-aae0d89e65c5da6ef45ec787e165dccb5ae7e2d0.zip gcc-aae0d89e65c5da6ef45ec787e165dccb5ae7e2d0.tar.gz gcc-aae0d89e65c5da6ef45ec787e165dccb5ae7e2d0.tar.bz2 |
modula2: Add cwd to include path. Include m2cor before m2pim.
The driver should default to include the current working directory in the
module search path. This patch adds . to the search path provided
-fm2-pathname has not been specified. The patch also reorders the pim
libraries so that the m2cor directory is searched before m2pim.
Coroutine support is visible by default for both -fpim and -fiso
(from their respective SYSTEM modules).
gcc/m2/ChangeLog:
PR modula2/109248
* Make-lang.in (m2/pge-boot/%.o): Add CFLAGS and CXXFLAGS for C
and C++ compiles.
* gm2spec.cc (add_m2_I_path): Indentation.
(lang_specific_driver): New variable seen_pathname.
Detect -fm2-pathname. If not seen then push_back_Ipath (".").
Change non iso library path to "m2cor,m2log,m2pim,m2iso".
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
-rw-r--r-- | gcc/m2/Make-lang.in | 4 | ||||
-rw-r--r-- | gcc/m2/gm2spec.cc | 13 |
2 files changed, 13 insertions, 4 deletions
diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in index 3fc691b6..ad21b20 100644 --- a/gcc/m2/Make-lang.in +++ b/gcc/m2/Make-lang.in @@ -1694,11 +1694,11 @@ include m2/Make-maintainer else m2/pge-boot/%.o: m2/pge-boot/%.c m2/gm2-libs/gm2-libs-host.h m2/gm2config.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ + $(CXX) $(CFLAGS) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ m2/pge-boot/%.o: m2/pge-boot/%.cc m2/gm2-libs/gm2-libs-host.h m2/gm2config.h -test -d $(@D) || $(mkinstalldirs) $(@D) - $(CXX) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ + $(CXX) $(CXXFLAGS) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@ $(PGE): $(BUILD-PGE-O) +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PGE-O) -lm diff --git a/gcc/m2/gm2spec.cc b/gcc/m2/gm2spec.cc index a118a88..3b2652c 100644 --- a/gcc/m2/gm2spec.cc +++ b/gcc/m2/gm2spec.cc @@ -388,7 +388,7 @@ add_m2_I_path (void) if (strcmp (np.name, "") == 0) append_option (OPT_fm2_pathname_, safe_strdup ("-"), 1); else - append_option (OPT_fm2_pathname_, safe_strdup (np.name), 1); + append_option (OPT_fm2_pathname_, safe_strdup (np.name), 1); for (auto *s : np.path) append_option (OPT_fm2_pathnameI, safe_strdup (s), 1); } @@ -461,6 +461,9 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, /* Have we seen the -v flag? */ bool verbose = false; + /* Have we seen the -fm2-pathname flag? */ + bool seen_pathname = false; + /* The number of libraries added in. */ int added_libraries; @@ -569,6 +572,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, uselist = decoded_options[i].value; break; case OPT_fm2_pathname_: + seen_pathname = true; args[i] |= SKIPOPT; /* We will add the option if it is needed. */ m2_path_name = decoded_options[i].arg; break; @@ -677,6 +681,11 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, if (language != NULL && (strcmp (language, "modula-2") != 0)) return; + if (! seen_pathname) + /* Not seen -fm2-pathname therefore make current working directory + the first place to look for modules. */ + push_back_Ipath ("."); + /* Override the default when the user specifies it. */ if (seen_scaffold_static && scaffold_static && !seen_scaffold_dynamic) scaffold_dynamic = false; @@ -772,7 +781,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, libraries = xstrdup ("m2iso,m2cor,m2pim,m2log"); else /* Default to pim libraries otherwise. */ - libraries = xstrdup ("m2pim,m2iso,m2cor,m2log"); + libraries = xstrdup ("m2cor,m2log,m2pim,m2iso"); } libraries = convert_abbreviations (libraries); append_option (OPT_flibs_, xstrdup (libraries), 1); |