and switch bool_t to being of type _Bool rather than char.
Using bool_t as char causes several subtle problems; first that a bool_t
actually has more than two values, and that (bool_t)0x100 actually has the
value 0 rather than the expected 1, due to truncation.
Making this change reveals two bugs now caught by the compiler.
errata_c6_eoi_workaround() actually makes use of bool_t having more than two
states, while generic_apic_probe() has a integer in the middle of a compound
bool_t assignment (which triggers a [-Werror=parentheses] warning on Debian
Jessie).
Finally, it turns out that ARM is mixing and matching bool_t and bool, despite
their different semantics. This change brings the semantics of bool_t to
match bool, but does not alter the current mix.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Acked-by: Tim Deegan <tim@xen.org>
#include <xen/config.h>
#include <xen/sched.h>
#include <xen/lib.h>
-#include <xen/stdbool.h>
#include <xen/errno.h>
#include <xen/domain_page.h>
#include <xen/bitops.h>
#include <xen/config.h>
#include <asm/platform.h>
-#include <xen/stdbool.h>
#include <xen/vmap.h>
#include <xen/device_tree.h>
#include <asm/io.h>
*/
#include <xen/config.h>
-#include <xen/stdbool.h>
#include <xen/init.h>
#include <xen/string.h>
#include <xen/version.h>
*/
bool_t errata_c6_eoi_workaround(void)
{
- static bool_t fix_needed = -1;
+ static int8_t fix_needed = -1;
if ( unlikely(fix_needed == -1) )
{
void __init generic_apic_probe(void)
{
- int i, changed;
+ bool changed;
+ int i;
record_boot_APIC_mode();
#endif
typedef signed long ssize_t;
-typedef char bool_t;
-#define test_and_set_bool(b) xchg(&(b), 1)
-#define test_and_clear_bool(b) xchg(&(b), 0)
-
#endif /* __ASSEMBLY__ */
#endif /* __ARM_TYPES_H__ */
#endif
typedef signed long ssize_t;
-typedef char bool_t;
-#define test_and_set_bool(b) xchg(&(b), 1)
-#define test_and_clear_bool(b) xchg(&(b), 0)
-
#endif /* __ASSEMBLY__ */
#endif /* __X86_TYPES_H__ */
#include <xen/init.h>
#include <xen/string.h>
#include <xen/types.h>
-#include <xen/stdbool.h>
#include <xen/list.h>
#define DEVICE_TREE_MAX_DEPTH 16
#ifndef __TYPES_H__
#define __TYPES_H__
+#include <xen/stdbool.h>
+
#include <asm/types.h>
#define BITS_TO_LONGS(bits) \
typedef unsigned long uintptr_t;
+typedef _Bool bool_t;
+#define test_and_set_bool(b) xchg(&(b), true)
+#define test_and_clear_bool(b) xchg(&(b), false)
+
#endif /* __TYPES_H__ */