Skip to content

Conversation

adam-leeper-ai
Copy link
Contributor

Description

Note: this PR is related to addition of IWYU pragmas in generated messages, see ros2/rosidl#902.

This PR adds // IWYU pragma: private, include "sensor_msgs/point_cloud2_iterator.hpp" to the impl file, sensor_msgs/impl/point_cloud2_iterator.hpp.

This allows the IWYU tool to know that it shouldn't try to pull in the impl file and should instead rely on the public header.

See documentation here for IWYU pragma: private.

Is this user-facing behavior change?

Not user-facing in terms of code compilation or runtime.

Yes user-facing when using dev tools like IWYU:

  • Before this change, IWYU tries to automatically add an include line for the impl header like this, which is not what we want:
my/file.cc should add these lines:
#include <sensor_msgs/impl/point_cloud2_iterator.hpp>
  • After this change, the IWYU will accept / expect the user to just include sensor_msgs/point_cloud2_iterator.hpp.

Did you use Generative AI?

No

This adds `// IWYU pragma: private, include "sensor_msgs/point_cloud2_iterator.hpp" to the impl file.

This allows the IWYU tool to know that it shouldn't try to pull in the impl file and should instead rely on the public header.

See documentation here: https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md#iwyu-pragma-private

Signed-off-by: Adam Leeper <[email protected]>
@mjcarroll
Copy link
Member

LGTM, and it's just a comment (we don't run IWYU as part of CI), so I will skip CI here.

@mjcarroll mjcarroll merged commit 3fe6e1b into ros2:rolling Sep 26, 2025
3 checks passed
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.

2 participants