Re: [PATCH v7 02/59] perf arch arm: Sort includes and add missed explicit dependencies

sashiko-bot
2026-04-25T23:05:25Z

Sashiko AI review found 1 potential issue(s):
- [Low] Incorrect primary header identification during include sorting. The patch moves `../../../util/cs-etm.h` to the top block and pushes the actual local primary header `"cs-etm.h"` to the very bottom.
--

commit febaa4aba550b6cb11c26a233479adf942c73a27
Author: Ian Rogers <irogers@google.com>

perf arch arm: Sort includes and add missed explicit dependencies

This commit adds missing includes found while cleaning evsel/evlist header
files and sorts the remaining headers in cs-etm.c for consistency.

> diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
> index b7a839de8707..cdf8e3e60606 100644
> --- a/tools/perf/arch/arm/util/cs-etm.c
> +++ b/tools/perf/arch/arm/util/cs-etm.c
> @@ -3,10 +3,13 @@
> * Copyright(C) 2015 Linaro Limited. All rights reserved.
> * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
> */
> +#include "../../../util/cs-etm.h"

This isn't a bug, but did the sorting logic mistakenly identify
../../../util/cs-etm.h as the primary header for this file?

A source file normally includes its own corresponding header file first
to verify that the header is self-contained. Since this cs-etm.c implements
functions declared in the local "cs-etm.h", that local header would
typically be the primary one.

[ ... ]

> #include "../../../util/session.h"
> -
> -#include <errno.h>
> -#include <stdlib.h>
> -#include <sys/stat.h>
> +#include "cs-etm.h"

Should "cs-etm.h" be placed at the top block instead of being sorted to the
very bottom of the include list?

Leaving the true primary header at the bottom bypasses its self-containedness
check, as the compiler has already parsed all the other system and utility
headers by the time it reaches this one.

--
Sashiko AI review · https://sashiko.dev/#/patchset/20260425224951.174663-1-irogers@google.com?part=2