From: sashiko-bot@kernel.org
To: "James Clark" <james.clark@linaro.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2] perf build: Stub out __guarded_by() on older Clang versions
Date: Tue, 24 Nov 2026 11:26:46 +0000 [thread overview]
Message-ID: <sashiko-outbox-231049@kernel.org> (raw)
In-Reply-To: <20261124-james-perf-late-parse-attr-v2-1-cb8b00d904a7@linaro.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] perf build: check-headers.sh ignore regex misses #else lines
--
commit 0ea3202ffc7513d3010799640980ebb7d00cf374
Author: James Clark <james.clark@linaro.org>
perf build: Stub out __guarded_by() on older Clang versions
This commit stubs out __guarded_by() and __pt_guarded_by() in
tools/include/linux/compiler-context-analysis.h on Clang versions older
than 19, and updates tools/perf/check-headers.sh to ignore the difference
from the kernel header.
> diff --git a/tools/include/linux/compiler-context-analysis.h b/tools/include/linux/compiler-context-analysis.h
> index 024e303188ad3..2806fb5f79d3a 100644
> --- a/tools/include/linux/compiler-context-analysis.h
> +++ b/tools/include/linux/compiler-context-analysis.h
> @@ -60,7 +60,11 @@
> * long counter __guarded_by(&lock1, &lock2);
> * };
> */
> +#if defined(__clang__) && __clang_major__ < 19
> +# define __guarded_by(...)
> +#else
> # define __guarded_by(...) __attribute__((guarded_by(__VA_ARGS__)))
> +#endif /* __clang_major__ < 19 */
>
> /**
> * __pt_guarded_by() - struct member and globals attribute, declares pointed-to
> @@ -85,7 +89,11 @@
> * long *counter __pt_guarded_by(&lock1, &lock2);
> * };
> */
> +#if defined(__clang__) && __clang_major__ < 19
> +# define __pt_guarded_by(...)
> +#else
> # define __pt_guarded_by(...) __attribute__((pt_guarded_by(__VA_ARGS__)))
> +#endif /* __clang_major__ < 19 */
>
> /**
> * context_lock_struct() - declare or define a context lock struct
> diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
> index c6b2ecadf9b12..caa7ab26968ce 100755
> --- a/tools/perf/check-headers.sh
> +++ b/tools/perf/check-headers.sh
> @@ -23,7 +23,6 @@ declare -a FILES=(
> "include/linux/bits.h"
> "include/vdso/bits.h"
> "include/linux/cfi_types.h"
> - "include/linux/compiler-context-analysis.h"
> "include/linux/const.h"
> "include/vdso/const.h"
> "include/vdso/unaligned.h"
> @@ -193,6 +192,7 @@ check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman
> check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"'
> check include/linux/build_bug.h '-I "^#\(ifndef\|endif\)\( \/\/\)* static_assert$"'
> check include/linux/ctype.h '-I "isdigit("'
> +check include/linux/compiler-context-analysis.h '-I "__clang_major__ < 19" -I "^# define __\(pt_\)*guarded_by(...)$"'
[Severity: Low]
Does this diff -I filter miss the bare #else lines added in
tools/include/linux/compiler-context-analysis.h?
diff -I only ignores a difference hunk when every changed line in that
hunk matches an -I pattern. Because the #else lines are part of the
3-line insertion hunks with #if and # define but match neither regex,
tools/perf/check-headers.sh still reports a header difference warning for
compiler-context-analysis.h. Adding the /* __clang_major__ < 19 */
comment to the two #else lines (or matching #else in the -I filter) lets
diff ignore the hunks.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-james-perf-late-parse-attr-v2-1-cb8b00d904a7@linaro.org?part=1
prev parent reply other threads:[~2026-11-24 11:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 11:20 [PATCH v2] perf build: Stub out __guarded_by() on older Clang versions James Clark
2026-11-24 11:26 ` sashiko-bot [this message]
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=sashiko-outbox-231049@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=james.clark@linaro.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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