qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] sysemu/os-win32.h: Windows clang-cl compiler fixes


From: Roque Arcudia Hernandez
Subject: [PATCH] sysemu/os-win32.h: Windows clang-cl compiler fixes
Date: Fri, 1 Nov 2024 21:41:01 +0000

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]