Explicitly define __STDC_FORMAT_MACROS for PRIu64
Summary:
Builds are failing on RHEL machines because of PRIu64.
lvm/projects/compiler-rt/lib/gwp_asan/guarded_pool_allocator.cpp:420:50: error: expected ')'
`snprintf(ThreadBuffer, kThreadBufferLen, "%" PRIu64, ThreadID);`
inttypes.h in RHEL uses PRIu64 macros only when __STDC_FORMAT_MACROS is defined.
Author: DTharun
Reviewers: hctim
Reviewed By: hctim
Differential Revision: https://reviews.llvm.org/D64388
llvm-svn: 365801
GitOrigin-RevId: af3dc759e786324c8a38fa7849da0791b99e67b0
diff --git a/guarded_pool_allocator.cpp b/guarded_pool_allocator.cpp
index 3180684..7e3628e 100644
--- a/guarded_pool_allocator.cpp
+++ b/guarded_pool_allocator.cpp
@@ -10,6 +10,12 @@
#include "gwp_asan/options.h"
+// RHEL creates the PRIu64 format macro (for printing uint64_t's) only when this
+// macro is defined before including <inttypes.h>.
+#ifndef __STDC_FORMAT_MACROS
+ #define __STDC_FORMAT_MACROS 1
+#endif
+
#include <assert.h>
#include <inttypes.h>
#include <stdio.h>