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

Fix deprecation warnings for message constants #750

Conversation

emersonknapp
Copy link
Collaborator

Fixes #743

This patch fixes two issues:

  1. Code generation for rosidl_typesupport_introspection_cpp was overriding user-provided compile definitons, hiding the -Wdeprecated warnings in generated code, that users did see in rosidl_typesupport_fastrtps_cpp, which was not overriding those compile flags. This inconsistent result confused the issue of why we were seeing deprecation warnings in some portion of the build but not others
  2. #ifdefs out a variable definition for message constant members that is now deprecated in C++17. In C++14 it was still necessary to define a static constexpr member variable outside the class, but as of C++17 those static constexpr vars are now automatically inlined so the declaration and definiton are the same line, making the external definition redundant.

Fixes ros2#743

This patch fixes two issues:
1. Code generation for `rosidl_typesupport_introspection_cpp` was overriding user-provided compile definitons, hiding the `-Wdeprecated` warnings in generated code, that users did see in `rosidl_typesupport_fastrtps_cpp`, which was not overriding those compile flags. This inconsistent result confused the issue of why we were seeing deprecation warnings in some portion of the build but not others
1. `#ifdef`s out a variable definition for message constant members that is now deprecated in C++17. In C++14 it was still necessary to define a `static constexpr` member variable outside the class, but as of C++17 those `static constexpr` vars are now automatically inlined so the declaration and definiton are the same line, making the external definition redundant.

Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com>
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Thanks for tracking this down! This looks good to me with green CI. I'll also suggest that once we merge this and ros2/rosidl_typesupport_fastrtps#102 , we do a more-or-less immediate release into Rolling just to make sure there isn't any fallout from them. I can help with that.

@emersonknapp
Copy link
Collaborator Author

emersonknapp commented Jun 6, 2023

@emersonknapp
Copy link
Collaborator Author

emersonknapp commented Jun 6, 2023

Rerunning aarch64 Build Status

@emersonknapp
Copy link
Collaborator Author

OK - now it's just the test_executors one

@clalancette clalancette merged commit 1228f54 into ros2:rolling Jun 7, 2023
4 checks passed
@emersonknapp
Copy link
Collaborator Author

@Mergifyio backport iron humble

@mergify
Copy link

mergify bot commented Jun 7, 2023

backport iron humble

❌ Command disallowed due to command restrictions in the Mergify configuration.

  • sender-permission>=write

@emersonknapp emersonknapp deleted the emersonknapp/rosidl-deprecation-warnings branch June 8, 2023 16:19
@quarkytale
Copy link

@Mergifyio backport iron humble

@mergify
Copy link

mergify bot commented Jun 8, 2023

backport iron humble

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jun 8, 2023
Fixes #743

This patch fixes two issues:
1. Code generation for `rosidl_typesupport_introspection_cpp` was overriding user-provided compile definitons, hiding the `-Wdeprecated` warnings in generated code, that users did see in `rosidl_typesupport_fastrtps_cpp`, which was not overriding those compile flags. This inconsistent result confused the issue of why we were seeing deprecation warnings in some portion of the build but not others
1. `#ifdef`s out a variable definition for message constant members that is now deprecated in C++17. In C++14 it was still necessary to define a `static constexpr` member variable outside the class, but as of C++17 those `static constexpr` vars are now automatically inlined so the declaration and definiton are the same line, making the external definition redundant.

Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com>
(cherry picked from commit 1228f54)
mergify bot pushed a commit that referenced this pull request Jun 8, 2023
Fixes #743

This patch fixes two issues:
1. Code generation for `rosidl_typesupport_introspection_cpp` was overriding user-provided compile definitons, hiding the `-Wdeprecated` warnings in generated code, that users did see in `rosidl_typesupport_fastrtps_cpp`, which was not overriding those compile flags. This inconsistent result confused the issue of why we were seeing deprecation warnings in some portion of the build but not others
1. `#ifdef`s out a variable definition for message constant members that is now deprecated in C++17. In C++14 it was still necessary to define a `static constexpr` member variable outside the class, but as of C++17 those `static constexpr` vars are now automatically inlined so the declaration and definiton are the same line, making the external definition redundant.

Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com>
(cherry picked from commit 1228f54)
emersonknapp added a commit that referenced this pull request Jun 14, 2023
Fix deprecation warnings for message constants (backport #750)
emersonknapp added a commit that referenced this pull request Jun 14, 2023
Fix deprecation warnings for message constants (backport #750)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rosidl generator cpp depreceation warning failing builds when using const values in msg definitions
3 participants