Skip to content

Commit

Permalink
Fix hidden overloaded virtual methods (#4516)
Browse files Browse the repository at this point in the history
* Refs #20592: Fix for test

Signed-off-by: EduPonz <[email protected]>

* Refs #20592: Fix for examples

Signed-off-by: EduPonz <[email protected]>

* Refs #20592: Add more warning flags to Ubuntu CI

Signed-off-by: EduPonz <[email protected]>

* Refs #20592: Remove default values on overloaded PDPClient::announceParticipantState

Signed-off-by: EduPonz <[email protected]>

---------

Signed-off-by: EduPonz <[email protected]>
(cherry picked from commit 63cc242)

# Conflicts:
#	.github/workflows/reusable-ubuntu-ci.yml
#	test/dds/communication/security/PublisherModule.hpp
#	test/dds/communication/security/SubscriberModule.hpp
  • Loading branch information
EduPonz authored and mergify[bot] committed Mar 20, 2024
1 parent d3a969c commit 1dbe74d
Show file tree
Hide file tree
Showing 41 changed files with 369 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/reusable-ubuntu-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ jobs:
colcon_meta_file: ${{ github.workspace }}/src/fastrtps/.github/workflows/config/ci.meta
colcon_build_args: ${{ inputs.colcon-args }}
cmake_args: ${{ inputs.cmake-args }}
<<<<<<< HEAD
cmake_args_default: -DCMAKE_CXX_FLAGS="-Werror -Wall"
=======
cmake_args_default: -DCMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused-value -Woverloaded-virtual" -DFASTDDS_EXAMPLE_TESTS=ON
>>>>>>> 63cc242b2 (Fix hidden overloaded virtual methods (#4516))
cmake_build_type: ${{ matrix.cmake-build-type }}
workspace: ${{ github.workspace }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ class HelloWorldPublisher

private:

using eprosima::fastdds::dds::DomainParticipantListener::on_participant_discovery;

//! Number of DataReaders matched to the associated DataWriter
std::atomic<std::uint32_t> matched_;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ class DiscoveryServer
void on_participant_discovery(
eprosima::fastdds::dds::DomainParticipant* /*participant*/,
eprosima::fastrtps::rtps::ParticipantDiscoveryInfo&& info) override;

private:

using eprosima::fastdds::dds::DomainParticipantListener::on_participant_discovery;
}
listener_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ class HelloWorldSubscriber

private:

using eprosima::fastdds::dds::DomainParticipantListener::on_participant_discovery;

HelloWorld hello_;

//! Number of DataWriters matched to the associated DataReader
Expand Down
6 changes: 6 additions & 0 deletions examples/cpp/dds/LivelinessQoS/LivelinessSubscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,15 @@ class LivelinessSubscriber

class PartListener : public eprosima::fastdds::dds::DomainParticipantListener
{
public:

virtual void on_participant_discovery(
eprosima::fastdds::dds::DomainParticipant* participant,
eprosima::fastrtps::rtps::ParticipantDiscoveryInfo&& info) override;

private:

using eprosima::fastdds::dds::DomainParticipantListener::on_participant_discovery;
};

PartListener part_listener_;
Expand Down
4 changes: 4 additions & 0 deletions examples/cpp/rtps/Persistent/TestReaderPersistent.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class TestReaderPersistent

uint32_t n_received;
uint32_t n_matched;

private:

using eprosima::fastrtps::rtps::ReaderListener::onReaderMatched;
}
m_listener;
};
Expand Down
4 changes: 4 additions & 0 deletions examples/cpp/rtps/Persistent/TestWriterPersistent.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ class TestWriterPersistent
}

int n_matched;

private:

using eprosima::fastrtps::rtps::WriterListener::onWriterMatched;
}
m_listener;
};
Expand Down
4 changes: 4 additions & 0 deletions examples/cpp/rtps/Registered/TestReaderRegistered.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class TestReaderRegistered

uint32_t n_received;
uint32_t n_matched;

private:

using eprosima::fastrtps::rtps::ReaderListener::onReaderMatched;
}
m_listener;
};
Expand Down
4 changes: 4 additions & 0 deletions examples/cpp/rtps/Registered/TestWriterRegistered.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ class TestWriterRegistered
}

int n_matched;

private:

using eprosima::fastrtps::rtps::WriterListener::onWriterMatched;
}
m_listener;
};
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/builtin/discovery/participant/PDPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ class PDPClient : public PDP
*/
void announceParticipantState(
bool new_change,
bool dispose = false,
WriteParams& wparams = WriteParams::WRITE_PARAM_DEFAULT) override;
bool dispose,
WriteParams& wparams) override;

