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

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Mon Jan 27 21:22:51 UTC 2025



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
a1d92378 by Brandon Chinn at 2025-01-25T15:11:54-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 #-}
@@ -3366,11 +3367,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/a1d923786baed5b001c523fd2a76f133be510b04

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a1d923786baed5b001c523fd2a76f133be510b04
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/20250127/377390a9/attachment-0001.html>


More information about the ghc-commits mailing list