[nhc-bugs] Re: nhc-1.06 doesn't compile .c files

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Mon, 11 Jun 2001 11:20:30 +0100


> nhc-1.06 doesn't compile .c files

I presume the .c file you want to compile is real hand-written C,
not a compiler-generated intermediate file?  If so, then yes, this
was inadvertently broken in 1.06.  A full patch is attached.

> Changing CSUFFIX from "hc" to "c" in the nhc98 driver seems to fix this.

Unfortunately, that is not a very safe fix - it will break a build
via gcc.  Better to undo that change and apply the patch below.
(After applying, a ./configure is needed.)

Regards,
    Malcolm



diff -u -r1.26 nhc98.inst
--- script/nhc98.inst	2001/06/04 15:10:29	1.26
+++ script/nhc98.inst	2001/06/11 10:11:57
@@ -304,19 +304,20 @@
 
   while test $1 
   do
+    CSUF=$CSUFFIX
     case $1 in
     *.s   ) UNLIT="";       HSRC=0; CSRC=0; SSRC=1; GR=0;
                               BASENAME=`basename $1 .s`   ;;
     *.hc  ) UNLIT="";       HSRC=0; CSRC=1; SSRC=0; GR=0;
-                              BASENAME=`basename $1 .hc`  ;;
+                              BASENAME=`basename $1 .hc`  CSUF=hc ;;
     *.T.c ) UNLIT="";       HSRC=0; CSRC=1; SSRC=0; GR=0;
-                              BASENAME=`basename $1 .T.c`  ;;
+                              BASENAME=`basename $1 .T.c` CSUF=T.c ;;
     *.p.c ) UNLIT="";       HSRC=0; CSRC=1; SSRC=0; GR=0;
-                              BASENAME=`basename $1 .p.c`  ;;
+                              BASENAME=`basename $1 .p.c` CSUF=p.c ;;
     *.z.c ) UNLIT="";       HSRC=0; CSRC=1; SSRC=0; GR=0;
-                              BASENAME=`basename $1 .z.c`  ;;
+                              BASENAME=`basename $1 .z.c` CSUF=z.c ;;
     *.c   ) UNLIT="";       HSRC=0; CSRC=1; SSRC=0; GR=0;
-                              BASENAME=`basename $1 .c`   ;;
+                              BASENAME=`basename $1 .c`   CSUF=c ;;
     *.hs_ ) UNLIT="";       HSRC=1; CSRC=0; SSRC=0; GR=0;
                               BASENAME=`basename $1 _.hs_` ;;
     *.gc  ) UNLIT="";       HSRC=1; CSRC=0; SSRC=0; GR=1;
@@ -342,10 +343,20 @@
 
     TMPCPPPREFILE=$TMP/$BASENAME.$$.hs
 
-    CPPASFILE=$DIRNAME/$BASENAME.$CSUFFIX
+    if [ "$CSUF" != "$CSUFFIX"  -a "$CSUF" != "c" ]
+    then
+      echo "Warning: compiling a .$CSUF file, but expected a .$CSUFFIX file"
+      echo "    Ensure compiler options match the intended build type:"
+      echo "        ordinary            .hc"
+      echo "        heap profiling  -p  .p.c"
+      echo "        time profiling  -t  .z.c"
+      echo "        tracing         -T  .T.c"
+    fi
+
+    CPPASFILE=$DIRNAME/$BASENAME.$CSUF
     if test $CSRC -eq 0
     then
-      TMPCPPASFILE=$TMP/$BASENAME.$$.$CSUFFIX
+      TMPCPPASFILE=$TMP/$BASENAME.$$.$CSUF
     else
       TMPCPPASFILE=$CPPASFILE
     fi