From 5a263160b6b9053bda0658fabe1e3282852a37fa Mon Sep 17 00:00:00 2001 From: Anton Gladky Date: Tue, 15 Oct 2024 21:33:40 +0200 Subject: [PATCH 1/3] Fix GCC-14 compilation warning. third_party/fmt/include/fmt/ranges.h:215:59: error: self-comparison always evaluates to true [-Werror=tautological-compare] 215 | integer_sequence); Is == Is is always true. Upstream uses Is >=0 which is more meaningful to check non-negative index values. https://github.com/fmtlib/fmt/blob/cc2ba8f9ede4e5ae3262f43f3e4d07a22a9acdfc/include/fmt/ranges.h#L162 --- third_party/fmt/include/fmt/ranges.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/fmt/include/fmt/ranges.h b/third_party/fmt/include/fmt/ranges.h index 65beba5bf..c9536e0fe 100644 --- a/third_party/fmt/include/fmt/ranges.h +++ b/third_party/fmt/include/fmt/ranges.h @@ -212,7 +212,7 @@ class is_tuple_formattable_ { template class is_tuple_formattable_ { template static std::true_type check2(index_sequence, - integer_sequence); + integer_sequence= 0)...>); static std::false_type check2(...); template static decltype(check2( From 285738fcb44f97cd55921783985e0194efbbba0b Mon Sep 17 00:00:00 2001 From: Anton Gladky Date: Tue, 15 Oct 2024 21:37:57 +0200 Subject: [PATCH 2/3] Fix GCC-14 compilation warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bustub/src/type/timestamp_type.cpp: In member function ‘virtual std::string bustub::TimestampType::ToString(const bustub::Value&) const’: bustub/src/type/timestamp_type.cpp:130:29: error: ‘%02d’ directive output may be truncated writing between 2 and 10 bytes into a region of size 5 [-Werror=format-truncation=] 130 | snprintf(zone, zone_len, "%02d", tz); // NOLINT | ^~~~ bustub/src/type/timestamp_type.cpp:130:28: note: directive argument in the range [0, 2147483647] 130 | snprintf(zone, zone_len, "%02d", tz); // NOLINT | ^~~~~~ bustub/src/type/timestamp_type.cpp:130:11: note: ‘snprintf’ output between 3 and 11 bytes into a destination of size 5 130 | snprintf(zone, zone_len, "%02d", tz); // NOLINT --- src/type/timestamp_type.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/type/timestamp_type.cpp b/src/type/timestamp_type.cpp index f0b5e7d93..4abeac059 100644 --- a/src/type/timestamp_type.cpp +++ b/src/type/timestamp_type.cpp @@ -115,7 +115,7 @@ auto TimestampType::ToString(const Value &val) const -> std::string { tm /= 32; auto month = static_cast(tm); const size_t date_str_len = 30; - const size_t zone_len = 5; + const size_t zone_len = 6; char str[date_str_len]; char zone[zone_len]; snprintf(str, date_str_len, "%04d-%02d-%02d %02d:%02d:%02d.%06d", year, month, day, hour, min, sec, micro); @@ -127,7 +127,7 @@ auto TimestampType::ToString(const Value &val) const -> std::string { if (tz < 0) { tz = -tz; } - snprintf(zone, zone_len, "%02d", tz); // NOLINT + snprintf(zone, std::min(zone_len, sizeof(zone)), "%02d", tz); // NOLINT str[27] = 0; return std::string(std::string(str) + std::string(zone)); } From 75a861013442c1e0f191ee6370a7a59e35ef1ab3 Mon Sep 17 00:00:00 2001 From: Anton Gladky Date: Tue, 15 Oct 2024 21:42:03 +0200 Subject: [PATCH 3/3] Fix clang-16 compilation warning (error: unqualified call to std::move) --- third_party/backward-cpp/backward.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/third_party/backward-cpp/backward.hpp b/third_party/backward-cpp/backward.hpp index ac7ad5173..2902608fa 100644 --- a/third_party/backward-cpp/backward.hpp +++ b/third_party/backward-cpp/backward.hpp @@ -2443,8 +2443,8 @@ class TraceResolverLinuxImpl // If we have a valid elf handle, return the new elf handle // and file handle and discard the original ones if (debuglink_elf) { - elf_handle = move(debuglink_elf); - file_handle = move(debuglink_file); + elf_handle = std::move(debuglink_elf); + file_handle = std::move(debuglink_file); } } } @@ -2466,9 +2466,9 @@ class TraceResolverLinuxImpl dwarf_handle.reset(dwarf_debug); - r.file_handle = move(file_handle); - r.elf_handle = move(elf_handle); - r.dwarf_handle = move(dwarf_handle); + r.file_handle = std::move(file_handle); + r.elf_handle = std::move(elf_handle); + r.dwarf_handle = std::move(dwarf_handle); return r; }