linux-user: fix implicit conversion from enumeration type error
authorLaurent Vivier <laurent@vivier.eu>
Wed, 2 Sep 2020 12:57:52 +0000 (14:57 +0200)
committerLaurent Vivier <laurent@vivier.eu>
Wed, 2 Sep 2020 23:09:31 +0000 (01:09 +0200)
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>
Message-Id: <20200902125752.1033524-1-laurent@vivier.eu>

include/exec/user/thunk.h

index a5bbb2c73331c75f82b992934b071c89be036601..b281dfa30f8c2f560826283770d4cb4a28045b3a 100644 (file)
@@ -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