All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add()
@ 2023-04-18 14:57 Lin Chun Yeh
  2023-04-18 17:49 ` kernel test robot
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Lin Chun Yeh @ 2023-04-18 14:57 UTC (permalink / raw)
  To: linux-kernel; +Cc: Lin Chun Yeh

Move the declaration position of variable c in rb_find_add() to
maintain thedeclaration and used scope consistent with the c
variables, which have the same usage in rb_find() and
rb_find_first().

Signed-off-by: Lin Chun Yeh <r09921093@g.ntu.edu.tw>
---
 include/linux/rbtree.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index f7edca369..910c12382 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -225,11 +225,10 @@ rb_find_add(struct rb_node *node, struct rb_root *tree,
 {
 	struct rb_node **link = &tree->rb_node;
 	struct rb_node *parent = NULL;
-	int c;
 
 	while (*link) {
 		parent = *link;
-		c = cmp(node, parent);
+		int c = cmp(node, parent);
 
 		if (c < 0)
 			link = &parent->rb_left;
-- 
2.34.1


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

* Re: [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add()
  2023-04-18 14:57 [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add() Lin Chun Yeh
@ 2023-04-18 17:49 ` kernel test robot
  2023-04-18 17:49 ` kernel test robot
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2023-04-18 17:49 UTC (permalink / raw)
  To: Lin Chun Yeh, linux-kernel; +Cc: llvm, oe-kbuild-all, Lin Chun Yeh

Hi Lin,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.3-rc7 next-20230417]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lin-Chun-Yeh/include-linux-rbtree-h-move-the-declaration-of-c-in-rb_find_add/20230418-230031
patch link:    https://lore.kernel.org/r/20230418145712.20620-1-r09921093%40g.ntu.edu.tw
patch subject: [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add()
config: arm-randconfig-r046-20230416 (https://download.01.org/0day-ci/archive/20230419/202304190118.H5o8xyuA-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 437b7602e4a998220871de78afcb020b9c14a661)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/intel-lab-lkp/linux/commit/9348e5c71c46a8d88c805acf5dd56c1785bc04e8
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Lin-Chun-Yeh/include-linux-rbtree-h-move-the-declaration-of-c-in-rb_find_add/20230418-230031
        git checkout 9348e5c71c46a8d88c805acf5dd56c1785bc04e8
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/gpu/drm/tilcdc/ drivers/memstick/host/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304190118.H5o8xyuA-lkp@intel.com/

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

   In file included from arch/arm/kernel/asm-offsets.c:11:
   In file included from include/linux/sched.h:20:
   In file included from include/linux/hrtimer.h:16:
>> include/linux/rbtree.h:231:7: warning: mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement]
                   int c = cmp(node, parent);
                       ^
   1 warning generated.
--
   In file included from drivers/memstick/host/r592.c:8:
   In file included from include/linux/module.h:14:
   In file included from include/linux/buildid.h:5:
   In file included from include/linux/mm_types.h:11:
>> include/linux/rbtree.h:231:7: warning: mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement]
                   int c = cmp(node, parent);
                       ^
   drivers/memstick/host/r592.c:47:13: warning: no previous prototype for function 'memstick_debug_get_tpc_name' [-Wmissing-prototypes]
   const char *memstick_debug_get_tpc_name(int tpc)
               ^
   drivers/memstick/host/r592.c:47:7: note: declare 'static' if the function is not intended to be used outside of this translation unit
   const char *memstick_debug_get_tpc_name(int tpc)
         ^
   static 
   2 warnings generated.
--
   In file included from drivers/gpu/drm/tilcdc/tilcdc_plane.c:7:
   In file included from include/drm/drm_atomic.h:31:
   In file included from include/drm/drm_crtc.h:30:
   In file included from include/drm/drm_modeset_lock.h:28:
   In file included from include/linux/stackdepot.h:25:
   In file included from include/linux/gfp.h:7:
   In file included from include/linux/mmzone.h:22:
   In file included from include/linux/mm_types.h:11:
>> include/linux/rbtree.h:231:7: error: mixing declarations and code is incompatible with standards before C99 [-Werror,-Wdeclaration-after-statement]
                   int c = cmp(node, parent);
                       ^
   1 error generated.
--
   In file included from arch/arm/kernel/asm-offsets.c:11:
   In file included from include/linux/sched.h:20:
   In file included from include/linux/hrtimer.h:16:
>> include/linux/rbtree.h:231:7: warning: mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement]
                   int c = cmp(node, parent);
                       ^
   1 warning generated.


vim +231 include/linux/rbtree.h

   212	
   213	/**
   214	 * rb_find_add() - find equivalent @node in @tree, or add @node
   215	 * @node: node to look-for / insert
   216	 * @tree: tree to search / modify
   217	 * @cmp: operator defining the node order
   218	 *
   219	 * Returns the rb_node matching @node, or NULL when no match is found and @node
   220	 * is inserted.
   221	 */
   222	static __always_inline struct rb_node *
   223	rb_find_add(struct rb_node *node, struct rb_root *tree,
   224		    int (*cmp)(struct rb_node *, const struct rb_node *))
   225	{
   226		struct rb_node **link = &tree->rb_node;
   227		struct rb_node *parent = NULL;
   228	
   229		while (*link) {
   230			parent = *link;
 > 231			int c = cmp(node, parent);
   232	
   233			if (c < 0)
   234				link = &parent->rb_left;
   235			else if (c > 0)
   236				link = &parent->rb_right;
   237			else
   238				return parent;
   239		}
   240	
   241		rb_link_node(node, parent, link);
   242		rb_insert_color(node, tree);
   243		return NULL;
   244	}
   245	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* Re: [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add()
  2023-04-18 14:57 [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add() Lin Chun Yeh
  2023-04-18 17:49 ` kernel test robot
