mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Checkpatch errors that should be downgraded
@ 2023-02-02 11:16 David Howells
  2023-02-02 17:03 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2023-02-02 11:16 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches; +Cc: dhowells, linux-kernel

In the trace headers, the following should probably be ignored:

	CHECK: Lines should not end with a '('
	#73: FILE: include/trace/events/rxrpc.h:1947:
	+	    TP_STRUCT__entry(

	CHECK: Lines should not end with a '('
	#80: FILE: include/trace/events/rxrpc.h:1954:
	+	    TP_fast_assign(

as it's standard practice to bump the contents onto the next line for these
two macros.

Also checkpatch is wrong in giving this error:

	ERROR: Macros with complex values should be enclosed in parentheses
	#37: FILE: include/trace/events/rxrpc.h:425:
	+#define rxrpc_sack_traces \
	+	EM(rxrpc_sack_advance,			"ADV")	\
	+	EM(rxrpc_sack_fill,			"FIL")	\
	+	EM(rxrpc_sack_nack,			"NAK")	\
	+	EM(rxrpc_sack_none,			"---")	\
	+	E_(rxrpc_sack_oos,			"OOS")

as the contents, when found in a trace header, are going to be used to
generate a string table and maybe an enum.  It's standard practice, so if it
could be ignored in trace headers or at least downgraded to a warning?

Thanks,
David


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

* Re: Checkpatch errors that should be downgraded
  2023-02-02 11:16 Checkpatch errors that should be downgraded David Howells
@ 2023-02-02 17:03 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2023-02-02 17:03 UTC (permalink / raw)
  To: David Howells, Andy Whitcroft; +Cc: linux-kernel

On Thu, 2023-02-02 at 11:16 +0000, David Howells wrote:
> In the trace headers, the following should probably be ignored:
> 
> 	CHECK: Lines should not end with a '('
> 	#73: FILE: include/trace/events/rxrpc.h:1947:
> 	+	    TP_STRUCT__entry(
> 
> 	CHECK: Lines should not end with a '('
> 	#80: FILE: include/trace/events/rxrpc.h:1954:
> 	+	    TP_fast_assign(
> 
> as it's standard practice to bump the contents onto the next line for these
> two macros.

trace has its own grammar.
Might as well ignore all of it.

> Also checkpatch is wrong in giving this error:
> 
> 	ERROR: Macros with complex values should be enclosed in parentheses
> 	#37: FILE: include/trace/events/rxrpc.h:425:
> 	+#define rxrpc_sack_traces \
> 	+	EM(rxrpc_sack_advance,			"ADV")	\
> 	+	EM(rxrpc_sack_fill,			"FIL")	\
> 	+	EM(rxrpc_sack_nack,			"NAK")	\
> 	+	EM(rxrpc_sack_none,			"---")	\
> 	+	E_(rxrpc_sack_oos,			"OOS")
> 
> as the contents, when found in a trace header, are going to be used to
> generate a string table and maybe an enum.  It's standard practice, so if it
> could be ignored in trace headers or at least downgraded to a warning?

Don't care.

There are lots of weird macros that don't fit the typical uses
like this not just for trace weirdness.

Maybe:

---

 scripts/checkpatch.pl | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a2fc7d5561267..126a8d4c07ce0 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3876,6 +3876,9 @@ sub process {
 			}
 		}
 
+# trace include files use a completely different grammar/style
+		next if ($realfile =~ m{/trace/.*\.h$} || $realfile =~ m{trace\.h$});
+
 # check for assignments on the start of a line
 		if ($sline =~ /^\+\s+($Assignment)[^=]/) {
 			my $operator = $1;


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

end of thread, other threads:[~2023-02-02 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-02 11:16 Checkpatch errors that should be downgraded David Howells
2023-02-02 17:03 ` Joe Perches

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®