From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ruljo-0001Uu-6O for qemu-devel@nongnu.org; Tue, 07 Feb 2012 09:09:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ruljf-0005fP-HM for qemu-devel@nongnu.org; Tue, 07 Feb 2012 09:09:40 -0500 Received: from oxygen.pond.sub.org ([78.46.104.156]:39188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ruljf-0005eU-CX for qemu-devel@nongnu.org; Tue, 07 Feb 2012 09:09:31 -0500 From: Markus Armbruster Date: Tue, 7 Feb 2012 15:09:12 +0100 Message-Id: <1328623766-12287-6-git-send-email-armbru@redhat.com> In-Reply-To: <1328623766-12287-1-git-send-email-armbru@redhat.com> References: <1328623766-12287-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH 05/19] vl.c: Error locations for options using add_device_config() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, aliguori@us.ibm.com These are -bt, -serial, -virtcon, -parallel, -debugcon, -usbdevice. Improves messages emitted via proper error reporting interfaces. For instance: $ qemu-system-x86_64 -nodefaults -S -usb -usbdevice net:vlan=xxx qemu-system-x86_64: Parameter 'vlan' expects a number becomes: qemu-system-x86_64: -usbdevice net:vlan=xxx: Parameter 'vlan' expects a number Many more remain unimproved, because they're fprintf()ed. The next few commits will take care of that. Signed-off-by: Markus Armbruster --- vl.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/vl.c b/vl.c index 2d464cf..e252a9d 100644 --- a/vl.c +++ b/vl.c @@ -1859,6 +1859,7 @@ struct device_config { DEV_DEBUGCON, /* -debugcon */ } type; const char *cmdline; + Location loc; QTAILQ_ENTRY(device_config) next; }; QTAILQ_HEAD(, device_config) device_configs = QTAILQ_HEAD_INITIALIZER(device_configs); @@ -1870,6 +1871,7 @@ static void add_device_config(int type, const char *cmdline) conf = g_malloc0(sizeof(*conf)); conf->type = type; conf->cmdline = cmdline; + loc_save(&conf->loc); QTAILQ_INSERT_TAIL(&device_configs, conf, next); } @@ -1881,7 +1883,9 @@ static int foreach_device_config(int type, int (*func)(const char *cmdline)) QTAILQ_FOREACH(conf, &device_configs, next) { if (conf->type != type) continue; + loc_push_restore(&conf->loc); rc = func(conf->cmdline); + loc_pop(&conf->loc); if (0 != rc) return rc; } -- 1.7.6.5