aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 03:27:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 03:27:48 -0400
commitda92da3638a04894afdca8b99e973ddd20268471 (patch)
treeb24fbfb46d75632104ddb6ada7d95d0321222143 /scripts
parentf33a3faa25c569d2a7640de66bea69e15c12ecd1 (diff)
parent4204111c028d492019e4440d12e9e3d062db4283 (diff)
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull misc kbuild updates from Michal Marek: "This is the less critical kbuild stuff for v3.18-rc1: - make deb-pkg debuginfo fix, ppc64el support and warning fix for recent dpkg tools - make TAGS fixes - new coccinelle patch - kbuild documentation improvements" * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: deb-pkg: remove obsolete -isp option to dpkg-gencontrol coccinelle: misc: semantic patch to delete overly complex return code processing deb-pkg: Add support for powerpc little endian builddeb: put the dbg files into the correct directory scripts/tags.sh: fix DEFINE_HASHTABLE in emacs case scripts/tags.sh: remove *PCGFLAGS regular expressions scripts/tags.sh: Don't specify kind-spec for emacs' ctags/etags Documentation: kbuild: Improve grammar Documentation: kbuild: Remove obsolete dtc_cpp section Documentation: kbuild: Improve if_changed documentation Documentation: kbuild: Remove obsolete include/asm symlink step
Diffstat (limited to 'scripts')
-rw-r--r--scripts/coccinelle/misc/simple_return.cocci180
-rwxr-xr-xscripts/package/builddeb26
-rwxr-xr-xscripts/tags.sh10
3 files changed, 193 insertions, 23 deletions
diff --git a/scripts/coccinelle/misc/simple_return.cocci b/scripts/coccinelle/misc/simple_return.cocci
new file mode 100644
index 000000000000..47f7084b6360
--- /dev/null
+++ b/scripts/coccinelle/misc/simple_return.cocci
@@ -0,0 +1,180 @@
1/// Simplify a trivial if-return sequence. Possibly combine with a
2/// preceding function call.
3//
4// Confidence: High
5// Copyright: (C) 2014 Julia Lawall, INRIA/LIP6. GPLv2.
6// Copyright: (C) 2014 Gilles Muller, INRIA/LiP6. GPLv2.
7// URL: http://coccinelle.lip6.fr/
8// Comments:
9// Options: --no-includes --include-headers
10
11virtual patch
12virtual context
13virtual org
14virtual report
15
16@r depends on patch@
17local idexpression e;
18identifier i,f,fn;
19@@
20
21fn(...) { <...
22- e@i =
23+ return
24 f(...);
25-if (i != 0) return i;
26-return 0;
27...> }
28
29@depends on patch@
30identifier r.i;
31type t;
32@@
33
34-t i;
35 ... when != i
36
37@depends on patch@
38expression e;
39@@
40
41-if (e != 0)
42 return e;
43-return 0;
44
45// -----------------------------------------------------------------------
46
47@s1 depends on context || org || report@
48local idexpression e;
49identifier i,f,fn;
50position p,p1,p2;
51@@
52
53fn(...) { <...
54* e@i@p = f(...);
55 if (\(i@p1 != 0\|i@p2 < 0\))
56 return i;
57 return 0;
58...> }
59
60@s2 depends on context || org || report forall@
61identifier s1.i;
62type t;
63position q,s1.p;
64expression e,f;
65@@
66
67* t i@q;
68 ... when != i
69 e@p = f(...);
70
71@s3 depends on context || org || report@
72expression e;
73position p1!=s1.p1;
74position p2!=s1.p2;
75@@
76
77*if (\(e@p1 != 0\|e@p2 < 0\))
78 return e;
79 return 0;
80
81// -----------------------------------------------------------------------
82
83@script:python depends on org@
84p << s1.p;
85p1 << s1.p1;
86q << s2.q;
87@@
88
89cocci.print_main("decl",q)
90cocci.print_secs("use",p)
91cocci.include_match(False)
92
93@script:python depends on org@
94p << s1.p;
95p2 << s1.p2;
96q << s2.q;
97@@
98
99cocci.print_main("decl",q)
100cocci.print_secs("use with questionable test",p)
101cocci.include_match(False)
102
103@script:python depends on org@
104p << s1.p;
105p1 << s1.p1;
106@@
107
108cocci.print_main("use",p)
109
110@script:python depends on org@
111p << s1.p;
112p2 << s1.p2;
113@@
114
115cocci.print_main("use with questionable test",p)
116
117@script:python depends on org@
118p << s3.p1;
119@@
120
121cocci.print_main("test",p)
122
123@script:python depends on org@
124p << s3.p2;
125@@
126
127cocci.print_main("questionable test",p)
128
129// -----------------------------------------------------------------------
130
131@script:python depends on report@
132p << s1.p;
133p1 << s1.p1;
134q << s2.q;
135@@
136
137msg = "WARNING: end returns can be simpified and declaration on line %s can be dropped" % (q[0].line)
138coccilib.report.print_report(p[0],msg)
139cocci.include_match(False)
140
141@script:python depends on report@
142p << s1.p;
143p1 << s1.p1;
144q << s2.q
145;
146@@
147
148msg = "WARNING: end returns may be simpified if negative or 0 value and declaration on line %s can be dropped" % (q[0].line)
149coccilib.report.print_report(p[0],msg)
150cocci.include_match(False)
151
152@script:python depends on report@
153p << s1.p;
154p1 << s1.p1;
155@@
156
157msg = "WARNING: end returns can be simpified"
158coccilib.report.print_report(p[0],msg)
159
160@script:python depends on report@
161p << s1.p;
162p2 << s1.p2;
163@@
164
165msg = "WARNING: end returns can be simpified if negative or 0 value"
166coccilib.report.print_report(p[0],msg)
167
168@script:python depends on report@
169p << s3.p1;
170@@
171
172msg = "WARNING: end returns can be simpified"
173coccilib.report.print_report(p[0],msg)
174
175@script:python depends on report@
176p << s3.p2;
177@@
178
179msg = "WARNING: end returns can be simpified if tested value is negative or 0"
180coccilib.report.print_report(p[0],msg)
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 35d5a5877d04..59726243c2eb 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -37,7 +37,7 @@ create_package() {
37 s390*) 37 s390*)
38 debarch=s390$(grep -q CONFIG_64BIT=y $KCONFIG_CONFIG && echo x || true) ;; 38 debarch=s390$(grep -q CONFIG_64BIT=y $KCONFIG_CONFIG && echo x || true) ;;
39 ppc*) 39 ppc*)
40 debarch=powerpc ;; 40 debarch=$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo ppc64el || echo powerpc) ;;
41 parisc*) 41 parisc*)
42 debarch=hppa ;; 42 debarch=hppa ;;
43 mips*) 43 mips*)
@@ -64,7 +64,7 @@ create_package() {
64 fi 64 fi
65 65
66 # Create the package 66 # Create the package
67 dpkg-gencontrol -isp $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir" 67 dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir"
68 dpkg --build "$pdir" .. 68 dpkg --build "$pdir" ..
69} 69}
70 70
@@ -152,18 +152,16 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
152 rmdir "$tmpdir/lib/modules/$version" 152 rmdir "$tmpdir/lib/modules/$version"
153 fi 153 fi
154 if [ -n "$BUILD_DEBUG" ] ; then 154 if [ -n "$BUILD_DEBUG" ] ; then
155 ( 155 for module in $(find $tmpdir/lib/modules/ -name *.ko -printf '%P\n'); do
156 cd $tmpdir 156 module=lib/modules/$module
157 for module in $(find lib/modules/ -name *.ko); do 157 mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module)
158 mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module) 158 # only keep debug symbols in the debug file
159 # only keep debug symbols in the debug file 159 $OBJCOPY --only-keep-debug $tmpdir/$module $dbg_dir/usr/lib/debug/$module
160 $OBJCOPY --only-keep-debug $module $dbg_dir/usr/lib/debug/$module 160 # strip original module from debug symbols
161 # strip original module from debug symbols 161 $OBJCOPY --strip-debug $tmpdir/$module
162 $OBJCOPY --strip-debug $module 162 # then add a link to those
163 # then add a link to those 163 $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $tmpdir/$module
164 $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $module 164 done
165 done
166 )
167 fi 165 fi
168fi 166fi
169 167
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 293828bfd4ac..cdb491d84503 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -193,10 +193,6 @@ exuberant()
193 --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ 193 --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
194 --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ 194 --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
195 --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \ 195 --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \
196 --regex-c++='/TESTPCGFLAG\(([^,)]*).*/PageCgroup\1/' \
197 --regex-c++='/SETPCGFLAG\(([^,)]*).*/SetPageCgroup\1/' \
198 --regex-c++='/CLEARPCGFLAG\(([^,)]*).*/ClearPageCgroup\1/' \
199 --regex-c++='/TESTCLEARPCGFLAG\(([^,)]*).*/TestClearPageCgroup\1/' \
200 --regex-c++='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ 196 --regex-c++='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \
201 --regex-c++='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ 197 --regex-c++='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \
202 --regex-c++='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/'\ 198 --regex-c++='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/'\
@@ -259,17 +255,13 @@ emacs()
259 --regex='/__CLEARPAGEFLAG_NOOP(\([^,)]*\).*/__ClearPage\1/' \ 255 --regex='/__CLEARPAGEFLAG_NOOP(\([^,)]*\).*/__ClearPage\1/' \
260 --regex='/TESTCLEARFLAG_FALSE(\([^,)]*\).*/TestClearPage\1/' \ 256 --regex='/TESTCLEARFLAG_FALSE(\([^,)]*\).*/TestClearPage\1/' \
261 --regex='/__TESTCLEARFLAG_FALSE(\([^,)]*\).*/__TestClearPage\1/' \ 257 --regex='/__TESTCLEARFLAG_FALSE(\([^,)]*\).*/__TestClearPage\1/' \
262 --regex='/TESTPCGFLAG\(([^,)]*).*/PageCgroup\1/' \
263 --regex='/SETPCGFLAG\(([^,)]*).*/SetPageCgroup\1/' \
264 --regex='/CLEARPCGFLAG\(([^,)]*).*/ClearPageCgroup\1/' \
265 --regex='/TESTCLEARPCGFLAG\(([^,)]*).*/TestClearPageCgroup\1/' \
266 --regex='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ 258 --regex='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \
267 --regex='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ 259 --regex='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \
268 --regex='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/' \ 260 --regex='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/' \
269 --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' \ 261 --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' \
270 --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \ 262 --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \
271 --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'\ 263 --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'\
272 --regex='/DEFINE_HASHTABLE\((\w*)/\1/v/' 264 --regex='/[^#]*DEFINE_HASHTABLE(\([^,)]*\)/\1/'
273 265
274 all_kconfigs | xargs $1 -a \ 266 all_kconfigs | xargs $1 -a \
275 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' 267 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'