aboutsummaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
AgeCommit message (Collapse)Author
2007-11-29update checkpatch.pl to version 0.12Andy Whitcroft
This version brings a new terse output mode as well as many improvements to the unary detection and bare type regcognition. It also brings the usual updates for false positives, though these seem to be slowing markedly now that the unary detector is no longer just putting its finger in the air and guessing. Of note: - new --terse mode producing a single line per report - loosening of the block brace checks - new checks for enum/union/struch brace placements - hugely expanded "bare type" detection - checks for inline usage - better handling of already open comment blocks - handle patches which introduce or remove lines without newlines Andy Whitcroft (19): Version: 0.12 style fixes as spotted by checkpatch add a --terse options of a single line of output per report block brace checks should only apply for single line blocks all new bare type detector check spacing for open braces with enum, union and struct check for LINUX_VERSION_CODE macros definition bracketing checks need to ignore -ve context clean up the mail-back mode, -q et al expand possible type matching to declarations allow const and sparse annotations on possible types handle possible types as regular types everywhere prefer plain inline over __inline__ and __inline all new open comment detection fix up conditional extraction for if assignment checks add const to the possible type matcher unary checks: a for loop is a conditional too possible types: detect function pointer definitions handle missind newlines at end of file, report addition Signed-off-by: Andy Whitcroft <apw@shadowen.org> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-18update checkpatch.pl to version 0.11Andy Whitcroft
This version brings a more cautious checkpatch.pl by default. The more subjective checks are only applied with the --strict option. It also brings the usual slew of corrections for false positives. Of note: - new tree detection, the source tree will be found via the executable - a major revamp of the unary detection to make it more parser like - a new summary at the bottom of the report - --strict option for subjective checks - --file to enable checking on complete files - support for use in emacs "compile" window Andy Whitcroft (27): Version: 0.11 fix up cat_vet for the case where there are no control characters any cast to a pointer introduces a type cpp unary operator detection needs to float attributes are also valid in type definitions sizeof may be a bareword and makes its argument unary unary checks for #ifdef et al need to find end of line add new --file mode to handle raw source files add --strict/--subjective which enables the subjective tests add some additional standard type suffixes cpp #elif is also a unary prefix case is not a function name widen asm volatile exceptions __kprobes is a type attribute typeof is a unary operator function open parenthesis checks should check all occurances expand sizeof() binary exceptions linux/irq.h should not be recommended work harder to find the kernel root and add --root= fix --emacs mode line numbers and string concatenation warnings add a summary to the bottom of the main report loosen assignment in if checks update operator spacing to maintain tabs in output revamp unary detection corruption/line wrapped patches need only reporting once revamp s/u/be/le 8/16/32/64 bit types handle missing ,1 in uni-diff header Mike D. Day (2): Adds support to checkpatch.pl for running in the emacs compile window. checkpatch: Fix line number reporting Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-17update checkpatch.pl to version 0.10Andy Whitcroft
This version brings a number of new checks, and a number of bug fixes. Of note: - better categorisation and space checks for dual use unary/binary operators - warn on deprecated use of {SPIN,RW}_LOCK_UNLOCKED - check if/for/while with trailing ';' for hanging statements - detect DOS line endings - detect redundant casts for kalloc() Andy Whitcroft (18): Version: 0.10 asmlinkage is also a storage type pull out inline specifiers allow only some operators before a unary operator parenthesised values may span line ends add additional attribute matching handle sparse annotations within pointer type space checks support alternative function definition syntax for typedefs check if/for/while with trailing ';' for hanging statements fix output format for case checks deprecate SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED allow complex macros with bracketing braces detect and report DOS line endings fastcall is a valid function attribute bracket spacing is ok for 'for' categorise operators into unary/binary/definitions add heuristic to pick up on unannotated types remove spurious warnings from cat_vet Dave Jones (1): Make checkpatch warn about pointless casting of kalloc returns. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-08-11update checkpatch.pl to version 0.09Andy Whitcroft
This version brings a number of new checks, and a number of bug fixes. Of note: - checks for spacing on round and square bracket combinations - loosening of the single statement brace checks, to allow them when they contain comments or where other blocks in a compound statement have them. - parks the multple declaration support - allows architecture defines in architecture specific headers Andy Whitcroft (21): Version: 0.09 loosen single statement brace checks fix up multiple declaration to avoid function arguments add some function space parenthesis check exceptions handle EXPORT_'s with parentheses in their names clean up some warnings in multi-line macro bracketing support park the multiple declaration checks make block brace checks count comments as a statement __volatile__ and __extension__ are not functions allow architecture specific defined within architecture includes check spacing on square brackets check spacing on parentheses ensure we apply checks to the part before start comment check #ifdef conditional spacing handle __init_refok and __must_check add noinline to inline checks prevent email addresses from tripping spacing checks handle typed initialiser spacing handle line contination as end of line add bool to the type matcher refine EXPORT_SYMBOL checks to handle pointers Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-19update checkpatch.pl to version 0.08Andy Whitcroft
This version brings a number of new checks, and a number of bug fixes. Of note: - warnings for multiple assignments per line - warnings for multiple declarations per line - checks for single statement blocks with braces This patch includes an update for feature-removal-schedule.txt to better target checks. Andy Whitcroft (12): Version: 0.08 only apply printk checks where there is a string literal allow suppression of errors for when no patch is found warn about multiple assignments warn on declaration of multiple variables check for kfree() with needless null check check for single statement braced blocks check for aggregate initialisation on the next line handle the => operator check for spaces between function name and open parenthesis move to explicit Check: entries in feature-removal-schedule.txt handle pointer attributes Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-16update checkpatch.pl to version 0.07Andy Whitcroft
This version brings a number of new checks, fixes for flase positives, plus a clarification of the output to better guide use. Of note: - checks for documentation for new __setup calls - clearer reporting where braces and parenthesis are involved - reports for closing brace and semi-colon spacing - reports on unwanted externs This patch includes an update to the documentation on checkpatch.pl itself to clarify when it should be used and to indicate that it is not intended as the final arbitor of style. Full changelog: Andy Whitcroft (19): Version: 0.07 ensure we do not apply control brace checks to preprocesor directives add {u,s}{8,16,32,64} to the type matcher accept lack of spacing after the semicolons in for (;;) report new externs in .c files fix up typedef exclusion for function prototypes else trailing statements check need to account for \ at end of line add enums to the type matcher add missing check descriptions suppress double reporting of ** spacing report on do{ spacing issues include an example of the brace/parenthesis in output check for spacing after closing braces prevent double reports on pointer spacing issues handle blank continuation lines on macros classify all reports error, warning, or check revamp hanging { checks and apply in context no spaces after the last ; in a for is ok check __setup has a corresponding addition to documentation David Woodhouse (1): limit character set used in patches and descriptions to UTF-8 Signed-off-by: Andy Whitcroft <apw@shadowen.org> Cc: David Woodhouse <dwmw2@infradead.org> Cc: "Randy.Dunlap" <rdunlap@xenotime.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-06-24update checkpatch.pl to version 0.06Andy Whitcroft
Update to checkpatch.pl v0.06. Of note: - do { and else handled correctly as control structures for { matching - trailing whitespace correctly tripped when line otherwise empty - support for const, including const foo * const bar - multiline macros defining values correctly reported This version of checkpatch.pl can be found at the following URL: http://www.kernel.org/pub/linux/kernel/people/apw/checkpatch/checkpatch.pl-0.06 Full Changelog: Andy Whitcroft (14): Version: 0.06 cleanup the Type regular expression declarations fix up block counting end of line counts as a space for ++ and -- do { needs the same checks as if, for et al handle "const foo * const a" as a valid type add spacing checks following ; complete whitespace lines should trip trailing whitespace check else is also a block control structure badly formatted else can trip function declaration detect and report trailing statements after else types need to be terminated by a boundary multiline macros defining values should be surrounded by parentheses soften the wording of the Signed-off-by: warnings Signed-off-by: Andy Whitcroft <apw@shadowen.org> Cc: "Randy.Dunlap" <rdunlap@xenotime.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-06-24update checkpatch.pl to version 0.05Andy Whitcroft
This version brings a some new tests, and a host of changes to fix false positives, of particular note: - detect 'var ++;' and 'var --;' as a bad combination - multistatement #defines are now checked based on statement count - multistatement #defines with initialisation correctly reported - checks the location of the inline keywords - EXPORT_SYMBOL for variables are now understood - typedefs are loosened to handle sparse etc This version of checkpatch.pl can be found at the following URL: http://www.shadowen.org/~apw/public/checkpatch/checkpatch.pl-0.05 Full Changelog: Andy Whitcroft (18): Version: 0.05 macro definition checks should be for a single statement avoid assignements only in if conditionals declarations of function pointers need no space multiline macros which are purely initialisation cannot be wrapped EXPORT_SYMBOL can also directly follow a variable definition check on the location of the inline keyword EXPORT_SYMBOL needs to allow for attributes ensure we do not find C99 // in strings handle malformed #include lines accept the {0,} form typedefs are sensible for defining function pointer parameters ensure { handling correctly handles nested switch() statements trailing whitespace checks are not anchored typedefs for sparse bitwise annotations make sense update the type matcher to include sparse annotations clean up indent and spacing Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-06-08update checkpatch.pl to version 0.04Andy Whitcroft
This version brings a some new tests, and a host of changes to fix false positives, of particular note: - check for and report #if 0 - extend checking of line lengths and spacing for .pl, .sh etc - extends the pointer type checks to multiple levels - updates printk handling to track newlines - adds a wrapped patch detector - drops the leading component of the filenames - extends switch indent handling to switch statmentes rooted in the context - adds foo * bar single pointer checks This version of checkpatch.pl can be found at the following URL: http://www.shadowen.org/~apw/public/checkpatch/checkpatch.pl-0.04 Full Changelog: Andy Whitcroft (16): allow checking line lengths and spacing on other source files clean up that whitespace sanitise the input line standardising the content of quotes clean up pointer type * and space checks fix up the sanitiser so it maintains the line length apply the printk facility checks only to the first printk in a set switch/case indent checks may anchor in the context add a wrapped patch detector put the #ifdef in C file checks on ice asm volatile is acceptable check for and report #if 0 drop the leading component of the filename as patches are -p1 use the original line when reporting operator errors correct spelling of Joel's name Version: 0.04 add support for struct foo * bar checks Geert Uytterhoeven (1): Fix checkpatch.pl name in usage template Randy Dunlap (1): checkpatch: produce fewer lines of output Signed-off-by: Andy Whitcroft <apw@shadowen.org> Cc: Randy Dunlap <rdunlap@xenotime.net> Cc: Joel Schopp <jschopp@austin.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-06-08checkpatch: produce fewer lines of outputRandy Dunlap
Produce one less line of output per flagged incident. Change this: use tabs not spaces PATCH: /home/rddunlap/arcmsr1200014.patch4:756: FILE: b/drivers/scsi/arcmsr/arcmsr_hba.c:1843: + return PCI_ERS_RESULT_NEED_RESET;$ to this: use tabs not spaces #756: FILE: b/drivers/scsi/arcmsr/arcmsr_hba.c:1843: + return PCI_ERS_RESULT_NEED_RESET;$ Cc: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-06-08update checkpatch.pl to version 0.03Andy Whitcroft
This version brings a host of changes to cure false positives and bugs detected on patches submitted to lkml and -mm. It also brings a number of new tests in response to reviews, of particular note: - catch use of volatile - allow deprecated functions to be listed in feature-removal-schedule.txt - warn about #ifdef's in c files - check that spinlock_t and struct mutex use is commented - report on architecture specific defines being used - report memory barriers without an associated comment Full changelog: catch use of volatile convert other quoted string checks to common routine alloc deprecated functions to be listed in feature-removal-schedule.txt split out the line length and indent for each line improve switch block handling handle GNU diff context lines with no leading space warn about #ifdef's in c files tidy up tests for signed-off-by using raw mode check that spinlock_t and struct mutex use is commented syntax checks for open brace placement may drop off the bottom of hunk report memory barriers without an associated comment when a sign off is present but ugly do not report it missing do not mistake bitfield definitions for indented labels report on architecture specific defines being used major update to the operator checks prevent switch/if/while etc matching foo_switch generify assignement in condition error message introduce an operator context marker Version: 0.03 Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-06-07checkpatch.pl: should be executableAndy Whitcroft
scripts/checkpatch.pl should be executable, make it so. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Acked-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Joel Schopp <jschopp@austin.ibm.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-06-01add a trivial patch style checkerAndy Whitcroft
We are seeing increasing levels of minor patch style violations in submissions to the mailing lists as well as making it into the tree. These detract from the quality of the submission and cause unnessary work for reviewers. As a first step package up the current state of the patch style checker and include it in the kernel tree. Add instructions suggesting running it on submissions. This adds version v0.01 of the checkpatch.pl script. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Joel Schopp <jschopp@austin.ibm.com> Cc: Randy Dunlap <rdunlap@xenotime.net> Cc: Dave Jones <davej@codemonkey.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>