aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-30 21:14:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-30 21:14:05 -0400
commita7697b945e6e5025f184d6762e7285f1c498411d (patch)
tree3cf6ddd963c454cbadc581c8160e560894fdb2a1 /scripts
parent2b17b4382c4bcb1952e9c6953284044970a274f3 (diff)
parent354fa22fce767ac137099c8009a411bd0499816c (diff)
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull non-critical part of kbuild from Michal Marek: - New semantic patches, make coccicheck M= fix - make gtags speedup - make tags/TAGS always removes struct forward declarations - make deb-pkg fixes (some patches are still pending, I know) - scripts/patch-kernel fix from the last user of this script ;) * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: scripts/patch-kernel: digest kernel.org hosted .xz patches scripts/coccinelle/api/ptr_ret.cocci: semantic patch for ptr_err scripts: refactor remove structure forward declarations kbuild: incremental tags update for GNU Global coccinelle: semantic patch for bool issues coccinelle: semantic patch to check for PTR_ERR after reassignment coccinelle: semantic patch converting 0 test to null test coccinelle: semantic patch for missing iounmap coccinelle: semantic patch for missing clk_put kbuild: Fix out-of-tree build for 'make deb-pkg' kbuild: Only build linux-image package for UML kbuild: Fix link to headers in 'make deb-pkg' coccicheck: change handling of C={1,2} when M= is set
Diffstat (limited to 'scripts')
-rw-r--r--scripts/coccinelle/api/ptr_ret.cocci70
-rw-r--r--scripts/coccinelle/free/clk_put.cocci67
-rw-r--r--scripts/coccinelle/free/iounmap.cocci67
-rw-r--r--scripts/coccinelle/misc/boolinit.cocci178
-rw-r--r--scripts/coccinelle/misc/cstptr.cocci41
-rw-r--r--scripts/coccinelle/null/badzero.cocci237
-rw-r--r--scripts/package/builddeb20
-rwxr-xr-xscripts/patch-kernel4
-rwxr-xr-xscripts/tags.sh13
9 files changed, 687 insertions, 10 deletions
diff --git a/scripts/coccinelle/api/ptr_ret.cocci b/scripts/coccinelle/api/ptr_ret.cocci
new file mode 100644
index 000000000000..cbfd08c7d8c7
--- /dev/null
+++ b/scripts/coccinelle/api/ptr_ret.cocci
@@ -0,0 +1,70 @@
1///
2/// Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR
3///
4// Confidence: High
5// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
6// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
7// URL: http://coccinelle.lip6.fr/
8// Options: -no_includes -include_headers
9//
10// Keywords: ERR_PTR, PTR_ERR, PTR_RET
11// Version min: 2.6.39
12//
13
14virtual context
15virtual patch
16virtual org
17virtual report
18
19@depends on patch@
20expression ptr;
21@@
22
23- if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0;
24+ return PTR_RET(ptr);
25
26@depends on patch@
27expression ptr;
28@@
29
30- if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
31+ return PTR_RET(ptr);
32
33@r1 depends on !patch@
34expression ptr;
35position p1;
36@@
37
38* if@p1 (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0;
39
40@r2 depends on !patch@
41expression ptr;
42position p2;
43@@
44
45* if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
46
47@script:python depends on org@
48p << r1.p1;
49@@
50
51coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
52
53
54@script:python depends on org@
55p << r2.p2;
56@@
57
58coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
59
60@script:python depends on report@
61p << r1.p1;
62@@
63
64coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")
65
66@script:python depends on report@
67p << r2.p2;
68@@
69
70coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")
diff --git a/scripts/coccinelle/free/clk_put.cocci b/scripts/coccinelle/free/clk_put.cocci
new file mode 100644
index 000000000000..46747adfd20a
--- /dev/null
+++ b/scripts/coccinelle/free/clk_put.cocci
@@ -0,0 +1,67 @@
1/// Find missing clk_puts.
2///
3//# This only signals a missing clk_put when there is a clk_put later
4//# in the same function.
5//# False positives can be due to loops.
6//
7// Confidence: Moderate
8// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
9// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
10// URL: http://coccinelle.lip6.fr/
11// Comments:
12// Options:
13
14virtual context
15virtual org
16virtual report
17
18@clk@
19expression e;
20statement S,S1;
21int ret;
22position p1,p2,p3;
23@@
24
25e = clk_get@p1(...)
26... when != clk_put(e)
27if (<+...e...+>) S
28... when any
29 when != clk_put(e)
30 when != if (...) { ... clk_put(e); ... }
31(
32 if (ret == 0) S1
33|
34if (...)
35 { ...
36 return 0; }
37|
38if (...)
39 { ...
40 return <+...e...+>; }
41|
42*if@p2 (...)
43 { ... when != clk_put(e)
44 when forall
45 return@p3 ...; }
46)
47... when any
48clk_put(e);
49
50@script:python depends on org@
51p1 << clk.p1;
52p2 << clk.p2;
53p3 << clk.p3;
54@@
55
56cocci.print_main("clk_get",p1)
57cocci.print_secs("if",p2)
58cocci.print_secs("needed clk_put",p3)
59
60@script:python depends on report@
61p1 << clk.p1;
62p2 << clk.p2;
63p3 << clk.p3;
64@@
65
66msg = "ERROR: missing clk_put; clk_get on line %s and execution via conditional on line %s" % (p1[0].line,p2[0].line)
67coccilib.report.print_report(p3[0],msg)
diff --git a/scripts/coccinelle/free/iounmap.cocci b/scripts/coccinelle/free/iounmap.cocci
new file mode 100644
index 000000000000..5384f4ba1192
--- /dev/null
+++ b/scripts/coccinelle/free/iounmap.cocci
@@ -0,0 +1,67 @@
1/// Find missing iounmaps.
2///
3//# This only signals a missing iounmap when there is an iounmap later
4//# in the same function.
5//# False positives can be due to loops.
6//
7// Confidence: Moderate
8// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
9// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
10// URL: http://coccinelle.lip6.fr/
11// Comments:
12// Options:
13
14virtual context
15virtual org
16virtual report
17
18@iom@
19expression e;
20statement S,S1;
21int ret;
22position p1,p2,p3;
23@@
24
25e = \(ioremap@p1\|ioremap_nocache@p1\)(...)
26... when != iounmap(e)
27if (<+...e...+>) S
28... when any
29 when != iounmap(e)
30 when != if (...) { ... iounmap(e); ... }
31(
32 if (ret == 0) S1
33|
34if (...)
35 { ...
36 return 0; }
37|
38if (...)
39 { ...
40 return <+...e...+>; }
41|
42*if@p2 (...)
43 { ... when != iounmap(e)
44 when forall
45 return@p3 ...; }
46)
47... when any
48iounmap(e);
49
50@script:python depends on org@
51p1 << iom.p1;
52p2 << iom.p2;
53p3 << iom.p3;
54@@
55
56cocci.print_main("ioremap",p1)
57cocci.print_secs("if",p2)
58cocci.print_secs("needed iounmap",p3)
59
60@script:python depends on report@
61p1 << iom.p1;
62p2 << iom.p2;
63p3 << iom.p3;
64@@
65
66msg = "ERROR: missing iounmap; ioremap on line %s and execution via conditional on line %s" % (p1[0].line,p2[0].line)
67coccilib.report.print_report(p3[0],msg)
diff --git a/scripts/coccinelle/misc/boolinit.cocci b/scripts/coccinelle/misc/boolinit.cocci
new file mode 100644
index 000000000000..97ce41ce8135
--- /dev/null
+++ b/scripts/coccinelle/misc/boolinit.cocci
@@ -0,0 +1,178 @@
1/// Bool initializations should use true and false. Bool tests don't need
2/// comparisons. Based on contributions from Joe Perches, Rusty Russell
3/// and Bruce W Allan.
4///
5// Confidence: High
6// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
7// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
8// URL: http://coccinelle.lip6.fr/
9// Options: -include_headers
10
11virtual patch
12virtual context
13virtual org
14virtual report
15
16@depends on patch@
17bool t;
18symbol true;
19symbol false;
20@@
21
22(
23- t == true
24+ t
25|
26- true == t
27+ t
28|
29- t != true
30+ !t
31|
32- true != t
33+ !t
34|
35- t == false
36+ !t
37|
38- false == t
39+ !t
40|
41- t != false
42+ t
43|
44- false != t
45+ t
46)
47
48@depends on patch disable is_zero, isnt_zero@
49bool t;
50@@
51
52(
53- t == 1
54+ t
55|
56- t != 1
57+ !t
58|
59- t == 0
60+ !t
61|
62- t != 0
63+ t
64)
65
66@depends on patch@
67bool b;
68@@
69(
70 b =
71- 0
72+ false
73|
74 b =
75- 1
76+ true
77)
78
79// ---------------------------------------------------------------------
80
81@r1 depends on !patch@
82bool t;
83position p;
84@@
85
86(
87* t@p == true
88|
89* true == t@p
90|
91* t@p != true
92|
93* true != t@p
94|
95* t@p == false
96|
97* false == t@p
98|
99* t@p != false
100|
101* false != t@p
102)
103
104@r2 depends on !patch disable is_zero, isnt_zero@
105bool t;
106position p;
107@@
108
109(
110* t@p == 1
111|
112* t@p != 1
113|
114* t@p == 0
115|
116* t@p != 0
117)
118
119@r3 depends on !patch@
120bool b;
121position p1,p2;
122constant c;
123@@
124(
125*b@p1 = 0
126|
127*b@p1 = 1
128|
129*b@p2 = c
130)
131
132@script:python depends on org@
133p << r1.p;
134@@
135
136cocci.print_main("WARNING: Comparison to bool",p)
137
138@script:python depends on org@
139p << r2.p;
140@@
141
142cocci.print_main("WARNING: Comparison of bool to 0/1",p)
143
144@script:python depends on org@
145p1 << r3.p1;
146@@
147
148cocci.print_main("WARNING: Assignment of bool to 0/1",p1)
149
150@script:python depends on org@
151p2 << r3.p2;
152@@
153
154cocci.print_main("ERROR: Assignment of bool to non-0/1 constant",p2)
155
156@script:python depends on report@
157p << r1.p;
158@@
159
160coccilib.report.print_report(p[0],"WARNING: Comparison to bool")
161
162@script:python depends on report@
163p << r2.p;
164@@
165
166coccilib.report.print_report(p[0],"WARNING: Comparison of bool to 0/1")
167
168@script:python depends on report@
169p1 << r3.p1;
170@@
171
172coccilib.report.print_report(p1[0],"WARNING: Assignment of bool to 0/1")
173
174@script:python depends on report@
175p2 << r3.p2;
176@@
177
178coccilib.report.print_report(p2[0],"ERROR: Assignment of bool to non-0/1 constant")
diff --git a/scripts/coccinelle/misc/cstptr.cocci b/scripts/coccinelle/misc/cstptr.cocci
new file mode 100644
index 000000000000..d42564484528
--- /dev/null
+++ b/scripts/coccinelle/misc/cstptr.cocci
@@ -0,0 +1,41 @@
1/// PTR_ERR should be applied before its argument is reassigned, typically
2/// to NULL
3///
4// Confidence: High
5// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
6// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
7// URL: http://coccinelle.lip6.fr/
8// Comments:
9// Options: -no_includes -include_headers
10
11virtual org
12virtual report
13virtual context
14
15@r exists@
16expression e,e1;
17constant c;
18position p1,p2;
19@@
20
21*e@p1 = c
22... when != e = e1
23 when != &e
24 when != true IS_ERR(e)
25*PTR_ERR@p2(e)
26
27@script:python depends on org@
28p1 << r.p1;
29p2 << r.p2;
30@@
31
32cocci.print_main("PTR_ERR",p2)
33cocci.print_secs("assignment",p1)
34
35@script:python depends on report@
36p1 << r.p1;
37p2 << r.p2;
38@@
39
40msg = "ERROR: PTR_ERR applied after initialization to constant on line %s" % (p1[0].line)
41coccilib.report.print_report(p2[0],msg)
diff --git a/scripts/coccinelle/null/badzero.cocci b/scripts/coccinelle/null/badzero.cocci
new file mode 100644
index 000000000000..d79baf7220e7
--- /dev/null
+++ b/scripts/coccinelle/null/badzero.cocci
@@ -0,0 +1,237 @@
1/// Compare pointer-typed values to NULL rather than 0
2///
3//# This makes an effort to choose between !x and x == NULL. !x is used
4//# if it has previously been used with the function used to initialize x.
5//# This relies on type information. More type information can be obtained
6//# using the option -all_includes and the option -I to specify an
7//# include path.
8//
9// Confidence: High
10// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
11// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
12// URL: http://coccinelle.lip6.fr/
13// Comments:
14// Options:
15
16virtual patch
17virtual context
18virtual org
19virtual report
20
21@initialize:ocaml@
22let negtable = Hashtbl.create 101
23
24@depends on patch@
25expression *E;
26identifier f;
27@@
28
29(
30 (E = f(...)) ==
31- 0
32+ NULL
33|
34 (E = f(...)) !=
35- 0
36+ NULL
37|
38- 0
39+ NULL
40 == (E = f(...))
41|
42- 0
43+ NULL
44 != (E = f(...))
45)
46
47
48@t1 depends on !patch@
49expression *E;
50identifier f;
51position p;
52@@
53
54(
55 (E = f(...)) ==
56* 0@p
57|
58 (E = f(...)) !=
59* 0@p
60|
61* 0@p
62 == (E = f(...))
63|
64* 0@p
65 != (E = f(...))
66)
67
68@script:python depends on org@
69p << t1.p;
70@@
71
72coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0")
73
74@script:python depends on report@
75p << t1.p;
76@@
77
78coccilib.report.print_report(p[0], "WARNING comparing pointer to 0")
79
80// Tests of returned values
81
82@s@
83identifier f;
84expression E,E1;
85@@
86
87 E = f(...)
88 ... when != E = E1
89 !E
90
91@script:ocaml depends on s@
92f << s.f;
93@@
94
95try let _ = Hashtbl.find negtable f in ()
96with Not_found -> Hashtbl.add negtable f ()
97
98@ r disable is_zero,isnt_zero exists @
99expression *E;
100identifier f;
101@@
102
103E = f(...)
104...
105(E == 0
106|E != 0
107|0 == E
108|0 != E
109)
110
111@script:ocaml@
112f << r.f;
113@@
114
115try let _ = Hashtbl.find negtable f in ()
116with Not_found -> include_match false
117
118// This rule may lead to inconsistent path problems, if E is defined in two
119// places
120@ depends on patch disable is_zero,isnt_zero @
121expression *E;
122expression E1;
123identifier r.f;
124@@
125
126E = f(...)
127<...
128(
129- E == 0
130+ !E
131|
132- E != 0
133+ E
134|
135- 0 == E
136+ !E
137|
138- 0 != E
139+ E
140)
141...>
142?E = E1
143
144@t2 depends on !patch disable is_zero,isnt_zero @
145expression *E;
146expression E1;
147identifier r.f;
148position p1;
149position p2;
150@@
151
152E = f(...)
153<...
154(
155* E == 0@p1
156|
157* E != 0@p2
158|
159* 0@p1 == E
160|
161* 0@p1 != E
162)
163...>
164?E = E1
165
166@script:python depends on org@
167p << t2.p1;
168@@
169
170coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0, suggest !E")
171
172@script:python depends on org@
173p << t2.p2;
174@@
175
176coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0")
177
178@script:python depends on report@
179p << t2.p1;
180@@
181
182coccilib.report.print_report(p[0], "WARNING comparing pointer to 0, suggest !E")
183
184@script:python depends on report@
185p << t2.p2;
186@@
187
188coccilib.report.print_report(p[0], "WARNING comparing pointer to 0")
189
190@ depends on patch disable is_zero,isnt_zero @
191expression *E;
192@@
193
194(
195 E ==
196- 0
197+ NULL
198|
199 E !=
200- 0
201+ NULL
202|
203- 0
204+ NULL
205 == E
206|
207- 0
208+ NULL
209 != E
210)
211
212@ t3 depends on !patch disable is_zero,isnt_zero @
213expression *E;
214position p;
215@@
216
217(
218* E == 0@p
219|
220* E != 0@p
221|
222* 0@p == E
223|
224* 0@p != E
225)
226
227@script:python depends on org@
228p << t3.p;
229@@
230
231coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0")
232
233@script:python depends on report@
234p << t3.p;
235@@
236
237coccilib.report.print_report(p[0], "WARNING comparing pointer to 0")
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 3c6c0b14c807..eee5f8ed2493 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -97,6 +97,7 @@ mkdir -m 755 -p "$libc_headers_dir/DEBIAN"
97mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" 97mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename"
98mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" 98mkdir -m 755 -p "$kernel_headers_dir/DEBIAN"
99mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename" 99mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename"
100mkdir -p "$kernel_headers_dir/lib/modules/$version/"
100if [ "$ARCH" = "um" ] ; then 101if [ "$ARCH" = "um" ] ; then
101 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" 102 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin"
102fi 103fi
@@ -120,15 +121,19 @@ else
120fi 121fi
121 122
122if grep -q '^CONFIG_MODULES=y' .config ; then 123if grep -q '^CONFIG_MODULES=y' .config ; then
123 INSTALL_MOD_PATH="$tmpdir" make KBUILD_SRC= modules_install 124 INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install
125 rm -f "$tmpdir/lib/modules/$version/build"
126 rm -f "$tmpdir/lib/modules/$version/source"
124 if [ "$ARCH" = "um" ] ; then 127 if [ "$ARCH" = "um" ] ; then
125 mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" 128 mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/"
126 rmdir "$tmpdir/lib/modules/$version" 129 rmdir "$tmpdir/lib/modules/$version"
127 fi 130 fi
128fi 131fi
129 132
130make headers_check 133if [ "$ARCH" != "um" ]; then
131make headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr" 134 $MAKE headers_check KBUILD_SRC=
135 $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr"
136fi
132 137
133# Install the maintainer scripts 138# Install the maintainer scripts
134# Note: hook scripts under /etc/kernel are also executed by official Debian 139# Note: hook scripts under /etc/kernel are also executed by official Debian
@@ -245,6 +250,7 @@ destdir=$kernel_headers_dir/usr/src/linux-headers-$version
245mkdir -p "$destdir" 250mkdir -p "$destdir"
246(cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -) 251(cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -)
247(cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -) 252(cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
253ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
248rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" 254rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
249arch=$(dpkg --print-architecture) 255arch=$(dpkg --print-architecture)
250 256
@@ -259,8 +265,6 @@ Description: Linux kernel headers for $KERNELRELEASE on $arch
259 This is useful for people who need to build external modules 265 This is useful for people who need to build external modules
260EOF 266EOF
261 267
262create_package "$kernel_headers_packagename" "$kernel_headers_dir"
263
264# Do we have firmware? Move it out of the way and build it into a package. 268# Do we have firmware? Move it out of the way and build it into a package.
265if [ -e "$tmpdir/lib/firmware" ]; then 269if [ -e "$tmpdir/lib/firmware" ]; then
266 mv "$tmpdir/lib/firmware" "$fwdir/lib/" 270 mv "$tmpdir/lib/firmware" "$fwdir/lib/"
@@ -287,7 +291,11 @@ Description: Linux support headers for userspace development
287 are used by the installed headers for GNU glibc and other system libraries. 291 are used by the installed headers for GNU glibc and other system libraries.
288EOF 292EOF
289 293
290create_package "$libc_headers_packagename" "$libc_headers_dir" 294if [ "$ARCH" != "um" ]; then
295 create_package "$kernel_headers_packagename" "$kernel_headers_dir"
296 create_package "$libc_headers_packagename" "$libc_headers_dir"
297fi
298
291create_package "$packagename" "$tmpdir" 299create_package "$packagename" "$tmpdir"
292 300
293exit 0 301exit 0
diff --git a/scripts/patch-kernel b/scripts/patch-kernel
index 20fb25c23382..d000ea3a41fd 100755
--- a/scripts/patch-kernel
+++ b/scripts/patch-kernel
@@ -116,6 +116,10 @@ findFile () {
116 ext=".bz2" 116 ext=".bz2"
117 name="bzip2" 117 name="bzip2"
118 uncomp="bunzip2 -dc" 118 uncomp="bunzip2 -dc"
119 elif [ -r ${filebase}.xz ]; then
120 ext=".xz"
121 name="xz"
122 uncomp="xz -dc"
119 elif [ -r ${filebase}.zip ]; then 123 elif [ -r ${filebase}.zip ]; then
120 ext=".zip" 124 ext=".zip"
121 name="zip" 125 name="zip"
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 833813a99e7c..0d6004e20658 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -116,7 +116,7 @@ docscope()
116 116
117dogtags() 117dogtags()
118{ 118{
119 all_sources | gtags -f - 119 all_sources | gtags -i -f -
120} 120}
121 121
122exuberant() 122exuberant()
@@ -166,9 +166,6 @@ exuberant()
166 all_defconfigs | xargs -r $1 -a \ 166 all_defconfigs | xargs -r $1 -a \
167 --langdef=dotconfig --language-force=dotconfig \ 167 --langdef=dotconfig --language-force=dotconfig \
168 --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/' 168 --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'
169
170 # Remove structure forward declarations.
171 LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' tags
172} 169}
173 170
174emacs() 171emacs()
@@ -233,6 +230,7 @@ if [ "${ARCH}" = "um" ]; then
233 fi 230 fi
234fi 231fi
235 232
233remove_structs=
236case "$1" in 234case "$1" in
237 "cscope") 235 "cscope")
238 docscope 236 docscope
@@ -245,10 +243,17 @@ case "$1" in
245 "tags") 243 "tags")
246 rm -f tags 244 rm -f tags
247 xtags ctags 245 xtags ctags
246 remove_structs=y
248 ;; 247 ;;
249 248
250 "TAGS") 249 "TAGS")
251 rm -f TAGS 250 rm -f TAGS
252 xtags etags 251 xtags etags
252 remove_structs=y
253 ;; 253 ;;
254esac 254esac
255
256# Remove structure forward declarations.
257if [ -n $remove_structs ]; then
258 LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1
259fi