open-telemetry / open-telemetry/opentelemetry-cpp

Extend IWYU checks to headers without a matching .cc file

Open
#4,581 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted triage/accepted
Dominant language
C++
Stars
1.4k
Forks
632
Avg merge
1d 13h
Merged PRs (30d)
75

Description

Context

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.

Related

  • #4574

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing IWYU tooling and CI coverage, then inspect sdk/include/opentelemetry/sdk/metrics/view/predicate_factory.h and related context in PR #4574. Done means header-only files without matching .cc files are included in IWYU checks for missing or unnecessary includes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
ci-cd, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.