Skip to content

[CODE HEALTH] Fix clang-tidy misc-use-internal-linkage warnings#3985

Merged
marcalff merged 5 commits intoopen-telemetry:mainfrom
mateenali66:fix/3977-misc-use-internal-linkage
Apr 13, 2026
Merged

[CODE HEALTH] Fix clang-tidy misc-use-internal-linkage warnings#3985
marcalff merged 5 commits intoopen-telemetry:mainfrom
mateenali66:fix/3977-misc-use-internal-linkage

Conversation

@mateenali66
Copy link
Copy Markdown
Contributor

Fixes #3977

marked list_test_cases in func_grpc_main.cc as static since it is only called in the same TU, and added static to the thread_local RNG in circular_buffer_benchmark.cc. the two foo_library functions in examples/common/foo_library and examples/common/logs_foo_library are exported via headers and linked into many example binaries, so internal linkage is not possible there. suppressed those with NOLINTNEXTLINE.

also decremented the clang-tidy warning limits by 4 to match the reduced unique warning count, consistent with prior code-health PRs.

keeping as draft until clang-tidy CI confirms the new limits are correct.

Changes

  • Fix clang-tidy misc-use-internal-linkage warnings.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

Mark list_test_cases in func_grpc_main as static, and make the
thread_local RNG in circular_buffer_benchmark explicitly static.
The foo_library functions in the common example libraries are
exported via headers and linked into multiple example binaries,
so internal linkage is not possible; suppress those two with
NOLINTNEXTLINE instead. Decrement clang-tidy warning limits by 4
to match the fewer unique warnings.

Fixes open-telemetry#3977

Signed-off-by: Mateen Anjum <mateenali66@gmail.com>
Signed-off-by: Mateen Anjum <mateenali66@gmail.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.14%. Comparing base (f60bbf3) to head (a7fb808).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3985      +/-   ##
==========================================
- Coverage   90.18%   90.14%   -0.04%     
==========================================
  Files         230      230              
  Lines        7299     7299              
==========================================
- Hits         6582     6579       -3     
- Misses        717      720       +3     

see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mateenali66 mateenali66 marked this pull request as ready for review April 10, 2026 20:43
@mateenali66 mateenali66 requested a review from a team as a code owner April 10, 2026 20:43
Copy link
Copy Markdown
Member

@dbarker dbarker 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 the cleanup! A few minor comments about the missing header includes which should fix the foo_library warnings.

mateenali66 and others added 3 commits April 10, 2026 19:49
Addresses review feedback on open-telemetry#3985. The clang-tidy
misc-use-internal-linkage warning for foo_library() was triggered
because the .cc files did not include their own header, so clang-tidy
could not see the external declaration. Including the header is the
right fix and lets the NOLINTNEXTLINE suppressions be removed.

Uses the same BAZEL_BUILD vs CMake include path split already used
by every example main file that calls foo_library().

Signed-off-by: Mateen Anjum <mateenali66@gmail.com>
Copy link
Copy Markdown
Member

@dbarker dbarker left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for the contribution!

Copy link
Copy Markdown
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the cleanup.

@marcalff marcalff merged commit 185dbd7 into open-telemetry:main Apr 13, 2026
68 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.

[CODE HEALTH] clang-tidy misc-use-internal-linkage warnings

3 participants