linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Namhyung Kim <namhyung.kim@lge.com>
Subject: Re: [PATCH 2/2] perf: squelch warnings from perl.h to compile-pass
Date: Fri, 05 Jul 2013 11:34:12 +0900	[thread overview]
Message-ID: <878v1lzqe3.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <1372945246-21605-3-git-send-email-artagnon@gmail.com> (Ramkumar Ramachandra's message of "Thu, 4 Jul 2013 19:10:46 +0530")

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"

  reply	other threads:[~2013-07-05  2:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2013-07-06 19:12     ` Kirill A. Shutemov
2013-07-07  9:22       ` Ramkumar Ramachandra
2013-07-09 10:06         ` Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878v1lzqe3.fsf@sejong.aot.lge.com \
    --to=namhyung@kernel.org \
    --cc=acme@redhat.com \
    --cc=artagnon@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung.kim@lge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).