Minor perf build fixes
cover Minor perf build fixes
Hi,
[1/2] is a trivial cleanup patch. I happened to notice it because the syntax highlighting of shell-script-mode broke due to the unmatched quotes.
I'm not sure why [2/2] hasn't already been noticed and fixed though.
Thanks.
Ramkumar Ramachandra (2):
perf/Makefile: do not open-code shell-sq
perf: squelch warnings from perl.h to compile-pass
tools/perf/Makefile | 2 +- tools/perf/config/Makefile | 23 +++++++++++----------- tools/perf/config/feature-tests.mak | 5 +++++ tools/perf/scripts/perl/Perf-Trace-Util/Context.c | 10 ++++++++-- tools/perf/scripts/perl/Perf-Trace-Util/Context.xs | 10 ++++++++-- .../perf/util/scripting-engines/trace-event-perl.c | 5 +++++ 6 files changed, 38 insertions(+), 17 deletions(-)
Signature · 1 line
1.8.3.1.643.gebeea52.dirty
PATCH 1/2 perf/Makefile: do not open-code shell-sq
d24e473e (perf_counter: copy in Git's top Makefile, 2009-04-20) started by determining *_SQ variables (shell-quoted equivalents) by calling subst by hand, with the rationale that $(call) must be avoided to accommodate ancient setups. That reasoning does not hold true anymore, as our Makefiles are filled with $(call) invocations now. So, use the shell-sq function introduced in ced465c4 (perf tools: Makefile:
PYTHON{,_CONFIG} to bandage Python 3 incompatibility, 2011-04-02) in place of open-coding.
--- tools/perf/Makefile | 2 +- tools/perf/config/Makefile | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-)
tools/perf/Makefile +1 -1
@@ -731,7 +731,7 @@ cscope: $(FIND) . -name '*.[hcS]' -print | xargs cscope -b ### Detect prefix changes -TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):\ +TRACK_CFLAGS = $(call escape-for-shell-sq,$(CFLAGS)):\ $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) $(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS
tools/perf/config/Makefile +11 -12
@@ -457,21 +457,20 @@ ETC_PERFCONFIG = etc/perfconfig endif lib = lib -# Shell quote (do not use $(call) to accommodate ancient setups); -ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG)) -DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) -bindir_SQ = $(subst ','\'',$(bindir)) -mandir_SQ = $(subst ','\'',$(mandir)) -infodir_SQ = $(subst ','\'',$(infodir)) -perfexecdir_SQ = $(subst ','\'',$(perfexecdir)) -template_dir_SQ = $(subst ','\'',$(template_dir)) -htmldir_SQ = $(subst ','\'',$(htmldir)) -prefix_SQ = $(subst ','\'',$(prefix)) -sysconfdir_SQ = $(subst ','\'',$(sysconfdir)) +ETC_PERFCONFIG_SQ = $(call shell-sq,$(ETC_PERFCONFIG)) +DESTDIR_SQ = $(call shell-sq,$(DESTDIR)) +bindir_SQ = $(call shell-sq,$(bindir)) +mandir_SQ = $(call shell-sq,$(mandir)) +infodir_SQ = $(call shell-sq,$(infodir)) +perfexecdir_SQ = $(call shell-sq,$(perfexecdir)) +template_dir_SQ = $(call shell-sq,$(template_dir)) +htmldir_SQ = $(call shell-sq,$(htmldir)) +prefix_SQ = $(call shell-sq,$(prefix)) +sysconfdir_SQ = $(call shell-sq,$(sysconfdir)) ifneq ($(filter /%,$(firstword $(perfexecdir))),) perfexec_instdir = $(perfexecdir) else perfexec_instdir = $(prefix)/$(perfexecdir) endif -perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir)) +perfexec_instdir_SQ = $(call shell-sq,$(perfexec_instdir))
Signature · 1 line
1.8.3.1.643.gebeea52.dirty
PATCH 2/2 perf: squelch warnings from perl.h to compile-pass
In reply to Ramkumar RamachandraCurrently, a simple
$ make
errors out because we compile with -Werror by default, turning all warnings into errors. Although no warnings are emitted by our code itself, two kinds of warnings are emitted by perl.h (perl 5.18.0):
-Wundef and -Wswitch-default
Use #pragma statements to squelch exactly those warnings, and get perf to compile-pass by default.
--- tools/perf/config/feature-tests.mak | 5 +++++ tools/perf/scripts/perl/Perf-Trace-Util/Context.c | 10 ++++++++-- tools/perf/scripts/perl/Perf-Trace-Util/Context.xs | 10 ++++++++-- tools/perf/util/scripting-engines/trace-event-perl.c | 5 +++++ 4 files changed, 26 insertions(+), 4 deletions(-)
tools/perf/config/feature-tests.mak +5 -0
@@ -103,7 +103,12 @@ endif ifndef NO_LIBPERL define SOURCE_PERL_EMBED #include <EXTERN.h> + +#pragma GCC diagnostic ignored \"-Wundef\" +#pragma GCC diagnostic ignored \"-Wswitch-default\" #include <perl.h> +#pragma GCC diagnostic error \"-Wundef\" +#pragma GCC diagnostic error \"-Wswitch-default\" int main(void) {
tools/perf/scripts/perl/Perf-Trace-Util/Context.c +8 -2
@@ -28,8 +28,14 @@* */ -#include "EXTERN.h" -#include "perl.h" +#include <EXTERN.h> + +#pragma GCC diagnostic ignored "-Wundef" +#pragma GCC diagnostic ignored "-Wswitch-default" +#include <perl.h> +#pragma GCC diagnostic error "-Wundef" +#pragma GCC diagnostic error "-Wswitch-default" +#include "XSUB.h" #include "../../../perf.h" #include "../../../util/trace-event.h"
tools/perf/scripts/perl/Perf-Trace-Util/Context.xs +8 -2
@@ -19,8 +19,14 @@ * */ -#include "EXTERN.h" -#include "perl.h" +#include <EXTERN.h> + +#pragma GCC diagnostic ignored "-Wundef" +#pragma GCC diagnostic ignored "-Wswitch-default" +#include <perl.h> +#pragma GCC diagnostic error "-Wundef" +#pragma GCC diagnostic error "-Wswitch-default" + #include "XSUB.h" #include "../../../perf.h" #include "../../../util/script-event.h"
tools/perf/util/scripting-engines/trace-event-perl.c +5 -0
@@ -27,7 +27,12 @@#include "../util.h" #include <EXTERN.h> + +#pragma GCC diagnostic ignored "-Wundef" +#pragma GCC diagnostic ignored "-Wswitch-default"#include <perl.h> +#pragma GCC diagnostic error "-Wundef" +#pragma GCC diagnostic error "-Wswitch-default"#include "../../perf.h" #include "../thread.h"
Signature · 1 line
1.8.3.1.643.gebeea52.dirty
Namhyung Kim
maintainerRe: [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass
Hi Ramkumar,
Quoted 9 lines · Ramkumar Ramachandra
Currently, a simple
$ makeerrors out because we compile with -Werror by default, turning all warnings into errors. Although no warnings are emitted by our code itself, two kinds of warnings are emitted by
perl.h(perl 5.18.0):-Wundef and -Wswitch-default
IIRC there's a floating patch for this, but I cannot find it now.
Quoted 19 lines
Use #pragma statements to squelch exactly those warnings, and get perf to compile-pass by default.
Cc Arnaldo Carvalho de Melo <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Ramkumar Ramachandra <[email protected]>--- tools/perf/config/feature-tests.mak | 5 +++++ tools/perf/scripts/perl/Perf-Trace-Util/Context.c | 10 ++++++++-- tools/perf/scripts/perl/Perf-Trace-Util/Context.xs | 10 ++++++++-- tools/perf/util/scripting-engines/trace-event-perl.c | 5 +++++ 4 files changed, 26 insertions(+), 4 deletions(-)tools/perf/config/feature-tests.mak +0
-0
tools/perf/config/feature-tests.mak endif · line 111
Quoted 9 lines
tools/perf/config/feature-tests.mak +5
-0@@ -103,7 +103,12 @@ endif ifndef NO_LIBPERL define SOURCE_PERL_EMBED #include <EXTERN.h> + +#pragma GCC diagnostic ignored \"-Wundef\" +#pragma GCC diagnostic ignored \"-Wswitch-default\" #include <perl.h> +#pragma GCC diagnostic error \"-Wundef\" +#pragma GCC diagnostic error \"-Wswitch-default\"
It seems that this kind of duplication is not a good solution. You'd better making an wraping header like ui/gtk/gtk.h.
Thanks,
Namhyung
Quoted 62 lines
tools/perf/config/feature-tests.mak +0
-0int main(void) {tools/perf/scripts/perl/Perf-Trace-Util/Context.c +8
-2@@ -28,8 +28,14 @@* */ -#include "EXTERN.h" -#include "perl.h" +#include <EXTERN.h> + +#pragma GCC diagnostic ignored "-Wundef" +#pragma GCC diagnostic ignored "-Wswitch-default" +#include <perl.h> +#pragma GCC diagnostic error "-Wundef" +#pragma GCC diagnostic error "-Wswitch-default" +#include "XSUB.h" #include "../../../perf.h" #include "../../../util/trace-event.h" tools/perf/scripts/perl/Perf-Trace-Util/Context.xs +8
-2@@ -19,8 +19,14 @@ * */ -#include "EXTERN.h" -#include "perl.h" +#include <EXTERN.h> + +#pragma GCC diagnostic ignored "-Wundef" +#pragma GCC diagnostic ignored "-Wswitch-default" +#include <perl.h> +#pragma GCC diagnostic error "-Wundef" +#pragma GCC diagnostic error "-Wswitch-default" + #include "XSUB.h" #include "../../../perf.h" #include "../../../util/script-event.h"tools/perf/util/scripting-engines/trace-event-perl.c +5
-0@@ -27,7 +27,12 @@#include "../util.h" #include <EXTERN.h> + +#pragma GCC diagnostic ignored "-Wundef" +#pragma GCC diagnostic ignored "-Wswitch-default"#include <perl.h> +#pragma GCC diagnostic error "-Wundef" +#pragma GCC diagnostic error "-Wswitch-default"#include "../../perf.h" #include "../thread.h"
Re: [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass
Quoted 7 lines · Namhyung Kim
Hi Ramkumar,
Quoted 4 lines · Ramkumar Ramachandra
Currently, a simple
$ make
Quoted 7 lines
Quoted 5 lines
errors out because we compile with -Werror by default, turning all warnings into errors. Although no warnings are emitted by our code itself, two kinds of warnings are emitted by
perl.h(perl 5.18.0):-Wundef and -Wswitch-default
IIRC there's a floating patch for this, but I cannot find it now.
This one: https://lkml.org/lkml/2013/6/24/66 ?
Signature · 1 line
Kirill A. Shutemov
Re: [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass
Quoted 10 lines · Kirill A. Shutemov
Quoted 9 lines · Namhyung Kim
Quoted 8 lines · Ramkumar Ramachandra
Currently, a simple
$ makeerrors out because we compile with -Werror by default, turning all warnings into errors. Although no warnings are emitted by our code itself, two kinds of warnings are emitted by
perl.h(perl 5.18.0):
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
-Wundef and -Wswitch-default
IIRC there's a floating patch for this, but I cannot find it now.
This one: https://lkml.org/lkml/2013/6/24/66 ?
Yeah, I think this is more sensible than my approach.
Re: [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass
Quoted 3 lines · Ramkumar Ramachandra
Quoted 1 line
This one: https://lkml.org/lkml/2013/6/24/66 ?
Yeah, I think this is more sensible than my approach.
Thanks to Namhyung, I think my v3 is better now:
http://article.gmane.org/gmane.linux.kernel/1522137