Re: [PATCH] btree: Remove custom MAX macro

From: kbuild test robot
Date: Thu Sep 26 2019 - 18:16:26 EST


Hi Harry,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3 next-20190925]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Harry-Jeffery/btree-Remove-custom-MAX-macro/20190927-053933
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=sh

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

In file included from include/linux/btree.h:5:0,
from lib///btree.c:40:
>> include/linux/kernel.h:860:50: error: braced-group within expression allowed only inside a function
#define __cmp_once(x, y, unique_x, unique_y, op) ({ \
^
>> include/linux/kernel.h:868:3: note: in expansion of macro '__cmp_once'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^~~~~~~~~~
include/linux/kernel.h:882:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> lib///btree.c:46:18: note: in expansion of macro 'max'
#define NODESIZE max(L1_CACHE_BYTES, 128)
^~~
>> lib///btree.c:56:14: note: in expansion of macro 'NODESIZE'
.no_pairs = NODESIZE / sizeof(long) / 2,
^~~~~~~~
>> include/linux/kernel.h:860:50: error: braced-group within expression allowed only inside a function
#define __cmp_once(x, y, unique_x, unique_y, op) ({ \
^
>> include/linux/kernel.h:868:3: note: in expansion of macro '__cmp_once'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^~~~~~~~~~
include/linux/kernel.h:882:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> lib///btree.c:46:18: note: in expansion of macro 'max'
#define NODESIZE max(L1_CACHE_BYTES, 128)
^~~
lib///btree.c:57:14: note: in expansion of macro 'NODESIZE'
.no_longs = NODESIZE / sizeof(long) / 2,
^~~~~~~~
>> include/linux/kernel.h:860:50: error: braced-group within expression allowed only inside a function
#define __cmp_once(x, y, unique_x, unique_y, op) ({ \
^
>> include/linux/kernel.h:868:3: note: in expansion of macro '__cmp_once'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^~~~~~~~~~
include/linux/kernel.h:882:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> lib///btree.c:46:18: note: in expansion of macro 'max'
#define NODESIZE max(L1_CACHE_BYTES, 128)
^~~
lib///btree.c:64:14: note: in expansion of macro 'NODESIZE'
.no_pairs = NODESIZE / sizeof(long) / (1 + LONG_PER_U64),
^~~~~~~~
>> include/linux/kernel.h:860:50: error: braced-group within expression allowed only inside a function
#define __cmp_once(x, y, unique_x, unique_y, op) ({ \
^
>> include/linux/kernel.h:868:3: note: in expansion of macro '__cmp_once'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^~~~~~~~~~
include/linux/kernel.h:882:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> lib///btree.c:46:18: note: in expansion of macro 'max'
#define NODESIZE max(L1_CACHE_BYTES, 128)
^~~
lib///btree.c:65:30: note: in expansion of macro 'NODESIZE'
.no_longs = LONG_PER_U64 * (NODESIZE / sizeof(long) / (1 + LONG_PER_U64)),
^~~~~~~~
>> include/linux/kernel.h:860:50: error: braced-group within expression allowed only inside a function
#define __cmp_once(x, y, unique_x, unique_y, op) ({ \
^
>> include/linux/kernel.h:868:3: note: in expansion of macro '__cmp_once'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^~~~~~~~~~
include/linux/kernel.h:882:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> lib///btree.c:46:18: note: in expansion of macro 'max'
#define NODESIZE max(L1_CACHE_BYTES, 128)
^~~
lib///btree.c:71:14: note: in expansion of macro 'NODESIZE'
.no_pairs = NODESIZE / sizeof(long) / (1 + 2 * LONG_PER_U64),
^~~~~~~~
>> include/linux/kernel.h:860:50: error: braced-group within expression allowed only inside a function
#define __cmp_once(x, y, unique_x, unique_y, op) ({ \
^
>> include/linux/kernel.h:868:3: note: in expansion of macro '__cmp_once'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^~~~~~~~~~
include/linux/kernel.h:882:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> lib///btree.c:46:18: note: in expansion of macro 'max'
#define NODESIZE max(L1_CACHE_BYTES, 128)
^~~
lib///btree.c:72:34: note: in expansion of macro 'NODESIZE'
.no_longs = 2 * LONG_PER_U64 * (NODESIZE / sizeof(long) / (1 + 2 * LONG_PER_U64)),
^~~~~~~~

vim +860 include/linux/kernel.h

3c8ba0d61d04ce Kees Cook 2018-03-30 859
e9092d0d979611 Linus Torvalds 2018-04-09 @860 #define __cmp_once(x, y, unique_x, unique_y, op) ({ \
e9092d0d979611 Linus Torvalds 2018-04-09 861 typeof(x) unique_x = (x); \
e9092d0d979611 Linus Torvalds 2018-04-09 862 typeof(y) unique_y = (y); \
e9092d0d979611 Linus Torvalds 2018-04-09 863 __cmp(unique_x, unique_y, op); })
3c8ba0d61d04ce Kees Cook 2018-03-30 864
3c8ba0d61d04ce Kees Cook 2018-03-30 865 #define __careful_cmp(x, y, op) \
3c8ba0d61d04ce Kees Cook 2018-03-30 866 __builtin_choose_expr(__safe_cmp(x, y), \
e9092d0d979611 Linus Torvalds 2018-04-09 867 __cmp(x, y, op), \
e9092d0d979611 Linus Torvalds 2018-04-09 @868 __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
e8c97af0c1f23d Randy Dunlap 2017-10-13 869

:::::: The code at line 860 was first introduced by commit
:::::: e9092d0d97961146655ce51f43850907d95f68c3 Fix subtle macro variable shadowing in min_not_zero()

:::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip