lkml.org 
[lkml]   [2013]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] perf: squelch warnings from perl.h to compile-pass
Date
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


\
 
 \ /
  Last update: 2013-07-04 16:21    [W:0.043 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site