Avoidable compiler warnings in `EventLog.c`
Summary
As of 2057c77d, the EventLog.c
code uses FMT_Int
to print C-int
values cast to (long long)
for no particular reason. On LP64-systems FreeBSD defines PRId64
as ld
, not lld
, and compiler warnings are generated for the code in question. A simple fix is below. There is no need for either FMT_Int
or the casts to (long long)
. Just print the int
values with %d
:
--- a/rts/eventlog/EventLog.c
+++ b/rts/eventlog/EventLog.c
@@ -756,10 +756,8 @@ void postCapsetVecEvent (EventTypeNum tag,
// 1 + strlen to account for the trailing \0, used as separator
int increment = 1 + strlen(argv[i]);
if (size + increment > EVENT_PAYLOAD_SIZE_MAX) {
- errorBelch("Event size exceeds EVENT_PAYLOAD_SIZE_MAX, record only %"
- FMT_Int " out of %" FMT_Int " args",
- (long long) i,
- (long long) argc);
+ errorBelch("Event size exceeds EVENT_PAYLOAD_SIZE_MAX, record only "
+ "%d out of %d args", i, argc);
argc = i;
break;
} else {
Steps to reproduce
Build GHC 9.4.4 on FreeBSD 12.3
Expected behavior
Avoid the compiler warnings.
Environment
- GHC version used: 9.4.4
Optional:
- Operating System: FreeBSD 12.3
- System Architecture: x86_64