[Git][ghc/ghc][wip/ghc-debug] Rearrange #ifdef with GHC version

Sven Tennie gitlab at gitlab.haskell.org
Fri Jul 24 11:02:06 UTC 2020



Sven Tennie pushed to branch wip/ghc-debug at Glasgow Haskell Compiler / GHC


Commits:
5f73058e by Sven Tennie at 2020-07-24T13:01:58+02:00
Rearrange #ifdef with GHC version

This prevents some "unused" warnings.

- - - - -


1 changed file:

- libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/PeekProfInfo_ProfilingEnabled.hsc


Changes:

=====================================
libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/PeekProfInfo_ProfilingEnabled.hsc
=====================================
@@ -3,6 +3,8 @@ module GHC.Exts.Heap.ProfInfo.PeekProfInfo_ProfilingEnabled(
     peekStgTSOProfInfo
 ) where
 
+#if __GLASGOW_HASKELL__ >= 811
+
 -- Manually defining PROFILING gives the #peek and #poke macros an accurate
 -- representation of the C structures when hsc2hs runs. This is valid because
 -- a non-profiling build would use
@@ -14,6 +16,7 @@ module GHC.Exts.Heap.ProfInfo.PeekProfInfo_ProfilingEnabled(
 
 import Prelude
 import Foreign
+
 import Foreign.C.String
 import GHC.Exts.Heap.ProfInfo.Types
 
@@ -43,9 +46,6 @@ data Cache = Cache {
 type DecoderMonad a = StateT Cache IO a
 
 peekStgTSOProfInfo :: Ptr a -> IO (Maybe StgTSOProfInfo)
-#if __GLASGOW_HASKELL__ < 811
-peekStgTSOProfInfo _ = return Nothing
-#else
 peekStgTSOProfInfo tsoPtr = do
     print $ "peekStgTSOProfInfo - tsoPtr : " ++ show tsoPtr
     cccs_ptr <- peekByteOff tsoPtr cccsOffset
@@ -185,4 +185,13 @@ peekIndexTable loopBreakers ptr = do
                     return $ Just result
     where
         ptrAsInt = ptrToInt ptr
+
+#else
+import Prelude
+import Foreign
+
+import GHC.Exts.Heap.ProfInfo.Types
+
+peekStgTSOProfInfo :: Ptr a -> IO (Maybe StgTSOProfInfo)
+peekStgTSOProfInfo _ = return Nothing
 #endif



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5f73058e52b47950acbeffc929c137ffe6bb1cd2

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5f73058e52b47950acbeffc929c137ffe6bb1cd2
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/20200724/b67b8fcb/attachment-0001.html>


More information about the ghc-commits mailing list