Skip to content

Commit f956dbc

Browse files
committed
Backport changes for GHC 9.2 on 3.2.5
Because CI is currently broken, and there is no straightforward way to test GHC prior to release, I want to do as bare-minimal a release as possible.
1 parent 40d2340 commit f956dbc

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
## Changes in 3.2.6:
2+
3+
* Support for the GHC 9.2.
4+
5+
The array access primops now read/write with the fixed-sized numeric
6+
type corresponding to the width of the data accessed. Additionally,
7+
the primops to convert to and from fixed-sized numeric types have
8+
been given new names.
9+
10+
9.2 isn't cut yet, so these changes are somewhat speculative, but
11+
unfortunately GHC must used a released version of Alex (and Happy) at
12+
all times until further changes have been made, so we must make the
13+
release to actually implement these changes in GHC.
14+
15+
If the final GHC 9.2 ends up being different, this release will be
16+
marked broken to make it less likely people use it by accident.
17+
118
## Changes in 3.2.5:
219

320
* Build fixes for GHC 8.8.x

alex.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: >= 1.8
22
name: alex
3-
version: 3.2.5
3+
version: 3.2.6
44
-- don't forget updating changelog.md!
55
license: BSD3
66
license-file: LICENSE

templates/GenericTemplate.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define ALEX_IF_GHC_GT_500 #if __GLASGOW_HASKELL__ > 500
1313
#define ALEX_IF_GHC_LT_503 #if __GLASGOW_HASKELL__ < 503
1414
#define ALEX_IF_GHC_GT_706 #if __GLASGOW_HASKELL__ > 706
15+
#define ALEX_IF_GHC_GT_901 #if __GLASGOW_HASKELL__ > 901
1516
#define ALEX_ELIF_GHC_500 #elif __GLASGOW_HASKELL__ == 500
1617
#define ALEX_IF_BIGENDIAN #ifdef WORDS_BIGENDIAN
1718
#define ALEX_ELSE #else
@@ -57,9 +58,14 @@ uncheckedShiftL# = shiftL#
5758
ALEX_ENDIF
5859

5960
{-# INLINE alexIndexInt16OffAddr #-}
61+
alexIndexInt16OffAddr :: AlexAddr -> Int# -> Int#
6062
alexIndexInt16OffAddr (AlexA# arr) off =
6163
ALEX_IF_BIGENDIAN
64+
ALEX_IF_GHC_GT_901
6265
narrow16Int# i
66+
ALEX_ELSE
67+
int16ToInt# i
68+
ALEX_ENDIF
6369
where
6470
i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)
6571
high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))
@@ -74,9 +80,14 @@ alexIndexInt16OffAddr arr off = arr ! off
7480

7581
#ifdef ALEX_GHC
7682
{-# INLINE alexIndexInt32OffAddr #-}
83+
alexIndexInt32OffAddr :: AlexAddr -> Int# -> Int#
7784
alexIndexInt32OffAddr (AlexA# arr) off =
7885
ALEX_IF_BIGENDIAN
86+
ALEX_IF_GHC_GT_901
7987
narrow32Int# i
88+
ALEX_ELSE
89+
int32ToInt# i
90+
ALEX_ENDIF
8091
where
8192
i = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#`
8293
(b2 `uncheckedShiftL#` 16#) `or#`

0 commit comments

Comments
 (0)