* [PATCH v1] perf clang-format: Prioritize Python.h and expand other categories
@ 2026-05-26 21:39 Ian Rogers
2026-05-26 22:42 ` [PATCH v2] " Ian Rogers
0 siblings, 1 reply; 4+ messages in thread
From: Ian Rogers @ 2026-05-26 21:39 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Jiri Olsa, Ian Rogers, Adrian Hunter, James Clark,
linux-perf-users, linux-kernel
- Prioritize Python.h by sorting it first (Priority 0).
- Shift other header priorities down to accommodate Python.h.
- Sanity check and complete "C Standard Library Headers" up to C23
(added stdbit.h, stdckdint.h).
- Sanity check and complete "OS/System-Specific Headers" based on
actual usage in tools/perf (added asm-generic, uapi, and various
flat POSIX/system headers).
Signed-off-by: Ian Rogers <irogers@google.com>
Assisted-by: Antigravity:gemini-3.5-flash
---
tools/perf/.clang-format | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/tools/perf/.clang-format b/tools/perf/.clang-format
index 902b2f7456f6..68b1c073d070 100644
--- a/tools/perf/.clang-format
+++ b/tools/perf/.clang-format
@@ -2,19 +2,22 @@ BasedOnStyle: InheritParentConfig
SortIncludes: true
IncludeBlocks: Regroup
IncludeCategories:
+ # Python.h must be first
+ - Regex: '^<Python\.h>'
+ Priority: 0
# Implicitly the corresponding header for the C file has Priority 0
# C Standard Library Headers
- - Regex: '^<(assert|complex|ctype|errno|fenv|float|inttypes|iso646|limits|locale|math|setjmp|signal|stdalign|stdarg|stdatomic|stdbool|stddef|stdint|stdio|stdlib|stdnoreturn|string|tgmath|threads|time|uchar|wchar|wctype)\.h>'
- Priority: 1
- # OS/System-Specific Headers (directories)
- - Regex: '^<(sys|linux|asm|arpa|net|netinet|x86_64|machine)/.*>'
+ - Regex: '^<(assert|complex|ctype|errno|fenv|float|inttypes|iso646|limits|locale|math|setjmp|signal|stdalign|stdarg|stdatomic|stdbit|stdbool|stdckdint|stddef|stdint|stdio|stdlib|stdnoreturn|string|tgmath|threads|time|uchar|wchar|wctype)\.h>'
Priority: 2
+ # OS/System-Specific Headers (directories)
+ - Regex: '^<(arpa|asm|asm-generic|linux|machine|net|netinet|sys|uapi|x86_64)/.*>'
+ Priority: 3
# OS/System-Specific Headers (POSIX/System flat headers)
- - Regex: '^<(unistd|pthread|fcntl|dirent|dlfcn|poll|sched|semaphore|spawn|syslog|termios|pwd|grp|netdb|sysexits|err|paths|pty|utmp|resolv|ifaddrs|elf|libelf|gelf)\.h>'
- Priority: 2
+ - Regex: '^<(aio|byteswap|dirent|dlfcn|elf|endian|err|execinfo|fcntl|features|fnmatch|ftw|gelf|getopt|grp|ifaddrs|libelf|libgen|malloc|memory|mntent|netdb|numa|numaif|paths|poll|pthread|pty|pwd|regex|resolv|sched|semaphore|spawn|strings|syscall|sysexits|syslog|termios|unistd|utmp|x86intrin)\.h>'
+ Priority: 3
# Third-Party Library Headers
- Regex: '^<.*>'
- Priority: 3
+ Priority: 4
# Your Project's Other Headers
- Regex: '^".*"'
- Priority: 4
+ Priority: 5
--
2.54.0.823.g6e5bcc1fc9-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] perf clang-format: Prioritize Python.h and expand other categories
2026-05-26 21:39 [PATCH v1] perf clang-format: Prioritize Python.h and expand other categories Ian Rogers
@ 2026-05-26 22:42 ` Ian Rogers
2026-06-05 6:24 ` [PATCH v3] " Ian Rogers
0 siblings, 1 reply; 4+ messages in thread
From: Ian Rogers @ 2026-05-26 22:42 UTC (permalink / raw)
To: irogers, acme, namhyung
Cc: adrian.hunter, james.clark, jolsa, linux-kernel,
linux-perf-users, mingo, peterz
- Prioritize Python.h by sorting it first (Priority 0).
- Shift other header priorities down to accommodate Python.h.
- Sanity check and complete "C Standard Library Headers" up to C23
(added stdbit.h, stdckdint.h).
- Sanity check and complete "OS/System-Specific Headers" based on
actual usage in tools/perf (added asm-generic, uapi, and various
flat POSIX/system headers).
Signed-off-by: Ian Rogers <irogers@google.com>
Assisted-by: Antigravity:gemini-3.5-flash
---
tools/perf/.clang-format | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tools/perf/.clang-format b/tools/perf/.clang-format
index 902b2f7456f6..e4cff363a603 100644
--- a/tools/perf/.clang-format
+++ b/tools/perf/.clang-format
@@ -2,15 +2,18 @@ BasedOnStyle: InheritParentConfig
SortIncludes: true
IncludeBlocks: Regroup
IncludeCategories:
+ # Python.h must be first
+ - Regex: '^<Python\.h>'
+ Priority: -1
# Implicitly the corresponding header for the C file has Priority 0
# C Standard Library Headers
- - Regex: '^<(assert|complex|ctype|errno|fenv|float|inttypes|iso646|limits|locale|math|setjmp|signal|stdalign|stdarg|stdatomic|stdbool|stddef|stdint|stdio|stdlib|stdnoreturn|string|tgmath|threads|time|uchar|wchar|wctype)\.h>'
+ - Regex: '^<(assert|complex|ctype|errno|fenv|float|inttypes|iso646|limits|locale|math|setjmp|signal|stdalign|stdarg|stdatomic|stdbit|stdbool|stdckdint|stddef|stdint|stdio|stdlib|stdnoreturn|string|tgmath|threads|time|uchar|wchar|wctype)\.h>'
Priority: 1
# OS/System-Specific Headers (directories)
- - Regex: '^<(sys|linux|asm|arpa|net|netinet|x86_64|machine)/.*>'
+ - Regex: '^<(arpa|asm|asm-generic|linux|machine|net|netinet|sys|uapi|x86_64)/.*>'
Priority: 2
# OS/System-Specific Headers (POSIX/System flat headers)
- - Regex: '^<(unistd|pthread|fcntl|dirent|dlfcn|poll|sched|semaphore|spawn|syslog|termios|pwd|grp|netdb|sysexits|err|paths|pty|utmp|resolv|ifaddrs|elf|libelf|gelf)\.h>'
+ - Regex: '^<(aio|byteswap|dirent|dlfcn|elf|endian|err|execinfo|fcntl|features|fnmatch|ftw|gelf|getopt|grp|ifaddrs|libelf|libgen|malloc|memory|mntent|netdb|numa|numaif|paths|poll|pthread|pty|pwd|regex|resolv|sched|semaphore|spawn|strings|syscall|sysexits|syslog|termios|unistd|utmp|x86intrin)\.h>'
Priority: 2
# Third-Party Library Headers
- Regex: '^<.*>'
--
2.54.0.823.g6e5bcc1fc9-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3] perf clang-format: Prioritize Python.h and expand other categories
2026-05-26 22:42 ` [PATCH v2] " Ian Rogers
@ 2026-06-05 6:24 ` Ian Rogers
2026-07-12 6:56 ` Namhyung Kim
0 siblings, 1 reply; 4+ messages in thread
From: Ian Rogers @ 2026-06-05 6:24 UTC (permalink / raw)
To: irogers, acme, namhyung
Cc: adrian.hunter, james.clark, jolsa, linux-kernel,
linux-perf-users, mingo, peterz
This commit updates the .clang-format rules for the perf tools.
It prioritizes Python.h sorting and expands the regex lists for C
standard library and OS specific headers.
- Prioritize Python.h by sorting it first (Priority -1), ensuring it
is sorted before even the main header (Priority 0).
- Keep other header priorities (1 and 2) to maintain their relative
order.
- Sanity check and complete "C Standard Library Headers" up to C23
(added stdbit.h, stdckdint.h).
- Sanity check and complete "OS/System-Specific Headers" based on
actual usage in tools/perf (added asm-generic, uapi, and various
flat POSIX/system headers).
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/.clang-format | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tools/perf/.clang-format b/tools/perf/.clang-format
index 902b2f7456f6..e4cff363a603 100644
--- a/tools/perf/.clang-format
+++ b/tools/perf/.clang-format
@@ -2,15 +2,18 @@ BasedOnStyle: InheritParentConfig
SortIncludes: true
IncludeBlocks: Regroup
IncludeCategories:
+ # Python.h must be first
+ - Regex: '^<Python\.h>'
+ Priority: -1
# Implicitly the corresponding header for the C file has Priority 0
# C Standard Library Headers
- - Regex: '^<(assert|complex|ctype|errno|fenv|float|inttypes|iso646|limits|locale|math|setjmp|signal|stdalign|stdarg|stdatomic|stdbool|stddef|stdint|stdio|stdlib|stdnoreturn|string|tgmath|threads|time|uchar|wchar|wctype)\.h>'
+ - Regex: '^<(assert|complex|ctype|errno|fenv|float|inttypes|iso646|limits|locale|math|setjmp|signal|stdalign|stdarg|stdatomic|stdbit|stdbool|stdckdint|stddef|stdint|stdio|stdlib|stdnoreturn|string|tgmath|threads|time|uchar|wchar|wctype)\.h>'
Priority: 1
# OS/System-Specific Headers (directories)
- - Regex: '^<(sys|linux|asm|arpa|net|netinet|x86_64|machine)/.*>'
+ - Regex: '^<(arpa|asm|asm-generic|linux|machine|net|netinet|sys|uapi|x86_64)/.*>'
Priority: 2
# OS/System-Specific Headers (POSIX/System flat headers)
- - Regex: '^<(unistd|pthread|fcntl|dirent|dlfcn|poll|sched|semaphore|spawn|syslog|termios|pwd|grp|netdb|sysexits|err|paths|pty|utmp|resolv|ifaddrs|elf|libelf|gelf)\.h>'
+ - Regex: '^<(aio|byteswap|dirent|dlfcn|elf|endian|err|execinfo|fcntl|features|fnmatch|ftw|gelf|getopt|grp|ifaddrs|libelf|libgen|malloc|memory|mntent|netdb|numa|numaif|paths|poll|pthread|pty|pwd|regex|resolv|sched|semaphore|spawn|strings|syscall|sysexits|syslog|termios|unistd|utmp|x86intrin)\.h>'
Priority: 2
# Third-Party Library Headers
- Regex: '^<.*>'
--
2.54.0.1032.g2f8565e1d1-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] perf clang-format: Prioritize Python.h and expand other categories
2026-06-05 6:24 ` [PATCH v3] " Ian Rogers
@ 2026-07-12 6:56 ` Namhyung Kim
0 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2026-07-12 6:56 UTC (permalink / raw)
To: acme, Ian Rogers
Cc: adrian.hunter, james.clark, jolsa, linux-kernel,
linux-perf-users, mingo, peterz
On Thu, 04 Jun 2026 23:24:18 -0700, Ian Rogers wrote:
> This commit updates the .clang-format rules for the perf tools.
> It prioritizes Python.h sorting and expands the regex lists for C
> standard library and OS specific headers.
>
> - Prioritize Python.h by sorting it first (Priority -1), ensuring it
> is sorted before even the main header (Priority 0).
> - Keep other header priorities (1 and 2) to maintain their relative
> order.
> - Sanity check and complete "C Standard Library Headers" up to C23
> (added stdbit.h, stdckdint.h).
> - Sanity check and complete "OS/System-Specific Headers" based on
> actual usage in tools/perf (added asm-generic, uapi, and various
> flat POSIX/system headers).
>
> [...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-12 6:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-26 21:39 [PATCH v1] perf clang-format: Prioritize Python.h and expand other categories Ian Rogers
2026-05-26 22:42 ` [PATCH v2] " Ian Rogers
2026-06-05 6:24 ` [PATCH v3] " Ian Rogers
2026-07-12 6:56 ` Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox