vl.c: Fix OpenBSD compilation issue due to namespace collisions
PATCH 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.
--- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
vl.c +1 -1
@@ -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
Quoted 24 lines · Marcel Apfelbaum
Machine rewriting added MACHINE macro which is
already in use by other OpenBSD library.
Sinceqemu/sockets.hexposes the OpenBSD namespace,
the minimalistic approach is to add it as the first QEMU include.Reported-by Brad Smith <[email protected]>Signed-off-by Marcel Apfelbaum <[email protected]>--- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)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"
vl.c int main(int argc, char **argv) · line 108
Quoted 6 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"
I'm confused; why doesn't this just result in a compiler error in the other direction when we try to #define MACHINE in QEMU and it's already been defined by the BSD headers?
thanks
-- PMM
Quoted 28 lines · Peter Maydell
Quoted 27 lines · Marcel Apfelbaum
Machine rewriting added MACHINE macro which is
already in use by other OpenBSD library.
Sinceqemu/sockets.hexposes the OpenBSD namespace,
the minimalistic approach is to add it as the first QEMU include.Reported-by Brad Smith <[email protected]>Signed-off-by Marcel Apfelbaum <[email protected]>--- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)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" @@ -103,7 +104,6 @@ int main(int argc, char **argv)#include "disas/disas.h"
Quoted 8 lines
vl.c int main(int argc, char **argv) · line 108
Quoted 3 lines
vl.c +0
-1-#include "qemu/sockets.h" #include "slirp/libslirp.h" I'm confused; why doesn't this just result in a compiler error in the other direction when we try to #define MACHINE in QEMU and it's already been defined by the BSD headers?
Maybe because there is usage of the "MACHINE" define by the BSD library? (on Qemu context, of course! - meaning, it shouldn't even be exposed in the first place!)
Thanks,
Marcel
Quoted 3 lines
thanks
-- PMM
Quoted 37 lines · Marcel Apfelbaum
Quoted 28 lines · Peter Maydell
Quoted 27 lines · Marcel Apfelbaum
Machine rewriting added MACHINE macro which is
already in use by other OpenBSD library.
Sinceqemu/sockets.hexposes the OpenBSD namespace,
the minimalistic approach is to add it as the first QEMU include.Reported-by Brad Smith <[email protected]>Signed-off-by Marcel Apfelbaum <[email protected]>--- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)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" @@ -103,7 +104,6 @@ int main(int argc, char **argv)#include "disas/disas.h" Quoted 8 lines
vl.c int main(int argc, char **argv) · line 108
Quoted 3 lines
vl.c +0
-1-#include "qemu/sockets.h" #include "slirp/libslirp.h" I'm confused; why doesn't this just result in a compiler error in the other direction when we try to #define MACHINE in QEMU and it's already been defined by the BSD headers?
Quoted 3 lines
Maybe because there is usage of the "MACHINE" define by the BSD library? (on Qemu context, of course! - meaning, it shouldn't even be exposed in the first place!)
I meant "there is *no* usage of the..."
Quoted 9 lines
Thanks,
MarcelQuoted 3 lines
thanks
-- PMM
Quoted 10 lines · Marcel Apfelbaum
Quoted 8 lines · Marcel Apfelbaum
Quoted 4 lines · Peter Maydell
I'm confused; why doesn't this just result in a compiler error in the other direction when we try to #define MACHINE in QEMU and it's already been defined by the BSD headers?
Maybe because there is usage of the "MACHINE" define by the BSD library? (on Qemu context, of course! - meaning, it shouldn't even be exposed in the first place!)
I meant "there is *no* usage of the..."
But we'll still see
#define MACHINE something
and then later
#define MACHINE something-else
right? The compiler ought to complain about that, at point of the second #define; use or otherwise of the macro isn't relevant here.
thanks
-- PMM
Quoted 12 lines · Peter Maydell
Quoted 10 lines · Marcel Apfelbaum
Quoted 8 lines · Marcel Apfelbaum
Quoted 4 lines · Peter Maydell
I'm confused; why doesn't this just result in a compiler error in the other direction when we try to #define MACHINE in QEMU and it's already been defined by the BSD headers?
Maybe because there is usage of the "MACHINE" define by the BSD library? (on Qemu context, of course! - meaning, it shouldn't even be exposed in the first place!)
I meant "there is *no* usage of the..."
Quoted 8 lines
But we'll still see
#define MACHINE something
and then later
#define MACHINE something-elseright? The compiler ought to complain about that, at point of the second #define; use or otherwise of the macro isn't relevant here.
Right! Sorry.
As Andreas said in IRC, BSDs do not build with -Werror
Quoted 4 lines
thanks
-- PMM