[project @ 2002-07-04 10:38:49 by simonmar]
authorsimonmar <unknown>
Thu, 4 Jul 2002 10:38:49 +0000 (10:38 +0000)
committersimonmar <unknown>
Thu, 4 Jul 2002 10:38:49 +0000 (10:38 +0000)
In hPutLitString, catch the empty string case before calling hPutBuf.
Some older versions of hPutBufFull choke on a zero-length buffer.

Fixes occasional problems with the Sparc native code generator, which
uses SLIT("") in a couple of places.

ghc/compiler/utils/Pretty.lhs

index d3fe50a..bf7f10b 100644 (file)
@@ -1037,6 +1037,8 @@ printDoc mode hdl doc
 hPutBuf = hPutBufFull
 #endif
 
+  -- some versions of hPutBuf will barf if the length is zero
+hPutLitString handle a# 0# = return ()
 hPutLitString handle a# l#
 #if __GLASGOW_HASKELL__ < 411
   = hPutBuf handle (A# a#) (I# l#)