Skip to content

Commit

Permalink
Fix enum templates not compatible with Solaris compiler
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeny Malygin <[email protected]>
  • Loading branch information
678098 committed Jan 10, 2025
1 parent 81b0f42 commit 2b8c80a
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 64 deletions.
6 changes: 4 additions & 2 deletions src/applications/bmqstoragetool/bmqstoragetool.m.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ static bool parseArgs(CommandLineArguments& arguments,
{
bool showHelp = false;

bsl::vector<bsl::string> defaultRecordType(allocator);
defaultRecordType.push_back(CommandLineArguments::k_MESSAGE_TYPE);

balcl::OptionInfo specTable[] = {
{"r|record-type",
"record type",
"record type to search {message|queue-op|journal-op}",
balcl::TypeInfo(&arguments.d_recordType,
CommandLineArguments::isValidRecordType),
balcl::OccurrenceInfo(bsl::vector<bsl::string>(
{CommandLineArguments::k_MESSAGE_TYPE}))},
balcl::OccurrenceInfo(defaultRecordType)},
{"journal-path",
"journal path",
"'*'-ended file path pattern, where the tool will try to find "
Expand Down
7 changes: 6 additions & 1 deletion src/groups/bmq/bmqio/bmqio_ntcchannel.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,13 @@ void Tester::init()
ntca::InterfaceConfig config = ntcCreateInterfaceConfig(d_allocator_p);
config.setThreadName("test");

// Solaris: disambiguate by using the expected interface type
bsl::shared_ptr<bdlbb::BlobBufferFactory> bufferFactory_sp =
bsl::static_pointer_cast<bdlbb::BlobBufferFactory>(
d_blobBufferFactory_sp);

d_interface_sp = ntcf::System::createInterface(config,
d_blobBufferFactory_sp,
bufferFactory_sp,
d_allocator_p);
ntsa::Error error = d_interface_sp->start();
BMQTST_ASSERT_EQ(error, ntsa::Error::e_OK);
Expand Down
2 changes: 1 addition & 1 deletion src/groups/bmq/bmqp/bmqp_blobpoolutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ BlobPoolUtil::createBlobPool(bdlbb::BlobBufferFactory* blobBufferFactory_p,
bslma::Allocator* alloc = bslma::Default::allocator(allocator);

return bsl::shared_ptr<BlobSpPool>(
new BlobSpPool(
new (*alloc) BlobSpPool(
bdlf::BindUtil::bind(&createBlob,
blobBufferFactory_p,
bdlf::PlaceHolders::_1, // arena
Expand Down
8 changes: 8 additions & 0 deletions src/groups/bmq/bmqtsk/bmqtsk_alarmlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@ class AlarmLog : public ball::ObserverAdapter {
/// will be dumped to stderr with respects to rate-controlled logic.
void publish(const ball::Record& record,
const ball::Context& context) BSLS_KEYWORD_OVERRIDE;

/// Note: this member is overriden to get rid of the "hides the virtual
/// function" warning.
inline void publish(const bsl::shared_ptr<const ball::Record>& record,
const ball::Context& context) BSLS_KEYWORD_OVERRIDE
{
publish(*record, context);
}
};

} // close package namespace
Expand Down
8 changes: 8 additions & 0 deletions src/groups/bmq/bmqtsk/bmqtsk_consoleobserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,14 @@ class ConsoleObserver : public ball::ObserverAdapter {
void publish(const ball::Record& record,
const ball::Context& context) BSLS_KEYWORD_OVERRIDE;

/// Note: this member is overriden to get rid of the "hides the virtual
/// function" warning.
inline void publish(const bsl::shared_ptr<const ball::Record>& record,
const ball::Context& context) BSLS_KEYWORD_OVERRIDE
{
publish(*record, context);
}

// ACCESSORS

/// Return the currently set severity threshold of this object.
Expand Down
8 changes: 8 additions & 0 deletions src/groups/bmq/bmqtsk/bmqtsk_syslogobserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ class SyslogObserver : public ball::ObserverAdapter {
void publish(const ball::Record& record,
const ball::Context& context) BSLS_KEYWORD_OVERRIDE;

/// Note: this member is overriden to get rid of the "hides the virtual
/// function" warning.
inline void publish(const bsl::shared_ptr<const ball::Record>& record,
const ball::Context& context) BSLS_KEYWORD_OVERRIDE
{
publish(*record, context);
}

// ACCESSORS

/// Return the currently set severity threshold of this object.
Expand Down
8 changes: 8 additions & 0 deletions src/groups/bmq/bmqtst/bmqtst_scopedlogobserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ class ScopedLogObserver : public ball::ObserverAdapter {
void publish(const ball::Record& record,
const ball::Context& context) BSLS_KEYWORD_OVERRIDE;

/// Note: this member is overriden to get rid of the "hides the virtual
/// function" warning.
inline void publish(const bsl::shared_ptr<const ball::Record>& record,
const ball::Context& context) BSLS_KEYWORD_OVERRIDE
{
publish(*record, context);
}

public:
// ACCESSORS

Expand Down
10 changes: 0 additions & 10 deletions src/groups/bmq/bmqu/bmqu_blobiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ class BlobIterator {
/// referring to a valid value.
const char& operator*() const;

/// Return a pointer to the byte being referred to by this
/// iterator. The behavior is undefined if this iterator isn't
/// referring to a valid value.
const char* operator->() const;

/// Return `true` if this `BlobIterator` has reached its end.
bool atEnd() const;

Expand Down Expand Up @@ -284,11 +279,6 @@ inline const char& BlobIterator::operator*() const
return d_blob_p->buffer(d_pos.buffer()).data()[d_pos.byte()];
}

inline const char* BlobIterator::operator->() const
{
return &**this;
}

inline bool BlobIterator::atEnd() const
{
return d_remaining <= 0;
Expand Down
2 changes: 1 addition & 1 deletion src/groups/mqb/mqbblp/mqbblp_domain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ void Domain::removeDomainReset()
bslmt::LockGuard<bslmt::Mutex> guard(&d_mutex); // LOCK

d_state = e_PREREMOVE;
d_teardownRemoveCb = nullptr;
d_teardownRemoveCb = bsl::nullptr_t();
}

void Domain::removeDomainComplete()
Expand Down
2 changes: 1 addition & 1 deletion src/groups/mqb/mqbc/mqbc_clusterstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ bool ClusterState::unassignQueue(const bmqt::Uri& uri)

domIt->second->queuesInfo().erase(cit);
if (domIt->second->queuesInfo().empty()) {
domIt->second->setDomain(nullptr);
domIt->second->setDomain(NULL);
}

// POSTCONDITIONS
Expand Down
4 changes: 2 additions & 2 deletions src/groups/mqb/mqbs/mqbs_filebackedstorage.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class MockDataStore : public mqbs::DataStore {
*options = d_options.at(id);
}

mqbi::Dispatcher* dispatcher() BSLS_KEYWORD_OVERRIDE { return nullptr; }
mqbi::Dispatcher* dispatcher() BSLS_KEYWORD_OVERRIDE { return NULL; }

mqbi::DispatcherClientData& dispatcherClientData() BSLS_KEYWORD_OVERRIDE
{
Expand All @@ -314,7 +314,7 @@ class MockDataStore : public mqbs::DataStore {

const mqbi::Dispatcher* dispatcher() const BSLS_KEYWORD_OVERRIDE
{
return nullptr;
return NULL;
}

const mqbi::DispatcherClientData&
Expand Down
12 changes: 4 additions & 8 deletions src/groups/mqb/mqbstat/mqbstat_brokerstats.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,35 +165,31 @@ inline bmqst::StatContext* BrokerStats::statContext()
}

template <>
inline void
BrokerStats::onEvent<BrokerStats::EventType::Enum::e_CLIENT_CREATED>()
inline void BrokerStats::onEvent<BrokerStats::EventType::e_CLIENT_CREATED>()
{
BSLS_ASSERT_SAFE(d_statContext_p && "initialize was not called");

d_statContext_p->adjustValue(BrokerStatsIndex::e_STAT_CLIENT_COUNT, 1);
}

template <>
inline void
BrokerStats::onEvent<BrokerStats::EventType::Enum::e_CLIENT_DESTROYED>()
inline void BrokerStats::onEvent<BrokerStats::EventType::e_CLIENT_DESTROYED>()
{
BSLS_ASSERT_SAFE(d_statContext_p && "initialize was not called");

d_statContext_p->adjustValue(BrokerStatsIndex::e_STAT_CLIENT_COUNT, -1);
}

template <>
inline void
BrokerStats::onEvent<BrokerStats::EventType::Enum::e_QUEUE_CREATED>()
inline void BrokerStats::onEvent<BrokerStats::EventType::e_QUEUE_CREATED>()
{
BSLS_ASSERT_SAFE(d_statContext_p && "initialize was not called");

d_statContext_p->adjustValue(BrokerStatsIndex::e_STAT_QUEUE_COUNT, 1);
}

template <>
inline void
BrokerStats::onEvent<BrokerStats::EventType::Enum::e_QUEUE_DESTROYED>()
inline void BrokerStats::onEvent<BrokerStats::EventType::e_QUEUE_DESTROYED>()
{
BSLS_ASSERT_SAFE(d_statContext_p && "initialize was not called");

Expand Down
12 changes: 4 additions & 8 deletions src/groups/mqb/mqbstat/mqbstat_clusterstats.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,32 +418,28 @@ inline bmqst::StatContext* ClusterNodeStats::statContext()
}

template <>
inline void
ClusterNodeStats::onEvent<ClusterNodeStats::EventType::Enum::e_ACK>(
inline void ClusterNodeStats::onEvent<ClusterNodeStats::EventType::e_ACK>(
BSLS_ANNOTATION_UNUSED bsls::Types::Int64 value)
{
d_statContext_mp->adjustValue(ClusterNodeStatsIndex::e_STAT_ACK, 1);
}

template <>
inline void
ClusterNodeStats::onEvent<ClusterNodeStats::EventType::Enum::e_CONFIRM>(
inline void ClusterNodeStats::onEvent<ClusterNodeStats::EventType::e_CONFIRM>(
BSLS_ANNOTATION_UNUSED bsls::Types::Int64 value)
{
d_statContext_mp->adjustValue(ClusterNodeStatsIndex::e_STAT_CONFIRM, 1);
}

template <>
inline void
ClusterNodeStats::onEvent<ClusterNodeStats::EventType::Enum::e_PUSH>(
inline void ClusterNodeStats::onEvent<ClusterNodeStats::EventType::e_PUSH>(
bsls::Types::Int64 value)
{
d_statContext_mp->adjustValue(ClusterNodeStatsIndex::e_STAT_PUSH, value);
}

template <>
inline void
ClusterNodeStats::onEvent<ClusterNodeStats::EventType::Enum::e_PUT>(
inline void ClusterNodeStats::onEvent<ClusterNodeStats::EventType::e_PUT>(
bsls::Types::Int64 value)
{
d_statContext_mp->adjustValue(ClusterNodeStatsIndex::e_STAT_PUT, value);
Expand Down
6 changes: 3 additions & 3 deletions src/groups/mqb/mqbstat/mqbstat_domainstats.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,23 @@ inline bmqst::StatContext* DomainStats::statContext()
}

template <>
inline void DomainStats::onEvent<DomainStats::EventType::Enum::e_CFG_MSGS>(
inline void DomainStats::onEvent<DomainStats::EventType::e_CFG_MSGS>(
bsls::Types::Int64 value)
{
BSLS_ASSERT_SAFE(d_statContext_mp && "initialize was not called");
d_statContext_mp->setValue(DomainStatsIndex::e_STAT_CFG_MSGS, value);
}

template <>
inline void DomainStats::onEvent<DomainStats::EventType::Enum::e_CFG_BYTES>(
inline void DomainStats::onEvent<DomainStats::EventType::e_CFG_BYTES>(
bsls::Types::Int64 value)
{
BSLS_ASSERT_SAFE(d_statContext_mp && "initialize was not called");
d_statContext_mp->setValue(DomainStatsIndex::e_STAT_CFG_BYTES, value);
}

template <>
inline void DomainStats::onEvent<DomainStats::EventType::Enum::e_QUEUE_COUNT>(
inline void DomainStats::onEvent<DomainStats::EventType::e_QUEUE_COUNT>(
bsls::Types::Int64 value)
{
BSLS_ASSERT_SAFE(d_statContext_mp && "initialize was not called");
Expand Down
Loading

0 comments on commit 2b8c80a

Please sign in to comment.