@ 2023-04-18 17:49 ` kernel test robot
  2023-04-18 18:00 ` kernel test robot
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2023-04-18 17:49 UTC (permalink / raw)
  To: Lin Chun Yeh, linux-kernel; +Cc: oe-kbuild-all, Lin Chun Yeh

Hi Lin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.3-rc7 next-20230417]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lin-Chun-Yeh/include-linux-rbtree-h-move-the-declaration-of-c-in-rb_find_add/20230418-230031
patch link:    https://lore.kernel.org/r/20230418145712.20620-1-r09921093%40g.ntu.edu.tw
patch subject: [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add()
config: arc-randconfig-r043-20230416 (https://download.01.org/0day-ci/archive/20230419/202304190130.57DBIvkF-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/9348e5c71c46a8d88c805acf5dd56c1785bc04e8
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Lin-Chun-Yeh/include-linux-rbtree-h-move-the-declaration-of-c-in-rb_find_add/20230418-230031
        git checkout 9348e5c71c46a8d88c805acf5dd56c1785bc04e8
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc prepare

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304190130.57DBIvkF-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/hrtimer.h:16,
                    from include/linux/sched.h:20,
                    from arch/arc/kernel/asm-offsets.c:6:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
--
   In file included from include/linux/mm_types.h:11,
                    from include/linux/mmzone.h:22,
                    from include/linux/gfp.h:7,
                    from include/linux/xarray.h:15,
                    from include/linux/list_lru.h:14,
                    from include/linux/fs.h:13,
                    from include/linux/decompress/mm.h:80,
                    from lib/decompress_inflate.c:32:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
   lib/decompress_inflate.c: At top level:
   lib/decompress_inflate.c:42:17: warning: no previous prototype for '__gunzip' [-Wmissing-prototypes]
      42 | STATIC int INIT __gunzip(unsigned char *buf, long len,
         |                 ^~~~~~~~
--
   In file included from include/linux/mm_types.h:11,
                    from include/linux/mmzone.h:22,
                    from include/linux/gfp.h:7,
                    from include/linux/xarray.h:15,
                    from include/linux/list_lru.h:14,
                    from include/linux/fs.h:13,
                    from include/linux/decompress/mm.h:80,
                    from lib/decompress_unxz.c:107:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
   lib/decompress_unxz.c: At top level:
   lib/decompress_unxz.c:251:17: warning: no previous prototype for 'unxz' [-Wmissing-prototypes]
     251 | STATIC int INIT unxz(unsigned char *in, long in_size,
         |                 ^~~~
--
   In file included from include/linux/hrtimer.h:16,
                    from include/linux/sched.h:20,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/node.h:18,
                    from include/linux/cpu.h:17,
                    from lib/radix-tree.c:15:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
   lib/radix-tree.c: At top level:
   lib/radix-tree.c:288:6: warning: no previous prototype for 'radix_tree_node_rcu_free' [-Wmissing-prototypes]
     288 | void radix_tree_node_rcu_free(struct rcu_head *head)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/mm_types.h:11,
                    from include/linux/mmzone.h:22,
                    from include/linux/gfp.h:7,
                    from include/linux/xarray.h:15,
                    from include/linux/radix-tree.h:21,
                    from include/linux/idr.h:15,
                    from include/linux/kernfs.h:12,
                    from include/linux/sysfs.h:16,
                    from include/linux/kobject.h:20,
                    from include/linux/of.h:17,
                    from include/linux/clk-provider.h:9,
                    from lib/vsprintf.c:23:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
   lib/vsprintf.c: In function 'va_format':
   lib/vsprintf.c:1681:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
    1681 |         buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
         |         ^~~
--
   In file included from include/linux/hrtimer.h:16,
                    from include/linux/sched.h:20,
                    from lib/ubsan.c:15:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
   lib/ubsan.c: At top level:
   lib/ubsan.c:226:6: warning: no previous prototype for '__ubsan_handle_divrem_overflow' [-Wmissing-prototypes]
     226 | void __ubsan_handle_divrem_overflow(void *_data, void *lhs, void *rhs)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:307:6: warning: no previous prototype for '__ubsan_handle_type_mismatch' [-Wmissing-prototypes]
     307 | void __ubsan_handle_type_mismatch(struct type_mismatch_data *data,
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:321:6: warning: no previous prototype for '__ubsan_handle_type_mismatch_v1' [-Wmissing-prototypes]
     321 | void __ubsan_handle_type_mismatch_v1(void *_data, void *ptr)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:335:6: warning: no previous prototype for '__ubsan_handle_out_of_bounds' [-Wmissing-prototypes]
     335 | void __ubsan_handle_out_of_bounds(void *_data, void *index)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:352:6: warning: no previous prototype for '__ubsan_handle_shift_out_of_bounds' [-Wmissing-prototypes]
     352 | void __ubsan_handle_shift_out_of_bounds(void *_data, void *lhs, void *rhs)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:394:6: warning: no previous prototype for '__ubsan_handle_builtin_unreachable' [-Wmissing-prototypes]
     394 | void __ubsan_handle_builtin_unreachable(void *_data)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ubsan.c:404:6: warning: no previous prototype for '__ubsan_handle_load_invalid_value' [-Wmissing-prototypes]
     404 | void __ubsan_handle_load_invalid_value(void *_data, void *val)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/mm_types.h:11,
                    from include/linux/buildid.h:5,
                    from include/linux/module.h:14,
                    from lib/test_ubsan.c:4:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
   lib/test_ubsan.c: In function 'test_ubsan_out_of_bounds':
   lib/test_ubsan.c:40:22: warning: variable 'arr' set but not used [-Wunused-but-set-variable]
      40 |         volatile int arr[4];
         |                      ^~~
   lib/test_ubsan.c:39:23: warning: variable 'above' set but not used [-Wunused-but-set-variable]
      39 |         volatile char above[4] = { }; /* Protect surrounding memory. */
         |                       ^~~~~
   lib/test_ubsan.c: In function 'test_ubsan_load_invalid_value':
   lib/test_ubsan.c:62:44: warning: variable 'eptr' set but not used [-Wunused-but-set-variable]
      62 |         enum ubsan_test_enum eval, eval2, *eptr;
         |                                            ^~~~
   lib/test_ubsan.c:61:26: warning: variable 'ptr' set but not used [-Wunused-but-set-variable]
      61 |         bool val, val2, *ptr;
         |                          ^~~
   lib/test_ubsan.c: At top level:
   lib/test_ubsan.c:100:28: warning: 'skip_ubsan_array' defined but not used [-Wunused-const-variable=]
     100 | static const test_ubsan_fp skip_ubsan_array[] = {
         |                            ^~~~~~~~~~~~~~~~
--
   In file included from include/linux/mm_types.h:11,
                    from include/linux/mmzone.h:22,
                    from include/linux/gfp.h:7,
                    from include/linux/xarray.h:15,
                    from include/linux/list_lru.h:14,
                    from include/linux/fs.h:13,
                    from include/linux/debugfs.h:15,
                    from lib/kunit/debugfs.c:7:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
   lib/kunit/debugfs.c: At top level:
   lib/kunit/debugfs.c:28:6: warning: no previous prototype for 'kunit_debugfs_cleanup' [-Wmissing-prototypes]
      28 | void kunit_debugfs_cleanup(void)
         |      ^~~~~~~~~~~~~~~~~~~~~
   lib/kunit/debugfs.c:33:6: warning: no previous prototype for 'kunit_debugfs_init' [-Wmissing-prototypes]
      33 | void kunit_debugfs_init(void)
         |      ^~~~~~~~~~~~~~~~~~
   lib/kunit/debugfs.c:92:6: warning: no previous prototype for 'kunit_debugfs_create_suite' [-Wmissing-prototypes]
      92 | void kunit_debugfs_create_suite(struct kunit_suite *suite)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/kunit/debugfs.c:108:6: warning: no previous prototype for 'kunit_debugfs_destroy_suite' [-Wmissing-prototypes]
     108 | void kunit_debugfs_destroy_suite(struct kunit_suite *suite)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/mm_types.h:11,
                    from include/linux/buildid.h:5,
                    from include/linux/module.h:14,
                    from lib/crc64.c:36:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
   lib/crc64.c: At top level:
   lib/crc64.c:39:10: fatal error: crc64table.h: No such file or directory
      39 | #include "crc64table.h"
         |          ^~~~~~~~~~~~~~
   compilation terminated.
--
   In file included from include/linux/hrtimer.h:16,
                    from include/linux/sched.h:20,
                    from arch/arc/kernel/asm-offsets.c:6:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~


vim +231 include/linux/rbtree.h

   212	
   213	/**
   214	 * rb_find_add() - find equivalent @node in @tree, or add @node
   215	 * @node: node to look-for / insert
   216	 * @tree: tree to search / modify
   217	 * @cmp: operator defining the node order
   218	 *
   219	 * Returns the rb_node matching @node, or NULL when no match is found and @node
   220	 * is inserted.
   221	 */
   222	static __always_inline struct rb_node *
   223	rb_find_add(struct rb_node *node, struct rb_root *tree,
   224		    int (*cmp)(struct rb_node *, const struct rb_node *))
   225	{
   226		struct rb_node **link = &tree->rb_node;
   227		struct rb_node *parent = NULL;
   228	
   229		while (*link) {
   230			parent = *link;
 > 231			int c = cmp(node, parent);
   232	
   233			if (c < 0)
   234				link = &parent->rb_left;
   235			else if (c > 0)
   236				link = &parent->rb_right;
   237			else
   238				return parent;
   239		}
   240	
   241		rb_link_node(node, parent, link);
   242		rb_insert_color(node, tree);
   243		return NULL;
   244	}
   245	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* Re: [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add()
  2023-04-18 14:57 [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add() Lin Chun Yeh
  2023-04-18 17:49 ` kernel test robot
  2023-04-18 17:49 ` kernel test robot
@ 2023-04-18 18:00 ` kernel test robot
  2023-04-18 19:12 ` kernel test robot
  2023-04-19  3:54 ` kernel test robot
  4 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2023-04-18 18:00 UTC (permalink / raw)
  To: Lin Chun Yeh, linux-kernel; +Cc: oe-kbuild-all, Lin Chun Yeh

Hi Lin,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.3-rc7 next-20230417]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lin-Chun-Yeh/include-linux-rbtree-h-move-the-declaration-of-c-in-rb_find_add/20230418-230031
patch link:    https://lore.kernel.org/r/20230418145712.20620-1-r09921093%40g.ntu.edu.tw
patch subject: [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add()
config: riscv-randconfig-r042-20230416 (https://download.01.org/0day-ci/archive/20230419/202304190113.SlgVhTbO-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/9348e5c71c46a8d88c805acf5dd56c1785bc04e8
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Lin-Chun-Yeh/include-linux-rbtree-h-move-the-declaration-of-c-in-rb_find_add/20230418-230031
        git checkout 9348e5c71c46a8d88c805acf5dd56c1785bc04e8
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash lib/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304190113.SlgVhTbO-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/mm_types.h:11,
                    from include/linux/buildid.h:5,
                    from include/linux/module.h:14,
                    from lib/test_bitops.c:9:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
   cc1: all warnings being treated as errors


vim +231 include/linux/rbtree.h

   212	
   213	/**
   214	 * rb_find_add() - find equivalent @node in @tree, or add @node
   215	 * @node: node to look-for / insert
   216	 * @tree: tree to search / modify
   217	 * @cmp: operator defining the node order
   218	 *
   219	 * Returns the rb_node matching @node, or NULL when no match is found and @node
   220	 * is inserted.
   221	 */
   222	static __always_inline struct rb_node *
   223	rb_find_add(struct rb_node *node, struct rb_root *tree,
   224		    int (*cmp)(struct rb_node *, const struct rb_node *))
   225	{
   226		struct rb_node **link = &tree->rb_node;
   227		struct rb_node *parent = NULL;
   228	
   229		while (*link) {
   230			parent = *link;
 > 231			int c = cmp(node, parent);
   232	
   233			if (c < 0)
   234				link = &parent->rb_left;
   235			else if (c > 0)
   236				link = &parent->rb_right;
   237			else
   238				return parent;
   239		}
   240	
   241		rb_link_node(node, parent, link);
   242		rb_insert_color(node, tree);
   243		return NULL;
   244	}
   245	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* Re: [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add()
  2023-04-18 14:57 [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add() Lin Chun Yeh
                   ` (2 preceding siblings ...)
  2023-04-18 18:00 ` kernel test robot
@ 2023-04-18 19:12 ` kernel test robot
  2023-04-19  3:54 ` kernel test robot
  4 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2023-04-18 19:12 UTC (permalink / raw)
  To: Lin Chun Yeh, linux-kernel; +Cc: llvm, oe-kbuild-all, Lin Chun Yeh

Hi Lin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.3-rc7 next-20230417]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lin-Chun-Yeh/include-linux-rbtree-h-move-the-declaration-of-c-in-rb_find_add/20230418-230031
patch link:    https://lore.kernel.org/r/20230418145712.20620-1-r09921093%40g.ntu.edu.tw
patch subject: [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add()
config: s390-randconfig-r044-20230417 (https://download.01.org/0day-ci/archive/20230419/202304190219.FPDNRf8x-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 437b7602e4a998220871de78afcb020b9c14a661)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/intel-lab-lkp/linux/commit/9348e5c71c46a8d88c805acf5dd56c1785bc04e8
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Lin-Chun-Yeh/include-linux-rbtree-h-move-the-declaration-of-c-in-rb_find_add/20230418-230031
        git checkout 9348e5c71c46a8d88c805acf5dd56c1785bc04e8
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304190219.FPDNRf8x-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> warning: unsafe memchr() usage lacked '__read_overflow' warning in lib/test_fortify/read_overflow-memchr.c
--
>> warning: unsafe memchr_inv() usage lacked '__read_overflow' warning in lib/test_fortify/read_overflow-memchr_inv.c
--
>> warning: unsafe memcmp() usage lacked '__read_overflow' warning in lib/test_fortify/read_overflow-memcmp.c
--
>> warning: unsafe memscan() usage lacked '__read_overflow' warning in lib/test_fortify/read_overflow-memscan.c
--
>> warning: unsafe memcmp() usage lacked '__read_overflow2' warning in lib/test_fortify/read_overflow2-memcmp.c
--
>> warning: unsafe memcpy() usage lacked '__read_overflow2' warning in lib/test_fortify/read_overflow2-memcpy.c
--
>> warning: unsafe memmove() usage lacked '__read_overflow2' warning in lib/test_fortify/read_overflow2-memmove.c
--
>> warning: unsafe memcpy() usage lacked '__read_overflow2_field' warning in lib/test_fortify/read_overflow2_field-memcpy.c
--
>> warning: unsafe memmove() usage lacked '__read_overflow2_field' warning in lib/test_fortify/read_overflow2_field-memmove.c
--
>> warning: unsafe memcpy() usage lacked '__write_overflow' warning in lib/test_fortify/write_overflow-memcpy.c
--
>> warning: unsafe memmove() usage lacked '__write_overflow' warning in lib/test_fortify/write_overflow-memmove.c
..

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* Re: [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add()
  2023-04-18 14:57 [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add() Lin Chun Yeh
                   ` (3 preceding siblings ...)
  2023-04-18 19:12 ` kernel test robot
@ 2023-04-19  3:54 ` kernel test robot
  4 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2023-04-19  3:54 UTC (permalink / raw)
  To: Lin Chun Yeh, linux-kernel; +Cc: oe-kbuild-all, Lin Chun Yeh

Hi Lin,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.3-rc7 next-20230418]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lin-Chun-Yeh/include-linux-rbtree-h-move-the-declaration-of-c-in-rb_find_add/20230418-230031
patch link:    https://lore.kernel.org/r/20230418145712.20620-1-r09921093%40g.ntu.edu.tw
patch subject: [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add()
config: powerpc-allnoconfig (https://download.01.org/0day-ci/archive/20230419/202304191107.GfNLJjsT-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/9348e5c71c46a8d88c805acf5dd56c1785bc04e8
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Lin-Chun-Yeh/include-linux-rbtree-h-move-the-declaration-of-c-in-rb_find_add/20230418-230031
        git checkout 9348e5c71c46a8d88c805acf5dd56c1785bc04e8
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash arch/powerpc/lib/ lib/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304191107.GfNLJjsT-lkp@intel.com/

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

   In file included from include/linux/mm_types.h:11,
                    from include/linux/uio.h:10,
                    from include/linux/socket.h:8,
                    from include/linux/compat.h:15,
                    from arch/powerpc/kernel/asm-offsets.c:12:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
--
   In file included from include/linux/hrtimer.h:16,
                    from include/linux/sched.h:20,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/node.h:18,
                    from include/linux/cpu.h:17,
                    from lib/radix-tree.c:15:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
   lib/radix-tree.c: At top level:
   lib/radix-tree.c:288:6: warning: no previous prototype for 'radix_tree_node_rcu_free' [-Wmissing-prototypes]
     288 | void radix_tree_node_rcu_free(struct rcu_head *head)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/mm_types.h:11,
                    from include/linux/mmzone.h:22,
                    from include/linux/gfp.h:7,
                    from include/linux/xarray.h:15,
                    from include/linux/radix-tree.h:21,
                    from include/linux/idr.h:15,
                    from include/linux/kernfs.h:12,
                    from include/linux/sysfs.h:16,
                    from include/linux/kobject.h:20,
                    from include/linux/of.h:17,
                    from include/linux/clk-provider.h:9,
                    from lib/vsprintf.c:23:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
   lib/vsprintf.c: In function 'va_format':
   lib/vsprintf.c:1681:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
    1681 |         buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
         |         ^~~
--
   In file included from include/linux/mm_types.h:11,
                    from include/linux/mmzone.h:22,
                    from include/linux/gfp.h:7,
                    from include/linux/slab.h:15,
                    from arch/powerpc/lib/alloc.c:4:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
   cc1: all warnings being treated as errors
--
   In file included from include/linux/hrtimer.h:16,
                    from include/linux/sched.h:20,
                    from include/linux/hardirq.h:9,
                    from include/linux/interrupt.h:11,
                    from include/linux/trace_recursion.h:5,
                    from include/linux/ftrace.h:10,
                    from include/linux/kprobes.h:28,
                    from arch/powerpc/lib/sstep.c:8:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~
   arch/powerpc/lib/sstep.c: In function 'analyse_instr':
   arch/powerpc/lib/sstep.c:1355:28: error: variable 'suffix' set but not used [-Werror=unused-but-set-variable]
    1355 |         unsigned int word, suffix;
         |                            ^~~~~~
   arch/powerpc/lib/sstep.c:1351:38: error: variable 'rc' set but not used [-Werror=unused-but-set-variable]
    1351 |         unsigned int opcode, ra, rb, rc, rd, spr, u;
         |                                      ^~
   cc1: all warnings being treated as errors
--
   In file included from include/linux/mm_types.h:11,
                    from include/linux/uio.h:10,
                    from include/linux/socket.h:8,
                    from include/linux/compat.h:15,
                    from arch/powerpc/kernel/asm-offsets.c:12:
   include/linux/rbtree.h: In function 'rb_find_add':
>> include/linux/rbtree.h:231:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     231 |                 int c = cmp(node, parent);
         |                 ^~~


vim +231 include/linux/rbtree.h

   212	
   213	/**
   214	 * rb_find_add() - find equivalent @node in @tree, or add @node
   215	 * @node: node to look-for / insert
   216	 * @tree: tree to search / modify
   217	 * @cmp: operator defining the node order
   218	 *
   219	 * Returns the rb_node matching @node, or NULL when no match is found and @node
   220	 * is inserted.
   221	 */
   222	static __always_inline struct rb_node *
   223	rb_find_add(struct rb_node *node, struct rb_root *tree,
   224		    int (*cmp)(struct rb_node *, const struct rb_node *))
   225	{
   226		struct rb_node **link = &tree->rb_node;
   227		struct rb_node *parent = NULL;
   228	
   229		while (*link) {
   230			parent = *link;
 > 231			int c = cmp(node, parent);
   232	
   233			if (c < 0)
   234				link = &parent->rb_left;
   235			else if (c > 0)
   236				link = &parent->rb_right;
   237			else
   238				return parent;
   239		}
   240	
   241		rb_link_node(node, parent, link);
   242		rb_insert_color(node, tree);
   243		return NULL;
   244	}
   245	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

end of thread, other threads:[~2023-04-19  3:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 14:57 [PATCH] include/linux/rbtree.h: move the declaration of c in rb_find_add() Lin Chun Yeh
2023-04-18 17:49 ` kernel test robot
2023-04-18 17:49 ` kernel test robot
2023-04-18 18:00 ` kernel test robot
2023-04-18 19:12 ` kernel test robot
2023-04-19  3:54 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.