From e7362700bc5146689455f6a29d5f5f0fbd037285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 30 May 2022 10:44:38 +0200 Subject: msvc: enable vmstate code on !gnuc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- src/vmstate.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/vmstate.h b/src/vmstate.h index 64dd256..cd77c85 100644 --- a/src/vmstate.h +++ b/src/vmstate.h @@ -39,10 +39,6 @@ #ifndef VMSTATE_H_ #define VMSTATE_H_ -#ifdef __GNUC__ -#define HAVE_VMSTATE 1 - -#include #include #include #include "slirp.h" @@ -220,10 +216,17 @@ extern const VMStateInfo slirp_vmstate_info_nullptr; extern const VMStateInfo slirp_vmstate_info_buffer; extern const VMStateInfo slirp_vmstate_info_tmp; +#ifdef __GNUC__ #define type_check_array(t1, t2, n) ((t1(*)[n])0 - (t2 *)0) #define type_check_pointer(t1, t2) ((t1 **)0 - (t2 *)0) #define typeof_field(type, field) typeof(((type *)0)->field) #define type_check(t1, t2) ((t1 *)0 - (t2 *)0) +#else +#define type_check_array(t1, t2, n) 0 +#define type_check_pointer(t1, t2) 0 +#define typeof_field(type, field) (((type *)0)->field) +#define type_check(t1, t2) 0 +#endif #define vmstate_offset_value(_state, _field, _type) \ (offsetof(_state, _field) + type_check(_type, typeof_field(_state, _field))) @@ -395,6 +398,4 @@ extern const VMStateInfo slirp_vmstate_info_tmp; .flags = VMS_END, \ } -#endif /* __GNUC__ */ - #endif /* VMSTATE_H_ */ -- cgit v1.1 From 177da3d752176274059181988a7cd4c0953f34a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 30 May 2022 10:47:56 +0200 Subject: msvc: fix some gcc-specific pragma warnings --- src/misc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/misc.c b/src/misc.c index 0d43e43..3c25835 100644 --- a/src/misc.c +++ b/src/misc.c @@ -147,8 +147,10 @@ static void fork_exec_child_setup(gpointer data) #endif } +#ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif #if !GLIB_CHECK_VERSION(2, 58, 0) typedef struct SlirpGSpawnFds { @@ -198,7 +200,9 @@ g_spawn_async_with_fds_slirp(const gchar *working_directory, gchar **argv, #define g_spawn_async_with_fds(wd, argv, env, f, c, d, p, ifd, ofd, efd, err) \ g_spawn_async_with_fds_slirp(wd, argv, env, f, c, d, p, ifd, ofd, efd, err) +#ifdef __GNUC__ #pragma GCC diagnostic pop +#endif int fork_exec(struct socket *so, const char *ex) { -- cgit v1.1