summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Phillips <mitchphillips@outlook.com>2019-07-11 18:07:03 +0000
committerMitch Phillips <mitchphillips@outlook.com>2019-07-11 18:07:03 +0000
commit364f9d148f9b53afecd66ae8c6e60d63f0e0207f (patch)
tree4189547e077dc29ddbdff9511cfffad38ce78f30
parent1a513e395ea23df10e58c807ce264fbe5df596f7 (diff)
downloadcompiler-rt-364f9d148f9b53afecd66ae8c6e60d63f0e0207f.tar.gz
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@365801 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/gwp_asan/guarded_pool_allocator.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/gwp_asan/guarded_pool_allocator.cpp b/lib/gwp_asan/guarded_pool_allocator.cpp
index 318068404..7e3628eba 100644
--- a/lib/gwp_asan/guarded_pool_allocator.cpp
+++ b/lib/gwp_asan/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>