[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH] linux-user: Remove type casts to union type
From: |
Michael Tokarev |
Subject: |
Re: [Qemu-trivial] [PATCH] linux-user: Remove type casts to union type |
Date: |
Sun, 04 Oct 2015 19:15:39 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 |
08.02.2015 17:40, Stefan Weil wrote:
> Casting to a union type is a gcc (and clang) extension. Other compilers
> might not support it. This is not a problem today, but the type casts
> can be removed easily. Smatch now no longer complains like before:
I've applied this patch with the following change:
> linux-user/syscall.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 852308e..ec137db 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -2663,8 +2663,9 @@ static inline abi_long host_to_target_semarray(int
> semid, abi_ulong target_addr,
> }
>
> static inline abi_long do_semctl(int semid, int semnum, int cmd,
> - union target_semun target_su)
> + abi_ulong target_arg)
> {
> + union target_semun target_su;
union target_semun target_su = { .buf = target_arg };
> union semun arg;
> struct semid_ds dsarg;
> unsigned short *array = NULL;
> @@ -2673,6 +2674,8 @@ static inline abi_long do_semctl(int semid, int semnum,
> int cmd,
> abi_long err;
> cmd &= 0xff;
>
> + target_su.buf = target_arg;
and dropping this hunk.
Thank you!
/mjt
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-trivial] [PATCH] linux-user: Remove type casts to union type,
Michael Tokarev <=