[compiler-rt] r365801 - Explicitly define __STDC_FORMAT_MACROS for PRIu64

Mitch Phillips via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 11:07:03 PDT 2019


Author: hctim
Date: Thu Jul 11 11:07:03 2019
New Revision: 365801

URL: http://llvm.org/viewvc/llvm-project?rev=365801&view=rev
Log:
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

Modified:
    compiler-rt/trunk/lib/gwp_asan/guarded_pool_allocator.cpp

Modified: compiler-rt/trunk/lib/gwp_asan/guarded_pool_allocator.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/gwp_asan/guarded_pool_allocator.cpp?rev=365801&r1=365800&r2=365801&view=diff
==============================================================================
--- compiler-rt/trunk/lib/gwp_asan/guarded_pool_allocator.cpp (original)
+++ compiler-rt/trunk/lib/gwp_asan/guarded_pool_allocator.cpp Thu Jul 11 11:07:03 2019
@@ -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>




More information about the llvm-commits mailing list