* [PATCH] m68k: avoid xchg() warning
@ 2020-10-08 12:34 Arnd Bergmann
2020-10-12 13:18 ` Geert Uytterhoeven
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2020-10-08 12:34 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Arnd Bergmann, Greg Ungerer, linux-m68k, linux-kernel
gcc warns about the value of xchg()/cmpxchg() being unused
in some cases:
net/core/filter.c: In function 'bpf_clear_redirect_map':
arch/m68k/include/asm/cmpxchg.h:137:3: warning: value computed is not used [-Wunused-value]
106 | #define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n))
net/core/filter.c:3595:4: note: in expansion of macro 'cmpxchg'
3595 | cmpxchg(&ri->map, map, NULL);
Shut up that warning like we do on other architectures, by
turning the macro into a statement expression.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/m68k/include/asm/cmpxchg.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/m68k/include/asm/cmpxchg.h b/arch/m68k/include/asm/cmpxchg.h
index 3a3bdcfcd375..a4aa82021d3b 100644
--- a/arch/m68k/include/asm/cmpxchg.h
+++ b/arch/m68k/include/asm/cmpxchg.h
@@ -76,7 +76,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
}
#endif
-#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
+#define xchg(ptr,x) ({(__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)));})
#include <asm-generic/cmpxchg-local.h>
@@ -119,11 +119,11 @@ static inline unsigned long __cmpxchg(volatile void *p, unsigned long old,
}
#define cmpxchg(ptr, o, n) \
- ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
- (unsigned long)(n), sizeof(*(ptr))))
+ ({(__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
+ (unsigned long)(n), sizeof(*(ptr)));})
#define cmpxchg_local(ptr, o, n) \
- ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
- (unsigned long)(n), sizeof(*(ptr))))
+ ({(__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
+ (unsigned long)(n), sizeof(*(ptr)));})
#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] m68k: avoid xchg() warning
2020-10-08 12:34 [PATCH] m68k: avoid xchg() warning Arnd Bergmann
@ 2020-10-12 13:18 ` Geert Uytterhoeven
0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2020-10-12 13:18 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Greg Ungerer, linux-m68k, Linux Kernel Mailing List
On Thu, Oct 8, 2020 at 2:34 PM Arnd Bergmann <arnd@arndb.de> wrote:
> gcc warns about the value of xchg()/cmpxchg() being unused
> in some cases:
>
> net/core/filter.c: In function 'bpf_clear_redirect_map':
> arch/m68k/include/asm/cmpxchg.h:137:3: warning: value computed is not used [-Wunused-value]
> 106 | #define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n))
> net/core/filter.c:3595:4: note: in expansion of macro 'cmpxchg'
> 3595 | cmpxchg(&ri->map, map, NULL);
>
> Shut up that warning like we do on other architectures, by
> turning the macro into a statement expression.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue in the m68k for-v5.11 branch.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-12 13:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-08 12:34 [PATCH] m68k: avoid xchg() warning Arnd Bergmann
2020-10-12 13:18 ` Geert Uytterhoeven
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).