[m-dev.] diff: missing #include

Tyson Richard DOWD trd at cs.mu.oz.au
Tue Jul 29 15:17:57 AEST 1997


Fergus Henderson wrote:
> Tyson Richard DOWD, you wrote:
> > 
> > util/mdemangle.c:
> > 	Add #include <assert.h>.
> 
> That change looks fine, but your comment
> 
> > Don't release without this one.... ;-)
> 
> is quite convincing -- mdemangle.c already includes "std.h" which includes
> <assert.h>, so this change should be for stylistic reasons (making things
> self-contained) rather than for correctness.  Did I miss something?

Yes, the Mmake file in the util directory doesn't put the runtime in its
include path properly.

> How did you discover this one?

hydra 15:00 util 0 >mmake ../scripts/mgnuc --grade asm_fast.gc -I../runtime -g -o mdemangle mdemangle.c
mdemangle.c: In function `fix_mangled_special_case':
mdemangle.c:610: warning: implicit declaration of function `assert'
/tmp/cca266471.o: In function `fix_mangled_special_case':
/home/pgrad/trd/mercury1/hydra2/util/mdemangle.c:610: undefined reference to `assert'
gmake: *** [mdemangle] Error 1

hydra 15:02 util 2 >mgnuc mdemangle.c 
hydra 15:02 util 0 >

It appears that my compiler on hydra has configured to use an older
runtime that doesn't have assert.h.  Mmake only puts -I ../runtime at
the end of the seach path, which is wrong, /usr/local/lib/mercury.....
occurs much earlier in the search path.

Here's a better fix then (I think):

cvs diff: Diffing .
Index: Mmake
===================================================================
RCS file: /home/staff/zs/imp/mercury/util/Mmake,v
retrieving revision 1.17
diff -u -r1.17 Mmake
--- Mmake       1997/07/27 15:09:57     1.17
+++ Mmake       1997/07/29 05:14:52
@@ -15,9 +15,8 @@
 
 #-----------------------------------------------------------------------------#
 
-MGNUC  = $(SCRIPTS_DIR)/mgnuc
-CFLAGS = -I$(RUNTIME_DIR) $(EXTRA_CFLAGS)
-# we need -I ../runtime for "getopt.h"
+MGNUC   =       MERCURY_C_INCL_DIR=$(RUNTIME_DIR) $(SCRIPTS_DIR)/mgnuc
+MGNUCFLAGS =    -I$(RUNTIME_DIR) $(EXTRA_CFLAGS)
 
 PROGS=mkinit mdemangle
 
-- 
       Tyson Dowd           # 4.4: People keep saying the behavior is undefined,
                            # but I just tried it on an ANSI-conforming compiler
     trd at cs.mu.oz.au        # and got the results I expected.
http://www.cs.mu.oz.au/~trd # A: They were wrong. Flame them mercilessly. C-IAQ



More information about the developers mailing list