From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wwuoz-0005ha-Mk for qemu-devel@nongnu.org; Tue, 17 Jun 2014 10:57:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wwuos-0004Qr-CF for qemu-devel@nongnu.org; Tue, 17 Jun 2014 10:57:13 -0400 Received: from afflict.kos.to ([92.243.29.197]:46243) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wwuos-0004P7-17 for qemu-devel@nongnu.org; Tue, 17 Jun 2014 10:57:06 -0400 From: riku.voipio@linaro.org Date: Tue, 17 Jun 2014 17:56:56 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL v2 13/17] linux-user: fix gcc-4.9 compiler error on __{get, put]}_user List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Riku Voipio , Richard Henderson From: Riku Voipio gcc-4.9 finds unused operand: linux-user/syscall.c: In function =E2=80=98host_to_target_stat64=E2=80=99= : linux-user/qemu.h:301:19: error: right-hand operand of comma expression has no effect [-Werror=3Dunused-value] ((hptr), (x)), 0) Just removing the rh operand is no good, it will error in later: linux-user/main.c: In function =E2=80=98arm_kernel_cmpxchg64_helper=E2=80= =99: linux-user/qemu.h:330:15: error: void value not ignored as it ought to be __ret =3D __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 Reviewed-by: Peter Maydell Cc: Richard Henderson --- 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 ba3d8ab..8012cc2 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -299,7 +299,7 @@ static inline int access_ok(int type, abi_ulong addr,= abi_ulong size) __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 2, stw_##e##_p, = \ __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 4, stl_##e##_p, = \ __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 8, stq_##e##_p, abort)))= ) \ - ((hptr), (x)), 0) + ((hptr), (x)), (void)0) =20 #define __get_user_e(x, hptr, e) = \ ((x) =3D (typeof(*hptr))( = \ @@ -307,7 +307,7 @@ static inline int access_ok(int type, abi_ulong addr,= abi_ulong size) __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 2, lduw_##e##_p, = \ __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 4, ldl_##e##_p, = \ __builtin_choose_expr(sizeof(*(hptr)) =3D=3D 8, ldq_##e##_p, abort)))= ) \ - (hptr)), 0) + (hptr)), (void)0) =20 #ifdef TARGET_WORDS_BIGENDIAN # define __put_user(x, hptr) __put_user_e(x, hptr, be) @@ -326,9 +326,9 @@ static inline int access_ok(int type, abi_ulong addr,= abi_ulong size) ({ \ abi_ulong __gaddr =3D (gaddr); \ target_type *__hptr; \ - abi_long __ret; \ + abi_long __ret =3D 0; \ if ((__hptr =3D lock_user(VERIFY_WRITE, __gaddr, sizeof(target_type)= , 0))) { \ - __ret =3D __put_user((x), __hptr); \ + __put_user((x), __hptr); \ unlock_user(__hptr, __gaddr, sizeof(target_type)); \ } else \ __ret =3D -TARGET_EFAULT; \ @@ -339,9 +339,9 @@ static inline int access_ok(int type, abi_ulong addr,= abi_ulong size) ({ \ abi_ulong __gaddr =3D (gaddr); \ target_type *__hptr; \ - abi_long __ret; \ + abi_long __ret =3D 0; \ if ((__hptr =3D lock_user(VERIFY_READ, __gaddr, sizeof(target_type),= 1))) { \ - __ret =3D __get_user((x), __hptr); \ + __get_user((x), __hptr); \ unlock_user(__hptr, __gaddr, 0); \ } else { \ /* avoid warning */ \ --=20 2.0.0.rc2