linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mips/oprofile: Fix fallthrough placement
@ 2020-08-20 12:54 zhe.he
  2020-08-21  7:48 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 5+ messages in thread
From: zhe.he @ 2020-08-20 12:54 UTC (permalink / raw)
  To: rric, tsbogend, oprofile-list, linux-mips, linux-kernel, zhe.he

From: He Zhe <zhe.he@windriver.com>

We want neither
"
include/linux/compiler_attributes.h:201:41: warning: statement will never
be executed [-Wswitch-unreachable]
  201 | # define fallthrough __attribute__((__fallthrough__))
      |                      ^~~~~~~~~~~~~
"
nor
"
include/linux/compiler_attributes.h:201:41: warning: attribute
'fallthrough' not preceding a case label or default label
  201 | # define fallthrough __attribute__((__fallthrough__))
      |                      ^~~~~~~~~~~~~
"

It's not worth adding one more macro. Let's simply place the fallthrough
in between the expansions.

Signed-off-by: He Zhe <zhe.he@windriver.com>
---
 arch/mips/oprofile/op_model_mipsxx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index 1493c49ca47a..55d7b7fd18b6 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -245,7 +245,6 @@ static int mipsxx_perfcount_handler(void)
 
 	switch (counters) {
 #define HANDLE_COUNTER(n)						\
-	fallthrough;							\
 	case n + 1:							\
 		control = r_c0_perfctrl ## n();				\
 		counter = r_c0_perfcntr ## n();				\
@@ -256,8 +255,11 @@ static int mipsxx_perfcount_handler(void)
 			handled = IRQ_HANDLED;				\
 		}
 	HANDLE_COUNTER(3)
+	fallthrough;
 	HANDLE_COUNTER(2)
+	fallthrough;
 	HANDLE_COUNTER(1)
+	fallthrough;
 	HANDLE_COUNTER(0)
 	}
 
-- 
2.17.1


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

* Re: [PATCH] mips/oprofile: Fix fallthrough placement
  2020-08-20 12:54 [PATCH] mips/oprofile: Fix fallthrough placement zhe.he
@ 2020-08-21  7:48 ` Thomas Bogendoerfer
  2020-08-21  8:46   ` He Zhe
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Bogendoerfer @ 2020-08-21  7:48 UTC (permalink / raw)
  To: zhe.he; +Cc: rric, oprofile-list, linux-mips, linux-kernel

On Thu, Aug 20, 2020 at 08:54:40PM +0800, zhe.he@windriver.com wrote:
> From: He Zhe <zhe.he@windriver.com>
> 
> We want neither
> "
> include/linux/compiler_attributes.h:201:41: warning: statement will never
> be executed [-Wswitch-unreachable]
>   201 | # define fallthrough __attribute__((__fallthrough__))
>       |                      ^~~~~~~~~~~~~
> "
> nor
> "
> include/linux/compiler_attributes.h:201:41: warning: attribute
> 'fallthrough' not preceding a case label or default label
>   201 | # define fallthrough __attribute__((__fallthrough__))
>       |                      ^~~~~~~~~~~~~
> "
> 
> It's not worth adding one more macro. Let's simply place the fallthrough
> in between the expansions.
> 
> Signed-off-by: He Zhe <zhe.he@windriver.com>

there is already another patch for the problem, which I've applied
to mips-fixes.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

* Re: [PATCH] mips/oprofile: Fix fallthrough placement
  2020-08-21  7:48 ` Thomas Bogendoerfer
@ 2020-08-21  8:46   ` He Zhe
  2020-08-21  9:23     ` Gustavo A. R. Silva
  0 siblings, 1 reply; 5+ messages in thread
From: He Zhe @ 2020-08-21  8:46 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: rric, oprofile-list, linux-mips, linux-kernel



On 8/21/20 3:48 PM, Thomas Bogendoerfer wrote:
> On Thu, Aug 20, 2020 at 08:54:40PM +0800, zhe.he@windriver.com wrote:
>> From: He Zhe <zhe.he@windriver.com>
>>
>> We want neither
>> "
>> include/linux/compiler_attributes.h:201:41: warning: statement will never
>> be executed [-Wswitch-unreachable]
>>   201 | # define fallthrough __attribute__((__fallthrough__))
>>       |                      ^~~~~~~~~~~~~
>> "
>> nor
>> "
>> include/linux/compiler_attributes.h:201:41: warning: attribute
>> 'fallthrough' not preceding a case label or default label
>>   201 | # define fallthrough __attribute__((__fallthrough__))
>>       |                      ^~~~~~~~~~~~~
>> "
>>
>> It's not worth adding one more macro. Let's simply place the fallthrough
>> in between the expansions.
>>
>> Signed-off-by: He Zhe <zhe.he@windriver.com>
> there is already another patch for the problem, which I've applied
> to mips-fixes.

You mean the below one?
https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git/commit/?h=mips-fixes&id=5900acb374fe2f4f42bbcb2c84db64f582d917a1

That patch handles the first warning in my commit log but does not handle the
second one which is introduced since gcc v10.1.0 commit 6c80b1b56dec
("Make more bad uses of fallthrough attribute into pedwarns.").

Zhe

>
> Thomas.
>


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

* Re: [PATCH] mips/oprofile: Fix fallthrough placement
  2020-08-21  8:46   ` He Zhe
