Skip to content

Commit

Permalink
Fix several warnings
Browse files Browse the repository at this point in the history
m_bmqstoragetool
================

FileManager
- Follow ISO C++ destructor rules

FileManagerMock
- Fix weak-vtable

SearchShortResult
- Remove unused d_allocator_p parameter
- Add allocator() method to retrieve allocator from subobject

bmq
===

bmqa_mocksession
- Remove unused const overload of uriCorrIdToQueues

bmqma_countingallocator
- Properly mark CountingAllocator::configureStatContextTableInfoProvider
as deprecated

bmqtst_logcontroller
- Add missing cases in switch statement

mqb
===

mqba_commandrouter
- Mark CommandRouter::ClusterWideRoutingMode::getRouteTargets
errorDescription as unused
- Move RoutingMode::~RoutingMode() to implementation file

mqba_sessionnegotiator
- Escape '@' character used by doxygen special command parsing

mqbcfg_tcpinterfaceconfigvalidator
- Add newline to end of header

mqbi_queueengine
- Mark QueueEngine::logAppSubscription appId as unused

mqbmock_storagemanager
- Force assertion failure for unimplemented StorageManager::fileStore

mqbnet_tcpsessionfactory
- Remove unused channelCast() helper

Signed-off-by: Taylor Foxhall <[email protected]>
  • Loading branch information
hallfox committed Dec 9, 2024
1 parent 90b398b commit 993e3d7
Show file tree
Hide file tree
Showing 16 changed files with 62 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ inline FileManagerImpl::FileHandler<ITER>::FileHandler(
}

