diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-11 21:32:29 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-11 21:32:29 -0400 |
| commit | cbd8aca472134e666eee87462177f1be854ebbf8 (patch) | |
| tree | fbe0dd2ffbd14eeb1b8ec5dbb39fe52b0cbb76e5 /scripts | |
| parent | 35e9a274fdc9c8feb763e4970a32d7089f51393c (diff) | |
| parent | 26de9c26bf8557584c1977da92f3ed1b752291cf (diff) | |
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild misc changes from Michal Marek:
"In the non-critical part of kbuild, I have
- Some make coccicheck improvements and two new tests
- Support for a cleaner html output in scripts/kernel-doc, named
html5 (no, it does not play videos, yet)
BTW, Randy wants to route further kernel-doc patches through the
kbuild tree."
* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
Update SmPL/Coccinelle section of MAINTAINERS
coccicheck: Add the rep+ctxt mode
scripts/coccinelle/tests/odd_ptr_err.cocci: semantic patch for IS_ERR/PTR_ERR inconsistency
scripts/tags.sh: Add magic for pci access functions
scripts/coccinelle: ptr_ret: Add ternary operator version
scripts/kernel-doc: drop maintainer
scripts/kernel-doc: added support for html5
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/coccicheck | 3 | ||||
| -rw-r--r-- | scripts/coccinelle/api/ptr_ret.cocci | 26 | ||||
| -rw-r--r-- | scripts/coccinelle/tests/odd_ptr_err.cocci | 65 | ||||
| -rwxr-xr-x | scripts/kernel-doc | 273 | ||||
| -rwxr-xr-x | scripts/tags.sh | 8 |
5 files changed, 366 insertions, 9 deletions
diff --git a/scripts/coccicheck b/scripts/coccicheck index 823e972149e5..1a49d1c7ecfe 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck | |||
| @@ -95,6 +95,9 @@ coccinelle () { | |||
| 95 | $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \ | 95 | $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \ |
| 96 | $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ | 96 | $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ |
| 97 | $SPATCH -D org $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1 | 97 | $SPATCH -D org $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1 |
| 98 | elif [ "$MODE" = "rep+ctxt" ] ; then | ||
| 99 | $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff && \ | ||
| 100 | $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 | ||
| 98 | else | 101 | else |
| 99 | $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 | 102 | $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 |
| 100 | fi | 103 | fi |
diff --git a/scripts/coccinelle/api/ptr_ret.cocci b/scripts/coccinelle/api/ptr_ret.cocci index cbfd08c7d8c7..15f076fdecbe 100644 --- a/scripts/coccinelle/api/ptr_ret.cocci +++ b/scripts/coccinelle/api/ptr_ret.cocci | |||
| @@ -30,6 +30,13 @@ expression ptr; | |||
| 30 | - if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; | 30 | - if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; |
| 31 | + return PTR_RET(ptr); | 31 | + return PTR_RET(ptr); |
| 32 | 32 | ||
| 33 | @depends on patch@ | ||
| 34 | expression ptr; | ||
| 35 | @@ | ||
| 36 | |||
| 37 | - (IS_ERR(ptr) ? PTR_ERR(ptr) : 0) | ||
| 38 | + PTR_RET(ptr) | ||
| 39 | |||
| 33 | @r1 depends on !patch@ | 40 | @r1 depends on !patch@ |
| 34 | expression ptr; | 41 | expression ptr; |
| 35 | position p1; | 42 | position p1; |
| @@ -44,6 +51,13 @@ position p2; | |||
| 44 | 51 | ||
| 45 | * if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; | 52 | * if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; |
| 46 | 53 | ||
| 54 | @r3 depends on !patch@ | ||
| 55 | expression ptr; | ||
| 56 | position p3; | ||
| 57 | @@ | ||
| 58 | |||
| 59 | * IS_ERR@p3(ptr) ? PTR_ERR(ptr) : 0 | ||
| 60 | |||
| 47 | @script:python depends on org@ | 61 | @script:python depends on org@ |
| 48 | p << r1.p1; | 62 | p << r1.p1; |
| 49 | @@ | 63 | @@ |
| @@ -57,6 +71,12 @@ p << r2.p2; | |||
| 57 | 71 | ||
| 58 | coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") | 72 | coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") |
| 59 | 73 | ||
| 74 | @script:python depends on org@ | ||
| 75 | p << r3.p3; | ||
| 76 | @@ | ||
| 77 | |||
| 78 | coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") | ||
| 79 | |||
| 60 | @script:python depends on report@ | 80 | @script:python depends on report@ |
| 61 | p << r1.p1; | 81 | p << r1.p1; |
| 62 | @@ | 82 | @@ |
| @@ -68,3 +88,9 @@ p << r2.p2; | |||
| 68 | @@ | 88 | @@ |
| 69 | 89 | ||
| 70 | coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") | 90 | coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") |
| 91 | |||
| 92 | @script:python depends on report@ | ||
| 93 | p << r3.p3; | ||
| 94 | @@ | ||
| 95 | |||
| 96 | coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") | ||
diff --git a/scripts/coccinelle/tests/odd_ptr_err.cocci b/scripts/coccinelle/tests/odd_ptr_err.cocci new file mode 100644 index 000000000000..e8dd8a6b28a2 --- /dev/null +++ b/scripts/coccinelle/tests/odd_ptr_err.cocci | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | /// PTR_ERR should access the value just tested by IS_ERR | ||
| 2 | //# There can be false positives in the patch case, where it is the call | ||
| 3 | //# IS_ERR that is wrong. | ||
| 4 | /// | ||
| 5 | // Confidence: High | ||
| 6 | // Copyright: (C) 2012 Julia Lawall, INRIA. GPLv2. | ||
| 7 | // Copyright: (C) 2012 Gilles Muller, INRIA. GPLv2. | ||
| 8 | // URL: http://coccinelle.lip6.fr/ | ||
| 9 | // Comments: | ||
| 10 | // Options: -no_includes -include_headers | ||
| 11 | |||
| 12 | virtual patch | ||
| 13 | virtual context | ||
| 14 | virtual org | ||
| 15 | virtual report | ||
| 16 | |||
| 17 | @depends on patch@ | ||
| 18 | expression e,e1; | ||
| 19 | @@ | ||
| 20 | |||
| 21 | ( | ||
| 22 | if (IS_ERR(e)) { ... PTR_ERR(e) ... } | ||
| 23 | | | ||
| 24 | if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... } | ||
| 25 | | | ||
| 26 | if (IS_ERR(e)) | ||
| 27 | { ... | ||
| 28 | PTR_ERR( | ||
| 29 | - e1 | ||
| 30 | + e | ||
| 31 | ) | ||
| 32 | ... } | ||
| 33 | ) | ||
| 34 | |||
| 35 | @r depends on !patch@ | ||
| 36 | expression e,e1; | ||
| 37 | position p1,p2; | ||
| 38 | @@ | ||
| 39 | |||
| 40 | ( | ||
| 41 | if (IS_ERR(e)) { ... PTR_ERR(e) ... } | ||
| 42 | | | ||
| 43 | if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... } | ||
| 44 | | | ||
| 45 | *if (IS_ERR@p1(e)) | ||
| 46 | { ... | ||
| 47 | * PTR_ERR@p2(e1) | ||
| 48 | ... } | ||
| 49 | ) | ||
| 50 | |||
| 51 | @script:python depends on org@ | ||
| 52 | p1 << r.p1; | ||
| 53 | p2 << r.p2; | ||
| 54 | @@ | ||
| 55 | |||
| 56 | cocci.print_main("inconsistent IS_ERR and PTR_ERR",p1) | ||
| 57 | cocci.print_secs("PTR_ERR",p2) | ||
| 58 | |||
| 59 | @script:python depends on report@ | ||
| 60 | p1 << r.p1; | ||
| 61 | p2 << r.p2; | ||
| 62 | @@ | ||
| 63 | |||
| 64 | msg = "inconsistent IS_ERR and PTR_ERR, PTR_ERR on line %s" % (p2[0].line) | ||
| 65 | coccilib.report.print_report(p1[0],msg) | ||
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 01e8a8e22602..46e7aff80d1a 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
| @@ -6,6 +6,7 @@ use strict; | |||
| 6 | ## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## | 6 | ## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## |
| 7 | ## Copyright (C) 2001 Simon Huggins ## | 7 | ## Copyright (C) 2001 Simon Huggins ## |
| 8 | ## Copyright (C) 2005-2012 Randy Dunlap ## | 8 | ## Copyright (C) 2005-2012 Randy Dunlap ## |
| 9 | ## Copyright (C) 2012 Dan Luedtke ## | ||
| 9 | ## ## | 10 | ## ## |
| 10 | ## #define enhancements by Armin Kuster <akuster@mvista.com> ## | 11 | ## #define enhancements by Armin Kuster <akuster@mvista.com> ## |
| 11 | ## Copyright (c) 2000 MontaVista Software, Inc. ## | 12 | ## Copyright (c) 2000 MontaVista Software, Inc. ## |
| @@ -35,6 +36,8 @@ use strict; | |||
| 35 | # Small fixes (like spaces vs. \s in regex) | 36 | # Small fixes (like spaces vs. \s in regex) |
| 36 | # -- Tim Jansen <tim@tjansen.de> | 37 | # -- Tim Jansen <tim@tjansen.de> |
| 37 | 38 | ||
| 39 | # 25/07/2012 - Added support for HTML5 | ||
| 40 | # -- Dan Luedtke <mail@danrl.de> | ||
| 38 | 41 | ||
| 39 | # | 42 | # |
| 40 | # This will read a 'c' file and scan for embedded comments in the | 43 | # This will read a 'c' file and scan for embedded comments in the |
| @@ -44,12 +47,16 @@ use strict; | |||
| 44 | # Note: This only supports 'c'. | 47 | # Note: This only supports 'c'. |
| 45 | 48 | ||
| 46 | # usage: | 49 | # usage: |
| 47 | # kernel-doc [ -docbook | -html | -text | -man | -list ] [ -no-doc-sections ] | 50 | # kernel-doc [ -docbook | -html | -html5 | -text | -man | -list ] |
| 48 | # [ -function funcname [ -function funcname ...] ] c file(s)s > outputfile | 51 | # [ -no-doc-sections ] |
| 52 | # [ -function funcname [ -function funcname ...] ] | ||
| 53 | # c file(s)s > outputfile | ||
| 49 | # or | 54 | # or |
| 50 | # [ -nofunction funcname [ -function funcname ...] ] c file(s)s > outputfile | 55 | # [ -nofunction funcname [ -function funcname ...] ] |
| 56 | # c file(s)s > outputfile | ||
| 51 | # | 57 | # |
| 52 | # Set output format using one of -docbook -html -text or -man. Default is man. | 58 | # Set output format using one of -docbook -html -html5 -text or -man. |
| 59 | # Default is man. | ||
| 53 | # The -list format is for internal use by docproc. | 60 | |
