ros2 / ros2/rclcpp

Clang warning: ordered comparison of function pointers (Rolling)

Open
#2,488 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog help wanted
Dominant language
C++
Stars
805
Forks
564
Avg merge
1d 17h
Merged PRs (30d)
27

Description

Related build https://ci.ros2.org/view/nightly/job/nightly_linux_clang_libcxx/1848/consoleText

In file included from /home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/src/ros2/rclcpp/rclcpp/test/rclcpp/test_utilities.cpp:28:
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/src/ros2/rclcpp/rclcpp/test/rclcpp/../mocking_utils/patch.hpp:141:3: warning: ordered comparison of function pointers ('void (*)(const rcutils_log_location_s *, int, const char *, long, const char *, __va_list_tag (*)[1])' and 'void (*)(const rcutils_log_location_s *, int, const char *, long, const char *, __va_list_tag (*)[1])') [-Wordered-compare-function-pointers]
  mmk_mock_define(mock_type, ReturnT, ArgT0, ArgT1, ArgT2);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/mock.h:434:16: note: expanded from macro 'mmk_mock_define'
    MMK_EXPAND(MMK_MOCK_DEFINE_IMPL(Id,                     \
    ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/mock.h:444:9: note: expanded from macro 'MMK_MOCK_DEFINE_IMPL'
        MMK_MOCK_DEFINE,                                    \
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:604:81: note: expanded from macro 'MMK_COND_VOID'
# define MMK_COND_VOID(Macro, Params1, Params2, ...) MMK_EXPAND(MMK_VOID_SELECT(Macro, Params1, Params2, __VA_ARGS__))
                                                                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 48 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:40:24: note: expanded from macro 'MMK_EXPAND'
# define MMK_EXPAND(x) x
                       ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:40:24: note: expanded from macro 'MMK_EXPAND'
# define MMK_EXPAND(x) x
                       ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:40:24: note: expanded from macro 'MMK_EXPAND'
# define MMK_EXPAND(x) x
                       ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/src/ros2/rclcpp/rclcpp/test/rclcpp/../mocking_utils/patch.hpp:141:3: note: in instantiation of member function 'mocking_utils::PatchTraits<5, int (const rcl_arguments_s *, const rcutils_allocator_s *, void (*)(const rcutils_log_location_s *, int, const char *, long, const char *, __va_list_tag (*)[1]))>::mmkuser_mock_type_stub' requested here
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/mock.h:434:16: note: expanded from macro 'mmk_mock_define'
    MMK_EXPAND(MMK_MOCK_DEFINE_IMPL(Id,                     \
               ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/mock.h:444:9: note: expanded from macro 'MMK_MOCK_DEFINE_IMPL'
        MMK_MOCK_DEFINE,                                    \
        ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/src/ros2/rclcpp/rclcpp/test/rclcpp/../mocking_utils/patch.hpp:462:43: note: in instantiation of member function 'mocking_utils::PatchTraits<5, int (const rcl_arguments_s *, const rcutils_allocator_s *, void (*)(const rcutils_log_location_s *, int, const char *, long, const char *, __va_list_tag (*)[1]))>::mmkuser_mock_type_create' requested here
      PatchTraits<ID, ReturnT(ArgTs...)>::MMK_MANGLE(mock_type, create);
                                          ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/mock.h:95:31: note: expanded from macro 'MMK_MANGLE'
# define MMK_MANGLE(Id, Name) MMK_MANGLE_(Id, Name)
                              ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/mock.h:94:32: note: expanded from macro 'MMK_MANGLE_'
# define MMK_MANGLE_(Id, Name) mmkuser_ ## Id ## _ ## Name
                               ^
<scratch space>:211:1: note: expanded from here
mmkuser_mock_type_create
^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/src/ros2/rclcpp/rclcpp/test/rclcpp/../mocking_utils/patch.hpp:444:5: note: in instantiation of member function 'mocking_utils::Patch<5, int (const rcl_arguments_s *, const rcutils_allocator_s *, void (*)(const rcutils_log_location_s *, int, const char *, long, const char *, __va_list_tag (*)[1]))>::replace_with' requested here
    replace_with(replacement);
    ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/src/ros2/rclcpp/rclcpp/test/rclcpp/test_utilities.cpp:177:32: note: in instantiation of member function 'mocking_utils::Patch<5, int (const rcl_arguments_s *, const rcutils_allocator_s *, void (*)(const rcutils_log_location_s *, int, const char *, long, const char *, __va_list_tag (*)[1]))>::then_call' requested here
    auto mock = mocking_utils::patch_and_return(
                               ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/src/ros2/rclcpp/rclcpp/test/rclcpp/../mocking_utils/patch.hpp:537:3: note: expanded from macro 'patch_and_return'
  patch(scope, function, [&](auto && ...) {return return_code;})
  ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/src/ros2/rclcpp/rclcpp/test/rclcpp/../mocking_utils/patch.hpp:533:34: note: expanded from macro 'patch'
  prepare_patch(scope, function).then_call(replacement)
                                 ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/src/ros2/rclcpp/rclcpp/test/rclcpp/../mocking_utils/patch.hpp:141:3: warning: ordered comparison of function pointers ('void (*)(const rcutils_log_location_s *, int, const char *, long, const char *, __va_list_tag (*)[1])' and 'void (*)(const rcutils_log_location_s *, int, const char *, long, const char *, __va_list_tag (*)[1])') [-Wordered-compare-function-pointers]
  mmk_mock_define(mock_type, ReturnT, ArgT0, ArgT1, ArgT2);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/mock.h:434:16: note: expanded from macro 'mmk_mock_define'
    MMK_EXPAND(MMK_MOCK_DEFINE_IMPL(Id,                     \
    ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/mock.h:444:9: note: expanded from macro 'MMK_MOCK_DEFINE_IMPL'
        MMK_MOCK_DEFINE,                                    \
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:604:81: note: expanded from macro 'MMK_COND_VOID'
# define MMK_COND_VOID(Macro, Params1, Params2, ...) MMK_EXPAND(MMK_VOID_SELECT(Macro, Params1, Params2, __VA_ARGS__))
                                                                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 48 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:40:24: note: expanded from macro 'MMK_EXPAND'
# define MMK_EXPAND(x) x
                       ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:40:24: note: expanded from macro 'MMK_EXPAND'
# define MMK_EXPAND(x) x
                       ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:40:24: note: expanded from macro 'MMK_EXPAND'
# define MMK_EXPAND(x) x
                       ^
In file included from /home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/src/ros2/rclcpp/rclcpp/test/rclcpp/test_utilities.cpp:28:
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/src/ros2/rclcpp/rclcpp/test/rclcpp/../mocking_utils/patch.hpp:141:3: warning: ordered comparison of function pointers ('void (*)(const rcutils_log_location_s *, int, const char *, long, const char *, __va_list_tag (*)[1])' and 'void (*)(const rcutils_log_location_s *, int, const char *, long, const char *, __va_list_tag (*)[1])') [-Wordered-compare-function-pointers]
  mmk_mock_define(mock_type, ReturnT, ArgT0, ArgT1, ArgT2);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/mock.h:434:16: note: expanded from macro 'mmk_mock_define'
    MMK_EXPAND(MMK_MOCK_DEFINE_IMPL(Id,                     \
    ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/mock.h:444:9: note: expanded from macro 'MMK_MOCK_DEFINE_IMPL'
        MMK_MOCK_DEFINE,                                    \
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:604:81: note: expanded from macro 'MMK_COND_VOID'
# define MMK_COND_VOID(Macro, Params1, Params2, ...) MMK_EXPAND(MMK_VOID_SELECT(Macro, Params1, Params2, __VA_ARGS__))
                                                                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 48 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:40:24: note: expanded from macro 'MMK_EXPAND'
# define MMK_EXPAND(x) x
                       ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:40:24: note: expanded from macro 'MMK_EXPAND'
# define MMK_EXPAND(x) x
                       ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:40:24: note: expanded from macro 'MMK_EXPAND'
# define MMK_EXPAND(x) x
                       ^
In file included from /home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/src/ros2/rclcpp/rclcpp/test/rclcpp/test_utilities.cpp:28:
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/src/ros2/rclcpp/rclcpp/test/rclcpp/../mocking_utils/patch.hpp:141:3: warning: ordered comparison of function pointers ('void (*)(const rcutils_log_location_s *, int, const char *, long, const char *, __va_list_tag (*)[1])' and 'void (*)(const rcutils_log_location_s *, int, const char *, long, const char *, __va_list_tag (*)[1])') [-Wordered-compare-function-pointers]
  mmk_mock_define(mock_type, ReturnT, ArgT0, ArgT1, ArgT2);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/mock.h:434:16: note: expanded from macro 'mmk_mock_define'
    MMK_EXPAND(MMK_MOCK_DEFINE_IMPL(Id,                     \
    ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/mock.h:444:9: note: expanded from macro 'MMK_MOCK_DEFINE_IMPL'
        MMK_MOCK_DEFINE,                                    \
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:604:81: note: expanded from macro 'MMK_COND_VOID'
# define MMK_COND_VOID(Macro, Params1, Params2, ...) MMK_EXPAND(MMK_VOID_SELECT(Macro, Params1, Params2, __VA_ARGS__))
                                                                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 48 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:40:24: note: expanded from macro 'MMK_EXPAND'
# define MMK_EXPAND(x) x
                       ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:40:24: note: expanded from macro 'MMK_EXPAND'
# define MMK_EXPAND(x) x
                       ^
/home/jenkins-agent/workspace/nightly_linux_clang_libcxx/ws/install/mimick_vendor/opt/mimick_vendor/include/mimick/preprocess.h:40:24: note: expanded from macro 'MMK_EXPAND'
# define MMK_EXPAND(x) x

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with rclcpp/test/mocking_utils/patch.hpp at line 141 and rclcpp/test/rclcpp/test_utilities.cpp around line 177, then inspect the referenced mimick/mock.h macro expansion. Reproduce the warning with the nightly Linux Clang libc++ build and confirm that the ordered function-pointer comparison warning no longer appears.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.