Skip to contentSkip to conversation

error: Clean up after recent changes

PATCH Applied Markus Armbruster 3 participants 9 messages Mar 22, 2010 – Mar 27, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

v2 cover error: Clean up after recent changes

Cleaner integration of location tracking with qemu-tool.c. Move qerror_report() where it belongs.

v2: Remove an assertion that unreachable code can't be reached, at Blue Swirl's request. Rebased.

Markus Armbruster (6):
error: Trim includes after "Move qemu_error & friends..."
error: Trim includes in qerror.c
error: Trim includes after "Infrastructure to track locations..."
error: Make use of error_set_progname() optional
error: Link qemu-img, qemu-nbd, qemu-io with qemu-error.o
error: Move qerror_report() from qemu-error.[ch] to qerror.[ch]

 Makefile             |    6 +++---
 hw/qdev-properties.c |    1 +
 monitor.c            |    2 --
 monitor.h            |    1 -
 qemu-error.c         |   20 +-------------------
 qemu-error.h         |    6 ------
 qemu-tool.c          |   49 +++++++++++++++----------------------------------
 qerror.c             |   22 ++++++++++++++++++++--
 qerror.h             |    5 +++++
 sysemu.h             |    2 --
 10 files changed, 45 insertions(+), 69 deletions(-)
#1 lore raw

PATCH v2 1/6 error: Trim includes after "Move qemu_error & friends..."

Missed in commit 2f792016.

---
 hw/qdev-properties.c |    1 +
 monitor.c            |    2 --
 sysemu.h             |    2 --
 3 files changed, 1 insertions(+), 4 deletions(-)
hw/qdev-properties.c +1 -0
index 92d6793..157a111 100644
@@ -1,6 +1,7 @@
 #include "sysemu.h"
 #include "net.h"
 #include "qdev.h"
