[Lldb-commits] [lldb] 89dc706 - [lldb] Fix printf format errors

Kazu Hirata via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 25 10:39:29 PST 2024


Author: Kazu Hirata
Date: 2024-01-25T10:39:24-08:00
New Revision: 89dc7063f6c81d468a61b71b4ca612e22cb87a46

URL: https://github.com/llvm/llvm-project/commit/89dc7063f6c81d468a61b71b4ca612e22cb87a46
DIFF: https://github.com/llvm/llvm-project/commit/89dc7063f6c81d468a61b71b4ca612e22cb87a46.diff

LOG: [lldb] Fix printf format errors

This patch fixes:

  lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp:1108:39: error:
  format specifies type 'long long' but the argument has type
  'std::time_t' (aka 'long') [-Werror,-Wformat]

  lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp:1116:64: error:
  format specifies type 'long long' but the argument has type
  'std::time_t' (aka 'long') [-Werror,-Wformat]

Added: 
    

Modified: 
    lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index c5bed2cee815078..d0bdbe1fd4d91ac 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -1105,7 +1105,7 @@ bool lldb_private::formatters::LibcxxChronoSysSecondsSummaryProvider(
 
   const std::time_t seconds = ptr_sp->GetValueAsSigned(0);
   if (seconds < chrono_timestamp_min || seconds > chrono_timestamp_max)
-    stream.Printf("timestamp=%lld s", seconds);
+    stream.Printf("timestamp=%" PRIu64 " s", static_cast<uint64_t>(seconds));
   else {
     std::array<char, 128> str;
     std::size_t size =
@@ -1113,7 +1113,8 @@ bool lldb_private::formatters::LibcxxChronoSysSecondsSummaryProvider(
     if (size == 0)
       return false;
 
-    stream.Printf("date/time=%s timestamp=%lld s", str.data(), seconds);
+    stream.Printf("date/time=%s timestamp=%" PRIu64 " s", str.data(),
+                  static_cast<uint64_t>(seconds));
   }
 
   return true;


        


More information about the lldb-commits mailing list