diff mbox series

[12/31] tcg: Move TCG_TYPE_COUNT outside enum

Message ID 20221020115242.2301066-13-richard.henderson@linaro.org
State New
Headers show
Series tcg: Support for Int128 with helpers | expand

Commit Message

Richard Henderson Oct. 20, 2022, 11:52 a.m. UTC
The count is not itself an enumerator.  Move it outside to
prevent the compiler from considering it with -Wswitch-enum.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 include/tcg/tcg.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé Oct. 20, 2022, 3:03 p.m. UTC | #1
On 20/10/22 13:52, Richard Henderson wrote:
> The count is not itself an enumerator.  Move it outside to
> prevent the compiler from considering it with -Wswitch-enum.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   include/tcg/tcg.h | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
> index afa18986b1..a631e0bc80 100644
> --- a/include/tcg/tcg.h
> +++ b/include/tcg/tcg.h
> @@ -294,8 +294,6 @@ typedef enum TCGType {
>       TCG_TYPE_V128,
>       TCG_TYPE_V256,
>   
> -    TCG_TYPE_COUNT, /* number of different types */
> -
>       /* An alias for the size of the host register.  */
>   #if TCG_TARGET_REG_BITS == 32
>       TCG_TYPE_REG = TCG_TYPE_I32,
> @@ -318,6 +316,9 @@ typedef enum TCGType {
>   #endif
>   } TCGType;
>   
> +/* Number of different types */
> +#define TCG_TYPE_COUNT  (TCG_TYPE_V256 + 1)

Eventually add the definition at the same place within the enum,
so we don't forget to update it when adding a new type?

Regardless:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> +
>   /**
>    * get_alignment_bits
>    * @memop: MemOp value
diff mbox series

Patch

diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
index afa18986b1..a631e0bc80 100644
--- a/include/tcg/tcg.h
+++ b/include/tcg/tcg.h
@@ -294,8 +294,6 @@  typedef enum TCGType {
     TCG_TYPE_V128,
     TCG_TYPE_V256,
 
-    TCG_TYPE_COUNT, /* number of different types */
-
     /* An alias for the size of the host register.  */
 #if TCG_TARGET_REG_BITS == 32
     TCG_TYPE_REG = TCG_TYPE_I32,
@@ -318,6 +316,9 @@  typedef enum TCGType {
 #endif
 } TCGType;
 
+/* Number of different types */
+#define TCG_TYPE_COUNT  (TCG_TYPE_V256 + 1)
+
 /**
  * get_alignment_bits
  * @memop: MemOp value