Skip to content
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

[21624] Fix compilation errors in Ubuntu 24.04 using -Werror #5217

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

richiware
Copy link
Member

@richiware richiware commented Sep 10, 2024

Description

Fix compilation errors in Ubuntu 24.04 using -Werror.

Depends on:

Fixes the related error in eProsima/Fast-DDS-Gen#395 and also this error:

[ 66%] Building CXX object test/unittest/dds/status/CMakeFiles/ListenerTests.dir/__/__/__/__/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp.o
In file included from /usr/include/c++/13/vector:66,
                from /home/ricardo/workspace/eprosima/fastdds/include/fastdds/dds/core/policy/QosPolicies.hpp:24,
                from /home/ricardo/workspace/eprosima/fastdds/include/fastdds/rtps/builtin/data/PublicationBuiltinTopicData.hpp:27,
                from /home/ricardo/workspace/eprosima/fastdds/include/fastdds/dds/builtin/topic/PublicationBuiltinTopicData.hpp:22,
                from /home/ricardo/workspace/eprosima/fastdds/src/cpp/fastdds/publisher/DataWriterImpl.hpp:24,
                from /home/ricardo/workspace/eprosima/fastdds/src/cpp/fastdds/publisher/DataWriterImpl.cpp:19:
In member function ‘std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = std::shared_ptr<testing::internal::ExpectationBase>; _Alloc = std::allocator<std::shared_ptr<testing::internal::ExpectationBase> >]’,
   inlined from ‘R testing::internal::FunctionMocker<R(Args ...)>::InvokeWith(ArgumentTuple&&) [with R = const eprosima::fastdds::rtps::NetworkFactory&; Args = {}]’ at /home/ricardo/workspace/install/googletest-distribution/include/gmock/gmock-spec-builders.h:1755:33,
   inlined from ‘testing::internal::FunctionMocker<R(Args ...)>::Result testing::internal::FunctionMocker<R(Args ...)>::Invoke(Args ...) [with R = const eprosima::fastdds::rtps::NetworkFactory&; Args = {}]’ at /home/ricardo/workspace/install/googletest-distribution/include/gmock/gmock-spec-builders.h:1510:22,
   inlined from ‘const eprosima::fastdds::rtps::NetworkFactory& eprosima::fastdds::rtps::RTPSParticipantImpl::network_factory() const’ at /home/ricardo/workspace/eprosima/fastdds/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h:134:5,
   inlined from ‘eprosima::fastdds::dds::ReturnCode_t eprosima::fastdds::dds::DataWriterImpl::get_publication_builtin_topic_data(eprosima::fastdds::dds::PublicationBuiltinTopicData&) const’ at /home/ricardo/workspace/eprosima/fastdds/src/cpp/fastdds/publisher/DataWriterImpl.cpp:1745:61:
/usr/include/c++/13/bits/stl_vector.h:993:40: error: array subscript 2 is outside array bounds of ‘testing::internal::FunctionMocker<const eprosima::fastdds::rtps::NetworkFactory&()> [0]’ [-Werror=array-bounds=]
 993 |       { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
     |                          ~~~~~~~~~~~~~~^~~~~~~~~
In member function ‘eprosima::fastdds::dds::ReturnCode_t eprosima::fastdds::dds::DataWriterImpl::get_publication_builtin_topic_data(eprosima::fastdds::dds::PublicationBuiltinTopicData&) const’:
cc1plus: note: source object is likely at address zero
In member function ‘std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = std::shared_ptr<testing::internal::ExpectationBase>; _Alloc = std::allocator<std::shared_ptr<testing::internal::ExpectationBase> >]’,
   inlined from ‘R testing::internal::FunctionMocker<R(Args ...)>::InvokeWith(ArgumentTuple&&) [with R = const eprosima::fastdds::rtps::NetworkFactory&; Args = {}]’ at /home/ricardo/workspace/install/googletest-distribution/include/gmock/gmock-spec-builders.h:1755:33,
   inlined from ‘testing::internal::FunctionMocker<R(Args ...)>::Result testing::internal::FunctionMocker<R(Args ...)>::Invoke(Args ...) [with R = const eprosima::fastdds::rtps::NetworkFactory&; Args = {}]’ at /home/ricardo/workspace/install/googletest-distribution/include/gmock/gmock-spec-builders.h:1510:22,
   inlined from ‘const eprosima::fastdds::rtps::NetworkFactory& eprosima::fastdds::rtps::RTPSParticipantImpl::network_factory() const’ at /home/ricardo/workspace/eprosima/fastdds/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h:134:5,
   inlined from ‘eprosima::fastdds::dds::ReturnCode_t eprosima::fastdds::dds::DataWriterImpl::get_publication_builtin_topic_data(eprosima::fastdds::dds::PublicationBuiltinTopicData&) const’ at /home/ricardo/workspace/eprosima/fastdds/src/cpp/fastdds/publisher/DataWriterImpl.cpp:1745:61:
