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

Add compatibility with protobuf 28 (backport #541) #552

Open
wants to merge 1 commit into
base: gz-transport13
Choose a base branch
from

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Nov 5, 2024

🎉 New feature

Adds compatibility with the Google Protocol Buffers v28.

Summary

Basically, rules for message down casting have been changed in protobuf and this PR modifies the way protobuf is used for downcasting.

Protobuf does not allow to use google::protobuf::internal::DownCast function to downcast message types with concepts enabled in version 28 (see port.h file in this diff). When compiling custom packages which depend on the gz-transport with C++ concepts enabled, there will be compile-time errors, if RepHandler::RunLocalCallback or SubscriptionHandler::RunLocalCallback functions were used (not necessarily used directly, but via some other function, for example: Node::Request).

Alternatively. there are google::protobuf::DynamicCastMessage and google::protobuf::DownCastMessage functions. Because google::protobuf::DynamicCastMessage function has more sanity checks, it was used in this PR with some additional error logging.

Test it

To test the changes you may install the Google Protocol Buffers v28, write some code that uses RepHandler::RunLocalCallback or SubscriptionHandler::RunLocalCallback (not necessarily directly) with C++ concepts enabled, and try to compile the code.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Rebase-and-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.


This is an automatic backport of pull request #541 done by [Mergify](https://mergify.com).

* Add compatibility with protobuf 28

Signed-off-by: Ramir Sultanov <[email protected]>

* Add message verification after message down casts

Signed-off-by: Ramir Sultanov <[email protected]>

---------

Signed-off-by: Ramir Sultanov <[email protected]>
(cherry picked from commit 6256a56)
@mergify mergify bot requested a review from caguero as a code owner November 5, 2024 17:31
@mergify mergify bot mentioned this pull request Nov 5, 2024
9 tasks
@github-actions github-actions bot added the 🎵 harmonic Gazebo Harmonic label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎵 harmonic Gazebo Harmonic
Projects
Status: Inbox
Development

Successfully merging this pull request may close these issues.

1 participant