mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: David Gow <davidgow@google.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	0day robot <lkp@intel.com>
Subject: lib/list-test.c:662:45: warning: variable 'head' set but not used
Date: Fri, 11 Mar 2022 21:22:22 +0800	[thread overview]
Message-ID: <202203112152.zpAjsGQF-lkp@intel.com> (raw)

tree:   https://github.com/0day-ci/linux/commits/UPDATE-20220311-151720/Xiaomeng-Tong/list_for_each_entry-make-iterator-invisiable-outside-the-loop/20220301-160113
head:   54ae283053c127aac4b946dffa0f31f9885dbb77
commit: 32c7dc1050a5376225f79589948ac5a63cb75e5a list: test: Add a test for list_traverse
date:   6 hours ago
config: arc-randconfig-r043-20220310 (https://download.01.org/0day-ci/archive/20220311/202203112152.zpAjsGQF-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.2.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/0day-ci/linux/commit/32c7dc1050a5376225f79589948ac5a63cb75e5a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review UPDATE-20220311-151720/Xiaomeng-Tong/list_for_each_entry-make-iterator-invisiable-outside-the-loop/20220301-160113
        git checkout 32c7dc1050a5376225f79589948ac5a63cb75e5a
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash kernel/ lib/ mm/ net/core/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   lib/list-test.c:15:9: error: expected specifier-qualifier-list before 'list_traversal_head'
      15 |         list_traversal_head(struct list_test_struct, head, list);
         |         ^~~~~~~~~~~~~~~~~~~
   lib/list-test.c: In function 'list_test_list_traverse':
   lib/list-test.c:665:29: error: 'struct list_test_struct' has no member named 'head'
     665 |         INIT_LIST_HEAD(&head.head);
         |                             ^
   lib/list-test.c:669:54: error: 'struct list_test_struct' has no member named 'head'
     669 |                 list_add_tail(&entries[i].list, &head.head);
         |                                                      ^
   lib/list-test.c:674:9: error: implicit declaration of function 'list_traverse' [-Werror=implicit-function-declaration]
     674 |         list_traverse(cur, &head.head, list) {
         |         ^~~~~~~~~~~~~
   lib/list-test.c:674:23: error: 'cur' undeclared (first use in this function)
     674 |         list_traverse(cur, &head.head, list) {
         |                       ^~~
   lib/list-test.c:674:23: note: each undeclared identifier is reported only once for each function it appears in
   lib/list-test.c:674:33: error: 'struct list_test_struct' has no member named 'head'
     674 |         list_traverse(cur, &head.head, list) {
         |                                 ^
   lib/list-test.c:674:40: error: 'list' undeclared (first use in this function)
     674 |         list_traverse(cur, &head.head, list) {
         |                                        ^~~~
   lib/list-test.c:674:45: error: expected ';' before '{' token
     674 |         list_traverse(cur, &head.head, list) {
         |                                             ^~
         |                                             ;
>> lib/list-test.c:662:45: warning: variable 'head' set but not used [-Wunused-but-set-variable]
     662 |         struct list_test_struct entries[5], head;
         |                                             ^~~~
   cc1: some warnings being treated as errors


vim +/head +662 lib/list-test.c

   659	
   660	static void list_test_list_traverse(struct kunit *test)
   661	{
 > 662		struct list_test_struct entries[5], head;
   663		int i = 0;
   664	
   665		INIT_LIST_HEAD(&head.head);
   666	
   667		for (i = 0; i < 5; ++i) {
   668			entries[i].data = i;
   669			list_add_tail(&entries[i].list, &head.head);
   670		}
   671	
   672		i = 0;
   673	
   674		list_traverse(cur, &head.head, list) {
   675			KUNIT_EXPECT_EQ(test, cur->data, i);
   676			i++;
   677		}
   678	
   679		KUNIT_EXPECT_EQ(test, i, 5);
   680	}
   681	

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

                 reply	other threads:[~2022-03-11 13:23 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=202203112152.zpAjsGQF-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=davidgow@google.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®