The patch titled Subject: checkpatch: catch all occurances of type and cast spacing errors per line has been added to the -mm tree. Its filename is checkpatch-catch-all-occurances-of-type-and-cast-spacing-errors-per-line.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ From: Andy Whitcroft <apw@xxxxxxxxxxxxx> Subject: checkpatch: catch all occurances of type and cast spacing errors per line Fix up type and cast spacing checks such that all occurances on a line are examined and reported. For example the line below has a valid cast and a bad type, but currently we check the cast first which is good and stop: u16* bar = (u16 *)baz; We will also only report one of the errors in this example: u16* bar = (u16*)bad; Move to iterating across all casts and all types, reporting any failure. Signed-off-by: Andy Whitcroft <apw@xxxxxxxxxxxxx> Cc: Joe Perches <joe@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- scripts/checkpatch.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff -puN scripts/checkpatch.pl~checkpatch-catch-all-occurances-of-type-and-cast-spacing-errors-per-line scripts/checkpatch.pl --- a/scripts/checkpatch.pl~checkpatch-catch-all-occurances-of-type-and-cast-spacing-errors-per-line +++ a/scripts/checkpatch.pl @@ -2209,8 +2209,9 @@ sub process { # * goes on variable not on type # (char*[ const]) - if ($line =~ m{\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\)}) { - my ($from, $to) = ($1, $1); + while ($line =~ m{(\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\))}g) { + #print "AA<$1>\n"; + my ($from, $to) = ($2, $2); # Should start with a space. $to =~ s/^(\S)/ $1/; @@ -2225,8 +2226,10 @@ sub process { ERROR("POINTER_LOCATION", "\"(foo$from)\" should be \"(foo$to)\"\n" . $herecurr); } - } elsif ($line =~ m{\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident)}) { - my ($from, $to, $ident) = ($1, $1, $2); + } + while ($line =~ m{(\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident))}g) { + #print "BB<$1>\n"; + my ($from, $to, $ident) = ($2, $2, $3); # Should start with a space. $to =~ s/^(\S)/ $1/; _ Subject: Subject: checkpatch: catch all occurances of type and cast spacing errors per line Patches currently in -mm which might be from apw@xxxxxxxxxxxxx are origin.patch checkpatch-correctly-track-the-end-of-preprocessor-commands-in-context.patch checkpatch-correctly-track-the-end-of-preprocessor-commands-in-context-fix.patch checkpatch-check-for-common-memset-parameter-issues-against-statments.patch checkpatch-improve-memset-and-min-max-with-cast-checking.patch checkpatch-improve-memset-and-min-max-with-cast-checking-fix.patch checkpatch-is-not-a-valid-modifier.patch checkpatch-optimise-statement-scanner-when-mid-statement.patch checkpatch-only-apply-kconfig-help-checks-for-options-which-prompt.patch checkpatch-fix-export_symbol-handling-following-a-function.patch checkpatch-complex-macro-should-allow-the-empty-do-while-loop.patch checkpatch-fix-return-is-not-a-function-square-bracket-handling.patch checkpatch-fix-complex-macros-handling-of-square-brackets.patch checkpatch-ensure-cast-type-is-unique-in-the-context-parser.patch checkpatch-typeof-may-have-more-complex-arguments.patch checkpatch-catch-all-occurances-of-type-and-cast-spacing-errors-per-line.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html