aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Deegan <tim@xen.org>2013-08-20 15:40:38 +0200
committerJan Beulich <jbeulich@suse.com>2013-08-20 15:40:38 +0200
commitc5137a955a7a8bedef526127970b49f5cca8f78c (patch)
tree057d728d601d36a160cba3724b6002eaa606c921
parentdf047d6936000f0656c6679220baae91f6b8cda3 (diff)
downloadxen-c5137a955a7a8bedef526127970b49f5cca8f78c.tar.gz
xen-c5137a955a7a8bedef526127970b49f5cca8f78c.tar.bz2
xen-c5137a955a7a8bedef526127970b49f5cca8f78c.zip
xen: Add stdbool.h workaround for BSD.
On *BSD, stdbool.h lives in /usr/include, but we don't want to have that on the search path in case we pick up any headers from the build host's C libraries. Copy the equivalent hack already in place for stdarg.h: on all supported compilers the contents of stdbool.h are trivial, so just supply the things we need in a xen/stdbool.h header. Signed-off-by: Tim Deegan <tim@xen.org> Reviewed-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Keir Fraser <keir@xen.org> Tested-by: Patrick Welche <prlw1@cam.ac.uk> master commit: 7b9685ca4ed2fd723600ce66eb20a6d0c115b6cb master date: 2013-08-15 22:00:45 +0100
-rw-r--r--xen/include/xen/libelf.h4
-rw-r--r--xen/include/xen/stdbool.h13
2 files changed, 15 insertions, 2 deletions
diff --git a/xen/include/xen/libelf.h b/xen/include/xen/libelf.h
index 36b2b3fee0..0ced7b17fc 100644
--- a/xen/include/xen/libelf.h
+++ b/xen/include/xen/libelf.h
@@ -29,8 +29,6 @@
#error define architectural endianness
#endif
-#include <stdbool.h>
-
typedef int elf_errorstatus; /* 0: ok; -ve (normally -1): error */
typedef int elf_negerrnoval; /* 0: ok; -EFOO: error */
@@ -39,11 +37,13 @@ typedef int elf_negerrnoval; /* 0: ok; -EFOO: error */
#ifdef __XEN__
#include <public/elfnote.h>
#include <public/features.h>
+#include <xen/stdbool.h>
#else
#include <xen/elfnote.h>
#include <xen/features.h>
#include <stdarg.h>
+#include <stdbool.h>
struct elf_binary;
typedef void elf_log_callback(struct elf_binary*, void *caller_data,
diff --git a/xen/include/xen/stdbool.h b/xen/include/xen/stdbool.h
new file mode 100644
index 0000000000..2eecd52a18
--- /dev/null
+++ b/xen/include/xen/stdbool.h
@@ -0,0 +1,13 @@
+#ifndef __XEN_STDBOOL_H__
+#define __XEN_STDBOOL_H__
+
+#if defined(__OpenBSD__) || defined(__NetBSD__)
+# define bool _Bool
+# define true 1
+# define false 0
+# define __bool_true_false_are_defined 1
+#else
+# include <stdbool.h>
+#endif
+
+#endif /* __XEN_STDBOOL_H__ */