The patch titled checkpatch: simplify and consolidate "missing space after" checks has been added to the -mm tree. Its filename is checkpatch-simplify-and-consolidate-missing-space-after-checks.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/ ------------------------------------------------------ Subject: checkpatch: simplify and consolidate "missing space after" checks From: Andy Whitcroft <apw@xxxxxxxxxxxxx> Commonise the code for missing spaces after struct, union, and enum such that they share the same code. Ensure we cover all the common cases in each case. Check against the sanitised line to ensure we do not report on comments and strings. Signed-off-by: Andy Whitcroft <apw@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- scripts/checkpatch.pl | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff -puN scripts/checkpatch.pl~checkpatch-simplify-and-consolidate-missing-space-after-checks scripts/checkpatch.pl --- a/scripts/checkpatch.pl~checkpatch-simplify-and-consolidate-missing-space-after-checks +++ a/scripts/checkpatch.pl @@ -1905,22 +1905,17 @@ sub process { ERROR("open brace '{' following function declarations go on the next line\n" . $herecurr); } -# missing space after union or struct definition - if ($rawline =~ /^\+\s*(union|struct)\s+$Ident[=\{]/) { - WARN("Missing space after struct or union definition\n" . $herecurr); - } - -# missing space after enum definition - if ($rawline =~ /^\+\s*enum\{/) { - WARN("Missing space after enum definition\n" . $herecurr); - } - # open braces for enum, union and struct go on the same line. if ($line =~ /^.\s*{/ && $prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) { ERROR("open brace '{' following $1 go on the same line\n" . $hereprev); } +# missing space after union, struct or enum definition + if ($line =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?(?:\s+$Ident)?[=\{]/) { + WARN("missing space after $1 definition\n" . $herecurr); + } + # check for spacing round square brackets; allowed: # 1. with a type on the left -- int [] a; # 2. at the beginning of a line for slice initialisers -- [0...10] = 5, _ Patches currently in -mm which might be from apw@xxxxxxxxxxxxx are checkpatch-fix-regressions-in-fix-handling-of-leading-spaces.patch checkpatch-types-may-sit-on-a-line-on-their-own.patch checkpatch-suggest-cleanpatch-and-cleanfile-when-appropriate.patch checkpatch-ensure-we-do-not-collapse-bracketed-sections-into-constants.patch checkpatch-handle-casts-better-fixing-false-categorisation-of-as-binary.patch checkpatch-returning-errno-typically-should-be-negative.patch checkpatch-add-check-for-space-after-struct-union-and-enum.patch checkpatch-simplify-and-consolidate-missing-space-after-checks.patch checkpatch-ensure-kconfig-help-checks-only-apply-when-we-are-adding-help.patch checkpatch-check-for-incorrect-permissions.patch checkpatch-add-additional-attribute-defines.patch checkpatch-update-copyright-dates.patch checkpatch-clean-up-structure-definition-macro-handline.patch checkpatch-handle-export_symbol-for-device_attr-and-similar.patch checkpatch-statement-block-context-analyser-should-look-at-sanitised-lines.patch checkpatch-version-031.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