Skip to content
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

C++20 compatibility #6697

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
af91b57
Fix implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20
syoliver-se Mar 22, 2020
880549c
Allow to choose C++ version in cmake command line
syoliver-se Mar 22, 2020
4a1df6e
Fix deprecated copy warning in gcc 9
syoliver-se Apr 5, 2020
2756589
Minimal Rebuild is deprecated in visual studio since 2015 and is forb…
syoliver-se Apr 5, 2020
cea96d0
random_shuffle is deprecated in C++14 and removed in C++17
syoliver-se Apr 5, 2020
4e46260
Fix implicit this lambda capture deprecation
syoliver-se Apr 5, 2020
96f7359
Add implicit lambda capture in raw makefile
syoliver-se Apr 6, 2020
5962870
Add MSVC2019 to AppVeyor
syoliver-se Apr 6, 2020
d31e395
Add gcc-9 with c++11 and c++20 to travis
syoliver-se Apr 6, 2020
43eee91
Merge remote-tracking branch 'origin/master' into pr/6648
pdillinger Apr 10, 2020
87f3151
Reduce cmake variants built on each PR
pdillinger Apr 10, 2020
831fb29
Fix whitespace / noeol in CMakeLists.txt
pdillinger Apr 10, 2020
3de7ca9
Tweak so that no configuration change is needed
pdillinger Apr 10, 2020
c9e951e
Unified RandomShuffle
pdillinger Apr 13, 2020
756ea7f
Remove 'this' capture from folly import
pdillinger Apr 14, 2020
1b7b028
Remove an unnecessary capture spec
pdillinger Apr 14, 2020
dda5107
make format
pdillinger Apr 14, 2020
427a33d
Merge remote-tracking branch 'origin/master' into cxx20
pdillinger Apr 14, 2020
882a9d5
Fixup after merge
pdillinger Apr 14, 2020
c19c8ac
Better capture solution for Baton.h
pdillinger Apr 14, 2020
da5b61e
Actually, just use explicit capture
pdillinger Apr 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make format
  • Loading branch information
pdillinger committed Apr 14, 2020
commit dda51076ca8957e61c23f933ba57cb0222a33e4d
1 change: 0 additions & 1 deletion db/db_bloom_filter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "rocksdb/perf_context.h"
#include "table/block_based/filter_policy_internal.h"


namespace ROCKSDB_NAMESPACE {

namespace {
Expand Down
15 changes: 7 additions & 8 deletions memory/concurrent_arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ class ConcurrentArena : public Allocator {
size_t huge_page_size = 0);

char* Allocate(size_t bytes) override {
return AllocateImpl(bytes, false /*force_arena*/,
[ROCKSDB_THIS_LAMBDA_CAPTURE]() {
return arena_.Allocate(bytes);
});
return AllocateImpl(
bytes, false /*force_arena*/,
[ROCKSDB_THIS_LAMBDA_CAPTURE]() { return arena_.Allocate(bytes); });
}

char* AllocateAligned(size_t bytes, size_t huge_page_size = 0,
Expand All @@ -62,10 +61,10 @@ class ConcurrentArena : public Allocator {
(rounded_up % sizeof(void*)) == 0);

return AllocateImpl(rounded_up, huge_page_size != 0 /*force_arena*/,
[ROCKSDB_THIS_LAMBDA_CAPTURE]() {
return arena_.AllocateAligned(rounded_up, huge_page_size, logger);
}
);
[ROCKSDB_THIS_LAMBDA_CAPTURE]() {
return arena_.AllocateAligned(rounded_up,
huge_page_size, logger);
});
}

size_t ApproximateMemoryUsage() const {
Expand Down
15 changes: 6 additions & 9 deletions table/block_based/block_based_table_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -662,17 +662,14 @@ BlockBasedTableBuilder::BlockBasedTableBuilder(
rep_->pc_rep->compress_thread_pool.reserve(
rep_->compression_opts.parallel_threads);
for (uint32_t i = 0; i < rep_->compression_opts.parallel_threads; i++) {
rep_->pc_rep->compress_thread_pool.emplace_back([ROCKSDB_THIS_LAMBDA_CAPTURE] {
BGWorkCompression(*(rep_->compression_ctxs[i]),
rep_->verify_ctxs[i].get());
});
rep_->pc_rep->compress_thread_pool.emplace_back(
[ROCKSDB_THIS_LAMBDA_CAPTURE] {
BGWorkCompression(*(rep_->compression_ctxs[i]),
rep_->verify_ctxs[i].get());
});
}
rep_->pc_rep->write_thread.reset(new port::Thread(
[ROCKSDB_THIS_LAMBDA_CAPTURE] {
BGWorkWriteRawBlock();
}
)
);
[ROCKSDB_THIS_LAMBDA_CAPTURE] { BGWorkWriteRawBlock(); }));
}
}

Expand Down
7 changes: 4 additions & 3 deletions third-party/folly/folly/synchronization/Baton.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ class Baton {
bool tryWaitSlow(
const std::chrono::time_point<Clock, Duration>& deadline,
const WaitOptions& opt) noexcept {

// Avoid implicit/explicit capture 'this' because C++ standards change
const auto thiz = this;
switch (detail::spin_pause_until(deadline, opt, [thiz] { return thiz->ready(); })) {
switch (detail::spin_pause_until(deadline, opt,
[thiz] { return thiz->ready(); })) {
case detail::spin_result::success:
return true;
case detail::spin_result::timeout:
Expand All @@ -262,7 +262,8 @@ class Baton {
}

if (!MayBlock) {
switch (detail::spin_yield_until(deadline, [thiz] { return thiz->ready(); })) {
switch (detail::spin_yield_until(deadline,
[thiz] { return thiz->ready(); })) {
case detail::spin_result::success:
return true;
case detail::spin_result::timeout:
Expand Down
12 changes: 6 additions & 6 deletions utilities/blob_db/blob_db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -622,19 +622,19 @@ void BlobDBImpl::MarkUnreferencedBlobFilesObsolete() {
const SequenceNumber obsolete_seq = GetLatestSequenceNumber();

MarkUnreferencedBlobFilesObsoleteImpl(
[ROCKSDB_THIS_LAMBDA_CAPTURE](const std::shared_ptr<BlobFile>& blob_file) {
[ROCKSDB_THIS_LAMBDA_CAPTURE](
const std::shared_ptr<BlobFile>& blob_file) {
WriteLock file_lock(&blob_file->mutex_);
return MarkBlobFileObsoleteIfNeeded(blob_file, obsolete_seq);
}
);
});
}

void BlobDBImpl::MarkUnreferencedBlobFilesObsoleteDuringOpen() {
MarkUnreferencedBlobFilesObsoleteImpl(
[ROCKSDB_THIS_LAMBDA_CAPTURE](const std::shared_ptr<BlobFile>& blob_file) {
[ROCKSDB_THIS_LAMBDA_CAPTURE](
const std::shared_ptr<BlobFile>& blob_file) {
return MarkBlobFileObsoleteIfNeeded(blob_file, /* obsolete_seq */ 0);
}
);
});
}

void BlobDBImpl::CloseRandomAccessLocked(
Expand Down