diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.lib | 3 | ||||
-rwxr-xr-x | scripts/bloat-o-meter | 8 | ||||
-rwxr-xr-x | scripts/checkkconfigsymbols.py | 234 | ||||
-rwxr-xr-x | scripts/kernel-doc | 5 | ||||
-rwxr-xr-x | scripts/ld-version.sh | 4 | ||||
-rwxr-xr-x | scripts/link-vmlinux.sh | 2 | ||||
-rw-r--r-- | scripts/mod/file2alias.c | 5 | ||||
-rwxr-xr-x | scripts/recordmcount.pl | 3 | ||||
-rwxr-xr-x | scripts/tags.sh | 2 |
9 files changed, 204 insertions, 62 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 79e86613712f..26a48d76eb9d 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -104,8 +104,9 @@ modname_flags = $(if $(filter 1,$(words $(modname))),\ | |||
104 | orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \ | 104 | orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \ |
105 | $(ccflags-y) $(CFLAGS_$(basetarget).o) | 105 | $(ccflags-y) $(CFLAGS_$(basetarget).o) |
106 | _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) | 106 | _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) |
107 | _a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \ | 107 | orig_a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \ |
108 | $(asflags-y) $(AFLAGS_$(basetarget).o) | 108 | $(asflags-y) $(AFLAGS_$(basetarget).o) |
109 | _a_flags = $(filter-out $(AFLAGS_REMOVE_$(basetarget).o), $(orig_a_flags)) | ||
109 | _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F)) | 110 | _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F)) |
110 | 111 | ||
111 | # | 112 | # |
diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter index 23e78dcd12bf..38b64f487315 100755 --- a/scripts/bloat-o-meter +++ b/scripts/bloat-o-meter | |||
@@ -58,8 +58,8 @@ for name in common: | |||
58 | delta.sort() | 58 | delta.sort() |
59 | delta.reverse() | 59 | delta.reverse() |
60 | 60 | ||
61 | print "add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s (%s)" % \ | 61 | print("add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s (%s)" % \ |
62 | (add, remove, grow, shrink, up, -down, up-down) | 62 | (add, remove, grow, shrink, up, -down, up-down)) |
63 | print "%-40s %7s %7s %+7s" % ("function", "old", "new", "delta") | 63 | print("%-40s %7s %7s %+7s" % ("function", "old", "new", "delta")) |
64 | for d, n in delta: | 64 | for d, n in delta: |
65 | if d: print "%-40s %7s %7s %+7d" % (n, old.get(n,"-"), new.get(n,"-"), d) | 65 | if d: print("%-40s %7s %7s %+7d" % (n, old.get(n,"-"), new.get(n,"-"), d)) |
diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py index 2f4b7ffd5570..d8f6c094cce5 100755 --- a/scripts/checkkconfigsymbols.py +++ b/scripts/checkkconfigsymbols.py | |||
@@ -8,11 +8,14 @@ | |||
8 | # Licensed under the terms of the GNU GPL License version 2 | 8 | # Licensed under the terms of the GNU GPL License version 2 |
9 | 9 | ||
10 | 10 | ||
11 | import difflib | ||
11 | import os | 12 | import os |
12 | import re | 13 | import re |
14 | import signal | ||
13 | import sys | 15 | import sys |
14 | from subprocess import Popen, PIPE, STDOUT | 16 | from multiprocessing import Pool, cpu_count |
15 | from optparse import OptionParser | 17 | from optparse import OptionParser |
18 | from subprocess import Popen, PIPE, STDOUT | ||
16 | 19 | ||
17 | 20 | ||
18 | # regex expressions | 21 | # regex expressions |
@@ -26,7 +29,7 @@ SOURCE_FEATURE = r"(?:\W|\b)+[D]{,1}CONFIG_(" + FEATURE + r")" | |||
26 | 29 | ||
27 | # regex objects | 30 | # regex objects |
28 | REGEX_FILE_KCONFIG = re.compile(r".*Kconfig[\.\w+\-]*$") | 31 | REGEX_FILE_KCONFIG = re.compile(r".*Kconfig[\.\w+\-]*$") |
29 | REGEX_FEATURE = re.compile(r'(?!\B"[^"]*)' + FEATURE + r'(?![^"]*"\B)') | 32 | REGEX_FEATURE = re.compile(r'(?!\B)' + FEATURE + r'(?!\B)') |
30 | REGEX_SOURCE_FEATURE = re.compile(SOURCE_FEATURE) | 33 | REGEX_SOURCE_FEATURE = re.compile(SOURCE_FEATURE) |
31 | REGEX_KCONFIG_DEF = re.compile(DEF) | 34 | REGEX_KCONFIG_DEF = re.compile(DEF) |
32 | REGEX_KCONFIG_EXPR = re.compile(EXPR) | 35 | REGEX_KCONFIG_EXPR = re.compile(EXPR) |
@@ -34,6 +37,7 @@ REGEX_KCONFIG_STMT = re.compile(STMT) | |||
34 | REGEX_KCONFIG_HELP = re.compile(r"^\s+(help|---help---)\s*$") | 37 | REGEX_KCONFIG_HELP = re.compile(r"^\s+(help|---help---)\s*$") |
35 | REGEX_FILTER_FEATURES = re.compile(r"[A-Za-z0-9]$") | 38 | REGEX_FILTER_FEATURES = re.compile(r"[A-Za-z0-9]$") |
36 | REGEX_NUMERIC = re.compile(r"0[xX][0-9a-fA-F]+|[0-9]+") | 39 | REGEX_NUMERIC = re.compile(r"0[xX][0-9a-fA-F]+|[0-9]+") |
40 | REGEX_QUOTES = re.compile("(\"(.*?)\")") | ||
37 | 41 | ||
38 | 42 | ||
39 | def parse_options(): | 43 | def parse_options(): |
@@ -71,6 +75,9 @@ def parse_options(): | |||
71 | "the pattern needs to be a Python regex. To " | 75 | "the pattern needs to be a Python regex. To " |
72 | "ignore defconfigs, specify -i '.*defconfig'.") | 76 | "ignore defconfigs, specify -i '.*defconfig'.") |
73 | 77 | ||
78 | parser.add_option('-s', '--sim', dest='sim', action='store', default="", | ||
79 | help="Print a list of maximum 10 string-similar symbols.") | ||
80 | |||
74 | parser.add_option('', '--force', dest='force', action='store_true', | 81 | parser.add_option('', '--force', dest='force', action='store_true', |
75 | default=False, | 82 | default=False, |
76 | help="Reset current Git tree even when it's dirty.") | 83 | help="Reset current Git tree even when it's dirty.") |
@@ -109,6 +116,18 @@ def main(): | |||
109 | """Main function of this module.""" | 116 | """Main function of this module.""" |
110 | opts = parse_options() | 117 | opts = parse_options() |
111 | 118 | ||
119 | if opts.sim and not opts.commit and not opts.diff: | ||
120 | sims = find_sims(opts.sim, opts.ignore) | ||
121 | if sims: | ||
122 | print "%s: %s" % (yel("Similar symbols"), ', '.join(sims)) | ||
123 | else: | ||
124 | print "%s: no similar symbols found" % yel("Similar symbols") | ||
125 | sys.exit(0) | ||
126 | |||
127 | # dictionary of (un)defined symbols | ||
128 | defined = {} | ||
129 | undefined = {} | ||
130 | |||
112 | if opts.commit or opts.diff: | 131 | if opts.commit or opts.diff: |
113 | head = get_head() | 132 | head = get_head() |
114 | 133 | ||
@@ -127,40 +146,56 @@ def main(): | |||
127 | 146 | ||
128 | # get undefined items before the commit | 147 | # get undefined items before the commit |
129 | execute("git reset --hard %s" % commit_a) | 148 | execute("git reset --hard %s" % commit_a) |
130 | undefined_a = check_symbols(opts.ignore) | 149 | undefined_a, _ = check_symbols(opts.ignore) |
131 | 150 | ||
132 | # get undefined items for the commit | 151 | # get undefined items for the commit |
133 | execute("git reset --hard %s" % commit_b) | 152 | execute("git reset --hard %s" % commit_b) |
134 | undefined_b = check_symbols(opts.ignore) | 153 | undefined_b, defined = check_symbols(opts.ignore) |
135 | 154 | ||
136 | # report cases that are present for the commit but not before | 155 | # report cases that are present for the commit but not before |
137 | for feature in sorted(undefined_b): | 156 | for feature in sorted(undefined_b): |
138 | # feature has not been undefined before | 157 | # feature has not been undefined before |
139 | if not feature in undefined_a: | 158 | if not feature in undefined_a: |
140 | files = sorted(undefined_b.get(feature)) | 159 | files = sorted(undefined_b.get(feature)) |
141 | print "%s\t%s" % (yel(feature), ", ".join(files)) | 160 | undefined[feature] = files |
142 | if opts.find: | ||
143 | commits = find_commits(feature, opts.diff) | ||
144 | print red(commits) | ||
145 | # check if there are new files that reference the undefined feature | 161 | # check if there are new files that reference the undefined feature |
146 | else: | 162 | else: |
147 | files = sorted(undefined_b.get(feature) - | 163 | files = sorted(undefined_b.get(feature) - |
148 | undefined_a.get(feature)) | 164 | undefined_a.get(feature)) |
149 | if files: | 165 | if files: |
150 | print "%s\t%s" % (yel(feature), ", ".join(files)) | 166 | undefined[feature] = files |
151 | if opts.find: | ||
152 | commits = find_commits(feature, opts.diff) | ||
153 | print red(commits) | ||
154 | 167 | ||
155 | # reset to head | 168 | # reset to head |
156 | execute("git reset --hard %s" % head) | 169 | execute("git reset --hard %s" % head) |
157 | 170 | ||
158 | # default to check the entire tree | 171 | # default to check the entire tree |
159 | else: | 172 | else: |
160 | undefined = check_symbols(opts.ignore) | 173 | undefined, defined = check_symbols(opts.ignore) |
161 | for feature in sorted(undefined): | 174 | |
162 | files = sorted(undefined.get(feature)) | 175 | # now print the output |
163 | print "%s\t%s" % (yel(feature), ", ".join(files)) | 176 | for feature in sorted(undefined): |
177 | print red(feature) | ||
178 | |||
179 | files = sorted(undefined.get(feature)) | ||
180 | print "%s: %s" % (yel("Referencing files"), ", ".join(files)) | ||
181 | |||
182 | sims = find_sims(feature, opts.ignore, defined) | ||
183 | sims_out = yel("Similar symbols") | ||
184 | if sims: | ||
185 | print "%s: %s" % (sims_out, ', '.join(sims)) | ||
186 | else: | ||
187 | print "%s: %s" % (sims_out, "no similar symbols found") | ||
188 | |||
189 | if opts.find: | ||
190 | print "%s:" % yel("Commits changing symbol") | ||
191 | commits = find_commits(feature, opts.diff) | ||
192 | if commits: | ||
193 | for commit in commits: | ||
194 | commit = commit.split(" ", 1) | ||
195 | print "\t- %s (\"%s\")" % (yel(commit[0]), commit[1]) | ||
196 | else: | ||
197 | print "\t- no commit found" | ||
198 | print # new line | ||
164 | 199 | ||
165 | 200 | ||
166 | def yel(string): | 201 | def yel(string): |
@@ -190,7 +225,7 @@ def find_commits(symbol, diff): | |||
190 | """Find commits changing %symbol in the given range of %diff.""" | 225 | """Find commits changing %symbol in the given range of %diff.""" |
191 | commits = execute("git log --pretty=oneline --abbrev-commit -G %s %s" | 226 | commits = execute("git log --pretty=oneline --abbrev-commit -G %s %s" |
192 | % (symbol, diff)) | 227 | % (symbol, diff)) |
193 | return commits | 228 | return [x for x in commits.split("\n") if x] |
194 | 229 | ||
195 | 230 | ||
196 | def tree_is_dirty(): | 231 | def tree_is_dirty(): |
@@ -209,43 +244,107 @@ def get_head(): | |||
209 | return stdout.strip('\n') | 244 | return stdout.strip('\n') |
210 | 245 | ||
211 | 246 | ||
212 | def check_symbols(ignore): | 247 | def partition(lst, size): |
213 | """Find undefined Kconfig symbols and return a dict with the symbol as key | 248 | """Partition list @lst into eveni-sized lists of size @size.""" |
214 | and a list of referencing files as value. Files matching %ignore are not | 249 | return [lst[i::size] for i in xrange(size)] |
215 | checked for undefined symbols.""" | 250 | |
216 | source_files = [] | 251 | |
217 | kconfig_files = [] | 252 | def init_worker(): |
218 | defined_features = set() | 253 | """Set signal handler to ignore SIGINT.""" |
219 | referenced_features = dict() # {feature: [files]} | 254 | signal.signal(signal.SIGINT, signal.SIG_IGN) |
255 | |||
256 | |||
257 | def find_sims(symbol, ignore, defined = []): | ||
258 | """Return a list of max. ten Kconfig symbols that are string-similar to | ||
259 | @symbol.""" | ||
260 | if defined: | ||
261 | return sorted(difflib.get_close_matches(symbol, set(defined), 10)) | ||
262 | |||
263 | pool = Pool(cpu_count(), init_worker) | ||
264 | kfiles = [] | ||
265 | for gitfile in get_files(): | ||
266 | if REGEX_FILE_KCONFIG.match(gitfile): | ||
267 | kfiles.append(gitfile) | ||
220 | 268 | ||
269 | arglist = [] | ||
270 | for part in partition(kfiles, cpu_count()): | ||
271 | arglist.append((part, ignore)) | ||
272 | |||
273 | for res in pool.map(parse_kconfig_files, arglist): | ||
274 | defined.extend(res[0]) | ||
275 | |||
276 | return sorted(difflib.get_close_matches(symbol, set(defined), 10)) | ||
277 | |||
278 | |||
279 | def get_files(): | ||
280 | """Return a list of all files in the current git directory.""" | ||
221 | # use 'git ls-files' to get the worklist | 281 | # use 'git ls-files' to get the worklist |
222 | stdout = execute("git ls-files") | 282 | stdout = execute("git ls-files") |
223 | if len(stdout) > 0 and stdout[-1] == "\n": | 283 | if len(stdout) > 0 and stdout[-1] == "\n": |
224 | stdout = stdout[:-1] | 284 | stdout = stdout[:-1] |
225 | 285 | ||
286 | files = [] | ||
226 | for gitfile in stdout.rsplit("\n"): | 287 | for gitfile in stdout.rsplit("\n"): |
227 | if ".git" in gitfile or "ChangeLog" in gitfile or \ | 288 | if ".git" in gitfile or "ChangeLog" in gitfile or \ |
228 | ".log" in gitfile or os.path.isdir(gitfile) or \ | 289 | ".log" in gitfile or os.path.isdir(gitfile) or \ |
229 | gitfile.startswith("tools/"): | 290 | gitfile.startswith("tools/"): |
230 | continue | 291 | continue |
292 | files.append(gitfile) | ||
293 | return files | ||
294 | |||
295 | |||
296 | def check_symbols(ignore): | ||
297 | """Find undefined Kconfig symbols and return a dict with the symbol as key | ||
298 | and a list of referencing files as value. Files matching %ignore are not | ||
299 | checked for undefined symbols.""" | ||
300 | pool = Pool(cpu_count(), init_worker) | ||
301 | try: | ||
302 | return check_symbols_helper(pool, ignore) | ||
303 | except KeyboardInterrupt: | ||
304 | pool.terminate() | ||
305 | pool.join() | ||
306 | sys.exit(1) | ||
307 | |||
308 | |||
309 | def check_symbols_helper(pool, ignore): | ||
310 | """Helper method for check_symbols(). Used to catch keyboard interrupts in | ||
311 | check_symbols() in order to properly terminate running worker processes.""" | ||
312 | source_files = [] | ||
313 | kconfig_files = [] | ||
314 | defined_features = [] | ||
315 | referenced_features = dict() # {file: [features]} | ||
316 | |||
317 | for gitfile in get_files(): | ||
231 | if REGEX_FILE_KCONFIG.match(gitfile): | 318 | if REGEX_FILE_KCONFIG.match(gitfile): |
232 | kconfig_files.append(gitfile) | 319 | kconfig_files.append(gitfile) |
233 | else: | 320 | else: |
234 | # all non-Kconfig files are checked for consistency | 321 | if ignore and not re.match(ignore, gitfile): |
322 | continue | ||
323 | # add source files that do not match the ignore pattern | ||
235 | source_files.append(gitfile) | 324 | source_files.append(gitfile) |
236 | 325 | ||
237 | for sfile in source_files: | 326 | # parse source files |
238 | if ignore and re.match(ignore, sfile): | 327 | arglist = partition(source_files, cpu_count()) |
239 | # do not check files matching %ignore | 328 | for res in pool.map(parse_source_files, arglist): |
240 | continue | 329 | referenced_features.update(res) |
241 | parse_source_file(sfile, referenced_features) | ||
242 | 330 | ||
243 | for kfile in kconfig_files: | 331 | |
244 | if ignore and re.match(ignore, kfile): | 332 | # parse kconfig files |
245 | # do not collect references for files matching %ignore | 333 | arglist = [] |
246 | parse_kconfig_file(kfile, defined_features, dict()) | 334 | for part in partition(kconfig_files, cpu_count()): |
247 | else: | 335 | arglist.append((part, ignore)) |
248 | parse_kconfig_file(kfile, defined_features, referenced_features) | 336 | for res in pool.map(parse_kconfig_files, arglist): |
337 | defined_features.extend(res[0]) | ||
338 | referenced_features.update(res[1]) | ||
339 | defined_features = set(defined_features) | ||
340 | |||
341 | # inverse mapping of referenced_features to dict(feature: [files]) | ||
342 | inv_map = dict() | ||
343 | for _file, features in referenced_features.iteritems(): | ||
344 | for feature in features: | ||
345 | inv_map[feature] = inv_map.get(feature, set()) | ||
346 | inv_map[feature].add(_file) | ||
347 | referenced_features = inv_map | ||
249 | 348 | ||
250 | undefined = {} # {feature: [files]} | 349 | undefined = {} # {feature: [files]} |
251 | for feature in sorted(referenced_features): | 350 | for feature in sorted(referenced_features): |
@@ -259,12 +358,26 @@ def check_symbols(ignore): | |||
259 | if feature[:-len("_MODULE")] in defined_features: | 358 | if feature[:-len("_MODULE")] in defined_features: |
260 | continue | 359 | continue |
261 | undefined[feature] = referenced_features.get(feature) | 360 | undefined[feature] = referenced_features.get(feature) |
262 | return undefined | 361 | return undefined, defined_features |
263 | 362 | ||
264 | 363 | ||
265 | def parse_source_file(sfile, referenced_features): | 364 | def parse_source_files(source_files): |
266 | """Parse @sfile for referenced Kconfig features.""" | 365 | """Parse each source file in @source_files and return dictionary with source |
366 | files as keys and lists of references Kconfig symbols as values.""" | ||
367 | referenced_features = dict() | ||
368 | for sfile in source_files: | ||
369 | referenced_features[sfile] = parse_source_file(sfile) | ||
370 | return referenced_features | ||
371 | |||
372 | |||
373 | def parse_source_file(sfile): | ||
374 | """Parse @sfile and return a list of referenced Kconfig features.""" | ||
267 | lines = [] | 375 | lines = [] |
376 | references = [] | ||
377 | |||
378 | if not os.path.exists(sfile): | ||
379 | return references | ||
380 | |||
268 | with open(sfile, "r") as stream: | 381 | with open(sfile, "r") as stream: |
269 | lines = stream.readlines() | 382 | lines = stream.readlines() |
270 | 383 | ||
@@ -275,9 +388,9 @@ def parse_source_file(sfile, referenced_features): | |||
275 | for feature in features: | 388 | for feature in features: |
276 | if not REGEX_FILTER_FEATURES.search(feature): | 389 | if not REGEX_FILTER_FEATURES.search(feature): |
277 | continue | 390 | continue |
278 | sfiles = referenced_features.get(feature, set()) | 391 | references.append(feature) |
279 | sfiles.add(sfile) | 392 | |
280 | referenced_features[feature] = sfiles | 393 | return references |
281 | 394 | ||
282 | 395 | ||
283 | def get_features_in_line(line): | 396 | def get_features_in_line(line): |
@@ -285,11 +398,35 @@ def get_features_in_line(line): | |||
285 | return REGEX_FEATURE.findall(line) | 398 | return REGEX_FEATURE.findall(line) |
286 | 399 | ||
287 | 400 | ||
288 | def parse_kconfig_file(kfile, defined_features, referenced_features): | 401 | def parse_kconfig_files(args): |
402 | """Parse kconfig files and return tuple of defined and references Kconfig | ||
403 | symbols. Note, @args is a tuple of a list of files and the @ignore | ||
404 | pattern.""" | ||
405 | kconfig_files = args[0] | ||
406 | ignore = args[1] | ||
407 | defined_features = [] | ||
408 | referenced_features = dict() | ||
409 | |||
410 | for kfile in kconfig_files: | ||
411 | defined, references = parse_kconfig_file(kfile) | ||
412 | defined_features.extend(defined) | ||
413 | if ignore and re.match(ignore, kfile): | ||
414 | # do not collect references for files that match the ignore pattern | ||
415 | continue | ||
416 | referenced_features[kfile] = references | ||
417 | return (defined_features, referenced_features) | ||
418 | |||
419 | |||
420 | def parse_kconfig_file(kfile): | ||
289 | """Parse @kfile and update feature definitions and references.""" | 421 | """Parse @kfile and update feature definitions and references.""" |
290 | lines = [] | 422 | lines = [] |
423 | defined = [] | ||
424 | references = [] | ||
291 | skip = False | 425 | skip = False |
292 | 426 | ||
427 | if not os.path.exists(kfile): | ||
428 | return defined, references | ||
429 | |||
293 | with open(kfile, "r") as stream: | 430 | with open(kfile, "r") as stream: |
294 | lines = stream.readlines() | 431 | lines = stream.readlines() |
295 | 432 | ||
@@ -300,7 +437,7 @@ def parse_kconfig_file(kfile, defined_features, referenced_features): | |||
300 | 437 | ||
301 | if REGEX_KCONFIG_DEF.match(line): | 438 | if REGEX_KCONFIG_DEF.match(line): |
302 | feature_def = REGEX_KCONFIG_DEF.findall(line) | 439 | feature_def = REGEX_KCONFIG_DEF.findall(line) |
303 | defined_features.add(feature_def[0]) | 440 | defined.append(feature_def[0]) |
304 | skip = False | 441 | skip = False |
305 | elif REGEX_KCONFIG_HELP.match(line): | 442 | elif REGEX_KCONFIG_HELP.match(line): |
306 | skip = True | 443 | skip = True |
@@ -308,6 +445,7 @@ def parse_kconfig_file(kfile, defined_features, referenced_features): | |||
308 | # ignore content of help messages | 445 | # ignore content of help messages |
309 | pass | 446 | pass |
310 | elif REGEX_KCONFIG_STMT.match(line): | 447 | elif REGEX_KCONFIG_STMT.match(line): |
448 | line = REGEX_QUOTES.sub("", line) | ||
311 | features = get_features_in_line(line) | 449 | features = get_features_in_line(line) |
312 | # multi-line statements | 450 | # multi-line statements |
313 | while line.endswith("\\"): | 451 | while line.endswith("\\"): |
@@ -319,9 +457,9 @@ def parse_kconfig_file(kfile, defined_features, referenced_features): | |||
319 | if REGEX_NUMERIC.match(feature): | 457 | if REGEX_NUMERIC.match(feature): |
320 | # ignore numeric values | 458 | # ignore numeric values |
321 | continue | 459 | continue |
322 | paths = referenced_features.get(feature, set()) | 460 | references.append(feature) |
323 | paths.add(kfile) | 461 | |
324 | referenced_features[feature] = paths | 462 | return defined, references |
325 | 463 | ||
326 | 464 | ||
327 | if __name__ == "__main__": | 465 | if __name__ == "__main__": |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 638a38e1b419..c37255bb620d 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -1816,6 +1816,8 @@ sub dump_struct($$) { | |||
1816 | $members =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//i; | 1816 | $members =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//i; |
1817 | $members =~ s/__aligned\s*\([^;]*\)//gos; | 1817 | $members =~ s/__aligned\s*\([^;]*\)//gos; |
1818 | $members =~ s/\s*CRYPTO_MINALIGN_ATTR//gos; | 1818 | $members =~ s/\s*CRYPTO_MINALIGN_ATTR//gos; |
1819 | # replace DECLARE_BITMAP | ||
1820 | $members =~ s/DECLARE_BITMAP\s*\(([^,)]+), ([^,)]+)\)/unsigned long $1\[BITS_TO_LONGS($2)\]/gos; | ||
1819 | 1821 | ||
1820 | create_parameterlist($members, ';', $file); | 1822 | create_parameterlist($members, ';', $file); |
1821 | check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); | 1823 | check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); |
@@ -1844,7 +1846,8 @@ sub dump_enum($$) { | |||
1844 | my $file = shift; | 1846 | my $file = shift; |
1845 | 1847 | ||
1846 | $x =~ s@/\*.*?\*/@@gos; # strip comments. | 1848 | $x =~ s@/\*.*?\*/@@gos; # strip comments. |
1847 | $x =~ s/^#\s*define\s+.*$//; # strip #define macros inside enums | 1849 | # strip #define macros inside enums |
1850 | $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos; | ||
1848 | 1851 | ||
1849 | if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { | 1852 | if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { |
1850 | $declaration_name = $1; | 1853 | $declaration_name = $1; |
diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh index 198580d245e0..d154f0877fd8 100755 --- a/scripts/ld-version.sh +++ b/scripts/ld-version.sh | |||
@@ -2,7 +2,9 @@ | |||
2 | # extract linker version number from stdin and turn into single number | 2 | # extract linker version number from stdin and turn into single number |
3 | { | 3 | { |
4 | gsub(".*)", ""); | 4 | gsub(".*)", ""); |
5 | gsub(".*version ", ""); | ||
6 | gsub("-.*", ""); | ||
5 | split($1,a, "."); | 7 | split($1,a, "."); |
6 | print a[1]*10000000 + a[2]*100000 + a[3]*10000 + a[4]*100 + a[5]; | 8 | print a[1]*100000000 + a[2]*1000000 + a[3]*10000 + a[4]*100 + a[5]; |
7 | exit | 9 | exit |
8 | } | 10 | } |
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index dacf71a43ad4..ba6c34ea5429 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh | |||
@@ -62,7 +62,7 @@ vmlinux_link() | |||
62 | -Wl,--start-group \ | 62 | -Wl,--start-group \ |
63 | ${KBUILD_VMLINUX_MAIN} \ | 63 | ${KBUILD_VMLINUX_MAIN} \ |
64 | -Wl,--end-group \ | 64 | -Wl,--end-group \ |
65 | -lutil -lrt ${1} | 65 | -lutil -lrt -lpthread ${1} |
66 | rm -f linux | 66 | rm -f linux |
67 | fi | 67 | fi |
68 | } | 68 | } |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 5b96206e9aab..161dd0d67da8 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -125,7 +125,7 @@ do { \ | |||
125 | sprintf(str + strlen(str), "*"); \ | 125 | sprintf(str + strlen(str), "*"); \ |
126 | } while(0) | 126 | } while(0) |
127 | 127 | ||
128 | /* Always end in a wildcard, for future extension */ | 128 | /* End in a wildcard, for future extension */ |
129 | static inline void add_wildcard(char *str) | 129 | static inline void add_wildcard(char *str) |
130 | { | 130 | { |
131 | int len = strlen(str); | 131 | int len = strlen(str); |
@@ -704,7 +704,6 @@ static int do_of_entry (const char *filename, void *symval, char *alias) | |||
704 | if (isspace (*tmp)) | 704 | if (isspace (*tmp)) |
705 | *tmp = '_'; | 705 | *tmp = '_'; |
706 | 706 | ||
707 | add_wildcard(alias); | ||
708 | return 1; | 707 | return 1; |
709 | } | 708 | } |
710 | ADD_TO_DEVTABLE("of", of_device_id, do_of_entry); | 709 | ADD_TO_DEVTABLE("of", of_device_id, do_of_entry); |
@@ -917,7 +916,7 @@ static int do_vmbus_entry(const char *filename, void *symval, | |||
917 | char guid_name[(sizeof(*guid) + 1) * 2]; | 916 | char guid_name[(sizeof(*guid) + 1) * 2]; |
918 | 917 | ||
919 | for (i = 0; i < (sizeof(*guid) * 2); i += 2) | 918 | for (i = 0; i < (sizeof(*guid) * 2); i += 2) |
920 | sprintf(&guid_name[i], "%02x", TO_NATIVE((*guid)[i/2])); | 919 | sprintf(&guid_name[i], "%02x", TO_NATIVE((guid->b)[i/2])); |
921 | 920 | ||
922 | strcpy(alias, "vmbus:"); | 921 | strcpy(alias, "vmbus:"); |
923 | strcat(alias, guid_name); | 922 | strcat(alias, guid_name); |
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 826470d7f000..96e2486a6fc4 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
@@ -263,7 +263,8 @@ if ($arch eq "x86_64") { | |||
263 | 263 | ||
264 | } elsif ($arch eq "powerpc") { | 264 | } elsif ($arch eq "powerpc") { |
265 | $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)"; | 265 | $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)"; |
266 | $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?.*?)>:"; | 266 | # See comment in the sparc64 section for why we use '\w'. |
267 | $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?\\w*?)>:"; | ||
267 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$"; | 268 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$"; |
268 | 269 | ||
269 | if ($bits == 64) { | 270 | if ($bits == 64) { |
diff --git a/scripts/tags.sh b/scripts/tags.sh index 262889046703..76f131ebc192 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
@@ -193,7 +193,6 @@ exuberant() | |||
193 | --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ | 193 | --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ |
194 | --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ | 194 | --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ |
195 | --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ | 195 | --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ |
196 | --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ | ||
197 | --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \ | 196 | --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \ |
198 | --regex-c++='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ | 197 | --regex-c++='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ |
199 | --regex-c++='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ | 198 | --regex-c++='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ |
@@ -260,7 +259,6 @@ emacs() | |||
260 | --regex='/CLEARPAGEFLAG_NOOP(\([^,)]*\).*/ClearPage\1/' \ | 259 | --regex='/CLEARPAGEFLAG_NOOP(\([^,)]*\).*/ClearPage\1/' \ |
261 | --regex='/__CLEARPAGEFLAG_NOOP(\([^,)]*\).*/__ClearPage\1/' \ | 260 | --regex='/__CLEARPAGEFLAG_NOOP(\([^,)]*\).*/__ClearPage\1/' \ |
262 | --regex='/TESTCLEARFLAG_FALSE(\([^,)]*\).*/TestClearPage\1/' \ | 261 | --regex='/TESTCLEARFLAG_FALSE(\([^,)]*\).*/TestClearPage\1/' \ |
263 | --regex='/__TESTCLEARFLAG_FALSE(\([^,)]*\).*/__TestClearPage\1/' \ | ||
264 | --regex='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ | 262 | --regex='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ |
265 | --regex='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ | 263 | --regex='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ |
266 | --regex='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/' \ | 264 | --regex='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/' \ |