From: Lluís <xscript@gmx.net>
To: qemu-devel@nongnu.org
Cc: stefanha@gmail.com, chouteau@adacore.com
Subject: [Qemu-devel] [PATCH v4 02/10] trace: avoid conditional code compilation during option parsing
Date: Tue, 03 May 2011 22:40:56 +0200 [thread overview]
Message-ID: <20110503204056.438.46770.stgit@ginnungagap.bsc.es> (raw)
In-Reply-To: <20110503204042.438.2257.stgit@ginnungagap.bsc.es>
Instead of conditionally compiling option support, perform checks and issue the
corresponding error messages.
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
configure | 4 +++-
qemu-config.c | 4 ----
qemu-options.hx | 6 ++++--
vl.c | 17 +++++++++++++----
4 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/configure b/configure
index 6f75e2e..fef7d35 100755
--- a/configure
+++ b/configure
@@ -2945,7 +2945,9 @@ bsd)
esac
echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
-if test "$trace_backend" = "simple"; then
+if test "$trace_backend" = "nop"; then
+ echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
+elif test "$trace_backend" = "simple"; then
echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak
fi
# Set the appropriate trace file.
diff --git a/qemu-config.c b/qemu-config.c
index 14d3419..db5b14c 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -296,7 +296,6 @@ static QemuOptsList qemu_mon_opts = {
},
};
-#ifdef CONFIG_SIMPLE_TRACE
static QemuOptsList qemu_trace_opts = {
.name = "trace",
.implied_opt_name = "trace",
@@ -309,7 +308,6 @@ static QemuOptsList qemu_trace_opts = {
{ /* end if list */ }
},
};
-#endif
static QemuOptsList qemu_cpudef_opts = {
.name = "cpudef",
@@ -460,9 +458,7 @@ static QemuOptsList *vm_config_groups[32] = {
&qemu_global_opts,
&qemu_mon_opts,
&qemu_cpudef_opts,
-#ifdef CONFIG_SIMPLE_TRACE
&qemu_trace_opts,
-#endif
&qemu_option_rom_opts,
NULL,
};
diff --git a/qemu-options.hx b/qemu-options.hx
index 489df10..b439120 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2356,17 +2356,19 @@ Normally QEMU loads a configuration file from @var{sysconfdir}/qemu.conf and
@var{sysconfdir}/target-@var{ARCH}.conf on startup. The @code{-nodefconfig}
option will prevent QEMU from loading these configuration files at startup.
ETEXI
-#ifdef CONFIG_SIMPLE_TRACE
DEF("trace", HAS_ARG, QEMU_OPTION_trace,
"-trace\n"
" Specify a trace file to log traces to\n",
QEMU_ARCH_ALL)
STEXI
+HXCOMM This line is not accurate, as the option is backend-specific but HX does
+HXCOMM not support conditional compilation of text.
@item -trace
@findex -trace
Specify a trace file to log output traces to.
+
+This option is available only when using the @var{simple} tracing backend.
ETEXI
-#endif
HXCOMM This is the last statement. Insert new options before this line!
STEXI
diff --git a/vl.c b/vl.c
index 3eac0bc..9db7b64 100644
--- a/vl.c
+++ b/vl.c
@@ -2744,14 +2744,23 @@ int main(int argc, char **argv, char **envp)
}
xen_mode = XEN_ATTACH;
break;
-#ifdef CONFIG_SIMPLE_TRACE
case QEMU_OPTION_trace:
opts = qemu_opts_parse(qemu_find_opts("trace"), optarg, 0);
- if (opts) {
- trace_file = qemu_opt_get(opts, "file");
+ if (!opts) {
+ exit(1);
}
- break;
+#if defined(CONFIG_TRACE_NOP)
+ fprintf(stderr, "qemu: option \"-%s\" is not supported by this tracing backend\n", popt->name);
+ exit(1);
#endif
+ trace_file = qemu_opt_get(opts, "file");
+#if !defined(CONFIG_SIMPLE_TRACE)
+ if (trace_file) {
+ fprintf(stderr, "qemu: suboption \"-%s file\" is not supported by this tracing backend\n", popt->name);
+ exit(1);
+ }
+#endif
+ break;
case QEMU_OPTION_readconfig:
{
int ret = qemu_read_config_file(optarg);
next prev parent reply other threads:[~2011-05-03 20:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-03 20:40 [Qemu-devel] [RFC][PATCH v4 00/10] trace-state: make the behaviour of "disable" consistent across all backends Lluís
2011-05-03 20:40 ` [Qemu-devel] [PATCH v4 01/10] trace: move backend-specific code into the trace/ directory Lluís
2011-05-03 20:40 ` Lluís [this message]
2011-05-03 20:41 ` [Qemu-devel] [PATCH v4 03/10] trace: generalize the "property" concept in the trace-events file Lluís
2011-05-03 20:41 ` [Qemu-devel] [PATCH v4 04/10] trace-state: separate trace event control and query routines from the simple backend Lluís
2011-05-03 20:41 ` [Qemu-devel] [PATCH v4 05/10] trace-state: always compile support for controlling and querying trace event states Lluís
2011-05-03 20:41 ` [Qemu-devel] [PATCH v4 06/10] trace-state: add "-trace events" argument to control initial state Lluís
2011-05-03 20:41 ` [Qemu-devel] [PATCH v4 07/10] trace-state: always use the "nop" backend on events with the "disable" keyword Lluís
2011-05-03 20:41 ` [Qemu-devel] [PATCH v4 08/10] trace-state: [simple] disable all trace points by default Lluís
2011-05-03 20:41 ` [Qemu-devel] [PATCH v4 09/10] trace-state: [stderr] add support for dynamically enabling/disabling events Lluís
2011-05-04 14:17 ` Lluís
2011-05-03 20:41 ` [Qemu-devel] [PATCH v4 10/10] trace: enable all events Lluís
2011-05-19 14:10 ` [Qemu-devel] [RFC][PATCH v4 00/10] trace-state: make the behaviour of "disable" consistent across all backends Lluís
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=20110503204056.438.46770.stgit@ginnungagap.bsc.es \
--to=xscript@gmx.net \
--cc=chouteau@adacore.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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).