Skip to content

Commit

Permalink
MWC: make Dummy function placeholders callable to fix build with MSVC
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
  • Loading branch information
678098 committed Jul 17, 2024
1 parent 7f817c4 commit a79202a
Show file tree
Hide file tree
Showing 14 changed files with 440 additions and 1,013 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ settings.json
.pytest_cache/
.cache/
.venv/

# Symlink from 'src/applications/bmqbrkr/run'
src/applications/bmqbrkr/etc/etc

# 'sim_cpp11_features.pl' backups
src/groups/mwc/mwcex/*.bak
src/groups/mwc/mwcu/*.bak
3 changes: 2 additions & 1 deletion src/groups/mqb/mqba/mqba_clientsession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
#include <bdld_datummapbuilder.h>
#include <bdld_manageddatum.h>
#include <bdlf_bind.h>
#include <bdlf_noop.h>
#include <bdlf_placeholder.h>
#include <bdlma_localsequentialallocator.h>
#include <bdlt_timeunitratio.h>
Expand Down Expand Up @@ -1079,7 +1080,7 @@ void ClientSession::finishCheckUnconfirmedDispatched(
mwcu::WeakMemFnUtil::weakMemFn(&ClientSession::checkUnconfirmed,
d_self.acquireWeak()),
shutdownCtx,
mwcu::NoOp()));
bdlf::NoOp()));
}

void ClientSession::closeChannel()
Expand Down
60 changes: 58 additions & 2 deletions src/groups/mwc/mwcex/mwcex_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
//..

// MWC

#include <mwcex_executortraits.h>

// BDE
Expand Down Expand Up @@ -293,8 +292,65 @@ class Executor_Box_SboImp {

/// Provides a "small" dummy object which size is used to calculate the
/// size of the on-stack buffer used to store the executor target.
struct Dummy {
struct Dummy : public Executor_TargetBase {
void* d_padding[4];

bool
operator==(BSLS_ANNOTATION_UNUSED const Executor_Box_SboImp::Dummy&)
const BSLS_KEYWORD_NOEXCEPT
{
return false;
}

void post(BSLS_ANNOTATION_UNUSED const bsl::function<void()>& f) const
BSLS_KEYWORD_OVERRIDE
{
// NOTHING
}

/// Perform `ExecutorTraits<E>::dispatch(e, f)`, where `e` is the
/// contained executor target of type `E`.
void dispatch(BSLS_ANNOTATION_UNUSED const bsl::function<void()>& f)
const BSLS_KEYWORD_OVERRIDE
{
// NOTHING
}

/// Move-construct `*this` into the specified `dst` address.
void move(BSLS_ANNOTATION_UNUSED void* dst)
BSLS_KEYWORD_NOEXCEPT BSLS_KEYWORD_OVERRIDE
{
// NOTHING
}

bool equal(BSLS_ANNOTATION_UNUSED const Executor_TargetBase& other)
const BSLS_KEYWORD_NOEXCEPT
{
// NOTHING
}

/// Return a pointer to the contained executor target.
void* target() BSLS_KEYWORD_NOEXCEPT
{
// NOTHING
}

const void* target() const BSLS_KEYWORD_NOEXCEPT
{
// NOTHING
}

/// Return `typeid(e)`, where `e` is the contained executor target.
const bsl::type_info& targetType() const BSLS_KEYWORD_NOEXCEPT
{
// NOTHING
}

/// Copy-construct `*this` into the specified `dst` address.
void copy(BSLS_ANNOTATION_UNUSED void* dst) const BSLS_KEYWORD_NOEXCEPT
{
// NOTHING
}
};

private:
Expand Down
8 changes: 4 additions & 4 deletions src/groups/mwc/mwcex/mwcex_future.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@
// result-supplier thread.

// MWC

#include <mwcu_objectplaceholder.h>

// BDE
#include <bdlb_nullablevalue.h>
#include <bdlf_noop.h>
#include <bsl_algorithm.h> // bsl::swap
#include <bsl_exception.h>
#include <bsl_functional.h> // bsl::reference_wrapper
Expand Down Expand Up @@ -150,7 +150,7 @@

#if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
// Include version that can be compiled with C++03
// Generated on Wed Jun 29 04:17:13 2022
// Generated on Wed Jul 17 12:44:45 2024
// Command line: sim_cpp11_features.pl mwcex_future.h
#define COMPILING_MWCEX_FUTURE_H
#include <mwcex_future_cpp03.h>
Expand Down Expand Up @@ -232,7 +232,7 @@ class Future_Exception {

/// Provides a "small" dummy object which size is used to calculate the
/// size of the on-stack buffer used for optimization.
struct Dummy {
struct Dummy : public bdlf::NoOp {
void* d_padding[3];
};

Expand Down Expand Up @@ -359,7 +359,7 @@ class Future_Callback {

/// Provides a "small" dummy object which size is used to calculate the
/// size of the on-stack buffer used for optimization.
struct Dummy {
struct Dummy : public bdlf::NoOp {
void* d_padding[3];
};

Expand Down
Loading

0 comments on commit a79202a

Please sign in to comment.