Re: [PATCH v6 1/9] perf c2c: extract shared data structures into c2c.h

[email protected] Mon, 03 Aug 2026 03:58:44 +0000
Newsgroups org.kernel.vger.linux-perf-users
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(=
s) to consider:
- [Medium] The header `c2c.h` uses the POSIX libc type `int64_t` but does n=
ot explicitly include `<stdint.h>`.
--

--- Patch [1]: [PATCH v6 1/9] perf c2c: extract shared data structures into=
 c2c.h ---
commit 0f5b8701063010839966e39a3a6a2759c7919cbf
Author: Jiebin Sun <[email protected]>

perf c2c: extract shared data structures into c2c.h

This commit moves shared data structures and formatting macros from
builtin-c2c.c into a new c2c.h header file. It also exports functions
like perf_c2c__browse_cacheline(), c2c_fmt_free(), and c2c_fmt_equal()
for reuse by the upcoming function view browser.

> diff --git a/tools/perf/c2c.h b/tools/perf/c2c.h
> new file mode 100644
> index 0000000000000..aac01d4f67605
> --- /dev/null
> +++ b/tools/perf/c2c.h
> @@ -0,0 +1,149 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _PERF_C2C_H_
> +#define _PERF_C2C_H_ 1
> +
> +#include <stdbool.h>
> +#include <linux/types.h>
> +#include "util/stat.h"
> +#include "util/hist.h"
> +#include "util/mem-events.h"
> +#include "util/mem2node.h"
> +#include "util/tool.h"

[ ... ]

> +struct c2c_dimension {
> +	struct c2c_header	 header;
> +	const char		*name;
> +	int			 width;
> +	struct sort_entry	*se;
> +
> +	int64_t (*cmp)(struct perf_hpp_fmt *fmt,
> +		       struct hist_entry *left, struct hist_entry *right);

[Severity: Medium]
Will this fail to compile under musl libc? The struct c2c_dimension uses
int64_t for the cmp function pointer, but c2c.h does not explicitly include
<stdint.h>.

Since musl strictly separates declarations, relying on implicit header incl=
usion
can lead to build failures. Should we explicitly include <stdint.h> at the =
top
of this file?

> +	int   (*entry)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
> +		       struct hist_entry *he);
> +	int   (*color)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
> +		       struct hist_entry *he);
> +};

--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260803035220.1720=
[email protected]?part=3D1