Skip to contentSkip to conversation

Minor perf build fixes

PATCH Superseded Ramkumar Ramachandra 3 participants 7 messages Jul 4, 2013 – Jul 9, 2013 perf events

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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
index 203cb0e..ace1784 100644
@@ -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
index f139dcd..3025d87 100644
@@ -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
#2 lore raw

PATCH 2/2 perf: squelch warnings from perl.h to compile-pass

In reply to Ramkumar Ramachandra

Currently, 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.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Namhyung Kim <[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 +5 -0
index 708fb8e..91fa083 100644
@@ -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
index 790ceba..0807294 100644
@@ -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
index c1e2ed1..cd46e01 100644
@@ -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
index eacec85..aa3c11e 100644
@@ -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
maintainer
#3 lore raw

Re: [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass

Hi Ramkumar,

Quoted 9 lines · Ramkumar Ramachandra

Currently, 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

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]>
---
 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
index 708fb8e..91fa083 100644

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 -0
 int main(void)
 {
tools/perf/scripts/perl/Perf-Trace-Util/Context.c +8 -2
index 790ceba..0807294 100644
@@ -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
index c1e2ed1..cd46e01 100644
@@ -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
index eacec85..aa3c11e 100644
@@ -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"
#4 lore raw

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
#5 lore raw

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

  $ 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):

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.