diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-02-04 18:51:50 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-02-06 01:43:56 -0500 |
commit | 633296bca950f0ef17313f8487d2f5ddd369bc4f (patch) | |
tree | 717761b8b031826c2edec6b4aca208e02340a2e1 /rts | |
parent | fc083b480adedf26d47f880402f111680ec34183 (diff) | |
download | haskell-633296bca950f0ef17313f8487d2f5ddd369bc4f.tar.gz |
Fix macro redefinition warnings for PRINTF
* Move `PRINTF` macro from `Stats.h` to `Stats.c` as it's only needed in
the latter.
* Undefine `PRINTF` at the end of `Messages.h` to avoid leaking it.
Diffstat (limited to 'rts')
-rw-r--r-- | rts/Stats.c | 10 | ||||
-rw-r--r-- | rts/Stats.h | 9 | ||||
-rw-r--r-- | rts/include/rts/Messages.h | 2 |
3 files changed, 12 insertions, 9 deletions
diff --git a/rts/Stats.c b/rts/Stats.c index ea57f60e70..fb87a6d8e4 100644 --- a/rts/Stats.c +++ b/rts/Stats.c @@ -26,6 +26,16 @@ #include <string.h> // for memset +#if defined(mingw32_HOST_OS) +/* On Win64, if we say "printf" then gcc thinks we are going to use + MS format specifiers like %I64d rather than %llu */ +#define PRINTF gnu_printf +#else +/* However, on OS X, "gnu_printf" isn't recognised */ +#define PRINTF printf +#endif + + #if defined(THREADED_RTS) // Protects all statistics below Mutex stats_mutex; diff --git a/rts/Stats.h b/rts/Stats.h index 5268c3ae63..ebbb197cf9 100644 --- a/rts/Stats.h +++ b/rts/Stats.h @@ -14,15 +14,6 @@ #include "BeginPrivate.h" -#if defined(mingw32_HOST_OS) -/* On Win64, if we say "printf" then gcc thinks we are going to use - MS format specifiers like %I64d rather than %llu */ -#define PRINTF gnu_printf -#else -/* However, on OS X, "gnu_printf" isn't recognised */ -#define PRINTF printf -#endif - struct gc_thread_; void stat_startInit(void); diff --git a/rts/include/rts/Messages.h b/rts/include/rts/Messages.h index b19c02de3d..f9b3009c20 100644 --- a/rts/include/rts/Messages.h +++ b/rts/include/rts/Messages.h @@ -103,3 +103,5 @@ extern RtsMsgFunction rtsFatalInternalErrorFn; extern RtsMsgFunctionRetLen rtsDebugMsgFn; extern RtsMsgFunction rtsErrorMsgFn; extern RtsMsgFunction rtsSysErrorMsgFn; + +#undef PRINTF |