diff mbox series

checkpatch: really skip LONG_LINE_* when LONG_LINE is ignored

Message ID 20240610114554.82496-2-wsa+renesas@sang-engineering.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series checkpatch: really skip LONG_LINE_* when LONG_LINE is ignored | expand

Commit Message

Wolfram Sang June 10, 2024, 11:45 a.m. UTC
For this to happen, all types must be set to "show". So, AND is needed
for the flags, not OR.

Fixes: 47e0c88b37a5 ("checkpatch: categorize some long line length checks")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Geert Uytterhoeven June 10, 2024, 12:03 p.m. UTC | #1
Hi Wolfram,

On Mon, Jun 10, 2024 at 1:46 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> For this to happen, all types must be set to "show". So, AND is needed
> for the flags, not OR.
>
> Fixes: 47e0c88b37a5 ("checkpatch: categorize some long line length checks")
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thanks for your patch!

> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3858,7 +3858,7 @@ sub process {
>                         }
>
>                         if ($msg_type ne "" &&
> -                           (show_type("LONG_LINE") || show_type($msg_type))) {
> +                           (show_type("LONG_LINE") && show_type($msg_type))) {

I don't know if the change in logic is correct, but if it is, you
probably want to remove one set of parentheses:
A && (B && C) => A && B && C

>                                 my $msg_level = \&WARN;
>                                 $msg_level = \&CHK if ($file);
>                                 &{$msg_level}($msg_type,

Gr{oetje,eeting}s,

                        Geert
Wolfram Sang June 10, 2024, 2:59 p.m. UTC | #2
> I don't know if the change in logic is correct, but if it is, you
> probably want to remove one set of parentheses:
> A && (B && C) => A && B && C

Oh, true, thanks!
diff mbox series

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2b812210b412..f81c046a22a1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3858,7 +3858,7 @@  sub process {
 			}
 
 			if ($msg_type ne "" &&
-			    (show_type("LONG_LINE") || show_type($msg_type))) {
+			    (show_type("LONG_LINE") && show_type($msg_type))) {
 				my $msg_level = \&WARN;
 				$msg_level = \&CHK if ($file);
 				&{$msg_level}($msg_type,