mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* checkpatch hangs, memset failures, and minimum versions
@ 2012-02-29 19:41 Joe Perches
  0 siblings, 0 replies; only message in thread
From: Joe Perches @ 2012-02-29 19:41 UTC (permalink / raw)
  To: Andy Whitcroft; +Cc: Andrew Morton, LKML

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?


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-02-29 19:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-29 19:41 checkpatch hangs, memset failures, and minimum versions Joe Perches

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®