Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1254b51e authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo
Browse files

perf tools: Convert to NEWT_SUPPORT



For building perf without libnewt, we can set NO_NEWT=1 as a argument of
make.  It then defines NO_NEWT_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: default avatarNamhyung 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-7-git-send-email-namhyung@kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent f315e168
Loading
Loading
Loading
Loading
+3 −5
Original line number Original line Diff line number Diff line
@@ -554,16 +554,14 @@ ifndef NO_LIBAUDIT
	endif
	endif
endif
endif


ifdef NO_NEWT
ifndef NO_NEWT
	BASIC_CFLAGS += -DNO_NEWT_SUPPORT
else
	FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt
	FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt
	ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y)
	ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y)
		msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev);
		msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev);
		BASIC_CFLAGS += -DNO_NEWT_SUPPORT
	else
	else
		# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
		# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
		BASIC_CFLAGS += -I/usr/include/slang
		BASIC_CFLAGS += -I/usr/include/slang
		BASIC_CFLAGS += -DNEWT_SUPPORT
		EXTLIBS += -lnewt -lslang
		EXTLIBS += -lnewt -lslang
		LIB_OBJS += $(OUTPUT)ui/setup.o
		LIB_OBJS += $(OUTPUT)ui/setup.o
		LIB_OBJS += $(OUTPUT)ui/browser.o
		LIB_OBJS += $(OUTPUT)ui/browser.o
@@ -603,7 +601,7 @@ else
		LIB_OBJS += $(OUTPUT)ui/gtk/util.o
		LIB_OBJS += $(OUTPUT)ui/gtk/util.o
		LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
		LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
		# Make sure that it'd be included only once.
		# Make sure that it'd be included only once.
		ifneq ($(findstring -DNO_NEWT_SUPPORT,$(BASIC_CFLAGS)),)
		ifeq ($(findstring -DNEWT_SUPPORT,$(BASIC_CFLAGS)),)
			LIB_OBJS += $(OUTPUT)ui/setup.o
			LIB_OBJS += $(OUTPUT)ui/setup.o
			LIB_OBJS += $(OUTPUT)ui/util.o
			LIB_OBJS += $(OUTPUT)ui/util.o
		endif
		endif
+1 −1
Original line number Original line Diff line number Diff line
@@ -116,7 +116,7 @@ struct perf_error_ops perf_gtk_eops = {
 * FIXME: Functions below should be implemented properly.
 * FIXME: Functions below should be implemented properly.
 *        For now, just add stubs for NO_NEWT=1 build.
 *        For now, just add stubs for NO_NEWT=1 build.
 */
 */
#ifdef NO_NEWT_SUPPORT
#ifndef NEWT_SUPPORT
void ui_progress__update(u64 curr __maybe_unused, u64 total __maybe_unused,
void ui_progress__update(u64 curr __maybe_unused, u64 total __maybe_unused,
			 const char *title __maybe_unused)
			 const char *title __maybe_unused)
{
{
+5 −5
Original line number Original line Diff line number Diff line
@@ -23,16 +23,16 @@ void ui_helpline__puts(const char *msg);


extern char ui_helpline__current[512];
extern char ui_helpline__current[512];


#ifdef NO_NEWT_SUPPORT
#ifdef NEWT_SUPPORT
extern char ui_helpline__last_msg[];
int ui_helpline__show_help(const char *format, va_list ap);
#else
static inline int ui_helpline__show_help(const char *format __maybe_unused,
static inline int ui_helpline__show_help(const char *format __maybe_unused,
					 va_list ap __maybe_unused)
					 va_list ap __maybe_unused)
{
{
	return 0;
	return 0;
}
}
#else
#endif /* NEWT_SUPPORT */
extern char ui_helpline__last_msg[];
int ui_helpline__show_help(const char *format, va_list ap);
#endif /* NO_NEWT_SUPPORT */


#ifdef NO_GTK2_SUPPORT
#ifdef NO_GTK2_SUPPORT
static inline int perf_gtk__show_helpline(const char *format __maybe_unused,
static inline int perf_gtk__show_helpline(const char *format __maybe_unused,
+4 −4
Original line number Original line Diff line number Diff line
@@ -138,7 +138,10 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
			 bool print_lines, bool full_paths, int min_pcnt,
			 bool print_lines, bool full_paths, int min_pcnt,
			 int max_lines);
			 int max_lines);


#ifdef NO_NEWT_SUPPORT
#ifdef NEWT_SUPPORT
int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
			 void(*timer)(void *arg), void *arg, int delay_secs);
#else
static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,
static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,
				       struct map *map __maybe_unused,
				       struct map *map __maybe_unused,
				       int evidx __maybe_unused,
				       int evidx __maybe_unused,
@@ -148,9 +151,6 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,
{
{
	return 0;
	return 0;
}
}
#else
int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
			 void(*timer)(void *arg), void *arg, int delay_secs);
#endif
#endif


extern const char	*disassembler_style;
extern const char	*disassembler_style;
+6 −6
Original line number Original line Diff line number Diff line
@@ -33,7 +33,7 @@ extern int pager_use_color;


extern int use_browser;
extern int use_browser;


#if defined(NO_NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT)
#if !defined(NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT)
static inline void setup_browser(bool fallback_to_pager)
static inline void setup_browser(bool fallback_to_pager)
{
{
	if (fallback_to_pager)
	if (fallback_to_pager)
@@ -44,15 +44,15 @@ static inline void exit_browser(bool wait_for_ok __maybe_unused) {}
void setup_browser(bool fallback_to_pager);
void setup_browser(bool fallback_to_pager);
void exit_browser(bool wait_for_ok);
void exit_browser(bool wait_for_ok);


#ifdef NO_NEWT_SUPPORT
#ifdef NEWT_SUPPORT
int ui__init(void);
void ui__exit(bool wait_for_ok);
#else
static inline int ui__init(void)
static inline int ui__init(void)
{
{
	return -1;
	return -1;
}
}
static inline void ui__exit(bool wait_for_ok __maybe_unused) {}
static inline void ui__exit(bool wait_for_ok __maybe_unused) {}
#else
int ui__init(void);
void ui__exit(bool wait_for_ok);
#endif
#endif


#ifdef NO_GTK2_SUPPORT
#ifdef NO_GTK2_SUPPORT
@@ -65,7 +65,7 @@ static inline void perf_gtk__exit(bool wait_for_ok __maybe_unused) {}
int perf_gtk__init(void);
int perf_gtk__init(void);
void perf_gtk__exit(bool wait_for_ok);
void perf_gtk__exit(bool wait_for_ok);
#endif
#endif
#endif /* NO_NEWT_SUPPORT && NO_GTK2_SUPPORT */
#endif /* !NEWT_SUPPORT && NO_GTK2_SUPPORT */


char *alias_lookup(const char *alias);
char *alias_lookup(const char *alias);
int split_cmdline(char *cmdline, const char ***argv);
int split_cmdline(char *cmdline, const char ***argv);
Loading