Patchwork [1/2] tcg: Use QEMU_BUILD_BUG_ON for CPU_TLB_ENTRY_BITS

login
register
mail settings
Submitter Richard Henderson
Date June 4, 2013, 4:58 p.m.
Message ID <1370365114-21102-2-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/248747/
State New
Headers show

Comments

Richard Henderson - June 4, 2013, 4:58 p.m.
Rather than a hand-coded version of the same thing.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 include/exec/cpu-defs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
liguang - June 5, 2013, 1:37 a.m.
Reviewed-by: liguang <lig.fnst@cn.fujitsu.com>

在 2013-06-04二的 09:58 -0700,Richard Henderson写道:
> Rather than a hand-coded version of the same thing.
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  include/exec/cpu-defs.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
> index d8c64e9..2e5a9ba 100644
> --- a/include/exec/cpu-defs.h
> +++ b/include/exec/cpu-defs.h
> @@ -99,7 +99,7 @@ typedef struct CPUTLBEntry {
>                     sizeof(uintptr_t))];
>  } CPUTLBEntry;
>  
> -extern int CPUTLBEntry_wrong_size[sizeof(CPUTLBEntry) == (1 << CPU_TLB_ENTRY_BITS) ? 1 : -1];
> +QEMU_BUILD_BUG_ON(sizeof(CPUTLBEntry) != (1 << CPU_TLB_ENTRY_BITS));
>  
>  #define CPU_COMMON_TLB \
>      /* The meaning of the MMU modes is defined in the target code. */   \

Patch

diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
index d8c64e9..2e5a9ba 100644
--- a/include/exec/cpu-defs.h
+++ b/include/exec/cpu-defs.h
@@ -99,7 +99,7 @@  typedef struct CPUTLBEntry {
                    sizeof(uintptr_t))];
 } CPUTLBEntry;
 
-extern int CPUTLBEntry_wrong_size[sizeof(CPUTLBEntry) == (1 << CPU_TLB_ENTRY_BITS) ? 1 : -1];
+QEMU_BUILD_BUG_ON(sizeof(CPUTLBEntry) != (1 << CPU_TLB_ENTRY_BITS));
 
 #define CPU_COMMON_TLB \
     /* The meaning of the MMU modes is defined in the target code. */   \