Skip to content

Fix C++23 compilation errors in leveldb #47

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 2 commits into from
Mar 7, 2025

Conversation

fanquake
Copy link
Member

@fanquake fanquake commented Jan 30, 2025

Cherry-picks two commits from upstream (google@302786e, google@e829478), which remove the usage of std::aligned_storage/std::aligned_union.

Note the first cherry-pick is not clean, because due to Google tooling issues, it accidently contained a revert of the prior two commits. See google#1249 for more details, as well as https://issues.chromium.org/issues/388068052.

Closes #43.

leveldb Team added 2 commits January 30, 2025 11:58
Remove usages of std::aligned_storage, which is deprecated.
More details about the replacement in https://crbug.com/388068052.

PiperOrigin-RevId: 713346733
cl/713346733 changed the type of some variables to pointers, but didn't adjust the placement new statements. From pkasting@: "I suspect your code is wrong and will crash. An array is a pointer, so taking its address also gives a pointer, which is why it compiles; but the value of that pointer is different. You're no longer providing the address of the storage, but rather the address of the array pointer."

PiperOrigin-RevId: 717926210
@victorvianna
Copy link

FYI the upstream PR landed

@fanquake
Copy link
Member Author

fanquake commented Jan 31, 2025

Chromium has also re-rolled to the current upstream: https://issues.chromium.org/issues/388068052#comment10.

@hebasto
Copy link
Member

hebasto commented Feb 3, 2025

FYI the upstream PR landed

Undraft then?

@fanquake fanquake marked this pull request as ready for review February 3, 2025 16:27
@dergoegge
Copy link
Member

utACK 183e79a

@sipa
Copy link

sipa commented Mar 7, 2025

ACK 183e79a. I don't think the second commit actually changes anything.

@fanquake fanquake merged commit 4188247 into bitcoin-core:bitcoin-fork Mar 7, 2025
@fanquake fanquake deleted the cpp_std_23 branch March 7, 2025 17:03
fanquake added a commit to fanquake/bitcoin that referenced this pull request Mar 7, 2025
4188247086 Merge bitcoin-core/leveldb-subtree#47: Fix C++23 compilation errors in leveldb
183e79a495 Fix speculatively some "placement new" issues in leveldb
82c31046ed Fix C++23 compilation errors in leveldb

git-subtree-dir: src/leveldb
git-subtree-split: 41882470862df219f74cdd38354007b91eb98191
@darosior
Copy link
Member

darosior commented Mar 7, 2025

I don't think the second commit actually changes anything.

Why?

@sipa
Copy link

sipa commented Mar 7, 2025

I tried it in godbolt, and both versions produce the same machine code (but also, my understanding of how arrays work in C++ is that there is no distinction).

fanquake added a commit to fanquake/bitcoin that referenced this pull request Mar 17, 2025
4188247086 Merge bitcoin-core/leveldb-subtree#47: Fix C++23 compilation errors in leveldb
183e79a495 Fix speculatively some "placement new" issues in leveldb
82c31046ed Fix C++23 compilation errors in leveldb

git-subtree-dir: src/leveldb
git-subtree-split: 41882470862df219f74cdd38354007b91eb98191
l0rinc pushed a commit to l0rinc/bitcoin that referenced this pull request Mar 19, 2025
4188247086 Merge bitcoin-core/leveldb-subtree#47: Fix C++23 compilation errors in leveldb
183e79a495 Fix speculatively some "placement new" issues in leveldb
82c31046ed Fix C++23 compilation errors in leveldb

git-subtree-dir: src/leveldb
git-subtree-split: 41882470862df219f74cdd38354007b91eb98191
sr-gi pushed a commit to sr-gi/bitcoin that referenced this pull request Mar 20, 2025
4188247086 Merge bitcoin-core/leveldb-subtree#47: Fix C++23 compilation errors in leveldb
183e79a495 Fix speculatively some "placement new" issues in leveldb
82c31046ed Fix C++23 compilation errors in leveldb

git-subtree-dir: src/leveldb
git-subtree-split: 41882470862df219f74cdd38354007b91eb98191
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.

Compilation with std=c++23
6 participants