linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Minor perf build fixes
@ 2013-07-04 13:40 Ramkumar Ramachandra
  2013-07-04 13:40 ` [PATCH 1/2] perf/Makefile: do not open-code shell-sq Ramkumar Ramachandra
  2013-07-04 13:40 ` [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass Ramkumar Ramachandra
  0 siblings, 2 replies; 7+ messages in thread
From: Ramkumar Ramachandra @ 2013-07-04 13:40 UTC (permalink / raw)
  To: LKML

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(-)

-- 
1.8.3.1.643.gebeea52.dirty


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] perf/Makefile: do not open-code shell-sq
  2013-07-04 13:40 [PATCH 0/2] Minor perf build fixes Ramkumar Ramachandra
@ 2013-07-04 13:40 ` Ramkumar Ramachandra
  2013-07-04 13:40 ` [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass Ramkumar Ramachandra
  1 sibling, 0 replies; 7+ messages in thread
From: Ramkumar Ramachandra @ 2013-07-04 13:40 UTC (permalink / raw)
  To: LKML; +Cc: Michael Witten, Ingo Molnar

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.

Cc: Michael Witten <mfwitten@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 tools/perf/Makefile        |  2 +-
 tools/perf/config/Makefile | 23 +++++++++++------------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 203cb0e..ace1784 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -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
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index f139dcd..3025d87 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -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))
-- 
1.8.3.1.643.gebeea52.dirty


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass
  2013-07-04 13:40 [PATCH 0/2] Minor perf build fixes Ramkumar Ramachandra
  2013-07-04 13:40 ` [PATCH 1/2] perf/Makefile: do not open-code shell-sq Ramkumar Ramachandra
@ 2013-07-04 13:40 ` Ramkumar Ramachandra
  2013-07-05  2:34   ` Namhyung Kim
  1 sibling, 1 reply; 7+ messages in thread
From: Ramkumar Ramachandra @ 2013-07-04 13:40 UTC (permalink / raw)
  To: LKML; +Cc: Arnaldo Carvalho de Melo, Namhyung Kim

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 <acme@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 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(-)

diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index 708fb8e..91fa083 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -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)
 {
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Context.c b/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
index 790ceba..0807294 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
@@ -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"
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
index c1e2ed1..cd46e01 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
@@ -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"
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index eacec85..aa3c11e 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -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"
-- 
1.8.3.1.643.gebeea52.dirty


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass
  2013-07-04 13:40 ` [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass Ramkumar Ramachandra
@ 2013-07-05  2:34   ` Namhyung Kim
  2013-07-06 19:12     ` Kirill A. Shutemov
  0 siblings, 1 reply; 7+ messages in thread
From: Namhyung Kim @ 2013-07-05  2:34 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: LKML, Arnaldo Carvalho de Melo, Namhyung Kim

Hi Ramkumar,

On Thu,  4 Jul 2013 19:10:46 +0530, Ramkumar Ramachandra wrote:
> 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.

>
> Use #pragma statements to squelch exactly those warnings, and get perf
> to compile-pass by default.
>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Namhyung Kim <namhyung.kim@lge.com>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
>  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(-)
>
> diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
> index 708fb8e..91fa083 100644
> --- a/tools/perf/config/feature-tests.mak
> +++ b/tools/perf/config/feature-tests.mak
> @@ -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

>  
>  int main(void)
>  {
> diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Context.c b/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
> index 790ceba..0807294 100644
> --- a/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
> +++ b/tools/perf/scripts/perl/Perf-Trace-Util/Context.c
> @@ -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"
> diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
> index c1e2ed1..cd46e01 100644
> --- a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
> +++ b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
> @@ -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"
> diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
> index eacec85..aa3c11e 100644
> --- a/tools/perf/util/scripting-engines/trace-event-perl.c
> +++ b/tools/perf/util/scripting-engines/trace-event-perl.c
> @@ -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"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass
  2013-07-05  2:34   ` Namhyung Kim
@ 2013-07-06 19:12     ` Kirill A. Shutemov
  2013-07-07  9:22       ` Ramkumar Ramachandra
  0 siblings, 1 reply; 7+ messages in thread
From: Kirill A. Shutemov @ 2013-07-06 19:12 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Ramkumar Ramachandra, LKML, Arnaldo Carvalho de Melo, Namhyung Kim

On Fri, Jul 05, 2013 at 11:34:12AM +0900, Namhyung Kim wrote:
> Hi Ramkumar,
> 
> On Thu,  4 Jul 2013 19:10:46 +0530, Ramkumar Ramachandra wrote:
> > 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.

This one: https://lkml.org/lkml/2013/6/24/66 ?

-- 
 Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass
  2013-07-06 19:12     ` Kirill A. Shutemov
@ 2013-07-07  9:22       ` Ramkumar Ramachandra
  2013-07-09 10:06         ` Ramkumar Ramachandra
  0 siblings, 1 reply; 7+ messages in thread
From: Ramkumar Ramachandra @ 2013-07-07  9:22 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: Namhyung Kim, LKML, Arnaldo Carvalho de Melo, Namhyung Kim

Kirill A. Shutemov wrote:
> On Fri, Jul 05, 2013 at 11:34:12AM +0900, Namhyung Kim wrote:
>> On Thu,  4 Jul 2013 19:10:46 +0530, Ramkumar Ramachandra wrote:
>> > 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.
>
> This one: https://lkml.org/lkml/2013/6/24/66 ?

Yeah, I think this is more sensible than my approach.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass
  2013-07-07  9:22       ` Ramkumar Ramachandra
@ 2013-07-09 10:06         ` Ramkumar Ramachandra
  0 siblings, 0 replies; 7+ messages in thread
From: Ramkumar Ramachandra @ 2013-07-09 10:06 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: Namhyung Kim, LKML, Arnaldo Carvalho de Melo, Namhyung Kim

Ramkumar Ramachandra wrote:
>> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-07-09 10:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-04 13:40 [PATCH 0/2] Minor perf build fixes Ramkumar Ramachandra
2013-07-04 13:40 ` [PATCH 1/2] perf/Makefile: do not open-code shell-sq Ramkumar Ramachandra
2013-07-04 13:40 ` [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass Ramkumar Ramachandra
2013-07-05  2:34   ` Namhyung Kim
2013-07-06 19:12     ` Kirill A. Shutemov
2013-07-07  9:22       ` Ramkumar Ramachandra
2013-07-09 10:06         ` Ramkumar Ramachandra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).