diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-20 20:52:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-20 20:52:06 -0500 |
commit | af487e4209ef5e82b1932b8b15fd59efbd56a955 (patch) | |
tree | 50bfd221e5542b8a08932aa3fa02ad4208692477 /scripts | |
parent | 810a4855513b9cb1a191301eb5e4e28b276cc318 (diff) | |
parent | c6ba8d06ecfc1dadcf7f1b54960cf9332ba5ae8d (diff) |
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild misc changes from Michal Marek:
"This is the non-critical part of kbuild
- scripts/kernel-doc requires a "Return:" section for non-void
functions
- ARCH=arm SUBARCH=... support for make tags
- COMPILED_SOURCE=1 support for make tags (only indexes .c files for
which a .o exists)
- New coccinelle check
- Option parsing fix for scripts/config"
* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
scripts/config: Fix wrong "shift" for --keep-case
scripts/tags.sh: Support compiled source
scripts/tags.sh: Support subarch for ARM
scripts/coccinelle/misc/warn.cocci: use WARN
scripts/kernel-doc: check that non-void fcts describe their return value
Kernel-doc: Convention: Use a "Return" section to describe return values
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/coccinelle/misc/warn.cocci | 109 | ||||
-rwxr-xr-x | scripts/config | 1 | ||||
-rwxr-xr-x | scripts/tags.sh | 57 |
3 files changed, 158 insertions, 9 deletions
diff --git a/scripts/coccinelle/misc/warn.cocci b/scripts/coccinelle/misc/warn.cocci new file mode 100644 index 000000000000..fda8c3558e4f --- /dev/null +++ b/scripts/coccinelle/misc/warn.cocci | |||
@@ -0,0 +1,109 @@ | |||
1 | /// Use WARN(1,...) rather than printk followed by WARN_ON(1) | ||
2 | /// | ||
3 | // Confidence: High | ||
4 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | ||
5 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | ||
6 | // URL: http://coccinelle.lip6.fr/ | ||
7 | // Comments: | ||
8 | // Options: -no_includes -include_headers | ||
9 | |||
10 | virtual patch | ||
11 | virtual context | ||
12 | virtual org | ||
13 | virtual report | ||
14 | |||
15 | @bad1@ | ||
16 | position p; | ||
17 | @@ | ||
18 | |||
19 | printk(...); | ||
20 | printk@p(...); | ||
21 | WARN_ON(1); | ||
22 | |||
23 | @r1 depends on context || report || org@ | ||
24 | position p != bad1.p; | ||
25 | @@ | ||
26 | |||
27 | printk@p(...); | ||
28 | *WARN_ON(1); | ||
29 | |||
30 | @script:python depends on org@ | ||
31 | p << r1.p; | ||
32 | @@ | ||
33 | |||
34 | cocci.print_main("printk + WARN_ON can be just WARN",p) | ||
35 | |||
36 | @script:python depends on report@ | ||
37 | p << r1.p; | ||
38 | @@ | ||
39 | |||
40 | msg = "SUGGESTION: printk + WARN_ON can be just WARN" | ||
41 | coccilib.report.print_report(p[0],msg) | ||
42 | |||
43 | @ok1 depends on patch@ | ||
44 | expression list es; | ||
45 | position p != bad1.p; | ||
46 | @@ | ||
47 | |||
48 | -printk@p( | ||
49 | +WARN(1, | ||
50 | es); | ||
51 | -WARN_ON(1); | ||
52 | |||
53 | @depends on patch@ | ||
54 | expression list ok1.es; | ||
55 | @@ | ||
56 | |||
57 | if (...) | ||
58 | - { | ||
59 | WARN(1,es); | ||
60 | - } | ||
61 | |||
62 | // -------------------------------------------------------------------- | ||
63 | |||
64 | @bad2@ | ||
65 | position p; | ||
66 | @@ | ||
67 | |||
68 | printk(...); | ||
69 | printk@p(...); | ||
70 | WARN_ON_ONCE(1); | ||
71 | |||
72 | @r2 depends on context || report || org@ | ||
73 | position p != bad1.p; | ||
74 | @@ | ||
75 | |||
76 | printk@p(...); | ||
77 | *WARN_ON_ONCE(1); | ||
78 | |||
79 | @script:python depends on org@ | ||
80 | p << r2.p; | ||
81 | @@ | ||
82 | |||
83 | cocci.print_main("printk + WARN_ON_ONCE can be just WARN_ONCE",p) | ||
84 | |||
85 | @script:python depends on report@ | ||
86 | p << r2.p; | ||
87 | @@ | ||
88 | |||
89 | msg = "SUGGESTION: printk + WARN_ON_ONCE can be just WARN_ONCE" | ||
90 | coccilib.report.print_report(p[0],msg) | ||
91 | |||
92 | @ok2 depends on patch@ | ||
93 | expression list es; | ||
94 | position p != bad2.p; | ||
95 | @@ | ||
96 | |||
97 | -printk@p( | ||
98 | +WARN_ONCE(1, | ||
99 | es); | ||
100 | -WARN_ON_ONCE(1); | ||
101 | |||
102 | @depends on patch@ | ||
103 | expression list ok2.es; | ||
104 | @@ | ||
105 | |||
106 | if (...) | ||
107 | - { | ||
108 | WARN_ONCE(1,es); | ||
109 | - } | ||
diff --git a/scripts/config b/scripts/config index ee355394f4ef..bb4d3deb6d1c 100755 --- a/scripts/config +++ b/scripts/config | |||
@@ -101,7 +101,6 @@ while [ "$1" != "" ] ; do | |||
101 | case "$CMD" in | 101 | case "$CMD" in |
102 | --keep-case|-k) | 102 | --keep-case|-k) |
103 | MUNGE_CASE=no | 103 | MUNGE_CASE=no |
104 | shift | ||
105 | continue | 104 | continue |
106 | ;; | 105 | ;; |
107 | --refresh) | 106 | --refresh) |
diff --git a/scripts/tags.sh b/scripts/tags.sh index 79fdafb0d263..08f06c00745e 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
@@ -48,13 +48,14 @@ find_arch_sources() | |||
48 | for i in $archincludedir; do | 48 | for i in $archincludedir; do |
49 | prune="$prune -wholename $i -prune -o" | 49 | prune="$prune -wholename $i -prune -o" |
50 | done | 50 | done |
51 | find ${tree}arch/$1 $ignore $prune -name "$2" -print; | 51 | find ${tree}arch/$1 $ignore $subarchprune $prune -name "$2" -print; |
52 | } | 52 | } |
53 | 53 | ||
54 | # find sources in arch/$1/include | 54 | # find sources in arch/$1/include |
55 | find_arch_include_sources() | 55 | find_arch_include_sources() |
56 | { | 56 | { |
57 | include=$(find ${tree}arch/$1/ -name include -type d); | 57 | include=$(find ${tree}arch/$1/ $subarchprune \ |
58 | -name include -type d -print); | ||
58 | if [ -n "$include" ]; then | 59 | if [ -n "$include" ]; then |
59 | archincludedir="$archincludedir $include" | 60 | archincludedir="$archincludedir $include" |
60 | find $include $ignore -name "$2" -print; | 61 | find $include $ignore -name "$2" -print; |
@@ -95,6 +96,32 @@ all_sources() | |||
95 | find_other_sources '*.[chS]' | 96 | find_other_sources '*.[chS]' |
96 | } | 97 | } |
97 | 98 | ||
99 | all_compiled_sources() | ||
100 | { | ||
101 | for i in $(all_sources); do | ||
102 | case "$i" in | ||
103 | *.[cS]) | ||
104 | j=${i/\.[cS]/\.o} | ||
105 | if [ -e $j ]; then | ||
106 | echo $i | ||
107 | fi | ||
108 | ;; | ||
109 | *) | ||
110 | echo $i | ||
111 | ;; | ||
112 | esac | ||
113 | done | ||
114 | } | ||
115 | |||
116 | all_target_sources() | ||
117 | { | ||
118 | if [ -n "$COMPILED_SOURCE" ]; then | ||
119 | all_compiled_sources | ||
120 | else | ||
121 | all_sources | ||
122 | fi | ||
123 | } | ||
124 | |||
98 | all_kconfigs() | 125 | all_kconfigs() |
99 | { | 126 | { |
100 | for arch in $ALLSOURCE_ARCHS; do | 127 | for arch in $ALLSOURCE_ARCHS; do |
@@ -110,18 +137,18 @@ all_defconfigs() | |||
110 | 137 | ||
111 | docscope() | 138 | docscope() |
112 | { | 139 | { |
113 | (echo \-k; echo \-q; all_sources) > cscope.files | 140 | (echo \-k; echo \-q; all_target_sources) > cscope.files |
114 | cscope -b -f cscope.out | 141 | cscope -b -f cscope.out |
115 | } | 142 | } |
116 | 143 | ||
117 | dogtags() | 144 | dogtags() |
118 | { | 145 | { |
119 | all_sources | gtags -i -f - | 146 | all_target_sources | gtags -i -f - |
120 | } | 147 | } |
121 | 148 | ||
122 | exuberant() | 149 | exuberant() |
123 | { | 150 | { |
124 | all_sources | xargs $1 -a \ | 151 | all_target_sources | xargs $1 -a \ |
125 | -I __initdata,__exitdata,__acquires,__releases \ | 152 | -I __initdata,__exitdata,__acquires,__releases \ |
126 | -I __read_mostly,____cacheline_aligned \ | 153 | -I __read_mostly,____cacheline_aligned \ |
127 | -I ____cacheline_aligned_in_smp \ | 154 | -I ____cacheline_aligned_in_smp \ |
@@ -173,7 +200,7 @@ exuberant() | |||
173 | 200 | ||
174 | emacs() | 201 | emacs() |
175 | { | 202 | { |
176 | all_sources | xargs $1 -a \ | 203 | all_target_sources | xargs $1 -a \ |
177 | --regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/' \ | 204 | --regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/' \ |
178 | --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \ | 205 | --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \ |
179 | --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \ | 206 | --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \ |
@@ -220,11 +247,10 @@ xtags() | |||
220 | elif $1 --version 2>&1 | grep -iq emacs; then | 247 | elif $1 --version 2>&1 | grep -iq emacs; then |
221 | emacs $1 | 248 | emacs $1 |
222 | else | 249 | else |
223 | all_sources | xargs $1 -a | 250 | all_target_sources | xargs $1 -a |
224 | fi | 251 | fi |
225 | } | 252 | } |
226 | 253 | ||
227 | |||
228 | # Support um (which uses SUBARCH) | 254 | # Support um (which uses SUBARCH) |
229 | if [ "${ARCH}" = "um" ]; then | 255 | if [ "${ARCH}" = "um" ]; then |
230 | if [ "$SUBARCH" = "i386" ]; then | 256 | if [ "$SUBARCH" = "i386" ]; then |
@@ -234,6 +260,21 @@ if [ "${ARCH}" = "um" ]; then | |||
234 | else | 260 | else |
235 | archinclude=${SUBARCH} | 261 | archinclude=${SUBARCH} |
236 | fi | 262 | fi |
263 | elif [ "${SRCARCH}" = "arm" -a "${SUBARCH}" != "" ]; then | ||
264 | subarchdir=$(find ${tree}arch/$SRCARCH/ -name "mach-*" -type d -o \ | ||
265 | -name "plat-*" -type d); | ||
266 | for i in $subarchdir; do | ||
267 | case "$i" in | ||
268 | *"mach-"${SUBARCH}) | ||
269 | ;; | ||
270 | *"plat-"${SUBARCH}) | ||
271 | ;; | ||
272 | *) | ||
273 | subarchprune="$subarchprune \ | ||
274 | -wholename $i -prune -o" | ||
275 | ;; | ||
276 | esac | ||
277 | done | ||
237 | fi | 278 | fi |
238 | 279 | ||
239 | remove_structs= | 280 | remove_structs= |