Skip to contentSkip to conversation

devtools: ignore PREFER_FALLTHROUGH

PATCH In review Adrian Moreno 4 participants 7 messages Aug 4, 2020 – Aug 7, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtools: ignore PREFER_FALLTHROUGH

The PREFER_FALLTHROUGH check warns if a passthrough comment is found because, in the kernel, the special macro "fallthrough" is prefered.

Since that keyword is not defined in DPDK, ignore the warning.

Ignoring this check does not affect the MISSING_BREAK check that will warn if a switch case/default is not preceded by break or a fallthrough comment.

---
 devtools/checkpatches.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
devtools/checkpatches.sh +1 -1
index acf921ae0..4283ca82b 100755
@@ -33,7 +33,7 @@ VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
 PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
 SPLIT_STRING,LONG_LINE_STRING,C99_COMMENT_TOLERANCE,\
 LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
-NEW_TYPEDEFS,COMPARISON_TO_NULL"
+NEW_TYPEDEFS,COMPARISON_TO_NULL,PREFER_FALLTHROUGH"
 options="$options $DPDK_CHECKPATCH_OPTIONS"
 
 print_usage () {
Signature · 1 line
2.26.2
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Adrian Moreno

The PREFER_FALLTHROUGH check warns if a passthrough comment is found because, in the kernel, the special macro "fallthrough" is prefered.

Since that keyword is not defined in DPDK, ignore the warning.

Ignoring this check does not affect the MISSING_BREAK check that will warn if a switch case/default is not preceded by break or a fallthrough comment.

Acked-by on v1 1/1
#2 lore raw
In reply to Adrian Moreno
Quoted 39 lines

-----Original Message-----
From: Adrian Moreno <[email protected]>
Sent: Tuesday, August 4, 2020 3:39 PM
To: [email protected]
Cc: [email protected]; Xia, Chenbo <[email protected]>; [email protected]; Adrian Moreno <[email protected]>
Subject: [PATCH] devtools: ignore PREFER_FALLTHROUGH

The PREFER_FALLTHROUGH check warns if a passthrough comment is found because, in the kernel, the special macro "fallthrough" is prefered.

Since that keyword is not defined in DPDK, ignore the warning.

Ignoring this check does not affect the MISSING_BREAK check that will warn if a switch case/default is not preceded by break or a fallthrough comment.

---
 devtools/checkpatches.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
devtools/checkpatches.sh index renamed from devtools/checkpatches.sh +0 -0

acf921ae0..4283ca82b 100755

devtools/checkpatches.sh +0 -0
@@ -33,7 +33,7 @@
 VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
 PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
 SPLIT_STRING,LONG_LINE_STRING,C99_COMMENT_TOLERANCE,\
 

LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_ STYLE,\

devtools/checkpatches.sh +1 -2
-NEW_TYPEDEFS,COMPARISON_TO_NULL"
+NEW_TYPEDEFS,COMPARISON_TO_NULL,PREFER_FALLTHROUGH"
 options="$options $DPDK_CHECKPATCH_OPTIONS"
 
 print_usage () {
--
Quoted 1 line

2.26.2

#3 lore raw
In reply to Adrian Moreno

04/08/2020 09:38, Adrian Moreno:

Quoted 4 lines

The PREFER_FALLTHROUGH check warns if a passthrough comment is found because, in the kernel, the special macro "fallthrough" is prefered.

Since that keyword is not defined in DPDK, ignore the warning.

We could ask why not defining a similar keyword?

Quoted 15 lines

Ignoring this check does not affect the MISSING_BREAK check that will warn if a switch case/default is not preceded by break or a fallthrough comment.

---
 devtools/checkpatches.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
devtools/checkpatches.sh +0 -0
index acf921ae0..4283ca82b 100755

devtools/checkpatches.sh VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\ · line 36

Quoted 5 lines
devtools/checkpatches.sh +1 -1
@@ -33,7 +33,7 @@ VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
 PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
 SPLIT_STRING,LONG_LINE_STRING,C99_COMMENT_TOLERANCE,\
 LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
-NEW_TYPEDEFS,COMPARISON_TO_NULL"
+NEW_TYPEDEFS,COMPARISON_TO_NULL,PREFER_FALLTHROUGH"

I would add this option between PREFER_KERNEL_TYPES and BIT_MACRO to maintain a bit of logic ordering.

#4 lore raw

Hi Thomas,

Quoted 8 lines · Thomas Monjalon

04/08/2020 09:38, Adrian Moreno:

Quoted 4 lines

The PREFER_FALLTHROUGH check warns if a passthrough comment is found because, in the kernel, the special macro "fallthrough" is prefered.

Since that keyword is not defined in DPDK, ignore the warning.

We could ask why not defining a similar keyword?

Surely, we can also add the keyword. Given that unintended fallthrough is already protected by the "MISSING_BREAK" and that fallthrough comments are already used in DPDK, I thought it made sense to ignore the check.

If you prefer to add the keyword, let me ask:
- Where is the right place for it? Maybe rte_common.h?
- Should all the comments be replaced with the pseudo-keyword?

Quoted 10 lines
Quoted 10 lines

Ignoring this check does not affect the MISSING_BREAK check that will warn if a switch case/default is not preceded by break or a fallthrough comment.

---
 devtools/checkpatches.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

devtools/checkpatches.sh VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\ · line 36

Quoted 10 lines
devtools/checkpatches.sh +1 -1
index acf921ae0..4283ca82b 100755
@@ -33,7 +33,7 @@ VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
 PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
 SPLIT_STRING,LONG_LINE_STRING,C99_COMMENT_TOLERANCE,\
 LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
-NEW_TYPEDEFS,COMPARISON_TO_NULL"
+NEW_TYPEDEFS,COMPARISON_TO_NULL,PREFER_FALLTHROUGH"

I would add this option between PREFER_KERNEL_TYPES and BIT_MACRO to maintain a bit of logic ordering.

OK. I'll reorder it if the final decision is to ignore the check.

Thanks

Signature · 1 line
Adrián Moreno
#5 lore raw

05/08/2020 15:34, Adrian Moreno:

Quoted 7 lines

Hi Thomas,

Quoted 4 lines · Thomas Monjalon

04/08/2020 09:38, Adrian Moreno:

Quoted 3 lines

The PREFER_FALLTHROUGH check warns if a passthrough comment is found because, in the kernel, the special macro "fallthrough" is prefered.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Since that keyword is not defined in DPDK, ignore the warning.

We could ask why not defining a similar keyword?

Surely, we can also add the keyword. Given that unintended fallthrough is already protected by the "MISSING_BREAK" and that fallthrough comments are already used in DPDK, I thought it made sense to ignore the check.

Yes this patch makes sense.
And anyway, we'll never use the same keyword as in kernel.

Quoted 2 lines

If you prefer to add the keyword, let me ask:
- Where is the right place for it? Maybe rte_common.h?

Yes

Quoted 1 line

- Should all the comments be replaced with the pseudo-keyword?

Yes

Before doing that, please send a RFC.
I remember we already tried that but failed.

Quoted 12 lines
Quoted 12 lines

devtools/checkpatches.sh VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\ · line 36

Quoted 8 lines
devtools/checkpatches.sh +1 -1
@@ -33,7 +33,7 @@ VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
 PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
 SPLIT_STRING,LONG_LINE_STRING,C99_COMMENT_TOLERANCE,\
 LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
-NEW_TYPEDEFS,COMPARISON_TO_NULL"
+NEW_TYPEDEFS,COMPARISON_TO_NULL,PREFER_FALLTHROUGH"

I would add this option between PREFER_KERNEL_TYPES and BIT_MACRO to maintain a bit of logic ordering.

Quoted 1 line

OK. I'll reorder it if the final decision is to ignore the check.

Yes thanks

#6 lore raw

05/08/2020 15:54, Thomas Monjalon:

Quoted 15 lines

05/08/2020 15:34, Adrian Moreno:

Quoted 14 lines · Thomas Monjalon
Quoted 13 lines

04/08/2020 09:38, Adrian Moreno:

devtools/checkpatches.sh VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\ · line 36

Quoted 8 lines
devtools/checkpatches.sh +1 -1
@@ -33,7 +33,7 @@ VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
 PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
 SPLIT_STRING,LONG_LINE_STRING,C99_COMMENT_TOLERANCE,\
 LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
-NEW_TYPEDEFS,COMPARISON_TO_NULL"
+NEW_TYPEDEFS,COMPARISON_TO_NULL,PREFER_FALLTHROUGH"

I would add this option between PREFER_KERNEL_TYPES and BIT_MACRO to maintain a bit of logic ordering.

Quoted 3 lines
Quoted 1 line

OK. I'll reorder it if the final decision is to ignore the check.

Yes thanks

Applied with above change.