From patchwork Wed Jun 22 11:24:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 9192471 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 91E1860756 for ; Wed, 22 Jun 2016 11:25:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 814BC283E5 for ; Wed, 22 Jun 2016 11:25:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75F07283F7; Wed, 22 Jun 2016 11:25:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BA64E283E5 for ; Wed, 22 Jun 2016 11:25:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFgGd-0005P4-Cq; Wed, 22 Jun 2016 11:24:23 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFgGb-0005JR-G6 for xen-devel@lists.xen.org; Wed, 22 Jun 2016 11:24:21 +0000 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 4C/C5-18769-5657A675; Wed, 22 Jun 2016 11:24:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRWlGSWpSXmKPExsXitHRDpG5KaVa 4QfcSBYslHxezODB6HN39mymAMYo1My8pvyKBNWP+mZ2MBc/0KibfucvewDhRo4uRk0NCwF9i 878+JhCbTUBfYveLT2C2iIC6xOmOi6xdjFwczAJPmSSuPjvDDJIQFrCXuP3qG1ARBweLgKrE4 T5XkDCvgKfE1jfTmCFmykmcP/4TzOYU8JL4NWklI4gtBFTzrW8TE4StJnGt/xI7RK+gxMmZT1 hAbGYBCYmDL14wg4yXEOCW+NttP4GRbxaSqllIqhYwMq1i1ChOLSpLLdI1tNBLKspMzyjJTcz M0TU0MNbLTS0uTkxPzUlMKtZLzs/dxAgMqXoGBsYdjL9Pex5ilORgUhLllVfOChfiS8pPqcxI LM6ILyrNSS0+xCjDwaEkwatWApQTLEpNT61Iy8wBBjdMWoKDR0mEVwUkzVtckJhbnJkOkTrFq Cglzvu2GCghAJLIKM2Da4NF1CVGWSlhXkYGBgYhnoLUotzMElT5V4ziHIxKwry/QabwZOaVwE 1/BbSYCWjxsv50kMUliQgpqQbGlan/hA5YfZD0YOuec8v4WPrGulPsa673dbppWJ+p5vrBnPo 0x9L+VcPi6+79FzReb1inHXP2GvfLA9fNFW+s7d06f+LRc2n/l13ZKG1suOhF174Flm33HG19 TVdN/++6/V9w0rxz2jJbypxkUupWrFv6fZH1oszy4t5G6xNMbiXnlL/95fLQUmIpzkg01GIuK k4EAFpQI6OjAgAA X-Env-Sender: prvs=974a346cd=Andrew.Cooper3@citrix.com X-Msg-Ref: server-5.tower-31.messagelabs.com!1466594658!43468017!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 33723 invoked from network); 22 Jun 2016 11:24:20 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-5.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 22 Jun 2016 11:24:20 -0000 X-IronPort-AV: E=Sophos;i="5.26,509,1459814400"; d="scan'208";a="362051538" From: Andrew Cooper To: Xen-devel Date: Wed, 22 Jun 2016 12:24:13 +0100 Message-ID: <1466594653-28241-7-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1466594653-28241-1-git-send-email-andrew.cooper3@citrix.com> References: <1466594653-28241-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH 6/6] xen/build: Use the system stdbool.h header X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. 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 --- CC: Stefano Stabellini CC: Julien Grall CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Tim Deegan CC: Wei Liu --- xen/arch/arm/p2m.c | 1 - xen/arch/arm/platforms/xgene-storm.c | 1 - xen/arch/arm/traps.c | 1 - xen/arch/x86/acpi/cpu_idle.c | 2 +- xen/arch/x86/genapic/probe.c | 3 ++- xen/include/asm-arm/types.h | 4 ---- xen/include/asm-x86/types.h | 4 ---- xen/include/xen/device_tree.h | 1 - xen/include/xen/libelf.h | 1 - xen/include/xen/stdbool.h | 9 --------- xen/include/xen/types.h | 5 +++++ 11 files changed, 8 insertions(+), 24 deletions(-) delete mode 100644 xen/include/xen/stdbool.h diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 65d8f1a..8308028 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c index 70cb655..686b19b 100644 --- a/xen/arch/arm/platforms/xgene-storm.c +++ b/xen/arch/arm/platforms/xgene-storm.c @@ -20,7 +20,6 @@ #include #include -#include #include #include #include diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 44926ca..c6d6c9f 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -17,7 +17,6 @@ */ #include -#include #include #include #include diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c index a21aeed..a9ad201 100644 --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -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 int fix_needed = -1; if ( unlikely(fix_needed == -1) ) { diff --git a/xen/arch/x86/genapic/probe.c b/xen/arch/x86/genapic/probe.c index a5f2a24..8736013 100644 --- a/xen/arch/x86/genapic/probe.c +++ b/xen/arch/x86/genapic/probe.c @@ -56,7 +56,8 @@ custom_param("apic", genapic_apic_force); void __init generic_apic_probe(void) { - int i, changed; + bool_t changed; + int i; record_boot_APIC_mode(); diff --git a/xen/include/asm-arm/types.h b/xen/include/asm-arm/types.h index fc43fb4..d3a7eb6 100644 --- a/xen/include/asm-arm/types.h +++ b/xen/include/asm-arm/types.h @@ -57,10 +57,6 @@ typedef u64 register_t; 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__ */ diff --git a/xen/include/asm-x86/types.h b/xen/include/asm-x86/types.h index c37b516..eebd374 100644 --- a/xen/include/asm-x86/types.h +++ b/xen/include/asm-x86/types.h @@ -36,10 +36,6 @@ typedef unsigned long paddr_t; 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__ */ diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h index d7d1b40..3657ac2 100644 --- a/xen/include/xen/device_tree.h +++ b/xen/include/xen/device_tree.h @@ -17,7 +17,6 @@ #include #include #include -#include #include #define DEVICE_TREE_MAX_DEPTH 16 diff --git a/xen/include/xen/libelf.h b/xen/include/xen/libelf.h index d430c83..9ff4006 100644 --- a/xen/include/xen/libelf.h +++ b/xen/include/xen/libelf.h @@ -37,7 +37,6 @@ typedef int elf_negerrnoval; /* 0: ok; -EFOO: error */ #ifdef __XEN__ #include #include -#include #include #else #include diff --git a/xen/include/xen/stdbool.h b/xen/include/xen/stdbool.h deleted file mode 100644 index b0947a6..0000000 --- a/xen/include/xen/stdbool.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __XEN_STDBOOL_H__ -#define __XEN_STDBOOL_H__ - -#define bool _Bool -#define true 1 -#define false 0 -#define __bool_true_false_are_defined 1 - -#endif /* __XEN_STDBOOL_H__ */ diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h index 3ea5941..4455f8f 100644 --- a/xen/include/xen/types.h +++ b/xen/include/xen/types.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -46,4 +47,8 @@ typedef __u32 __be32; typedef __u64 __le64; typedef __u64 __be64; +typedef _Bool bool_t; +#define test_and_set_bool(b) xchg(&(b), 1) +#define test_and_clear_bool(b) xchg(&(b), 0) + #endif /* __TYPES_H__ */