[compiler-rt] r198644 - Use the PRIu64 macro for printing a uint64_t.

Kaelyn Uhrain rikka at google.com
Mon Jan 6 15:17:27 PST 2014


Author: rikka
Date: Mon Jan  6 17:17:27 2014
New Revision: 198644

URL: http://llvm.org/viewvc/llvm-project?rev=198644&view=rev
Log:
Use the PRIu64 macro for printing a uint64_t.

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.

Modified:
    compiler-rt/trunk/lib/profile/PGOProfiling.c

Modified: compiler-rt/trunk/lib/profile/PGOProfiling.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/PGOProfiling.c?rev=198644&r1=198643&r2=198644&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/PGOProfiling.c (original)
+++ compiler-rt/trunk/lib/profile/PGOProfiling.c Mon Jan  6 17:17:27 2014
@@ -7,6 +7,7 @@
 |*
 \*===----------------------------------------------------------------------===*/
 
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -37,7 +38,7 @@ void llvm_pgo_emit(const char *MangledNa
   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");
 }
 





More information about the llvm-commits mailing list