All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] bcache: Use fallthrough pseudo-keyword
@ 2020-07-27 20:03 Gustavo A. R. Silva
  2020-07-27 22:39 ` kernel test robot
  2020-07-27 23:01 ` Gustavo A. R. Silva
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2020-07-27 20:03 UTC (permalink / raw)
  To: Coly Li, Kent Overstreet; +Cc: linux-bcache, linux-kernel, Gustavo A. R. Silva

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1].

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/md/bcache/journal.c |  2 +-
 drivers/md/bcache/util.c    | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
index 77fbfd52edcf..c1227bdb57e7 100644
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -608,7 +608,7 @@ static void do_journal_discard(struct cache *ca)
 			ca->sb.njournal_buckets;
 
 		atomic_set(&ja->discard_in_flight, DISCARD_READY);
-		/* fallthrough */
+		fallthrough;
 
 	case DISCARD_READY:
 		if (ja->discard_idx == ja->last_idx)
diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c
index 62fb917f7a4f..66965de548d0 100644
--- a/drivers/md/bcache/util.c
+++ b/drivers/md/bcache/util.c
@@ -33,27 +33,27 @@ int bch_ ## name ## _h(const char *cp, type *res)		\
 	case 'y':						\
 	case 'z':						\
 		u++;						\
-		/* fall through */				\
+		fallthrough;					\
 	case 'e':						\
 		u++;						\
-		/* fall through */				\
+		fallthrough;					\
 	case 'p':						\
 		u++;						\
-		/* fall through */				\
+		fallthrough;					\
 	case 't':						\
 		u++;						\
-		/* fall through */				\
+		fallthrough;					\
 	case 'g':						\
 		u++;						\
-		/* fall through */				\
+		fallthrough					\
 	case 'm':						\
 		u++;						\
-		/* fall through */				\
+		fallthrough;					\
 	case 'k':						\
 		u++;						\
 		if (e++ == cp)					\
 			return -EINVAL;				\
-		/* fall through */				\
+		fallthrough;					\
 	case '\n':						\
 	case '\0':						\
 		if (*e == '\n')					\
-- 
2.27.0


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

* Re: [PATCH][next] bcache: Use fallthrough pseudo-keyword
  2020-07-27 20:03 [PATCH][next] bcache: Use fallthrough pseudo-keyword Gustavo A. R. Silva
@ 2020-07-27 22:39 ` kernel test robot
  2020-07-27 23:01 ` Gustavo A. R. Silva
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-07-27 22:39 UTC (permalink / raw)
  To: kbuild-all

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

Hi "Gustavo,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.8-rc7 next-20200727]
[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]

url:    https://github.com/0day-ci/linux/commits/Gustavo-A-R-Silva/bcache-Use-fallthrough-pseudo-keyword/20200728-040136
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 92ed301919932f777713b9172e525674157e983d
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64 

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

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

   In file included from include/linux/compiler_types.h:59,
                    from <command-line>:
   drivers/md/bcache/util.c: In function 'bch_strtoint_h':
>> include/linux/compiler_attributes.h:201:41: warning: 'fallthrough' attribute not followed by ';' [-Wattributes]
     201 | # define fallthrough                    __attribute__((__fallthrough__))
         |                                         ^~~~~~~~~~~~~
   drivers/md/bcache/util.c:48:3: note: in expansion of macro 'fallthrough'
      48 |   fallthrough     \
         |   ^~~~~~~~~~~
   drivers/md/bcache/util.c:80:1: note: in expansion of macro 'STRTO_H'
      80 | STRTO_H(strtoint, int)
         | ^~~~~~~
>> drivers/md/bcache/util.c:49:2: error: expected identifier or '(' before 'case'
      49 |  case 'm':      \
         |  ^~~~
   drivers/md/bcache/util.c:80:1: note: in expansion of macro 'STRTO_H'
      80 | STRTO_H(strtoint, int)
         | ^~~~~~~
   In file included from include/linux/compiler_types.h:59,
                    from <command-line>:
>> include/linux/compiler_attributes.h:201:41: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     201 | # define fallthrough                    __attribute__((__fallthrough__))
         |                                         ^~~~~~~~~~~~~
   drivers/md/bcache/util.c:48:3: note: in expansion of macro 'fallthrough'
      48 |   fallthrough     \
         |   ^~~~~~~~~~~
   drivers/md/bcache/util.c:80:1: note: in expansion of macro 'STRTO_H'
      80 | STRTO_H(strtoint, int)
         | ^~~~~~~
   drivers/md/bcache/util.c: In function 'bch_strtouint_h':
