qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
	Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Subject: Re: [Qemu-devel] [PULL 7/9] checkpatch: check trace-events code style
Date: Tue, 29 Aug 2017 15:34:42 -0600	[thread overview]
Message-ID: <20170829153442.1175f76d@w520.home> (raw)
In-Reply-To: <20170801131618.27332-8-stefanha@redhat.com>

On Tue,  1 Aug 2017 14:16:16 +0100
Stefan Hajnoczi <stefanha@redhat.com> wrote:

> From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> 
> According 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 <vsementsov@virtuozzo.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> Message-id: 20170731160135.12101-4-vsementsov@virtuozzo.com
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  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 =~ /(?<!0x)$hex/) {
> +					ERROR("Hex numbers must be prefixed with '0x'\n" .
> +					      $herecurr);
> +				}
> +			}
> +		}
> +
>  # check we are in a valid source file if not then ignore this hunk
>  		next if ($realfile !~ /\.(h|c|cpp|s|S|pl|py|sh)$/);
>  

This broke checkpatch.pl for me:

Bareword found where operator expected at ./scripts/checkpatch.pl line 1350, near "s/($hex[.:\/ ])+$hex//gr"
syntax error at ./scripts/checkpatch.pl line 1350, near "s/($hex[.:\/ ])+$hex//gr"
Execution of ./scripts/checkpatch.pl aborted due to compilation errors.

$ perl -v

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

  reply	other threads:[~2017-08-29 21:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01 13:16 [Qemu-devel] [PULL 0/9] Tracing patches Stefan Hajnoczi
2017-08-01 13:16 ` [Qemu-devel] [PULL 1/9] trace: ensure .stp files are rebuilt if trace tool source changes Stefan Hajnoczi
2017-08-01 13:16 ` [Qemu-devel] [PULL 2/9] trace: ensure unique function / variable names per .stp file Stefan Hajnoczi
2017-08-01 13:16 ` [Qemu-devel] [PULL 3/9] trace: add TRACE_<event>_BACKEND_DSTATE() Stefan Hajnoczi
2017-08-01 13:16 ` [Qemu-devel] [PULL 4/9] trace: add trace_event_get_state_backends() Stefan Hajnoczi
2017-08-01 13:16 ` [Qemu-devel] [PULL 5/9] coding_style: add point about 0x in trace-events Stefan Hajnoczi
2017-08-01 13:16 ` [Qemu-devel] [PULL 6/9] trace-events: fix code style: %# -> 0x% Stefan Hajnoczi
2017-08-01 13:16 ` [Qemu-devel] [PULL 7/9] checkpatch: check trace-events code style Stefan Hajnoczi
2017-08-29 21:34   ` Alex Williamson [this message]
2017-08-01 13:16 ` [Qemu-devel] [PULL 8/9] trace-events: fix code style: print 0x before hex numbers Stefan Hajnoczi
2017-08-01 13:16 ` [Qemu-devel] [PULL 9/9] monitor: Reduce handle_qmp_command() tracing overhead Stefan Hajnoczi
2017-08-01 13:41 ` [Qemu-devel] [PULL 0/9] Tracing patches no-reply
2017-08-01 14:31 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170829153442.1175f76d@w520.home \
    --to=alex.williamson@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).