Skip to content

Conversation

@idesign0
Copy link
Contributor

Fix: Correct int64_t Format Specifier and Set CMake Policy CMP0167

This PR resolves a C++ compilation error by correcting a format specifier mismatch in controller_interface/src/controller_interface_base.cpp.

  • C++ Fix: Changed the format specifier from the incorrect %ld (long) to the proper %lld (long long/int64_t) in the logging statement to match the argument type.

Signed-off-by: Dhruv Patel <dhruvpatel2991998@gmail.com>
Copy link
Member

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

Are you sure?
error: format specifies type 'long long' but the argument has type 'int64_t' (aka 'long') [-Werror,-Wformat]

@idesign0
Copy link
Contributor Author

Are you sure? error: format specifies type 'long long' but the argument has type 'int64_t' (aka 'long') [-Werror,-Wformat]

Yes, I saw that error. The root cause is the platform-dependent definition of int64_t — on macOS it resolves to long long (testing there). Thinking about a more portable fix now

Signed-off-by: Dhruv Patel <dhruvpatel2991998@gmail.com>
@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.62%. Comparing base (432ecad) to head (5afc131).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2817   +/-   ##
=======================================
  Coverage   89.62%   89.62%           
=======================================
  Files         152      152           
  Lines       17817    17817           
  Branches     1455     1455           
=======================================
  Hits        15968    15968           
  Misses       1263     1263           
  Partials      586      586           
Flag Coverage Δ
unittests 89.62% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...roller_interface/src/controller_interface_base.cpp 82.58% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Dhruv Patel <dhruvpatel2991998@gmail.com>
@bmagyar bmagyar changed the title Fix: Correct int64_t Format Specifier Fix: Correct int64_t Format Specifier (MacOS) Nov 15, 2025
@bmagyar
Copy link
Member

bmagyar commented Nov 15, 2025

I put MacOS in the title although I think it may have to do more with the architecture itself.

Here's an alternative idea @christophfroehlich : what if we drop -Werror=format from our cmake?

@christophfroehlich
Copy link
Member

sure, we can do that

@saikishor
Copy link
Member

@bmagyar @christophfroehlich instead of dropping the format flag, how about changing the update_rate parameter to size_t? or change the log to RCLCPP_WARN_STREAM?

Signed-off-by: Dhruv Patel <dhruvpatel2991998@gmail.com>
Signed-off-by: Dhruv Patel <dhruvpatel2991998@gmail.com>
@christophfroehlich christophfroehlich added backport-jazzy Triggers PR backport to ROS 2 jazzy. backport-kilted Triggers PR backport to ROS 2 kilted. labels Nov 20, 2025
@saikishor
Copy link
Member

@christophfroehlich there is a failing pre-commit should we wait for it or merge and open a PR fixing it?

@christophfroehlich
Copy link
Member

oops, no let's wait for the fix

Signed-off-by: Dhruv Patel <dhruvpatel2991998@gmail.com>
@saikishor saikishor merged commit 30416ba into ros-controls:master Nov 21, 2025
17 checks passed
mergify bot pushed a commit that referenced this pull request Nov 21, 2025
---------

Signed-off-by: Dhruv Patel <dhruvpatel2991998@gmail.com>
Co-authored-by: Sai Kishor Kothakota <saisastra3@gmail.com>
Co-authored-by: Sai Kishor Kothakota <sai.kishor@pal-robotics.com>
(cherry picked from commit 30416ba)
mergify bot pushed a commit that referenced this pull request Nov 21, 2025
---------

Signed-off-by: Dhruv Patel <dhruvpatel2991998@gmail.com>
Co-authored-by: Sai Kishor Kothakota <saisastra3@gmail.com>
Co-authored-by: Sai Kishor Kothakota <sai.kishor@pal-robotics.com>
(cherry picked from commit 30416ba)
robkwan pushed a commit to robkwan/ros2_control that referenced this pull request Nov 21, 2025
…ntrols#2817)

---------

Signed-off-by: Dhruv Patel <dhruvpatel2991998@gmail.com>
Co-authored-by: Sai Kishor Kothakota <saisastra3@gmail.com>
Co-authored-by: Sai Kishor Kothakota <sai.kishor@pal-robotics.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-jazzy Triggers PR backport to ROS 2 jazzy. backport-kilted Triggers PR backport to ROS 2 kilted.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants