linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Torsten Hilbrich <torsten.hilbrich@secunet.com>
To: <linux-kernel@vger.kernel.org>
Cc: Yury Norov <yury.norov@gmail.com>
Subject: [PATCH] include/uapi: Fix invalid use of BITS_PER_LONG in __swab
Date: Wed, 12 Feb 2020 08:51:06 +0100	[thread overview]
Message-ID: <6ecc4021-9beb-2ceb-98ba-5fc8954a05e1@secunet.com> (raw)

This caused compile problems in user-space application using that
header. Seen with systemd:

In file included from /build/client/devel/kernel/_/usr/include/linux/byteorder/little_endian.h:13,
                 from /build/client/devel/kernel/_/usr/include/asm/byteorder.h: ,
                 from /build/client/devel/kernel/_/usr/include/linux/icmpv6.h:6,
                 from ../src/network/networkd-route.c:3:
/build/client/devel/kernel/_/usr/include/linux/swab.h: In function ‘__swab’:
/build/client/devel/kernel/_/usr/include/linux/swab.h:138:5: error: "BITS_PER_LONG" is not defined, evaluates to 0 [-Werror=undef]
 #if BITS_PER_LONG == 64
     ^~~~~~~~~~~~~
cc1: some warnings being treated as errors
[181/1207] Generating sys with a custom command.
ninja: build stopped: subcommand failed.

Signed-off-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
---
 include/uapi/linux/swab.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/swab.h b/include/uapi/linux/swab.h
index fa7f97da5b76..7272f85d6d6a 100644
--- a/include/uapi/linux/swab.h
+++ b/include/uapi/linux/swab.h
@@ -135,9 +135,9 @@ static inline __attribute_const__ __u32 __fswahb32(__u32 val)
 
 static __always_inline unsigned long __swab(const unsigned long y)
 {
-#if BITS_PER_LONG == 64
+#if __BITS_PER_LONG == 64
 	return __swab64(y);
-#else /* BITS_PER_LONG == 32 */
+#else /* __BITS_PER_LONG == 32 */
 	return __swab32(y);
 #endif
 }
-- 
2.20.1



             reply	other threads:[~2020-02-12  7:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12  7:51 Torsten Hilbrich [this message]
2020-02-12  8:21 ` [PATCH] include/uapi: Fix invalid use of BITS_PER_LONG in __swab Yury Norov

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=6ecc4021-9beb-2ceb-98ba-5fc8954a05e1@secunet.com \
    --to=torsten.hilbrich@secunet.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yury.norov@gmail.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 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).