+#include "qerror.h"
 
 void *qdev_get_prop_ptr(DeviceState *dev, Property *prop)
 {
monitor.c +0 -2
index 0448a70..822dc27 100644
@@ -49,10 +49,8 @@
 #include "qint.h"
 #include "qfloat.h"
 #include "qlist.h"
-#include "qdict.h"
 #include "qbool.h"
 #include "qstring.h"
-#include "qerror.h"
 #include "qjson.h"
 #include "json-streamer.h"
 #include "json-parser.h"
sysemu.h +0 -2
index 525efd1..5464d35 100644
@@ -6,8 +6,6 @@
 #include "qemu-option.h"
 #include "qemu-queue.h"
 #include "qemu-timer.h"
-#include "qdict.h"
-#include "qerror.h"
 
 #ifdef _WIN32
 #include <windows.h>
Signature · 1 line
1.6.6.1
#2 lore raw

PATCH v2 2/6 error: Trim includes in qerror.c

In reply to Markus Armbruster
---
 qerror.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
qerror.c +0 -2
index d0aba61..ff2fbd5 100644
@@ -11,9 +11,7 @@
  */
 #include "qjson.h"
 #include "qerror.h"
-#include "qstring.h"
 #include "qemu-common.h"
-#include "qemu-error.h"
 
 static void qerror_destroy_obj(QObject *obj);
 
Signature · 1 line
1.6.6.1
#3 lore raw

PATCH v2 3/6 error: Trim includes after "Infrastructure to track locations..."

In reply to Markus Armbruster

Missed in commit 827b0813.

---
 monitor.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
monitor.h +0 -1
index bd4ae34..5bdeed1 100644
@@ -3,7 +3,6 @@
 
 #include "qemu-common.h"
 #include "qemu-char.h"
-#include "qemu-error.h"
 #include "qerror.h"
 #include "qdict.h"
 #include "block.h"
Signature · 1 line
1.6.6.1
#4 lore raw

PATCH v2 4/6 error: Make use of error_set_progname() optional

In reply to Markus Armbruster
---
 qemu-error.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
qemu-error.c +1 -1
index 5d5fe37..9b9c0a1 100644
@@ -167,7 +167,7 @@ void error_print_loc(void)
     int i;
     const char *const *argp;
 
-    if (!cur_mon) {
+    if (!cur_mon && progname) {
         fprintf(stderr, "%s:", progname);
         sep = " ";
     }
Signature · 1 line
1.6.6.1
#5 lore raw

PATCH v2 5/6 error: Link qemu-img, qemu-nbd, qemu-io with qemu-error.o

In reply to Markus Armbruster

The location tracking interface is used by code shared with qemi-img, qemu-nbd and qemu-io, so it needs to be available there. Commit 827b0813 provides it in a rather hamfisted way: it adds a dummy implementation to qemu-tool.c.

It's cleaner to provide the real thing, and put a few more dummy monitor functions into qemu-tool.c.

---
 Makefile    |    6 +++---
 qemu-tool.c |   49 +++++++++++++++----------------------------------
 2 files changed, 18 insertions(+), 37 deletions(-)
Makefile +3 -3
index 57c354d..a404fda 100644
@@ -129,11 +129,11 @@ bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
 qemu-img.o: qemu-img-cmds.h
 qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o: $(GENERATED_HEADERS)
 
-qemu-img$(EXESUF): qemu-img.o qemu-tool.o $(block-obj-y) $(qobject-obj-y)
+qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
 
-qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o $(block-obj-y) $(qobject-obj-y)
+qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
 
-qemu-io$(EXESUF): qemu-io.o qemu-tool.o cmd.o $(block-obj-y) $(qobject-obj-y)
+qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
 
 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $@")
qemu-tool.c +15 -34

64 lines not on this page · raw message

Signature · 1 line
1.6.6.1
#6 lore raw

PATCH v2 6/6 error: Move qerror_report() from qemu-error.[ch] to qerror.[ch]

In reply to Markus Armbruster
---
 qemu-error.c |   18 ------------------
 qemu-error.h |    6 ------
 qerror.c     |   20 ++++++++++++++++++++
 qerror.h     |    5 +++++
 4 files changed, 25 insertions(+), 24 deletions(-)
qemu-error.c +0 -18
index 9b9c0a1..57d7555 100644
@@ -207,21 +207,3 @@ void error_report(const char *fmt, ...)
     va_end(ap);
     error_printf("\n");
 }
-
-void qerror_report_internal(const char *file, int linenr, const char *func,
-                            const char *fmt, ...)
-{
-    va_list va;
-    QError *qerror;
-
-    va_start(va, fmt);
-    qerror = qerror_from_info(file, linenr, func, fmt, &va);
-    va_end(va);
-
-    if (monitor_cur_is_qmp()) {
-        monitor_set_error(cur_mon, qerror);
-    } else {
-        qerror_print(qerror);
-        QDECREF(qerror);
-    }
-}
qemu-error.h +0 -6
index e63c6ab..a45609f 100644
@@ -37,11 +37,5 @@ void error_printf_unless_qmp(const char *fmt, ...)
 void error_print_loc(void);
 void error_set_progname(const char *argv0);
 void error_report(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
-void qerror_report_internal(const char *file, int linenr, const char *func,
-                            const char *fmt, ...)
-    __attribute__ ((format(printf, 4, 5)));
-
-#define qerror_report(fmt, ...) \
-    qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
 
 #endif
qerror.c +20 -0
index ff2fbd5..eaa1deb 100644
@@ -9,6 +9,8 @@
  * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
  * See the COPYING.LIB file in the top-level directory.
  */
+
+#include "monitor.h"
 #include "qjson.h"
 #include "qerror.h"
 #include "qemu-common.h"
@@ -377,6 +379,24 @@ void qerror_print(QError *qerror)
     QDECREF(qstring);
 }
 
+void qerror_report_internal(const char *file, int linenr, const char *func,
+                            const char *fmt, ...)
+{
+    va_list va;
+    QError *qerror;
+
+    va_start(va, fmt);
+    qerror = qerror_from_info(file, linenr, func, fmt, &va);
+    va_end(va);
+
+    if (monitor_cur_is_qmp()) {
+        monitor_set_error(cur_mon, qerror);
+    } else {
+        qerror_print(qerror);
+        QDECREF(qerror);
+    }
+}
+
 /**
  * qobject_to_qerror(): Convert a QObject into a QError
  */
qerror.h +5 -0
index d96abe1..dd298d4 100644
@@ -37,6 +37,11 @@ QError *qerror_from_info(const char *file, int linenr, const char *func,
                          const char *fmt, va_list *va);
 QString *qerror_human(const QError *qerror);
 void qerror_print(QError *qerror);
+void qerror_report_internal(const char *file, int linenr, const char *func,
+                            const char *fmt, ...)
+    __attribute__ ((format(printf, 4, 5)));
+#define qerror_report(fmt, ...) \
+    qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
 QError *qobject_to_qerror(const QObject *obj);
 
 /*
Signature · 1 line
1.6.6.1
#7 lore raw
In reply to Markus Armbruster
Quoted 6 lines · On Mon, 22 Mar 2010 10:28:59 +0100 Markus Armbruster <[email protected]> wrote:

Cleaner integration of location tracking with qemu-tool.c. Move qerror_report() where it belongs.

v2: Remove an assertion that unreachable code can't be reached, at Blue Swirl's request. Rebased.

Quoted 7 lines

Markus Armbruster (6):
error: Trim includes after "Move qemu_error & friends..."
error: Trim includes in qerror.c
error: Trim includes after "Infrastructure to track locations..."
error: Make use of error_set_progname() optional
error: Link qemu-img, qemu-nbd, qemu-io with qemu-error.o
error: Move qerror_report() from qemu-error.[ch] to qerror.[ch]

Looks good.

Quoted 13 lines
 Makefile             |    6 +++---
 hw/qdev-properties.c |    1 +
 monitor.c            |    2 --
 monitor.h            |    1 -
 qemu-error.c         |   20 +-------------------
 qemu-error.h         |    6 ------
 qemu-tool.c          |   49 +++++++++++++++----------------------------------
 qerror.c             |   22 ++++++++++++++++++++--
 qerror.h             |    5 +++++
 sysemu.h             |    2 --
 10 files changed, 45 insertions(+), 69 deletions(-)
#8 lore raw
In reply to Markus Armbruster
Quoted 6 lines · Markus Armbruster

Cleaner integration of location tracking with qemu-tool.c. Move qerror_report() where it belongs.

v2: Remove an assertion that unreachable code can't be reached, at Blue Swirl's request. Rebased.

Quoted 7 lines

Markus Armbruster (6):
error: Trim includes after "Move qemu_error & friends..."
error: Trim includes in qerror.c
error: Trim includes after "Infrastructure to track locations..."
error: Make use of error_set_progname() optional
error: Link qemu-img, qemu-nbd, qemu-io with qemu-error.o
error: Move qerror_report() from qemu-error.[ch] to qerror.[ch]

Thanks, applied.

Quoted 15 lines
 Makefile             |    6 +++---
 hw/qdev-properties.c |    1 +
 monitor.c            |    2 --
 monitor.h            |    1 -
 qemu-error.c         |   20 +-------------------
 qemu-error.h         |    6 ------
 qemu-tool.c          |   49 +++++++++++++++----------------------------------
 qerror.c             |   22 ++++++++++++++++++++--
 qerror.h             |    5 +++++
 sysemu.h             |    2 --
 10 files changed, 45 insertions(+), 69 deletions(-)
Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net