@ 2020-08-21  9:23     ` Gustavo A. R. Silva
  2020-08-21 14:07       ` Thomas Bogendoerfer
  0 siblings, 1 reply; 5+ messages in thread
From: Gustavo A. R. Silva @ 2020-08-21  9:23 UTC (permalink / raw)
  To: He Zhe, Thomas Bogendoerfer
  Cc: rric, oprofile-list, linux-mips, linux-kernel, Gustavo A. R. Silva



On 8/21/20 03:46, He Zhe wrote:
> 
> 
> On 8/21/20 3:48 PM, Thomas Bogendoerfer wrote:
>> On Thu, Aug 20, 2020 at 08:54:40PM +0800, zhe.he@windriver.com wrote:
>>> From: He Zhe <zhe.he@windriver.com>
>>>
>>> We want neither
>>> "
>>> include/linux/compiler_attributes.h:201:41: warning: statement will never
>>> be executed [-Wswitch-unreachable]
>>>   201 | # define fallthrough __attribute__((__fallthrough__))
>>>       |                      ^~~~~~~~~~~~~
>>> "
>>> nor
>>> "
>>> include/linux/compiler_attributes.h:201:41: warning: attribute
>>> 'fallthrough' not preceding a case label or default label
>>>   201 | # define fallthrough __attribute__((__fallthrough__))
>>>       |                      ^~~~~~~~~~~~~
>>> "
>>>
>>> It's not worth adding one more macro. Let's simply place the fallthrough
>>> in between the expansions.
>>>
>>> Signed-off-by: He Zhe <zhe.he@windriver.com>
>> there is already another patch for the problem, which I've applied
>> to mips-fixes.
> 
> You mean the below one?
> https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git/commit/?h=mips-fixes&id=5900acb374fe2f4f42bbcb2c84db64f582d917a1
> 
> That patch handles the first warning in my commit log but does not handle the
> second one which is introduced since gcc v10.1.0 commit 6c80b1b56dec
> ("Make more bad uses of fallthrough attribute into pedwarns.").
> 

This is true.

Thomas, please apply this patch instead of mine. Also, consider adding
the Fixes tag and CC stable due to the non-executable code error, and
my Reviewed-by:

Fixes: c9b029903466 ("MIPS: Use fallthrough for arch/mips")
Cc: stable@vger.kernel.org
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
--
Gustavo

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

* Re: [PATCH] mips/oprofile: Fix fallthrough placement
  2020-08-21  9:23     ` Gustavo A. R. Silva
@ 2020-08-21 14:07       ` Thomas Bogendoerfer
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Bogendoerfer @ 2020-08-21 14:07 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: He Zhe, rric, oprofile-list, linux-mips, linux-kernel,
	Gustavo A. R. Silva

On Fri, Aug 21, 2020 at 04:23:28AM -0500, Gustavo A. R. Silva wrote:
> 
> 
> On 8/21/20 03:46, He Zhe wrote:
> > 
> > 
> > On 8/21/20 3:48 PM, Thomas Bogendoerfer wrote:
> >> On Thu, Aug 20, 2020 at 08:54:40PM +0800, zhe.he@windriver.com wrote:
> >>> From: He Zhe <zhe.he@windriver.com>
> >>>
> >>> We want neither
> >>> "
> >>> include/linux/compiler_attributes.h:201:41: warning: statement will never
> >>> be executed [-Wswitch-unreachable]
> >>>   201 | # define fallthrough __attribute__((__fallthrough__))
> >>>       |                      ^~~~~~~~~~~~~
> >>> "
> >>> nor
> >>> "
> >>> include/linux/compiler_attributes.h:201:41: warning: attribute
> >>> 'fallthrough' not preceding a case label or default label
> >>>   201 | # define fallthrough __attribute__((__fallthrough__))
> >>>       |                      ^~~~~~~~~~~~~
> >>> "
> >>>
> >>> It's not worth adding one more macro. Let's simply place the fallthrough
> >>> in between the expansions.
> >>>
> >>> Signed-off-by: He Zhe <zhe.he@windriver.com>
> >> there is already another patch for the problem, which I've applied
> >> to mips-fixes.
> > 
> > You mean the below one?
> > https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git/commit/?h=mips-fixes&id=5900acb374fe2f4f42bbcb2c84db64f582d917a1
> > 
> > That patch handles the first warning in my commit log but does not handle the
> > second one which is introduced since gcc v10.1.0 commit 6c80b1b56dec
> > ("Make more bad uses of fallthrough attribute into pedwarns.").
> > 
> 
> This is true.
> 
> Thomas, please apply this patch instead of mine. Also, consider adding
> the Fixes tag and CC stable due to the non-executable code error, and
> my Reviewed-by:
> 
> Fixes: c9b029903466 ("MIPS: Use fallthrough for arch/mips")
> Cc: stable@vger.kernel.org
> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

done.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

end of thread, other threads:[~2020-08-21 14:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20 12:54 [PATCH] mips/oprofile: Fix fallthrough placement zhe.he
2020-08-21  7:48 ` Thomas Bogendoerfer
2020-08-21  8:46   ` He Zhe
2020-08-21  9:23     ` Gustavo A. R. Silva
2020-08-21 14:07       ` Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).