>> include/linux/compiler_attributes.h:201:41: warning: 'fallthrough' attribute not followed by ';' [-Wattributes]
     201 | # define fallthrough                    __attribute__((__fallthrough__))
         |                                         ^~~~~~~~~~~~~
   drivers/md/bcache/util.c:48:3: note: in expansion of macro 'fallthrough'
      48 |   fallthrough     \
         |   ^~~~~~~~~~~
   drivers/md/bcache/util.c:81:1: note: in expansion of macro 'STRTO_H'
      81 | STRTO_H(strtouint, unsigned int)
         | ^~~~~~~
>> drivers/md/bcache/util.c:49:2: error: expected identifier or '(' before 'case'
      49 |  case 'm':      \
         |  ^~~~
   drivers/md/bcache/util.c:81:1: note: in expansion of macro 'STRTO_H'
      81 | STRTO_H(strtouint, unsigned int)
         | ^~~~~~~
   In file included from include/linux/compiler_types.h:59,
                    from <command-line>:
>> include/linux/compiler_attributes.h:201:41: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     201 | # define fallthrough                    __attribute__((__fallthrough__))
         |                                         ^~~~~~~~~~~~~
   drivers/md/bcache/util.c:48:3: note: in expansion of macro 'fallthrough'
      48 |   fallthrough     \
         |   ^~~~~~~~~~~
   drivers/md/bcache/util.c:81:1: note: in expansion of macro 'STRTO_H'
      81 | STRTO_H(strtouint, unsigned int)
         | ^~~~~~~
   drivers/md/bcache/util.c: In function 'bch_strtoll_h':
>> include/linux/compiler_attributes.h:201:41: warning: 'fallthrough' attribute not followed by ';' [-Wattributes]
     201 | # define fallthrough                    __attribute__((__fallthrough__))
         |                                         ^~~~~~~~~~~~~
   drivers/md/bcache/util.c:48:3: note: in expansion of macro 'fallthrough'
      48 |   fallthrough     \
         |   ^~~~~~~~~~~
   drivers/md/bcache/util.c:82:1: note: in expansion of macro 'STRTO_H'
      82 | STRTO_H(strtoll, long long)
         | ^~~~~~~
>> drivers/md/bcache/util.c:49:2: error: expected identifier or '(' before 'case'
      49 |  case 'm':      \
         |  ^~~~
   drivers/md/bcache/util.c:82:1: note: in expansion of macro 'STRTO_H'
      82 | STRTO_H(strtoll, long long)
         | ^~~~~~~
   In file included from include/linux/compiler_types.h:59,
                    from <command-line>:
>> include/linux/compiler_attributes.h:201:41: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     201 | # define fallthrough                    __attribute__((__fallthrough__))
         |                                         ^~~~~~~~~~~~~
   drivers/md/bcache/util.c:48:3: note: in expansion of macro 'fallthrough'
      48 |   fallthrough     \
         |   ^~~~~~~~~~~
   drivers/md/bcache/util.c:82:1: note: in expansion of macro 'STRTO_H'
      82 | STRTO_H(strtoll, long long)
         | ^~~~~~~
   drivers/md/bcache/util.c: In function 'bch_strtoull_h':
>> include/linux/compiler_attributes.h:201:41: warning: 'fallthrough' attribute not followed by ';' [-Wattributes]
     201 | # define fallthrough                    __attribute__((__fallthrough__))
         |                                         ^~~~~~~~~~~~~
   drivers/md/bcache/util.c:48:3: note: in expansion of macro 'fallthrough'
      48 |   fallthrough     \
         |   ^~~~~~~~~~~
   drivers/md/bcache/util.c:83:1: note: in expansion of macro 'STRTO_H'
      83 | STRTO_H(strtoull, unsigned long long)
         | ^~~~~~~
>> drivers/md/bcache/util.c:49:2: error: expected identifier or '(' before 'case'
      49 |  case 'm':      \
         |  ^~~~
   drivers/md/bcache/util.c:83:1: note: in expansion of macro 'STRTO_H'
      83 | STRTO_H(strtoull, unsigned long long)
         | ^~~~~~~
   In file included from include/linux/compiler_types.h:59,
                    from <command-line>:
