[m-rev.] for review: Fix unused variable warning about MERC_INT_DIR.

Peter Wang novalazy at gmail.com
Tue Oct 17 11:52:43 AEDT 2023


GNU Make 4.4 reported unused variable warnings about MERC_INT_DIR.
The problem is related to MERC_INT_DIR being referenced in a
$(shell ...) command, but being defined later.

scripts/Mmake.vars.in:
    Move the definition of MERC_INT_DIR to Mmake.vars,
    before its reference in MERC_INT_DIR_FOR_VPATH.

scripts/Mmake.rules:
    Delete definition of MERC_INT_DIR from Mmake.rules.
---
 scripts/Mmake.rules   | 12 ------------
 scripts/Mmake.vars.in |  8 ++++++++
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/scripts/Mmake.rules b/scripts/Mmake.rules
index 9f1c72e4a..4d7054380 100644
--- a/scripts/Mmake.rules
+++ b/scripts/Mmake.rules
@@ -43,18 +43,6 @@ ALL_MGNUCFLAGS += -I. -I$(mihs_subdir).
 
 endif
 
-#-----------------------------------------------------------------------------#
-#
-# Find the directory containing the interface files for the standard library.
-#
-
-ifdef MERCURY_STDLIB_DIR
-    export MERCURY_STDLIB_DIR
-    MERC_INT_DIR = $(MERCURY_STDLIB_DIR)/ints
-else
-    MERC_INT_DIR =
-endif
-
 #-----------------------------------------------------------------------------#
 
 .PRECIOUS: $(date0s_subdir)%.date0
diff --git a/scripts/Mmake.vars.in b/scripts/Mmake.vars.in
index d07e9dc31..0eca0f257 100644
--- a/scripts/Mmake.vars.in
+++ b/scripts/Mmake.vars.in
@@ -15,6 +15,14 @@
 # Ensure that commands use /bin/sh not the user's shell
 SHELL = /bin/sh
 
+# The directory containing the interface files for the standard library.
+ifdef MERCURY_STDLIB_DIR
+    export MERCURY_STDLIB_DIR
+    MERC_INT_DIR = $(MERCURY_STDLIB_DIR)/ints
+else
+    MERC_INT_DIR =
+endif
+
 ALL_EXTRA_LIBRARIES = $(TARGET_EXTRA_LIBRARIES) $(EXTRA_LIBRARIES)
 EXTRA_LIB_DIRS =
 EXTRA_LIBRARIES =
-- 
2.42.0



More information about the reviews mailing list