Re: [PATCH v1 08/58] perf evsel/evlist: Avoid unnecessary #includes

sashiko-bot
2026-04-20T00:14:28Z

Sashiko AI review found 1 potential issue(s):
- [Low] Redundant forward declaration and commit message inaccuracies.
--

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

perf evsel/evlist: Avoid unnecessary #includes

This commit attempts to reduce header dependencies by using forward
declarations and removing unnecessary includes in evsel.h and evlist.h,
while also sorting the forward declarations.

> Use forward declarations and remove unnecessary #includes in evsel.h
> and evlist.h. Sort the forward declaration.s

This isn't a bug, but there is a typo (declaration.s) at the end of the
commit message.

Also, looking at the diff for evlist.h, it appears the includes were merely
reordered rather than removed. Is the commit message accurate regarding
removing unnecessary includes in evlist.h?

> diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
> index e507f5f20ef61..69784787da486 100644
> --- a/tools/perf/util/evlist.h
> +++ b/tools/perf/util/evlist.h

[ ... ]

> #include <api/fd/array.h>
> #include <internal/evlist.h>
> #include <internal/evsel.h>
> #include <perf/evlist.h>
> +
> #include "affinity.h"
> #include "events_stats.h"
> #include "evsel.h"
> #include "rblist.h"
> -#include <pthread.h>
> -#include <signal.h>
> -#include <unistd.h>
>
> -struct pollfd;
> -struct thread_map;
> +struct evsel;

Is this forward declaration for struct evsel needed? Since evsel.h is still
included a few lines above, the forward declaration appears to be redundant.

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