diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-14 03:27:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-14 03:27:48 -0400 |
commit | da92da3638a04894afdca8b99e973ddd20268471 (patch) | |
tree | b24fbfb46d75632104ddb6ada7d95d0321222143 /scripts | |
parent | f33a3faa25c569d2a7640de66bea69e15c12ecd1 (diff) | |
parent | 4204111c028d492019e4440d12e9e3d062db4283 (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.cocci | 180 | ||||
-rwxr-xr-x | scripts/package/builddeb | 26 | ||||
-rwxr-xr-x | scripts/tags.sh | 10 |
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 | |||
11 | virtual patch | ||
12 | virtual context | ||
13 | virtual org | ||
14 | virtual report | ||
15 | |||
16 | @r depends on patch@ | ||
17 | local idexpression e; | ||
18 | identifier i,f,fn; | ||
19 | @@ | ||
20 | |||
21 | fn(...) { <... | ||
22 | - e@i = | ||
23 | + return | ||
24 | f(...); | ||
25 | -if (i != 0) return i; | ||
26 | -return 0; | ||
27 | ...> } | ||
28 | |||
29 | @depends on patch@ | ||
30 | identifier r.i; | ||
31 | type t; | ||
32 | @@ | ||
33 | |||
34 | -t i; | ||
35 | ... when != i | ||
36 | |||
37 | @depends on patch@ | ||
38 | expression e; | ||
39 | @@ | ||
40 | |||
41 | -if (e != 0) | ||
42 | return e; | ||
43 | -return 0; | ||
44 | |||
45 | // ----------------------------------------------------------------------- | ||
46 | |||
47 | @s1 depends on context || org || report@ | ||
48 | local idexpression e; | ||
49 | identifier i,f,fn; | ||
50 | position p,p1,p2; | ||
51 | @@ | ||
52 | |||
53 | fn(...) { <... | ||
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@ | ||
61 | identifier s1.i; | ||
62 | type t; | ||
63 | position q,s1.p; | ||
64 | expression e,f; | ||
65 | @@ | ||
66 | |||
67 | * t i@q; | ||
68 | ... when != i | ||
69 | e@p = f(...); | ||
70 | |||
71 | @s3 depends on context || org || report@ | ||
72 | expression e; | ||
73 | position p1!=s1.p1; | ||
74 | position 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@ | ||
84 | p << s1.p; | ||
85 | p1 << s1.p1; | ||
86 | q << s2.q; | ||
87 | @@ | ||
88 | |||
89 | cocci.print_main("decl",q) | ||
90 | cocci.print_secs("use",p) | ||
91 | cocci.include_match(False) | ||
92 | |||
93 | @script:python depends on org@ | ||
94 | p << s1.p; | ||
95 | p2 << s1.p2; | ||
96 | q << s2.q; | ||
97 | @@ | ||
98 | |||
99 | cocci.print_main("decl",q) | ||
100 | cocci.print_secs("use with questionable test",p) | ||
101 | cocci.include_match(False) | ||
102 | |||
103 | @script:python depends on org@ | ||
104 | p << s1.p; | ||
105 | p1 << s1.p1; | ||
106 | @@ | ||
107 | |||
108 | cocci.print_main("use",p) | ||
109 | |||
110 | @script:python depends on org@ | ||
111 | p << s1.p; | ||
112 | p2 << s1.p2; | ||
113 | @@ | ||
114 | |||
115 | cocci.print_main("use with questionable test",p) | ||
116 | |||
117 | @script:python depends on org@ | ||
118 | p << s3.p1; | ||
119 | @@ | ||
120 | |||
121 | cocci.print_main("test",p) | ||
122 | |||
123 | @script:python depends on org@ | ||
124 | p << s3.p2; | ||
125 | @@ | ||
126 | |||
127 | cocci.print_main("questionable test",p) | ||
128 | |||
129 | // ----------------------------------------------------------------------- | ||
130 | |||
131 | @script:python depends on report@ | ||
132 | p << s1.p; | ||
133 | p1 << s1.p1; | ||
134 | q << s2.q; | ||
135 | @@ | ||
136 | |||
137 | msg = "WARNING: end returns can be simpified and declaration on line %s can be dropped" % (q[0].line) | ||
138 | coccilib.report.print_report(p[0],msg) | ||
139 | cocci.include_match(False) | ||
140 | |||
141 | @script:python depends on report@ | ||
142 | p << s1.p; | ||
143 | p1 << s1.p1; | ||
144 | q << s2.q | ||
145 | ; | ||
146 | @@ | ||
147 | |||
148 | msg = "WARNING: end returns may be simpified if negative or 0 value and declaration on line %s can be dropped" % (q[0].line) | ||
149 | coccilib.report.print_report(p[0],msg) | ||
150 | cocci.include_match(False) | ||
151 | |||
152 | @script:python depends on report@ | ||
153 | p << s1.p; | ||
154 | p1 << s1.p1; | ||
155 | @@ | ||
156 | |||
157 | msg = "WARNING: end returns can be simpified" | ||
158 | coccilib.report.print_report(p[0],msg) | ||
159 | |||
160 | @script:python depends on report@ | ||
161 | p << s1.p; | ||
162 | p2 << s1.p2; | ||
163 | @@ | ||
164 | |||
165 | msg = "WARNING: end returns can be simpified if negative or 0 value" | ||
166 | coccilib.report.print_report(p[0],msg) | ||
167 | |||
168 | @script:python depends on report@ | ||
169 | p << s3.p1; | ||
170 | @@ | ||
171 | |||
172 | msg = "WARNING: end returns can be simpified" | ||
173 | coccilib.report.print_report(p[0],msg) | ||
174 | |||
175 | @script:python depends on report@ | ||
176 | p << s3.p2; | ||
177 | @@ | ||
178 | |||
179 | msg = "WARNING: end returns can be simpified if tested value is negative or 0" | ||
180 | coccilib.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 |
168 | fi | 166 | fi |
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/' |