Skip to content

Commit af487e4

Browse files
committed
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
2 parents 810a485 + c6ba8d0 commit af487e4

File tree

3 files changed

+158
-9
lines changed

3 files changed

+158
-9
lines changed

scripts/coccinelle/misc/warn.cocci

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
- }

scripts/config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ while [ "$1" != "" ] ; do
101101
case "$CMD" in
102102
--keep-case|-k)
103103
MUNGE_CASE=no
104-
shift
105104
continue
106105
;;
107106
--refresh)

scripts/tags.sh

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ find_arch_sources()
4848
for i in $archincludedir; do
4949
prune="$prune -wholename $i -prune -o"
5050
done
51-
find ${tree}arch/$1 $ignore $prune -name "$2" -print;
51+
find ${tree}arch/$1 $ignore $subarchprune $prune -name "$2" -print;
5252
}
5353

5454
# find sources in arch/$1/include
5555
find_arch_include_sources()
5656
{
57-
include=$(find ${tree}arch/$1/ -name include -type d);
57+
include=$(find ${tree}arch/$1/ $subarchprune \
58+
-name include -type d -print);
5859
if [ -n "$include" ]; then
5960
archincludedir="$archincludedir $include"
6061
find $include $ignore -name "$2" -print;
@@ -95,6 +96,32 @@ all_sources()
9596
find_other_sources '*.[chS]'
9697
}
9798

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+
98125
all_kconfigs()
99126
{
100127
for arch in $ALLSOURCE_ARCHS; do
@@ -110,18 +137,18 @@ all_defconfigs()
110137

111138
docscope()
112139
{
113-
(echo \-k; echo \-q; all_sources) > cscope.files
140+
(echo \-k; echo \-q; all_target_sources) > cscope.files
114141
cscope -b -f cscope.out
115142
}
116143

117144
dogtags()
118145
{
119-
all_sources | gtags -i -f -
146+
all_target_sources | gtags -i -f -
120147
}
121148

122149
exuberant()
123150
{
124-
all_sources | xargs $1 -a \
151+
all_target_sources | xargs $1 -a \
125152
-I __initdata,__exitdata,__acquires,__releases \
126153
-I __read_mostly,____cacheline_aligned \
127154
-I ____cacheline_aligned_in_smp \
@@ -173,7 +200,7 @@ exuberant()
173200

174201
emacs()
175202
{
176-
all_sources | xargs $1 -a \
203+
all_target_sources | xargs $1 -a \
177204
--regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/' \
178205
--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \
179206
--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
@@ -220,11 +247,10 @@ xtags()
220247
elif $1 --version 2>&1 | grep -iq emacs; then
221248
emacs $1
222249
else
223-
all_sources | xargs $1 -a
250+
all_target_sources | xargs $1 -a
224251
fi
225252
}
226253

227-
228254
# Support um (which uses SUBARCH)
229255
if [ "${ARCH}" = "um" ]; then
230256
if [ "$SUBARCH" = "i386" ]; then
@@ -234,6 +260,21 @@ if [ "${ARCH}" = "um" ]; then
234260
else
235261
archinclude=${SUBARCH}
236262
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
237278
fi
238279

239280
remove_structs=

0 commit comments

Comments
 (0)