Skip to content

fix: extend clang-tidy hook to cover .h files; replace deprecated C headers#16

Merged
deku2026 merged 1 commit into
mainfrom
fix/clang-tidy-header-coverage
Mar 10, 2026
Merged

fix: extend clang-tidy hook to cover .h files; replace deprecated C headers#16
deku2026 merged 1 commit into
mainfrom
fix/clang-tidy-header-coverage

Conversation

@deku2026
Copy link
Copy Markdown

Problem

The modernize-deprecated-headers check was enabled in .clang-tidy but silently missed deprecated C headers inside .h files due to two compounding gaps:

Gap 1 — modernize-deprecated-headers only fires on the main TU

The check registers via PPCallbacks::InclusionDirective, but only reports when the #include directive is in the file being directly analyzed. An #include <assert.h> inside audioparams.h is invisible when clang-tidy analyzes audioparams.cpp.

Gap 2 — the hook's files pattern excluded .h

# before
files: \.(cpp|hpp|cc|hh|cxx|hxx)$   # .h never analyzed as main TU

# after
files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|inc)$  # matches clang-format hook

Changes

File Change
.pre-commit-config.yaml Expand clang-tidy files pattern to include .h
audioparams.h #include <assert.h>#include <cassert>
value.h #include <stdint.h>#include <cstdint>, #include <string.h>#include <cstring>

The CI workflow uses pre-commit/action which reads the same .pre-commit-config.yaml, so coverage is automatically extended in CI as well.

…eaders

The clang-tidy pre-commit hook used pattern \.(cpp|hpp|cc|hh|cxx|hxx)$
which excluded plain .h headers from direct analysis. The
modernize-deprecated-headers check only fires when the deprecated
#include is in the main translation unit being analyzed, so C-style
headers inside .h files were invisible to the hook.

- Expand clang-tidy files pattern to \.(c|h|cpp|hpp|cc|hh|cxx|hxx|inc)$
  (matches the existing clang-format hook pattern)
- audioparams.h: #include <assert.h> -> #include <cassert>
- value.h: #include <stdint.h> -> #include <cstdint>
           #include <string.h> -> #include <cstring>

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 10, 2026 09:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the pre-commit clang-tidy hook’s file matching to include .h headers (to better catch modernize-deprecated-headers) and updates a couple of headers to use non-deprecated C++ standard library includes.

Changes:

  • Expand pre-commit clang-tidy files regex to cover .h (and .c, .inc) files.
  • Replace deprecated C headers with their C++ equivalents in audioparams.h and value.h.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
.pre-commit-config.yaml Broadens clang-tidy’s file matching to include headers as main inputs.
include/arcvideo/foundation/render/audioparams.h Replaces <assert.h> with <cassert>.
include/arcvideo/foundation/util/value.h Replaces <stdint.h>/<string.h> with <cstdint>/<cstring>.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .pre-commit-config.yaml
@deku2026 deku2026 merged commit a5db6d5 into main Mar 10, 2026
8 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