RE: [cvs-nhc98] cvs commit: nhc98/src/hmake MkConfig.hs
On 16 August 2004 16:32, Malcolm Wallace wrote:
malcolm 2004/08/16 08:32:15 PDT
Modified files: src/hmake MkConfig.hs Log: Apparently ghc versions like 6.2 have -D__GLASGOW_HASKELL__=602, not =620.
I think this makes complete sense, but it seems to catch everybody out. I don't know why. Perhaps because the version used to have the leading zero (eg. 5.04) and now it doesn't? Cheers, Simon
"Simon Marlow"
Apparently ghc versions like 6.2 have -D__GLASGOW_HASKELL__=602, not =620.
I think this makes complete sense, but it seems to catch everybody out. I don't know why. Perhaps because the version used to have the leading zero (eg. 5.04) and now it doesn't?
It is possibly because many people use a nasty shell-script hack to convert the output of ghc --version into a -D__GLASGOW_HASKELL= option. The simplest hack (provided originally by yourself I believe :-) is GHCVERSION=`ghc --version 2>&1 | sed 's/^.*version[ ]*\([0-9.]*\).*/\1/'` GHCNUM=`echo $GHCVERSION | tr "v." " " | ( read x y z; echo $x$y; )` But when the middle zero disappeared, most of us probably assumed that adding this: if [ "$GHCNUM" -lt "100" ] then GHCNUM=${GHCNUM}0 fi was sufficient to patch things up again. Sadly not. It takes a little bit more arithmetic. (in haskell:) if v >= 100 then v else (v`div`10)*100 + (v`mod`10) Maybe we should add a new option to the compiler, rather like cpp -dM, to report any cpp symbols that are automatically defined. Regards, Malcolm
participants (2)
-
Malcolm Wallace -
Simon Marlow