diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-05-24 04:13:01 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-05-24 04:13:01 -0400 |
| commit | e644dae645e167d154c0526358940986682a72b0 (patch) | |
| tree | 972993c6568085b8d407fc7e13de10f4b93c651d /scripts | |
| parent | 899c612d74d4a242158a4db20367388d6299c028 (diff) | |
| parent | 86809173ce32ef03bd4d0389dfc72df0c805e9c4 (diff) | |
Merge branch 'next' into for-linus
Diffstat (limited to 'scripts')
27 files changed, 1064 insertions, 112 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index d897278b1f97..6a3ee981931d 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
| @@ -104,7 +104,7 @@ as-option = $(call try-run,\ | |||
| 104 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) | 104 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) |
| 105 | 105 | ||
| 106 | as-instr = $(call try-run,\ | 106 | as-instr = $(call try-run,\ |
| 107 | /bin/echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) | 107 | printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) |
| 108 | 108 | ||
| 109 | # cc-option | 109 | # cc-option |
| 110 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) | 110 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index d2b366c16b64..ff1720d28d0c 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
| @@ -69,6 +69,7 @@ warning-1 += -Wmissing-prototypes | |||
| 69 | warning-1 += -Wold-style-definition | 69 | warning-1 += -Wold-style-definition |
| 70 | warning-1 += $(call cc-option, -Wmissing-include-dirs) | 70 | warning-1 += $(call cc-option, -Wmissing-include-dirs) |
| 71 | warning-1 += $(call cc-option, -Wunused-but-set-variable) | 71 | warning-1 += $(call cc-option, -Wunused-but-set-variable) |
| 72 | warning-1 += $(call cc-disable-warning, missing-field-initializers) | ||
| 72 | 73 | ||
| 73 | warning-2 := -Waggregate-return | 74 | warning-2 := -Waggregate-return |
| 74 | warning-2 += -Wcast-align | 75 | warning-2 += -Wcast-align |
| @@ -76,6 +77,7 @@ warning-2 += -Wdisabled-optimization | |||
| 76 | warning-2 += -Wnested-externs | 77 | warning-2 += -Wnested-externs |
| 77 | warning-2 += -Wshadow | 78 | warning-2 += -Wshadow |
| 78 | warning-2 += $(call cc-option, -Wlogical-op) | 79 | warning-2 += $(call cc-option, -Wlogical-op) |
| 80 | warning-2 += $(call cc-option, -Wmissing-field-initializers) | ||
| 79 | 81 | ||
| 80 | warning-3 := -Wbad-function-cast | 82 | warning-3 := -Wbad-function-cast |
| 81 | warning-3 += -Wcast-qual | 83 | warning-3 += -Wcast-qual |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 00c368c6e996..0be6f110cce7 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
| @@ -304,6 +304,30 @@ cmd_lzo = (cat $(filter-out FORCE,$^) | \ | |||
| 304 | lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | 304 | lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ |
| 305 | (rm -f $@ ; false) | 305 | (rm -f $@ ; false) |
| 306 | 306 | ||
| 307 | # U-Boot mkimage | ||
| 308 | # --------------------------------------------------------------------------- | ||
| 309 | |||
| 310 | MKIMAGE := $(srctree)/scripts/mkuboot.sh | ||
| 311 | |||
| 312 | # SRCARCH just happens to match slightly more than ARCH (on sparc), so reduces | ||
| 313 | # the number of overrides in arch makefiles | ||
| 314 | UIMAGE_ARCH ?= $(SRCARCH) | ||
| 315 | UIMAGE_COMPRESSION ?= $(if $(2),$(2),none) | ||
| 316 | UIMAGE_OPTS-y ?= | ||
| 317 | UIMAGE_TYPE ?= kernel | ||
| 318 | UIMAGE_LOADADDR ?= arch_must_set_this | ||
| 319 | UIMAGE_ENTRYADDR ?= $(UIMAGE_LOADADDR) | ||
| 320 | UIMAGE_NAME ?= 'Linux-$(KERNELRELEASE)' | ||
| 321 | UIMAGE_IN ?= $< | ||
| 322 | UIMAGE_OUT ?= $@ | ||
| 323 | |||
| 324 | quiet_cmd_uimage = UIMAGE $(UIMAGE_OUT) | ||
| 325 | cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(UIMAGE_ARCH) -O linux \ | ||
| 326 | -C $(UIMAGE_COMPRESSION) $(UIMAGE_OPTS-y) \ | ||
| 327 | -T $(UIMAGE_TYPE) \ | ||
| 328 | -a $(UIMAGE_LOADADDR) -e $(UIMAGE_ENTRYADDR) \ | ||
| 329 | -n $(UIMAGE_NAME) -d $(UIMAGE_IN) $(UIMAGE_OUT) | ||
| 330 | |||
| 307 | # XZ | 331 | # XZ |
| 308 | # --------------------------------------------------------------------------- | 332 | # --------------------------------------------------------------------------- |
| 309 | # Use xzkern to compress the kernel image and xzmisc to compress other things. | 333 | # Use xzkern to compress the kernel image and xzmisc to compress other things. |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a3b9782441f9..faea0ec612bf 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -323,17 +323,22 @@ sub build_types { | |||
| 323 | }x; | 323 | }x; |
| 324 | $Type = qr{ | 324 | $Type = qr{ |
| 325 | $NonptrType | 325 | $NonptrType |
| 326 | (?:[\s\*]+\s*const|[\s\*]+|(?:\s*\[\s*\])+)? | 326 | (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*|\[\])+|(?:\s*\[\s*\])+)? |
| 327 | (?:\s+$Inline|\s+$Modifier)* | 327 | (?:\s+$Inline|\s+$Modifier)* |
| 328 | }x; | 328 | }x; |
| 329 | $Declare = qr{(?:$Storage\s+)?$Type}; | 329 | $Declare = qr{(?:$Storage\s+)?$Type}; |
| 330 | } | 330 | } |
| 331 | build_types(); | 331 | build_types(); |
| 332 | 332 | ||
| 333 | our $match_balanced_parentheses = qr/(\((?:[^\(\)]+|(-1))*\))/; | ||
| 334 | 333 | ||
| 335 | our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*}; | 334 | our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*}; |
| 336 | our $LvalOrFunc = qr{($Lval)\s*($match_balanced_parentheses{0,1})\s*}; | 335 | |
| 336 | # Using $balanced_parens, $LvalOrFunc, or $FuncArg | ||
| 337 | # requires at least perl version v5.10.0 | ||
| 338 | # Any use must be runtime checked with $^V | ||
| 339 | |||
| 340 | our $balanced_parens = qr/(\((?:[^\(\)]++|(?-1))*\))/; | ||
| 341 | our $LvalOrFunc = qr{($Lval)\s*($balanced_parens{0,1})\s*}; | ||
| 337 | our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant)}; | 342 | our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant)}; |
| 338 | 343 | ||
| 339 | sub deparenthesize { | 344 | sub deparenthesize { |
| @@ -1330,6 +1335,36 @@ sub check_absolute_file { | |||
| 1330 | } | 1335 | } |
| 1331 | } | 1336 | } |
| 1332 | 1337 | ||
| 1338 | sub pos_last_openparen { | ||
| 1339 | my ($line) = @_; | ||
| 1340 | |||
| 1341 | my $pos = 0; | ||
| 1342 | |||
| 1343 | my $opens = $line =~ tr/\(/\(/; | ||
| 1344 | my $closes = $line =~ tr/\)/\)/; | ||
| 1345 | |||
| 1346 | my $last_openparen = 0; | ||
| 1347 | |||
| 1348 | if (($opens == 0) || ($closes >= $opens)) { | ||
| 1349 | return -1; | ||
| 1350 | } | ||
| 1351 | |||
| 1352 | my $len = length($line); | ||
| 1353 | |||
| 1354 | for ($pos = 0; $pos < $len; $pos++) { | ||
| 1355 | my $string = substr($line, $pos); | ||
| 1356 | if ($string =~ /^($FuncArg|$balanced_parens)/) { | ||
| 1357 | $pos += length($1) - 1; | ||
| 1358 | } elsif (substr($line, $pos, 1) eq '(') { | ||
| 1359 | $last_openparen = $pos; | ||
| 1360 | } elsif (index($string, '(') == -1) { | ||
| 1361 | last; | ||
| 1362 | } | ||
| 1363 | } | ||
| 1364 | |||
| 1365 | return $last_openparen + 1; | ||
| 1366 | } | ||
| 1367 | |||
| 1333 | sub process { | 1368 | sub process { |
| 1334 | my $filename = shift; | 1369 | my $filename = shift; |
| 1335 | 1370 | ||
| @@ -1737,6 +1772,21 @@ sub process { | |||
| 1737 | "line over 80 characters\n" . $herecurr); | 1772 | "line over 80 characters\n" . $herecurr); |
| 1738 | } | 1773 | } |
| 1739 | 1774 | ||
| 1775 | # Check for user-visible strings broken across lines, which breaks the ability | ||
| 1776 | # to grep for the string. Limited to strings used as parameters (those | ||
| 1777 | # following an open parenthesis), which almost completely eliminates false | ||
| 1778 | # positives, as well as warning only once per parameter rather than once per | ||
| 1779 | # line of the string. Make an exception when the previous string ends in a | ||
| 1780 | # newline (multiple lines in one string constant) or \n\t (common in inline | ||
| 1781 | # assembly to indent the instruction on the following line). | ||
| 1782 | if ($line =~ /^\+\s*"/ && | ||
| 1783 | $prevline =~ /"\s*$/ && | ||
| 1784 | $prevline =~ /\(/ && | ||
| 1785 | $prevrawline !~ /\\n(?:\\t)*"\s*$/) { | ||
| 1786 | WARN("SPLIT_STRING", | ||
| 1787 | "quoted string split across lines\n" . $hereprev); | ||
| 1788 | } | ||
| 1789 | |||
| 1740 | # check for spaces before a quoted newline | 1790 | # check for spaces before a quoted newline |
| 1741 | if ($rawline =~ /^.*\".*\s\\n/) { | 1791 | if ($rawline =~ /^.*\".*\s\\n/) { |
| 1742 | WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE", | 1792 | WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE", |
| @@ -1783,6 +1833,42 @@ sub process { | |||
| 1783 | "please, no space before tabs\n" . $herevet); | 1833 | "please, no space before tabs\n" . $herevet); |
| 1784 | } | 1834 | } |
| 1785 | 1835 | ||
| 1836 | # check for && or || at the start of a line | ||
| 1837 | if ($rawline =~ /^\+\s*(&&|\|\|)/) { | ||
| 1838 | CHK("LOGICAL_CONTINUATIONS", | ||
| 1839 | "Logical continuations should be on the previous line\n" . $hereprev); | ||
| 1840 | } | ||
| 1841 | |||
| 1842 | # check multi-line statement indentation matches previous line | ||
| 1843 | if ($^V && $^V ge 5.10.0 && | ||
| 1844 | $prevline =~ /^\+(\t*)(if \(|$Ident\().*(\&\&|\|\||,)\s*$/) { | ||
| 1845 | $prevline =~ /^\+(\t*)(.*)$/; | ||
| 1846 | my $oldindent = $1; | ||
| 1847 | my $rest = $2; | ||
| 1848 | |||
| 1849 | my $pos = pos_last_openparen($rest); | ||
| 1850 | if ($pos >= 0) { | ||
| 1851 | $line =~ /^\+([ \t]*)/; | ||
| 1852 | my $newindent = $1; | ||
| 1853 | |||
| 1854 | my $goodtabindent = $oldindent . | ||
| 1855 | "\t" x ($pos / 8) . | ||
| 1856 | " " x ($pos % 8); | ||
| 1857 | my $goodspaceindent = $oldindent . " " x $pos; | ||
| 1858 | |||
| 1859 | if ($newindent ne $goodtabindent && | ||
| 1860 | $newindent ne $goodspaceindent) { | ||
| 1861 | CHK("PARENTHESIS_ALIGNMENT", | ||
| 1862 | "Alignment should match open parenthesis\n" . $hereprev); | ||
| 1863 | } | ||
| 1864 | } | ||
| 1865 | } | ||
| 1866 | |||
| 1867 | if ($line =~ /^\+.*\*[ \t]*\)[ \t]+/) { | ||
| 1868 | CHK("SPACING", | ||
| 1869 | "No space is necessary after a cast\n" . $hereprev); | ||
| 1870 | } | ||
| 1871 | |||
| 1786 | # check for spaces at the beginning of a line. | 1872 | # check for spaces at the beginning of a line. |
| 1787 | # Exceptions: | 1873 | # Exceptions: |
| 1788 | # 1) within comments | 1874 | # 1) within comments |
| @@ -2325,7 +2411,7 @@ sub process { | |||
| 2325 | my ($where, $prefix) = ($-[1], $1); | 2411 | my ($where, $prefix) = ($-[1], $1); |
| 2326 | if ($prefix !~ /$Type\s+$/ && | 2412 | if ($prefix !~ /$Type\s+$/ && |
| 2327 | ($where != 0 || $prefix !~ /^.\s+$/) && | 2413 | ($where != 0 || $prefix !~ /^.\s+$/) && |
| 2328 | $prefix !~ /{\s+$/) { | 2414 | $prefix !~ /[{,]\s+$/) { |
| 2329 | ERROR("BRACKET_SPACE", | 2415 | ERROR("BRACKET_SPACE", |
| 2330 | "space prohibited before open square bracket '['\n" . $herecurr); | 2416 | "space prohibited before open square bracket '['\n" . $herecurr); |
| 2331 | } | 2417 | } |
| @@ -2828,6 +2914,12 @@ sub process { | |||
| 2828 | { | 2914 | { |
| 2829 | } | 2915 | } |
| 2830 | 2916 | ||
| 2917 | # Flatten any obvious string concatentation. | ||
| 2918 | while ($dstat =~ s/("X*")\s*$Ident/$1/ || | ||
| 2919 | $dstat =~ s/$Ident\s*("X*")/$1/) | ||
| 2920 | { | ||
| 2921 | } | ||
| 2922 | |||
| 2831 | my $exceptions = qr{ | 2923 | my $exceptions = qr{ |
| 2832 | $Declare| | 2924 | $Declare| |
| 2833 | module_param_named| | 2925 | module_param_named| |
| @@ -2844,7 +2936,8 @@ sub process { | |||
| 2844 | if ($dstat ne '' && | 2936 | if ($dstat ne '' && |
| 2845 | $dstat !~ /^(?:$Ident|-?$Constant),$/ && # 10, // foo(), | 2937 | $dstat !~ /^(?:$Ident|-?$Constant),$/ && # 10, // foo(), |
| 2846 | $dstat !~ /^(?:$Ident|-?$Constant);$/ && # foo(); | 2938 | $dstat !~ /^(?:$Ident|-?$Constant);$/ && # foo(); |
| 2847 | $dstat !~ /^(?:$Ident|-?$Constant)$/ && # 10 // foo() | 2939 | $dstat !~ /^[!~-]?(?:$Ident|$Constant)$/ && # 10 // foo() // !foo // ~foo // -foo |
| 2940 | $dstat !~ /^'X'$/ && # character constants | ||
| 2848 | $dstat !~ /$exceptions/ && | 2941 | $dstat !~ /$exceptions/ && |
| 2849 | $dstat !~ /^\.$Ident\s*=/ && # .foo = | 2942 | $dstat !~ /^\.$Ident\s*=/ && # .foo = |
| 2850 | $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...) | 2943 | $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...) |
| @@ -2888,7 +2981,8 @@ sub process { | |||
| 2888 | #print "chunks<$#chunks> linenr<$linenr> endln<$endln> level<$level>\n"; | 2981 | #print "chunks<$#chunks> linenr<$linenr> endln<$endln> level<$level>\n"; |
| 2889 | #print "APW: <<$chunks[1][0]>><<$chunks[1][1]>>\n"; | 2982 | #print "APW: <<$chunks[1][0]>><<$chunks[1][1]>>\n"; |
| 2890 | if ($#chunks > 0 && $level == 0) { | 2983 | if ($#chunks > 0 && $level == 0) { |
| 2891 | my $allowed = 0; | 2984 | my @allowed = (); |
| 2985 | my $allow = 0; | ||
| 2892 | my $seen = 0; | 2986 | my $seen = 0; |
| 2893 | my $herectx = $here . "\n"; | 2987 | my $herectx = $here . "\n"; |
| 2894 | my $ln = $linenr - 1; | 2988 | my $ln = $linenr - 1; |
| @@ -2899,6 +2993,7 @@ sub process { | |||
| 2899 | my ($whitespace) = ($cond =~ /^((?:\s*\n[+-])*\s*)/s); | 2993 | my ($whitespace) = ($cond =~ /^((?:\s*\n[+-])*\s*)/s); |
| 2900 | my $offset = statement_rawlines($whitespace) - 1; | 2994 | my $offset = statement_rawlines($whitespace) - 1; |
| 2901 | 2995 | ||
| 2996 | $allowed[$allow] = 0; | ||
| 2902 | #print "COND<$cond> whitespace<$whitespace> offset<$offset>\n"; | 2997 | #print "COND<$cond> whitespace<$whitespace> offset<$offset>\n"; |
| 2903 | 2998 | ||
| 2904 | # We have looked at and allowed this specific line. | 2999 | # We have looked at and allowed this specific line. |
| @@ -2911,23 +3006,34 @@ sub process { | |||
| 2911 | 3006 | ||
| 2912 | $seen++ if ($block =~ /^\s*{/); | 3007 | $seen++ if ($block =~ /^\s*{/); |
| 2913 | 3008 | ||
| 2914 | #print "cond<$cond> block<$block> allowed<$allowed>\n"; | 3009 | #print "cond<$cond> block<$block> allowed<$allowed[$allow]>\n"; |
| 2915 | if (statement_lines($cond) > 1) { | 3010 | if (statement_lines($cond) > 1) { |
| 2916 | #print "APW: ALLOWED: cond<$cond>\n"; | 3011 | #print "APW: ALLOWED: cond<$cond>\n"; |
| 2917 | $allowed = 1; | 3012 | $allowed[$allow] = 1; |
| 2918 | } | 3013 | } |
| 2919 | if ($block =~/\b(?:if|for|while)\b/) { | 3014 | if ($block =~/\b(?:if|for|while)\b/) { |
| 2920 | #print "APW: ALLOWED: block<$block>\n"; | 3015 | #print "APW: ALLOWED: block<$block>\n"; |
| 2921 | $allowed = 1; | 3016 | $allowed[$allow] = 1; |
| 2922 | } | 3017 | } |
| 2923 | if (statement_block_size($block) > 1) { | 3018 | if (statement_block_size($block) > 1) { |
| 2924 | #print "APW: ALLOWED: lines block<$block>\n"; | 3019 | #print "APW: ALLOWED: lines block<$block>\n"; |
| 2925 | $allowed = 1; | 3020 | $allowed[$allow] = 1; |
| 2926 | } | 3021 | } |
| 3022 | $allow++; | ||
| 2927 | } | 3023 | } |
| 2928 | if ($seen && !$allowed) { | 3024 | if ($seen) { |
| 2929 | WARN("BRACES", | 3025 | my $sum_allowed = 0; |
| 2930 | "braces {} are not necessary for any arm of this statement\n" . $herectx); | 3026 | foreach (@allowed) { |
| 3027 | $sum_allowed += $_; | ||
| 3028 | } | ||
| 3029 | if ($sum_allowed == 0) { | ||
| 3030 | WARN("BRACES", | ||
| 3031 | "braces {} are not necessary for any arm of this statement\n" . $herectx); | ||
| 3032 | } elsif ($sum_allowed != $allow && | ||
| 3033 | $seen != $allow) { | ||
| 3034 | CHK("BRACES", | ||
| 3035 | "braces {} should be used on all arms of this statement\n" . $herectx); | ||
| 3036 | } | ||
| 2931 | } | 3037 | } |
| 2932 | } | 3038 | } |
| 2933 | } | 3039 | } |
| @@ -3123,6 +3229,12 @@ sub process { | |||
| 3123 | "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr); | 3229 | "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr); |
| 3124 | } | 3230 | } |
| 3125 | 3231 | ||
| 3232 | # Check for __attribute__ format(scanf, prefer __scanf | ||
| 3233 | if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\b/) { | ||
| 3234 | WARN("PREFER_SCANF", | ||
| 3235 | "__scanf(string-index, first-to-check) is preferred over __attribute__((format(scanf, string-index, first-to-check)))\n" . $herecurr); | ||
| 3236 | } | ||
| 3237 | |||
| 3126 | # check for sizeof(&) | 3238 | # check for sizeof(&) |
| 3127 | if ($line =~ /\bsizeof\s*\(\s*\&/) { | 3239 | if ($line =~ /\bsizeof\s*\(\s*\&/) { |
| 3128 | WARN("SIZEOF_ADDRESS", | 3240 | WARN("SIZEOF_ADDRESS", |
| @@ -3136,12 +3248,13 @@ sub process { | |||
| 3136 | } | 3248 | } |
| 3137 | 3249 | ||
| 3138 | # Check for misused memsets | 3250 | # Check for misused memsets |
| 3139 | if (defined $stat && | 3251 | if ($^V && $^V ge 5.10.0 && |
| 3252 | defined $stat && | ||
| 3140 | $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/s) { | 3253 | $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/s) { |
| 3141 | 3254 | ||
| 3142 | my $ms_addr = $2; | 3255 | my $ms_addr = $2; |
| 3143 | my $ms_val = $8; | 3256 | my $ms_val = $7; |
| 3144 | my $ms_size = $14; | 3257 | my $ms_size = $12; |
| 3145 | 3258 | ||
| 3146 | if ($ms_size =~ /^(0x|)0$/i) { | 3259 | if ($ms_size =~ /^(0x|)0$/i) { |
| 3147 | ERROR("MEMSET", | 3260 | ERROR("MEMSET", |
| @@ -3153,17 +3266,18 @@ sub process { | |||
| 3153 | } | 3266 | } |
| 3154 | 3267 | ||
| 3155 | # typecasts on min/max could be min_t/max_t | 3268 | # typecasts on min/max could be min_t/max_t |
| 3156 | if (defined $stat && | 3269 | if ($^V && $^V ge 5.10.0 && |
| 3270 | defined $stat && | ||
| 3157 | $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) { | 3271 | $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) { |
| 3158 | if (defined $2 || defined $8) { | 3272 | if (defined $2 || defined $7) { |
| 3159 | my $call = $1; | 3273 | my $call = $1; |
| 3160 | my $cast1 = deparenthesize($2); | 3274 | my $cast1 = deparenthesize($2); |
| 3161 | my $arg1 = $3; | 3275 | my $arg1 = $3; |
| 3162 | my $cast2 = deparenthesize($8); | 3276 | my $cast2 = deparenthesize($7); |
| 3163 | my $arg2 = $9; | 3277 | my $arg2 = $8; |
| 3164 | my $cast; | 3278 | my $cast; |
| 3165 | 3279 | ||
| 3166 | if ($cast1 ne "" && $cast2 ne "") { | 3280 | if ($cast1 ne "" && $cast2 ne "" && $cast1 ne $cast2) { |
| 3167 | $cast = "$cast1 or $cast2"; | 3281 | $cast = "$cast1 or $cast2"; |
| 3168 | } elsif ($cast1 ne "") { | 3282 | } elsif ($cast1 ne "") { |
| 3169 | $cast = $cast1; | 3283 | $cast = $cast1; |
| @@ -3233,22 +3347,30 @@ sub process { | |||
| 3233 | "__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); | 3347 | "__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); |
| 3234 | } | 3348 | } |
| 3235 | 3349 | ||
| 3350 | # check for use of yield() | ||
| 3351 | if ($line =~ /\byield\s*\(\s*\)/) { | ||
| 3352 | WARN("YIELD", | ||
| 3353 | "Using yield() is generally wrong. See yield() kernel-doc (sched/core.c)\n" . $herecurr); | ||
| 3354 | } | ||
| 3355 | |||
| 3236 | # check for semaphores initialized locked | 3356 | # check for semaphores initialized locked |
| 3237 | if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { | 3357 | if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { |
| 3238 | WARN("CONSIDER_COMPLETION", | 3358 | WARN("CONSIDER_COMPLETION", |
| 3239 | "consider using a completion\n" . $herecurr); | 3359 | "consider using a completion\n" . $herecurr); |
| 3240 | |||
| 3241 | } | 3360 | } |
| 3361 | |||
| 3242 | # recommend kstrto* over simple_strto* and strict_strto* | 3362 | # recommend kstrto* over simple_strto* and strict_strto* |
| 3243 | if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) { | 3363 | if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) { |
| 3244 | WARN("CONSIDER_KSTRTO", | 3364 | WARN("CONSIDER_KSTRTO", |
| 3245 | "$1 is obsolete, use k$3 instead\n" . $herecurr); | 3365 | "$1 is obsolete, use k$3 instead\n" . $herecurr); |
| 3246 | } | 3366 | } |
| 3367 | |||
| 3247 | # check for __initcall(), use device_initcall() explicitly please | 3368 | # check for __initcall(), use device_initcall() explicitly please |
| 3248 | if ($line =~ /^.\s*__initcall\s*\(/) { | 3369 | if ($line =~ /^.\s*__initcall\s*\(/) { |
| 3249 | WARN("USE_DEVICE_INITCALL", | 3370 | WARN("USE_DEVICE_INITCALL", |
| 3250 | "please use device_initcall() instead of __initcall()\n" . $herecurr); | 3371 | "please use device_initcall() instead of __initcall()\n" . $herecurr); |
| 3251 | } | 3372 | } |
| 3373 | |||
| 3252 | # check for various ops structs, ensure they are const. | 3374 | # check for various ops structs, ensure they are const. |
| 3253 | my $struct_ops = qr{acpi_dock_ops| | 3375 | my $struct_ops = qr{acpi_dock_ops| |
| 3254 | address_space_operations| | 3376 | address_space_operations| |
| @@ -3385,6 +3507,12 @@ sub process { | |||
| 3385 | } | 3507 | } |
| 3386 | 3508 | ||
| 3387 | if ($quiet == 0) { | 3509 | if ($quiet == 0) { |
| 3510 | |||
| 3511 | if ($^V lt 5.10.0) { | ||
| 3512 | print("NOTE: perl $^V is not modern enough to detect all possible issues.\n"); | ||
| 3513 | print("An upgrade to at least perl v5.10.0 is suggested.\n\n"); | ||
| 3514 | } | ||
| 3515 | |||
| 3388 | # If there were whitespace errors which cleanpatch can fix | 3516 | # If there were whitespace errors which cleanpatch can fix |
| 3389 | # then suggest that. | 3517 | # then suggest that. |
| 3390 | if ($rpt_cleaners) { | 3518 | if ($rpt_cleaners) { |
| @@ -3394,13 +3522,12 @@ sub process { | |||
| 3394 | } | 3522 | } |
| 3395 | } | 3523 | } |
| 3396 | 3524 | ||
| 3397 | if (keys %ignore_type) { | 3525 | if ($quiet == 0 && keys %ignore_type) { |
| 3398 | print "NOTE: Ignored message types:"; | 3526 | print "NOTE: Ignored message types:"; |
| 3399 | foreach my $ignore (sort keys %ignore_type) { | 3527 | foreach my $ignore (sort keys %ignore_type) { |
| 3400 | print " $ignore"; | 3528 | print " $ignore"; |
| 3401 | } | 3529 | } |
| 3402 | print "\n"; | 3530 | print "\n\n"; |
| 3403 | print "\n" if ($quiet == 0); | ||
| 3404 | } | 3531 | } |
| 3405 | 3532 | ||
| 3406 | if ($clean == 1 && $quiet == 0) { | 3533 | if ($clean == 1 && $quiet == 0) { |
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 | |||
| 14 | virtual context | ||
| 15 | virtual patch | ||
| 16 | virtual org | ||
| 17 | virtual report | ||
| 18 | |||
| 19 | @depends on patch@ | ||
| 20 | expression 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@ | ||
| 27 | expression 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@ | ||
| 34 | expression ptr; | ||
| 35 | position p1; | ||
| 36 | @@ | ||
| 37 | |||
| 38 | * if@p1 (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; | ||
| 39 | |||
| 40 | @r2 depends on !patch@ | ||
| 41 | expression ptr; | ||
| 42 | position p2; | ||
| 43 | @@ | ||
| 44 | |||
| 45 | * if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; | ||
| 46 | |||
| 47 | @script:python depends on org@ | ||
| 48 | p << r1.p1; | ||
| 49 | @@ | ||
| 50 | |||
| 51 | coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") | ||
| 52 | |||
| 53 | |||
| 54 | @script:python depends on org@ | ||
| 55 | p << r2.p2; | ||
| 56 | @@ | ||
| 57 | |||
| 58 | coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") | ||
| 59 | |||
| 60 | @script:python depends on report@ | ||
| 61 | p << r1.p1; | ||
| 62 | @@ | ||
| 63 | |||
| 64 | coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") | ||
| 65 | |||
| 66 | @script:python depends on report@ | ||
| 67 | p << r2.p2; | ||
| 68 | @@ | ||
| 69 | |||
| 70 | coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") | ||
diff --git a/scripts/coccinelle/api/simple_open.cocci b/scripts/coccinelle/api/simple_open.cocci new file mode 100644 index 000000000000..05962f7be155 --- /dev/null +++ b/scripts/coccinelle/api/simple_open.cocci | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | /// This removes an open coded simple_open() function | ||
| 2 | /// and replaces file operations references to the function | ||
| 3 | /// with simple_open() instead. | ||
| 4 | /// | ||
| 5 | // Confidence: High | ||
| 6 | // Comments: | ||
| 7 | // Options: -no_includes -include_headers | ||
| 8 | |||
| 9 | virtual patch | ||
| 10 | virtual report | ||
| 11 | |||
| 12 | @ open depends on patch @ | ||
| 13 | identifier open_f != simple_open; | ||
| 14 | identifier i, f; | ||
| 15 | @@ | ||
| 16 | -int open_f(struct inode *i, struct file *f) | ||
| 17 | -{ | ||
| 18 | ( | ||
| 19 | -if (i->i_private) | ||
| 20 | -f->private_data = i->i_private; | ||
| 21 | | | ||
| 22 | -f->private_data = i->i_private; | ||
| 23 | ) | ||
| 24 | -return 0; | ||
| 25 | -} | ||
| 26 | |||
| 27 | @ has_open depends on open @ | ||
| 28 | identifier fops; | ||
| 29 | identifier open.open_f; | ||
| 30 | @@ | ||
| 31 | struct file_operations fops = { | ||
| 32 | ..., | ||
| 33 | -.open = open_f, | ||
| 34 | +.open = simple_open, | ||
| 35 | ... | ||
| 36 | }; | ||
| 37 | |||
| 38 | @ openr depends on report @ | ||
| 39 | identifier open_f != simple_open; | ||
| 40 | identifier i, f; | ||
| 41 | position p; | ||
| 42 | @@ | ||
| 43 | int open_f@p(struct inode *i, struct file *f) | ||
| 44 | { | ||
| 45 | ( | ||
| 46 | if (i->i_private) | ||
| 47 | f->private_data = i->i_private; | ||
| 48 | | | ||
| 49 | f->private_data = i->i_private; | ||
| 50 | ) | ||
| 51 | return 0; | ||
| 52 | } | ||
| 53 | |||
| 54 | @ has_openr depends on openr @ | ||
| 55 | identifier fops; | ||
| 56 | identifier openr.open_f; | ||
| 57 | position p; | ||
| 58 | @@ | ||
| 59 | struct file_operations fops = { | ||
| 60 | ..., | ||
| 61 | .open = open_f@p, | ||
| 62 | ... | ||
| 63 | }; | ||
| 64 | |||
| 65 | @script:python@ | ||
| 66 | pf << openr.p; | ||
| 67 | ps << has_openr.p; | ||
| 68 | @@ | ||
| 69 | |||
| 70 | coccilib.report.print_report(pf[0],"WARNING opportunity for simple_open, see also structure on line %s"%(ps[0].line)) | ||
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 | |||
| 14 | virtual context | ||
| 15 | virtual org | ||
| 16 | virtual report | ||
| 17 | |||
| 18 | @clk@ | ||
| 19 | expression e; | ||
| 20 | statement S,S1; | ||
| 21 | int ret; | ||
| 22 | position p1,p2,p3; | ||
| 23 | @@ | ||
| 24 | |||
| 25 | e = clk_get@p1(...) | ||
| 26 | ... when != clk_put(e) | ||
| 27 | if (<+...e...+>) S | ||
| 28 | ... when any | ||
| 29 | when != clk_put(e) | ||
| 30 | when != if (...) { ... clk_put(e); ... } | ||
| 31 | ( | ||
| 32 | if (ret == 0) S1 | ||
| 33 | | | ||
| 34 | if (...) | ||
| 35 | { ... | ||
| 36 | return 0; } | ||
| 37 | | | ||
| 38 | if (...) | ||
| 39 | { ... | ||
| 40 | return <+...e...+>; } | ||
| 41 | | | ||
| 42 | *if@p2 (...) | ||
| 43 | { ... when != clk_put(e) | ||
| 44 | when forall | ||
| 45 | return@p3 ...; } | ||
| 46 | ) | ||
| 47 | ... when any | ||
| 48 | clk_put(e); | ||
| 49 | |||
| 50 | @script:python depends on org@ | ||
| 51 | p1 << clk.p1; | ||
| 52 | p2 << clk.p2; | ||
| 53 | p3 << clk.p3; | ||
| 54 | @@ | ||
| 55 | |||
| 56 | cocci.print_main("clk_get",p1) | ||
| 57 | cocci.print_secs("if",p2) | ||
| 58 | cocci.print_secs("needed clk_put",p3) | ||
| 59 | |||
| 60 | @script:python depends on report@ | ||
| 61 | p1 << clk.p1; | ||
| 62 | p2 << clk.p2; | ||
| 63 | p3 << clk.p3; | ||
| 64 | @@ | ||
| 65 | |||
| 66 | msg = "ERROR: missing clk_put; clk_get on line %s and execution via conditional on line %s" % (p1[0].line,p2[0].line) | ||
| 67 | coccilib.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 | |||
| 14 | virtual context | ||
| 15 | virtual org | ||
| 16 | virtual report | ||
| 17 | |||
| 18 | @iom@ | ||
| 19 | expression e; | ||
| 20 | statement S,S1; | ||
| 21 | int ret; | ||
| 22 | position p1,p2,p3; | ||
| 23 | @@ | ||
| 24 | |||
| 25 | e = \(ioremap@p1\|ioremap_nocache@p1\)(...) | ||
| 26 | ... when != iounmap(e) | ||
| 27 | if (<+...e...+>) S | ||
| 28 | ... when any | ||
| 29 | when != iounmap(e) | ||
| 30 | when != if (...) { ... iounmap(e); ... } | ||
| 31 | ( | ||
| 32 | if (ret == 0) S1 | ||
| 33 | | | ||
| 34 | if (...) | ||
| 35 | { ... | ||
| 36 | return 0; } | ||
| 37 | | | ||
| 38 | if (...) | ||
| 39 | { ... | ||
| 40 | return <+...e...+>; } | ||
| 41 | | | ||
| 42 | *if@p2 (...) | ||
| 43 | { ... when != iounmap(e) | ||
| 44 | when forall | ||
| 45 | return@p3 ...; } | ||
| 46 | ) | ||
| 47 | ... when any | ||
| 48 | iounmap(e); | ||
| 49 | |||
| 50 | @script:python depends on org@ | ||
| 51 | p1 << iom.p1; | ||
| 52 | p2 << iom.p2; | ||
| 53 | p3 << iom.p3; | ||
| 54 | @@ | ||
| 55 | |||
| 56 | cocci.print_main("ioremap",p1) | ||
| 57 | cocci.print_secs("if",p2) | ||
| 58 | cocci.print_secs("needed iounmap",p3) | ||
| 59 | |||
| 60 | @script:python depends on report@ | ||
| 61 | p1 << iom.p1; | ||
| 62 | p2 << iom.p2; | ||
| 63 | p3 << iom.p3; | ||
| 64 | @@ | ||
| 65 | |||
| 66 | msg = "ERROR: missing iounmap; ioremap on line %s and execution via conditional on line %s" % (p1[0].line,p2[0].line) | ||
| 67 | coccilib.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 | |||
| 11 | virtual patch | ||
| 12 | virtual context | ||
| 13 | virtual org | ||
| 14 | virtual report | ||
| 15 | |||
| 16 | @depends on patch@ | ||
| 17 | bool t; | ||
| 18 | symbol true; | ||
| 19 | symbol 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@ | ||
| 49 | bool 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@ | ||
| 67 | bool 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@ | ||
| 82 | bool t; | ||
| 83 | position 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@ | ||
| 105 | bool t; | ||
| 106 | position 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@ | ||
| 120 | bool b; | ||
| 121 | position p1,p2; | ||
| 122 | constant 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@ | ||
| 133 | p << r1.p; | ||
| 134 | @@ | ||
| 135 | |||
| 136 | cocci.print_main("WARNING: Comparison to bool",p) | ||
| 137 | |||
| 138 | @script:python depends on org@ | ||
| 139 | p << r2.p; | ||
| 140 | @@ | ||
| 141 | |||
| 142 | cocci.print_main("WARNING: Comparison of bool to 0/1",p) | ||
| 143 | |||
| 144 | @script:python depends on org@ | ||
| 145 | p1 << r3.p1; | ||
| 146 | @@ | ||
| 147 | |||
| 148 | cocci.print_main("WARNING: Assignment of bool to 0/1",p1) | ||
| 149 | |||
| 150 | @script:python depends on org@ | ||
| 151 | p2 << r3.p2; | ||
| 152 | @@ | ||
| 153 | |||
| 154 | cocci.print_main("ERROR: Assignment of bool to non-0/1 constant",p2) | ||
| 155 | |||
| 156 | @script:python depends on report@ | ||
| 157 | p << r1.p; | ||
| 158 | @@ | ||
| 159 | |||
| 160 | coccilib.report.print_report(p[0],"WARNING: Comparison to bool") | ||
| 161 | |||
| 162 | @script:python depends on report@ | ||
| 163 | p << r2.p; | ||
| 164 | @@ | ||
| 165 | |||
| 166 | coccilib.report.print_report(p[0],"WARNING: Comparison of bool to 0/1") | ||
| 167 | |||
| 168 | @script:python depends on report@ | ||
| 169 | p1 << r3.p1; | ||
| 170 | @@ | ||
| 171 | |||
| 172 | coccilib.report.print_report(p1[0],"WARNING: Assignment of bool to 0/1") | ||
| 173 | |||
| 174 | @script:python depends on report@ | ||
| 175 | p2 << r3.p2; | ||
| 176 | @@ | ||
| 177 | |||
| 178 | coccilib.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 | |||
| 11 | virtual org | ||
| 12 | virtual report | ||
| 13 | virtual context | ||
| 14 | |||
| 15 | @r exists@ | ||
| 16 | expression e,e1; | ||
| 17 | constant c; | ||
| 18 | position 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@ | ||
| 28 | p1 << r.p1; | ||
| 29 | p2 << r.p2; | ||
| 30 | @@ | ||
| 31 | |||
| 32 | cocci.print_main("PTR_ERR",p2) | ||
| 33 | cocci.print_secs("assignment",p1) | ||
| 34 | |||
| 35 | @script:python depends on report@ | ||
| 36 | p1 << r.p1; | ||
| 37 | p2 << r.p2; | ||
| 38 | @@ | ||
| 39 | |||
| 40 | msg = "ERROR: PTR_ERR applied after initialization to constant on line %s" % (p1[0].line) | ||
| 41 | coccilib.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 | |||
| 16 | virtual patch | ||
| 17 | virtual context | ||
| 18 | virtual org | ||
| 19 | virtual report | ||
| 20 | |||
| 21 | @initialize:ocaml@ | ||
| 22 | let negtable = Hashtbl.create 101 | ||
| 23 | |||
| 24 | @depends on patch@ | ||
| 25 | expression *E; | ||
| 26 | identifier 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@ | ||
| 49 | expression *E; | ||
| 50 | identifier f; | ||
| 51 | position 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@ | ||
| 69 | p << t1.p; | ||
| 70 | @@ | ||
| 71 | |||
| 72 | coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0") | ||
| 73 | |||
| 74 | @script:python depends on report@ | ||
| 75 | p << t1.p; | ||
| 76 | @@ | ||
| 77 | |||
| 78 | coccilib.report.print_report(p[0], "WARNING comparing pointer to 0") | ||
| 79 | |||
| 80 | // Tests of returned values | ||
| 81 | |||
| 82 | @s@ | ||
| 83 | identifier f; | ||
| 84 | expression E,E1; | ||
| 85 | @@ | ||
| 86 | |||
| 87 | E = f(...) | ||
| 88 | ... when != E = E1 | ||
| 89 | !E | ||
| 90 | |||
| 91 | @script:ocaml depends on s@ | ||
| 92 | f << s.f; | ||
| 93 | @@ | ||
| 94 | |||
| 95 | try let _ = Hashtbl.find negtable f in () | ||
| 96 | with Not_found -> Hashtbl.add negtable f () | ||
| 97 | |||
| 98 | @ r disable is_zero,isnt_zero exists @ | ||
| 99 | expression *E; | ||
| 100 | identifier f; | ||
| 101 | @@ | ||
| 102 | |||
| 103 | E = f(...) | ||
| 104 | ... | ||
| 105 | (E == 0 | ||
| 106 | |E != 0 | ||
| 107 | |0 == E | ||
| 108 | |0 != E | ||
| 109 | ) | ||
| 110 | |||
| 111 | @script:ocaml@ | ||
| 112 | f << r.f; | ||
| 113 | @@ | ||
| 114 | |||
| 115 | try let _ = Hashtbl.find negtable f in () | ||
| 116 | with 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 @ | ||
| 121 | expression *E; | ||
| 122 | expression E1; | ||
| 123 | identifier r.f; | ||
| 124 | @@ | ||
| 125 | |||
| 126 | E = 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 @ | ||
| 145 | expression *E; | ||
| 146 | expression E1; | ||
| 147 | identifier r.f; | ||
| 148 | position p1; | ||
| 149 | position p2; | ||
| 150 | @@ | ||
| 151 | |||
| 152 | E = 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@ | ||
| 167 | p << t2.p1; | ||
| 168 | @@ | ||
| 169 | |||
| 170 | coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0, suggest !E") | ||
| 171 | |||
| 172 | @script:python depends on org@ | ||
| 173 | p << t2.p2; | ||
| 174 | @@ | ||
| 175 | |||
| 176 | coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0") | ||
| 177 | |||
| 178 | @script:python depends on report@ | ||
| 179 | p << t2.p1; | ||
| 180 | @@ | ||
| 181 | |||
| 182 | coccilib.report.print_report(p[0], "WARNING comparing pointer to 0, suggest !E") | ||
| 183 | |||
| 184 | @script:python depends on report@ | ||
| 185 | p << t2.p2; | ||
| 186 | @@ | ||
| 187 | |||
| 188 | coccilib.report.print_report(p[0], "WARNING comparing pointer to 0") | ||
| 189 | |||
| 190 | @ depends on patch disable is_zero,isnt_zero @ | ||
| 191 | expression *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 @ | ||
| 213 | expression *E; | ||
| 214 | position 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@ | ||
| 228 | p << t3.p; | ||
| 229 | @@ | ||
| 230 | |||
| 231 | coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0") | ||
| 232 | |||
| 233 | @script:python depends on report@ | ||
| 234 | p << t3.p; | ||
| 235 | @@ | ||
| 236 | |||
| 237 | coccilib.report.print_report(p[0], "WARNING comparing pointer to 0") | ||
diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c index 451c92d31b19..2ef5e2e3dd38 100644 --- a/scripts/dtc/dtc.c +++ b/scripts/dtc/dtc.c | |||
| @@ -101,7 +101,7 @@ int main(int argc, char *argv[]) | |||
| 101 | const char *outform = "dts"; | 101 | const char *outform = "dts"; |
| 102 | const char *outname = "-"; | 102 | const char *outname = "-"; |
| 103 | const char *depname = NULL; | 103 | const char *depname = NULL; |
| 104 | int force = 0, check = 0, sort = 0; | 104 | int force = 0, sort = 0; |
| 105 | const char *arg; | 105 | const char *arg; |
| 106 | int opt; | 106 | int opt; |
| 107 | FILE *outf = NULL; | 107 | FILE *outf = NULL; |
| @@ -143,9 +143,6 @@ int main(int argc, char *argv[]) | |||
| 143 | case 'f': | 143 | case 'f': |
| 144 | force = 1; | 144 | force = 1; |
| 145 | break; | 145 | break; |
| 146 | case 'c': | ||
| 147 | check = 1; | ||
| 148 | break; | ||
| 149 | case 'q': | 146 | case 'q': |
| 150 | quiet++; | 147 | quiet++; |
| 151 | break; | 148 | break; |
diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c index ead0332c87e1..28d0b2381df6 100644 --- a/scripts/dtc/flattree.c +++ b/scripts/dtc/flattree.c | |||
| @@ -697,7 +697,6 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb) | |||
| 697 | { | 697 | { |
| 698 | struct reserve_info *reservelist = NULL; | 698 | struct reserve_info *reservelist = NULL; |
| 699 | struct reserve_info *new; | 699 | struct reserve_info *new; |
| 700 | const char *p; | ||
| 701 | struct fdt_reserve_entry re; | 700 | struct fdt_reserve_entry re; |
| 702 | 701 | ||
| 703 | /* | 702 | /* |
| @@ -706,7 +705,6 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb) | |||
| 706 | * | 705 | * |
| 707 | * First pass, count entries. | 706 | * First pass, count entries. |
| 708 | */ | 707 | */ |
| 709 | p = inb->ptr; | ||
| 710 | while (1) { | 708 | while (1) { |
| 711 | flat_read_chunk(inb, &re, sizeof(re)); | 709 | flat_read_chunk(inb, &re, sizeof(re)); |
| 712 | re.address = fdt64_to_cpu(re.address); | 710 | re.address = fdt64_to_cpu(re.address); |
diff --git a/scripts/gcc-goto.sh b/scripts/gcc-goto.sh index 98cffcb941ea..a2af2e88daf3 100644 --- a/scripts/gcc-goto.sh +++ b/scripts/gcc-goto.sh | |||
| @@ -2,4 +2,20 @@ | |||
| 2 | # Test for gcc 'asm goto' support | 2 | # Test for gcc 'asm goto' support |
| 3 | # Copyright (C) 2010, Jason Baron <jbaron@redhat.com> | 3 | # Copyright (C) 2010, Jason Baron <jbaron@redhat.com> |
| 4 | 4 | ||
| 5 | echo "int main(void) { entry: asm goto (\"\"::::entry); return 0; }" | $@ -x c - -c -o /dev/null >/dev/null 2>&1 && echo "y" | 5 | cat << "END" | $@ -x c - -c -o /dev/null >/dev/null 2>&1 && echo "y" |
| 6 | int main(void) | ||
| 7 | { | ||
| 8 | #ifdef __arm__ | ||
| 9 | /* | ||
| 10 | * Not related to asm goto, but used by jump label | ||
| 11 | * and broken on some ARM GCC versions (see GCC Bug 48637). | ||
| 12 | */ | ||
| 13 | static struct { int dummy; int state; } tp; | ||
| 14 | asm (".long %c0" :: "i" (&tp.state)); | ||
| 15 | #endif | ||
| 16 | |||
| 17 | entry: | ||
| 18 | asm goto ("" :::: entry); | ||
| 19 | return 0; | ||
| 20 | } | ||
| 21 | END | ||
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index f32a04c4c5bc..0948c6b5a321 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
| @@ -931,7 +931,7 @@ sub get_maintainer_role { | |||
| 931 | my $start = find_starting_index($index); | 931 | my $start = find_starting_index($index); |
| 932 | my $end = find_ending_index($index); | 932 | my $end = find_ending_index($index); |
| 933 | 933 | ||
| 934 | my $role; | 934 | my $role = "unknown"; |
| 935 | my $subsystem = $typevalue[$start]; | 935 | my $subsystem = $typevalue[$start]; |
| 936 | if (length($subsystem) > 20) { | 936 | if (length($subsystem) > 20) { |
| 937 | $subsystem = substr($subsystem, 0, 17); | 937 | $subsystem = substr($subsystem, 0, 17); |
| @@ -1027,8 +1027,13 @@ sub add_categories { | |||
| 1027 | if ($email_list) { | 1027 | if ($email_list) { |
| 1028 | if (!$hash_list_to{lc($list_address)}) { | 1028 | if (!$hash_list_to{lc($list_address)}) { |
| 1029 | $hash_list_to{lc($list_address)} = 1; | 1029 | $hash_list_to{lc($list_address)} = 1; |
| 1030 | push(@list_to, [$list_address, | 1030 | if ($list_additional =~ m/moderated/) { |
| 1031 | "open list${list_role}"]); | 1031 | push(@list_to, [$list_address, |
| 1032 | "moderated list${list_role}"]); | ||
| 1033 | } else { | ||
| 1034 | push(@list_to, [$list_address, | ||
| 1035 | "open list${list_role}"]); | ||
| 1036 | } | ||
| 1032 | } | 1037 | } |
| 1033 | } | 1038 | } |
| 1034 | } | 1039 | } |
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl index 7957e7a5166a..64ac2380e4d5 100644 --- a/scripts/headers_check.pl +++ b/scripts/headers_check.pl | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | # 3) Check for leaked CONFIG_ symbols | 19 | # 3) Check for leaked CONFIG_ symbols |
| 20 | 20 | ||
| 21 | use strict; | 21 | use strict; |
| 22 | use File::Basename; | ||
| 22 | 23 | ||
| 23 | my ($dir, $arch, @files) = @ARGV; | 24 | my ($dir, $arch, @files) = @ARGV; |
| 24 | 25 | ||
| @@ -99,6 +100,39 @@ sub check_asm_types | |||
| 99 | } | 100 | } |
| 100 | 101 | ||
| 101 | my $linux_types; | 102 | my $linux_types; |
| 103 | my %import_stack = (); | ||
| 104 | sub check_include_typesh | ||
| 105 | { | ||
| 106 | my $path = $_[0]; | ||
| 107 | my $import_path; | ||
| 108 | |||
| 109 | my $fh; | ||
| 110 | my @file_paths = ($path, $dir . "/" . $path, dirname($filename) . "/" . $path); | ||
| 111 | for my $possible ( @file_paths ) { | ||
| 112 | if (not $import_stack{$possible} and open($fh, '<', $possible)) { | ||
| 113 | $import_path = $possible; | ||
| 114 | $import_stack{$import_path} = 1; | ||
| 115 | last; | ||
| 116 | } | ||
| 117 | } | ||
| 118 | if (eof $fh) { | ||
| 119 | return; | ||
| 120 | } | ||
| 121 | |||
| 122 | my $line; | ||
| 123 | while ($line = <$fh>) { | ||
| 124 | if ($line =~ m/^\s*#\s*include\s+<linux\/types.h>/) { | ||
| 125 | $linux_types = 1; | ||
| 126 | last; | ||
| 127 | } | ||
| 128 | if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) { | ||
| 129 | check_include_typesh($included); | ||
| 130 | } | ||
| 131 | } | ||
| 132 | close $fh; | ||
| 133 | delete $import_stack{$import_path}; | ||
| 134 | } | ||
| 135 | |||
| 102 | sub check_sizetypes | 136 | sub check_sizetypes |
| 103 | { | 137 | { |
| 104 | if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) { | 138 | if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) { |
| @@ -113,6 +147,9 @@ sub check_sizetypes | |||
| 113 | $linux_types = 1; | 147 | $linux_types = 1; |
| 114 | return; | 148 | return; |
| 115 | } | 149 | } |
| 150 | if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) { | ||
| 151 | check_include_typesh($included); | ||
| 152 | } | ||
| 116 | if ($line =~ m/__[us](8|16|32|64)\b/) { | 153 | if ($line =~ m/__[us](8|16|32|64)\b/) { |
| 117 | printf STDERR "$filename:$lineno: " . | 154 | printf STDERR "$filename:$lineno: " . |
| 118 | "found __[us]{8,16,32,64} type " . | 155 | "found __[us]{8,16,32,64} type " . |
| @@ -122,4 +159,3 @@ sub check_sizetypes | |||
| 122 | #$ret = 1; | 159 | #$ret = 1; |
| 123 | } | 160 | } |
| 124 | } | 161 | } |
| 125 | |||
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 7c7a5a6cc3f5..52577f052bc1 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
| @@ -344,10 +344,8 @@ setsym: | |||
| 344 | 344 | ||
| 345 | int conf_read(const char *name) | 345 | int conf_read(const char *name) |
| 346 | { | 346 | { |
| 347 | struct symbol *sym, *choice_sym; | 347 | struct symbol *sym; |
| 348 | struct property *prop; | 348 | int i; |
| 349 | struct expr *e; | ||
| 350 | int i, flags; | ||
| 351 | 349 | ||
| 352 | sym_set_change_count(0); | 350 | sym_set_change_count(0); |
| 353 | 351 | ||
| @@ -357,7 +355,7 @@ int conf_read(const char *name) | |||
| 357 | for_all_symbols(i, sym) { | 355 | for_all_symbols(i, sym) { |
| 358 | sym_calc_value(sym); | 356 | sym_calc_value(sym); |
| 359 | if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO)) | 357 | if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO)) |
| 360 | goto sym_ok; | 358 | continue; |
| 361 | if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) { | 359 | if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) { |
| 362 | /* check that calculated value agrees with saved value */ | 360 | /* check that calculated value agrees with saved value */ |
| 363 | switch (sym->type) { | 361 | switch (sym->type) { |
| @@ -366,30 +364,18 @@ int conf_read(const char *name) | |||
| 366 | if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym)) | 364 | if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym)) |
| 367 | break; | 365 | break; |
| 368 | if (!sym_is_choice(sym)) | 366 | if (!sym_is_choice(sym)) |
| 369 | goto sym_ok; | 367 | continue; |
| 370 | /* fall through */ | 368 | /* fall through */ |
| 371 | default: | 369 | default: |
| 372 | if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) | 370 | if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) |
| 373 | goto sym_ok; | 371 | continue; |
| 374 | break; | 372 | break; |
| 375 | } | 373 | } |
| 376 | } else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE)) | 374 | } else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE)) |
| 377 | /* no previous value and not saved */ | 375 | /* no previous value and not saved */ |
| 378 | goto sym_ok; | 376 | continue; |
| 379 | conf_unsaved++; | 377 | conf_unsaved++; |
| 380 | /* maybe print value in verbose mode... */ | 378 | /* maybe print value in verbose mode... */ |
| 381 | sym_ok: | ||
| 382 | if (!sym_is_choice(sym)) | ||
| 383 | continue; | ||
| 384 | /* The choice symbol only has a set value (and thus is not new) | ||
| 385 | * if all its visible childs have values. | ||
| 386 | */ | ||
| 387 | prop = sym_get_choice_prop(sym); | ||
| 388 | flags = sym->flags; | ||
| 389 | expr_list_for_each_sym(prop->expr, e, choice_sym) | ||
| 390 | if (choice_sym->visible != no) | ||
| 391 | flags &= choice_sym->flags; | ||
| 392 | sym->flags &= flags | ~SYMBOL_DEF_USER; | ||
| 393 | } | 379 | } |
| 394 | 380 | ||
| 395 | for_all_symbols(i, sym) { | 381 | for_all_symbols(i, sym) { |
| @@ -554,35 +540,6 @@ static struct conf_printer header_printer_cb = | |||
| 554 | }; | 540 | }; |
| 555 | 541 | ||
| 556 | /* | 542 | /* |
| 557 | * Generate the __enabled_CONFIG_* and __enabled_CONFIG_*_MODULE macros for | ||
| 558 | * use by the IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is | ||
| 559 | * generated even for booleans so that the IS_ENABLED() macro works. | ||
| 560 | */ | ||
| 561 | static void | ||
| 562 | header_print__enabled_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) | ||
| 563 | { | ||
| 564 | |||
| 565 | switch (sym->type) { | ||
| 566 | case S_BOOLEAN: | ||
| 567 | case S_TRISTATE: { | ||
| 568 | fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n", | ||
| 569 | sym->name, (*value == 'y')); | ||
| 570 | fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n", | ||
| 571 | sym->name, (*value == 'm')); | ||
| 572 | break; | ||
| 573 | } | ||
| 574 | default: | ||
| 575 | break; | ||
| 576 | } | ||
| 577 | } | ||
| 578 | |||
| 579 | static struct conf_printer header__enabled_printer_cb = | ||
| 580 | { | ||
| 581 | .print_symbol = header_print__enabled_symbol, | ||
| 582 | .print_comment = header_print_comment, | ||
| 583 | }; | ||
| 584 | |||
| 585 | /* | ||
| 586 | * Tristate printer | 543 | * Tristate printer |
| 587 | * | 544 | * |
| 588 | * This printer is used when generating the `include/config/tristate.conf' file. | 545 | * This printer is used when generating the `include/config/tristate.conf' file. |
| @@ -963,16 +920,11 @@ int conf_write_autoconf(void) | |||
| 963 | conf_write_heading(out_h, &header_printer_cb, NULL); | 920 | conf_write_heading(out_h, &header_printer_cb, NULL); |
| 964 | 921 | ||
| 965 | for_all_symbols(i, sym) { | 922 | for_all_symbols(i, sym) { |
| 966 | if (!sym->name) | ||
| 967 | continue; | ||
| 968 | |||
| 969 | sym_calc_value(sym); | 923 | sym_calc_value(sym); |
| 970 | 924 | if (!(sym->flags & SYMBOL_WRITE) || !sym->name) | |
| 971 | conf_write_symbol(out_h, sym, &header__enabled_printer_cb, NULL); | ||
| 972 | |||
| 973 | if (!(sym->flags & SYMBOL_WRITE)) | ||
| 974 | continue; | 925 | continue; |
| 975 | 926 | ||
| 927 | /* write symbol to auto.conf, tristate and header files */ | ||
| 976 | conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); | 928 | conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); |
| 977 | 929 | ||
| 978 | conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); | 930 | conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); |
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh index ceadf0e150cf..974d5cb7e30a 100644..100755 --- a/scripts/kconfig/merge_config.sh +++ b/scripts/kconfig/merge_config.sh | |||
| @@ -31,10 +31,12 @@ usage() { | |||
| 31 | echo " -h display this help text" | 31 | echo " -h display this help text" |
| 32 | echo " -m only merge the fragments, do not execute the make command" | 32 | echo " -m only merge the fragments, do not execute the make command" |
| 33 | echo " -n use allnoconfig instead of alldefconfig" | 33 | echo " -n use allnoconfig instead of alldefconfig" |
| 34 | echo " -r list redundant entries when merging fragments" | ||
| 34 | } | 35 | } |
| 35 | 36 | ||
| 36 | MAKE=true | 37 | MAKE=true |
| 37 | ALLTARGET=alldefconfig | 38 | ALLTARGET=alldefconfig |
| 39 | WARNREDUN=false | ||
| 38 | 40 | ||
| 39 | while true; do | 41 | while true; do |
| 40 | case $1 in | 42 | case $1 in |
| @@ -52,18 +54,27 @@ while true; do | |||
| 52 | usage | 54 | usage |
| 53 | exit | 55 | exit |
| 54 | ;; | 56 | ;; |
| 57 | "-r") | ||
| 58 | WARNREDUN=true | ||
| 59 | shift | ||
| 60 | continue | ||
| 61 | ;; | ||
| 55 | *) | 62 | *) |
| 56 | break | 63 | break |
| 57 | ;; | 64 | ;; |
| 58 | esac | 65 | esac |
| 59 | done | 66 | done |
| 60 | 67 | ||
| 61 | 68 | INITFILE=$1 | |
| 69 | shift; | ||
| 62 | 70 | ||
| 63 | MERGE_LIST=$* | 71 | MERGE_LIST=$* |
| 64 | SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" | 72 | SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" |
| 65 | TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) | 73 | TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) |
| 66 | 74 | ||
| 75 | echo "Using $INITFILE as base" | ||
| 76 | cat $INITFILE > $TMP_FILE | ||
| 77 | |||
| 67 | # Merge files, printing warnings on overrided values | 78 | # Merge files, printing warnings on overrided values |
| 68 | for MERGE_FILE in $MERGE_LIST ; do | 79 | for MERGE_FILE in $MERGE_LIST ; do |
| 69 | echo "Merging $MERGE_FILE" | 80 | echo "Merging $MERGE_FILE" |
| @@ -79,6 +90,8 @@ for MERGE_FILE in $MERGE_LIST ; do | |||
| 79 | echo Previous value: $PREV_VAL | 90 | echo Previous value: $PREV_VAL |
| 80 | echo New value: $NEW_VAL | 91 | echo New value: $NEW_VAL |
| 81 | echo | 92 | echo |
| 93 | elif [ "$WARNREDUN" = "true" ]; then | ||
| 94 | echo Value of $CFG is redundant by fragment $MERGE_FILE: | ||
| 82 | fi | 95 | fi |
| 83 | sed -i "/$CFG[ =]/d" $TMP_FILE | 96 | sed -i "/$CFG[ =]/d" $TMP_FILE |
| 84 | fi | 97 | fi |
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 071f00c3046e..22a3c400fc41 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
| @@ -262,11 +262,18 @@ static struct symbol *sym_calc_choice(struct symbol *sym) | |||
| 262 | struct symbol *def_sym; | 262 | struct symbol *def_sym; |
| 263 | struct property *prop; | 263 | struct property *prop; |
| 264 | struct expr *e; | 264 | struct expr *e; |
| 265 | int flags; | ||
| 265 | 266 | ||
| 266 | /* first calculate all choice values' visibilities */ | 267 | /* first calculate all choice values' visibilities */ |
| 268 | flags = sym->flags; | ||
| 267 | prop = sym_get_choice_prop(sym); | 269 | prop = sym_get_choice_prop(sym); |
| 268 | expr_list_for_each_sym(prop->expr, e, def_sym) | 270 | expr_list_for_each_sym(prop->expr, e, def_sym) { |
| 269 | sym_calc_visibility(def_sym); | 271 | sym_calc_visibility(def_sym); |
| 272 | if (def_sym->visible != no) | ||
| 273 | flags &= def_sym->flags; | ||
| 274 | } | ||
| 275 | |||
| 276 | sym->flags &= flags | ~SYMBOL_DEF_USER; | ||
| 270 | 277 | ||
| 271 | /* is the user choice visible? */ | 278 | /* is the user choice visible? */ |
| 272 | def_sym = sym->def[S_DEF_USER].val; | 279 | def_sym = sym->def[S_DEF_USER].val; |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index b89efe6e4c85..8e730ccc3f2b 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
| @@ -1029,6 +1029,31 @@ static int do_amba_entry(const char *filename, | |||
| 1029 | } | 1029 | } |
| 1030 | ADD_TO_DEVTABLE("amba", struct amba_id, do_amba_entry); | 1030 | ADD_TO_DEVTABLE("amba", struct amba_id, do_amba_entry); |
| 1031 | 1031 | ||
| 1032 | /* LOOKS like x86cpu:vendor:VVVV:family:FFFF:model:MMMM:feature:*,FEAT,* | ||
| 1033 | * All fields are numbers. It would be nicer to use strings for vendor | ||
| 1034 | * and feature, but getting those out of the build system here is too | ||
| 1035 | * complicated. | ||
| 1036 | */ | ||
| 1037 | |||
| 1038 | static int do_x86cpu_entry(const char *filename, struct x86_cpu_id *id, | ||
| 1039 | char *alias) | ||
| 1040 | { | ||
| 1041 | id->feature = TO_NATIVE(id->feature); | ||
| 1042 | id->family = TO_NATIVE(id->family); | ||
| 1043 | id->model = TO_NATIVE(id->model); | ||
| 1044 | id->vendor = TO_NATIVE(id->vendor); | ||
| 1045 | |||
| 1046 | strcpy(alias, "x86cpu:"); | ||
| 1047 | ADD(alias, "vendor:", id->vendor != X86_VENDOR_ANY, id->vendor); | ||
| 1048 | ADD(alias, ":family:", id->family != X86_FAMILY_ANY, id->family); | ||
| 1049 | ADD(alias, ":model:", id->model != X86_MODEL_ANY, id->model); | ||
| 1050 | strcat(alias, ":feature:*"); | ||
| 1051 | if (id->feature != X86_FEATURE_ANY) | ||
| 1052 | sprintf(alias + strlen(alias), "%04X*", id->feature); | ||
| 1053 | return 1; | ||
| 1054 | } | ||
| 1055 | ADD_TO_DEVTABLE("x86cpu", struct x86_cpu_id, do_x86cpu_entry); | ||
| 1056 | |||
| 1032 | /* Does namelen bytes of name exactly match the symbol? */ | 1057 | /* Does namelen bytes of name exactly match the symbol? */ |
| 1033 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) | 1058 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) |
| 1034 | { | 1059 | { |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 9adb667dd31a..c4e7d1510f9d 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
| @@ -132,8 +132,10 @@ static struct module *new_module(char *modname) | |||
| 132 | /* strip trailing .o */ | 132 | /* strip trailing .o */ |
| 133 | s = strrchr(p, '.'); | 133 | s = strrchr(p, '.'); |
| 134 | if (s != NULL) | 134 | if (s != NULL) |
| 135 | if (strcmp(s, ".o") == 0) | 135 | if (strcmp(s, ".o") == 0) { |
| 136 | *s = '\0'; | 136 | *s = '\0'; |
| 137 | mod->is_dot_o = 1; | ||
| 138 | } | ||
| 137 | 139 | ||
| 138 | /* add to list */ | 140 | /* add to list */ |
| 139 | mod->name = p; | 141 | mod->name = p; |
| @@ -587,7 +589,8 @@ static void handle_modversions(struct module *mod, struct elf_info *info, | |||
| 587 | unsigned int crc; | 589 | unsigned int crc; |
| 588 | enum export export; | 590 | enum export export; |
| 589 | 591 | ||
| 590 | if (!is_vmlinux(mod->name) && strncmp(symname, "__ksymtab", 9) == 0) | 592 | if ((!is_vmlinux(mod->name) || mod->is_dot_o) && |
| 593 | strncmp(symname, "__ksymtab", 9) == 0) | ||
| 591 | export = export_from_secname(info, get_secindex(info, sym)); | 594 | export = export_from_secname(info, get_secindex(info, sym)); |
| 592 | else | 595 | else |
| 593 | export = export_from_sec(info, get_secindex(info, sym)); | 596 | export = export_from_sec(info, get_secindex(info, sym)); |
| @@ -849,7 +852,7 @@ static void check_section(const char *modname, struct elf_info *elf, | |||
| 849 | 852 | ||
| 850 | #define ALL_INIT_DATA_SECTIONS \ | 853 | #define ALL_INIT_DATA_SECTIONS \ |
| 851 | ".init.setup$", ".init.rodata$", \ | 854 | ".init.setup$", ".init.rodata$", \ |
| 852 | ".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$" \ | 855 | ".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$", \ |
| 853 | ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$" | 856 | ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$" |
| 854 | #define ALL_EXIT_DATA_SECTIONS \ | 857 | #define ALL_EXIT_DATA_SECTIONS \ |
| 855 | ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$" | 858 | ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$" |
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 2031119080dc..51207e4d5f8b 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h | |||
| @@ -113,6 +113,7 @@ struct module { | |||
| 113 | int has_cleanup; | 113 | int has_cleanup; |
| 114 | struct buffer dev_table_buf; | 114 | struct buffer dev_table_buf; |
| 115 | char srcversion[25]; | 115 | char srcversion[25]; |
| 116 | int is_dot_o; | ||
| 116 | }; | 117 | }; |
| 117 | 118 | ||
| 118 | struct elf_info { | 119 | struct elf_info { |
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" | |||
| 97 | mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" | 97 | mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" |
| 98 | mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" | 98 | mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" |
| 99 | mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename" | 99 | mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename" |
| 100 | mkdir -p "$kernel_headers_dir/lib/modules/$version/" | ||
| 100 | if [ "$ARCH" = "um" ] ; then | 101 | if [ "$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" |
| 102 | fi | 103 | fi |
| @@ -120,15 +121,19 @@ else | |||
| 120 | fi | 121 | fi |
| 121 | 122 | ||
| 122 | if grep -q '^CONFIG_MODULES=y' .config ; then | 123 | if 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 |
| 128 | fi | 131 | fi |
| 129 | 132 | ||
| 130 | make headers_check | 133 | if [ "$ARCH" != "um" ]; then |
| 131 | make 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" | ||
| 136 | fi | ||
| 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 | |||
| 245 | mkdir -p "$destdir" | 250 | mkdir -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 -) |
| 253 | ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" | ||
| 248 | rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" | 254 | rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" |
| 249 | arch=$(dpkg --print-architecture) | 255 | arch=$(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 |
| 260 | EOF | 266 | EOF |
| 261 | 267 | ||
| 262 | create_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. |
| 265 | if [ -e "$tmpdir/lib/firmware" ]; then | 269 | if [ -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. |
| 288 | EOF | 292 | EOF |
| 289 | 293 | ||
| 290 | create_package "$libc_headers_packagename" "$libc_headers_dir" | 294 | if [ "$ARCH" != "um" ]; then |
| 295 | create_package "$kernel_headers_packagename" "$kernel_headers_dir" | ||
| 296 | create_package "$libc_headers_packagename" "$libc_headers_dir" | ||
| 297 | fi | ||
| 298 | |||
| 291 | create_package "$packagename" "$tmpdir" | 299 | create_package "$packagename" "$tmpdir" |
| 292 | 300 | ||
| 293 | exit 0 | 301 | exit 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/setlocalversion b/scripts/setlocalversion index 4d403844e137..bd6dca8a0ab2 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
| @@ -75,8 +75,7 @@ scm_version() | |||
| 75 | [ -w . ] && git update-index --refresh --unmerged > /dev/null | 75 | [ -w . ] && git update-index --refresh --unmerged > /dev/null |
| 76 | 76 | ||
| 77 | # Check for uncommitted changes | 77 | # Check for uncommitted changes |
| 78 | if git diff-index --name-only HEAD | grep -v "^scripts/package" \ | 78 | if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then |
| 79 | | read dummy; then | ||
| 80 | printf '%s' -dirty | 79 | printf '%s' -dirty |
| 81 | fi | 80 | fi |
| 82 | 81 | ||
diff --git a/scripts/tags.sh b/scripts/tags.sh index 833813a99e7c..cf7b12fee573 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
| @@ -116,7 +116,7 @@ docscope() | |||
| 116 | 116 | ||
| 117 | dogtags() | 117 | dogtags() |
| 118 | { | 118 | { |
| 119 | all_sources | gtags -f - | 119 | all_sources | gtags -i -f - |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | exuberant() | 122 | exuberant() |
| @@ -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 | ||
| 174 | emacs() | 171 | emacs() |
| @@ -233,6 +230,7 @@ if [ "${ARCH}" = "um" ]; then | |||
| 233 | fi | 230 | fi |
| 234 | fi | 231 | fi |
| 235 | 232 | ||
| 233 | remove_structs= | ||
| 236 | case "$1" in | 234 | case "$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 | ;; |
| 254 | esac | 254 | esac |
| 255 | |||
| 256 | # Remove structure forward declarations. | ||
| 257 | if [ -n "$remove_structs" ]; then | ||
| 258 | LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1 | ||
| 259 | fi | ||
diff --git a/scripts/xz_wrap.sh b/scripts/xz_wrap.sh index 17a5798c29da..7a2d372f4885 100644 --- a/scripts/xz_wrap.sh +++ b/scripts/xz_wrap.sh | |||
| @@ -12,8 +12,8 @@ | |||
| 12 | BCJ= | 12 | BCJ= |
| 13 | LZMA2OPTS= | 13 | LZMA2OPTS= |
| 14 | 14 | ||
| 15 | case $ARCH in | 15 | case $SRCARCH in |
| 16 | x86|x86_64) BCJ=--x86 ;; | 16 | x86) BCJ=--x86 ;; |
| 17 | powerpc) BCJ=--powerpc ;; | 17 | powerpc) BCJ=--powerpc ;; |
| 18 | ia64) BCJ=--ia64; LZMA2OPTS=pb=4 ;; | 18 | ia64) BCJ=--ia64; LZMA2OPTS=pb=4 ;; |
| 19 | arm) BCJ=--arm ;; | 19 | arm) BCJ=--arm ;; |
