Several CI-pipelines call to checkpatch.pl --strict, so CHECK reports
there can disrupt pipeline flow. This patchset addresses one such check.
CHECK: Macro argument reuse '_var' - possible side-effects?
Multi-statement declarative macros (both top-of-scope and file-scope),
commonly fall victim to this warning, checkpatch even has a list of
named exceptions to silence some of the checks.
This patchset provides a more focussed approach:
1 #define __chkp_no_side_effects(...) /* nothing */
so no functional change due to its use.
2 teach checkpatch how to silence THAT WARNING on that _var
find the macro call in macro-body, extract no-side-effect-vars
process the macro body as usual, count arg expansions
before issuing CHECK, check the no-side-effect-vars
3 authors add the assertion to their noisy macros
active assertion of safety, per variable, not full pardon by name
indicates they tested against --strict
Jim Cromie (3):
checkpatch: add --drx option and drx_print() helper
checkpatch: recognize __chkp_no_side_effects(_var) hint macro
compiler.h: add __chkp_no_side_effects() empty hint/assertion macro
include/linux/compiler.h | 12 ++++++++++
scripts/checkpatch.pl | 47 ++++++++++++++++++++++++++++++++++++----
2 files changed, 55 insertions(+), 4 deletions(-)
--
2.51.0