>> include/linux/compiler_attributes.h:201:41: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     201 | # define fallthrough                    __attribute__((__fallthrough__))
         |                                         ^~~~~~~~~~~~~
   drivers/md/bcache/util.c:48:3: note: in expansion of macro 'fallthrough'
      48 |   fallthrough     \
         |   ^~~~~~~~~~~
   drivers/md/bcache/util.c:83:1: note: in expansion of macro 'STRTO_H'
      83 | STRTO_H(strtoull, unsigned long long)
         | ^~~~~~~

vim +49 drivers/md/bcache/util.c

cafe563591446c Kent Overstreet     2013-03-23  22  
cafe563591446c Kent Overstreet     2013-03-23  23  #define STRTO_H(name, type)					\
169ef1cf6171d3 Kent Overstreet     2013-03-28  24  int bch_ ## name ## _h(const char *cp, type *res)		\
cafe563591446c Kent Overstreet     2013-03-23  25  {								\
cafe563591446c Kent Overstreet     2013-03-23  26  	int u = 0;						\
cafe563591446c Kent Overstreet     2013-03-23  27  	char *e;						\
cafe563591446c Kent Overstreet     2013-03-23  28  	type i = simple_ ## name(cp, &e, 10);			\
cafe563591446c Kent Overstreet     2013-03-23  29  								\
cafe563591446c Kent Overstreet     2013-03-23  30  	switch (tolower(*e)) {					\
cafe563591446c Kent Overstreet     2013-03-23  31  	default:						\
cafe563591446c Kent Overstreet     2013-03-23  32  		return -EINVAL;					\
cafe563591446c Kent Overstreet     2013-03-23  33  	case 'y':						\
cafe563591446c Kent Overstreet     2013-03-23  34  	case 'z':						\
cafe563591446c Kent Overstreet     2013-03-23  35  		u++;						\
9645a19fa4730e Gustavo A. R. Silva 2020-07-27  36  		fallthrough;					\
cafe563591446c Kent Overstreet     2013-03-23  37  	case 'e':						\
cafe563591446c Kent Overstreet     2013-03-23  38  		u++;						\
9645a19fa4730e Gustavo A. R. Silva 2020-07-27  39  		fallthrough;					\
cafe563591446c Kent Overstreet     2013-03-23  40  	case 'p':						\
cafe563591446c Kent Overstreet     2013-03-23  41  		u++;						\
9645a19fa4730e Gustavo A. R. Silva 2020-07-27  42  		fallthrough;					\
cafe563591446c Kent Overstreet     2013-03-23  43  	case 't':						\
cafe563591446c Kent Overstreet     2013-03-23  44  		u++;						\
9645a19fa4730e Gustavo A. R. Silva 2020-07-27  45  		fallthrough;					\
cafe563591446c Kent Overstreet     2013-03-23  46  	case 'g':						\
cafe563591446c Kent Overstreet     2013-03-23  47  		u++;						\
9645a19fa4730e Gustavo A. R. Silva 2020-07-27  48  		fallthrough					\
cafe563591446c Kent Overstreet     2013-03-23 @49  	case 'm':						\
cafe563591446c Kent Overstreet     2013-03-23  50  		u++;						\
9645a19fa4730e Gustavo A. R. Silva 2020-07-27  51  		fallthrough;					\
cafe563591446c Kent Overstreet     2013-03-23  52  	case 'k':						\
cafe563591446c Kent Overstreet     2013-03-23  53  		u++;						\
cafe563591446c Kent Overstreet     2013-03-23  54  		if (e++ == cp)					\
cafe563591446c Kent Overstreet     2013-03-23  55  			return -EINVAL;				\
9645a19fa4730e Gustavo A. R. Silva 2020-07-27  56  		fallthrough;					\
cafe563591446c Kent Overstreet     2013-03-23  57  	case '\n':						\
cafe563591446c Kent Overstreet     2013-03-23  58  	case '\0':						\
cafe563591446c Kent Overstreet     2013-03-23  59  		if (*e == '\n')					\
cafe563591446c Kent Overstreet     2013-03-23  60  			e++;					\
cafe563591446c Kent Overstreet     2013-03-23  61  	}							\
cafe563591446c Kent Overstreet     2013-03-23  62  								\
cafe563591446c Kent Overstreet     2013-03-23  63  	if (*e)							\
cafe563591446c Kent Overstreet     2013-03-23  64  		return -EINVAL;					\
cafe563591446c Kent Overstreet     2013-03-23  65  								\
cafe563591446c Kent Overstreet     2013-03-23  66  	while (u--) {						\
cafe563591446c Kent Overstreet     2013-03-23  67  		if ((type) ~0 > 0 &&				\
cafe563591446c Kent Overstreet     2013-03-23  68  		    (type) ~0 / 1024 <= i)			\
cafe563591446c Kent Overstreet     2013-03-23  69  			return -EINVAL;				\
cafe563591446c Kent Overstreet     2013-03-23  70  		if ((i > 0 && ANYSINT_MAX(type) / 1024 < i) ||	\
cafe563591446c Kent Overstreet     2013-03-23  71  		    (i < 0 && -ANYSINT_MAX(type) / 1024 > i))	\
cafe563591446c Kent Overstreet     2013-03-23  72  			return -EINVAL;				\
cafe563591446c Kent Overstreet     2013-03-23  73  		i *= 1024;					\
cafe563591446c Kent Overstreet     2013-03-23  74  	}							\
cafe563591446c Kent Overstreet     2013-03-23  75  								\
cafe563591446c Kent Overstreet     2013-03-23  76  	*res = i;						\
cafe563591446c Kent Overstreet     2013-03-23  77  	return 0;						\
cafe563591446c Kent Overstreet     2013-03-23  78  }								\
cafe563591446c Kent Overstreet     2013-03-23  79  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

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

