From: kernel test robot <lkp@intel.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [thomas-weissschuh:b4/bitmap-initializer 3/5] lib/tests/foreach_macros_kunit.c:18:39: warning: shift count >= width of type
Date: Mon, 2 Jun 2025 07:25:20 +0800 [thread overview]
Message-ID: <202506020750.h5ue0vJG-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/thomas.weissschuh/linux.git b4/bitmap-initializer
head: a2f50b59c4c10c1b348be838a119c2ba4566c82a
commit: ad77b763a6de29773ece034131d2ffcc10708629 [3/5] lib/tests: add a KUnit test for linux/foreach_macros.h
config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20250602/202506020750.h5ue0vJG-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250602/202506020750.h5ue0vJG-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506020750.h5ue0vJG-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> lib/tests/foreach_macros_kunit.c:18:39: warning: shift count >= width of type [-Wshift-count-overflow]
18 | static const u64 many_args = FOREACH(FOREACH_BIT, 1, 2, 3, 15, 30, 63) FOREACH_END(0);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/foreach_macros.h:20:47: note: expanded from macro 'FOREACH'
20 | __VA_OPT__(__FOREACH_EXPAND(__FOREACH_HELPER(MACRO, __VA_ARGS__)))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
include/linux/foreach_macros.h:24:47: note: expanded from macro '__FOREACH_HELPER'
24 | __VA_OPT__(__FOREACH_AGAIN __FOREACH_PARENS (MACRO, __VA_ARGS__))
| ^
include/linux/foreach_macros.h:13:85: note: expanded from macro '__FOREACH_EXPAND'
13 | #define __FOREACH_EXPAND(...) __FOREACH_EXPAND3(__FOREACH_EXPAND3(__FOREACH_EXPAND3(__VA_ARGS__)))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
note: (skipping 43 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/foreach_macros.h:16:32: note: expanded from macro '__FOREACH_EXPAND1'
16 | #define __FOREACH_EXPAND1(...) __VA_ARGS__
| ^
include/linux/foreach_macros.h:16:32: note: expanded from macro '__FOREACH_EXPAND1'
include/linux/foreach_macros.h:16:32: note: expanded from macro '__FOREACH_EXPAND1'
16 | #define __FOREACH_EXPAND1(...) __VA_ARGS__
| ^~~~~~~~~~~
lib/tests/foreach_macros_kunit.c:22:82: warning: shift count >= width of type [-Wshift-count-overflow]
22 | KUNIT_EXPECT_EQ(test, many_args, BIT(1) | BIT(2) | BIT(3) | BIT(15) | BIT(30) | BIT(63));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
7 | #define BIT(nr) (UL(1) << (nr))
| ^
include/kunit/test.h:968:34: note: expanded from macro 'KUNIT_EXPECT_EQ'
968 | KUNIT_EXPECT_EQ_MSG(test, left, right, NULL)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
include/kunit/test.h:973:18: note: expanded from macro 'KUNIT_EXPECT_EQ_MSG'
971 | KUNIT_BINARY_INT_ASSERTION(test, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
972 | KUNIT_EXPECTATION, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
973 | left, ==, right, \
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
974 | fmt, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
975 | ##__VA_ARGS__)
| ~~~~~~~~~~~~~~
include/kunit/test.h:809:19: note: expanded from macro 'KUNIT_BINARY_INT_ASSERTION'
805 | KUNIT_BASE_BINARY_ASSERTION(test, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
806 | kunit_binary_assert, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
807 | kunit_binary_assert_format, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
808 | assert_type, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
809 | left, op, right, \
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
810 | fmt, \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
811 | ##__VA_ARGS__)
| ~~~~~~~~~~~~~~
include/kunit/test.h:776:33: note: expanded from macro 'KUNIT_BASE_BINARY_ASSERTION'
776 | const typeof(right) __right = (right); \
| ^~~~~
2 warnings generated.
vim +18 lib/tests/foreach_macros_kunit.c
15
16 static const u64 empty_args = FOREACH(FOREACH_BIT) FOREACH_END(0);
17 static const u64 one_arg = FOREACH(FOREACH_BIT, 7) FOREACH_END(0);
> 18 static const u64 many_args = FOREACH(FOREACH_BIT, 1, 2, 3, 15, 30, 63) FOREACH_END(0);
19
20 KUNIT_EXPECT_EQ(test, empty_args, 0);
21 KUNIT_EXPECT_EQ(test, one_arg, BIT(7));
22 KUNIT_EXPECT_EQ(test, many_args, BIT(1) | BIT(2) | BIT(3) | BIT(15) | BIT(30) | BIT(63));
23
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2025-06-01 23:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202506020750.h5ue0vJG-lkp@intel.com \
--to=lkp@intel.com \
--cc=linux@weissschuh.net \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
/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