* checkpatch.pl: Use of uninitialized value $str in split at ./scripts/checkpatch.pl line 1079.
@ 2016-09-08 6:23 Charlemagne Lasse
2016-09-08 18:38 ` Joe Perches
2016-09-08 20:20 ` [PATCH] checkpatch: Improve the block comment * alignment test Joe Perches
0 siblings, 2 replies; 3+ messages in thread
From: Charlemagne Lasse @ 2016-09-08 6:23 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: Andy Whitcroft, Joe Perches, linux-kernel
Hi,
I've noticed that checkpatch prints an error in linux-next. This can
be reproduced via
./scripts/checkpatch.pl --strict --file net/batman-adv/bat_iv_ogm.c
This problem seems to be introduced by d369873d2f53 ("Merge branch
'akpm-current/current'") which is a merge of 6a6594aace5c ("Merge
remote-tracking branch 'nvdimm/libnvdimm-for-next'") and cdaa6aa1e90c
("kexec_file fixup"). But please check this because I am new to
git-bisect
Greetings
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: checkpatch.pl: Use of uninitialized value $str in split at ./scripts/checkpatch.pl line 1079.
2016-09-08 6:23 checkpatch.pl: Use of uninitialized value $str in split at ./scripts/checkpatch.pl line 1079 Charlemagne Lasse
@ 2016-09-08 18:38 ` Joe Perches
2016-09-08 20:20 ` [PATCH] checkpatch: Improve the block comment * alignment test Joe Perches
1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2016-09-08 18:38 UTC (permalink / raw)
To: Charlemagne Lasse, Stephen Rothwell; +Cc: Andy Whitcroft, linux-kernel
On Thu, 2016-09-08 at 08:23 +0200, Charlemagne Lasse wrote:
> I've noticed that checkpatch prints an error in linux-next. This can
> be reproduced via
> ./scripts/checkpatch.pl --strict --file net/batman-adv/bat_iv_ogm.c
> This problem seems to be introduced by d369873d2f53 ("Merge branch
> 'akpm-current/current'") which is a merge of 6a6594aace5c ("Merge
> remote-tracking branch 'nvdimm/libnvdimm-for-next'") and cdaa6aa1e90c
> ("kexec_file fixup"). But please check this because I am new to
> git-bisect
Thanks, I'll fix it.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] checkpatch: Improve the block comment * alignment test
2016-09-08 6:23 checkpatch.pl: Use of uninitialized value $str in split at ./scripts/checkpatch.pl line 1079 Charlemagne Lasse
2016-09-08 18:38 ` Joe Perches
@ 2016-09-08 20:20 ` Joe Perches
1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2016-09-08 20:20 UTC (permalink / raw)
To: Andrew Morton, Andy Whitcroft; +Cc: Charlemagne Lasse, linux-kernel
An "uninitialized value" is emitted when a block comment starts on
the same line as a statement.
Fix this and make the test use a little fewer cpu cycles too.
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Charlemagne Lasse <charlemagnelasse@gmail.com>
---
scripts/checkpatch.pl | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4ecb66c..d7cee13 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3005,18 +3005,23 @@ sub process {
# Block comment * alignment
if ($prevline =~ /$;[ \t]*$/ && #ends in comment
- (($prevrawline =~ /^\+.*?\/\*/ && #starting /*
+ $line =~ /^\+[ \t]*$;/ && #leading comment
+ $rawline =~ /^\+[ \t]*\*/ && #leading *
+ (($prevrawline =~ /^\+.*?\/\*/ && #leading /*
$prevrawline !~ /\*\/[ \t]*$/) || #no trailing */
- $prevrawline =~ /^\+[ \t]*\*/) && #starting *
- $rawline =~ /^\+[ \t]*\*/) { #rawline *
+ $prevrawline =~ /^\+[ \t]*\*/)) { #leading *
+ my $oldindent;
$prevrawline =~ m@^\+([ \t]*/?)\*@;
- my $oldindent = expand_tabs($1);
+ if (defined($1)) {
+ $oldindent = expand_tabs($1);
+ } else {
+ $prevrawline =~ m@^\+(.*/?)\*@;
+ $oldindent = expand_tabs($1);
+ }
$rawline =~ m@^\+([ \t]*)\*@;
my $newindent = $1;
- my $test_comment = '^\\+' . "$;" x (length($newindent) + 1);
$newindent = expand_tabs($newindent);
- if ($line =~ /$test_comment/ &&
- length($oldindent) ne length($newindent)) {
+ if (length($oldindent) ne length($newindent)) {
WARN("BLOCK_COMMENT_STYLE",
"Block comments should align the * on each line\n" . $hereprev);
}
--
2.10.0.rc2.1.g053435c
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-08 20:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-08 6:23 checkpatch.pl: Use of uninitialized value $str in split at ./scripts/checkpatch.pl line 1079 Charlemagne Lasse
2016-09-08 18:38 ` Joe Perches
2016-09-08 20:20 ` [PATCH] checkpatch: Improve the block comment * alignment test Joe Perches
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).