/usr/include/c++/13/bits/stl_vector.h:993:66: error: array subscript 2 is outside array bounds of ‘testing::internal::FunctionMocker<const eprosima::fastdds::rtps::NetworkFactory&()> [0]’ [-Werror=array-bounds=]
 993 |       { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
     |                                                    ~~~~~~~~~~~~~~^~~~~~~~
In member function ‘eprosima::fastdds::dds::ReturnCode_t eprosima::fastdds::dds::DataWriterImpl::get_publication_builtin_topic_data(eprosima::fastdds::dds::PublicationBuiltinTopicData&) const’:
cc1plus: note: source object is likely at address zero
In file included from /usr/include/c++/13/bits/stl_algobase.h:67,
                from /usr/include/c++/13/bits/stl_uninitialized.h:63,
                from /usr/include/c++/13/memory:69,
                from /home/ricardo/workspace/eprosima/fastdds/src/cpp/fastdds/publisher/DataWriterImpl.hpp:22:
In constructor ‘__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const _Iterator&) [with _Iterator = const std::shared_ptr<testing::internal::ExpectationBase>*; _Container = std::vector<std::shared_ptr<testing::internal::ExpectationBase> >]’,
   inlined from ‘std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::end() const [with _Tp = std::shared_ptr<testing::internal::ExpectationBase>; _Alloc = std::allocator<std::shared_ptr<testing::internal::ExpectationBase> >]’ at /usr/include/c++/13/bits/stl_vector.h:904:16,
   inlined from ‘std::vector<_Tp, _Alloc>::const_reverse_iterator std::vector<_Tp, _Alloc>::rbegin() const [with _Tp = std::shared_ptr<testing::internal::ExpectationBase>; _Alloc = std::allocator<std::shared_ptr<testing::internal::ExpectationBase> >]’ at /usr/include/c++/13/bits/stl_vector.h:924:44,
   inlined from ‘testing::internal::TypedExpectation<R(Args ...)>* testing::internal::FunctionMocker<R(Args ...)>::FindMatchingExpectationLocked(const ArgumentTuple&) const [with R = const eprosima::fastdds::rtps::NetworkFactory&; Args = {}]’ at /home/ricardo/workspace/install/googletest-distribution/include/gmock/gmock-spec-builders.h:1644:63,
   inlined from ‘const testing::internal::ExpectationBase* testing::internal::FunctionMocker<R(Args ...)>::UntypedFindMatchingExpectation(const void*, const void**, bool*, std::ostream*, std::ostream*) [with R = const eprosima::fastdds::rtps::NetworkFactory&; Args = {}]’ at /home/ricardo/workspace/install/googletest-distribution/include/gmock/gmock-spec-builders.h:1612:67,
   inlined from ‘R testing::internal::FunctionMocker<R(Args ...)>::InvokeWith(ArgumentTuple&&) [with R = const eprosima::fastdds::rtps::NetworkFactory&; Args = {}]’ at /home/ricardo/workspace/install/googletest-distribution/include/gmock/gmock-spec-builders.h:1813:43,
   inlined from ‘testing::internal::FunctionMocker<R(Args ...)>::Result testing::internal::FunctionMocker<R(Args ...)>::Invoke(Args ...) [with R = const eprosima::fastdds::rtps::NetworkFactory&; Args = {}]’ at /home/ricardo/workspace/install/googletest-distribution/include/gmock/gmock-spec-builders.h:1510:22,
   inlined from ‘const eprosima::fastdds::rtps::NetworkFactory& eprosima::fastdds::rtps::RTPSParticipantImpl::network_factory() const’ at /home/ricardo/workspace/eprosima/fastdds/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h:134:5,
   inlined from ‘eprosima::fastdds::dds::ReturnCode_t eprosima::fastdds::dds::DataWriterImpl::get_publication_builtin_topic_data(eprosima::fastdds::dds::PublicationBuiltinTopicData&) const’ at /home/ricardo/workspace/eprosima/fastdds/src/cpp/fastdds/publisher/DataWriterImpl.cpp:1745:61:
/usr/include/c++/13/bits/stl_iterator.h:1077:9: error: array subscript 7 is outside array bounds of ‘testing::internal::FunctionMocker<const eprosima::fastdds::rtps::NetworkFactory&()> [0]’ [-Werror=array-bounds=]
1077 |       : _M_current(__i) { }
     |         ^~~~~~~~~~~~~~~
