mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 00:31:32 +00:00
Merge pull request #9677 from ton31337/fix/zlog_newline_not_needed
tools: Add coccinelle script to catch \n or \r at the end of zlog_*
This commit is contained in:
commit
8e55e2c87b
20
tools/coccinelle/zlog_no_newline.cocci
Normal file
20
tools/coccinelle/zlog_no_newline.cocci
Normal file
@ -0,0 +1,20 @@
|
||||
// zlog_* should not have \n or \r at the end usually.
|
||||
// spatch --sp-file tools/coccinelle/zlog_no_newline.cocci --macro-file tools/cocci.h ./ 2>/dev/null
|
||||
|
||||
@r@
|
||||
expression fmt;
|
||||
identifier func =~ "zlog_";
|
||||
position p;
|
||||
@@
|
||||
(
|
||||
func(fmt)@p
|
||||
|
|
||||
func(fmt, ...)@p
|
||||
)
|
||||
|
||||
@script:python@
|
||||
fmt << r.fmt;
|
||||
p << r.p;
|
||||
@@
|
||||
if "\\n" in str(fmt) or "\\r" in str(fmt):
|
||||
print("Newline in logging function detected %s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt))
|
Loading…
Reference in New Issue
Block a user