Skip to content

Commit 70d0db8

Browse files
authored
Merge pull request #495 from IntersectMBO/wenkokke/rc-hascallstackifdebug
refcount: define macro-constraint `HasCallStackIfDebug`
2 parents 1fe7dd1 + ba78b31 commit 70d0db8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src-control/Control/RefCount.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ class RefCounted obj where
200200
getRefCounter :: obj -> RefCounter (FinaliserM obj)
201201

202202
#ifdef NO_IGNORE_ASSERTS
203-
#define HAS_CALL_STACK => HasCallStack
203+
#define HasCallStackIfDebug HasCallStack
204204
#else
205-
#define HAS_CALL_STACK
205+
#define HasCallStackIfDebug ()
206206
#endif
207207

208208
-- GHC says specialising is too complicated! But it's ok, each of these can
@@ -219,7 +219,7 @@ class RefCounted obj where
219219
--
220220
newRef ::
221221
(RefCounted obj, FinaliserM obj ~ m, PrimMonad m)
222-
HAS_CALL_STACK
222+
=> HasCallStackIfDebug
223223
=> m ()
224224
-> (RefCounter m -> obj)
225225
-> m (Ref obj)
@@ -234,7 +234,7 @@ newRef finaliser mkObject = do
234234
--
235235
releaseRef ::
236236
(RefCounted obj, FinaliserM obj ~ m, PrimMonad m, MonadMask m)
237-
HAS_CALL_STACK
237+
=> HasCallStackIfDebug
238238
=> Ref obj
239239
-> m ()
240240
releaseRef ref@Ref{refobj} = do
@@ -268,7 +268,7 @@ deRef ref@Ref{refobj} =
268268
withRef ::
269269
forall m obj a.
270270
PrimMonad m
271-
HAS_CALL_STACK
271+
=> HasCallStackIfDebug
272272
=> Ref obj
273273
-> (obj -> m a)
274274
-> m a
@@ -280,7 +280,7 @@ withRef ref@Ref{refobj} f = do
280280
--
281281
dupRef ::
282282
(RefCounted obj, FinaliserM obj ~ m, PrimMonad m)
283-
HAS_CALL_STACK
283+
=> HasCallStackIfDebug
284284
=> Ref obj
285285
-> m (Ref obj)
286286
dupRef ref@Ref{refobj} = do
@@ -313,7 +313,7 @@ mkWeakRefFromRaw obj = WeakRef obj
313313
--
314314
deRefWeak ::
315315
(RefCounted obj, FinaliserM obj ~ m, PrimMonad m)
316-
HAS_CALL_STACK
316+
=> HasCallStackIfDebug
317317
=> WeakRef obj
318318
-> m (Maybe (Ref obj))
319319
deRefWeak (WeakRef obj) = do

0 commit comments

Comments
 (0)