xen/build: Use C99 booleans

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>
This commit is contained in:
Andrew Cooper committed 2016-07-15 10:52:36 +01:00
1 parent 4ef815bf61
commit 9202342594
9 files changed
+9 -14

No files matched your search

-1
View File
@@ -1,7 +1,6 @@
#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>
-1
View File
@@ -20,7 +20,6 @@
#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>
-1
View File
@@ -17,7 +17,6 @@
*/
#include <xen/config.h>
#include <xen/stdbool.h>
#include <xen/init.h>
#include <xen/string.h>
#include <xen/version.h>
+1 -1
View File
@@ -480,7 +480,7 @@ void trace_exit_reason(u32 *irq_traced)
*/
bool_t errata_c6_eoi_workaround(void)
{
static bool_t fix_needed = -1;
static int8_t fix_needed = -1;
if ( unlikely(fix_needed == -1) )
{
+2 -1
View File
@@ -56,7 +56,8 @@ custom_param("apic", genapic_apic_force);
void __init generic_apic_probe(void)
{
int i, changed;
bool changed;
int i;
record_boot_APIC_mode();
-4
View File
@@ -62,10 +62,6 @@ typedef unsigned long size_t;
#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__ */
-4
View File
@@ -41,10 +41,6 @@ typedef unsigned long size_t;
#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__ */
-1
View File
@@ -17,7 +17,6 @@
#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
+6
View File
@@ -1,6 +1,8 @@
#ifndef __TYPES_H__
#define __TYPES_H__
#include <xen/stdbool.h>
#include <asm/types.h>
#define BITS_TO_LONGS(bits) \
@@ -59,4 +61,8 @@ typedef __u64 __be64;
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__ */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.