[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 13/13] fix gcc-4.9 compiler error on __{get, put]}_u
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PATCH 13/13] fix gcc-4.9 compiler error on __{get, put]}_user |
Date: |
Wed, 23 Apr 2014 16:12:04 +0300 |
From: Riku Voipio <address@hidden>
gcc-4.9 finds unused operand:
linux-user/syscall.c: In function ‘host_to_target_stat64’:
linux-user/qemu.h:301:19: error: right-hand operand of comma expression
has no effect [-Werror=unused-value]
((hptr), (x)), 0)
Just removing the rh operand is no good, it will error in later:
linux-user/main.c: In function ‘arm_kernel_cmpxchg64_helper’:
linux-user/qemu.h:330:15: error: void value not ignored as it ought to be
__ret = __put_user((x), __hptr); \
Thus, remove setting __ret from __get_user and __put_user, as and
set the right hand operand to (void)0 to make it clear that these
return never nothing.
This commit depends on the signal.c cleanup, to ensure bisectable
version history.
Signed-off-by: Riku Voipio <address@hidden>
Cc: Richard Henderson <address@hidden>
---
linux-user/qemu.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 36d4a73..772e180 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -298,7 +298,7 @@ static inline int access_ok(int type, abi_ulong addr,
abi_ulong size)
__builtin_choose_expr(sizeof(*(hptr)) == 2, stw_##e##_p, \
__builtin_choose_expr(sizeof(*(hptr)) == 4, stl_##e##_p, \
__builtin_choose_expr(sizeof(*(hptr)) == 8, stq_##e##_p, abort)))) \
- ((hptr), (x)), 0)
+ ((hptr), (x)), (void)0)
#define __get_user_e(x, hptr, e) \
((x) = (typeof(*hptr))( \
@@ -306,7 +306,7 @@ static inline int access_ok(int type, abi_ulong addr,
abi_ulong size)
__builtin_choose_expr(sizeof(*(hptr)) == 2, lduw_##e##_p, \
__builtin_choose_expr(sizeof(*(hptr)) == 4, ldl_##e##_p, \
__builtin_choose_expr(sizeof(*(hptr)) == 8, ldq_##e##_p, abort)))) \
- (hptr)), 0)
+ (hptr)), (void)0)
#ifdef TARGET_WORDS_BIGENDIAN
# define __put_user(x, hptr) __put_user_e(x, hptr, be)
@@ -325,9 +325,9 @@ static inline int access_ok(int type, abi_ulong addr,
abi_ulong size)
({ \
abi_ulong __gaddr = (gaddr); \
target_type *__hptr; \
- abi_long __ret; \
+ abi_long __ret = 0;
\
if ((__hptr = lock_user(VERIFY_WRITE, __gaddr, sizeof(target_type), 0))) {
\
- __ret = __put_user((x), __hptr); \
+ __put_user((x), __hptr); \
unlock_user(__hptr, __gaddr, sizeof(target_type)); \
} else \
__ret = -TARGET_EFAULT;
\
@@ -338,9 +338,9 @@ static inline int access_ok(int type, abi_ulong addr,
abi_ulong size)
({ \
abi_ulong __gaddr = (gaddr); \
target_type *__hptr; \
- abi_long __ret; \
+ abi_long __ret = 0;
\
if ((__hptr = lock_user(VERIFY_READ, __gaddr, sizeof(target_type), 1))) { \
- __ret = __get_user((x), __hptr); \
+ __get_user((x), __hptr); \
unlock_user(__hptr, __gaddr, 0); \
} else { \
/* avoid warning */ \
--
1.9.2
- [Qemu-devel] [PATCH 00/13] __{get,put}_user return value cleanup, riku . voipio, 2014/04/23
- [Qemu-devel] [PATCH 02/13] signal.c setup_frame/x86: __put_user cleanup, riku . voipio, 2014/04/23
- [Qemu-devel] [PATCH 03/13] signal.c: remove return value from copy_siginfo_to_user, riku . voipio, 2014/04/23
- [Qemu-devel] [PATCH 12/13] remove __get_user return check from PPC do_setcontext, riku . voipio, 2014/04/23
- [Qemu-devel] [PATCH 08/13] do_sigreturn - remove __get_user checks, riku . voipio, 2014/04/23
- [Qemu-devel] [PATCH 09/13] signal.c: setup_frame remove __put_user checks, riku . voipio, 2014/04/23
- [Qemu-devel] [PATCH 06/13] RFC comment out restore_fpu_state (sparc), riku . voipio, 2014/04/23
- [Qemu-devel] [PATCH 07/13] do_sigaltstack: remove __get_user value check, riku . voipio, 2014/04/23
- [Qemu-devel] [PATCH 01/13] signal.c: remove __get/__put_user return value reading, riku . voipio, 2014/04/23
- [Qemu-devel] [PATCH 13/13] fix gcc-4.9 compiler error on __{get, put]}_user,
riku . voipio <=
- [Qemu-devel] [PATCH 11/13] sparc64_set_context: remove __get_user checks, riku . voipio, 2014/04/23
- [Qemu-devel] [PATCH 04/13] signal.c: remove return value from setup_sigcontext, riku . voipio, 2014/04/23
- [Qemu-devel] [PATCH 05/13] signal.c: remove return value from restore_sigcontext, riku . voipio, 2014/04/23
- [Qemu-devel] [PATCH 10/13] remove __put/get error checks from ppc {save, restore}_user_regs, riku . voipio, 2014/04/23
- Re: [Qemu-devel] [PATCH 00/13] __{get, put}_user return value cleanup, Peter Maydell, 2014/04/23