Skip to contentSkip to conversation

4.1 backport request: Two perf build fixes

DISCUSSION Tuomas Tynkkynen 1 participant 1 message Nov 2, 2017 Stable branch

lore
Share & tools
lore

Tuomas Tynkkynen

author Tested-by Arnaldo Carvalho de Melo
#0 lore raw

Hi Sasha,

First, the following commit:

commit b5bf1733d6a391c4e90ea8f8468d83023be74a2a

Author: Arnaldo Carvalho de Melo <[email protected]>
Date:   Wed Feb 8 17:01:46 2017 -0300

tools include: Add a __fallthrough statement

For cases where implicit fall through case labels are intended, to let us inform that to gcc >= 7:

CC /tmp/build/perf/util/string.o
util/string.c: In function 'perf_atoll':
util/string.c:22:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (*p)
^
util/string.c:24:3: note: here
case '\0':
^~~~

So we introduce:

#define __fallthrough __attribute__ ((fallthrough))

And use it in such cases.

That is required because there already some commits picked to 4.1 that use __fallthrough without the declaration, namely:

ed83069083743b perf top: Use __fallthrough 9de93e56698fe2 tools string: Use __fallthrough in perf_atoll()

Next, the following commit is required to make perf build in distributions with new Perl:

commit b581c01fff646b5075d65359c8667de9c667da9e

Author: Namhyung Kim <[email protected]>
Date:   Tue Aug 2 11:43:17 2016 +0900

perf tools: Fix build failure on perl script context

On my Archlinux machine, perf faild to build like below:

CC scripts/perl/Perf-Trace-Util/Context.o
In file included from /usr/lib/perl5/core/perl/CORE/perl.h:3905:0,
from Context.xs:23:
/usr/lib/perl5/core/perl/CORE/inline.h: In function :
/usr/lib/perl5/core/perl/CORE/cop.h:612:13: warning: declaration of 'av'
shadows a previous local [-Werror-shadow]
AV *av =3D GvAV(PL_defgv);
^
/usr/lib/perl5/core/perl/CORE/inline.h:526:5: note: in expansion of
macro 'CX_POP_SAVEARRAY'
CX_POP_SAVEARRAY(cx);
^~~~~~~~~~~~~~~~
In file included from /usr/lib/perl5/core/perl/CORE/perl.h:5853:0,
from Context.xs:23:
/usr/lib/perl5/core/perl/CORE/inline.h:518:9: note:
shadowed declaration is here
AV *av;
^~

What I did to fix is adding '-Wno-shadow' as the error message said it's the cause of the failure. Since it's from the perl (not perf) code base, we don't have the control so I just wanted to ignore the warning when compiling perl scripting code.

Committer note:

This also fixes the build on Fedora Rawhide.

Thanks.