qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sysemu/os-win32.h: Windows clang-cl compiler fixes
@ 2024-11-01 21:41 Roque Arcudia Hernandez
  2024-11-04  9:18 ` Daniel P. Berrangé
  2024-11-04 10:08 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 3+ messages in thread
From: Roque Arcudia Hernandez @ 2024-11-01 21:41 UTC (permalink / raw)
  To: jansene, sw, peterx, farosas, lvivier, pbonzini
  Cc: qemu-devel, Roque Arcudia Hernandez

This contains a series of small compiler fixes to enable the compilation
of qemu using clang-cl.

It mainly involves adding some missing header files and updating #ifdefs
to handle clang-cl specific things.

Signed-off-by: Erwin Jansen <jansene@google.com>
Signed-off-by: Roque Arcudia Hernandez <roqueh@google.com>
---
 include/qemu/compiler.h   | 3 ++-
 include/sysemu/dma.h      | 2 ++
 include/sysemu/os-win32.h | 2 +-
 migration/savevm.c        | 2 ++
 tests/qtest/libqtest.c    | 2 +-
 5 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index c06954ccb4..7f532fe660 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -22,7 +22,8 @@
 #define QEMU_EXTERN_C extern
 #endif
 
-#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
+#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__)) && \
+    !defined(__clang__)
 # define QEMU_PACKED __attribute__((gcc_struct, packed))
 #else
 # define QEMU_PACKED __attribute__((packed))
diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
index 5a49a30628..f53b751fe2 100644
--- a/include/sysemu/dma.h
+++ b/include/sysemu/dma.h
@@ -14,6 +14,8 @@
 #include "exec/address-spaces.h"
 #include "block/block.h"
 #include "block/accounting.h"
+#include "block/aio.h"
+#include "qemu/iov.h"
 
 typedef enum {
     DMA_DIRECTION_TO_DEVICE = 0,
diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
index b82a5d3ad9..b5f1c61df4 100644
--- a/include/sysemu/os-win32.h
+++ b/include/sysemu/os-win32.h
@@ -70,7 +70,7 @@ int __mingw_setjmp(jmp_buf);
 void __attribute__((noreturn)) __mingw_longjmp(jmp_buf, int);
 #define setjmp(env) __mingw_setjmp(env)
 #define longjmp(env, val) __mingw_longjmp(env, val)
-#elif defined(_WIN64)
+#elif defined(_WIN64) && !defined(__clang__)
 /*
  * On windows-x64, setjmp is implemented by _setjmp which needs a second parameter.
  * If this parameter is NULL, longjump does no stack unwinding.
diff --git a/migration/savevm.c b/migration/savevm.c
index 7e1e27182a..c082015e84 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -54,6 +54,8 @@
 #include "qemu/job.h"
 #include "qemu/main-loop.h"
 #include "block/snapshot.h"
+#include "block/block-io.h"
+#include "block/block-global-state.h"
 #include "qemu/cutils.h"
 #include "io/channel-buffer.h"
 #include "io/channel-file.h"
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 9d07de1fbd..1fcb749602 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -386,7 +386,7 @@ static pid_t qtest_create_process(char *cmd)
         abort();
     }
 
-    return (pid_t)pi.hProcess;
+    return (pid_t)GetProcessId(pi.hProcess);
 }
 #endif /* _WIN32 */
 
-- 
2.47.0.163.g1226f6d8fa-goog



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-04 10:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-01 21:41 [PATCH] sysemu/os-win32.h: Windows clang-cl compiler fixes Roque Arcudia Hernandez
2024-11-04  9:18 ` Daniel P. Berrangé
2024-11-04 10:08 ` Philippe Mathieu-Daudé

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).