* [PATCH v2] linux-user: fix implicit conversion from enumeration type error
@ 2020-09-02 12:57 Laurent Vivier
2020-09-03 20:27 ` Richard Henderson
0 siblings, 1 reply; 2+ messages in thread
From: Laurent Vivier @ 2020-09-02 12:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Filip Bozuta, Laurent Vivier
MK_ARRAY(type,size) is used to fill the field_types buffer, and if the
"size" parameter is an enum type, clang [-Werror,-Wenum-conversion] reports
an error when it is assigned to field_types which is also an enum, argtypes.
To avoid that, convert "size" to "int" in MK_ARRAY(). "int" is the type
used for the size evaluation in thunk_type_size().
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
Notes:
v2: put "size" in parentheses as it can be an expression
include/exec/user/thunk.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/exec/user/thunk.h b/include/exec/user/thunk.h
index a5bbb2c73331..b281dfa30f8c 100644
--- a/include/exec/user/thunk.h
+++ b/include/exec/user/thunk.h
@@ -42,7 +42,7 @@ typedef enum argtype {
} argtype;
#define MK_PTR(type) TYPE_PTR, type
-#define MK_ARRAY(type, size) TYPE_ARRAY, size, type
+#define MK_ARRAY(type, size) TYPE_ARRAY, (int)(size), type
#define MK_STRUCT(id) TYPE_STRUCT, id
#define THUNK_TARGET 0
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] linux-user: fix implicit conversion from enumeration type error
2020-09-02 12:57 [PATCH v2] linux-user: fix implicit conversion from enumeration type error Laurent Vivier
@ 2020-09-03 20:27 ` Richard Henderson
0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2020-09-03 20:27 UTC (permalink / raw)
To: Laurent Vivier, qemu-devel; +Cc: Philippe Mathieu-Daudé, Filip Bozuta
On 9/2/20 5:57 AM, Laurent Vivier wrote:
> MK_ARRAY(type,size) is used to fill the field_types buffer, and if the
> "size" parameter is an enum type, clang [-Werror,-Wenum-conversion] reports
> an error when it is assigned to field_types which is also an enum, argtypes.
>
> To avoid that, convert "size" to "int" in MK_ARRAY(). "int" is the type
> used for the size evaluation in thunk_type_size().
>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-03 20:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-02 12:57 [PATCH v2] linux-user: fix implicit conversion from enumeration type error Laurent Vivier
2020-09-03 20:27 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).