/**
* These methods wouldn't be needed under perfect server operation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ bool DSClientEvent::event()
// This marks to announceParticipantState that the announcement is only meant for missing servers,
// so it is not a periodic announcement
mp_PDP->_serverPing = true;
mp_PDP->announceParticipantState(false);
WriteParams __wp = WriteParams::write_params_default();
mp_PDP->announceParticipantState(false, false, __wp);
EPROSIMA_LOG_INFO(CLIENT_PDP_THREAD,
"Client " << mp_PDP->getRTPSParticipant()->getGuid() << " PDP announcement");
}
Expand Down
2 changes: 2 additions & 0 deletions test/blackbox/api/dds-pim/PubSubParticipant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ class PubSubParticipant

private:

using eprosima::fastdds::dds::DomainParticipantListener::on_participant_discovery;

ParticipantListener& operator =(
const ParticipantListener&) = delete;
PubSubParticipant* participant_;
Expand Down
3 changes: 3 additions & 0 deletions test/blackbox/api/dds-pim/PubSubReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ class PubSubReader

private:

using eprosima::fastdds::dds::DomainParticipantListener::on_participant_discovery;
using eprosima::fastdds::dds::DomainParticipantListener::on_publisher_discovery;

ParticipantListener& operator =(
const ParticipantListener&) = delete;
PubSubReader& reader_;
Expand Down
4 changes: 4 additions & 0 deletions test/blackbox/api/dds-pim/PubSubWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ class PubSubWriter

private:

using eprosima::fastdds::dds::DomainParticipantListener::on_participant_discovery;
using eprosima::fastdds::dds::DomainParticipantListener::on_publisher_discovery;
using eprosima::fastdds::dds::DomainParticipantListener::on_subscriber_discovery;

ParticipantListener& operator =(
const ParticipantListener&) = delete;

Expand Down
4 changes: 4 additions & 0 deletions test/blackbox/api/dds-pim/PubSubWriterReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ class PubSubWriterReader

private:

using eprosima::fastdds::dds::DomainParticipantListener::on_participant_discovery;
using eprosima::fastdds::dds::DomainParticipantListener::on_publisher_discovery;
using eprosima::fastdds::dds::DomainParticipantListener::on_subscriber_discovery;

//! Mutex guarding all info collections
mutable std::mutex info_mutex_;
//! The discovered participants excluding the participant this listener is listening to
Expand Down
7 changes: 6 additions & 1 deletion test/blackbox/common/DDSBlackboxTestsBasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,10 @@ TEST(DDSBasic, PidRelatedSampleIdentity)
TEST(DDSBasic, IgnoreParticipant)
{

struct IgnoringDomainParticipantListener : public DomainParticipantListener
class IgnoringDomainParticipantListener : public DomainParticipantListener
{
public:

std::atomic_int num_matched{0};
std::atomic_int num_ignored{0};

Expand All @@ -505,6 +507,9 @@ TEST(DDSBasic, IgnoreParticipant)
}
}

private:

using DomainParticipantListener::on_participant_discovery;
};
// Set DomainParticipantFactory to create disabled entities
DomainParticipantFactoryQos factory_qos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ class MockHelloWorldPubSubType : public HelloWorldPubSubType
static eprosima::fastcdr::EncodingAlgorithmFlag last_encoding;

static DataRepresentationId_t last_data_representation;

private:

using HelloWorldPubSubType::serialize;
};

eprosima::fastcdr::EncodingAlgorithmFlag
Expand Down
6 changes: 6 additions & 0 deletions test/blackbox/common/DDSBlackboxTestsDiscovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ TEST(DDSDiscovery, ParticipantProxyPhysicalData)

private:

using DomainParticipantListener::on_participant_discovery;

std::condition_variable* cv_;

std::mutex* mtx_;
Expand Down Expand Up @@ -598,6 +600,8 @@ TEST(DDSDiscovery, DDSDiscoveryDoesNotDropUDPLocator)

struct CustomDomainParticipantListener : public DomainParticipantListener
{
using DomainParticipantListener::on_participant_discovery;

std::mutex mtx;
std::condition_variable cv;
GUID_t guid;
Expand Down Expand Up @@ -1653,6 +1657,8 @@ TEST(DDSDiscovery, DataracePDP)
{
public:

using DomainParticipantListener::on_participant_discovery;

CustomDomainParticipantListener()
: DomainParticipantListener()
, discovery_future(discovery_promise.get_future())
Expand Down
8 changes: 7 additions & 1 deletion test/blackbox/common/DDSBlackboxTestsFindTopic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ class DDSFindTopicTest : public testing::Test
/**
* A dummy type support class.
*/
struct TestType : public TopicDataType
class TestType : public TopicDataType
{
public:

TestType()
: TopicDataType()
{
Expand Down Expand Up @@ -96,6 +98,10 @@ class DDSFindTopicTest : public testing::Test
return false;
}

private:

using TopicDataType::getSerializedSizeProvider;
using TopicDataType::serialize;
};

public:
Expand Down
2 changes: 2 additions & 0 deletions test/blackbox/common/RTPSWithRegistrationReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ class RTPSWithRegistrationReader

private:

using eprosima::fastrtps::rtps::ReaderListener::onReaderMatched;

Listener& operator =(
const Listener&) = delete;

Expand Down
2 changes: 2 additions & 0 deletions test/blackbox/common/RTPSWithRegistrationWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class RTPSWithRegistrationWriter

private:

using eprosima::fastrtps::rtps::WriterListener::onWriterMatched;

Listener& operator =(
const Listener&) = delete;

Expand Down
2 changes: 2 additions & 0 deletions test/dds/communication/PublisherDynamic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class ParListener : public DomainParticipantListener

private:

using DomainParticipantListener::on_participant_discovery;

bool exit_on_lost_liveliness_;
};

Expand Down
2 changes: 2 additions & 0 deletions test/dds/communication/PublisherModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class PublisherModule

private:

using DomainParticipantListener::on_participant_discovery;

std::mutex mutex_;
std::condition_variable cv_;
unsigned int matched_ = 0;
Expand Down
2 changes: 2 additions & 0 deletions test/dds/communication/SubscriberDynamic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ class ParListener : public DomainParticipantListener

private:

using DomainParticipantListener::on_participant_discovery;

std::promise<topic_type_names> is_worth_a_type_;
};

Expand Down
2 changes: 2 additions & 0 deletions test/dds/communication/SubscriberModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class SubscriberModule

private:

using DomainParticipantListener::on_participant_discovery;

std::mutex mutex_;
std::condition_variable cv_;
const uint32_t publishers_ = 0;
Expand Down
Loading

0 comments on commit 1dbe74d

Please sign in to comment.