[PATCH v2 1/2] asm-generic: Unify uapi bitsperlong.h for arm64, riscv and loongarch

Tiezhu Yang yangtiezhu at loongson.cn
Thu Jun 22 05:50:19 PDT 2023



On 06/22/2023 04:04 AM, kernel test robot wrote:
> Hi Tiezhu,
>
> kernel test robot noticed the following build warnings:
>

...

>    In file included from include/asm-generic/bitsperlong.h:5:
>>> include/uapi/asm-generic/bitsperlong.h:13:9: warning: '__BITS_PER_LONG' macro redefined [-Wmacro-redefined]

Oh, thanks for the report, I am sorry.

In order to silence the build warning, it should check the definition
of __BITS_PER_LONG first at the beginning of bitsperlong.h, like this:

#ifndef __BITS_PER_LONG

#if defined(__CHAR_BIT__) && defined(__SIZEOF_LONG__)
#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
#else
#define __BITS_PER_LONG 32
#endif

#endif

I will test and then send v3 later.

Thanks,
Tiezhu




More information about the linux-arm-kernel mailing list