[compiler-rt] 197bad5 - [profile] Fifth speculative fix for Android after D68351

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 17:05:22 PDT 2019


Author: Vedant Kumar
Date: 2019-10-31T17:03:52-07:00
New Revision: 197bad50896c5b05d31e8aa7839d0a9357c6a4a3

URL: https://github.com/llvm/llvm-project/commit/197bad50896c5b05d31e8aa7839d0a9357c6a4a3
DIFF: https://github.com/llvm/llvm-project/commit/197bad50896c5b05d31e8aa7839d0a9357c6a4a3.diff

LOG: [profile] Fifth speculative fix for Android after D68351

Use the printf macros from inttypes.h to sidestep -Wformat issues:

/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/lib/profile/InstrProfilingFile.c:425:14: error: format specifies type 'long long' but the argument has type 'off_t' (aka 'long') [-Werror,-Wformat]
             CurrentFileOffset, PageSize);
             ^~~~~~~~~~~~~~~~~
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/lib/profile/InstrProfilingPort.h:114:50: note: expanded from macro 'PROF_ERR'
  fprintf(stderr, "LLVM Profile Error: " Format, __VA_ARGS__);
                                         ~~~~~~  ^~~~~~~~~~~
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/lib/profile/InstrProfilingFile.c:461:41: error: format specifies type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat]
        strerror(errno), CountersBegin, PageAlignedCountersLength, Fileno,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/lib/profile/InstrProfilingPort.h:114:50: note: expanded from macro 'PROF_ERR'
  fprintf(stderr, "LLVM Profile Error: " Format, __VA_ARGS__);
                                         ~~~~~~  ^~~~~~~~~~~
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/lib/profile/InstrProfilingFile.c:462:9: error: format specifies type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat]
        FileOffsetToCounters);
        ^~~~~~~~~~~~~~~~~~~~
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/lib/profile/InstrProfilingPort.h:114:50: note: expanded from macro 'PROF_ERR'
  fprintf(stderr, "LLVM Profile Error: " Format, __VA_ARGS__);

Added: 
    

Modified: 
    compiler-rt/lib/profile/InstrProfilingFile.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index d722b86f7c42..0086b9fc6fbe 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -426,8 +426,8 @@ static void initializeProfileForContinuousMode(void) {
   off_t OffsetModPage = CurrentFileOffset % PageSize;
   if (OffsetModPage != 0) {
     PROF_ERR("Continuous counter sync mode is enabled, but raw profile is not"
-             "page-aligned. CurrentFileOffset = %lld, pagesz = %u.\n",
-             CurrentFileOffset, PageSize);
+             "page-aligned. CurrentFileOffset = %" PRIu64 ", pagesz = %u.\n",
+             (uint64_t) CurrentFileOffset, PageSize);
     return;
   }
 
@@ -460,9 +460,9 @@ static void initializeProfileForContinuousMode(void) {
     PROF_ERR(
         "Continuous counter sync mode is enabled, but mmap() failed (%s).\n"
         "  - CountersBegin: %p\n"
-        "  - PageAlignedCountersLength: %llu\n"
+        "  - PageAlignedCountersLength: %" PRIu64 "\n"
         "  - Fileno: %d\n"
-        "  - FileOffsetToCounters: %llu\n",
+        "  - FileOffsetToCounters: %" PRIu64 "\n",
         strerror(errno), CountersBegin, PageAlignedCountersLength, Fileno,
         FileOffsetToCounters);
     return;


        


More information about the llvm-commits mailing list