perf tools: Fix calloc() arguments to address error introduced in gcc-14 29/312129/1
authorSun Haiyong <sunhaiyong@loongson.cn>
Sat, 6 Jan 2024 09:41:29 +0000 (17:41 +0800)
committerDongkyun Son <dongkyun.s@samsung.com>
Tue, 4 Jun 2024 11:48:41 +0000 (20:48 +0900)
commit056e616d308587ac7e2cea7a1a7414a060bce15b
treedd0c2c9ec6905f3e75a7a521fd0b5244cf2d70d1
parent275733ff01f0b9a19103e5316009277d32e7eb8b
perf tools: Fix calloc() arguments to address error introduced in gcc-14

the definition of calloc is as follows:

    void *calloc(size_t nmemb, size_t size);

number of members is in the first parameter and the size is in the
second parameter.

Fix error messages on gcc 14 20240102:

  error: 'calloc' sizes specified with 'sizeof' in the earlier argument and
  not in the later argument [-Werror=calloc-transposed-args]

Committer notes:

I noticed this on fedora 40 and rawhide.

cherry-picked from commit 7bbe8f0071dfa23fcc3b2864ec9f3b1aeb7ab2df

Change-Id: Ia96dbd404a3f9339e7e402465eaaa1b98c9d507c
Signed-off-by: Sun Haiyong <sunhaiyong@loongson.cn>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240106094129.3337057-1-siyanteng@loongson.cn
Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-record.c
tools/perf/util/hist.c
tools/perf/util/metricgroup.c
tools/perf/util/synthetic-events.c