[m-rev.] for review: avoid warnings from mgnuc about mfiltercc

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Dec 7 00:26:01 AEDT 2010


Branches: main, 10.04

Avoid warnings from the mgnuc script on MinGW, Cygwin and Solaris when
compiling the source distribution.  The warnings are from the "which" command,
which is used in the mgnuc script when checking for the presence of the
mfiltercc utility program.  (If the command named in the argument to which
cannot be found on the above systems it fails rather noisily rather than just
setting a non-zero exist status as on Linux and Mac OS X.)

The solution is to ensure that mfiltercc is built before anything that requires
it.

Mmakefile:
 	Add a new top-level target util_nort that builds those programs in the
 	util directory that do not depend on anything in the runtime directory.

scripts/mgnuc.in:
scripts/mgnuc_file_opt.sh-subr:
 	Add a new option, --no-filter-cc, that tells mgnuc not to bother
 	filtering the warning output of the C compiler.


util/Makefile:
 	Compile mfiltercc with --no-filter-cc since for the source distribution
 	it obviously won't exist until we do compile it.

util/mfiltercc.c:
 	Add a note at the top of this file mentioning the requirement that it
 	not depend on anything in the runtime directory.

Julien.

Index: Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/Mmakefile,v
retrieving revision 1.138
diff -u -r1.138 Mmakefile
--- Mmakefile	30 Sep 2010 07:23:30 -0000	1.138
+++ Mmakefile	6 Dec 2010 13:23:08 -0000
@@ -213,8 +213,20 @@

  #-----------------------------------------------------------------------------#

+# NOTE: there are two targets that concern the util directory here.  The first
+# is the "util_nort" target (short for "util no runtime") and the second is the
+# "util" target.  The first target builds thaose programs in the util directory
+# that do *not* depend on the runtime directory, at present just mfiltercc.
+# The second target builds the rest.  Things are arranged in this fashion so
+# that when building the source distribution we can build mfiltercc before
+# it is required.
+
  .PHONY: all
-all: 	$(GENERATED_DOCS) mercury-compiler.spec $(SUBDIRS)
+all: 	$(GENERATED_DOCS) mercury-compiler.spec util_nort $(SUBDIRS)
+
+.PHONY: util_nort
+util_nort: scripts
+	+cd util && $(SUBDIR_MMAKE) mfiltercc

  .PHONY: util
  util: 	scripts runtime
@@ -225,12 +237,12 @@
  	+cd scripts && $(SUBDIR_MMAKE)

  .PHONY: boehm_gc
-boehm_gc: scripts
+boehm_gc: scripts util_nort
  	+gc_grade=`scripts/ml --grade $(GRADE) --print-gc-grade`; \
  	cd boehm_gc && $(SUBDIR_MMAKE) GC_GRADE=$$gc_grade

  .PHONY: runtime
-runtime: scripts boehm_gc
+runtime: scripts util_nort boehm_gc
  	+cd runtime && $(SUBDIR_MMAKE)

  .PHONY: robdd
Index: scripts/mgnuc.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/mgnuc.in,v
retrieving revision 1.132
diff -u -r1.132 mgnuc.in
--- scripts/mgnuc.in	12 Jul 2010 04:57:09 -0000	1.132
+++ scripts/mgnuc.in	6 Dec 2010 13:23:09 -0000
@@ -96,6 +96,7 @@
  mercury_config_dir=${MERCURY_STDLIB_DIR- at LIBDIR@}
  mercury_config_dir=${MERCURY_CONFIG_DIR=$mercury_config_dir}
  mercury_stdlib_dir=${MERCURY_STDLIB_DIR=@LIBDIR@}
+do_filter_cc=true

  # include the file `init_grade_options.sh-subr'
  @INIT_GRADE_OPTIONS@
@@ -125,6 +126,8 @@
          The directory containing the installed Mercury standard library.
      --no-mercury-standard-library-directory, --no-mercury-stdlib-dir
          Don't use an installed Mercury standard library.
+    --no-filter-cc
+        Do not filter warnings from the C compiler.

  $grade_usage

@@ -641,7 +644,7 @@
  fi

  FILTERCC=""
-case $asm_labels in true)
+case $asm_labels,$do_filter_cc in true,true)
      # Check if mfiltercc is available as we may be bootstrapping with
      # an older compiler which did not have it.
      if test -n "$MKTEMP" && mfiltercc=`which mfiltercc`
Index: scripts/mgnuc_file_opts.sh-subr
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/mgnuc_file_opts.sh-subr,v
retrieving revision 1.2
diff -u -r1.2 mgnuc_file_opts.sh-subr
--- scripts/mgnuc_file_opts.sh-subr	28 Nov 2005 02:30:31 -0000	1.2
+++ scripts/mgnuc_file_opts.sh-subr	6 Dec 2010 13:23:09 -0000
@@ -71,3 +71,6 @@
              unset mercury_stdlib_dir
              unset mercury_config_dir
              ;;
+ 
+	--no-filter-cc)
+	    do_filter_cc=false ;;
Index: util/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/util/Mmakefile,v
retrieving revision 1.22
diff -u -r1.22 Mmakefile
--- util/Mmakefile	9 Jul 2010 07:10:16 -0000	1.22
+++ util/Mmakefile	6 Dec 2010 13:23:09 -0000
@@ -35,6 +35,10 @@
  MGNUCFLAGS-mkinit = --no-ansi
  MGNUCFLAGS-mkinit_erl = --no-ansi

+# For the C distribution mfiltercc may not be available until after we build
+# it here.
+MGNUCFLAGS-mfiltercc = --no-filter-cc
+
  #-----------------------------------------------------------------------------#

  all:	$(PROGS) $(TAGS_FILE_EXISTS)
Index: util/mfiltercc.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/util/mfiltercc.c,v
retrieving revision 1.2
diff -u -r1.2 mfiltercc.c
--- util/mfiltercc.c	11 Jul 2010 14:17:57 -0000	1.2
+++ util/mfiltercc.c	6 Dec 2010 13:23:09 -0000
@@ -15,6 +15,10 @@
  **
  ** This is a last ditch effort to filter out warning messages from the
  ** C compiler that we cannot (yet) figure out how to silence in a better way.
+**
+** This program must *not* #include any of the header files in the runtime
+** directory.
+**
  */

  #include <string.h>

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list