Re: [PATCH perf/core] perf intel-pt: Fix clang build failure in intel_pt_synth_pebs_sample

From: Gustavo A. R. Silva
Date: Thu May 14 2020 - 11:01:27 EST


On Thu, May 14, 2020 at 10:10:30AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, May 13, 2020 at 06:47:38PM -0500, Gustavo A. R. Silva escreveu:
> > Fix the following build failure generated with command
> > $ make CC=clang HOSTCC=clang -C tools/ perf:
> >
> > util/intel-pt.c:1802:24: error: field 'br_stack' with variable sized type 'struct branch_stack' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
> > struct branch_stack br_stack;
> > ^
> > 1 error generated.
> >
> > Fix this by reordering the members of struct br.
>
> Yeah, I noticed that as far back as with ubuntu 16.04's clang:
>
> clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
>
> util/intel-pt.c:1802:24: error: field 'br_stack' with variable sized type 'struct branch_stack' not at the end of a struct or class is a GNU
> extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
> struct branch_stack br_stack;
> ^
> 1 error generated.
>
>
> Will fold this with the bug introducing the problem to avoid bisection
> problems.
>

I agree. Also, the commit hash of the "Fixes" tag only applies to the
perf/core branch and, I guess that might create confusion.

Thanks
--
Gustavo