mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jim Cromie <jim.cromie@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@linuxfoundation.org, Jim Cromie <jim.cromie@gmail.com>
Subject: [PATCH 0/3] checkpatch --strict | ci-pipeline improvements
Date: Sat, 25 Oct 2025 15:15:15 -0600	[thread overview]
Message-ID: <20251025211519.1616439-1-jim.cromie@gmail.com> (raw)

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


             reply	other threads:[~2025-10-25 21:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-25 21:15 Jim Cromie [this message]
2025-10-25 21:15 ` [PATCH 1/3] checkpatch: add --drx option and drx_print() helper Jim Cromie
2025-10-25 23:24   ` Joe Perches
2025-10-25 21:15 ` [PATCH 2/3] checkpatch: recognize __chkp_no_side_effects(_var) hint macro Jim Cromie
2025-10-26 16:48   ` Joe Perches
2025-10-25 21:15 ` [PATCH 3/3] compiler.h: add __chkp_no_side_effects() empty hint/assertion macro Jim Cromie
2025-10-26  0:09   ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251025211519.1616439-1-jim.cromie@gmail.com \
    --to=jim.cromie@gmail.com \
    --cc=akpm@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®