summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-02-08 19:08:10 +0000
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:45:28 -0600
commit6c695b38ef7a3a199a793a3cd4895ba1d6b48282 (patch)
tree6f06867c491d33613b90606f8c003ded4214e041 /include
parent6afbac0b273459af17850e666321408aab822fc7 (diff)
downloadhqemu-6c695b38ef7a3a199a793a3cd4895ba1d6b48282.zip
hqemu-6c695b38ef7a3a199a793a3cd4895ba1d6b48282.tar.gz
oslib-posix.c: Move workaround for OSX daemon() deprecation to osdep.h
The right place for "work around issues with system headers" code is osdep.h. Move the workaround for OSX's stdlib.h emitting a deprecation warning for daemon() to that header. This also fixes a problem where running clean-includes on oslib-posix.c would erroneously remove the #include <stdlib.h> from it, breaking the workaround. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/qemu/osdep.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 59a7f8d..cc055c9 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -27,6 +27,17 @@
#include "config-host.h"
#include "qemu/compiler.h"
+
+/* The following block of code temporarily renames the daemon() function so the
+ * compiler does not see the warning associated with it in stdlib.h on OSX
+ */
+#ifdef __APPLE__
+#define daemon qemu_fake_daemon_function
+#include <stdlib.h>
+#undef daemon
+extern int daemon(int, int);
+#endif
+
#include <stdarg.h>
#include <stddef.h>
#include <stdbool.h>
OpenPOWER on IntegriCloud