linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: Randy Dunlap <rdunlap@infradead.org>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Rich Felker <dalias@libc.org>,
	linux-sh@vger.kernel.org, David Howells <dhowells@redhat.com>
Subject: [PATCH 1/4] sh: convert xchg() to a statement expression
Date: Wed,  2 Jun 2021 16:14:41 -0700	[thread overview]
Message-ID: <20210602231443.4670-2-rdunlap@infradead.org> (raw)
In-Reply-To: <20210602231443.4670-1-rdunlap@infradead.org>

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:
  https://lore.kernel.org/linux-m68k/20201008123429.1133896-1-arnd@arndb.de/

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

--- 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(). */

  reply	other threads:[~2021-06-02 23:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 23:14 [PATCH 0/3] sh: fixes for various build warnings Randy Dunlap
2021-06-02 23:14 ` Randy Dunlap [this message]
2021-06-02 23:14 ` [RFC PATCH 3/4] sh: define __BIG_ENDIAN for math-emu Randy Dunlap
2021-06-03  7:54   ` Geert Uytterhoeven
2021-06-03 23:19     ` Randy Dunlap
2021-06-04  7:24       ` Geert Uytterhoeven
2021-06-02 23:14 ` [PATCH 4/4] sh: fix READ/WRITE redefinition warnings Randy Dunlap
2021-06-03  6:51 ` [PATCH 0/3] sh: fixes for various build warnings John Paul Adrian Glaubitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210602231443.4670-2-rdunlap@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=dalias@libc.org \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=ysato@users.sourceforge.jp \
    --subject='Re: [PATCH 1/4] sh: convert xchg() to a statement expression' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).