template <typename ITER>
inline FileManagerImpl::FileHandler<ITER>::~FileHandler()
inline FileManagerImpl::FileHandler<ITER>::~FileHandler<ITER>()
{
d_iter.clear();
if (d_mfd.isValid()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,28 @@ namespace BloombergLP {

namespace m_bmqstoragetool {

// NOTHING
FileManagerMock::FileManagerMock()
: d_journalFileIt()
, d_dataFileIt()
{
EXPECT_CALL(*this, dataFileIterator())
.WillRepeatedly(testing::Return(&d_dataFileIt));
}

FileManagerMock::FileManagerMock(const JournalFile& journalFile)
: d_journalFileIt(&journalFile.mappedFileDescriptor(),
journalFile.fileHeader(),
false)
, d_dataFileIt()
{
EXPECT_CALL(*this, dataFileIterator())
.WillRepeatedly(testing::Return(&d_dataFileIt));
}

mqbs::JournalFileIterator* FileManagerMock::journalFileIterator()
{
return &d_journalFileIt;
}

} // close package namespace

Expand Down
27 changes: 0 additions & 27 deletions src/applications/bmqstoragetool/m_bmqstoragetool_filemanagermock.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,33 +98,6 @@ class FileManagerMock : public FileManager {
// INLINE DEFINITIONS
// ============================================================================

// =====================
// class FileManagerMock
// =====================

inline FileManagerMock::FileManagerMock()
: d_journalFileIt()
, d_dataFileIt()
{
EXPECT_CALL(*this, dataFileIterator())
.WillRepeatedly(testing::Return(&d_dataFileIt));
}

inline FileManagerMock::FileManagerMock(const JournalFile& journalFile)
: d_journalFileIt(&journalFile.mappedFileDescriptor(),
journalFile.fileHeader(),
false)
, d_dataFileIt()
{
EXPECT_CALL(*this, dataFileIterator())
.WillRepeatedly(testing::Return(&d_dataFileIt));
}

inline mqbs::JournalFileIterator* FileManagerMock::journalFileIterator()
{
return &d_journalFileIt;
}

} // close package namespace

} // close enterprise namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,15 @@ SearchShortResult::SearchShortResult(
, d_printedMessagesCount(0)
, d_guidMap(allocator)
, d_guidList(allocator)
, d_allocator_p(allocator)
{
// NOTHING
}

bslma::Allocator* SearchShortResult::allocator() const
{
return d_guidMap.get_allocator().mechanism();
}

bool SearchShortResult::processMessageRecord(
const mqbs::MessageRecord& record,
BSLS_ANNOTATION_UNUSED bsls::Types::Uint64 recordIndex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ class SearchShortResult : public SearchResult {
// Map to store guid and list iterator, for fast searching by guid.
bsl::list<GuidData> d_guidList;
// List to store ordered guid data to preserve messages order for output.
bslma::Allocator* d_allocator_p;
// Allocator used inside the class.

// PRIVATE MANIPULATORS

Expand All @@ -180,6 +178,10 @@ class SearchShortResult : public SearchResult {
bool printOnDelete = false,
bslma::Allocator* allocator = 0);

// ACCESSORS

bslma::Allocator* allocator() const;

// MANIPULATORS

/// Process `message` record with the specified `record`, `recordIndex` and
Expand Down
8 changes: 0 additions & 8 deletions src/groups/bmq/bmqa/bmqa_mocksession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,6 @@ UriCorrIdToQueueMap& uriCorrIdToQueues(B& buffer)
{
return reinterpret_cast<UriCorrIdToQueueMap&>(*(buffer.buffer()));
}

/// Utility method to cast the `UriCorrIdToQueueMap` held by the
/// `bsls::AlignedBuffer` (represented by the type `B`).
template <class B>
const UriCorrIdToQueueMap& uriCorrIdToQueues(const B& buffer)
{
return reinterpret_cast<const UriCorrIdToQueueMap&>(*(buffer.buffer()));
}
} // close unnamed namespace

#define BMQA_CHECK_ARG(METHOD, ARGNAME, EXPECTED, ACTUAL, CALL) \
Expand Down
7 changes: 5 additions & 2 deletions src/groups/bmq/bmqma/bmqma_countingallocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
#include <bslmf_nestedtraitdeclaration.h>
#include <bslmt_mutex.h>
#include <bsls_atomic.h>
#include <bsls_deprecatefeature.h>
#include <bsls_keyword.h>
#include <bsls_types.h>

Expand Down Expand Up @@ -167,8 +168,10 @@ class CountingAllocator BSLS_KEYWORD_FINAL : public bslma::Allocator {

/// Configure the specified `tableInfoProvider` with a filter, a
/// comparator, and columns to print the statistics generated by this
/// `bmqma::CountingAllocator`. @DEPRECATED: use the version taking a
/// `bmqst::Table` and `bmqst::BasicTableInfoProvider` instead.
/// `bmqma::CountingAllocator`.
BSLS_DEPRECATE_FEATURE("bmq",
"configureStatContextTableInfoProvider",
"Use the alternate overload instead.")
static void configureStatContextTableInfoProvider(
bmqst::StatContextTableInfoProvider* tableInfoProvider);

Expand Down
1 change: 1 addition & 0 deletions src/groups/bmq/bmqtsk/bmqtsk_logcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ LogControllerConfig::balToBslsLogLevel(ball::Severity::Level level)
case ball::Severity::e_INFO: return bsls::LogSeverity::e_INFO;
case ball::Severity::e_DEBUG: return bsls::LogSeverity::e_DEBUG;
case ball::Severity::e_TRACE: return bsls::LogSeverity::e_TRACE;
case ball::Severity::e_OFF:
default: return bsls::LogSeverity::e_ERROR;
};
}
Expand Down
7 changes: 4 additions & 3 deletions src/groups/mqb/mqba/mqba_commandrouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

// BDE
#include <bsl_iostream.h>
#include <bsla_annotations.h>

namespace BloombergLP {
namespace mqba {
Expand Down Expand Up @@ -129,9 +130,9 @@ CommandRouter::ClusterWideRoutingMode::ClusterWideRoutingMode()
}

int CommandRouter::ClusterWideRoutingMode::getRouteTargets(
bsl::ostream& errorDescription,
RouteTargets* routeTargets,
mqbi::Cluster* cluster)
BSLA_MAYBE_UNUSED bsl::ostream& errorDescription,
RouteTargets* routeTargets,
mqbi::Cluster* cluster)
{
// PRECONDITIONS
BSLS_ASSERT_SAFE(routeTargets);
Expand Down
2 changes: 1 addition & 1 deletion src/groups/mqb/mqba/mqba_commandrouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class CommandRouter {
class RoutingMode {
public:
RoutingMode();
virtual ~RoutingMode() = 0;
virtual ~RoutingMode();

/// Populates the given `routeMembers` struct with the proper nodes to
/// route to from the given `cluster`. Returns 0 on success or a
Expand Down
2 changes: 1 addition & 1 deletion src/groups/mqb/mqba/mqba_sessionnegotiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void loadBrokerIdentity(bmqp_ctrlmsg::ClientIdentity* identity,
/// Load in the specified `out` the short description representing the
/// specified `identity` from the specified `peerChannel`. The format is as
/// follow:
/// tskName:pid.sessionId[@hostId]
/// tskName:pid.sessionId[\@hostId]
/// Where:
/// - tskName : the task name, without any optional leading path
/// - pid : the pid of the task
Expand Down
18 changes: 9 additions & 9 deletions src/groups/mqb/mqbblp/mqbblp_queueenginetester.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class QueueEngineTester {

/// Obtain and return a handle for the client with handle parameters in
/// the specified `clientText` per the following format:
/// `<clientKey>[@<appId>] [readCount=<N>] [writeCount=<M>]`
/// `<clientKey>[\@<appId>] [readCount=<N>] [writeCount=<M>]`
///
/// The behavior is undefined unless `clientText` is formatted as above
/// and includes at least one attribute (e.g. `readCount=1`) other than
Expand All @@ -329,7 +329,7 @@ class QueueEngineTester {

/// Configure the handle for the client with stream parameters in the
/// specified `clientText` per the following format:
/// '<clientKey>[@<appId>] [consumerPriority=<P>]
/// '<clientKey>[\@<appId>] [consumerPriority=<P>]
/// [consumerPriorityCount=<C>]
/// [maxUnconfirmedMessages=<M>]
/// [maxUnconfirmedBytes=<B>]'
Expand All @@ -338,7 +338,7 @@ class QueueEngineTester {
/// on success, non-zero otherwise). The behavior is undefined unless
/// `clientText` is formatted as above (e.g. 'C1 consumerPriority=1
/// consumerPriorityCount=2') , and a previous call to `getHandle()`
/// returned a handle for the `<clientKey>[@appId]`, or if
/// returned a handle for the `<clientKey>[\@appId]`, or if
/// `createQueueEngine()` was not called.
int configureHandle(const bsl::string& clientText);

Expand Down Expand Up @@ -374,15 +374,15 @@ class QueueEngineTester {
/// the client identified with the specified `clientText` for the
/// specified `messages`. The format of `clientText` must be as
/// follows:
/// `<clientKey>[@<appId>]`
/// `<clientKey>[\@<appId>]`
///
/// The format of `messages` must be as follows:
/// `<msg1>,<msg2>,...,<msgN>`
///
/// The order of confirming each message is from left to right per the
/// format above. The behavior is undefined unless `messages` is
/// formatted as above, and a previous call to `getHandle()` returned a
/// handle for the `<clientKey>[@appId]`, or if `createQueueEngine()`
/// handle for the `<clientKey>[\@appId]`, or if `createQueueEngine()`
/// was not called. Note that it is "legal" for a client that is a
/// reader to confirm a message that was not posted or that is already
/// confirmed.
Expand All @@ -393,15 +393,15 @@ class QueueEngineTester {
/// the client identified with the specified `clientText` for the
/// specified `messages`. The format of `clientText` must be as
/// follows:
/// `<clientKey>[@<appId>]`
/// `<clientKey>[\@<appId>]`
///
/// The format of `messages` must be as follows:
/// `<msg1>,<msg2>,...,<msgN>`
///
/// The order of rejecting each message is from left to right per the
/// format above. The behavior is undefined unless `messages` is
/// formatted as above, and a previous call to `getHandle()` returned a
/// handle for the `<clientKey>[@appId]`, or if `createQueueEngine()`
/// handle for the `<clientKey>[\@appId]`, or if `createQueueEngine()`
/// was not called.
void reject(const bsl::string& clientText,
const bslstl::StringRef& messages);
Expand All @@ -427,7 +427,7 @@ class QueueEngineTester {

/// Release the parameters in the handle of the client in the specified
/// `clientText` per the following format:
/// `<clientKey>[@appId] [readCount=<N>] [writeCount=<M>]`
/// `<clientKey>[\@appId] [readCount=<N>] [writeCount=<M>]`
///
/// Return the result status code of the releaseHandle operation (zero
/// on success, non-zero otherwise). The behavior is undefined unless
Expand All @@ -439,7 +439,7 @@ class QueueEngineTester {

/// Release the parameters in the handle of the client in the specified
/// `clientText` per the following format:
/// '<clientKey>[@appId] [readCount=<N>] [writeCount=<M>]
/// '<clientKey>[\@appId] [readCount=<N>] [writeCount=<M>]
/// [isFinal=(true|false)]'
///
/// Return the result status code of the releaseHandle operation (zero
Expand Down
2 changes: 1 addition & 1 deletion src/groups/mqb/mqbcfg/mqbcfg_tcpinterfaceconfigvalidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ class TcpInterfaceConfigValidator {

} // close namespace mqbcfg
} // close namespace BloombergLP
#endif
#endif
10 changes: 7 additions & 3 deletions src/groups/mqb/mqbi/mqbi_queueengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
#include <mqbi_queueengine.h>

#include <mqbscm_version.h>

// BMQ
#include <bmqp_queueid.h>

// BDE
#include <bsla_annotations.h>

namespace BloombergLP {
namespace mqbi {

Expand Down Expand Up @@ -63,9 +67,9 @@ void QueueEngine::unregisterStorage(
// NOTHING
}

bsl::ostream&
QueueEngine::logAppSubscriptionInfo(bsl::ostream& stream,
const bsl::string& appId) const
bsl::ostream& QueueEngine::logAppSubscriptionInfo(
bsl::ostream& stream,
BSLA_MAYBE_UNUSED const bsl::string& appId) const
{
return stream;
};
Expand Down
1 change: 1 addition & 0 deletions src/groups/mqb/mqbmock/mqbmock_storagemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ bool StorageManager::isStorageEmpty(
const mqbs::FileStore&
StorageManager::fileStore(BSLS_ANNOTATION_UNUSED int partitionId) const
{
BSLS_ASSERT_INVOKE_NORETURN("Unimplemented");
}

bslma::ManagedPtr<mqbi::StorageManagerIterator>
Expand Down
19 changes: 0 additions & 19 deletions src/groups/mqb/mqbnet/mqbnet_tcpsessionfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,25 +262,6 @@ struct PortMatcher {
return listener.port() == d_port;
}
};

template <typename T>
T* channelCast(bmqio::Channel* base)
{
bmqio::Channel* alias = base;
while (alias) {
T* target = dynamic_cast<T*>(alias);
if (target) {
return target;
}
bmqio::DecoratingChannelPartialImp* decorated =
dynamic_cast<bmqio::DecoratingChannelPartialImp*>(alias);
if (!decorated) {
return NULL;
}
alias = decorated->base();
}
}

} // close unnamed namespace

// -----------------------------------------
Expand Down

0 comments on commit 993e3d7

Please sign in to comment.