diff options
| author | Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> | 2026-06-15 12:35:23 -0700 |
|---|---|---|
| committer | Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> | 2026-06-16 10:59:05 -0700 |
| commit | 320de9f89fbae08027ec0479b338cfc612e24c04 (patch) | |
| tree | 61225f4ce004dd248e2681c63518617fd496f6bd /scripts | |
| parent | 13c6930028adf4ae15cdef98a960f0335dab8c5c (diff) | |
| download | qemu-320de9f89fbae08027ec0479b338cfc612e24c04.tar.gz qemu-320de9f89fbae08027ec0479b338cfc612e24c04.zip | |
scripts/checkpatch: ignore spaces required around some operators in C++
C++ has a different style when it comes to space around references,
dereferences, so don't report it.
Also, closing templates with >> gets wrongly confused with >> operator,
so just relax this check.
Some examples:
ERROR: spaces required around that '&' (ctx:WxV)
+ auto &[counter, p] = *static_cast<TbData*>(udata);
^
ERROR: spaces required around that '*' (ctx:VxO)
+ auto &[counter, p] = *static_cast<TbData*>(udata);
^
ERROR: spaces required around that '>>' (ctx:VxW)
+ std::vector<std::pair<Vaddr, uint64_t>> v; ^
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-25-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/checkpatch.pl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2189db19f5..538e059e26 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2621,6 +2621,31 @@ sub process { if ($op eq '::') { $ok = 1; } + + # Ignore * in C++: templates and + # pointer types are incorrectly + # flagged. Example: + # static_cast<T*> + if ($op eq '*') { + $ok = 1; + } + + # Ignore & in C++: & means a + # reference, and this create + # issues with some constructions. + # Example: + # auto &[first, second] = pair; + if ($op eq '&') { + $ok = 1; + } + + # Ignore >> in C++ + # checkpatch is confused by + # >> closing templates. Example: + # vector<pair<A, B>> + if ($op eq '>>') { + $ok = 1; + } } # Ignore email addresses <foo@bar> |
