Skip to content

Commit

Permalink
[#24011] build: fix ./yb_build.sh --gcc13
Browse files Browse the repository at this point in the history
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
andrei-mart committed Sep 18, 2024
1 parent 2beb872 commit 28d0d8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/yb/rocksdb/utilities/checkpoint/checkpoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Status CreateCheckpoint(DB* db, const std::string& checkpoint_dir) {
if (s.ok()) {
if (delete_checkpoint_dir) {
const Status s_del = DeleteRecursively(db->GetCheckpointEnv(), checkpoint_dir);
VLOG(1) << "Deleted dir %s -- %s", checkpoint_dir.c_str(), s_del.ToString().c_str();
VLOG(1) << "Deleted dir " << checkpoint_dir.c_str() << " -- " << s_del.ToString().c_str();
}

// move tmp private backup to real snapshot directory
Expand Down

0 comments on commit 28d0d8e

Please sign in to comment.