diff mbox series

[1/4] sh: convert xchg() to a statement expression

Message ID 20210602231443.4670-2-rdunlap@infradead.org (mailing list archive)
State New
Headers show
Series sh: fixes for various build warnings | expand

Commit Message

Randy Dunlap June 2, 2021, 11:14 p.m. UTC
Use a GCC statement expression (extension) for xchg(), as is done
in other arches.

Fixes this build warning:

../fs/ocfs2/file.c: In function 'ocfs2_file_write_iter':
../arch/sh/include/asm/cmpxchg.h:49:3: warning: value computed is not used [-Wunused-value]
   49 |  ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr))))

Fixes: e839ca528718 ("Disintegrate asm/system.h for SH")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>
This is similar to a patch from Arnd for m68k:

 arch/sh/include/asm/cmpxchg.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


--- linux-next-20210528.orig/arch/sh/include/asm/cmpxchg.h
+++ linux-next-20210528/arch/sh/include/asm/cmpxchg.h
@@ -46,7 +46,7 @@  extern void __xchg_called_with_bad_point
 #define xchg(ptr,x)	\
-	((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr))))
+	({(__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr)));})
 /* This function doesn't exist, so you'll get a linker error
  * if something tries to do an invalid cmpxchg(). */