All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/avr: Fix compiler errors (-Werror=enum-conversion)
@ 2021-07-06 18:09 Stefan Weil
  2021-07-06 19:52 ` Michael Rolnik
  2021-09-16 10:11 ` Laurent Vivier
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2021-07-06 18:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Richard Henderson, Michael Rolnik, Stefan Weil

../target/avr/translate.c: In function ‘gen_jmp_ez’:
../target/avr/translate.c:1012:22: error: implicit conversion from ‘enum <anonymous>’ to ‘DisasJumpType’ [-Werror=enum-conversion]
 1012 |     ctx->base.is_jmp = DISAS_LOOKUP;
      |                      ^

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---

-Werror=enum-conversion is not enabled by -Wall, but by -Weverything
with clang for example.

As other targets use similar define statements, I think that's a simple fix.

Regards,
Stefan


 target/avr/translate.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/target/avr/translate.c b/target/avr/translate.c
index c06ce45bc7..fcc839ac36 100644
--- a/target/avr/translate.c
+++ b/target/avr/translate.c
@@ -70,11 +70,9 @@ static const char reg_names[NUMBER_OF_CPU_REGISTERS][8] = {
 };
 #define REG(x) (cpu_r[x])
 
-enum {
-    DISAS_EXIT   = DISAS_TARGET_0,  /* We want return to the cpu main loop.  */
-    DISAS_LOOKUP = DISAS_TARGET_1,  /* We have a variable condition exit.  */
-    DISAS_CHAIN  = DISAS_TARGET_2,  /* We have a single condition exit.  */
-};
+#define DISAS_EXIT   DISAS_TARGET_0  /* We want return to the cpu main loop.  */
+#define DISAS_LOOKUP DISAS_TARGET_1  /* We have a variable condition exit.  */
+#define DISAS_CHAIN  DISAS_TARGET_2  /* We have a single condition exit.  */
 
 typedef struct DisasContext DisasContext;
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] target/avr: Fix compiler errors (-Werror=enum-conversion)
  2021-07-06 18:09 [PATCH] target/avr: Fix compiler errors (-Werror=enum-conversion) Stefan Weil
@ 2021-07-06 19:52 ` Michael Rolnik
  2021-09-16 10:11 ` Laurent Vivier
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Rolnik @ 2021-07-06 19:52 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-trivial, Richard Henderson, QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]

Reviewed-by: Michael Rolnik <mrolnik@gmail.com>

On Tue, Jul 6, 2021 at 9:09 PM Stefan Weil <sw@weilnetz.de> wrote:

> ../target/avr/translate.c: In function ‘gen_jmp_ez’:
> ../target/avr/translate.c:1012:22: error: implicit conversion from ‘enum
> <anonymous>’ to ‘DisasJumpType’ [-Werror=enum-conversion]
>  1012 |     ctx->base.is_jmp = DISAS_LOOKUP;
>       |                      ^
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>
> -Werror=enum-conversion is not enabled by -Wall, but by -Weverything
> with clang for example.
>
> As other targets use similar define statements, I think that's a simple
> fix.
>
> Regards,
> Stefan
>
>
>  target/avr/translate.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/target/avr/translate.c b/target/avr/translate.c
> index c06ce45bc7..fcc839ac36 100644
> --- a/target/avr/translate.c
> +++ b/target/avr/translate.c
> @@ -70,11 +70,9 @@ static const char reg_names[NUMBER_OF_CPU_REGISTERS][8]
> = {
>  };
>  #define REG(x) (cpu_r[x])
>
> -enum {
> -    DISAS_EXIT   = DISAS_TARGET_0,  /* We want return to the cpu main
> loop.  */
> -    DISAS_LOOKUP = DISAS_TARGET_1,  /* We have a variable condition
> exit.  */
> -    DISAS_CHAIN  = DISAS_TARGET_2,  /* We have a single condition exit.
> */
> -};
> +#define DISAS_EXIT   DISAS_TARGET_0  /* We want return to the cpu main
> loop.  */
> +#define DISAS_LOOKUP DISAS_TARGET_1  /* We have a variable condition
> exit.  */
> +#define DISAS_CHAIN  DISAS_TARGET_2  /* We have a single condition exit.
> */
>
>  typedef struct DisasContext DisasContext;
>
> --
> 2.30.2
>
>

-- 
Best Regards,
Michael Rolnik

[-- Attachment #2: Type: text/html, Size: 2289 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] target/avr: Fix compiler errors (-Werror=enum-conversion)
  2021-07-06 18:09 [PATCH] target/avr: Fix compiler errors (-Werror=enum-conversion) Stefan Weil
  2021-07-06 19:52 ` Michael Rolnik
@ 2021-09-16 10:11 ` Laurent Vivier
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2021-09-16 10:11 UTC (permalink / raw)
  To: Stefan Weil, qemu-devel; +Cc: qemu-trivial, Michael Rolnik, Richard Henderson

Le 06/07/2021 à 20:09, Stefan Weil a écrit :
> ../target/avr/translate.c: In function ‘gen_jmp_ez’:
> ../target/avr/translate.c:1012:22: error: implicit conversion from ‘enum <anonymous>’ to ‘DisasJumpType’ [-Werror=enum-conversion]
>  1012 |     ctx->base.is_jmp = DISAS_LOOKUP;
>       |                      ^
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> 
> -Werror=enum-conversion is not enabled by -Wall, but by -Weverything
> with clang for example.
> 
> As other targets use similar define statements, I think that's a simple fix.
> 
> Regards,
> Stefan
> 
> 
>  target/avr/translate.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/target/avr/translate.c b/target/avr/translate.c
> index c06ce45bc7..fcc839ac36 100644
> --- a/target/avr/translate.c
> +++ b/target/avr/translate.c
> @@ -70,11 +70,9 @@ static const char reg_names[NUMBER_OF_CPU_REGISTERS][8] = {
>  };
>  #define REG(x) (cpu_r[x])
>  
> -enum {
> -    DISAS_EXIT   = DISAS_TARGET_0,  /* We want return to the cpu main loop.  */
> -    DISAS_LOOKUP = DISAS_TARGET_1,  /* We have a variable condition exit.  */
> -    DISAS_CHAIN  = DISAS_TARGET_2,  /* We have a single condition exit.  */
> -};
> +#define DISAS_EXIT   DISAS_TARGET_0  /* We want return to the cpu main loop.  */
> +#define DISAS_LOOKUP DISAS_TARGET_1  /* We have a variable condition exit.  */
> +#define DISAS_CHAIN  DISAS_TARGET_2  /* We have a single condition exit.  */
>  
>  typedef struct DisasContext DisasContext;
>  
> 

Applied to my trivial-patches branch.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-16 10:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 18:09 [PATCH] target/avr: Fix compiler errors (-Werror=enum-conversion) Stefan Weil
2021-07-06 19:52 ` Michael Rolnik
2021-09-16 10:11 ` Laurent Vivier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.