Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#24011] build: fix ./yb_build.sh --gcc13
Summary: GCC13 detects "nodiscard" attribute violation: ``` /------------------------------------------------------------------------------- | COMPILATION FAILED |------------------------------------------------------------------------------- ../../src/yb/rocksdb/utilities/checkpoint/checkpoint.cc: In function ‘rocksdb::Status rocksdb::checkpoint::CreateCheckpoint(rocksdb::DB*, const std::string&)’: ../../src/yb/rocksdb/utilities/checkpoint/checkpoint.cc:177:62: error: ignoring return value of ‘constexpr const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’, declared with attribute ‘nodiscard’ [-Werror=unused-result] 177 | VLOG(1) << "Deleted dir %s -- %s", checkpoint_dir.c_str(), s_del.ToString().c_str(); | ~~~~~~~~~~~~~~~~~~~~^~ In file included from /usr/include/c++/13/string:54, from ../../src/yb/rocksdb/utilities/checkpoint.h:24, from ../../src/yb/rocksdb/utilities/checkpoint/checkpoint.cc:25: /usr/include/c++/13/bits/basic_string.h:2595:7: note: declared here 2595 | c_str() const _GLIBCXX_NOEXCEPT | ^~~~~ ../../src/yb/rocksdb/utilities/checkpoint/checkpoint.cc:177:88: error: ignoring return value of ‘constexpr const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’, declared with attribute ‘nodiscard’ [-Werror=unused-result] 177 | VLOG(1) << "Deleted dir %s -- %s", checkpoint_dir.c_str(), s_del.ToString().c_str(); | ~~~~~~~~~~~~~~~~~~~~~~^~ /usr/include/c++/13/bits/basic_string.h:2595:7: note: declared here 2595 | c_str() const _GLIBCXX_NOEXCEPT | ^~~~~ cc1plus: all warnings being treated as errors Input files: /home/amartsin/code/yugabyte-db/build/debug-gcc13-dynamic-ninja/src/yb/rocksdb/CMakeFiles/rocksdb.dir/utilities/checkpoint/checkpoint.cc.o /home/amartsin/code/yugabyte-db/src/yb/rocksdb/utilities/checkpoint/checkpoint.cc Output file (from -o): src/yb/rocksdb/CMakeFiles/rocksdb.dir/utilities/checkpoint/checkpoint.cc.o \------------------------------------------------------------------------------- ``` Jira: DB-12898 Test Plan: Jenkins: compile only Reviewers: asrivastava Reviewed By: asrivastava Subscribers: ybase, yql Tags: #jenkins-ready Differential Revision: https://phorge.dev.yugabyte.com/D38172
- Loading branch information