Skip to content

Fix[bmqtool]: handle warning on CorrelationId destruction #834

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

678098
Copy link
Collaborator

@678098 678098 commented Jul 16, 2025

There is a problem with bdlb::Variant4 implementation that produces a warning. It is probably a false alarm, but we can still avoid this.

    inlined from 'BloombergLP::bmqt::CorrelationId::~CorrelationId()' at /blazingmq/src/groups/bmq/bmqt/bmqt_correlationid.h:193:7,
    inlined from 'static bool BloombergLP::m_bmqtool::InputUtil::populateSubscriptions(BloombergLP::bmqt::QueueOptions*, int, const char*, BloombergLP::bslma::Allocator*)' at /blazingmq/src/applications/bmqtool/m_bmqtool_inpututil.cpp:355:5:
/include/bslstl_sharedptr.h:5140:9: warning: '*(bsl::shared_ptr<void>*)((char*)&correlationId + offsetof(BloombergLP::bmqt::CorrelationId, BloombergLP::bmqt::CorrelationId::d_variant.BloombergLP::bdlb::Variant4<long long int, void*, bsl::shared_ptr<void>, long long unsigned int>::<unnamed>.BloombergLP::bdlb::VariantImp<BloombergLP::bslmf::TypeList<long long int, void*, bsl::shared_ptr<void>, long long unsigned int> >::<unnamed>.BloombergLP::bdlb::VariantImp_NoAllocatorBase<BloombergLP::bslmf::TypeList<long long int, void*, bsl::shared_ptr<void>, long long unsigned int> >::d_value)).bsl::shared_ptr<void>::d_rep_p' may be used uninitialized [-Wmaybe-uninitialized]
 5140 |     if (d_rep_p) {
      |         ^~~~~~~
/blazingmq/src/applications/bmqtool/m_bmqtool_inpututil.cpp: In static member function 'static bool BloombergLP::m_bmqtool::InputUtil::populateSubscriptions(BloombergLP::bmqt::QueueOptions*, int, const char*, BloombergLP::bslma::Allocator*)':
/blazingmq/src/applications/bmqtool/m_bmqtool_inpututil.cpp:335:34: note: 'correlationId' declared here
  335 |         bmqt::CorrelationId      correlationId(i);

@678098 678098 requested a review from a team as a code owner July 16, 2025 17:54
@678098 678098 requested review from dorjesinpo and removed request for a team July 16, 2025 17:54
Signed-off-by: Evgenii Malygin <[email protected]>
Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build 2900 of commit 02009b3 has completed with FAILURE

@@ -332,7 +332,7 @@ bool InputUtil::populateSubscriptions(bmqt::QueueOptions* out,
bool failed = false;
for (int i = 0; i < autoPubSubModulo; ++i) {
bmqt::Subscription to;
bmqt::CorrelationId correlationId(i);
bmqt::CorrelationId correlationId(bmqt::CorrelationId::autoValue());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try casting the value to Int64

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.

2 participants