* [PATCH] linux-user: fix implicit conversion from enumeration type error
@ 2020-09-01 15:33 Laurent Vivier
2020-09-02 2:44 ` no-reply
2020-09-02 10:29 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 3+ messages in thread
From: Laurent Vivier @ 2020-09-01 15:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier, Filip Bozuta
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>
---
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..b798fcb69cf4 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] 3+ messages in thread
* Re: [PATCH] linux-user: fix implicit conversion from enumeration type error
2020-09-01 15:33 [PATCH] linux-user: fix implicit conversion from enumeration type error Laurent Vivier
@ 2020-09-02 2:44 ` no-reply
2020-09-02 10:29 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: no-reply @ 2020-09-02 2:44 UTC (permalink / raw)
To: laurent; +Cc: qemu-devel, Filip.Bozuta, laurent
Patchew URL: https://patchew.org/QEMU/20200901153321.920490-1-laurent@vivier.eu/
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 20200901153321.920490-1-laurent@vivier.eu
Subject: [PATCH] linux-user: fix implicit conversion from enumeration type error
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
30ae5fc linux-user: fix implicit conversion from enumeration type error
=== OUTPUT BEGIN ===
ERROR: Macros with complex values should be enclosed in parenthesis
#26: FILE: include/exec/user/thunk.h:45:
+#define MK_ARRAY(type, size) TYPE_ARRAY, (int)size, type
total: 1 errors, 0 warnings, 8 lines checked
Commit 30ae5fc07c8d (linux-user: fix implicit conversion from enumeration type error) has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/20200901153321.920490-1-laurent@vivier.eu/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] linux-user: fix implicit conversion from enumeration type error
2020-09-01 15:33 [PATCH] linux-user: fix implicit conversion from enumeration type error Laurent Vivier
2020-09-02 2:44 ` no-reply
@ 2020-09-02 10:29 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-02 10:29 UTC (permalink / raw)
To: Laurent Vivier, qemu-devel; +Cc: Filip Bozuta
On 9/1/20 5:33 PM, 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>
> ---
> 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..b798fcb69cf4 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
You need to use parenthesis:
#define MK_ARRAY(type, size) TYPE_ARRAY, (int)(size), type
See:
MK_ARRAY(TYPE_CHAR, USBDEVFS_MAXDRIVERNAME + 1)) /* driver */
While here I'd also add them to 'type'.
With parenthesis:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> #define MK_STRUCT(id) TYPE_STRUCT, id
>
> #define THUNK_TARGET 0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-02 10:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01 15:33 [PATCH] linux-user: fix implicit conversion from enumeration type error Laurent Vivier
2020-09-02 2:44 ` no-reply
2020-09-02 10:29 ` Philippe Mathieu-Daudé
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.