diff --git a/src/Data/Array/Accelerate/Debug/Internal/Flags.hs b/src/Data/Array/Accelerate/Debug/Internal/Flags.hs index 9850f5168..0ff369542 100644 --- a/src/Data/Array/Accelerate/Debug/Internal/Flags.hs +++ b/src/Data/Array/Accelerate/Debug/Internal/Flags.hs @@ -161,6 +161,12 @@ clearFlags = mapM_ clearFlag -- notEnabled = error $ unlines [ "Data.Array.Accelerate: Debugging options are disabled." -- , "Reinstall package 'accelerate' with '-fdebug' to enable them." ] +-- FIXME: HLS requires stubs because it does not process the +-- 'addForeignFilePath' calls when evaluating Template Haskell +-- +-- https://github.com/haskell/haskell-language-server/issues/365 +#ifndef __GHCIDE__ + -- Import the underlying flag variables. These are defined in the file -- cbits/flags.h as a bitfield and initialised at program initialisation. -- @@ -174,6 +180,19 @@ foreign import ccall "&__cmd_line_flags" __cmd_line_flags :: Ptr Word32 foreign import ccall "&__unfolding_use_threshold" unfolding_use_threshold :: Value -- the magic cut-off figure for inlining foreign import ccall "&__max_simplifier_iterations" max_simplifier_iterations :: Value -- maximum number of scalar simplification passes +#else + +__cmd_line_flags :: Ptr Word32 +__cmd_line_flags = undefined + +unfolding_use_threshold :: Value +unfolding_use_threshold = undefined + +max_simplifier_iterations :: Value +max_simplifier_iterations = undefined + +#endif + -- These @-f@ flags can be reversed with @-fno-@ -- seq_sharing = Flag 0 -- recover sharing of sequence expressions diff --git a/src/Data/Atomic.hs b/src/Data/Atomic.hs index 2c1f8ef39..2e1639d86 100644 --- a/src/Data/Atomic.hs +++ b/src/Data/Atomic.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE NoImplicitPrelude #-} @@ -49,6 +50,12 @@ newtype Atomic = Atomic ( Ptr Int64 ) -- write a v -- return a +-- FIXME: HLS requires stubs because it does not process the +-- 'addForeignFilePath' calls when evaluating Template Haskell +-- +-- https://github.com/haskell/haskell-language-server/issues/365 +#ifndef __GHCIDE__ + -- | Get the current value. -- foreign import ccall unsafe "atomic_read_64" read :: Atomic -> IO Int64 @@ -69,6 +76,25 @@ foreign import ccall unsafe "atomic_fetch_and_and_64" and :: Atomic -> Int64 -> -- foreign import ccall unsafe "atomic_fetch_and_sub_64" subtract :: Atomic -> Int64 -> IO Int64 +#else + +read :: Atomic -> IO Int64 +read = undefined + +write :: Atomic -> Int64 -> IO () +write = undefined + +add :: Atomic -> Int64 -> IO Int64 +add = undefined + +and :: Atomic -> Int64 -> IO Int64 +and = undefined + +subtract :: Atomic -> Int64 -> IO Int64 +subtract = undefined + +#endif + -- SEE: [linking to .c files] -- runQ $ do