Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [thomas-weissschuh:b4/bitmap-initializer 3/5] lib/tests/foreach_macros_kunit.c:18:39: warning: shift count >= width of type
@ 2025-06-01 23:25 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-06-01 23:25 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: llvm, oe-kbuild-all

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-06-01 23:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-01 23:25 [thomas-weissschuh:b4/bitmap-initializer 3/5] lib/tests/foreach_macros_kunit.c:18:39: warning: shift count >= width of type kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox