mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andy Whitcroft <apw@shadowen.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: checkpatch hangs, memset failures, and minimum versions
Date: Wed, 29 Feb 2012 11:41:53 -0800	[thread overview]
Message-ID: <1330544513.22235.6.camel@joe2Laptop> (raw)

Hey Andy.

There's a problem with the memset tests that cause
the checkpatch script to fail oddly.

This test:

# Check for misused memsets
		if (defined $stat &&
		    $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/s) {

can sometimes never advance and can just consume cpu
so that the script hangs.

It works properly if $FuncArg (actually $LvalOrFunc)
is changed from

our $balanced_parens = qr/(\((?:[^\(\)]++|(?-1))*\))/;
our $lval_parens = qr/(\((?:[^\(\)]+|(-1))*\))/;

our $Typecast	= qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*};
our $LvalOrFunc	= qr{($Lval)\s*($lval_parens{0,1})\s*};
our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant)};

to

our $LvalOrFunc	= qr{($Lval)\s*($balanced_parens{0,1})\s*};

the balanced_parens use requires perl 5.10

This change can also help fix a problem with a --strict check
to calculate the correct position for a continuation line that
should align on an open parenthesis.  That test does require
an additional change though.

Suggestions?


                 reply	other threads:[~2012-02-29 19:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1330544513.22235.6.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@shadowen.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®