Skip to content

Commit 06b8f3d

Browse files
committed
Drop code generation for GHCs < 6.4 (removing some #ifs)
These have been untested since long.
1 parent 1efe16b commit 06b8f3d

File tree

2 files changed

+7
-30
lines changed

2 files changed

+7
-30
lines changed

data/AlexTemplate.hs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
#ifdef ALEX_GHC
4141
data AlexAddr = AlexA# Addr#
4242
-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.
43-
#if __GLASGOW_HASKELL__ < 503
44-
uncheckedShiftL# = shiftL#
45-
#endif
4643

4744
{-# INLINE alexIndexInt16OffAddr #-}
4845
alexIndexInt16OffAddr :: AlexAddr -> Int# -> Int#
@@ -90,13 +87,8 @@ alexIndexInt32OffAddr arr off = arr ! off
9087
#endif
9188

9289
#ifdef ALEX_GHC
93-
94-
#if __GLASGOW_HASKELL__ < 503
95-
quickIndex arr i = arr ! i
96-
#else
9790
-- GHC >= 503, unsafeAt is available from Data.Array.Base.
9891
quickIndex = unsafeAt
99-
#endif
10092
#else
10193
quickIndex arr i = arr ! i
10294
#endif

src/Main.hs

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -393,40 +393,25 @@ importsToInject _ cli = always_imports ++ debug_imports ++ glaexts_import
393393
debug_imports | OptDebugParser `elem` cli = import_debug
394394
| otherwise = ""
395395

396-
-- CPP is turned on for -fglasogw-exts, so we can use conditional
397-
-- compilation. We need to #include "config.h" to get hold of
396+
-- We need to #include "ghcconfig.h" to get hold of
398397
-- WORDS_BIGENDIAN (see AlexTemplate.hs).
399398

400399
always_imports :: String
401-
always_imports = "#if __GLASGOW_HASKELL__ >= 603\n" ++
402-
"#include \"ghcconfig.h\"\n" ++
403-
"#elif defined(__GLASGOW_HASKELL__)\n" ++
404-
"#include \"config.h\"\n" ++
405-
"#endif\n" ++
406-
"#if __GLASGOW_HASKELL__ >= 503\n" ++
400+
always_imports = "#include \"ghcconfig.h\"\n" ++
407401
"import Data.Array\n" ++
408-
"#else\n" ++
409-
"import Array\n" ++
410-
"#endif\n"
402+
""
411403

412404
import_glaexts :: String
413-
import_glaexts = "#if __GLASGOW_HASKELL__ >= 503\n" ++
414-
"import Data.Array.Base (unsafeAt)\n" ++
405+
import_glaexts = "import Data.Array.Base (unsafeAt)\n" ++
415406
"import GHC.Exts\n" ++
416-
"#else\n" ++
417-
"import GlaExts\n" ++
418-
"#endif\n"
407+
""
419408

420409
import_debug :: String
421-
import_debug = "#if __GLASGOW_HASKELL__ >= 503\n" ++
422-
"import Data.Char (chr)\n" ++
410+
import_debug = "import Data.Char (chr)\n" ++
423411
"import System.IO\n" ++
424412
"import System.IO.Unsafe\n" ++
425413
"import Debug.Trace\n" ++
426-
"#else\n" ++
427-
"import IO\n" ++
428-
"import IOExts\n" ++
429-
"#endif\n"
414+
""
430415

431416
templateDir :: IO FilePath -> [CLIFlags] -> IO FilePath
432417
templateDir def cli

0 commit comments

Comments
 (0)