summaryrefslogtreecommitdiffstats
path: root/tools/haskell-platform/alex-ghc74-fix-bang-pattern.patch
diff options
context:
space:
mode:
Diffstat (limited to 'tools/haskell-platform/alex-ghc74-fix-bang-pattern.patch')
-rw-r--r--tools/haskell-platform/alex-ghc74-fix-bang-pattern.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/tools/haskell-platform/alex-ghc74-fix-bang-pattern.patch b/tools/haskell-platform/alex-ghc74-fix-bang-pattern.patch
new file mode 100644
index 0000000..cbc5fe4
--- /dev/null
+++ b/tools/haskell-platform/alex-ghc74-fix-bang-pattern.patch
@@ -0,0 +1,53 @@
+# Author : Erik de Castro Lopo <erikd@mega-nerd.com>
+# Description : Fix generated haskell code so it doesn't fail with -Werror.
+# Debian Version : 2.3.5
+# Date : Sun, 17 Apr 2011 15:45:41 +1000
+
+--- a/templates/GenericTemplate.hs
++++ b/templates/GenericTemplate.hs
+@@ -9,7 +9,7 @@
+
+ #ifdef ALEX_GHC
+ #define ILIT(n) n#
+-#define FAST_INT_BINDING(n) (n)
++#define FAST_INT_BINDING(n) (!(n))
+ #define IBOX(n) (I# (n))
+ #define FAST_INT Int#
+ #define LT(n,m) (n <# m)
+@@ -57,10 +57,10 @@
+ ALEX_IF_BIGENDIAN
+ narrow16Int# i
+ where
+- i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)
+- high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))
+- low = int2Word# (ord# (indexCharOffAddr# arr off'))
+- off' = off *# 2#
++ !i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)
++ !high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))
++ !low = int2Word# (ord# (indexCharOffAddr# arr off'))
++ !off' = off *# 2#
+ ALEX_ELSE
+ indexInt16OffAddr# arr off
+ ALEX_ENDIF
+--- a/src/Scan.x
++++ b/src/Scan.x
+@@ -11,7 +11,7 @@
+ -------------------------------------------------------------------------------
+
+ {
+-{-# OPTIONS_GHC -w #-}
++{-# OPTIONS_GHC -w -XBangPatterns #-}
+
+ module Scan(lexer, AlexPosn(..), Token(..), Tkn(..), tokPosn) where
+
+--- a/src/Main.hs
++++ b/src/Main.hs
+@@ -203,7 +203,7 @@
+ hPutStrLn hdl code
+
+ optsToInject :: Target -> [CLIFlags] -> String
+-optsToInject GhcTarget _ = "{-# LANGUAGE CPP,MagicHash #-}\n"
++optsToInject GhcTarget _ = "{-# LANGUAGE CPP,MagicHash,BangPatterns #-}\n"
+ optsToInject _ _ = "{-# LANGUAGE CPP #-}\n"
+
+ importsToInject :: Target -> [CLIFlags] -> String