[project @ 2001-01-13 20:33:51 by qrczak]
authorqrczak <unknown>
Sat, 13 Jan 2001 20:34:25 +0000 (20:34 +0000)
committerqrczak <unknown>
Sat, 13 Jan 2001 20:34:25 +0000 (20:34 +0000)
Use a replacement for LINE pragmas under nhc.

ghc/utils/hsc2hs/Main.hs
ghc/utils/hsc2hs/template-hsc.h

index 71abaa3..be87ec6 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.10 2001/01/13 19:46:49 qrczak Exp $
+-- $Id: Main.hs,v 1.11 2001/01/13 20:33:51 qrczak Exp $
 --
 -- (originally "GlueHsc.hs" by Marcin 'Qrczak' Kowalczyk)
 --
@@ -409,7 +409,7 @@ outCLine pos =
 
 outHsLine :: SourcePos -> String
 outHsLine pos =
-    "    printf (\"{-# LINE %d \\\"%s\\\" #-}\\n\", "++
+    "    hsc_line ("++
     show (sourceLine pos + 1)++", \""++
     showCString (sourceFileName pos)++"\");\n"
 
index 9b68c98..df8747d 100644 (file)
 #define offsetof(t, f) ((size_t) &((t *)0)->f)
 #endif
 
+#if __NHC__
+#define hsc_line(line, file) \
+    printf ("# %d \"%s\"\n", line, file);
+#else
+#define hsc_line(line, file) \
+    printf ("{-# LINE %d \"%s\" #-}\n", line, file);
+#endif
+
 #define hsc_const(x)                        \
     if ((x) < 0)                            \
         printf ("%ld", (long)(x));          \