* Re: [PATCH][next] bcache: Use fallthrough pseudo-keyword
  2020-07-27 20:03 [PATCH][next] bcache: Use fallthrough pseudo-keyword Gustavo A. R. Silva
  2020-07-27 22:39 ` kernel test robot
@ 2020-07-27 23:01 ` Gustavo A. R. Silva
  1 sibling, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2020-07-27 23:01 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Coly Li, Kent Overstreet; +Cc: linux-bcache, linux-kernel

Hi,

Please, drop this. It contains an error.

I'll send v2, shortly.

Thanks
--
Gustavo

On 7/27/20 15:03, Gustavo A. R. Silva wrote:
> Replace the existing /* fall through */ comments and its variants with
> the new pseudo-keyword macro fallthrough[1].
> 
> [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through
> 
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>  drivers/md/bcache/journal.c |  2 +-
>  drivers/md/bcache/util.c    | 14 +++++++-------
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
> index 77fbfd52edcf..c1227bdb57e7 100644
> --- a/drivers/md/bcache/journal.c
> +++ b/drivers/md/bcache/journal.c
> @@ -608,7 +608,7 @@ static void do_journal_discard(struct cache *ca)
>  			ca->sb.njournal_buckets;
>  
>  		atomic_set(&ja->discard_in_flight, DISCARD_READY);
> -		/* fallthrough */
> +		fallthrough;
>  
>  	case DISCARD_READY:
>  		if (ja->discard_idx == ja->last_idx)
> diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c
> index 62fb917f7a4f..66965de548d0 100644
> --- a/drivers/md/bcache/util.c
> +++ b/drivers/md/bcache/util.c
> @@ -33,27 +33,27 @@ int bch_ ## name ## _h(const char *cp, type *res)		\
>  	case 'y':						\
>  	case 'z':						\
>  		u++;						\
> -		/* fall through */				\
> +		fallthrough;					\
>  	case 'e':						\
>  		u++;						\
> -		/* fall through */				\
> +		fallthrough;					\
>  	case 'p':						\
>  		u++;						\
> -		/* fall through */				\
> +		fallthrough;					\
>  	case 't':						\
>  		u++;						\
> -		/* fall through */				\
> +		fallthrough;					\
>  	case 'g':						\
>  		u++;						\
> -		/* fall through */				\
> +		fallthrough					\
>  	case 'm':						\
>  		u++;						\
> -		/* fall through */				\
> +		fallthrough;					\
>  	case 'k':						\
>  		u++;						\
>  		if (e++ == cp)					\
>  			return -EINVAL;				\
> -		/* fall through */				\
> +		fallthrough;					\
>  	case '\n':						\
>  	case '\0':						\
>  		if (*e == '\n')					\
> 

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

end of thread, other threads:[~2020-07-27 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-27 20:03 [PATCH][next] bcache: Use fallthrough pseudo-keyword Gustavo A. R. Silva
2020-07-27 22:39 ` kernel test robot
2020-07-27 23:01 ` Gustavo A. R. Silva

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.