m68k: avoid xchg() warning
PATCH 1/1 m68k: avoid xchg() warning
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.
--- arch/m68k/include/asm/cmpxchg.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/m68k/include/asm/cmpxchg.h +5 -5
@@ -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))
Signature · 1 line
2.27.0
Quoted 9 lines · Arnd Bergmann
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 | #definecmpxchg(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);
Quoted 4 lines
Shut up that warning like we do on other architectures, by turning the macro into a statement expression.
Signed-off-by Arnd Bergmann <[email protected]>
i.e. will queue in the m68k for-v5.11 branch.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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