From: tip-bot for Namhyung Kim <namhyung.kim@lge.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org,
hpa@zytor.com, mingo@kernel.org, a.p.zijlstra@chello.nl,
namhyung.kim@lge.com, namhyung@kernel.org, tglx@linutronix.de
Subject: [tip:perf/urgent] perf tools: Convert to GTK2_SUPPORT
Date: Fri, 5 Oct 2012 01:34:40 -0700 [thread overview]
Message-ID: <tip-f9f526ecdc09a851f4f5567ebcf9bc553778f6c2@git.kernel.org> (raw)
In-Reply-To: <1348824728-14025-8-git-send-email-namhyung@kernel.org>
Commit-ID: f9f526ecdc09a851f4f5567ebcf9bc553778f6c2
Gitweb: http://git.kernel.org/tip/f9f526ecdc09a851f4f5567ebcf9bc553778f6c2
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Fri, 28 Sep 2012 18:32:03 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 2 Oct 2012 18:36:23 -0300
perf tools: Convert to GTK2_SUPPORT
For building perf without gtk+2, we can set NO_GTK2=1 as a argument of
make. It then defines NO_GTK2_SUPPORT macro for C code to do the
proper handling. However it usually used in a negative semantics -
e.g. #ifndef - so we saw double negations which can be misleading.
Convert it to a positive form to make it more readable.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1348824728-14025-8-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Makefile | 6 ++----
tools/perf/ui/helpline.h | 8 ++++----
tools/perf/util/cache.h | 28 +++++++++++++++-------------
tools/perf/util/debug.c | 2 +-
tools/perf/util/debug.h | 17 +++++++++--------
tools/perf/util/hist.h | 11 +++++------
6 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 3d2181c..31a07f9 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -583,17 +583,15 @@ ifndef NO_NEWT
endif
endif
-ifdef NO_GTK2
- BASIC_CFLAGS += -DNO_GTK2_SUPPORT
-else
+ifndef NO_GTK2
FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y)
msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
- BASIC_CFLAGS += -DNO_GTK2_SUPPORT
else
ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2)),y)
BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
endif
+ BASIC_CFLAGS += -DGTK2_SUPPORT
BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
diff --git a/tools/perf/ui/helpline.h b/tools/perf/ui/helpline.h
index e1f126b..baa28a4 100644
--- a/tools/perf/ui/helpline.h
+++ b/tools/perf/ui/helpline.h
@@ -34,14 +34,14 @@ static inline int ui_helpline__show_help(const char *format __maybe_unused,
}
#endif /* NEWT_SUPPORT */
-#ifdef NO_GTK2_SUPPORT
+#ifdef GTK2_SUPPORT
+int perf_gtk__show_helpline(const char *format, va_list ap);
+#else
static inline int perf_gtk__show_helpline(const char *format __maybe_unused,
va_list ap __maybe_unused)
{
return 0;
}
-#else
-int perf_gtk__show_helpline(const char *format, va_list ap);
-#endif /* NO_GTK2_SUPPORT */
+#endif /* GTK2_SUPPORT */
#endif /* _PERF_UI_HELPLINE_H_ */
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index 70f318d..07aec06 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -33,14 +33,7 @@ extern int pager_use_color;
extern int use_browser;
-#if !defined(NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT)
-static inline void setup_browser(bool fallback_to_pager)
-{
- if (fallback_to_pager)
- setup_pager();
-}
-static inline void exit_browser(bool wait_for_ok __maybe_unused) {}
-#else
+#if defined(NEWT_SUPPORT) || defined(GTK2_SUPPORT)
void setup_browser(bool fallback_to_pager);
void exit_browser(bool wait_for_ok);
@@ -55,17 +48,26 @@ static inline int ui__init(void)
static inline void ui__exit(bool wait_for_ok __maybe_unused) {}
#endif
-#ifdef NO_GTK2_SUPPORT
+#ifdef GTK2_SUPPORT
+int perf_gtk__init(void);
+void perf_gtk__exit(bool wait_for_ok);
+#else
static inline int perf_gtk__init(void)
{
return -1;
}
static inline void perf_gtk__exit(bool wait_for_ok __maybe_unused) {}
-#else
-int perf_gtk__init(void);
-void perf_gtk__exit(bool wait_for_ok);
#endif
-#endif /* !NEWT_SUPPORT && NO_GTK2_SUPPORT */
+
+#else /* NEWT_SUPPORT || GTK2_SUPPORT */
+
+static inline void setup_browser(bool fallback_to_pager)
+{
+ if (fallback_to_pager)
+ setup_pager();
+}
+static inline void exit_browser(bool wait_for_ok __maybe_unused) {}
+#endif /* NEWT_SUPPORT || GTK2_SUPPORT */
char *alias_lookup(const char *alias);
int split_cmdline(char *cmdline, const char ***argv);
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index 0f6ad70..03f830b 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -49,7 +49,7 @@ int dump_printf(const char *fmt, ...)
return ret;
}
-#if !defined(NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT)
+#if !defined(NEWT_SUPPORT) && !defined(GTK2_SUPPORT)
int ui__warning(const char *format, ...)
{
va_list args;
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index 3fe9ade..dec9875 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -15,7 +15,14 @@ void trace_event(union perf_event *event);
struct ui_progress;
struct perf_error_ops;
-#if !defined(NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT)
+#if defined(NEWT_SUPPORT) || defined(GTK2_SUPPORT)
+
+#include "../ui/progress.h"
+int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2)));
+#include "../ui/util.h"
+
+#else
+
static inline void ui_progress__update(u64 curr __maybe_unused,
u64 total __maybe_unused,
const char *title __maybe_unused) {}
@@ -34,13 +41,7 @@ perf_error__unregister(struct perf_error_ops *eops __maybe_unused)
return 0;
}
-#else /* !NEWT_SUPPORT && NO_GTK2_SUPPORT */
-
-#include "../ui/progress.h"
-int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2)));
-#include "../ui/util.h"
-
-#endif /* !NEWT_SUPPORT && NO_GTK2_SUPPORT */
+#endif /* NEWT_SUPPORT || GTK2_SUPPORT */
int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2)));
int ui__error_paranoid(void);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 843638d..6ca7407 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -187,7 +187,11 @@ static inline int hist_entry__tui_annotate(struct hist_entry *self
#define K_RIGHT -2
#endif
-#ifdef NO_GTK2_SUPPORT
+#ifdef GTK2_SUPPORT
+int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help,
+ void(*timer)(void *arg), void *arg,
+ int refresh);
+#else
static inline
int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused,
const char *help __maybe_unused,
@@ -197,11 +201,6 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused,
{
return 0;
}
-
-#else
-int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help,
- void(*timer)(void *arg), void *arg,
- int refresh);
#endif
unsigned int hists__sort_list_width(struct hists *self);
next prev parent reply other threads:[~2012-10-05 8:35 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-28 9:31 [PATCH 00/12] perf tools: Makefile and related cleanups Namhyung Kim
2012-09-28 9:31 ` [PATCH 01/12] perf tools: Move libdw availability check before arch Makefile Namhyung Kim
2012-10-05 8:28 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2012-09-28 9:31 ` [PATCH 02/12] perf tools: Remove unused PYRF_OBJS variable on Makefile Namhyung Kim
2012-10-05 8:29 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2012-09-28 9:31 ` [PATCH 03/12] perf tools: Convert to LIBELF_SUPPORT Namhyung Kim
2012-10-05 8:30 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2012-09-28 9:32 ` [PATCH 04/12] perf tools: Convert to LIBUNWIND_SUPPORT Namhyung Kim
2012-10-01 8:45 ` Jiri Olsa
2012-10-05 8:31 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2012-09-28 9:32 ` [PATCH 05/12] perf tools: Convert to LIBAUDIT_SUPPORT Namhyung Kim
2012-10-05 8:32 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2012-09-28 9:32 ` [PATCH 06/12] perf tools: Convert to NEWT_SUPPORT Namhyung Kim
2012-10-05 8:33 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2012-09-28 9:32 ` [PATCH 07/12] perf tools: Convert to GTK2_SUPPORT Namhyung Kim
2012-10-05 8:34 ` tip-bot for Namhyung Kim [this message]
2012-09-28 9:32 ` [PATCH 08/12] perf tools: Convert to LIBPERL_SUPPORT Namhyung Kim
2012-09-28 9:32 ` [PATCH 09/12] perf tools: Convert to LIBPYTHON_SUPPORT Namhyung Kim
2012-09-28 9:32 ` [PATCH 10/12] perf tools: Convert to DEMANGLE_SUPPORT Namhyung Kim
2012-09-28 9:32 ` [PATCH 11/12] perf tools: Convert to BACKTRACE_SUPPORT Namhyung Kim
2012-09-30 23:40 ` Irina Tirdea
2012-10-01 13:54 ` Namhyung Kim
2012-10-01 14:24 ` Arnaldo Carvalho de Melo
2012-10-01 16:32 ` [PATCH v2 " Namhyung Kim
2012-10-05 8:55 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2012-09-28 9:32 ` [PATCH 12/12] perf tools: Convert to HAVE_STRLCPY Namhyung Kim
2012-10-05 8:35 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
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=tip-f9f526ecdc09a851f4f5567ebcf9bc553778f6c2@git.kernel.org \
--to=namhyung.kim@lge.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome