You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Extend IWYU checks to headers without a matching .cc file #4581
While working on PR #4574, we found that sdk/include/opentelemetry/sdk/metrics/view/predicate_factory.h uses uint8_t without including <cstdint>. It compiled only because something else in the same translation unit happened to pull that header in transitively. This kind of bug is exactly what include-what-you-use (IWYU) checks are meant to catch, but it slipped through because this header has no matching .cc file of its own to anchor an IWYU check against.
Proposal
Look into extending the project's IWYU tooling/CI so that header-only files (headers with no corresponding .cc translation unit in the same directory) are also checked for missing or unnecessary includes, rather than relying on incidental coverage from whichever .cc file happens to include them first.
Fixing this is especially valuable for all the header only files under api.
In my understanding, IWYU will work with the CMAKE compilation database, and this database only knows about foo.cc files.
A possible fix/work around might be to also add foo.h in a CMake library, creating a fake one if necessary, for IWYU to "see" these files and do something about it.
Purely speculative, I never got time to investigate further.
Activity
om7057 commentedon Sep 16, 2026
Thanks for the suggestion, @lalitb. Opening this to track it separately as discussed in #4574.
marcalff commentedon Sep 16, 2026
Fixing this is especially valuable for all the header only files under
api.In my understanding, IWYU will work with the CMAKE compilation database, and this database only knows about foo.cc files.
A possible fix/work around might be to also add foo.h in a CMake library, creating a fake one if necessary, for IWYU to "see" these files and do something about it.
Purely speculative, I never got time to investigate further.
dbarker commentedon Sep 16, 2026
Part the of the broader fix should be to complete #1429 and move the SDK implementations to .cc files if header only now.
github-actions commentedon Sep 16, 2026
This issue is available for anyone to work on. Make sure to reference this issue in your pull request.
✨ Thank you for your contribution! ✨