In member function ‘eprosima::fastdds::dds::ReturnCode_t eprosima::fastdds::dds::DataWriterImpl::get_publication_builtin_topic_data(eprosima::fastdds::dds::PublicationBuiltinTopicData&) const’:
cc1plus: note: source object is likely at address zero
In constructor ‘__gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const _Iterator&) [with _Iterator = const std::shared_ptr<testing::internal::ExpectationBase>*; _Container = std::vector<std::shared_ptr<testing::internal::ExpectationBase> >]’,
   inlined from ‘std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::begin() const [with _Tp = std::shared_ptr<testing::internal::ExpectationBase>; _Alloc = std::allocator<std::shared_ptr<testing::internal::ExpectationBase> >]’ at /usr/include/c++/13/bits/stl_vector.h:884:16,
   inlined from ‘std::vector<_Tp, _Alloc>::const_reverse_iterator std::vector<_Tp, _Alloc>::rend() const [with _Tp = std::shared_ptr<testing::internal::ExpectationBase>; _Alloc = std::allocator<std::shared_ptr<testing::internal::ExpectationBase> >]’ at /usr/include/c++/13/bits/stl_vector.h:944:46,
   inlined from ‘testing::internal::TypedExpectation<R(Args ...)>* testing::internal::FunctionMocker<R(Args ...)>::FindMatchingExpectationLocked(const ArgumentTuple&) const [with R = const eprosima::fastdds::rtps::NetworkFactory&; Args = {}]’ at /home/ricardo/workspace/install/googletest-distribution/include/gmock/gmock-spec-builders.h:1646:13,
   inlined from ‘const testing::internal::ExpectationBase* testing::internal::FunctionMocker<R(Args ...)>::UntypedFindMatchingExpectation(const void*, const void**, bool*, std::ostream*, std::ostream*) [with R = const eprosima::fastdds::rtps::NetworkFactory&; Args = {}]’ at /home/ricardo/workspace/install/googletest-distribution/include/gmock/gmock-spec-builders.h:1612:67,
   inlined from ‘R testing::internal::FunctionMocker<R(Args ...)>::InvokeWith(ArgumentTuple&&) [with R = const eprosima::fastdds::rtps::NetworkFactory&; Args = {}]’ at /home/ricardo/workspace/install/googletest-distribution/include/gmock/gmock-spec-builders.h:1813:43,
   inlined from ‘testing::internal::FunctionMocker<R(Args ...)>::Result testing::internal::FunctionMocker<R(Args ...)>::Invoke(Args ...) [with R = const eprosima::fastdds::rtps::NetworkFactory&; Args = {}]’ at /home/ricardo/workspace/install/googletest-distribution/include/gmock/gmock-spec-builders.h:1510:22,
   inlined from ‘const eprosima::fastdds::rtps::NetworkFactory& eprosima::fastdds::rtps::RTPSParticipantImpl::network_factory() const’ at /home/ricardo/workspace/eprosima/fastdds/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h:134:5,
   inlined from ‘eprosima::fastdds::dds::ReturnCode_t eprosima::fastdds::dds::DataWriterImpl::get_publication_builtin_topic_data(eprosima::fastdds::dds::PublicationBuiltinTopicData&) const’ at /home/ricardo/workspace/eprosima/fastdds/src/cpp/fastdds/publisher/DataWriterImpl.cpp:1745:61:
/usr/include/c++/13/bits/stl_iterator.h:1077:9: error: array subscript 6 is outside array bounds of ‘testing::internal::FunctionMocker<const eprosima::fastdds::rtps::NetworkFactory&()> [0]’ [-Werror=array-bounds=]
1077 |       : _M_current(__i) { }
     |         ^~~~~~~~~~~~~~~
In member function ‘eprosima::fastdds::dds::ReturnCode_t eprosima::fastdds::dds::DataWriterImpl::get_publication_builtin_topic_data(eprosima::fastdds::dds::PublicationBuiltinTopicData&) const’:
cc1plus: note: source object is likely at address zero
cc1plus: all warnings being treated as errors
make[2]: *** [test/unittest/dds/status/CMakeFiles/ListenerTests.dir/build.make:426: test/unittest/dds/status/CMakeFiles/ListenerTests.dir/__/__/__/__/src/cpp/fastdds/publisher/DataWriterImpl.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:2695: test/unittest/dds/status/CMakeFiles/ListenerTests.dir/all] Error 2

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
  • N/A Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • N/A Any new/modified methods have been properly documented using Doxygen.
  • N/A Any new configuration API has an equivalent XML API (with the corresponding XSD extension)
  • N/A Changes are backport compatible: they do NOT break ABI nor change library core behavior.
  • N/A Changes are API compatible.
  • N/A New feature has been added to the versions.md file (if applicable).
  • N/A New feature has been documented/Current behavior is correctly described in the documentation.
  • N/A Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • N/A: If this is a critical bug fix, backports to the critical-only supported branches have been requested.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

@richiware richiware changed the title Fix compilation errors in Ubuntu 24.04 using -Werror [21624] Fix compilation errors in Ubuntu 24.04 using -Werror Sep 10, 2024
@richiware richiware added this to the v3.0.1 - Frozen ❄️ milestone Sep 10, 2024
@JesusPoderoso JesusPoderoso added ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. and removed ci-pending PR which CI is running labels Sep 11, 2024
@richiware richiware merged commit 35dbc4b into master Sep 11, 2024
17 checks passed
@richiware richiware deleted the bugfix/21621 branch September 11, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Ready to be merged. CI and changes have been reviewed and approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants