aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2022-05-30 09:03:15 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-05-30 09:03:15 +0000
commitbaf336047c3bb869b3103a6b1b3d8b15e5f1c58d (patch)
treea3fb8950e562b4915c4e1ca2891155522948f620
parentdddb2be9e60531f232bb9eb44c25e810112cbe42 (diff)
parent177da3d752176274059181988a7cd4c0953f34a9 (diff)
downloadslirp-baf336047c3bb869b3103a6b1b3d8b15e5f1c58d.zip
slirp-baf336047c3bb869b3103a6b1b3d8b15e5f1c58d.tar.gz
slirp-baf336047c3bb869b3103a6b1b3d8b15e5f1c58d.tar.bz2
Merge branch 'msvc' into 'master'
msvc: enable vmstate code on !gnuc See merge request slirp/libslirp!126
-rw-r--r--src/misc.c4
-rw-r--r--src/vmstate.h13
2 files changed, 11 insertions, 6 deletions
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)
{
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 <unistd.h>
#include <stdint.h>
#include <stdbool.h>
#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_ */