[m-dev.] Re: diff: fix bug with --parallel & C flags
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Sep 15 02:59:18 AEDT 2000
On 15-Sep-2000, Fergus Henderson <fjh at cs.mu.oz.au> wrote:
> Estimated hours taken: 2
>
> Fix a bug: mmc wasn't passing the right flags to the C compiler
> when `--parallel' was specified.
...
> scripts/mmc.in:
> Pass `--cflags-for-threads $CFLAGS_FOR_THREADS' to mercury_compile.
>
> compiler/options.m:
> Add a new option `--cflags-for-threads', for use by scripts/mmc.in.
Oops, that didn't quite work... when building with the old compiler,
this tries to pass a new option which the old compiler doesn't recognize.
(My original testing didn't uncover this because I first modified options.m
and ran `mmake' [since I knew it would take a long time], and then modified
the other files including last of all scripts/mmc.in, by which time
all the .m files in my compiler directory had already been compiled;
so without realizing, it I ended up not testing that it worked with
the original compiler.)
Here's a fix.
----------
Estimated hours taken: 0.25
scripts/mmc.in:
Add a work-around for a bootstrapping problem with my
previous change to use `--cflags-for-threads'.
Workspace: /home/pgrad/fjh/ws/hg
Index: scripts/mmc.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mmc.in,v
retrieving revision 1.13
diff -u -d -r1.13 mmc.in
--- scripts/mmc.in 2000/09/14 14:31:29 1.13
+++ scripts/mmc.in 2000/09/14 15:51:19
@@ -35,6 +35,18 @@
HAVE_BOXED_FLOATS=@HAVE_BOXED_FLOATS@
DEFAULT_OPT_LEVEL=${MERCURY_DEFAULT_OPT_LEVEL="-O2"}
+# XXX Temporary hack for bootstrapping purposes
+case "`$MC --cflags-for-threads 2>&1`" in
+ *"unrecognized option"*)
+ # This value will get overridden by
+ # the later setting of --cflags-for-regs, so
+ # it will just get ignored
+ THREADS_OPT="--cflags-for-regs"
+ ;;
+ *)
+ THREADS_OPT="--cflags-for-threads"
+esac
+
# The default optimization level should be after
# all the options that describe the machine configuration.
@@ -42,9 +54,9 @@
0) exec $MC \
$MERC_ALL_MC_C_INCL_DIRS \
--cc "$CC" --grade "$DEFAULT_GRADE" \
+ $THREADS_OPT "$CFLAGS_FOR_THREADS" \
--cflags-for-regs "$CFLAGS_FOR_REGS" \
--cflags-for-gotos "$CFLAGS_FOR_GOTOS" \
- --cflags-for-threads "$CFLAGS_FOR_THREADS" \
--c-flag-to-name-object-file "$CFLAG_TO_NAME_OBJECT_FILE" \
--object-file-extension "$OBJECT_FILE_EXTENSION" \
--num-real-r-regs "$NUM_REAL_R_REGS" \
@@ -60,9 +72,9 @@
*) exec $MC \
$MERC_ALL_MC_C_INCL_DIRS \
--cc "$CC" --grade "$DEFAULT_GRADE" \
+ $THREADS_OPT "$CFLAGS_FOR_THREADS" \
--cflags-for-regs "$CFLAGS_FOR_REGS" \
--cflags-for-gotos "$CFLAGS_FOR_GOTOS" \
- --cflags-for-threads "$CFLAGS_FOR_THREADS" \
--c-flag-to-name-object-file "$CFLAG_TO_NAME_OBJECT_FILE" \
--object-file-extension "$OBJECT_FILE_EXTENSION" \
--num-real-r-regs "$NUM_REAL_R_REGS" \
--
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