Re: [PATCH RESEND 1/1] perf build: Allow nested externs to enable BUILD_BUG() usage

From: Stephen Rothwell
Date: Mon Oct 12 2020 - 01:14:40 EST


Hi all,

On Mon, 12 Oct 2020 08:59:36 +1100 Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
>
> On Fri, 9 Oct 2020 14:41:11 +0200 Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
> >
> > On Fri, Oct 09, 2020 at 02:25:23PM +0200, Vasily Gorbik wrote:
> > > Currently BUILD_BUG() macro is expanded to smth like the following:
> > > do {
> > > extern void __compiletime_assert_0(void)
> > > __attribute__((error("BUILD_BUG failed")));
> > > if (!(!(1)))
> > > __compiletime_assert_0();
> > > } while (0);
> > >
> > > If used in a function body this obviously would produce build errors
> > > with -Wnested-externs and -Werror.
> > >
> > > To enable BUILD_BUG() usage in tools/arch/x86/lib/insn.c which perf
> > > includes in intel-pt-decoder, build perf without -Wnested-externs.
> > >
> > > Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> > > Signed-off-by: Vasily Gorbik <gor@xxxxxxxxxxxxx>
> >
> > that one applied nicely ;-) thanks
> >
> > Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>
>
> I will apply that patch to the merge of the tip tree today (instead of
> reverting the series I reverted in Friday) (unless I get an update of
> the tip tree containing it, of course).

Tested-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> # build tested

--
Cheers,
Stephen Rothwell

Attachment: pgpR7y_yLhI9d.pgp
Description: OpenPGP digital signature