[Git][ghc/ghc][wip/T25623] Fix for alex-3.5.2.0 (#25623)

Brandon Chinn (@brandonchinn178) gitlab at gitlab.haskell.org
Tue Jan 21 05:18:37 UTC 2025



Brandon Chinn pushed to branch wip/T25623 at Glasgow Haskell Compiler / GHC


Commits:
12de7903 by Brandon Chinn at 2025-01-20T21:16:09-08:00
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

- - - - -


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 #-}
@@ -3467,10 +3468,12 @@ topNoLayoutContainsCommas [] = False
 topNoLayoutContainsCommas (ALRLayout _ _ : ls) = topNoLayoutContainsCommas ls
 topNoLayoutContainsCommas (ALRNoLayout b _ : _) = b
 
+#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.
 {-# INLINE alexScanUser #-}
+#endif
 
 lexToken :: P (PsLocated Token)
 lexToken = do



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/12de79036430d68111a34fc948edfee0256f3d32

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/12de79036430d68111a34fc948edfee0256f3d32
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250121/0d4db9dd/attachment-0001.html>


More information about the ghc-commits mailing list