Patchwork [v2,05/11] trace: [simple] minor code fixes on conditional compilation

login
register
mail settings
Submitter =?utf-8?Q?Llu=C3=ADs?=
Date April 6, 2011, 6:34 p.m.
Message ID <20110406183423.22854.30920.stgit@ginnungagap.bsc.es>
Download mbox | patch
Permalink /patch/90050/
State New
Headers show

Comments

=?utf-8?Q?Llu=C3=ADs?= - April 6, 2011, 6:34 p.m.
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 monitor.c     |    4 +---
 qemu-config.c |    4 ++--
 simpletrace.h |    7 -------
 vl.c          |    7 +++++--
 4 files changed, 8 insertions(+), 14 deletions(-)
Stefan Hajnoczi - April 23, 2011, 2:20 p.m.
On Wed, Apr 6, 2011 at 7:34 PM, Lluís <xscript@gmx.net> wrote:
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
>  monitor.c     |    4 +---
>  qemu-config.c |    4 ++--
>  simpletrace.h |    7 -------
>  vl.c          |    7 +++++--
>  4 files changed, 8 insertions(+), 14 deletions(-)

Please drop this patch, it's purely a style change.

Stefan

Patch

diff --git a/monitor.c b/monitor.c
index 2ba1362..377424e 100644
--- a/monitor.c
+++ b/monitor.c
@@ -57,9 +57,7 @@ 
 #include "json-parser.h"
 #include "osdep.h"
 #include "exec-all.h"
-#ifdef CONFIG_SIMPLE_TRACE
 #include "trace.h"
-#endif
 #include "ui/qemu-spice.h"
 
 //#define DEBUG
@@ -592,7 +590,7 @@  static void do_help_cmd(Monitor *mon, const QDict *qdict)
     help_cmd(mon, qdict_get_try_str(qdict, "name"));
 }
 
-#ifdef CONFIG_SIMPLE_TRACE
+#if defined(CONFIG_SIMPLE_TRACE)
 static void do_change_trace_event_state(Monitor *mon, const QDict *qdict)
 {
     const char *tp_name = qdict_get_str(qdict, "name");
diff --git a/qemu-config.c b/qemu-config.c
index 323d3c2..8ba0804 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -297,7 +297,7 @@  static QemuOptsList qemu_mon_opts = {
     },
 };
 
-#ifdef CONFIG_SIMPLE_TRACE
+#if defined(CONFIG_SIMPLE_TRACE)
 static QemuOptsList qemu_trace_opts = {
     .name = "trace",
     .implied_opt_name = "trace",
@@ -461,7 +461,7 @@  static QemuOptsList *vm_config_groups[32] = {
     &qemu_global_opts,
     &qemu_mon_opts,
     &qemu_cpudef_opts,
-#ifdef CONFIG_SIMPLE_TRACE
+#if defined(CONFIG_SIMPLE_TRACE)
     &qemu_trace_opts,
 #endif
     &qemu_option_rom_opts,
diff --git a/simpletrace.h b/simpletrace.h
index 8d893bd..196bbe7 100644
--- a/simpletrace.h
+++ b/simpletrace.h
@@ -15,7 +15,6 @@ 
 #include <stdbool.h>
 #include <stdio.h>
 
-#ifdef CONFIG_SIMPLE_TRACE
 typedef uint64_t TraceEventID;
 
 typedef struct {
@@ -38,11 +37,5 @@  void st_set_trace_file_enabled(bool enable);
 bool st_set_trace_file(const char *file);
 void st_flush_trace_buffer(void);
 bool st_init(const char *file);
-#else
-static inline bool st_init(const char *file)
-{
-    return true;
-}
-#endif /* !CONFIG_SIMPLE_TRACE */
 
 #endif /* SIMPLETRACE_H */
diff --git a/vl.c b/vl.c
index 8478cb8..5a9ea51 100644
--- a/vl.c
+++ b/vl.c
@@ -156,7 +156,6 @@  int main(int argc, char **argv)
 #include "slirp/libslirp.h"
 
 #include "trace.h"
-#include "simpletrace.h"
 #include "qemu-queue.h"
 #include "cpus.h"
 #include "arch_init.h"
@@ -1967,7 +1966,9 @@  int main(int argc, char **argv, char **envp)
     int show_vnc_port = 0;
 #endif
     int defconfig = 1;
+#if defined(CONFIG_SIMPLE_TRACE)
     const char *trace_file = NULL;
+#endif
 
     atexit(qemu_run_exit_notifiers);
     error_set_progname(argv[0]);
@@ -2760,7 +2761,7 @@  int main(int argc, char **argv, char **envp)
                 }
                 xen_mode = XEN_ATTACH;
                 break;
-#ifdef CONFIG_SIMPLE_TRACE
+#if defined(CONFIG_SIMPLE_TRACE)
             case QEMU_OPTION_trace:
                 opts = qemu_opts_parse(qemu_find_opts("trace"), optarg, 0);
                 if (opts) {
@@ -2813,9 +2814,11 @@  int main(int argc, char **argv, char **envp)
     }
     loc_set_none();
 
+#if defined(CONFIG_SIMPLE_TRACE)
     if (!st_init(trace_file)) {
         fprintf(stderr, "warning: unable to initialize simple trace backend\n");
     }
+#endif
 
     /* If no data_dir is specified then try to find it relative to the
        executable path.  */