Skip to content

[Backport] Fix compile warning with -Wsign-compare#309

Merged
cottsay merged 1 commit intodashingfrom
Wsign-compare
Jul 31, 2019
Merged

[Backport] Fix compile warning with -Wsign-compare#309
cottsay merged 1 commit intodashingfrom
Wsign-compare

Conversation

@cottsay
Copy link
Copy Markdown
Member

@cottsay cottsay commented Jul 29, 2019

This is a backport of #288 for Dashing.


Bug report

Required Info:

  • Operating System:
    • Fedora 30
  • Installation type:
    • source
  • Version or commit hash:
    • 0.7.3
  • DDS implementation:
    • Fast-RTPS
  • Client library (if applicable):
    • N/A

Steps to reproduce issue

Compile from source using system's default compiler, g++ (GCC) 9.1.1 20190503 (Red Hat 9.1.1-1)

Expected behavior

No warnings.

Actual behavior

src/ros2/rmw_fastrtps/rmw_fastrtps_shared_cpp/src/qos.cpp: In instantiation of ‘bool fill_entity_qos_from_profile(const rmw_qos_profile_t&, DDSEntityQos&, eprosima::fastrtps::HistoryQosPolicy&) [with DDSEntityQos = eprosima::fastrtps::ReaderQos; rmw_qos_profile_t = rmw_qos_profile_t]’:
src/ros2/rmw_fastrtps/rmw_fastrtps_shared_cpp/src/qos.cpp:150:86:   required from here
src/ros2/rmw_fastrtps/rmw_fastrtps_shared_cpp/src/qos.cpp:98:28: warning: comparison of integer expressions of different signedness: ‘const size_t’ {aka ‘const long unsigned int’} and ‘int’ [-Wsign-compare]
   98 |     if (qos_policies.depth > (std::numeric_limits<int32_t>::max)()) {
      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ros2/rmw_fastrtps/rmw_fastrtps_shared_cpp/src/qos.cpp: In instantiation of ‘bool fill_entity_qos_from_profile(const rmw_qos_profile_t&, DDSEntityQos&, eprosima::fastrtps::HistoryQosPolicy&) [with DDSEntityQos = eprosima::fastrtps::WriterQos; rmw_qos_profile_t = rmw_qos_profile_t]’:
src/ros2/rmw_fastrtps/rmw_fastrtps_shared_cpp/src/qos.cpp:157:86:   required from here
src/ros2/rmw_fastrtps/rmw_fastrtps_shared_cpp/src/qos.cpp:98:28: warning: comparison of integer expressions of different signedness: ‘const size_t’ {aka ‘const long unsigned int’} and ‘int’ [-Wsign-compare]

Additional information

The type is defined in rmw/include/rmw/types.h.

Signed-off-by: Scott K Logan <logans@cottsay.net>
@cottsay cottsay added the in review Waiting for review (Kanban column) label Jul 29, 2019
@cottsay cottsay self-assigned this Jul 29, 2019
@cottsay cottsay changed the title [Backport] Fix a comparison with a sign mismatch [Backport] Fix compile warning with -Wsign-compare Jul 29, 2019
@cottsay
Copy link
Copy Markdown
Member Author

cottsay commented Jul 31, 2019

@ros-pull-request-builder retest this please

@cottsay cottsay merged commit 1305dcf into dashing Jul 31, 2019
@delete-merged-branch delete-merged-branch bot deleted the Wsign-compare branch July 31, 2019 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in review Waiting for review (Kanban column)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants