[m-dev.] diff: fix problem with confusing demangler output

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Nov 12 18:05:04 AEDT 1999


Estimated hours taken: 0.5

scripts/ml.in:
	Wait for the demangler to exit before exiting.
	This avoids confusing output when `mmake' exits before
	the demangler has finished its output.

Workspace: /home/mercury0/fjh/mercury
Index: scripts/ml.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/ml.in,v
retrieving revision 1.71
diff -u -d -r1.71 ml.in
--- ml.in	1999/11/09 01:45:43	1.71
+++ ml.in	1999/11/12 06:53:31
@@ -608,18 +608,29 @@
 		# execute the demangler in the background, with stdin 
 		# coming from the pipe and with stdout redirected to stderr
 	exec $DEMANGLER --explain-link-errors 1>&2 < $PIPE &
-		# redirect our stdout and stderr into the pipe
-	exec >$PIPE 2>&1
+		# execute $CC with stdout & stderr redirected to
+		# go via the pipe to $DEMANGLER and then to stderr
+	case $# in
+		0) $LINKER $UNDEF_OPT $STRIP_OPTS $MAYBE_STATIC_OPT $ARCH_OPTS \
+			$LIBDIR_OPTS $RPATH_OPT_LIST $LIBS >$PIPE 2>&1 ;;
+
+		*) $LINKER $UNDEF_OPT $STRIP_OPTS $MAYBE_STATIC_OPT $ARCH_OPTS \
+			$LIBDIR_OPTS $RPATH_OPT_LIST "$@" $LIBS >$PIPE 2>&1 ;;
+	esac
+	linker_status=$?
 		# now we can remove the pipe; since is an open file, it will
-		# stay around until $CC and $DEMANGLER exit
+		# stay around until $DEMANGLER exits
 	rm -rf $ML_TMPDIR
-		# finally execute $CC; stdout & stderr will
-		# go via the pipe to $DEMANGLER and then to stderr
+		# wait for the demangler to exit before exiting ourselves
+	wait
+	exit $linker_status
 	;;
-esac
-case $# in
-	0) exec $LINKER $UNDEF_OPT $STRIP_OPTS $MAYBE_STATIC_OPT $ARCH_OPTS \
-		$LIBDIR_OPTS $RPATH_OPT_LIST $LIBS ;;
-	*) exec $LINKER $UNDEF_OPT $STRIP_OPTS $MAYBE_STATIC_OPT $ARCH_OPTS \
-		$LIBDIR_OPTS $RPATH_OPT_LIST "$@" $LIBS ;;
+false)
+	case $# in
+		0) exec $LINKER $UNDEF_OPT $STRIP_OPTS $MAYBE_STATIC_OPT $ARCH_OPTS \
+			$LIBDIR_OPTS $RPATH_OPT_LIST $LIBS ;;
+		*) exec $LINKER $UNDEF_OPT $STRIP_OPTS $MAYBE_STATIC_OPT $ARCH_OPTS \
+			$LIBDIR_OPTS $RPATH_OPT_LIST "$@" $LIBS ;;
+	esac
+	;;
 esac

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list