[libvirt] [PATCH 2/2] Add syntax-check rule to look for 'function (...args...)' violations
Martin Kletzander
mkletzan at redhat.com
Wed Oct 17 10:29:57 UTC 2012
On 10/17/2012 11:31 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
>
> Checking for 'function (...args...)' is quite difficult since it
> needs to ignore valid usage with keywords like 'if (...test...)'
> and while/for/switch. It must also ignore source comments and
> quoted strings.
>
> It is not possible todo this with a simple regex in the normal
> syntax-check style. So a short Perl script is created instead
> to analyse the source. In practice this works well enough. The
> only thing it can't cope with is multi-line quoted strings of
> the form
>
> "start of string\
> more lines\
> more line\
> the end"
>
> but this can and should be written as
>
> "start of string"
> "more lines"
> "more line"
> "the end"
>
> with this simple change, the bracket checking script does not
> have any false positives across libvirt source, provided it
Unfortunately there's a false negative, see my comment to other patch.
> is only run against .c files.
Why not .h files?
> ---
> build-aux/bracket-spacing.pl | 75 ++++++++++++++++++++++++++++++++++++++++++++
> cfg.mk | 7 ++++-
> 2 files changed, 81 insertions(+), 1 deletion(-)
> create mode 100755 build-aux/bracket-spacing.pl
>
Sorry, I really don't feel competent enough to review the perl part,
since the last perl line I wrote was more than 5 years ago.
Martin
More information about the libvir-list
mailing list