Re: [Qemu-devel] [PATCH v2 3/4] checkpatch: check trace-events code style
On 07/31/2017 04:26 AM, Stefan Hajnoczi wrote: > On Sat, Jul 29, 2017 at 04:11:58PM +0300, Vladimir Sementsov-Ogievskiy wrote: >> Accordingly to CODING_STYLE, check that in trace-events: s/Accordingly/According/ >> 1. hex numbers are prefixed with '0x' >> 2. '#' flag of printf is not used >> 3. The exclusion from 1. are period-separated groups of numbers >> >> Signed-off-by: Vladimir Sementsov-Ogievskiy>> --- >> scripts/checkpatch.pl | 19 +++ >> 1 file changed, 19 insertions(+) > > Reviewed-by: Stefan Hajnoczi > -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org signature.asc Description: OpenPGP digital signature
Re: [Qemu-devel] [PATCH v2 3/4] checkpatch: check trace-events code style
On Sat, Jul 29, 2017 at 04:11:58PM +0300, Vladimir Sementsov-Ogievskiy wrote: > Accordingly to CODING_STYLE, check that in trace-events: > 1. hex numbers are prefixed with '0x' > 2. '#' flag of printf is not used > 3. The exclusion from 1. are period-separated groups of numbers > > Signed-off-by: Vladimir Sementsov-Ogievskiy> --- > scripts/checkpatch.pl | 19 +++ > 1 file changed, 19 insertions(+) Reviewed-by: Stefan Hajnoczi signature.asc Description: PGP signature
[Qemu-devel] [PATCH v2 3/4] checkpatch: check trace-events code style
Accordingly to CODING_STYLE, check that in trace-events: 1. hex numbers are prefixed with '0x' 2. '#' flag of printf is not used 3. The exclusion from 1. are period-separated groups of numbers Signed-off-by: Vladimir Sementsov-Ogievskiy--- scripts/checkpatch.pl | 19 +++ 1 file changed, 19 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 4e91122813..fa478074b8 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1337,6 +1337,25 @@ sub process { $rpt_cleaners = 1; } +# checks for trace-events files + if ($realfile =~ /trace-events$/ && $line =~ /^\+/) { + if ($rawline =~ /%[-+ 0]*#/) { + ERROR("Don't use '#' flag of printf format ('%#') in " . + "trace-events, use '0x' prefix instead\n" . $herecurr); + } else { + my $hex = + qr/%[-+ *.0-9]*([hljztL]|ll|hh)?(x|X|"\s*PRI[xX][^"]*"?)/; + + # don't consider groups splitted by [.:/ ], like 2A.20:12ab + my $tmpline = $rawline =~ s/($hex[.:\/ ])+$hex//gr; + + if ($tmpline =~ /(?