
Alan Zimmerman pushed to branch wip/az/ghc-cpp at Glasgow Haskell Compiler / GHC Commits: 6ff34ae9 by Alan Zimmerman at 2025-04-16T20:10:15+01:00 Use a strict map for macro defines - - - - - 3 changed files: - compiler/GHC/Parser/PreProcess/State.hs - + utils/check-cpp/Example12.hs - + utils/check-cpp/Example13.hs Changes: ===================================== compiler/GHC/Parser/PreProcess/State.hs ===================================== @@ -32,8 +32,8 @@ module GHC.Parser.PreProcess.State ( import Data.List.NonEmpty ((<|)) import Data.List.NonEmpty qualified as NonEmpty -import Data.Map (Map) -import Data.Map qualified as Map +import Data.Map.Strict (Map) +import Data.Map.Strict qualified as Map import Data.Maybe (isJust) import GHC.Base import GHC.Data.StringBuffer @@ -317,7 +317,7 @@ addDefine name def = do addDefine' :: PpState -> MacroName -> MacroDef -> PpState addDefine' s name def = - s{pp_defines = insertMacroDef name def (pp_defines s)} + s{ pp_defines = insertMacroDef name def (pp_defines s)} ppDefine :: MacroName -> MacroDef -> PP () ppDefine name val = addDefine name val ===================================== utils/check-cpp/Example12.hs ===================================== @@ -0,0 +1,6 @@ +{-# LANGUAGE + GHC_CPP + , DeriveGeneric +#-} + +module Example12 where ===================================== utils/check-cpp/Example13.hs ===================================== @@ -0,0 +1,10 @@ +{-# LANGUAGE GHC_CPP #-} +-- {-# OPTIONS -ddump-ghc-cpp -dkeep-comments #-} +module Example13 where + +foo = +#if MIN_VERSION_GLASGOW_HASKELL(19,13,20250101,0) + 'a' +#else + 'b' +#endif View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6ff34ae924b99fa7abe1f96b1741924b... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6ff34ae924b99fa7abe1f96b1741924b... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Alan Zimmerman (@alanz)