Use the PRIu64 macro for printing a uint64_t.
authorKaelyn Uhrain <rikka@google.com>
Mon, 6 Jan 2014 23:17:27 +0000 (23:17 +0000)
committerKaelyn Uhrain <rikka@google.com>
Mon, 6 Jan 2014 23:17:27 +0000 (23:17 +0000)
Otherwise on (some) 64-bit systems, -Wformat will trigger a warning
because uint64_t is an 'unsigned long' not an 'unsigned long long'.
Consequently, PGOProfiling.c would fail to build if -Werror and
-Wformat are both enabled.

llvm-svn: 198644

compiler-rt/lib/profile/PGOProfiling.c

index 5bb216a..6c728dd 100644 (file)
@@ -7,6 +7,7 @@
 |*
 \*===----------------------------------------------------------------------===*/
 
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -37,7 +38,7 @@ void llvm_pgo_emit(const char *MangledName, uint32_t NumCounters,
   uint32_t i;
   fprintf(OutputFile, "%s %u\n", MangledName, NumCounters);
   for (i = 0; i < NumCounters; ++i)
-    fprintf(OutputFile, "%llu\n", Counters[i]);
+    fprintf(OutputFile, "%" PRIu64 "\n", Counters[i]);
   fprintf(OutputFile, "\n");
 }