fix: extend clang-tidy hook to cover .h files; replace deprecated C headers#16
Merged
Merged
Conversation
…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>
Contributor
There was a problem hiding this comment.
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
filesregex to cover.h(and.c,.inc) files. - Replace deprecated C headers with their C++ equivalents in
audioparams.handvalue.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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
modernize-deprecated-headerscheck was enabled in.clang-tidybut silently missed deprecated C headers inside.hfiles due to two compounding gaps:Gap 1 —
modernize-deprecated-headersonly fires on the main TUThe check registers via
PPCallbacks::InclusionDirective, but only reports when the#includedirective is in the file being directly analyzed. An#include <assert.h>insideaudioparams.his invisible when clang-tidy analyzesaudioparams.cpp.Gap 2 — the hook's
filespattern excluded.hChanges
.pre-commit-config.yamlfilespattern to include.haudioparams.h#include <assert.h>→#include <cassert>value.h#include <stdint.h>→#include <cstdint>,#include <string.h>→#include <cstring>The CI workflow uses
pre-commit/actionwhich reads the same.pre-commit-config.yaml, so coverage is automatically extended in CI as well.