[Git][ghc/ghc][wip/tracing-rework] rts/Trace: Ensure that debugTrace arguments are used

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Wed Jun 28 16:40:29 UTC 2023



Ben Gamari pushed to branch wip/tracing-rework at Glasgow Haskell Compiler / GHC


Commits:
d2703805 by Ben Gamari at 2023-06-28T12:40:26-04:00
rts/Trace: Ensure that debugTrace arguments are used

As debugTrace is a macro we must take care to ensure that
the fact is clear to the compiler lest we see warnings.

- - - - -


1 changed file:

- rts/Trace.h


Changes:

=====================================
rts/Trace.h
=====================================
@@ -238,23 +238,15 @@ void traceThreadLabel_(Capability *cap,
 /*
  * Emit a debug message (only when DEBUG is defined)
  */
-#if defined(DEBUG)
 #define debugTrace(class, msg, ...)             \
-    if (RTS_UNLIKELY(class)) {                  \
+    if (DEBUG && RTS_UNLIKELY(class)) {         \
         trace_(msg, ##__VA_ARGS__);             \
     }
-#else
-#define debugTrace(class, str, ...) /* nothing */
-#endif
 
-#if defined(DEBUG)
-#define debugTraceCap(class, cap, msg, ...)      \
-    if (RTS_UNLIKELY(class)) {                  \
+#define debugTraceCap(class, cap, msg, ...)     \
+    if (DEBUG && RTS_UNLIKELY(class)) {         \
         traceCap_(cap, msg, ##__VA_ARGS__);     \
     }
-#else
-#define debugTraceCap(class, cap, str, ...) /* nothing */
-#endif
 
 /*
  * Emit a message/event describing the state of a thread



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d27038050d2955a166b3f9e36a7484015ef08568
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/20230628/3e18d2b5/attachment-0001.html>


More information about the ghc-commits mailing list