All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Tony Luck <tony.luck@intel.com>, Fenghua Yu <fenghua.yu@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ia64: fix xchg() warning
Date: Mon,  4 Jan 2021 09:58:02 +0100	[thread overview]
Message-ID: <20210104085806.4176886-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

The definition if xchg() causes a harmless warning in some files, like:

In file included from ../arch/ia64/include/uapi/asm/intrinsics.h:22,
                 from ../arch/ia64/include/asm/intrinsics.h:11,
                 from ../arch/ia64/include/asm/bitops.h:19,
                 from ../include/linux/bitops.h:32,
                 from ../include/linux/kernel.h:11,
                 from ../fs/nfs/read.c:12:
../fs/nfs/read.c: In function 'nfs_read_completion':
../arch/ia64/include/uapi/asm/cmpxchg.h:57:2: warning: value computed is not used [-Wunused-value]
   57 | ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
      | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../fs/nfs/read.c:196:5: note: in expansion of macro 'xchg'
  196 |     xchg(&nfs_req_openctx(req)->error, error);
      |     ^~~~

Change it to a compound expression like the other architectures have
to get a clean defconfig build.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/ia64/include/uapi/asm/cmpxchg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/include/uapi/asm/cmpxchg.h b/arch/ia64/include/uapi/asm/cmpxchg.h
index d69c979936d4..5d90307fd6e0 100644
--- a/arch/ia64/include/uapi/asm/cmpxchg.h
+++ b/arch/ia64/include/uapi/asm/cmpxchg.h
@@ -54,7 +54,7 @@ extern void ia64_xchg_called_with_bad_pointer(void);
 })
 
 #define xchg(ptr, x)							\
-((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
+({(__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr)));})
 
 /*
  * Atomic compare and exchange.  Compare OLD with MEM, if identical,
-- 
2.29.2


WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@kernel.org>
To: Tony Luck <tony.luck@intel.com>, Fenghua Yu <fenghua.yu@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ia64: fix xchg() warning
Date: Mon, 04 Jan 2021 08:58:02 +0000	[thread overview]
Message-ID: <20210104085806.4176886-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

The definition if xchg() causes a harmless warning in some files, like:

In file included from ../arch/ia64/include/uapi/asm/intrinsics.h:22,
                 from ../arch/ia64/include/asm/intrinsics.h:11,
                 from ../arch/ia64/include/asm/bitops.h:19,
                 from ../include/linux/bitops.h:32,
                 from ../include/linux/kernel.h:11,
                 from ../fs/nfs/read.c:12:
../fs/nfs/read.c: In function 'nfs_read_completion':
../arch/ia64/include/uapi/asm/cmpxchg.h:57:2: warning: value computed is not used [-Wunused-value]
   57 | ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
      | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../fs/nfs/read.c:196:5: note: in expansion of macro 'xchg'
  196 |     xchg(&nfs_req_openctx(req)->error, error);
      |     ^~~~

Change it to a compound expression like the other architectures have
to get a clean defconfig build.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/ia64/include/uapi/asm/cmpxchg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/include/uapi/asm/cmpxchg.h b/arch/ia64/include/uapi/asm/cmpxchg.h
index d69c979936d4..5d90307fd6e0 100644
--- a/arch/ia64/include/uapi/asm/cmpxchg.h
+++ b/arch/ia64/include/uapi/asm/cmpxchg.h
@@ -54,7 +54,7 @@ extern void ia64_xchg_called_with_bad_pointer(void);
 })
 
 #define xchg(ptr, x)							\
-((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
+({(__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr)));})
 
 /*
  * Atomic compare and exchange.  Compare OLD with MEM, if identical,
-- 
2.29.2

             reply	other threads:[~2021-01-04  8:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04  8:58 Arnd Bergmann [this message]
2021-01-04  8:58 ` [PATCH] ia64: fix xchg() warning Arnd Bergmann
2021-01-04  9:06 ` John Paul Adrian Glaubitz
2021-01-04  9:06   ` John Paul Adrian Glaubitz
2021-01-04  9:32   ` Arnd Bergmann
2021-01-04  9:32     ` Arnd Bergmann
2021-01-04 16:00     ` Luck, Tony
2021-01-04 16:00       ` Luck, Tony
2021-01-05 13:17       ` Arnd Bergmann
2021-01-05 13:17         ` Arnd Bergmann
2021-01-05 15:36         ` Luck, Tony
2021-01-05 15:36           ` Luck, Tony
2021-01-06 10:46           ` John Paul Adrian Glaubitz
2021-01-06 10:46             ` 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=20210104085806.4176886-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=arnd@arndb.de \
    --cc=fenghua.yu@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.