Skip to content

Commit e28b372

Browse files
committed
Apply CLASH_MULTIPLE_HIDDEN to clash-prelude:doctests
Current doctest(-parallel) can't pickup such defines automatically, so we have to do it manually. And also define CLASH_OPAQUE, to prevent a ton of warnings.
1 parent c896f21 commit e28b372

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

cabal.project

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ write-ghc-environment-files: always
1616
-- index state, to go along with the cabal.project.freeze file. update the index
1717
-- state by running `cabal update` twice and looking at the index state it
1818
-- displays to you (as the second update will be a no-op)
19-
index-state: 2023-09-12T05:36:44Z
19+
index-state: 2023-10-18T12:11:41Z
2020

2121
-- For some reason the `clash-testsuite` executable fails to run without
2222
-- this, as it cannot find the related library...
@@ -81,4 +81,3 @@ package recursion-schemes
8181

8282
package regex-tdfa
8383
optimization: 2
84-

clash-prelude/clash-prelude.cabal

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,15 @@ test-suite doctests
385385
build-depends:
386386
base,
387387
clash-prelude,
388-
doctest-parallel >= 0.2 && < 0.4,
388+
doctest-parallel >= 0.3.1 && < 0.4,
389389
filepath
390390

391391
if flag(workaround-ghc-mmap-crash)
392392
ghc-options: -with-rtsopts=-xm20000000
393393

394+
if flag(multiple-hidden)
395+
CPP-Options: -DCLASH_MULTIPLE_HIDDEN
396+
394397

395398
test-suite unittests
396399
import: common-options

clash-prelude/tests/doctests.hs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1+
{-# LANGUAGE CPP #-}
12
module Main where
23

3-
import System.Environment (getArgs)
44
import Test.DocTest (mainFromCabal)
5+
import System.Environment (getArgs)
56

67
main :: IO ()
7-
main = mainFromCabal "clash-prelude" =<< getArgs
8+
main = mainFromCabal "clash-prelude" =<< fmap (extraArgs ++) getArgs
9+
10+
extraArgs :: [String]
11+
extraArgs = map ("--ghc-arg=" ++)
12+
[
13+
#if __GLASGOW_HASKELL__ >= 904
14+
"-DCLASH_OPAQUE=OPAQUE"
15+
#else
16+
"-DCLASH_OPAQUE=NOINLINE"
17+
#endif
18+
#ifdef CLASH_MULTIPLE_HIDDEN
19+
, "-DCLASH_MULTIPLE_HIDDEN"
20+
#endif
21+
]

0 commit comments

Comments
 (0)