mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] btree: Remove custom MAX macro
@ 2019-09-26 21:34 Harry Jeffery
  2019-09-26 22:15 ` kbuild test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Harry Jeffery @ 2019-09-26 21:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: Harry Jeffery

The btree implementation defines its own MAX macro, whilst also
including kernel.h, which already defines a max macro. This removes the
custom implementation in favour of the standard one provided in kernel.h

Signed-off-by: Harry Jeffery <me@harry.pm>
---
 lib/btree.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/btree.c b/lib/btree.c
index b4cf08a5c267..4b5968b6167b 100644
--- a/lib/btree.c
+++ b/lib/btree.c
@@ -43,8 +43,7 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#define NODESIZE MAX(L1_CACHE_BYTES, 128)
+#define NODESIZE max(L1_CACHE_BYTES, 128)
 
 struct btree_geo {
 	int keylen;
-- 
2.23.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] btree: Remove custom MAX macro
  2019-09-26 21:34 [PATCH] btree: Remove custom MAX macro Harry Jeffery
@ 2019-09-26 22:15 ` kbuild test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kbuild test robot @ 2019-09-26 22:15 UTC (permalink / raw)
  To: Harry Jeffery; +Cc: kbuild-all, linux-kernel, Harry Jeffery

[-- Attachment #1: Type: text/plain, Size: 7279 bytes --]

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@intel.com>

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@linux-foundation.org>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 52170 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-26 22:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-26 21:34 [PATCH] btree: Remove custom MAX macro Harry Jeffery
2019-09-26 22:15 ` kbuild test robot

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

all inboxes | Powered by JetHome®