Skip to content

Commit 89dc706

Browse files
[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]
1 parent 8a0ff19 commit 89dc706

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,15 +1105,16 @@ bool lldb_private::formatters::LibcxxChronoSysSecondsSummaryProvider(
11051105

11061106
const std::time_t seconds = ptr_sp->GetValueAsSigned(0);
11071107
if (seconds < chrono_timestamp_min || seconds > chrono_timestamp_max)
1108-
stream.Printf("timestamp=%lld s", seconds);
1108+
stream.Printf("timestamp=%" PRIu64 " s", static_cast<uint64_t>(seconds));
11091109
else {
11101110
std::array<char, 128> str;
11111111
std::size_t size =
11121112
std::strftime(str.data(), str.size(), "%FT%H:%M:%SZ", gmtime(&seconds));
11131113
if (size == 0)
11141114
return false;
11151115

1116-
stream.Printf("date/time=%s timestamp=%lld s", str.data(), seconds);
1116+
stream.Printf("date/time=%s timestamp=%" PRIu64 " s", str.data(),
1117+
static_cast<uint64_t>(seconds));
11171118
}
11181119

11191120
return true;

0 commit comments

Comments
 (0)