[Git][ghc/ghc][wip/9.12.3-backports] Fix for alex-3.5.2.0 (#25623)
Zubin pushed to branch wip/9.12.3-backports at Glasgow Haskell Compiler / GHC Commits: 91047c03 by Brandon Chinn at 2025-09-11T17:58:18+05:30 Fix for alex-3.5.2.0 (#25623) This INLINE pragma for alexScanUser was added in 9.12, but then I ported the change to alex in 3.5.2.0 (https://github.com/haskell/alex/pull/262). I didn't realize that GHC errors on duplicate INLINE pragmas, so this ended up being a breaking change. This change should be backported into 9.12 (cherry picked from commit a1d923786baed5b001c523fd2a76f133be510b04) - - - - - 1 changed file: - compiler/GHC/Parser/Lexer.x Changes: ===================================== compiler/GHC/Parser/Lexer.x ===================================== @@ -41,6 +41,7 @@ -- Alex "Haskell code fragment top" { +{-# LANGUAGE CPP #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiWayIf #-} @@ -3370,11 +3371,15 @@ topNoLayoutContainsCommas [] = False topNoLayoutContainsCommas (ALRLayout _ _ : ls) = topNoLayoutContainsCommas ls topNoLayoutContainsCommas (ALRNoLayout b _ : _) = b +#ifdef MIN_TOOL_VERSION_alex +#if !MIN_TOOL_VERSION_alex(3,5,2) -- If the generated alexScan/alexScanUser functions are called multiple times -- in this file, alexScanUser gets broken out into a separate function and -- increases memory usage. Make sure GHC inlines this function and optimizes it. -- https://github.com/haskell/alex/pull/262 {-# INLINE alexScanUser #-} +#endif +#endif lexToken :: P (PsLocated Token) lexToken = do View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/91047c0326939af6fc174cd5de42df73... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/91047c0326939af6fc174cd5de42df73... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Zubin (@wz1000)