aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-20 20:52:06 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-20 20:52:06 -0500
commitaf487e4209ef5e82b1932b8b15fd59efbd56a955 (patch)
tree50bfd221e5542b8a08932aa3fa02ad4208692477 /scripts
parent810a4855513b9cb1a191301eb5e4e28b276cc318 (diff)
parentc6ba8d06ecfc1dadcf7f1b54960cf9332ba5ae8d (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.cocci109
-rwxr-xr-xscripts/config1
-rwxr-xr-xscripts/tags.sh57
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
10virtual patch
11virtual context
12virtual org
13virtual report
14
15@bad1@
16position p;
17@@
18
19printk(...);
20printk@p(...);
21WARN_ON(1);
22
23@r1 depends on context || report || org@
24position p != bad1.p;
25@@
26
27 printk@p(...);
28*WARN_ON(1);
29
30@script:python depends on org@
31p << r1.p;
32@@
33
34cocci.print_main("printk + WARN_ON can be just WARN",p)
35
36@script:python depends on report@
37p << r1.p;
38@@
39
40msg = "SUGGESTION: printk + WARN_ON can be just WARN"
41coccilib.report.print_report(p[0],msg)
42
43@ok1 depends on patch@
44expression list es;
45position p != bad1.p;
46@@
47
48-printk@p(
49+WARN(1,
50 es);
51-WARN_ON(1);
52
53@depends on patch@
54expression list ok1.es;
55@@
56
57if (...)
58- {
59 WARN(1,es);
60- }
61
62// --------------------------------------------------------------------
63
64@bad2@
65position p;
66@@
67
68printk(...);
69printk@p(...);
70WARN_ON_ONCE(1);
71
72@r2 depends on context || report || org@
73position p != bad1.p;
74@@
75
76 printk@p(...);
77*WARN_ON_ONCE(1);
78
79@script:python depends on org@
80p << r2.p;
81@@
82
83cocci.print_main("printk + WARN_ON_ONCE can be just WARN_ONCE",p)
84
85@script:python depends on report@
86p << r2.p;
87@@
88
89msg = "SUGGESTION: printk + WARN_ON_ONCE can be just WARN_ONCE"
90coccilib.report.print_report(p[0],msg)
91
92@ok2 depends on patch@
93expression list es;
94position p != bad2.p;
95@@
96
97-printk@p(
98+WARN_ONCE(1,
99 es);
100-WARN_ON_ONCE(1);
101
102@depends on patch@
103expression list ok2.es;
104@@
105
106if (...)
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
55find_arch_include_sources() 55find_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
99all_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
116all_target_sources()
117{
118 if [ -n "$COMPILED_SOURCE" ]; then
119 all_compiled_sources
120 else
121 all_sources
122 fi
123}
124
98all_kconfigs() 125all_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
111docscope() 138docscope()
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
117dogtags() 144dogtags()
118{ 145{
119 all_sources | gtags -i -f - 146 all_target_sources | gtags -i -f -
120} 147}
121 148
122exuberant() 149exuberant()
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
174emacs() 201emacs()
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)
229if [ "${ARCH}" = "um" ]; then 255if [ "${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
263elif [ "${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
237fi 278fi
238 279
239remove_structs= 280remove_structs=