Skip to contentSkip to conversation

vl.c: Fix OpenBSD compilation issue due to namespace collisions

PATCH In review Marcel Apfelbaum 3 participants 3 messages Mar 18, 2014 – Mar 21, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 vl.c: Fix OpenBSD compilation issue due to namespace collisions

Machine rewriting added MACHINE macro which is
already in use by other OpenBSD library.
Since qemu/sockets.h exposes the OpenBSD namespace,
the minimalistic approach is to add it as the first QEMU include.

---
V1 -> V2
#undef MACHINE to avoid introducing warnings for redefining the macro.

 include/hw/boards.h | 1 +
 vl.c                | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/boards.h +1 -0
index 7bd2ea7..dd2c70d 100644
@@ -54,6 +54,7 @@ struct QEMUMachine {
 int qemu_register_machine(QEMUMachine *m);
 
 #define TYPE_MACHINE "machine"
+#undef MACHINE  /* BSD defines it and QEMU does not use it */
 #define MACHINE(obj) \
     OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE)
 #define MACHINE_GET_CLASS(obj) \
vl.c +1 -1
index f0fe48b..9f86e68 100644
@@ -58,6 +58,7 @@ int main(int argc, char **argv)
 
 #include <glib.h>
 
+#include "qemu/sockets.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "hw/usb.h"
@@ -103,7 +104,6 @@ int main(int argc, char **argv)
 
 #include "disas/disas.h"
 
-#include "qemu/sockets.h"
 
 #include "slirp/libslirp.h"
 
Signature · 1 line
1.8.3.1
#1 lore raw

Am 18.03.2014 16:26, schrieb Marcel Apfelbaum:

Quoted 32 lines

Machine rewriting added MACHINE macro which is
already in use by other OpenBSD library.
Since qemu/sockets.h exposes the OpenBSD namespace,
the minimalistic approach is to add it as the first QEMU include.

---
V1 -> V2
#undef MACHINE to avoid introducing warnings for redefining the macro.

 include/hw/boards.h | 1 +
 vl.c                | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/boards.h +1 -0
index 7bd2ea7..dd2c70d 100644
@@ -54,6 +54,7 @@ struct QEMUMachine {
 int qemu_register_machine(QEMUMachine *m);
 
 #define TYPE_MACHINE "machine"
+#undef MACHINE  /* BSD defines it and QEMU does not use it */
 #define MACHINE(obj) \
     OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE)
 #define MACHINE_GET_CLASS(obj) \
vl.c +0 -0
index f0fe48b..9f86e68 100644

vl.c int main(int argc, char **argv) · line 64

Quoted 7 lines
vl.c +1 -0
@@ -58,6 +58,7 @@ int main(int argc, char **argv)
 
 #include <glib.h>
 
+#include "qemu/sockets.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "hw/usb.h"

Thanks, I've queued this for testing but would probably like to add a comment explaining why this is placed there.

https://github.com/afaerber/qemu-cpu/commits/qom-next

Andreas

Quoted 9 lines
vl.c +0 -1
@@ -103,7 +104,6 @@ int main(int argc, char **argv)
 
 #include "disas/disas.h"
 
-#include "qemu/sockets.h"
 
 #include "slirp/libslirp.h"
 
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw
In reply to Marcel Apfelbaum
Quoted 7 lines · Marcel Apfelbaum

Machine rewriting added MACHINE macro which is
already in use by other OpenBSD library.
Since qemu/sockets.h exposes the OpenBSD namespace,
the minimalistic approach is to add it as the first QEMU include.

Thank you for the workaround for the namespace collision.

Signature · 3 lines
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.