From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKT2n-0004jB-V6 for qemu-devel@nongnu.org; Sun, 08 Feb 2015 09:41:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKT2n-0003rF-1C for qemu-devel@nongnu.org; Sun, 08 Feb 2015 09:41:05 -0500 From: Stefan Weil Date: Sun, 8 Feb 2015 15:40:58 +0100 Message-Id: <1423406458-31957-1-git-send-email-sw@weilnetz.de> Subject: [Qemu-devel] [PATCH] linux-user: Remove type casts to union type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Trivial Cc: Stefan Weil , Riku Voipio , QEMU Developer 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: linux-user/syscall.c:3190:18: warning: cast to non-scalar linux-user/syscall.c:7348:44: warning: cast to non-scalar Cc: Riku Voipio Signed-off-by: Stefan Weil --- 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 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; + switch( cmd ) { case GETVAL: case SETVAL: @@ -3186,8 +3189,7 @@ static abi_long do_ipc(unsigned int call, abi_long first, * ptr argument. */ abi_ulong atptr; get_user_ual(atptr, ptr); - ret = do_semctl(first, second, third, - (union target_semun) atptr); + ret = do_semctl(first, second, third, atptr); break; } @@ -7345,7 +7347,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, #endif #ifdef TARGET_NR_semctl case TARGET_NR_semctl: - ret = do_semctl(arg1, arg2, arg3, (union target_semun)(abi_ulong)arg4); + ret = do_semctl(arg1, arg2, arg3, arg4); break; #endif #ifdef TARGET_NR_msgctl -- 1.7.10.4