* [PATCH] include/uapi: Fix invalid use of BITS_PER_LONG in __swab
@ 2020-02-12 7:51 Torsten Hilbrich
2020-02-12 8:21 ` Yury Norov
0 siblings, 1 reply; 2+ messages in thread
From: Torsten Hilbrich @ 2020-02-12 7:51 UTC (permalink / raw)
To: linux-kernel; +Cc: Yury Norov
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] include/uapi: Fix invalid use of BITS_PER_LONG in __swab
2020-02-12 7:51 [PATCH] include/uapi: Fix invalid use of BITS_PER_LONG in __swab Torsten Hilbrich
@ 2020-02-12 8:21 ` Yury Norov
0 siblings, 0 replies; 2+ messages in thread
From: Yury Norov @ 2020-02-12 8:21 UTC (permalink / raw)
To: Torsten Hilbrich; +Cc: linux-kernel
On Wed, Feb 12, 2020 at 08:51:06AM +0100, Torsten Hilbrich wrote:
> 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
Acked-by: Yury Norov <yury.norov@gmail.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-12 8:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-12 7:51 [PATCH] include/uapi: Fix invalid use of BITS_PER_LONG in __swab Torsten Hilbrich
2020-02-12 8:21 ` Yury Norov
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).