Skip to content

refactor: add missing overrides #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025

Conversation

fanquake
Copy link
Member

@fanquake fanquake commented May 8, 2025

Fixes instances of:

leveldb-subtree/db/log_test.cc:208:17: error: 'GetName' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
  208 |     std::string GetName() const { return ""; }

To fix compile failures under C++20, and removing warning supression in the main repo.

Fixes instances of:
```bash
leveldb-subtree/db/log_test.cc:208:17: error: 'GetName' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
  208 |     std::string GetName() const { return ""; }
```
Copy link
Member

@laanwj laanwj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 9defe84

@hebasto
Copy link
Member

hebasto commented May 8, 2025

Is there a related upstream commit or issue?

@fanquake
Copy link
Member Author

fanquake commented May 8, 2025

Is there a related upstream commit or issue?

I don't think so. Upstream still uses C++11, and I don't think they would take this change.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 9defe84, tested on Ubuntu 25.04 with GCC 14.2.0 and Clang 20.1.2.

Additionally tested with the Bitcoin Core code base being patched with:

--- a/cmake/leveldb.cmake
+++ b/cmake/leveldb.cmake
@@ -90,9 +90,6 @@ else()
   try_append_cxx_flags("-Wconditional-uninitialized" TARGET nowarn_leveldb_interface SKIP_LINK
     IF_CHECK_PASSED "-Wno-conditional-uninitialized"
   )
-  try_append_cxx_flags("-Wsuggest-override" TARGET nowarn_leveldb_interface SKIP_LINK
-    IF_CHECK_PASSED "-Wno-suggest-override"
-  )
 endif()
 
 target_link_libraries(leveldb PRIVATE

I also have to notice that compiling fails without this patch:

--- a/benchmarks/db_bench_sqlite3.cc
+++ b/benchmarks/db_bench_sqlite3.cc
@@ -5,6 +5,7 @@
 #include <sqlite3.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <ctime>
 
 #include "util/histogram.h"
 #include "util/random.h"

@l0rinc
Copy link

l0rinc commented May 8, 2025

Upstream still uses C++11

It's worse actually, it uses C++17 syntax that doesn't even compile currently - google#1251

@fanquake fanquake merged commit 113db49 into bitcoin-core:bitcoin-fork May 13, 2025
fanquake added a commit to fanquake/bitcoin that referenced this pull request May 13, 2025
113db4962b Merge bitcoin-core/leveldb-subtree#51: refactor: add missing overrides
9defe8494a refactor: add missing overrides

git-subtree-dir: src/leveldb
git-subtree-split: 113db4962b8be416c17ad2b4bdcc5514c51d7181
fanquake added a commit to fanquake/bitcoin that referenced this pull request May 16, 2025
113db4962b Merge bitcoin-core/leveldb-subtree#51: refactor: add missing overrides
9defe8494a refactor: add missing overrides

git-subtree-dir: src/leveldb
git-subtree-split: 113db4962b8be416c17ad2b4bdcc5514c51d7181
@fanquake fanquake deleted the add_missing_override branch May 16, 2025 13:16
hebasto added a commit to bitcoin/bitcoin that referenced this pull request May 17, 2025
7015052 build: remove Wsuggest-override suppression from leveldb build (fanquake)
e2c84b8 Squashed 'src/leveldb/' changes from 4188247086..113db4962b (fanquake)

Pull request description:

  Pulls in
  * bitcoin-core/leveldb-subtree#51

  Remove the related warning suppression.

ACKs for top commit:
  l0rinc:
    utACK 7015052
  hebasto:
    ACK 7015052, I've updated the `leveldb` subtree locally and got zero diff with this branch.

Tree-SHA512: 1ac7c8ecc9025086b429e12c22fc25f654eaf68fc9500b95341fb635cea12e7f80d69298cff120e8557a4f2f5809956a3b158cdb4db745cfa605c0df6f346423
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants