Messages in this thread | | | Date | Wed, 16 Aug 2023 11:02:06 -0400 | From | Steven Rostedt <> | Subject | Re: [PATCH v3] tracepoint: add new `tcp:tcp_ca_event` trace event |
| |
On Wed, 16 Aug 2023 14:09:06 +0800 Manjusaka <me@manjusaka.me> wrote:
> > +# trace include files use a completely different grammar > > + next if ($realfile =~ m{(?:include/trace/events/|/trace\.h$/)}); > > + > > # check multi-line statement indentation matches previous line > > if ($perl_version_ok && > > $prevline =~ /^\+([ \t]*)((?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\s*=\s*$Ident\s*)\(.*(\&\&|\|\||,)\s*$/) { > > > > > > > > Actually, I'm not sure this is the checkpatch style issue or my code style issue. > > Seems wired.
The TRACE_EVENT() macro has its own style. I need to document it, and perhaps one day get checkpatch to understand it as well.
The TRACE_EVENT() typically looks like:
TRACE_EVENT(name,
TP_PROTO(int arg1, struct foo *arg2, struct bar *arg3),
TP_ARGS(arg1, arg2, arg3),
TP_STRUCT__entry( __field( int, field1 ) __array( char, mystring, MYSTRLEN ) __string( filename, arg3->name ) ),
TP_fast_assign( __entry->field1 = arg1; memcpy(__entry->mystring, arg2->string); __assign_str(filename, arg3->name); ),
TP_printk("field1=%d mystring=%s filename=%s", __entry->field1, __entry->mystring, __get_str(filename)) );
The TP_STRUCT__entry() should be considered more of a "struct" layout than a macro layout, and that's where checkpatch gets confused. The spacing makes it much easier to see the fields and their types.
-- Steve
| |