aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.modpost4
-rw-r--r--scripts/asn1_compiler.c2
-rwxr-xr-xscripts/bloat-o-meter7
-rwxr-xr-xscripts/checkkconfigsymbols.sh4
-rwxr-xr-xscripts/checkpatch.pl490
-rw-r--r--scripts/coccinelle/api/devm_request_and_ioremap.cocci105
-rw-r--r--scripts/coccinelle/misc/boolreturn.cocci58
-rwxr-xr-xscripts/config44
-rwxr-xr-xscripts/diffconfig33
-rw-r--r--scripts/docproc.c14
-rw-r--r--scripts/gen_initramfs_list.sh24
-rw-r--r--scripts/kallsyms.c18
-rw-r--r--scripts/kconfig/confdata.c11
-rw-r--r--scripts/kconfig/expr.h2
-rw-r--r--scripts/kconfig/mconf.c64
-rw-r--r--scripts/kconfig/menu.c22
-rw-r--r--scripts/kconfig/nconf.c4
-rw-r--r--scripts/kconfig/qconf.cc5
-rw-r--r--scripts/kconfig/qconf.h1
-rw-r--r--scripts/kconfig/symbol.c70
-rw-r--r--scripts/kconfig/zconf.l1
-rw-r--r--scripts/kconfig/zconf.tab.c_shipped562
-rw-r--r--scripts/kconfig/zconf.y11
-rwxr-xr-xscripts/kernel-doc9
-rw-r--r--scripts/link-vmlinux.sh2
-rw-r--r--scripts/mod/modpost.c37
-rw-r--r--scripts/mod/sumversion.c2
-rw-r--r--scripts/package/Makefile4
-rw-r--r--scripts/package/builddeb94
-rw-r--r--scripts/package/buildtar21
-rwxr-xr-xscripts/package/mkspec46
-rwxr-xr-xscripts/recordmcount.pl4
-rwxr-xr-xscripts/show_delta12
-rw-r--r--scripts/sortextable.c32
-rw-r--r--scripts/sortextable.h26
-rwxr-xr-xscripts/tags.sh9
36 files changed, 1168 insertions, 686 deletions
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 8dcdca27d836..69f0a1417e9a 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -79,9 +79,11 @@ modpost = scripts/mod/modpost \
79 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ 79 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
80 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) 80 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
81 81
82MODPOST_OPT=$(subst -i,-n,$(filter -i,$(MAKEFLAGS)))
83
82# We can go over command line length here, so be careful. 84# We can go over command line length here, so be careful.
83quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules 85quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
84 cmd_modpost = $(MODLISTCMD) | sed 's/\.ko$$/.o/' | $(modpost) -s -T - 86 cmd_modpost = $(MODLISTCMD) | sed 's/\.ko$$/.o/' | $(modpost) $(MODPOST_OPT) -s -T -
85 87
86PHONY += __modpost 88PHONY += __modpost
87__modpost: $(modules:.ko=.o) FORCE 89__modpost: $(modules:.ko=.o) FORCE
diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
index db0e5cd34c70..91c4117637ae 100644
--- a/scripts/asn1_compiler.c
+++ b/scripts/asn1_compiler.c
@@ -1353,6 +1353,8 @@ static void render_out_of_line_list(FILE *out)
1353 render_opcode(out, "ASN1_OP_END_SET_OF%s,\n", act); 1353 render_opcode(out, "ASN1_OP_END_SET_OF%s,\n", act);
1354 render_opcode(out, "_jump_target(%u),\n", entry); 1354 render_opcode(out, "_jump_target(%u),\n", entry);
1355 break; 1355 break;
1356 default:
1357 break;
1356 } 1358 }
1357 if (e->action) 1359 if (e->action)
1358 render_opcode(out, "_action(ACT_%s),\n", 1360 render_opcode(out, "_action(ACT_%s),\n",
diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter
index 6129020c41a9..549d0ab8c662 100755
--- a/scripts/bloat-o-meter
+++ b/scripts/bloat-o-meter
@@ -19,9 +19,10 @@ def getsizes(file):
19 size, type, name = l[:-1].split() 19 size, type, name = l[:-1].split()
20 if type in "tTdDbBrR": 20 if type in "tTdDbBrR":
21 # strip generated symbols 21 # strip generated symbols
22 if name[:6] == "__mod_": continue 22 if name.startswith("__mod_"): continue
23 # function names begin with '.' on 64-bit powerpc 23 if name == "linux_banner": continue
24 if "." in name[1:]: name = "static." + name.split(".")[0] 24 # statics and some other optimizations adds random .NUMBER
25 name = re.sub(r'\.[0-9]+', '', name)
25 sym[name] = sym.get(name, 0) + int(size, 16) 26 sym[name] = sym.get(name, 0) + int(size, 16)
26 return sym 27 return sym
27 28
diff --git a/scripts/checkkconfigsymbols.sh b/scripts/checkkconfigsymbols.sh
index 2ca49bb31efc..ccb3391882d1 100755
--- a/scripts/checkkconfigsymbols.sh
+++ b/scripts/checkkconfigsymbols.sh
@@ -9,7 +9,7 @@ paths="$@"
9# Doing this once at the beginning saves a lot of time, on a cache-hot tree. 9# Doing this once at the beginning saves a lot of time, on a cache-hot tree.
10Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" 10Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`"
11 11
12/bin/echo -e "File list \tundefined symbol used" 12printf "File list \tundefined symbol used\n"
13find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i 13find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i
14do 14do
15 # Output the bare Kconfig variable and the filename; the _MODULE part at 15 # Output the bare Kconfig variable and the filename; the _MODULE part at
@@ -54,6 +54,6 @@ while read symb files; do
54 # beyond the purpose of this script. 54 # beyond the purpose of this script.
55 symb_bare=`echo $symb | sed -e 's/_MODULE//'` 55 symb_bare=`echo $symb | sed -e 's/_MODULE//'`
56 if ! grep -q "\<$symb_bare\>" $Kconfigs; then 56 if ! grep -q "\<$symb_bare\>" $Kconfigs; then
57 /bin/echo -e "$files: \t$symb" 57 printf "$files: \t$symb\n"
58 fi 58 fi
59done|sort 59done|sort
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2ee9eb750560..9c9810030377 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -31,12 +31,16 @@ my $show_types = 0;
31my $fix = 0; 31my $fix = 0;
32my $root; 32my $root;
33my %debug; 33my %debug;
34my %ignore_type = ();
35my %camelcase = (); 34my %camelcase = ();
35my %use_type = ();
36my @use = ();
37my %ignore_type = ();
36my @ignore = (); 38my @ignore = ();
37my $help = 0; 39my $help = 0;
38my $configuration_file = ".checkpatch.conf"; 40my $configuration_file = ".checkpatch.conf";
39my $max_line_length = 80; 41my $max_line_length = 80;
42my $ignore_perl_version = 0;
43my $minimum_perl_version = 5.10.0;
40 44
41sub help { 45sub help {
42 my ($exitcode) = @_; 46 my ($exitcode) = @_;
@@ -54,6 +58,7 @@ Options:
54 --terse one line per report 58 --terse one line per report
55 -f, --file treat FILE as regular source file 59 -f, --file treat FILE as regular source file
56 --subjective, --strict enable more subjective tests 60 --subjective, --strict enable more subjective tests
61 --types TYPE(,TYPE2...) show only these comma separated message types
57 --ignore TYPE(,TYPE2...) ignore various comma separated message types 62 --ignore TYPE(,TYPE2...) ignore various comma separated message types
58 --max-line-length=n set the maximum line length, if exceeded, warn 63 --max-line-length=n set the maximum line length, if exceeded, warn
59 --show-types show the message "types" in the output 64 --show-types show the message "types" in the output
@@ -71,6 +76,8 @@ Options:
71 "<inputfile>.EXPERIMENTAL-checkpatch-fixes" 76 "<inputfile>.EXPERIMENTAL-checkpatch-fixes"
72 with potential errors corrected to the preferred 77 with potential errors corrected to the preferred
73 checkpatch style 78 checkpatch style
79 --ignore-perl-version override checking of perl version. expect
80 runtime errors.
74 -h, --help, --version display this help and exit 81 -h, --help, --version display this help and exit
75 82
76When FILE is - read standard input. 83When FILE is - read standard input.
@@ -116,6 +123,7 @@ GetOptions(
116 'subjective!' => \$check, 123 'subjective!' => \$check,
117 'strict!' => \$check, 124 'strict!' => \$check,
118 'ignore=s' => \@ignore, 125 'ignore=s' => \@ignore,
126 'types=s' => \@use,
119 'show-types!' => \$show_types, 127 'show-types!' => \$show_types,
120 'max-line-length=i' => \$max_line_length, 128 'max-line-length=i' => \$max_line_length,
121 'root=s' => \$root, 129 'root=s' => \$root,
@@ -123,6 +131,7 @@ GetOptions(
123 'mailback!' => \$mailback, 131 'mailback!' => \$mailback,
124 'summary-file!' => \$summary_file, 132 'summary-file!' => \$summary_file,
125 'fix!' => \$fix, 133 'fix!' => \$fix,
134 'ignore-perl-version!' => \$ignore_perl_version,
126 'debug=s' => \%debug, 135 'debug=s' => \%debug,
127 'test-only=s' => \$tst_only, 136 'test-only=s' => \$tst_only,
128 'h|help' => \$help, 137 'h|help' => \$help,
@@ -133,24 +142,50 @@ help(0) if ($help);
133 142
134my $exit = 0; 143my $exit = 0;
135 144
145if ($^V && $^V lt $minimum_perl_version) {
146 printf "$P: requires at least perl version %vd\n", $minimum_perl_version;
147 if (!$ignore_perl_version) {
148 exit(1);
149 }
150}
151
136if ($#ARGV < 0) { 152if ($#ARGV < 0) {
137 print "$P: no input files\n"; 153 print "$P: no input files\n";
138 exit(1); 154 exit(1);
139} 155}
140 156
141@ignore = split(/,/, join(',',@ignore)); 157sub hash_save_array_words {
142foreach my $word (@ignore) { 158 my ($hashRef, $arrayRef) = @_;
143 $word =~ s/\s*\n?$//g;
144 $word =~ s/^\s*//g;
145 $word =~ s/\s+/ /g;
146 $word =~ tr/[a-z]/[A-Z]/;
147 159
148 next if ($word =~ m/^\s*#/); 160 my @array = split(/,/, join(',', @$arrayRef));
149 next if ($word =~ m/^\s*$/); 161 foreach my $word (@array) {
162 $word =~ s/\s*\n?$//g;
163 $word =~ s/^\s*//g;
164 $word =~ s/\s+/ /g;
165 $word =~ tr/[a-z]/[A-Z]/;
150 166
151 $ignore_type{$word}++; 167 next if ($word =~ m/^\s*#/);
168 next if ($word =~ m/^\s*$/);
169
170 $hashRef->{$word}++;
171 }
152} 172}
153 173
174sub hash_show_words {
175 my ($hashRef, $prefix) = @_;
176
177 if ($quiet == 0 && keys %$hashRef) {
178 print "NOTE: $prefix message types:";
179 foreach my $word (sort keys %$hashRef) {
180 print " $word";
181 }
182 print "\n\n";
183 }
184}
185
186hash_save_array_words(\%ignore_type, \@ignore);
187hash_save_array_words(\%use_type, \@use);
188
154my $dbg_values = 0; 189my $dbg_values = 0;
155my $dbg_possible = 0; 190my $dbg_possible = 0;
156my $dbg_type = 0; 191my $dbg_type = 0;
@@ -206,6 +241,11 @@ our $Sparse = qr{
206 __ref| 241 __ref|
207 __rcu 242 __rcu
208 }x; 243 }x;
244our $InitAttributePrefix = qr{__(?:mem|cpu|dev|net_|)};
245our $InitAttributeData = qr{$InitAttributePrefix(?:initdata\b)};
246our $InitAttributeConst = qr{$InitAttributePrefix(?:initconst\b)};
247our $InitAttributeInit = qr{$InitAttributePrefix(?:init\b)};
248our $InitAttribute = qr{$InitAttributeData|$InitAttributeConst|$InitAttributeInit};
209 249
210# Notes to $Attribute: 250# Notes to $Attribute:
211# We need \b after 'init' otherwise 'initconst' will cause a false positive in a check 251# We need \b after 'init' otherwise 'initconst' will cause a false positive in a check
@@ -227,7 +267,7 @@ our $Attribute = qr{
227 __deprecated| 267 __deprecated|
228 __read_mostly| 268 __read_mostly|
229 __kprobes| 269 __kprobes|
230 __(?:mem|cpu|dev|)(?:initdata|initconst|init\b)| 270 $InitAttribute|
231 ____cacheline_aligned| 271 ____cacheline_aligned|
232 ____cacheline_aligned_in_smp| 272 ____cacheline_aligned_in_smp|
233 ____cacheline_internodealigned_in_smp| 273 ____cacheline_internodealigned_in_smp|
@@ -257,6 +297,7 @@ our $Operators = qr{
257 }x; 297 }x;
258 298
259our $NonptrType; 299our $NonptrType;
300our $NonptrTypeWithAttr;
260our $Type; 301our $Type;
261our $Declare; 302our $Declare;
262 303
@@ -285,7 +326,8 @@ our $logFunctions = qr{(?x:
285 (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)| 326 (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
286 WARN(?:_RATELIMIT|_ONCE|)| 327 WARN(?:_RATELIMIT|_ONCE|)|
287 panic| 328 panic|
288 MODULE_[A-Z_]+ 329 MODULE_[A-Z_]+|
330 seq_vprintf|seq_printf|seq_puts
289)}; 331)};
290 332
291our $signature_tags = qr{(?xi: 333our $signature_tags = qr{(?xi:
@@ -319,6 +361,12 @@ our @typeList = (
319 qr{${Ident}_handler}, 361 qr{${Ident}_handler},
320 qr{${Ident}_handler_fn}, 362 qr{${Ident}_handler_fn},
321); 363);
364our @typeListWithAttr = (
365 @typeList,
366 qr{struct\s+$InitAttribute\s+$Ident},
367 qr{union\s+$InitAttribute\s+$Ident},
368);
369
322our @modifierList = ( 370our @modifierList = (
323 qr{fastcall}, 371 qr{fastcall},
324); 372);
@@ -332,6 +380,7 @@ our $allowed_asm_includes = qr{(?x:
332sub build_types { 380sub build_types {
333 my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)"; 381 my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)";
334 my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)"; 382 my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)";
383 my $allWithAttr = "(?x: \n" . join("|\n ", @typeListWithAttr) . "\n)";
335 $Modifier = qr{(?:$Attribute|$Sparse|$mods)}; 384 $Modifier = qr{(?:$Attribute|$Sparse|$mods)};
336 $NonptrType = qr{ 385 $NonptrType = qr{
337 (?:$Modifier\s+|const\s+)* 386 (?:$Modifier\s+|const\s+)*
@@ -342,6 +391,15 @@ sub build_types {
342 ) 391 )
343 (?:\s+$Modifier|\s+const)* 392 (?:\s+$Modifier|\s+const)*
344 }x; 393 }x;
394 $NonptrTypeWithAttr = qr{
395 (?:$Modifier\s+|const\s+)*
396 (?:
397 (?:typeof|__typeof__)\s*\([^\)]*\)|
398 (?:$typeTypedefs\b)|
399 (?:${allWithAttr}\b)
400 )
401 (?:\s+$Modifier|\s+const)*
402 }x;
345 $Type = qr{ 403 $Type = qr{
346 $NonptrType 404 $NonptrType
347 (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*|\[\])+|(?:\s*\[\s*\])+)? 405 (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*|\[\])+|(?:\s*\[\s*\])+)?
@@ -388,8 +446,9 @@ sub seed_camelcase_file {
388 next if ($line !~ /(?:[A-Z][a-z]|[a-z][A-Z])/); 446 next if ($line !~ /(?:[A-Z][a-z]|[a-z][A-Z])/);
389 if ($line =~ /^[ \t]*(?:#[ \t]*define|typedef\s+$Type)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)/) { 447 if ($line =~ /^[ \t]*(?:#[ \t]*define|typedef\s+$Type)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)/) {
390 $camelcase{$1} = 1; 448 $camelcase{$1} = 1;
391 } 449 } elsif ($line =~ /^\s*$Declare\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[\(\[,;]/) {
392 elsif ($line =~ /^\s*$Declare\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*\(/) { 450 $camelcase{$1} = 1;
451 } elsif ($line =~ /^\s*(?:union|struct|enum)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[;\{]/) {
393 $camelcase{$1} = 1; 452 $camelcase{$1} = 1;
394 } 453 }
395 } 454 }
@@ -1355,7 +1414,9 @@ sub possible {
1355my $prefix = ''; 1414my $prefix = '';
1356 1415
1357sub show_type { 1416sub show_type {
1358 return !defined $ignore_type{$_[0]}; 1417 return defined $use_type{$_[0]} if (scalar keys %use_type > 0);
1418
1419 return !defined $ignore_type{$_[0]};
1359} 1420}
1360 1421
1361sub report { 1422sub report {
@@ -1435,7 +1496,31 @@ sub check_absolute_file {
1435sub trim { 1496sub trim {
1436 my ($string) = @_; 1497 my ($string) = @_;
1437 1498
1438 $string =~ s/(^\s+|\s+$)//g; 1499 $string =~ s/^\s+|\s+$//g;
1500
1501 return $string;
1502}
1503
1504sub ltrim {
1505 my ($string) = @_;
1506
1507 $string =~ s/^\s+//;
1508
1509 return $string;
1510}
1511
1512sub rtrim {
1513 my ($string) = @_;
1514
1515 $string =~ s/\s+$//;
1516
1517 return $string;
1518}
1519
1520sub string_find_replace {
1521 my ($string, $find, $replace) = @_;
1522
1523 $string =~ s/$find/$replace/g;
1439 1524
1440 return $string; 1525 return $string;
1441} 1526}
@@ -1532,6 +1617,7 @@ sub process {
1532 my %suppress_export; 1617 my %suppress_export;
1533 my $suppress_statement = 0; 1618 my $suppress_statement = 0;
1534 1619
1620 my %signatures = ();
1535 1621
1536 # Pre-scan the patch sanitizing the lines. 1622 # Pre-scan the patch sanitizing the lines.
1537 # Pre-scan the patch looking for any __setup documentation. 1623 # Pre-scan the patch looking for any __setup documentation.
@@ -1539,6 +1625,8 @@ sub process {
1539 my @setup_docs = (); 1625 my @setup_docs = ();
1540 my $setup_docs = 0; 1626 my $setup_docs = 0;
1541 1627
1628 my $camelcase_file_seeded = 0;
1629
1542 sanitise_line_reset(); 1630 sanitise_line_reset();
1543 my $line; 1631 my $line;
1544 foreach my $rawline (@rawlines) { 1632 foreach my $rawline (@rawlines) {
@@ -1624,6 +1712,8 @@ sub process {
1624 $linenr = 0; 1712 $linenr = 0;
1625 foreach my $line (@lines) { 1713 foreach my $line (@lines) {
1626 $linenr++; 1714 $linenr++;
1715 my $sline = $line; #copy of $line
1716 $sline =~ s/$;/ /g; #with comments as spaces
1627 1717
1628 my $rawline = $rawlines[$linenr - 1]; 1718 my $rawline = $rawlines[$linenr - 1];
1629 1719
@@ -1679,11 +1769,11 @@ sub process {
1679 # extract the filename as it passes 1769 # extract the filename as it passes
1680 if ($line =~ /^diff --git.*?(\S+)$/) { 1770 if ($line =~ /^diff --git.*?(\S+)$/) {
1681 $realfile = $1; 1771 $realfile = $1;
1682 $realfile =~ s@^([^/]*)/@@; 1772 $realfile =~ s@^([^/]*)/@@ if (!$file);
1683 $in_commit_log = 0; 1773 $in_commit_log = 0;
1684 } elsif ($line =~ /^\+\+\+\s+(\S+)/) { 1774 } elsif ($line =~ /^\+\+\+\s+(\S+)/) {
1685 $realfile = $1; 1775 $realfile = $1;
1686 $realfile =~ s@^([^/]*)/@@; 1776 $realfile =~ s@^([^/]*)/@@ if (!$file);
1687 $in_commit_log = 0; 1777 $in_commit_log = 0;
1688 1778
1689 $p1_prefix = $1; 1779 $p1_prefix = $1;
@@ -1781,6 +1871,17 @@ sub process {
1781 "email address '$email' might be better as '$suggested_email$comment'\n" . $herecurr); 1871 "email address '$email' might be better as '$suggested_email$comment'\n" . $herecurr);
1782 } 1872 }
1783 } 1873 }
1874
1875# Check for duplicate signatures
1876 my $sig_nospace = $line;
1877 $sig_nospace =~ s/\s//g;
1878 $sig_nospace = lc($sig_nospace);
1879 if (defined $signatures{$sig_nospace}) {
1880 WARN("BAD_SIGN_OFF",
1881 "Duplicate signature\n" . $herecurr);
1882 } else {
1883 $signatures{$sig_nospace} = 1;
1884 }
1784 } 1885 }
1785 1886
1786# Check for wrappage within a valid hunk of the file 1887# Check for wrappage within a valid hunk of the file
@@ -1845,20 +1946,34 @@ sub process {
1845#trailing whitespace 1946#trailing whitespace
1846 if ($line =~ /^\+.*\015/) { 1947 if ($line =~ /^\+.*\015/) {
1847 my $herevet = "$here\n" . cat_vet($rawline) . "\n"; 1948 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
1848 ERROR("DOS_LINE_ENDINGS", 1949 if (ERROR("DOS_LINE_ENDINGS",
1849 "DOS line endings\n" . $herevet); 1950 "DOS line endings\n" . $herevet) &&
1850 1951 $fix) {
1952 $fixed[$linenr - 1] =~ s/[\s\015]+$//;
1953 }
1851 } elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) { 1954 } elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) {
1852 my $herevet = "$here\n" . cat_vet($rawline) . "\n"; 1955 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
1853 if (ERROR("TRAILING_WHITESPACE", 1956 if (ERROR("TRAILING_WHITESPACE",
1854 "trailing whitespace\n" . $herevet) && 1957 "trailing whitespace\n" . $herevet) &&
1855 $fix) { 1958 $fix) {
1856 $fixed[$linenr - 1] =~ s/^(\+.*?)\s+$/$1/; 1959 $fixed[$linenr - 1] =~ s/\s+$//;
1857 } 1960 }
1858 1961
1859 $rpt_cleaners = 1; 1962 $rpt_cleaners = 1;
1860 } 1963 }
1861 1964
1965# Check for FSF mailing addresses.
1966 if ($rawline =~ /You should have received a copy/ ||
1967 $rawline =~ /write to the Free Software/ ||
1968 $rawline =~ /59 Temple Place/ ||
1969 $rawline =~ /51 Franklin Street/) {
1970 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
1971 my $msg_type = \&ERROR;
1972 $msg_type = \&CHK if ($file);
1973 &{$msg_type}("FSF_MAILING_ADDRESS",
1974 "Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL.\n" . $herevet)
1975 }
1976
1862# check for Kconfig help text having a real description 1977# check for Kconfig help text having a real description
1863# Only applies when adding the entry originally, after that we do not have 1978# Only applies when adding the entry originally, after that we do not have
1864# sufficient context to determine whether it is indeed long enough. 1979# sufficient context to determine whether it is indeed long enough.
@@ -2060,6 +2175,7 @@ sub process {
2060 if ($realfile =~ m@^(drivers/net/|net/)@ && 2175 if ($realfile =~ m@^(drivers/net/|net/)@ &&
2061 $prevrawline =~ /^\+[ \t]*\/\*/ && #starting /* 2176 $prevrawline =~ /^\+[ \t]*\/\*/ && #starting /*
2062 $prevrawline !~ /\*\/[ \t]*$/ && #no trailing */ 2177 $prevrawline !~ /\*\/[ \t]*$/ && #no trailing */
2178 $rawline =~ /^\+/ && #line is new
2063 $rawline !~ /^\+[ \t]*\*/) { #no leading * 2179 $rawline !~ /^\+[ \t]*\*/) { #no leading *
2064 WARN("NETWORKING_BLOCK_COMMENT_STYLE", 2180 WARN("NETWORKING_BLOCK_COMMENT_STYLE",
2065 "networking block comments start with * on subsequent lines\n" . $hereprev); 2181 "networking block comments start with * on subsequent lines\n" . $hereprev);
@@ -2126,7 +2242,7 @@ sub process {
2126 $realline_next); 2242 $realline_next);
2127#print "LINE<$line>\n"; 2243#print "LINE<$line>\n";
2128 if ($linenr >= $suppress_statement && 2244 if ($linenr >= $suppress_statement &&
2129 $realcnt && $line =~ /.\s*\S/) { 2245 $realcnt && $sline =~ /.\s*\S/) {
2130 ($stat, $cond, $line_nr_next, $remain_next, $off_next) = 2246 ($stat, $cond, $line_nr_next, $remain_next, $off_next) =
2131 ctx_statement_block($linenr, $realcnt, 0); 2247 ctx_statement_block($linenr, $realcnt, 0);
2132 $stat =~ s/\n./\n /g; 2248 $stat =~ s/\n./\n /g;
@@ -2486,16 +2602,22 @@ sub process {
2486 } 2602 }
2487 2603
2488# check for global initialisers. 2604# check for global initialisers.
2489 if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) { 2605 if ($line =~ /^\+(\s*$Type\s*$Ident\s*(?:\s+$Modifier))*\s*=\s*(0|NULL|false)\s*;/) {
2490 ERROR("GLOBAL_INITIALISERS", 2606 if (ERROR("GLOBAL_INITIALISERS",
2491 "do not initialise globals to 0 or NULL\n" . 2607 "do not initialise globals to 0 or NULL\n" .
2492 $herecurr); 2608 $herecurr) &&
2609 $fix) {
2610 $fixed[$linenr - 1] =~ s/($Type\s*$Ident\s*(?:\s+$Modifier))*\s*=\s*(0|NULL|false)\s*;/$1;/;
2611 }
2493 } 2612 }
2494# check for static initialisers. 2613# check for static initialisers.
2495 if ($line =~ /\bstatic\s.*=\s*(0|NULL|false)\s*;/) { 2614 if ($line =~ /^\+.*\bstatic\s.*=\s*(0|NULL|false)\s*;/) {
2496 ERROR("INITIALISED_STATIC", 2615 if (ERROR("INITIALISED_STATIC",
2497 "do not initialise statics to 0 or NULL\n" . 2616 "do not initialise statics to 0 or NULL\n" .
2498 $herecurr); 2617 $herecurr) &&
2618 $fix) {
2619 $fixed[$linenr - 1] =~ s/(\bstatic\s.*?)\s*=\s*(0|NULL|false)\s*;/$1;/;
2620 }
2499 } 2621 }
2500 2622
2501# check for static const char * arrays. 2623# check for static const char * arrays.
@@ -2638,8 +2760,12 @@ sub process {
2638 } 2760 }
2639 2761
2640 if ($line =~ /\bpr_warning\s*\(/) { 2762 if ($line =~ /\bpr_warning\s*\(/) {
2641 WARN("PREFER_PR_LEVEL", 2763 if (WARN("PREFER_PR_LEVEL",
2642 "Prefer pr_warn(... to pr_warning(...\n" . $herecurr); 2764 "Prefer pr_warn(... to pr_warning(...\n" . $herecurr) &&
2765 $fix) {
2766 $fixed[$linenr - 1] =~
2767 s/\bpr_warning\b/pr_warn/;
2768 }
2643 } 2769 }
2644 2770
2645 if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) { 2771 if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) {
@@ -2739,7 +2865,7 @@ sub process {
2739 \+=|-=|\*=|\/=|%=|\^=|\|=|&=| 2865 \+=|-=|\*=|\/=|%=|\^=|\|=|&=|
2740 =>|->|<<|>>|<|>|=|!|~| 2866 =>|->|<<|>>|<|>|=|!|~|
2741 &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|%| 2867 &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|%|
2742 \?|: 2868 \?:|\?|:
2743 }x; 2869 }x;
2744 my @elements = split(/($ops|;)/, $opline); 2870 my @elements = split(/($ops|;)/, $opline);
2745 2871
@@ -2759,6 +2885,7 @@ sub process {
2759 $off = 0; 2885 $off = 0;
2760 2886
2761 my $blank = copy_spacing($opline); 2887 my $blank = copy_spacing($opline);
2888 my $last_after = -1;
2762 2889
2763 for (my $n = 0; $n < $#elements; $n += 2) { 2890 for (my $n = 0; $n < $#elements; $n += 2) {
2764 2891
@@ -2824,7 +2951,7 @@ sub process {
2824 $cc !~ /^\\/ && $cc !~ /^;/) { 2951 $cc !~ /^\\/ && $cc !~ /^;/) {
2825 if (ERROR("SPACING", 2952 if (ERROR("SPACING",
2826 "space required after that '$op' $at\n" . $hereptr)) { 2953 "space required after that '$op' $at\n" . $hereptr)) {
2827 $good = trim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " "; 2954 $good = $fix_elements[$n] . trim($fix_elements[$n + 1]) . " ";
2828 $line_fixed = 1; 2955 $line_fixed = 1;
2829 } 2956 }
2830 } 2957 }
@@ -2839,11 +2966,11 @@ sub process {
2839 if ($ctx =~ /Wx.|.xW/) { 2966 if ($ctx =~ /Wx.|.xW/) {
2840 if (ERROR("SPACING", 2967 if (ERROR("SPACING",
2841 "spaces prohibited around that '$op' $at\n" . $hereptr)) { 2968 "spaces prohibited around that '$op' $at\n" . $hereptr)) {
2842 $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]); 2969 $good = rtrim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
2843 $line_fixed = 1;
2844 if (defined $fix_elements[$n + 2]) { 2970 if (defined $fix_elements[$n + 2]) {
2845 $fix_elements[$n + 2] =~ s/^\s+//; 2971 $fix_elements[$n + 2] =~ s/^\s+//;
2846 } 2972 }
2973 $line_fixed = 1;
2847 } 2974 }
2848 } 2975 }
2849 2976
@@ -2852,8 +2979,9 @@ sub process {
2852 if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) { 2979 if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) {
2853 if (ERROR("SPACING", 2980 if (ERROR("SPACING",
2854 "space required after that '$op' $at\n" . $hereptr)) { 2981 "space required after that '$op' $at\n" . $hereptr)) {
2855 $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]) . " "; 2982 $good = $fix_elements[$n] . trim($fix_elements[$n + 1]) . " ";
2856 $line_fixed = 1; 2983 $line_fixed = 1;
2984 $last_after = $n;
2857 } 2985 }
2858 } 2986 }
2859 2987
@@ -2870,8 +2998,10 @@ sub process {
2870 if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) { 2998 if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) {
2871 if (ERROR("SPACING", 2999 if (ERROR("SPACING",
2872 "space required before that '$op' $at\n" . $hereptr)) { 3000 "space required before that '$op' $at\n" . $hereptr)) {
2873 $good = trim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]); 3001 if ($n != $last_after + 2) {
2874 $line_fixed = 1; 3002 $good = $fix_elements[$n] . " " . ltrim($fix_elements[$n + 1]);
3003 $line_fixed = 1;
3004 }
2875 } 3005 }
2876 } 3006 }
2877 if ($op eq '*' && $cc =~/\s*$Modifier\b/) { 3007 if ($op eq '*' && $cc =~/\s*$Modifier\b/) {
@@ -2880,12 +3010,11 @@ sub process {
2880 } elsif ($ctx =~ /.xW/) { 3010 } elsif ($ctx =~ /.xW/) {
2881 if (ERROR("SPACING", 3011 if (ERROR("SPACING",
2882 "space prohibited after that '$op' $at\n" . $hereptr)) { 3012 "space prohibited after that '$op' $at\n" . $hereptr)) {
2883 $fixed_line =~ s/\s+$//; 3013 $good = $fix_elements[$n] . rtrim($fix_elements[$n + 1]);
2884 $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
2885 $line_fixed = 1;
2886 if (defined $fix_elements[$n + 2]) { 3014 if (defined $fix_elements[$n + 2]) {
2887 $fix_elements[$n + 2] =~ s/^\s+//; 3015 $fix_elements[$n + 2] =~ s/^\s+//;
2888 } 3016 }
3017 $line_fixed = 1;
2889 } 3018 }
2890 } 3019 }
2891 3020
@@ -2894,8 +3023,7 @@ sub process {
2894 if ($ctx !~ /[WEOBC]x[^W]/ && $ctx !~ /[^W]x[WOBEC]/) { 3023 if ($ctx !~ /[WEOBC]x[^W]/ && $ctx !~ /[^W]x[WOBEC]/) {
2895 if (ERROR("SPACING", 3024 if (ERROR("SPACING",
2896 "space required one side of that '$op' $at\n" . $hereptr)) { 3025 "space required one side of that '$op' $at\n" . $hereptr)) {
2897 $fixed_line =~ s/\s+$//; 3026 $good = $fix_elements[$n] . trim($fix_elements[$n + 1]) . " ";
2898 $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]) . " ";
2899 $line_fixed = 1; 3027 $line_fixed = 1;
2900 } 3028 }
2901 } 3029 }
@@ -2903,20 +3031,18 @@ sub process {
2903 ($ctx =~ /Wx./ && $cc =~ /^;/)) { 3031 ($ctx =~ /Wx./ && $cc =~ /^;/)) {
2904 if (ERROR("SPACING", 3032 if (ERROR("SPACING",
2905 "space prohibited before that '$op' $at\n" . $hereptr)) { 3033 "space prohibited before that '$op' $at\n" . $hereptr)) {
2906 $fixed_line =~ s/\s+$//; 3034 $good = rtrim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
2907 $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
2908 $line_fixed = 1; 3035 $line_fixed = 1;
2909 } 3036 }
2910 } 3037 }
2911 if ($ctx =~ /ExW/) { 3038 if ($ctx =~ /ExW/) {
2912 if (ERROR("SPACING", 3039 if (ERROR("SPACING",
2913 "space prohibited after that '$op' $at\n" . $hereptr)) { 3040 "space prohibited after that '$op' $at\n" . $hereptr)) {
2914 $fixed_line =~ s/\s+$//; 3041 $good = $fix_elements[$n] . trim($fix_elements[$n + 1]);
2915 $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
2916 $line_fixed = 1;
2917 if (defined $fix_elements[$n + 2]) { 3042 if (defined $fix_elements[$n + 2]) {
2918 $fix_elements[$n + 2] =~ s/^\s+//; 3043 $fix_elements[$n + 2] =~ s/^\s+//;
2919 } 3044 }
3045 $line_fixed = 1;
2920 } 3046 }
2921 } 3047 }
2922 3048
@@ -2930,8 +3056,10 @@ sub process {
2930 if ($ctx =~ /Wx[^WCE]|[^WCE]xW/) { 3056 if ($ctx =~ /Wx[^WCE]|[^WCE]xW/) {
2931 if (ERROR("SPACING", 3057 if (ERROR("SPACING",
2932 "need consistent spacing around '$op' $at\n" . $hereptr)) { 3058 "need consistent spacing around '$op' $at\n" . $hereptr)) {
2933 $fixed_line =~ s/\s+$//; 3059 $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " ";
2934 $good = trim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " "; 3060 if (defined $fix_elements[$n + 2]) {
3061 $fix_elements[$n + 2] =~ s/^\s+//;
3062 }
2935 $line_fixed = 1; 3063 $line_fixed = 1;
2936 } 3064 }
2937 } 3065 }
@@ -2942,7 +3070,7 @@ sub process {
2942 if ($ctx =~ /Wx./) { 3070 if ($ctx =~ /Wx./) {
2943 if (ERROR("SPACING", 3071 if (ERROR("SPACING",
2944 "space prohibited before that '$op' $at\n" . $hereptr)) { 3072 "space prohibited before that '$op' $at\n" . $hereptr)) {
2945 $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]); 3073 $good = rtrim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
2946 $line_fixed = 1; 3074 $line_fixed = 1;
2947 } 3075 }
2948 } 3076 }
@@ -2960,17 +3088,17 @@ sub process {
2960 $ok = 1; 3088 $ok = 1;
2961 } 3089 }
2962 3090
2963 # Ignore ?: 3091 # messages are ERROR, but ?: are CHK
2964 if (($opv eq ':O' && $ca =~ /\?$/) ||
2965 ($op eq '?' && $cc =~ /^:/)) {
2966 $ok = 1;
2967 }
2968
2969 if ($ok == 0) { 3092 if ($ok == 0) {
2970 if (ERROR("SPACING", 3093 my $msg_type = \&ERROR;
2971 "spaces required around that '$op' $at\n" . $hereptr)) { 3094 $msg_type = \&CHK if (($op eq '?:' || $op eq '?' || $op eq ':') && $ctx =~ /VxV/);
2972 $good = trim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " "; 3095
2973 $good = $fix_elements[$n] . " " . trim($fix_elements[$n + 1]) . " "; 3096 if (&{$msg_type}("SPACING",
3097 "spaces required around that '$op' $at\n" . $hereptr)) {
3098 $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " ";
3099 if (defined $fix_elements[$n + 2]) {
3100 $fix_elements[$n + 2] =~ s/^\s+//;
3101 }
2974 $line_fixed = 1; 3102 $line_fixed = 1;
2975 } 3103 }
2976 } 3104 }
@@ -3031,8 +3159,7 @@ sub process {
3031 if (ERROR("SPACING", 3159 if (ERROR("SPACING",
3032 "space required before the open brace '{'\n" . $herecurr) && 3160 "space required before the open brace '{'\n" . $herecurr) &&
3033 $fix) { 3161 $fix) {
3034 $fixed[$linenr - 1] =~ 3162 $fixed[$linenr - 1] =~ s/^(\+.*(?:do|\))){/$1 {/;
3035 s/^(\+.*(?:do|\))){/$1 {/;
3036 } 3163 }
3037 } 3164 }
3038 3165
@@ -3047,8 +3174,12 @@ sub process {
3047# closing brace should have a space following it when it has anything 3174# closing brace should have a space following it when it has anything
3048# on the line 3175# on the line
3049 if ($line =~ /}(?!(?:,|;|\)))\S/) { 3176 if ($line =~ /}(?!(?:,|;|\)))\S/) {
3050 ERROR("SPACING", 3177 if (ERROR("SPACING",
3051 "space required after that close brace '}'\n" . $herecurr); 3178 "space required after that close brace '}'\n" . $herecurr) &&
3179 $fix) {
3180 $fixed[$linenr - 1] =~
3181 s/}((?!(?:,|;|\)))\S)/} $1/;
3182 }
3052 } 3183 }
3053 3184
3054# check spacing on square brackets 3185# check spacing on square brackets
@@ -3102,21 +3233,10 @@ sub process {
3102 } 3233 }
3103 3234
3104# Return is not a function. 3235# Return is not a function.
3105 if (defined($stat) && $stat =~ /^.\s*return(\s*)(\(.*);/s) { 3236 if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) {
3106 my $spacing = $1; 3237 my $spacing = $1;
3107 my $value = $2; 3238 if ($^V && $^V ge 5.10.0 &&
3108 3239 $stat =~ /^.\s*return\s*$balanced_parens\s*;\s*$/) {
3109 # Flatten any parentheses
3110 $value =~ s/\(/ \(/g;
3111 $value =~ s/\)/\) /g;
3112 while ($value =~ s/\[[^\[\]]*\]/1/ ||
3113 $value !~ /(?:$Ident|-?$Constant)\s*
3114 $Compare\s*
3115 (?:$Ident|-?$Constant)/x &&
3116 $value =~ s/\([^\(\)]*\)/1/) {
3117 }
3118#print "value<$value>\n";
3119 if ($value =~ /^\s*(?:$Ident|-?$Constant)\s*$/) {
3120 ERROR("RETURN_PARENTHESES", 3240 ERROR("RETURN_PARENTHESES",
3121 "return is not a function, parentheses are not required\n" . $herecurr); 3241 "return is not a function, parentheses are not required\n" . $herecurr);
3122 3242
@@ -3125,6 +3245,7 @@ sub process {
3125 "space required before the open parenthesis '('\n" . $herecurr); 3245 "space required before the open parenthesis '('\n" . $herecurr);
3126 } 3246 }
3127 } 3247 }
3248
3128# Return of what appears to be an errno should normally be -'ve 3249# Return of what appears to be an errno should normally be -'ve
3129 if ($line =~ /^.\s*return\s*(E[A-Z]*)\s*;/) { 3250 if ($line =~ /^.\s*return\s*(E[A-Z]*)\s*;/) {
3130 my $name = $1; 3251 my $name = $1;
@@ -3168,6 +3289,7 @@ sub process {
3168 } 3289 }
3169 } 3290 }
3170 if (!defined $suppress_whiletrailers{$linenr} && 3291 if (!defined $suppress_whiletrailers{$linenr} &&
3292 defined($stat) && defined($cond) &&
3171 $line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) { 3293 $line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) {
3172 my ($s, $c) = ($stat, $cond); 3294 my ($s, $c) = ($stat, $cond);
3173 3295
@@ -3271,8 +3393,13 @@ sub process {
3271 3393
3272#gcc binary extension 3394#gcc binary extension
3273 if ($var =~ /^$Binary$/) { 3395 if ($var =~ /^$Binary$/) {
3274 WARN("GCC_BINARY_CONSTANT", 3396 if (WARN("GCC_BINARY_CONSTANT",
3275 "Avoid gcc v4.3+ binary constant extension: <$var>\n" . $herecurr); 3397 "Avoid gcc v4.3+ binary constant extension: <$var>\n" . $herecurr) &&
3398 $fix) {
3399 my $hexval = sprintf("0x%x", oct($var));
3400 $fixed[$linenr - 1] =~
3401 s/\b$var\b/$hexval/;
3402 }
3276 } 3403 }
3277 3404
3278#CamelCase 3405#CamelCase
@@ -3282,19 +3409,32 @@ sub process {
3282 $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ && 3409 $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
3283#Ignore SI style variants like nS, mV and dB (ie: max_uV, regulator_min_uA_show) 3410#Ignore SI style variants like nS, mV and dB (ie: max_uV, regulator_min_uA_show)
3284 $var !~ /^(?:[a-z_]*?)_?[a-z][A-Z](?:_[a-z_]+)?$/) { 3411 $var !~ /^(?:[a-z_]*?)_?[a-z][A-Z](?:_[a-z_]+)?$/) {
3285 seed_camelcase_includes() if ($check); 3412 while ($var =~ m{($Ident)}g) {
3286 if (!defined $camelcase{$var}) { 3413 my $word = $1;
3287 $camelcase{$var} = 1; 3414 next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/);
3288 CHK("CAMELCASE", 3415 if ($check) {
3289 "Avoid CamelCase: <$var>\n" . $herecurr); 3416 seed_camelcase_includes();
3417 if (!$file && !$camelcase_file_seeded) {
3418 seed_camelcase_file($realfile);
3419 $camelcase_file_seeded = 1;
3420 }
3421 }
3422 if (!defined $camelcase{$word}) {
3423 $camelcase{$word} = 1;
3424 CHK("CAMELCASE",
3425 "Avoid CamelCase: <$word>\n" . $herecurr);
3426 }
3290 } 3427 }
3291 } 3428 }
3292 } 3429 }
3293 3430
3294#no spaces allowed after \ in define 3431#no spaces allowed after \ in define
3295 if ($line=~/\#\s*define.*\\\s$/) { 3432 if ($line =~ /\#\s*define.*\\\s+$/) {
3296 WARN("WHITESPACE_AFTER_LINE_CONTINUATION", 3433 if (WARN("WHITESPACE_AFTER_LINE_CONTINUATION",
3297 "Whitepspace after \\ makes next lines useless\n" . $herecurr); 3434 "Whitespace after \\ makes next lines useless\n" . $herecurr) &&
3435 $fix) {
3436 $fixed[$linenr - 1] =~ s/\s+$//;
3437 }
3298 } 3438 }
3299 3439
3300#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line) 3440#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line)
@@ -3374,7 +3514,8 @@ sub process {
3374 $dstat !~ /^for\s*$Constant$/ && # for (...) 3514 $dstat !~ /^for\s*$Constant$/ && # for (...)
3375 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar() 3515 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar()
3376 $dstat !~ /^do\s*{/ && # do {... 3516 $dstat !~ /^do\s*{/ && # do {...
3377 $dstat !~ /^\({/) # ({... 3517 $dstat !~ /^\({/ && # ({...
3518 $ctx !~ /^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/)
3378 { 3519 {
3379 $ctx =~ s/\n*$//; 3520 $ctx =~ s/\n*$//;
3380 my $herectx = $here . "\n"; 3521 my $herectx = $here . "\n";
@@ -3606,6 +3747,53 @@ sub process {
3606 } 3747 }
3607 } 3748 }
3608 3749
3750# check for bad placement of section $InitAttribute (e.g.: __initdata)
3751 if ($line =~ /(\b$InitAttribute\b)/) {
3752 my $attr = $1;
3753 if ($line =~ /^\+\s*static\s+(?:const\s+)?(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Ident(?:\[[^]]*\])?)\s*[=;]/) {
3754 my $ptr = $1;
3755 my $var = $2;
3756 if ((($ptr =~ /\b(union|struct)\s+$attr\b/ &&
3757 ERROR("MISPLACED_INIT",
3758 "$attr should be placed after $var\n" . $herecurr)) ||
3759 ($ptr !~ /\b(union|struct)\s+$attr\b/ &&
3760 WARN("MISPLACED_INIT",
3761 "$attr should be placed after $var\n" . $herecurr))) &&
3762 $fix) {
3763 $fixed[$linenr - 1] =~ s/(\bstatic\s+(?:const\s+)?)(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Ident(?:\[[^]]*\])?)\s*([=;])\s*/"$1" . trim(string_find_replace($2, "\\s*$attr\\s*", " ")) . " " . trim(string_find_replace($3, "\\s*$attr\\s*", "")) . " $attr" . ("$4" eq ";" ? ";" : " = ")/e;
3764 }
3765 }
3766 }
3767
3768# check for $InitAttributeData (ie: __initdata) with const
3769 if ($line =~ /\bconst\b/ && $line =~ /($InitAttributeData)/) {
3770 my $attr = $1;
3771 $attr =~ /($InitAttributePrefix)(.*)/;
3772 my $attr_prefix = $1;
3773 my $attr_type = $2;
3774 if (ERROR("INIT_ATTRIBUTE",
3775 "Use of const init definition must use ${attr_prefix}initconst\n" . $herecurr) &&
3776 $fix) {
3777 $fixed[$linenr - 1] =~
3778 s/$InitAttributeData/${attr_prefix}initconst/;
3779 }
3780 }
3781
3782# check for $InitAttributeConst (ie: __initconst) without const
3783 if ($line !~ /\bconst\b/ && $line =~ /($InitAttributeConst)/) {
3784 my $attr = $1;
3785 if (ERROR("INIT_ATTRIBUTE",
3786 "Use of $attr requires a separate use of const\n" . $herecurr) &&
3787 $fix) {
3788 my $lead = $fixed[$linenr - 1] =~
3789 /(^\+\s*(?:static\s+))/;
3790 $lead = rtrim($1);
3791 $lead = "$lead " if ($lead !~ /^\+$/);
3792 $lead = "${lead}const ";
3793 $fixed[$linenr - 1] =~ s/(^\+\s*(?:static\s+))/$lead/;
3794 }
3795 }
3796
3609# prefer usleep_range over udelay 3797# prefer usleep_range over udelay
3610 if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) { 3798 if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) {
3611 # ignore udelay's < 10, however 3799 # ignore udelay's < 10, however
@@ -3665,8 +3853,8 @@ sub process {
3665# check for memory barriers without a comment. 3853# check for memory barriers without a comment.
3666 if ($line =~ /\b(mb|rmb|wmb|read_barrier_depends|smp_mb|smp_rmb|smp_wmb|smp_read_barrier_depends)\(/) { 3854 if ($line =~ /\b(mb|rmb|wmb|read_barrier_depends|smp_mb|smp_rmb|smp_wmb|smp_read_barrier_depends)\(/) {
3667 if (!ctx_has_comment($first_line, $linenr)) { 3855 if (!ctx_has_comment($first_line, $linenr)) {
3668 CHK("MEMORY_BARRIER", 3856 WARN("MEMORY_BARRIER",
3669 "memory barrier without comment\n" . $herecurr); 3857 "memory barrier without comment\n" . $herecurr);
3670 } 3858 }
3671 } 3859 }
3672# check of hardware specific defines 3860# check of hardware specific defines
@@ -3690,33 +3878,49 @@ sub process {
3690 } 3878 }
3691 3879
3692# Check for __inline__ and __inline, prefer inline 3880# Check for __inline__ and __inline, prefer inline
3693 if ($line =~ /\b(__inline__|__inline)\b/) { 3881 if ($realfile !~ m@\binclude/uapi/@ &&
3694 WARN("INLINE", 3882 $line =~ /\b(__inline__|__inline)\b/) {
3695 "plain inline is preferred over $1\n" . $herecurr); 3883 if (WARN("INLINE",
3884 "plain inline is preferred over $1\n" . $herecurr) &&
3885 $fix) {
3886 $fixed[$linenr - 1] =~ s/\b(__inline__|__inline)\b/inline/;
3887
3888 }
3696 } 3889 }
3697 3890
3698# Check for __attribute__ packed, prefer __packed 3891# Check for __attribute__ packed, prefer __packed
3699 if ($line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) { 3892 if ($realfile !~ m@\binclude/uapi/@ &&
3893 $line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) {
3700 WARN("PREFER_PACKED", 3894 WARN("PREFER_PACKED",
3701 "__packed is preferred over __attribute__((packed))\n" . $herecurr); 3895 "__packed is preferred over __attribute__((packed))\n" . $herecurr);
3702 } 3896 }
3703 3897
3704# Check for __attribute__ aligned, prefer __aligned 3898# Check for __attribute__ aligned, prefer __aligned
3705 if ($line =~ /\b__attribute__\s*\(\s*\(.*aligned/) { 3899 if ($realfile !~ m@\binclude/uapi/@ &&
3900 $line =~ /\b__attribute__\s*\(\s*\(.*aligned/) {
3706 WARN("PREFER_ALIGNED", 3901 WARN("PREFER_ALIGNED",
3707 "__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr); 3902 "__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr);
3708 } 3903 }
3709 3904
3710# Check for __attribute__ format(printf, prefer __printf 3905# Check for __attribute__ format(printf, prefer __printf
3711 if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf/) { 3906 if ($realfile !~ m@\binclude/uapi/@ &&
3712 WARN("PREFER_PRINTF", 3907 $line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf/) {
3713 "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr); 3908 if (WARN("PREFER_PRINTF",
3909 "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr) &&
3910 $fix) {
3911 $fixed[$linenr - 1] =~ s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.*)\)\s*\)\s*\)/"__printf(" . trim($1) . ")"/ex;
3912
3913 }
3714 } 3914 }
3715 3915
3716# Check for __attribute__ format(scanf, prefer __scanf 3916# Check for __attribute__ format(scanf, prefer __scanf
3717 if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\b/) { 3917 if ($realfile !~ m@\binclude/uapi/@ &&
3718 WARN("PREFER_SCANF", 3918 $line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\b/) {
3719 "__scanf(string-index, first-to-check) is preferred over __attribute__((format(scanf, string-index, first-to-check)))\n" . $herecurr); 3919 if (WARN("PREFER_SCANF",
3920 "__scanf(string-index, first-to-check) is preferred over __attribute__((format(scanf, string-index, first-to-check)))\n" . $herecurr) &&
3921 $fix) {
3922 $fixed[$linenr - 1] =~ s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\s*,\s*(.*)\)\s*\)\s*\)/"__scanf(" . trim($1) . ")"/ex;
3923 }
3720 } 3924 }
3721 3925
3722# check for sizeof(&) 3926# check for sizeof(&)
@@ -3727,8 +3931,11 @@ sub process {
3727 3931
3728# check for sizeof without parenthesis 3932# check for sizeof without parenthesis
3729 if ($line =~ /\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/) { 3933 if ($line =~ /\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/) {
3730 WARN("SIZEOF_PARENTHESIS", 3934 if (WARN("SIZEOF_PARENTHESIS",
3731 "sizeof $1 should be sizeof($1)\n" . $herecurr); 3935 "sizeof $1 should be sizeof($1)\n" . $herecurr) &&
3936 $fix) {
3937 $fixed[$linenr - 1] =~ s/\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/"sizeof(" . trim($1) . ")"/ex;
3938 }
3732 } 3939 }
3733 3940
3734# check for line continuations in quoted strings with odd counts of " 3941# check for line continuations in quoted strings with odd counts of "
@@ -3744,11 +3951,14 @@ sub process {
3744 } 3951 }
3745 3952
3746# check for seq_printf uses that could be seq_puts 3953# check for seq_printf uses that could be seq_puts
3747 if ($line =~ /\bseq_printf\s*\(/) { 3954 if ($sline =~ /\bseq_printf\s*\(.*"\s*\)\s*;\s*$/) {
3748 my $fmt = get_quoted_string($line, $rawline); 3955 my $fmt = get_quoted_string($line, $rawline);
3749 if ($fmt !~ /[^\\]\%/) { 3956 if ($fmt ne "" && $fmt !~ /[^\\]\%/) {
3750 WARN("PREFER_SEQ_PUTS", 3957 if (WARN("PREFER_SEQ_PUTS",
3751 "Prefer seq_puts to seq_printf\n" . $herecurr); 3958 "Prefer seq_puts to seq_printf\n" . $herecurr) &&
3959 $fix) {
3960 $fixed[$linenr - 1] =~ s/\bseq_printf\b/seq_puts/;
3961 }
3752 } 3962 }
3753 } 3963 }
3754 3964
@@ -3810,6 +4020,33 @@ sub process {
3810 } 4020 }
3811 } 4021 }
3812 4022
4023# check for naked sscanf
4024 if ($^V && $^V ge 5.10.0 &&
4025 defined $stat &&
4026 $stat =~ /\bsscanf\b/ &&
4027 ($stat !~ /$Ident\s*=\s*sscanf\s*$balanced_parens/ &&
4028 $stat !~ /\bsscanf\s*$balanced_parens\s*(?:$Compare)/ &&
4029 $stat !~ /(?:$Compare)\s*\bsscanf\s*$balanced_parens/)) {
4030 my $lc = $stat =~ tr@\n@@;
4031 $lc = $lc + $linenr;
4032 my $stat_real = raw_line($linenr, 0);
4033 for (my $count = $linenr + 1; $count <= $lc; $count++) {
4034 $stat_real = $stat_real . "\n" . raw_line($count, 0);
4035 }
4036 WARN("NAKED_SSCANF",
4037 "unchecked sscanf return value\n" . "$here\n$stat_real\n");
4038 }
4039
4040# check for new externs in .h files.
4041 if ($realfile =~ /\.h$/ &&
4042 $line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) {
4043 if (CHK("AVOID_EXTERNS",
4044 "extern prototypes should be avoided in .h files\n" . $herecurr) &&
4045 $fix) {
4046 $fixed[$linenr - 1] =~ s/(.*)\bextern\b\s*(.*)/$1$2/;
4047 }
4048 }
4049
3813# check for new externs in .c files. 4050# check for new externs in .c files.
3814 if ($realfile =~ /\.c$/ && defined $stat && 4051 if ($realfile =~ /\.c$/ && defined $stat &&
3815 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s) 4052 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)
@@ -3879,8 +4116,11 @@ sub process {
3879 4116
3880# check for multiple semicolons 4117# check for multiple semicolons
3881 if ($line =~ /;\s*;\s*$/) { 4118 if ($line =~ /;\s*;\s*$/) {
3882 WARN("ONE_SEMICOLON", 4119 if (WARN("ONE_SEMICOLON",
3883 "Statements terminations use 1 semicolon\n" . $herecurr); 4120 "Statements terminations use 1 semicolon\n" . $herecurr) &&
4121 $fix) {
4122 $fixed[$linenr - 1] =~ s/(\s*;\s*){2,}$/;/g;
4123 }
3884 } 4124 }
3885 4125
3886# check for switch/default statements without a break; 4126# check for switch/default statements without a break;
@@ -3898,9 +4138,12 @@ sub process {
3898 } 4138 }
3899 4139
3900# check for gcc specific __FUNCTION__ 4140# check for gcc specific __FUNCTION__
3901 if ($line =~ /__FUNCTION__/) { 4141 if ($line =~ /\b__FUNCTION__\b/) {
3902 WARN("USE_FUNC", 4142 if (WARN("USE_FUNC",
3903 "__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); 4143 "__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr) &&
4144 $fix) {
4145 $fixed[$linenr - 1] =~ s/\b__FUNCTION__\b/__func__/g;
4146 }
3904 } 4147 }
3905 4148
3906# check for use of yield() 4149# check for use of yield()
@@ -4012,6 +4255,12 @@ sub process {
4012 "usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc\n" . $herecurr); 4255 "usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc\n" . $herecurr);
4013 } 4256 }
4014 4257
4258# Use of __ARCH_HAS_<FOO> or ARCH_HAVE_<BAR> is wrong.
4259 if ($line =~ /\+\s*#\s*define\s+((?:__)?ARCH_(?:HAS|HAVE)\w*)\b/) {
4260 ERROR("DEFINE_ARCH_HAS",
4261 "#define of '$1' is wrong - use Kconfig variables or standard guards instead\n" . $herecurr);
4262 }
4263
4015# check for %L{u,d,i} in strings 4264# check for %L{u,d,i} in strings
4016 my $string; 4265 my $string;
4017 while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) { 4266 while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) {
@@ -4105,13 +4354,8 @@ sub process {
4105 } 4354 }
4106 } 4355 }
4107 4356
4108 if ($quiet == 0 && keys %ignore_type) { 4357 hash_show_words(\%use_type, "Used");
4109 print "NOTE: Ignored message types:"; 4358 hash_show_words(\%ignore_type, "Ignored");
4110 foreach my $ignore (sort keys %ignore_type) {
4111 print " $ignore";
4112 }
4113 print "\n\n";
4114 }
4115 4359
4116 if ($clean == 0 && $fix && "@rawlines" ne "@fixed") { 4360 if ($clean == 0 && $fix && "@rawlines" ne "@fixed") {
4117 my $newfile = $filename . ".EXPERIMENTAL-checkpatch-fixes"; 4361 my $newfile = $filename . ".EXPERIMENTAL-checkpatch-fixes";
diff --git a/scripts/coccinelle/api/devm_request_and_ioremap.cocci b/scripts/coccinelle/api/devm_request_and_ioremap.cocci
deleted file mode 100644
index 562ec88b6352..000000000000
--- a/scripts/coccinelle/api/devm_request_and_ioremap.cocci
+++ /dev/null
@@ -1,105 +0,0 @@
1/// Reimplement a call to devm_request_mem_region followed by a call to ioremap
2/// or ioremap_nocache by a call to devm_request_and_ioremap.
3/// Devm_request_and_ioremap was introduced in
4/// 72f8c0bfa0de64c68ee59f40eb9b2683bffffbb0. It makes the code much more
5/// concise.
6///
7///
8// Confidence: High
9// Copyright: (C) 2011 Julia Lawall, INRIA/LIP6. GPLv2.
10// Copyright: (C) 2011 Gilles Muller, INRIA/LiP6. GPLv2.
11// URL: http://coccinelle.lip6.fr/
12// Comments:
13// Options: --no-includes --include-headers
14
15virtual patch
16virtual org
17virtual report
18virtual context
19
20@nm@
21expression myname;
22identifier i;
23@@
24
25struct platform_driver i = { .driver = { .name = myname } };
26
27@depends on patch@
28expression dev,res,size;
29@@
30
31-if (!devm_request_mem_region(dev, res->start, size,
32- \(res->name\|dev_name(dev)\))) {
33- ...
34- return ...;
35-}
36... when != res->start
37(
38-devm_ioremap(dev,res->start,size)
39+devm_request_and_ioremap(dev,res)
40|
41-devm_ioremap_nocache(dev,res->start,size)
42+devm_request_and_ioremap(dev,res)
43)
44... when any
45 when != res->start
46
47// this rule is separate from the previous one, because a single file can
48// have multiple values of myname
49@depends on patch@
50expression dev,res,size;
51expression nm.myname;
52@@
53
54-if (!devm_request_mem_region(dev, res->start, size,myname)) {
55- ...
56- return ...;
57-}
58... when != res->start
59(
60-devm_ioremap(dev,res->start,size)
61+devm_request_and_ioremap(dev,res)
62|
63-devm_ioremap_nocache(dev,res->start,size)
64+devm_request_and_ioremap(dev,res)
65)
66... when any
67 when != res->start
68
69
70@pb depends on org || report || context@
71expression dev,res,size;
72expression nm.myname;
73position p1,p2;
74@@
75
76*if
77 (!devm_request_mem_region@p1(dev, res->start, size,
78 \(res->name\|dev_name(dev)\|myname\))) {
79 ...
80 return ...;
81}
82... when != res->start
83(
84*devm_ioremap@p2(dev,res->start,size)
85|
86*devm_ioremap_nocache@p2(dev,res->start,size)
87)
88... when any
89 when != res->start
90
91@script:python depends on org@
92p1 << pb.p1;
93p2 << pb.p2;
94@@
95
96cocci.print_main("INFO: replace by devm_request_and_ioremap",p1)
97cocci.print_secs("",p2)
98
99@script:python depends on report@
100p1 << pb.p1;
101p2 << pb.p2;
102@@
103
104msg = "INFO: devm_request_mem_region followed by ioremap on line %s can be replaced by devm_request_and_ioremap" % (p2[0].line)
105coccilib.report.print_report(p1[0],msg)
diff --git a/scripts/coccinelle/misc/boolreturn.cocci b/scripts/coccinelle/misc/boolreturn.cocci
new file mode 100644
index 000000000000..a43c7b0c36ef
--- /dev/null
+++ b/scripts/coccinelle/misc/boolreturn.cocci
@@ -0,0 +1,58 @@
1/// Return statements in functions returning bool should use
2/// true/false instead of 1/0.
3//
4// Confidence: High
5// Options: --no-includes --include-headers
6
7virtual patch
8virtual report
9virtual context
10
11@r1 depends on patch@
12identifier fn;
13typedef bool;
14symbol false;
15symbol true;
16@@
17
18bool fn ( ... )
19{
20<...
21return
22(
23- 0
24+ false
25|
26- 1
27+ true
28)
29 ;
30...>
31}
32
33@r2 depends on report || context@
34identifier fn;
35position p;
36@@
37
38bool fn ( ... )
39{
40<...
41return
42(
43* 0@p
44|
45* 1@p
46)
47 ;
48...>
49}
50
51
52@script:python depends on report@
53p << r2.p;
54fn << r2.fn;
55@@
56
57msg = "WARNING: return of 0/1 in function '%s' with return type bool" % fn
58coccilib.report.print_report(p[0], msg)
diff --git a/scripts/config b/scripts/config
index 567120a87c39..68041793698c 100755
--- a/scripts/config
+++ b/scripts/config
@@ -62,15 +62,52 @@ checkarg() {
62 fi 62 fi
63} 63}
64 64
65txt_append() {
66 local anchor="$1"
67 local insert="$2"
68 local infile="$3"
69 local tmpfile="$infile.swp"
70
71 # sed append cmd: 'a\' + newline + text + newline
72 cmd="$(printf "a\\%b$insert" "\n")"
73
74 sed -e "/$anchor/$cmd" "$infile" >"$tmpfile"
75 # replace original file with the edited one
76 mv "$tmpfile" "$infile"
77}
78
79txt_subst() {
80 local before="$1"
81 local after="$2"
82 local infile="$3"
83 local tmpfile="$infile.swp"
84
85 sed -e "s:$before:$after:" "$infile" >"$tmpfile"
86 # replace original file with the edited one
87 mv "$tmpfile" "$infile"
88}
89
90txt_delete() {
91 local text="$1"
92 local infile="$2"
93 local tmpfile="$infile.swp"
94
95 sed -e "/$text/d" "$infile" >"$tmpfile"
96 # replace original file with the edited one
97 mv "$tmpfile" "$infile"
98}
99
65set_var() { 100set_var() {
66 local name=$1 new=$2 before=$3 101 local name=$1 new=$2 before=$3
67 102
68 name_re="^($name=|# $name is not set)" 103 name_re="^($name=|# $name is not set)"
69 before_re="^($before=|# $before is not set)" 104 before_re="^($before=|# $before is not set)"
70 if test -n "$before" && grep -Eq "$before_re" "$FN"; then 105 if test -n "$before" && grep -Eq "$before_re" "$FN"; then
71 sed -ri "/$before_re/a $new" "$FN" 106 txt_append "^$before=" "$new" "$FN"
107 txt_append "^# $before is not set" "$new" "$FN"
72 elif grep -Eq "$name_re" "$FN"; then 108 elif grep -Eq "$name_re" "$FN"; then
73 sed -ri "s:$name_re.*:$new:" "$FN" 109 txt_subst "^$name=.*" "$new" "$FN"
110 txt_subst "^# $name is not set" "$new" "$FN"
74 else 111 else
75 echo "$new" >>"$FN" 112 echo "$new" >>"$FN"
76 fi 113 fi
@@ -79,7 +116,8 @@ set_var() {
79undef_var() { 116undef_var() {
80 local name=$1 117 local name=$1
81 118
82 sed -ri "/^($name=|# $name is not set)/d" "$FN" 119 txt_delete "^$name=" "$FN"
120 txt_delete "^# $name is not set" "$FN"
83} 121}
84 122
85if [ "$1" = "--file" ]; then 123if [ "$1" = "--file" ]; then
diff --git a/scripts/diffconfig b/scripts/diffconfig
index b91f3e34d44d..6d672836e187 100755
--- a/scripts/diffconfig
+++ b/scripts/diffconfig
@@ -10,7 +10,7 @@
10import sys, os 10import sys, os
11 11
12def usage(): 12def usage():
13 print """Usage: diffconfig [-h] [-m] [<config1> <config2>] 13 print("""Usage: diffconfig [-h] [-m] [<config1> <config2>]
14 14
15Diffconfig is a simple utility for comparing two .config files. 15Diffconfig is a simple utility for comparing two .config files.
16Using standard diff to compare .config files often includes extraneous and 16Using standard diff to compare .config files often includes extraneous and
@@ -33,7 +33,7 @@ Example usage:
33 EXT2_FS y -> n 33 EXT2_FS y -> n
34 LOG_BUF_SHIFT 14 -> 16 34 LOG_BUF_SHIFT 14 -> 16
35 PRINTK_TIME n -> y 35 PRINTK_TIME n -> y
36""" 36""")
37 sys.exit(0) 37 sys.exit(0)
38 38
39# returns a dictionary of name/value pairs for config items in the file 39# returns a dictionary of name/value pairs for config items in the file
@@ -54,23 +54,23 @@ def print_config(op, config, value, new_value):
54 if merge_style: 54 if merge_style:
55 if new_value: 55 if new_value:
56 if new_value=="n": 56 if new_value=="n":
57 print "# CONFIG_%s is not set" % config 57 print("# CONFIG_%s is not set" % config)
58 else: 58 else:
59 print "CONFIG_%s=%s" % (config, new_value) 59 print("CONFIG_%s=%s" % (config, new_value))
60 else: 60 else:
61 if op=="-": 61 if op=="-":
62 print "-%s %s" % (config, value) 62 print("-%s %s" % (config, value))
63 elif op=="+": 63 elif op=="+":
64 print "+%s %s" % (config, new_value) 64 print("+%s %s" % (config, new_value))
65 else: 65 else:
66 print " %s %s -> %s" % (config, value, new_value) 66 print(" %s %s -> %s" % (config, value, new_value))
67 67
68def main(): 68def main():
69 global merge_style 69 global merge_style
70 70
71 # parse command line args 71 # parse command line args
72 if ("-h" in sys.argv or "--help" in sys.argv): 72 if ("-h" in sys.argv or "--help" in sys.argv):
73 usage() 73 usage()
74 74
75 merge_style = 0 75 merge_style = 0
76 if "-m" in sys.argv: 76 if "-m" in sys.argv:
@@ -79,23 +79,27 @@ def main():
79 79
80 argc = len(sys.argv) 80 argc = len(sys.argv)
81 if not (argc==1 or argc == 3): 81 if not (argc==1 or argc == 3):
82 print "Error: incorrect number of arguments or unrecognized option" 82 print("Error: incorrect number of arguments or unrecognized option")
83 usage() 83 usage()
84 84
85 if argc == 1: 85 if argc == 1:
86 # if no filenames given, assume .config and .config.old 86 # if no filenames given, assume .config and .config.old
87 build_dir="" 87 build_dir=""
88 if os.environ.has_key("KBUILD_OUTPUT"): 88 if "KBUILD_OUTPUT" in os.environ:
89 build_dir = os.environ["KBUILD_OUTPUT"]+"/" 89 build_dir = os.environ["KBUILD_OUTPUT"]+"/"
90
91 configa_filename = build_dir + ".config.old" 90 configa_filename = build_dir + ".config.old"
92 configb_filename = build_dir + ".config" 91 configb_filename = build_dir + ".config"
93 else: 92 else:
94 configa_filename = sys.argv[1] 93 configa_filename = sys.argv[1]
95 configb_filename = sys.argv[2] 94 configb_filename = sys.argv[2]
96 95
97 a = readconfig(file(configa_filename)) 96 try:
98 b = readconfig(file(configb_filename)) 97 a = readconfig(open(configa_filename))
98 b = readconfig(open(configb_filename))
99 except (IOError):
100 e = sys.exc_info()[1]
101 print("I/O error[%s]: %s\n" % (e.args[0],e.args[1]))
102 usage()
99 103
100 # print items in a but not b (accumulate, sort and print) 104 # print items in a but not b (accumulate, sort and print)
101 old = [] 105 old = []
@@ -121,8 +125,7 @@ def main():
121 125
122 # now print items in b but not in a 126 # now print items in b but not in a
123 # (items from b that were in a were removed above) 127 # (items from b that were in a were removed above)
124 new = b.keys() 128 new = sorted(b.keys())
125 new.sort()
126 for config in new: 129 for config in new:
127 print_config("+", config, None, b[config]) 130 print_config("+", config, None, b[config])
128 131
diff --git a/scripts/docproc.c b/scripts/docproc.c
index 4cfdc1797eb8..2b69eaf5b646 100644
--- a/scripts/docproc.c
+++ b/scripts/docproc.c
@@ -72,6 +72,7 @@ FILELINE * docsection;
72#define FUNCTION "-function" 72#define FUNCTION "-function"
73#define NOFUNCTION "-nofunction" 73#define NOFUNCTION "-nofunction"
74#define NODOCSECTIONS "-no-doc-sections" 74#define NODOCSECTIONS "-no-doc-sections"
75#define SHOWNOTFOUND "-show-not-found"
75 76
76static char *srctree, *kernsrctree; 77static char *srctree, *kernsrctree;
77 78
@@ -294,6 +295,7 @@ static void singfunc(char * filename, char * line)
294 int startofsym = 1; 295 int startofsym = 1;
295 vec[idx++] = KERNELDOC; 296 vec[idx++] = KERNELDOC;
296 vec[idx++] = DOCBOOK; 297 vec[idx++] = DOCBOOK;
298 vec[idx++] = SHOWNOTFOUND;
297 299
298 /* Split line up in individual parameters preceded by FUNCTION */ 300 /* Split line up in individual parameters preceded by FUNCTION */
299 for (i=0; line[i]; i++) { 301 for (i=0; line[i]; i++) {
@@ -325,7 +327,8 @@ static void singfunc(char * filename, char * line)
325 */ 327 */
326static void docsect(char *filename, char *line) 328static void docsect(char *filename, char *line)
327{ 329{
328 char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */ 330 /* kerneldoc -docbook -show-not-found -function "section" file NULL */
331 char *vec[7];
329 char *s; 332 char *s;
330 333
331 for (s = line; *s; s++) 334 for (s = line; *s; s++)
@@ -341,10 +344,11 @@ static void docsect(char *filename, char *line)
341 344
342 vec[0] = KERNELDOC; 345 vec[0] = KERNELDOC;
343 vec[1] = DOCBOOK; 346 vec[1] = DOCBOOK;
344 vec[2] = FUNCTION; 347 vec[2] = SHOWNOTFOUND;
345 vec[3] = line; 348 vec[3] = FUNCTION;
346 vec[4] = filename; 349 vec[4] = line;
347 vec[5] = NULL; 350 vec[5] = filename;
351 vec[6] = NULL;
348 exec_kernel_doc(vec); 352 exec_kernel_doc(vec);
349} 353}
350 354
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index b482f162a18a..ef474098d9f1 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -240,12 +240,24 @@ case "$arg" in
240 output_file="$1" 240 output_file="$1"
241 cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" 241 cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)"
242 output=${cpio_list} 242 output=${cpio_list}
243 echo "$output_file" | grep -q "\.gz$" && compr="gzip -n -9 -f" 243 echo "$output_file" | grep -q "\.gz$" \
244 echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f" 244 && [ -x "`which gzip 2> /dev/null`" ] \
245 echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f" 245 && compr="gzip -n -9 -f"
246 echo "$output_file" | grep -q "\.xz$" && \ 246 echo "$output_file" | grep -q "\.bz2$" \
247 compr="xz --check=crc32 --lzma2=dict=1MiB" 247 && [ -x "`which bzip2 2> /dev/null`" ] \
248 echo "$output_file" | grep -q "\.lzo$" && compr="lzop -9 -f" 248 && compr="bzip2 -9 -f"
249 echo "$output_file" | grep -q "\.lzma$" \
250 && [ -x "`which lzma 2> /dev/null`" ] \
251 && compr="lzma -9 -f"
252 echo "$output_file" | grep -q "\.xz$" \
253 && [ -x "`which xz 2> /dev/null`" ] \
254 && compr="xz --check=crc32 --lzma2=dict=1MiB"
255 echo "$output_file" | grep -q "\.lzo$" \
256 && [ -x "`which lzop 2> /dev/null`" ] \
257 && compr="lzop -9 -f"
258 echo "$output_file" | grep -q "\.lz4$" \
259 && [ -x "`which lz4 2> /dev/null`" ] \
260 && compr="lz4 -9 -f"
249 echo "$output_file" | grep -q "\.cpio$" && compr="cat" 261 echo "$output_file" | grep -q "\.cpio$" && compr="cat"
250 shift 262 shift
251 ;; 263 ;;
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 487ac6f37ca2..10085de886fe 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -55,6 +55,7 @@ static struct sym_entry *table;
55static unsigned int table_size, table_cnt; 55static unsigned int table_size, table_cnt;
56static int all_symbols = 0; 56static int all_symbols = 0;
57static char symbol_prefix_char = '\0'; 57static char symbol_prefix_char = '\0';
58static unsigned long long kernel_start_addr = 0;
58 59
59int token_profit[0x10000]; 60int token_profit[0x10000];
60 61
@@ -65,7 +66,10 @@ unsigned char best_table_len[256];
65 66
66static void usage(void) 67static void usage(void)
67{ 68{
68 fprintf(stderr, "Usage: kallsyms [--all-symbols] [--symbol-prefix=<prefix char>] < in.map > out.S\n"); 69 fprintf(stderr, "Usage: kallsyms [--all-symbols] "
70 "[--symbol-prefix=<prefix char>] "
71 "[--page-offset=<CONFIG_PAGE_OFFSET>] "
72 "< in.map > out.S\n");
69 exit(1); 73 exit(1);
70} 74}
71 75
@@ -111,6 +115,12 @@ static int read_symbol(FILE *in, struct sym_entry *s)
111 fprintf(stderr, "Read error or end of file.\n"); 115 fprintf(stderr, "Read error or end of file.\n");
112 return -1; 116 return -1;
113 } 117 }
118 if (strlen(str) > KSYM_NAME_LEN) {
119 fprintf(stderr, "Symbol %s too long for kallsyms (%zu vs %d).\n"
120 "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n",
121 str, strlen(str), KSYM_NAME_LEN);
122 return -1;
123 }
114 124
115 sym = str; 125 sym = str;
116 /* skip prefix char */ 126 /* skip prefix char */
@@ -194,6 +204,9 @@ static int symbol_valid(struct sym_entry *s)
194 int i; 204 int i;
195 int offset = 1; 205 int offset = 1;
196 206
207 if (s->addr < kernel_start_addr)
208 return 0;
209
197 /* skip prefix char */ 210 /* skip prefix char */
198 if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char) 211 if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char)
199 offset++; 212 offset++;
@@ -646,6 +659,9 @@ int main(int argc, char **argv)
646 if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\'')) 659 if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\''))
647 p++; 660 p++;
648 symbol_prefix_char = *p; 661 symbol_prefix_char = *p;
662 } else if (strncmp(argv[i], "--page-offset=", 14) == 0) {
663 const char *p = &argv[i][14];
664 kernel_start_addr = strtoull(p, NULL, 16);
649 } else 665 } else
650 usage(); 666 usage();
651 } 667 }
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index c55c227af463..87f723804079 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -140,7 +140,9 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
140 sym->flags |= def_flags; 140 sym->flags |= def_flags;
141 break; 141 break;
142 } 142 }
143 conf_warning("symbol value '%s' invalid for %s", p, sym->name); 143 if (def != S_DEF_AUTO)
144 conf_warning("symbol value '%s' invalid for %s",
145 p, sym->name);
144 return 1; 146 return 1;
145 case S_OTHER: 147 case S_OTHER:
146 if (*p != '"') { 148 if (*p != '"') {
@@ -161,7 +163,8 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
161 memmove(p2, p2 + 1, strlen(p2)); 163 memmove(p2, p2 + 1, strlen(p2));
162 } 164 }
163 if (!p2) { 165 if (!p2) {
164 conf_warning("invalid string found"); 166 if (def != S_DEF_AUTO)
167 conf_warning("invalid string found");
165 return 1; 168 return 1;
166 } 169 }
167 /* fall through */ 170 /* fall through */
@@ -172,7 +175,9 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
172 sym->def[def].val = strdup(p); 175 sym->def[def].val = strdup(p);
173 sym->flags |= def_flags; 176 sym->flags |= def_flags;
174 } else { 177 } else {
175 conf_warning("symbol value '%s' invalid for %s", p, sym->name); 178 if (def != S_DEF_AUTO)
179 conf_warning("symbol value '%s' invalid for %s",
180 p, sym->name);
176 return 1; 181 return 1;
177 } 182 }
178 break; 183 break;
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index df198a5f4822..ba663e1dc7e3 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -93,7 +93,7 @@ struct symbol {
93#define SYMBOL_CHOICEVAL 0x0020 /* used as a value in a choice block */ 93#define SYMBOL_CHOICEVAL 0x0020 /* used as a value in a choice block */
94#define SYMBOL_VALID 0x0080 /* set when symbol.curr is calculated */ 94#define SYMBOL_VALID 0x0080 /* set when symbol.curr is calculated */
95#define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */ 95#define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */
96#define SYMBOL_WRITE 0x0200 /* ? */ 96#define SYMBOL_WRITE 0x0200 /* write symbol to file (KCONFIG_CONFIG) */
97#define SYMBOL_CHANGED 0x0400 /* ? */ 97#define SYMBOL_CHANGED 0x0400 /* ? */
98#define SYMBOL_AUTO 0x1000 /* value from environment variable */ 98#define SYMBOL_AUTO 0x1000 /* value from environment variable */
99#define SYMBOL_CHECKED 0x2000 /* used during dependency checking */ 99#define SYMBOL_CHECKED 0x2000 /* used during dependency checking */
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 6c9c45f9fbba..59184bb41ef8 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -25,7 +25,7 @@
25static const char mconf_readme[] = N_( 25static const char mconf_readme[] = N_(
26"Overview\n" 26"Overview\n"
27"--------\n" 27"--------\n"
28"This interface let you select features and parameters for the build.\n" 28"This interface lets you select features and parameters for the build.\n"
29"Features can either be built-in, modularized, or ignored. Parameters\n" 29"Features can either be built-in, modularized, or ignored. Parameters\n"
30"must be entered in as decimal or hexadecimal numbers or text.\n" 30"must be entered in as decimal or hexadecimal numbers or text.\n"
31"\n" 31"\n"
@@ -39,15 +39,15 @@ static const char mconf_readme[] = N_(
39"\n" 39"\n"
40"To change any of these features, highlight it with the cursor\n" 40"To change any of these features, highlight it with the cursor\n"
41"keys and press <Y> to build it in, <M> to make it a module or\n" 41"keys and press <Y> to build it in, <M> to make it a module or\n"
42"<N> to removed it. You may also press the <Space Bar> to cycle\n" 42"<N> to remove it. You may also press the <Space Bar> to cycle\n"
43"through the available options (ie. Y->N->M->Y).\n" 43"through the available options (i.e. Y->N->M->Y).\n"
44"\n" 44"\n"
45"Some additional keyboard hints:\n" 45"Some additional keyboard hints:\n"
46"\n" 46"\n"
47"Menus\n" 47"Menus\n"
48"----------\n" 48"----------\n"
49"o Use the Up/Down arrow keys (cursor keys) to highlight the item\n" 49"o Use the Up/Down arrow keys (cursor keys) to highlight the item you\n"
50" you wish to change or submenu wish to select and press <Enter>.\n" 50" wish to change or the submenu you wish to select and press <Enter>.\n"
51" Submenus are designated by \"--->\", empty ones by \"----\".\n" 51" Submenus are designated by \"--->\", empty ones by \"----\".\n"
52"\n" 52"\n"
53" Shortcut: Press the option's highlighted letter (hotkey).\n" 53" Shortcut: Press the option's highlighted letter (hotkey).\n"
@@ -65,7 +65,7 @@ static const char mconf_readme[] = N_(
65" there is a delayed response which you may find annoying.\n" 65" there is a delayed response which you may find annoying.\n"
66"\n" 66"\n"
67" Also, the <TAB> and cursor keys will cycle between <Select>,\n" 67" Also, the <TAB> and cursor keys will cycle between <Select>,\n"
68" <Exit> and <Help>.\n" 68" <Exit>, <Help>, <Save>, and <Load>.\n"
69"\n" 69"\n"
70"o To get help with an item, use the cursor keys to highlight <Help>\n" 70"o To get help with an item, use the cursor keys to highlight <Help>\n"
71" and press <ENTER>.\n" 71" and press <ENTER>.\n"
@@ -105,7 +105,7 @@ static const char mconf_readme[] = N_(
105"Text Box (Help Window)\n" 105"Text Box (Help Window)\n"
106"--------\n" 106"--------\n"
107"o Use the cursor keys to scroll up/down/left/right. The VI editor\n" 107"o Use the cursor keys to scroll up/down/left/right. The VI editor\n"
108" keys h,j,k,l function here as do <u>, <d>, <SPACE BAR> and <B> for \n" 108" keys h,j,k,l function here as do <u>, <d>, <SPACE BAR> and <B> for\n"
109" those who are familiar with less and lynx.\n" 109" those who are familiar with less and lynx.\n"
110"\n" 110"\n"
111"o Press <E>, <X>, <q>, <Enter> or <Esc><Esc> to exit.\n" 111"o Press <E>, <X>, <q>, <Enter> or <Esc><Esc> to exit.\n"
@@ -117,23 +117,21 @@ static const char mconf_readme[] = N_(
117"those who, for various reasons, find it necessary to switch\n" 117"those who, for various reasons, find it necessary to switch\n"
118"between different configurations.\n" 118"between different configurations.\n"
119"\n" 119"\n"
120"At the end of the main menu you will find two options. One is\n" 120"The <Save> button will let you save the current configuration to\n"
121"for saving the current configuration to a file of your choosing.\n" 121"a file of your choosing. Use the <Load> button to load a previously\n"
122"The other option is for loading a previously saved alternate\n" 122"saved alternate configuration.\n"
123"configuration.\n"
124"\n" 123"\n"
125"Even if you don't use alternate configuration files, but you\n" 124"Even if you don't use alternate configuration files, but you find\n"
126"find during a Menuconfig session that you have completely messed\n" 125"during a Menuconfig session that you have completely messed up your\n"
127"up your settings, you may use the \"Load Alternate...\" option to\n" 126"settings, you may use the <Load> button to restore your previously\n"
128"restore your previously saved settings from \".config\" without\n" 127"saved settings from \".config\" without restarting Menuconfig.\n"
129"restarting Menuconfig.\n"
130"\n" 128"\n"
131"Other information\n" 129"Other information\n"
132"-----------------\n" 130"-----------------\n"
133"If you use Menuconfig in an XTERM window make sure you have your\n" 131"If you use Menuconfig in an XTERM window, make sure you have your\n"
134"$TERM variable set to point to a xterm definition which supports color.\n" 132"$TERM variable set to point to an xterm definition which supports\n"
135"Otherwise, Menuconfig will look rather bad. Menuconfig will not\n" 133"color. Otherwise, Menuconfig will look rather bad. Menuconfig will\n"
136"display correctly in a RXVT window because rxvt displays only one\n" 134"not display correctly in an RXVT window because rxvt displays only one\n"
137"intensity of color, bright.\n" 135"intensity of color, bright.\n"
138"\n" 136"\n"
139"Menuconfig will display larger menus on screens or xterms which are\n" 137"Menuconfig will display larger menus on screens or xterms which are\n"
@@ -148,8 +146,8 @@ static const char mconf_readme[] = N_(
148"\n" 146"\n"
149"Optional personality available\n" 147"Optional personality available\n"
150"------------------------------\n" 148"------------------------------\n"
151"If you prefer to have all of the options listed in a single menu, rather\n" 149"If you prefer to have all of the options listed in a single menu,\n"
152"than the default multimenu hierarchy, run the menuconfig with\n" 150"rather than the default multimenu hierarchy, run the menuconfig with\n"
153"MENUCONFIG_MODE environment variable set to single_menu. Example:\n" 151"MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
154"\n" 152"\n"
155"make MENUCONFIG_MODE=single_menu menuconfig\n" 153"make MENUCONFIG_MODE=single_menu menuconfig\n"
@@ -172,7 +170,7 @@ static const char mconf_readme[] = N_(
172" mono => selects colors suitable for monochrome displays\n" 170" mono => selects colors suitable for monochrome displays\n"
173" blackbg => selects a color scheme with black background\n" 171" blackbg => selects a color scheme with black background\n"
174" classic => theme with blue background. The classic look\n" 172" classic => theme with blue background. The classic look\n"
175" bluetitle => a LCD friendly version of classic. (default)\n" 173" bluetitle => an LCD friendly version of classic. (default)\n"
176"\n"), 174"\n"),
177menu_instructions[] = N_( 175menu_instructions[] = N_(
178 "Arrow keys navigate the menu. " 176 "Arrow keys navigate the menu. "
@@ -238,24 +236,24 @@ search_help[] = N_(
238 "Symbol: FOO [=m]\n" 236 "Symbol: FOO [=m]\n"
239 "Type : tristate\n" 237 "Type : tristate\n"
240 "Prompt: Foo bus is used to drive the bar HW\n" 238 "Prompt: Foo bus is used to drive the bar HW\n"
241 " Defined at drivers/pci/Kconfig:47\n"
242 " Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
243 " Location:\n" 239 " Location:\n"
244 " -> Bus options (PCI, PCMCIA, EISA, ISA)\n" 240 " -> Bus options (PCI, PCMCIA, EISA, ISA)\n"
245 " -> PCI support (PCI [=y])\n" 241 " -> PCI support (PCI [=y])\n"
246 "(1) -> PCI access mode (<choice> [=y])\n" 242 "(1) -> PCI access mode (<choice> [=y])\n"
243 " Defined at drivers/pci/Kconfig:47\n"
244 " Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
247 " Selects: LIBCRC32\n" 245 " Selects: LIBCRC32\n"
248 " Selected by: BAR\n" 246 " Selected by: BAR [=n]\n"
249 "-----------------------------------------------------------------\n" 247 "-----------------------------------------------------------------\n"
250 "o The line 'Type:' shows the type of the configuration option for\n" 248 "o The line 'Type:' shows the type of the configuration option for\n"
251 " this symbol (boolean, tristate, string, ...)\n" 249 " this symbol (boolean, tristate, string, ...)\n"
252 "o The line 'Prompt:' shows the text used in the menu structure for\n" 250 "o The line 'Prompt:' shows the text used in the menu structure for\n"
253 " this symbol\n" 251 " this symbol\n"
254 "o The 'Defined at' line tell at what file / line number the symbol\n" 252 "o The 'Defined at' line tells at what file / line number the symbol\n"
255 " is defined\n" 253 " is defined\n"
256 "o The 'Depends on:' line tell what symbols needs to be defined for\n" 254 "o The 'Depends on:' line tells what symbols need to be defined for\n"
257 " this symbol to be visible in the menu (selectable)\n" 255 " this symbol to be visible in the menu (selectable)\n"
258 "o The 'Location:' lines tell where in the menu structure this symbol\n" 256 "o The 'Location:' lines tells where in the menu structure this symbol\n"
259 " is located\n" 257 " is located\n"
260 " A location followed by a [=y] indicates that this is a\n" 258 " A location followed by a [=y] indicates that this is a\n"
261 " selectable menu item - and the current value is displayed inside\n" 259 " selectable menu item - and the current value is displayed inside\n"
@@ -263,9 +261,9 @@ search_help[] = N_(
263 " Press the key in the (#) prefix to jump directly to that\n" 261 " Press the key in the (#) prefix to jump directly to that\n"
264 " location. You will be returned to the current search results\n" 262 " location. You will be returned to the current search results\n"
265 " after exiting this new menu.\n" 263 " after exiting this new menu.\n"
266 "o The 'Selects:' line tell what symbol will be automatically\n" 264 "o The 'Selects:' line tells what symbols will be automatically\n"
267 " selected if this symbol is selected (y or m)\n" 265 " selected if this symbol is selected (y or m)\n"
268 "o The 'Selected by' line tell what symbol has selected this symbol\n" 266 "o The 'Selected by' line tells what symbol has selected this symbol\n"
269 "\n" 267 "\n"
270 "Only relevant lines are shown.\n" 268 "Only relevant lines are shown.\n"
271 "\n\n" 269 "\n\n"
@@ -401,8 +399,8 @@ static void search_conf(void)
401 struct subtitle_part stpart; 399 struct subtitle_part stpart;
402 400
403 title = str_new(); 401 title = str_new();
404 str_printf( &title, _("Enter %s (sub)string or regexp to search for " 402 str_printf( &title, _("Enter (sub)string or regexp to search for "
405 "(with or without \"%s\")"), CONFIG_, CONFIG_); 403 "(with or without \"%s\")"), CONFIG_);
406 404
407again: 405again:
408 dialog_clear(); 406 dialog_clear();
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 7e233a6ca64e..db1512ae30cc 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -119,9 +119,10 @@ void menu_set_type(int type)
119 sym->type = type; 119 sym->type = type;
120 return; 120 return;
121 } 121 }
122 menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'", 122 menu_warn(current_entry,
123 sym->name ? sym->name : "<choice>", 123 "ignoring type redefinition of '%s' from '%s' to '%s'",
124 sym_type_name(sym->type), sym_type_name(type)); 124 sym->name ? sym->name : "<choice>",
125 sym_type_name(sym->type), sym_type_name(type));
125} 126}
126 127
127struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) 128struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep)
@@ -197,12 +198,15 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
197 198
198void menu_add_option(int token, char *arg) 199void menu_add_option(int token, char *arg)
199{ 200{
200 struct property *prop;
201
202 switch (token) { 201 switch (token) {
203 case T_OPT_MODULES: 202 case T_OPT_MODULES:
204 prop = prop_alloc(P_DEFAULT, modules_sym); 203 if (modules_sym)
205 prop->expr = expr_alloc_symbol(current_entry->sym); 204 zconf_error("symbol '%s' redefines option 'modules'"
205 " already defined by symbol '%s'",
206 current_entry->sym->name,
207 modules_sym->name
208 );
209 modules_sym = current_entry->sym;
206 break; 210 break;
207 case T_OPT_DEFCONFIG_LIST: 211 case T_OPT_DEFCONFIG_LIST:
208 if (!sym_defconfig_list) 212 if (!sym_defconfig_list)
@@ -580,7 +584,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
580 for (j = 4; --i >= 0; j += 2) { 584 for (j = 4; --i >= 0; j += 2) {
581 menu = submenu[i]; 585 menu = submenu[i];
582 if (head && location && menu == location) 586 if (head && location && menu == location)
583 jump->offset = r->len - 1; 587 jump->offset = strlen(r->s);
584 str_printf(r, "%*c-> %s", j, ' ', 588 str_printf(r, "%*c-> %s", j, ' ',
585 _(menu_get_prompt(menu))); 589 _(menu_get_prompt(menu)));
586 if (menu->sym) { 590 if (menu->sym) {
@@ -594,7 +598,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
594} 598}
595 599
596/* 600/*
597 * get peoperty of type P_SYMBOL 601 * get property of type P_SYMBOL
598 */ 602 */
599static struct property *get_symbol_prop(struct symbol *sym) 603static struct property *get_symbol_prop(struct symbol *sym)
600{ 604{
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 7975d8d258c3..4fbecd2473bc 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -695,8 +695,8 @@ static void search_conf(void)
695 int dres; 695 int dres;
696 696
697 title = str_new(); 697 title = str_new();
698 str_printf( &title, _("Enter %s (sub)string or regexp to search for " 698 str_printf( &title, _("Enter (sub)string or regexp to search for "
699 "(with or without \"%s\")"), CONFIG_, CONFIG_); 699 "(with or without \"%s\")"), CONFIG_);
700 700
701again: 701again:
702 dres = dialog_inputbox(main_window, 702 dres = dialog_inputbox(main_window,
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 1500c38f0cca..9d3b04b0769c 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -69,6 +69,11 @@ static inline QString qgettext(const QString& str)
69 return QString::fromLocal8Bit(gettext(str.latin1())); 69 return QString::fromLocal8Bit(gettext(str.latin1()));
70} 70}
71 71
72ConfigSettings::ConfigSettings()
73 : QSettings("kernel.org", "qconf")
74{
75}
76
72/** 77/**
73 * Reads a list of integer values from the application settings. 78 * Reads a list of integer values from the application settings.
74 */ 79 */
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 3715b3e7212c..bde0c6b6f9e8 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -32,6 +32,7 @@ class ConfigMainWindow;
32 32
33class ConfigSettings : public QSettings { 33class ConfigSettings : public QSettings {
34public: 34public:
35 ConfigSettings();
35 Q3ValueList<int> readSizes(const QString& key, bool *ok); 36 Q3ValueList<int> readSizes(const QString& key, bool *ok);
36 bool writeSizes(const QString& key, const Q3ValueList<int>& value); 37 bool writeSizes(const QString& key, const Q3ValueList<int>& value);
37}; 38};
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index d550300ec00c..7caabdb51c64 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -136,7 +136,7 @@ static struct property *sym_get_range_prop(struct symbol *sym)
136 return NULL; 136 return NULL;
137} 137}
138 138
139static long sym_get_range_val(struct symbol *sym, int base) 139static long long sym_get_range_val(struct symbol *sym, int base)
140{ 140{
141 sym_calc_value(sym); 141 sym_calc_value(sym);
142 switch (sym->type) { 142 switch (sym->type) {
@@ -149,13 +149,14 @@ static long sym_get_range_val(struct symbol *sym, int base)
149 default: 149 default:
150 break; 150 break;
151 } 151 }
152 return strtol(sym->curr.val, NULL, base); 152 return strtoll(sym->curr.val, NULL, base);
153} 153}
154 154
155static void sym_validate_range(struct symbol *sym) 155static void sym_validate_range(struct symbol *sym)
156{ 156{
157 struct property *prop; 157 struct property *prop;
158 long base, val, val2; 158 int base;
159 long long val, val2;
159 char str[64]; 160 char str[64];
160 161
161 switch (sym->type) { 162 switch (sym->type) {
@@ -171,7 +172,7 @@ static void sym_validate_range(struct symbol *sym)
171 prop = sym_get_range_prop(sym); 172 prop = sym_get_range_prop(sym);
172 if (!prop) 173 if (!prop)
173 return; 174 return;
174 val = strtol(sym->curr.val, NULL, base); 175 val = strtoll(sym->curr.val, NULL, base);
175 val2 = sym_get_range_val(prop->expr->left.sym, base); 176 val2 = sym_get_range_val(prop->expr->left.sym, base);
176 if (val >= val2) { 177 if (val >= val2) {
177 val2 = sym_get_range_val(prop->expr->right.sym, base); 178 val2 = sym_get_range_val(prop->expr->right.sym, base);
@@ -179,9 +180,9 @@ static void sym_validate_range(struct symbol *sym)
179 return; 180 return;
180 } 181 }
181 if (sym->type == S_INT) 182 if (sym->type == S_INT)
182 sprintf(str, "%ld", val2); 183 sprintf(str, "%lld", val2);
183 else 184 else
184 sprintf(str, "0x%lx", val2); 185 sprintf(str, "0x%llx", val2);
185 sym->curr.val = strdup(str); 186 sym->curr.val = strdup(str);
186} 187}
187 188
@@ -594,7 +595,7 @@ bool sym_string_valid(struct symbol *sym, const char *str)
594bool sym_string_within_range(struct symbol *sym, const char *str) 595bool sym_string_within_range(struct symbol *sym, const char *str)
595{ 596{
596 struct property *prop; 597 struct property *prop;
597 long val; 598 long long val;
598 599
599 switch (sym->type) { 600 switch (sym->type) {
600 case S_STRING: 601 case S_STRING:
@@ -605,7 +606,7 @@ bool sym_string_within_range(struct symbol *sym, const char *str)
605 prop = sym_get_range_prop(sym); 606 prop = sym_get_range_prop(sym);
606 if (!prop) 607 if (!prop)
607 return true; 608 return true;
608 val = strtol(str, NULL, 10); 609 val = strtoll(str, NULL, 10);
609 return val >= sym_get_range_val(prop->expr->left.sym, 10) && 610 return val >= sym_get_range_val(prop->expr->left.sym, 10) &&
610 val <= sym_get_range_val(prop->expr->right.sym, 10); 611 val <= sym_get_range_val(prop->expr->right.sym, 10);
611 case S_HEX: 612 case S_HEX:
@@ -614,7 +615,7 @@ bool sym_string_within_range(struct symbol *sym, const char *str)
614 prop = sym_get_range_prop(sym); 615 prop = sym_get_range_prop(sym);
615 if (!prop) 616 if (!prop)
616 return true; 617 return true;
617 val = strtol(str, NULL, 16); 618 val = strtoll(str, NULL, 16);
618 return val >= sym_get_range_val(prop->expr->left.sym, 16) && 619 return val >= sym_get_range_val(prop->expr->left.sym, 16) &&
619 val <= sym_get_range_val(prop->expr->right.sym, 16); 620 val <= sym_get_range_val(prop->expr->right.sym, 16);
620 case S_BOOLEAN: 621 case S_BOOLEAN:
@@ -963,11 +964,11 @@ struct sym_match {
963 * - first, symbols that match exactly 964 * - first, symbols that match exactly
964 * - then, alphabetical sort 965 * - then, alphabetical sort
965 */ 966 */
966static int sym_rel_comp( const void *sym1, const void *sym2 ) 967static int sym_rel_comp(const void *sym1, const void *sym2)
967{ 968{
968 struct sym_match *s1 = *(struct sym_match **)sym1; 969 const struct sym_match *s1 = sym1;
969 struct sym_match *s2 = *(struct sym_match **)sym2; 970 const struct sym_match *s2 = sym2;
970 int l1, l2; 971 int exact1, exact2;
971 972
972 /* Exact match: 973 /* Exact match:
973 * - if matched length on symbol s1 is the length of that symbol, 974 * - if matched length on symbol s1 is the length of that symbol,
@@ -978,11 +979,11 @@ static int sym_rel_comp( const void *sym1, const void *sym2 )
978 * exactly; if this is the case, we can't decide which comes first, 979 * exactly; if this is the case, we can't decide which comes first,
979 * and we fallback to sorting alphabetically. 980 * and we fallback to sorting alphabetically.
980 */ 981 */
981 l1 = s1->eo - s1->so; 982 exact1 = (s1->eo - s1->so) == strlen(s1->sym->name);
982 l2 = s2->eo - s2->so; 983 exact2 = (s2->eo - s2->so) == strlen(s2->sym->name);
983 if (l1 == strlen(s1->sym->name) && l2 != strlen(s2->sym->name)) 984 if (exact1 && !exact2)
984 return -1; 985 return -1;
985 if (l1 != strlen(s1->sym->name) && l2 == strlen(s2->sym->name)) 986 if (!exact1 && exact2)
986 return 1; 987 return 1;
987 988
988 /* As a fallback, sort symbols alphabetically */ 989 /* As a fallback, sort symbols alphabetically */
@@ -992,7 +993,7 @@ static int sym_rel_comp( const void *sym1, const void *sym2 )
992struct symbol **sym_re_search(const char *pattern) 993struct symbol **sym_re_search(const char *pattern)
993{ 994{
994 struct symbol *sym, **sym_arr = NULL; 995 struct symbol *sym, **sym_arr = NULL;
995 struct sym_match **sym_match_arr = NULL; 996 struct sym_match *sym_match_arr = NULL;
996 int i, cnt, size; 997 int i, cnt, size;
997 regex_t re; 998 regex_t re;
998 regmatch_t match[1]; 999 regmatch_t match[1];
@@ -1005,47 +1006,38 @@ struct symbol **sym_re_search(const char *pattern)
1005 return NULL; 1006 return NULL;
1006 1007
1007 for_all_symbols(i, sym) { 1008 for_all_symbols(i, sym) {
1008 struct sym_match *tmp_sym_match;
1009 if (sym->flags & SYMBOL_CONST || !sym->name) 1009 if (sym->flags & SYMBOL_CONST || !sym->name)
1010 continue; 1010 continue;
1011 if (regexec(&re, sym->name, 1, match, 0)) 1011 if (regexec(&re, sym->name, 1, match, 0))
1012 continue; 1012 continue;
1013 if (cnt + 1 >= size) { 1013 if (cnt >= size) {
1014 void *tmp; 1014 void *tmp;
1015 size += 16; 1015 size += 16;
1016 tmp = realloc(sym_match_arr, size * sizeof(struct sym_match *)); 1016 tmp = realloc(sym_match_arr, size * sizeof(struct sym_match));
1017 if (!tmp) { 1017 if (!tmp)
1018 goto sym_re_search_free; 1018 goto sym_re_search_free;
1019 }
1020 sym_match_arr = tmp; 1019 sym_match_arr = tmp;
1021 } 1020 }
1022 sym_calc_value(sym); 1021 sym_calc_value(sym);
1023 tmp_sym_match = (struct sym_match*)malloc(sizeof(struct sym_match)); 1022 /* As regexec returned 0, we know we have a match, so
1024 if (!tmp_sym_match)
1025 goto sym_re_search_free;
1026 tmp_sym_match->sym = sym;
1027 /* As regexec return 0, we know we have a match, so
1028 * we can use match[0].rm_[se]o without further checks 1023 * we can use match[0].rm_[se]o without further checks
1029 */ 1024 */
1030 tmp_sym_match->so = match[0].rm_so; 1025 sym_match_arr[cnt].so = match[0].rm_so;
1031 tmp_sym_match->eo = match[0].rm_eo; 1026 sym_match_arr[cnt].eo = match[0].rm_eo;
1032 sym_match_arr[cnt++] = tmp_sym_match; 1027 sym_match_arr[cnt++].sym = sym;
1033 } 1028 }
1034 if (sym_match_arr) { 1029 if (sym_match_arr) {
1035 qsort(sym_match_arr, cnt, sizeof(struct sym_match*), sym_rel_comp); 1030 qsort(sym_match_arr, cnt, sizeof(struct sym_match), sym_rel_comp);
1036 sym_arr = malloc((cnt+1) * sizeof(struct symbol)); 1031 sym_arr = malloc((cnt+1) * sizeof(struct symbol));
1037 if (!sym_arr) 1032 if (!sym_arr)
1038 goto sym_re_search_free; 1033 goto sym_re_search_free;
1039 for (i = 0; i < cnt; i++) 1034 for (i = 0; i < cnt; i++)
1040 sym_arr[i] = sym_match_arr[i]->sym; 1035 sym_arr[i] = sym_match_arr[i].sym;
1041 sym_arr[cnt] = NULL; 1036 sym_arr[cnt] = NULL;
1042 } 1037 }
1043sym_re_search_free: 1038sym_re_search_free:
1044 if (sym_match_arr) { 1039 /* sym_match_arr can be NULL if no match, but free(NULL) is OK */
1045 for (i = 0; i < cnt; i++) 1040 free(sym_match_arr);
1046 free(sym_match_arr[i]);
1047 free(sym_match_arr);
1048 }
1049 regfree(&re); 1041 regfree(&re);
1050 1042
1051 return sym_arr; 1043 return sym_arr;
@@ -1055,7 +1047,7 @@ sym_re_search_free:
1055 * When we check for recursive dependencies we use a stack to save 1047 * When we check for recursive dependencies we use a stack to save
1056 * current state so we can print out relevant info to user. 1048 * current state so we can print out relevant info to user.
1057 * The entries are located on the call stack so no need to free memory. 1049 * The entries are located on the call stack so no need to free memory.
1058 * Note inser() remove() must always match to properly clear the stack. 1050 * Note insert() remove() must always match to properly clear the stack.
1059 */ 1051 */
1060static struct dep_stack { 1052static struct dep_stack {
1061 struct dep_stack *prev, *next; 1053 struct dep_stack *prev, *next;
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index 6555a475453b..1a9f53e535ca 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -68,7 +68,6 @@ static void alloc_string(const char *str, int size)
68} 68}
69%} 69%}
70 70
71ws [ \n\t]
72n [A-Za-z0-9_] 71n [A-Za-z0-9_]
73 72
74%% 73%%
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped
index f636141e7bfd..25ae16ac75c8 100644
--- a/scripts/kconfig/zconf.tab.c_shipped
+++ b/scripts/kconfig/zconf.tab.c_shipped
@@ -1,9 +1,8 @@
1/* A Bison parser, made by GNU Bison 2.4.3. */ 1/* A Bison parser, made by GNU Bison 2.5. */
2 2
3/* Skeleton implementation for Bison's Yacc-like parsers in C 3/* Bison implementation for Yacc-like parsers in C
4 4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
6 2009, 2010 Free Software Foundation, Inc.
7 6
8 This program is free software: you can redistribute it and/or modify 7 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
@@ -45,7 +44,7 @@
45#define YYBISON 1 44#define YYBISON 1
46 45
47/* Bison version. */ 46/* Bison version. */
48#define YYBISON_VERSION "2.4.3" 47#define YYBISON_VERSION "2.5"
49 48
50/* Skeleton name. */ 49/* Skeleton name. */
51#define YYSKELETON_NAME "yacc.c" 50#define YYSKELETON_NAME "yacc.c"
@@ -302,11 +301,11 @@ YYID (yyi)
302# define alloca _alloca 301# define alloca _alloca
303# else 302# else
304# define YYSTACK_ALLOC alloca 303# define YYSTACK_ALLOC alloca
305# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 304# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
306 || defined __cplusplus || defined _MSC_VER) 305 || defined __cplusplus || defined _MSC_VER)
307# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 306# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
308# ifndef _STDLIB_H 307# ifndef EXIT_SUCCESS
309# define _STDLIB_H 1 308# define EXIT_SUCCESS 0
310# endif 309# endif
311# endif 310# endif
312# endif 311# endif
@@ -329,24 +328,24 @@ YYID (yyi)
329# ifndef YYSTACK_ALLOC_MAXIMUM 328# ifndef YYSTACK_ALLOC_MAXIMUM
330# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 329# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
331# endif 330# endif
332# if (defined __cplusplus && ! defined _STDLIB_H \ 331# if (defined __cplusplus && ! defined EXIT_SUCCESS \
333 && ! ((defined YYMALLOC || defined malloc) \ 332 && ! ((defined YYMALLOC || defined malloc) \
334 && (defined YYFREE || defined free))) 333 && (defined YYFREE || defined free)))
335# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 334# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
336# ifndef _STDLIB_H 335# ifndef EXIT_SUCCESS
337# define _STDLIB_H 1 336# define EXIT_SUCCESS 0
338# endif 337# endif
339# endif 338# endif
340# ifndef YYMALLOC 339# ifndef YYMALLOC
341# define YYMALLOC malloc 340# define YYMALLOC malloc
342# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 341# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
343 || defined __cplusplus || defined _MSC_VER) 342 || defined __cplusplus || defined _MSC_VER)
344void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 343void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
345# endif 344# endif
346# endif 345# endif
347# ifndef YYFREE 346# ifndef YYFREE
348# define YYFREE free 347# define YYFREE free
349# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 348# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
350 || defined __cplusplus || defined _MSC_VER) 349 || defined __cplusplus || defined _MSC_VER)
351void free (void *); /* INFRINGES ON USER NAME SPACE */ 350void free (void *); /* INFRINGES ON USER NAME SPACE */
352# endif 351# endif
@@ -375,23 +374,7 @@ union yyalloc
375 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 374 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
376 + YYSTACK_GAP_MAXIMUM) 375 + YYSTACK_GAP_MAXIMUM)
377 376
378/* Copy COUNT objects from FROM to TO. The source and destination do 377# define YYCOPY_NEEDED 1
379 not overlap. */
380# ifndef YYCOPY
381# if defined __GNUC__ && 1 < __GNUC__
382# define YYCOPY(To, From, Count) \
383 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
384# else
385# define YYCOPY(To, From, Count) \
386 do \
387 { \
388 YYSIZE_T yyi; \
389 for (yyi = 0; yyi < (Count); yyi++) \
390 (To)[yyi] = (From)[yyi]; \
391 } \
392 while (YYID (0))
393# endif
394# endif
395 378
396/* Relocate STACK from its old location to the new one. The 379/* Relocate STACK from its old location to the new one. The
397 local variables YYSIZE and YYSTACKSIZE give the old and new number of 380 local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -411,6 +394,26 @@ union yyalloc
411 394
412#endif 395#endif
413 396
397#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
398/* Copy COUNT objects from FROM to TO. The source and destination do
399 not overlap. */
400# ifndef YYCOPY
401# if defined __GNUC__ && 1 < __GNUC__
402# define YYCOPY(To, From, Count) \
403 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
404# else
405# define YYCOPY(To, From, Count) \
406 do \
407 { \
408 YYSIZE_T yyi; \
409 for (yyi = 0; yyi < (Count); yyi++) \
410 (To)[yyi] = (From)[yyi]; \
411 } \
412 while (YYID (0))
413# endif
414# endif
415#endif /* !YYCOPY_NEEDED */
416
414/* YYFINAL -- State number of the termination state. */ 417/* YYFINAL -- State number of the termination state. */
415#define YYFINAL 11 418#define YYFINAL 11
416/* YYLAST -- Last index in YYTABLE. */ 419/* YYLAST -- Last index in YYTABLE. */
@@ -529,18 +532,18 @@ static const yytype_int8 yyrhs[] =
529/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 532/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
530static const yytype_uint16 yyrline[] = 533static const yytype_uint16 yyrline[] =
531{ 534{
532 0, 104, 104, 104, 106, 106, 108, 110, 111, 112, 535 0, 103, 103, 103, 105, 105, 107, 109, 110, 111,
533 113, 114, 115, 119, 123, 123, 123, 123, 123, 123, 536 112, 113, 114, 118, 122, 122, 122, 122, 122, 122,
534 123, 123, 127, 128, 129, 130, 131, 132, 136, 137, 537 122, 122, 126, 127, 128, 129, 130, 131, 135, 136,
535 143, 151, 157, 165, 175, 177, 178, 179, 180, 181, 538 142, 150, 156, 164, 174, 176, 177, 178, 179, 180,
536 182, 185, 193, 199, 209, 215, 221, 224, 226, 237, 539 181, 184, 192, 198, 208, 214, 220, 223, 225, 236,
537 238, 243, 252, 257, 265, 268, 270, 271, 272, 273, 540 237, 242, 251, 256, 264, 267, 269, 270, 271, 272,
538 274, 277, 283, 294, 300, 310, 312, 317, 325, 333, 541 273, 276, 282, 293, 299, 309, 311, 316, 324, 332,
539 336, 338, 339, 340, 345, 352, 359, 364, 372, 375, 542 335, 337, 338, 339, 344, 351, 358, 363, 371, 374,
540 377, 378, 379, 382, 390, 397, 404, 410, 417, 419, 543 376, 377, 378, 381, 389, 396, 403, 409, 416, 418,
541 420, 421, 424, 432, 434, 435, 438, 445, 447, 452, 544 419, 420, 423, 431, 433, 434, 437, 444, 446, 451,
542 453, 456, 457, 458, 462, 463, 466, 467, 470, 471, 545 452, 455, 456, 457, 461, 462, 465, 466, 469, 470,
543 472, 473, 474, 475, 476, 479, 480, 483, 484 546 471, 472, 473, 474, 475, 478, 479, 482, 483
544}; 547};
545#endif 548#endif
546 549
@@ -615,8 +618,8 @@ static const yytype_uint8 yyr2[] =
615 3, 3, 2, 3, 3, 1, 1, 0, 1 618 3, 3, 2, 3, 3, 1, 1, 0, 1
616}; 619};
617 620
618/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 621/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
619 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 622 Performed when YYTABLE doesn't specify something else to do. Zero
620 means the default is an error. */ 623 means the default is an error. */
621static const yytype_uint8 yydefact[] = 624static const yytype_uint8 yydefact[] =
622{ 625{
@@ -691,8 +694,7 @@ static const yytype_int16 yypgoto[] =
691 694
692/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 695/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
693 positive, shift that token. If negative, reduce the rule which 696 positive, shift that token. If negative, reduce the rule which
694 number is the opposite. If zero, do what YYDEFACT says. 697 number is the opposite. If YYTABLE_NINF, syntax error. */
695 If YYTABLE_NINF, syntax error. */
696#define YYTABLE_NINF -86 698#define YYTABLE_NINF -86
697static const yytype_int16 yytable[] = 699static const yytype_int16 yytable[] =
698{ 700{
@@ -728,6 +730,12 @@ static const yytype_int16 yytable[] =
728 184 730 184
729}; 731};
730 732
733#define yypact_value_is_default(yystate) \
734 ((yystate) == (-90))
735
736#define yytable_value_is_error(yytable_value) \
737 YYID (0)
738
731static const yytype_int16 yycheck[] = 739static const yytype_int16 yycheck[] =
732{ 740{
733 1, 67, 68, 10, 93, 94, 76, 3, 76, 14, 741 1, 67, 68, 10, 93, 94, 76, 3, 76, 14,
@@ -821,7 +829,6 @@ do \
821 { \ 829 { \
822 yychar = (Token); \ 830 yychar = (Token); \
823 yylval = (Value); \ 831 yylval = (Value); \
824 yytoken = YYTRANSLATE (yychar); \
825 YYPOPSTACK (1); \ 832 YYPOPSTACK (1); \
826 goto yybackup; \ 833 goto yybackup; \
827 } \ 834 } \
@@ -863,19 +870,10 @@ while (YYID (0))
863#endif 870#endif
864 871
865 872
866/* YY_LOCATION_PRINT -- Print the location on the stream. 873/* This macro is provided for backward compatibility. */
867 This macro was not mandated originally: define only if we know
868 we won't break user code: when these are the locations we know. */
869 874
870#ifndef YY_LOCATION_PRINT 875#ifndef YY_LOCATION_PRINT
871# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL 876# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
872# define YY_LOCATION_PRINT(File, Loc) \
873 fprintf (File, "%d.%d-%d.%d", \
874 (Loc).first_line, (Loc).first_column, \
875 (Loc).last_line, (Loc).last_column)
876# else
877# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
878# endif
879#endif 877#endif
880 878
881 879
@@ -1067,7 +1065,6 @@ int yydebug;
1067# define YYMAXDEPTH 10000 1065# define YYMAXDEPTH 10000
1068#endif 1066#endif
1069 1067
1070
1071 1068
1072#if YYERROR_VERBOSE 1069#if YYERROR_VERBOSE
1073 1070
@@ -1170,115 +1167,142 @@ yytnamerr (char *yyres, const char *yystr)
1170} 1167}
1171# endif 1168# endif
1172 1169
1173/* Copy into YYRESULT an error message about the unexpected token 1170/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1174 YYCHAR while in state YYSTATE. Return the number of bytes copied, 1171 about the unexpected token YYTOKEN for the state stack whose top is
1175 including the terminating null byte. If YYRESULT is null, do not 1172 YYSSP.
1176 copy anything; just return the number of bytes that would be
1177 copied. As a special case, return 0 if an ordinary "syntax error"
1178 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1179 size calculation. */
1180static YYSIZE_T
1181yysyntax_error (char *yyresult, int yystate, int yychar)
1182{
1183 int yyn = yypact[yystate];
1184 1173
1185 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 1174 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1186 return 0; 1175 not large enough to hold the message. In that case, also set
1187 else 1176 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1177 required number of bytes is too large to store. */
1178static int
1179yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1180 yytype_int16 *yyssp, int yytoken)
1181{
1182 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1183 YYSIZE_T yysize = yysize0;
1184 YYSIZE_T yysize1;
1185 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1186 /* Internationalized format string. */
1187 const char *yyformat = 0;
1188 /* Arguments of yyformat. */
1189 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1190 /* Number of reported tokens (one for the "unexpected", one per
1191 "expected"). */
1192 int yycount = 0;
1193
1194 /* There are many possibilities here to consider:
1195 - Assume YYFAIL is not used. It's too flawed to consider. See
1196 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1197 for details. YYERROR is fine as it does not invoke this
1198 function.
1199 - If this state is a consistent state with a default action, then
1200 the only way this function was invoked is if the default action
1201 is an error action. In that case, don't check for expected
1202 tokens because there are none.
1203 - The only way there can be no lookahead present (in yychar) is if
1204 this state is a consistent state with a default action. Thus,
1205 detecting the absence of a lookahead is sufficient to determine
1206 that there is no unexpected or expected token to report. In that
1207 case, just report a simple "syntax error".
1208 - Don't assume there isn't a lookahead just because this state is a
1209 consistent state with a default action. There might have been a
1210 previous inconsistent state, consistent state with a non-default
1211 action, or user semantic action that manipulated yychar.
1212 - Of course, the expected token list depends on states to have
1213 correct lookahead information, and it depends on the parser not
1214 to perform extra reductions after fetching a lookahead from the
1215 scanner and before detecting a syntax error. Thus, state merging
1216 (from LALR or IELR) and default reductions corrupt the expected
1217 token list. However, the list is correct for canonical LR with
1218 one exception: it will still contain any token that will not be
1219 accepted due to an error action in a later state.
1220 */
1221 if (yytoken != YYEMPTY)
1188 { 1222 {
1189 int yytype = YYTRANSLATE (yychar); 1223 int yyn = yypact[*yyssp];
1190 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 1224 yyarg[yycount++] = yytname[yytoken];
1191 YYSIZE_T yysize = yysize0; 1225 if (!yypact_value_is_default (yyn))
1192 YYSIZE_T yysize1; 1226 {
1193 int yysize_overflow = 0; 1227 /* Start YYX at -YYN if negative to avoid negative indexes in
1194 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1228 YYCHECK. In other words, skip the first -YYN actions for
1195 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1229 this state because they are default actions. */
1196 int yyx; 1230 int yyxbegin = yyn < 0 ? -yyn : 0;
1197 1231 /* Stay within bounds of both yycheck and yytname. */
1198# if 0 1232 int yychecklim = YYLAST - yyn + 1;
1199 /* This is so xgettext sees the translatable formats that are 1233 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1200 constructed on the fly. */ 1234 int yyx;
1201 YY_("syntax error, unexpected %s"); 1235
1202 YY_("syntax error, unexpected %s, expecting %s"); 1236 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1203 YY_("syntax error, unexpected %s, expecting %s or %s"); 1237 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1204 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 1238 && !yytable_value_is_error (yytable[yyx + yyn]))
1205 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 1239 {
1206# endif 1240 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1207 char *yyfmt; 1241 {
1208 char const *yyf; 1242 yycount = 1;
1209 static char const yyunexpected[] = "syntax error, unexpected %s"; 1243 yysize = yysize0;
1210 static char const yyexpecting[] = ", expecting %s"; 1244 break;
1211 static char const yyor[] = " or %s"; 1245 }
1212 char yyformat[sizeof yyunexpected 1246 yyarg[yycount++] = yytname[yyx];
1213 + sizeof yyexpecting - 1 1247 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1214 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 1248 if (! (yysize <= yysize1
1215 * (sizeof yyor - 1))]; 1249 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1216 char const *yyprefix = yyexpecting; 1250 return 2;
1217 1251 yysize = yysize1;
1218 /* Start YYX at -YYN if negative to avoid negative indexes in 1252 }
1219 YYCHECK. */ 1253 }
1220 int yyxbegin = yyn < 0 ? -yyn : 0; 1254 }
1221
1222 /* Stay within bounds of both yycheck and yytname. */
1223 int yychecklim = YYLAST - yyn + 1;
1224 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1225 int yycount = 1;
1226
1227 yyarg[0] = yytname[yytype];
1228 yyfmt = yystpcpy (yyformat, yyunexpected);
1229
1230 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1231 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1232 {
1233 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1234 {
1235 yycount = 1;
1236 yysize = yysize0;
1237 yyformat[sizeof yyunexpected - 1] = '\0';
1238 break;
1239 }
1240 yyarg[yycount++] = yytname[yyx];
1241 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1242 yysize_overflow |= (yysize1 < yysize);
1243 yysize = yysize1;
1244 yyfmt = yystpcpy (yyfmt, yyprefix);
1245 yyprefix = yyor;
1246 }
1247 1255
1248 yyf = YY_(yyformat); 1256 switch (yycount)
1249 yysize1 = yysize + yystrlen (yyf); 1257 {
1250 yysize_overflow |= (yysize1 < yysize); 1258# define YYCASE_(N, S) \
1251 yysize = yysize1; 1259 case N: \
1260 yyformat = S; \
1261 break
1262 YYCASE_(0, YY_("syntax error"));
1263 YYCASE_(1, YY_("syntax error, unexpected %s"));
1264 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1265 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1266 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1267 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1268# undef YYCASE_
1269 }
1252 1270
1253 if (yysize_overflow) 1271 yysize1 = yysize + yystrlen (yyformat);
1254 return YYSIZE_MAXIMUM; 1272 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1273 return 2;
1274 yysize = yysize1;
1255 1275
1256 if (yyresult) 1276 if (*yymsg_alloc < yysize)
1257 { 1277 {
1258 /* Avoid sprintf, as that infringes on the user's name space. 1278 *yymsg_alloc = 2 * yysize;
1259 Don't have undefined behavior even if the translation 1279 if (! (yysize <= *yymsg_alloc
1260 produced a string with the wrong number of "%s"s. */ 1280 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1261 char *yyp = yyresult; 1281 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1262 int yyi = 0; 1282 return 1;
1263 while ((*yyp = *yyf) != '\0')
1264 {
1265 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1266 {
1267 yyp += yytnamerr (yyp, yyarg[yyi++]);
1268 yyf += 2;
1269 }
1270 else
1271 {
1272 yyp++;
1273 yyf++;
1274 }
1275 }
1276 }
1277 return yysize;
1278 } 1283 }
1284
1285 /* Avoid sprintf, as that infringes on the user's name space.
1286 Don't have undefined behavior even if the translation
1287 produced a string with the wrong number of "%s"s. */
1288 {
1289 char *yyp = *yymsg;
1290 int yyi = 0;
1291 while ((*yyp = *yyformat) != '\0')
1292 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1293 {
1294 yyp += yytnamerr (yyp, yyarg[yyi++]);
1295 yyformat += 2;
1296 }
1297 else
1298 {
1299 yyp++;
1300 yyformat++;
1301 }
1302 }
1303 return 0;
1279} 1304}
1280#endif /* YYERROR_VERBOSE */ 1305#endif /* YYERROR_VERBOSE */
1281
1282 1306
1283/*-----------------------------------------------. 1307/*-----------------------------------------------.
1284| Release the memory associated to this symbol. | 1308| Release the memory associated to this symbol. |
@@ -1341,6 +1365,7 @@ yydestruct (yymsg, yytype, yyvaluep)
1341 } 1365 }
1342} 1366}
1343 1367
1368
1344/* Prevent warnings from -Wmissing-prototypes. */ 1369/* Prevent warnings from -Wmissing-prototypes. */
1345#ifdef YYPARSE_PARAM 1370#ifdef YYPARSE_PARAM
1346#if defined __STDC__ || defined __cplusplus 1371#if defined __STDC__ || defined __cplusplus
@@ -1367,10 +1392,9 @@ YYSTYPE yylval;
1367int yynerrs; 1392int yynerrs;
1368 1393
1369 1394
1370 1395/*----------.
1371/*-------------------------. 1396| yyparse. |
1372| yyparse or yypush_parse. | 1397`----------*/
1373`-------------------------*/
1374 1398
1375#ifdef YYPARSE_PARAM 1399#ifdef YYPARSE_PARAM
1376#if (defined __STDC__ || defined __C99__FUNC__ \ 1400#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1394,8 +1418,6 @@ yyparse ()
1394#endif 1418#endif
1395#endif 1419#endif
1396{ 1420{
1397
1398
1399 int yystate; 1421 int yystate;
1400 /* Number of tokens to shift before error messages enabled. */ 1422 /* Number of tokens to shift before error messages enabled. */
1401 int yyerrstatus; 1423 int yyerrstatus;
@@ -1550,7 +1572,7 @@ yybackup:
1550 1572
1551 /* First try to decide what to do without reference to lookahead token. */ 1573 /* First try to decide what to do without reference to lookahead token. */
1552 yyn = yypact[yystate]; 1574 yyn = yypact[yystate];
1553 if (yyn == YYPACT_NINF) 1575 if (yypact_value_is_default (yyn))
1554 goto yydefault; 1576 goto yydefault;
1555 1577
1556 /* Not known => get a lookahead token if don't already have one. */ 1578 /* Not known => get a lookahead token if don't already have one. */
@@ -1581,8 +1603,8 @@ yybackup:
1581 yyn = yytable[yyn]; 1603 yyn = yytable[yyn];
1582 if (yyn <= 0) 1604 if (yyn <= 0)
1583 { 1605 {
1584 if (yyn == 0 || yyn == YYTABLE_NINF) 1606 if (yytable_value_is_error (yyn))
1585 goto yyerrlab; 1607 goto yyerrlab;
1586 yyn = -yyn; 1608 yyn = -yyn;
1587 goto yyreduce; 1609 goto yyreduce;
1588 } 1610 }
@@ -1637,34 +1659,34 @@ yyreduce:
1637 { 1659 {
1638 case 10: 1660 case 10:
1639 1661
1640 { zconf_error("unexpected end statement"); ;} 1662 { zconf_error("unexpected end statement"); }
1641 break; 1663 break;
1642 1664
1643 case 11: 1665 case 11:
1644 1666
1645 { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); ;} 1667 { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); }
1646 break; 1668 break;
1647 1669
1648 case 12: 1670 case 12:
1649 1671
1650 { 1672 {
1651 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name); 1673 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name);
1652;} 1674}
1653 break; 1675 break;
1654 1676
1655 case 13: 1677 case 13:
1656 1678
1657 { zconf_error("invalid statement"); ;} 1679 { zconf_error("invalid statement"); }
1658 break; 1680 break;
1659 1681
1660 case 28: 1682 case 28:
1661 1683
1662 { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;} 1684 { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); }
1663 break; 1685 break;
1664 1686
1665 case 29: 1687 case 29:
1666 1688
1667 { zconf_error("invalid option"); ;} 1689 { zconf_error("invalid option"); }
1668 break; 1690 break;
1669 1691
1670 case 30: 1692 case 30:
@@ -1674,7 +1696,7 @@ yyreduce:
1674 sym->flags |= SYMBOL_OPTIONAL; 1696 sym->flags |= SYMBOL_OPTIONAL;
1675 menu_add_entry(sym); 1697 menu_add_entry(sym);
1676 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); 1698 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
1677;} 1699}
1678 break; 1700 break;
1679 1701
1680 case 31: 1702 case 31:
@@ -1682,7 +1704,7 @@ yyreduce:
1682 { 1704 {
1683 menu_end_entry(); 1705 menu_end_entry();
1684 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); 1706 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1685;} 1707}
1686 break; 1708 break;
1687 1709
1688 case 32: 1710 case 32:
@@ -1692,7 +1714,7 @@ yyreduce:
1692 sym->flags |= SYMBOL_OPTIONAL; 1714 sym->flags |= SYMBOL_OPTIONAL;
1693 menu_add_entry(sym); 1715 menu_add_entry(sym);
1694 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); 1716 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
1695;} 1717}
1696 break; 1718 break;
1697 1719
1698 case 33: 1720 case 33:
@@ -1704,7 +1726,7 @@ yyreduce:
1704 zconfprint("warning: menuconfig statement without prompt"); 1726 zconfprint("warning: menuconfig statement without prompt");
1705 menu_end_entry(); 1727 menu_end_entry();
1706 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); 1728 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1707;} 1729}
1708 break; 1730 break;
1709 1731
1710 case 41: 1732 case 41:
@@ -1714,7 +1736,7 @@ yyreduce:
1714 printd(DEBUG_PARSE, "%s:%d:type(%u)\n", 1736 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1715 zconf_curname(), zconf_lineno(), 1737 zconf_curname(), zconf_lineno(),
1716 (yyvsp[(1) - (3)].id)->stype); 1738 (yyvsp[(1) - (3)].id)->stype);
1717;} 1739}
1718 break; 1740 break;
1719 1741
1720 case 42: 1742 case 42:
@@ -1722,7 +1744,7 @@ yyreduce:
1722 { 1744 {
1723 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); 1745 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
1724 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); 1746 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1725;} 1747}
1726 break; 1748 break;
1727 1749
1728 case 43: 1750 case 43:
@@ -1734,7 +1756,7 @@ yyreduce:
1734 printd(DEBUG_PARSE, "%s:%d:default(%u)\n", 1756 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1735 zconf_curname(), zconf_lineno(), 1757 zconf_curname(), zconf_lineno(),
1736 (yyvsp[(1) - (4)].id)->stype); 1758 (yyvsp[(1) - (4)].id)->stype);
1737;} 1759}
1738 break; 1760 break;
1739 1761
1740 case 44: 1762 case 44:
@@ -1742,7 +1764,7 @@ yyreduce:
1742 { 1764 {
1743 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr)); 1765 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr));
1744 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno()); 1766 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1745;} 1767}
1746 break; 1768 break;
1747 1769
1748 case 45: 1770 case 45:
@@ -1750,7 +1772,7 @@ yyreduce:
1750 { 1772 {
1751 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr)); 1773 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr));
1752 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); 1774 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1753;} 1775}
1754 break; 1776 break;
1755 1777
1756 case 48: 1778 case 48:
@@ -1762,17 +1784,17 @@ yyreduce:
1762 else 1784 else
1763 zconfprint("warning: ignoring unknown option %s", (yyvsp[(2) - (3)].string)); 1785 zconfprint("warning: ignoring unknown option %s", (yyvsp[(2) - (3)].string));
1764 free((yyvsp[(2) - (3)].string)); 1786 free((yyvsp[(2) - (3)].string));
1765;} 1787}
1766 break; 1788 break;
1767 1789
1768 case 49: 1790 case 49:
1769 1791
1770 { (yyval.string) = NULL; ;} 1792 { (yyval.string) = NULL; }
1771 break; 1793 break;
1772 1794
1773 case 50: 1795 case 50:
1774 1796
1775 { (yyval.string) = (yyvsp[(2) - (2)].string); ;} 1797 { (yyval.string) = (yyvsp[(2) - (2)].string); }
1776 break; 1798 break;
1777 1799
1778 case 51: 1800 case 51:
@@ -1783,14 +1805,14 @@ yyreduce:
1783 menu_add_entry(sym); 1805 menu_add_entry(sym);
1784 menu_add_expr(P_CHOICE, NULL, NULL); 1806 menu_add_expr(P_CHOICE, NULL, NULL);
1785 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); 1807 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1786;} 1808}
1787 break; 1809 break;
1788 1810
1789 case 52: 1811 case 52:
1790 1812
1791 { 1813 {
1792 (yyval.menu) = menu_add_menu(); 1814 (yyval.menu) = menu_add_menu();
1793;} 1815}
1794 break; 1816 break;
1795 1817
1796 case 53: 1818 case 53:
@@ -1800,7 +1822,7 @@ yyreduce:
1800 menu_end_menu(); 1822 menu_end_menu();
1801 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); 1823 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1802 } 1824 }
1803;} 1825}
1804 break; 1826 break;
1805 1827
1806 case 61: 1828 case 61:
@@ -1808,7 +1830,7 @@ yyreduce:
1808 { 1830 {
1809 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); 1831 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
1810 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); 1832 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1811;} 1833}
1812 break; 1834 break;
1813 1835
1814 case 62: 1836 case 62:
@@ -1821,7 +1843,7 @@ yyreduce:
1821 (yyvsp[(1) - (3)].id)->stype); 1843 (yyvsp[(1) - (3)].id)->stype);
1822 } else 1844 } else
1823 YYERROR; 1845 YYERROR;
1824;} 1846}
1825 break; 1847 break;
1826 1848
1827 case 63: 1849 case 63:
@@ -1829,7 +1851,7 @@ yyreduce:
1829 { 1851 {
1830 current_entry->sym->flags |= SYMBOL_OPTIONAL; 1852 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1831 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); 1853 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1832;} 1854}
1833 break; 1855 break;
1834 1856
1835 case 64: 1857 case 64:
@@ -1841,7 +1863,7 @@ yyreduce:
1841 zconf_curname(), zconf_lineno()); 1863 zconf_curname(), zconf_lineno());
1842 } else 1864 } else
1843 YYERROR; 1865 YYERROR;
1844;} 1866}
1845 break; 1867 break;
1846 1868
1847 case 67: 1869 case 67:
@@ -1851,7 +1873,7 @@ yyreduce:
1851 menu_add_entry(NULL); 1873 menu_add_entry(NULL);
1852 menu_add_dep((yyvsp[(2) - (3)].expr)); 1874 menu_add_dep((yyvsp[(2) - (3)].expr));
1853 (yyval.menu) = menu_add_menu(); 1875 (yyval.menu) = menu_add_menu();
1854;} 1876}
1855 break; 1877 break;
1856 1878
1857 case 68: 1879 case 68:
@@ -1861,14 +1883,14 @@ yyreduce:
1861 menu_end_menu(); 1883 menu_end_menu();
1862 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); 1884 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1863 } 1885 }
1864;} 1886}
1865 break; 1887 break;
1866 1888
1867 case 74: 1889 case 74:
1868 1890
1869 { 1891 {
1870 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL); 1892 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
1871;} 1893}
1872 break; 1894 break;
1873 1895
1874 case 75: 1896 case 75:
@@ -1877,14 +1899,14 @@ yyreduce:
1877 menu_add_entry(NULL); 1899 menu_add_entry(NULL);
1878 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL); 1900 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
1879 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); 1901 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1880;} 1902}
1881 break; 1903 break;
1882 1904
1883 case 76: 1905 case 76:
1884 1906
1885 { 1907 {
1886 (yyval.menu) = menu_add_menu(); 1908 (yyval.menu) = menu_add_menu();
1887;} 1909}
1888 break; 1910 break;
1889 1911
1890 case 77: 1912 case 77:
@@ -1894,7 +1916,7 @@ yyreduce:
1894 menu_end_menu(); 1916 menu_end_menu();
1895 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); 1917 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1896 } 1918 }
1897;} 1919}
1898 break; 1920 break;
1899 1921
1900 case 83: 1922 case 83:
@@ -1902,7 +1924,7 @@ yyreduce:
1902 { 1924 {
1903 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); 1925 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
1904 zconf_nextfile((yyvsp[(2) - (3)].string)); 1926 zconf_nextfile((yyvsp[(2) - (3)].string));
1905;} 1927}
1906 break; 1928 break;
1907 1929
1908 case 84: 1930 case 84:
@@ -1911,14 +1933,14 @@ yyreduce:
1911 menu_add_entry(NULL); 1933 menu_add_entry(NULL);
1912 menu_add_prompt(P_COMMENT, (yyvsp[(2) - (3)].string), NULL); 1934 menu_add_prompt(P_COMMENT, (yyvsp[(2) - (3)].string), NULL);
1913 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); 1935 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1914;} 1936}
1915 break; 1937 break;
1916 1938
1917 case 85: 1939 case 85:
1918 1940
1919 { 1941 {
1920 menu_end_entry(); 1942 menu_end_entry();
1921;} 1943}
1922 break; 1944 break;
1923 1945
1924 case 86: 1946 case 86:
@@ -1926,14 +1948,14 @@ yyreduce:
1926 { 1948 {
1927 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); 1949 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1928 zconf_starthelp(); 1950 zconf_starthelp();
1929;} 1951}
1930 break; 1952 break;
1931 1953
1932 case 87: 1954 case 87:
1933 1955
1934 { 1956 {
1935 current_entry->help = (yyvsp[(2) - (2)].string); 1957 current_entry->help = (yyvsp[(2) - (2)].string);
1936;} 1958}
1937 break; 1959 break;
1938 1960
1939 case 92: 1961 case 92:
@@ -1941,102 +1963,113 @@ yyreduce:
1941 { 1963 {
1942 menu_add_dep((yyvsp[(3) - (4)].expr)); 1964 menu_add_dep((yyvsp[(3) - (4)].expr));
1943 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); 1965 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1944;} 1966}
1945 break; 1967 break;
1946 1968
1947 case 96: 1969 case 96:
1948 1970
1949 { 1971 {
1950 menu_add_visibility((yyvsp[(2) - (2)].expr)); 1972 menu_add_visibility((yyvsp[(2) - (2)].expr));
1951;} 1973}
1952 break; 1974 break;
1953 1975
1954 case 98: 1976 case 98:
1955 1977
1956 { 1978 {
1957 menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr)); 1979 menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr));
1958;} 1980}
1959 break; 1981 break;
1960 1982
1961 case 101: 1983 case 101:
1962 1984
1963 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1985 { (yyval.id) = (yyvsp[(1) - (2)].id); }
1964 break; 1986 break;
1965 1987
1966 case 102: 1988 case 102:
1967 1989
1968 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1990 { (yyval.id) = (yyvsp[(1) - (2)].id); }
1969 break; 1991 break;
1970 1992
1971 case 103: 1993 case 103:
1972 1994
1973 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1995 { (yyval.id) = (yyvsp[(1) - (2)].id); }
1974 break; 1996 break;
1975 1997
1976 case 106: 1998 case 106:
1977 1999
1978 { (yyval.expr) = NULL; ;} 2000 { (yyval.expr) = NULL; }
1979 break; 2001 break;
1980 2002
1981 case 107: 2003 case 107:
1982 2004
1983 { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;} 2005 { (yyval.expr) = (yyvsp[(2) - (2)].expr); }
1984 break; 2006 break;
1985 2007
1986 case 108: 2008 case 108:
1987 2009
1988 { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;} 2010 { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); }
1989 break; 2011 break;
1990 2012
1991 case 109: 2013 case 109:
1992 2014
1993 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} 2015 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); }
1994 break; 2016 break;
1995 2017
1996 case 110: 2018 case 110:
1997 2019
1998 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} 2020 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); }
1999 break; 2021 break;
2000 2022
2001 case 111: 2023 case 111:
2002 2024
2003 { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} 2025 { (yyval.expr) = (yyvsp[(2) - (3)].expr); }
2004 break; 2026 break;
2005 2027
2006 case 112: 2028 case 112:
2007 2029
2008 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;} 2030 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); }
2009 break; 2031 break;
2010 2032
2011 case 113: 2033 case 113:
2012 2034
2013 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} 2035 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2014 break; 2036 break;
2015 2037
2016 case 114: 2038 case 114:
2017 2039
2018 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} 2040 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
2019 break; 2041 break;
2020 2042
2021 case 115: 2043 case 115:
2022 2044
2023 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;} 2045 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); }
2024 break; 2046 break;
2025 2047
2026 case 116: 2048 case 116:
2027 2049
2028 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;} 2050 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); }
2029 break; 2051 break;
2030 2052
2031 case 117: 2053 case 117:
2032 2054
2033 { (yyval.string) = NULL; ;} 2055 { (yyval.string) = NULL; }
2034 break; 2056 break;
2035 2057
2036 2058
2037 2059
2038 default: break; 2060 default: break;
2039 } 2061 }
2062 /* User semantic actions sometimes alter yychar, and that requires
2063 that yytoken be updated with the new translation. We take the
2064 approach of translating immediately before every use of yytoken.
2065 One alternative is translating here after every semantic action,
2066 but that translation would be missed if the semantic action invokes
2067 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2068 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2069 incorrect destructor might then be invoked immediately. In the
2070 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2071 to an incorrect destructor call or verbose syntax error message
2072 before the lookahead is translated. */
2040 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 2073 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2041 2074
2042 YYPOPSTACK (yylen); 2075 YYPOPSTACK (yylen);
@@ -2064,6 +2097,10 @@ yyreduce:
2064| yyerrlab -- here on detecting error | 2097| yyerrlab -- here on detecting error |
2065`------------------------------------*/ 2098`------------------------------------*/
2066yyerrlab: 2099yyerrlab:
2100 /* Make sure we have latest lookahead translation. See comments at
2101 user semantic actions for why this is necessary. */
2102 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2103
2067 /* If not already recovering from an error, report this error. */ 2104 /* If not already recovering from an error, report this error. */
2068 if (!yyerrstatus) 2105 if (!yyerrstatus)
2069 { 2106 {
@@ -2071,37 +2108,36 @@ yyerrlab:
2071#if ! YYERROR_VERBOSE 2108#if ! YYERROR_VERBOSE
2072 yyerror (YY_("syntax error")); 2109 yyerror (YY_("syntax error"));
2073#else 2110#else
2111# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2112 yyssp, yytoken)
2074 { 2113 {
2075 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 2114 char const *yymsgp = YY_("syntax error");
2076 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 2115 int yysyntax_error_status;
2077 { 2116 yysyntax_error_status = YYSYNTAX_ERROR;
2078 YYSIZE_T yyalloc = 2 * yysize; 2117 if (yysyntax_error_status == 0)
2079 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 2118 yymsgp = yymsg;
2080 yyalloc = YYSTACK_ALLOC_MAXIMUM; 2119 else if (yysyntax_error_status == 1)
2081 if (yymsg != yymsgbuf) 2120 {
2082 YYSTACK_FREE (yymsg); 2121 if (yymsg != yymsgbuf)
2083 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 2122 YYSTACK_FREE (yymsg);
2084 if (yymsg) 2123 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2085 yymsg_alloc = yyalloc; 2124 if (!yymsg)
2086 else 2125 {
2087 { 2126 yymsg = yymsgbuf;
2088 yymsg = yymsgbuf; 2127 yymsg_alloc = sizeof yymsgbuf;
2089 yymsg_alloc = sizeof yymsgbuf; 2128 yysyntax_error_status = 2;
2090 } 2129 }
2091 } 2130 else
2092 2131 {
2093 if (0 < yysize && yysize <= yymsg_alloc) 2132 yysyntax_error_status = YYSYNTAX_ERROR;
2094 { 2133 yymsgp = yymsg;
2095 (void) yysyntax_error (yymsg, yystate, yychar); 2134 }
2096 yyerror (yymsg); 2135 }
2097 } 2136 yyerror (yymsgp);
2098 else 2137 if (yysyntax_error_status == 2)
2099 { 2138 goto yyexhaustedlab;
2100 yyerror (YY_("syntax error"));
2101 if (yysize != 0)
2102 goto yyexhaustedlab;
2103 }
2104 } 2139 }
2140# undef YYSYNTAX_ERROR
2105#endif 2141#endif
2106 } 2142 }
2107 2143
@@ -2160,7 +2196,7 @@ yyerrlab1:
2160 for (;;) 2196 for (;;)
2161 { 2197 {
2162 yyn = yypact[yystate]; 2198 yyn = yypact[yystate];
2163 if (yyn != YYPACT_NINF) 2199 if (!yypact_value_is_default (yyn))
2164 { 2200 {
2165 yyn += YYTERROR; 2201 yyn += YYTERROR;
2166 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2202 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -2219,8 +2255,13 @@ yyexhaustedlab:
2219 2255
2220yyreturn: 2256yyreturn:
2221 if (yychar != YYEMPTY) 2257 if (yychar != YYEMPTY)
2222 yydestruct ("Cleanup: discarding lookahead", 2258 {
2223 yytoken, &yylval); 2259 /* Make sure we have latest lookahead translation. See comments at
2260 user semantic actions for why this is necessary. */
2261 yytoken = YYTRANSLATE (yychar);
2262 yydestruct ("Cleanup: discarding lookahead",
2263 yytoken, &yylval);
2264 }
2224 /* Do not reclaim the symbols of the rule which action triggered 2265 /* Do not reclaim the symbols of the rule which action triggered
2225 this YYABORT or YYACCEPT. */ 2266 this YYABORT or YYACCEPT. */
2226 YYPOPSTACK (yylen); 2267 YYPOPSTACK (yylen);
@@ -2256,9 +2297,6 @@ void conf_parse(const char *name)
2256 2297
2257 sym_init(); 2298 sym_init();
2258 _menu_init(); 2299 _menu_init();
2259 modules_sym = sym_lookup(NULL, 0);
2260 modules_sym->type = S_BOOLEAN;
2261 modules_sym->flags |= SYMBOL_AUTO;
2262 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); 2300 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
2263 2301
2264 if (getenv("ZCONF_DEBUG")) 2302 if (getenv("ZCONF_DEBUG"))
@@ -2266,12 +2304,8 @@ void conf_parse(const char *name)
2266 zconfparse(); 2304 zconfparse();
2267 if (zconfnerrs) 2305 if (zconfnerrs)
2268 exit(1); 2306 exit(1);
2269 if (!modules_sym->prop) { 2307 if (!modules_sym)
2270 struct property *prop; 2308 modules_sym = sym_find( "n" );
2271
2272 prop = prop_alloc(P_DEFAULT, modules_sym);
2273 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
2274 }
2275 2309
2276 rootmenu.prompt->text = _(rootmenu.prompt->text); 2310 rootmenu.prompt->text = _(rootmenu.prompt->text);
2277 rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text); 2311 rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 864da07ba4aa..0653886fac48 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -493,9 +493,6 @@ void conf_parse(const char *name)
493 493
494 sym_init(); 494 sym_init();
495 _menu_init(); 495 _menu_init();
496 modules_sym = sym_lookup(NULL, 0);
497 modules_sym->type = S_BOOLEAN;
498 modules_sym->flags |= SYMBOL_AUTO;
499 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); 496 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
500 497
501 if (getenv("ZCONF_DEBUG")) 498 if (getenv("ZCONF_DEBUG"))
@@ -503,12 +500,8 @@ void conf_parse(const char *name)
503 zconfparse(); 500 zconfparse();
504 if (zconfnerrs) 501 if (zconfnerrs)
505 exit(1); 502 exit(1);
506 if (!modules_sym->prop) { 503 if (!modules_sym)
507 struct property *prop; 504 modules_sym = sym_find( "n" );
508
509 prop = prop_alloc(P_DEFAULT, modules_sym);
510 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
511 }
512 505
513 rootmenu.prompt->text = _(rootmenu.prompt->text); 506 rootmenu.prompt->text = _(rootmenu.prompt->text);
514 rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text); 507 rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 4305b2f2ec5e..da058da413e7 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -257,6 +257,7 @@ my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',
257 'July', 'August', 'September', 'October', 257 'July', 'August', 'September', 'October',
258 'November', 'December')[(localtime)[4]] . 258 'November', 'December')[(localtime)[4]] .
259 " " . ((localtime)[5]+1900); 259 " " . ((localtime)[5]+1900);
260my $show_not_found = 0;
260 261
261# Essentially these are globals. 262# Essentially these are globals.
262# They probably want to be tidied up, made more localised or something. 263# They probably want to be tidied up, made more localised or something.
@@ -369,6 +370,8 @@ while ($ARGV[0] =~ m/^-(.*)/) {
369 usage(); 370 usage();
370 } elsif ($cmd eq '-no-doc-sections') { 371 } elsif ($cmd eq '-no-doc-sections') {
371 $no_doc_sections = 1; 372 $no_doc_sections = 1;
373 } elsif ($cmd eq '-show-not-found') {
374 $show_not_found = 1;
372 } 375 }
373} 376}
374 377
@@ -2125,8 +2128,7 @@ sub dump_function($$) {
2125 2128
2126 create_parameterlist($args, ',', $file); 2129 create_parameterlist($args, ',', $file);
2127 } else { 2130 } else {
2128 print STDERR "Error(${file}:$.): cannot understand prototype: '$prototype'\n"; 2131 print STDERR "Warning(${file}:$.): cannot understand function prototype: '$prototype'\n";
2129 ++$errors;
2130 return; 2132 return;
2131 } 2133 }
2132 2134
@@ -2536,6 +2538,9 @@ sub process_file($) {
2536 } 2538 }
2537 if ($initial_section_counter == $section_counter) { 2539 if ($initial_section_counter == $section_counter) {
2538 print STDERR "Warning(${file}): no structured comments found\n"; 2540 print STDERR "Warning(${file}): no structured comments found\n";
2541 if (($function_only == 1) && ($show_not_found == 1)) {
2542 print STDERR " Was looking for '$_'.\n" for keys %function_table;
2543 }
2539 if ($output_mode eq "xml") { 2544 if ($output_mode eq "xml") {
2540 # The template wants at least one RefEntry here; make one. 2545 # The template wants at least one RefEntry here; make one.
2541 print "<refentry>\n"; 2546 print "<refentry>\n";
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 014994936b1c..32b10f53d0b4 100644
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -82,6 +82,8 @@ kallsyms()
82 kallsymopt="${kallsymopt} --all-symbols" 82 kallsymopt="${kallsymopt} --all-symbols"
83 fi 83 fi
84 84
85 kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET"
86
85 local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ 87 local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \
86 ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" 88 ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}"
87 89
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 8247979e8f64..17855761e6b7 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -17,6 +17,7 @@
17#include <string.h> 17#include <string.h>
18#include <limits.h> 18#include <limits.h>
19#include <stdbool.h> 19#include <stdbool.h>
20#include <errno.h>
20#include "modpost.h" 21#include "modpost.h"
21#include "../../include/generated/autoconf.h" 22#include "../../include/generated/autoconf.h"
22#include "../../include/linux/license.h" 23#include "../../include/linux/license.h"
@@ -37,6 +38,8 @@ static int warn_unresolved = 0;
37/* How a symbol is exported */ 38/* How a symbol is exported */
38static int sec_mismatch_count = 0; 39static int sec_mismatch_count = 0;
39static int sec_mismatch_verbose = 1; 40static int sec_mismatch_verbose = 1;
41/* ignore missing files */
42static int ignore_missing_files;
40 43
41enum export { 44enum export {
42 export_plain, export_unused, export_gpl, 45 export_plain, export_unused, export_gpl,
@@ -161,7 +164,7 @@ struct symbol {
161 unsigned int vmlinux:1; /* 1 if symbol is defined in vmlinux */ 164 unsigned int vmlinux:1; /* 1 if symbol is defined in vmlinux */
162 unsigned int kernel:1; /* 1 if symbol is from kernel 165 unsigned int kernel:1; /* 1 if symbol is from kernel
163 * (only for external modules) **/ 166 * (only for external modules) **/
164 unsigned int preloaded:1; /* 1 if symbol from Module.symvers */ 167 unsigned int preloaded:1; /* 1 if symbol from Module.symvers, or crc */
165 enum export export; /* Type of export */ 168 enum export export; /* Type of export */
166 char name[0]; 169 char name[0];
167}; 170};
@@ -329,8 +332,11 @@ static void sym_update_crc(const char *name, struct module *mod,
329{ 332{
330 struct symbol *s = find_symbol(name); 333 struct symbol *s = find_symbol(name);
331 334
332 if (!s) 335 if (!s) {
333 s = new_symbol(name, mod, export); 336 s = new_symbol(name, mod, export);
337 /* Don't complain when we find it later. */
338 s->preloaded = 1;
339 }
334 s->crc = crc; 340 s->crc = crc;
335 s->crc_valid = 1; 341 s->crc_valid = 1;
336} 342}
@@ -407,6 +413,11 @@ static int parse_elf(struct elf_info *info, const char *filename)
407 413
408 hdr = grab_file(filename, &info->size); 414 hdr = grab_file(filename, &info->size);
409 if (!hdr) { 415 if (!hdr) {
416 if (ignore_missing_files) {
417 fprintf(stderr, "%s: %s (ignored)\n", filename,
418 strerror(errno));
419 return 0;
420 }
410 perror(filename); 421 perror(filename);
411 exit(1); 422 exit(1);
412 } 423 }
@@ -599,18 +610,17 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
599 else 610 else
600 export = export_from_sec(info, get_secindex(info, sym)); 611 export = export_from_sec(info, get_secindex(info, sym));
601 612
613 /* CRC'd symbol */
614 if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
615 crc = (unsigned int) sym->st_value;
616 sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
617 export);
618 }
619
602 switch (sym->st_shndx) { 620 switch (sym->st_shndx) {
603 case SHN_COMMON: 621 case SHN_COMMON:
604 warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name); 622 warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name);
605 break; 623 break;
606 case SHN_ABS:
607 /* CRC'd symbol */
608 if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
609 crc = (unsigned int) sym->st_value;
610 sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
611 export);
612 }
613 break;
614 case SHN_UNDEF: 624 case SHN_UNDEF:
615 /* undefined symbol */ 625 /* undefined symbol */
616 if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL && 626 if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL &&
@@ -1853,7 +1863,7 @@ static void add_header(struct buffer *b, struct module *mod)
1853 buf_printf(b, "\n"); 1863 buf_printf(b, "\n");
1854 buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); 1864 buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
1855 buf_printf(b, "\n"); 1865 buf_printf(b, "\n");
1856 buf_printf(b, "struct module __this_module\n"); 1866 buf_printf(b, "__visible struct module __this_module\n");
1857 buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); 1867 buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n");
1858 buf_printf(b, "\t.name = KBUILD_MODNAME,\n"); 1868 buf_printf(b, "\t.name = KBUILD_MODNAME,\n");
1859 if (mod->has_init) 1869 if (mod->has_init)
@@ -2119,7 +2129,7 @@ int main(int argc, char **argv)
2119 struct ext_sym_list *extsym_iter; 2129 struct ext_sym_list *extsym_iter;
2120 struct ext_sym_list *extsym_start = NULL; 2130 struct ext_sym_list *extsym_start = NULL;
2121 2131
2122 while ((opt = getopt(argc, argv, "i:I:e:msST:o:awM:K:")) != -1) { 2132 while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:")) != -1) {
2123 switch (opt) { 2133 switch (opt) {
2124 case 'i': 2134 case 'i':
2125 kernel_read = optarg; 2135 kernel_read = optarg;
@@ -2139,6 +2149,9 @@ int main(int argc, char **argv)
2139 case 'm': 2149 case 'm':
2140 modversions = 1; 2150 modversions = 1;
2141 break; 2151 break;
2152 case 'n':
2153 ignore_missing_files = 1;
2154 break;
2142 case 'o': 2155 case 'o':
2143 dump_write = optarg; 2156 dump_write = optarg;
2144 break; 2157 break;
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c
index 9dfcd6d988da..deb2994b04c4 100644
--- a/scripts/mod/sumversion.c
+++ b/scripts/mod/sumversion.c
@@ -416,7 +416,7 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
416 basename = strrchr(modname, '/') + 1; 416 basename = strrchr(modname, '/') + 1;
417 else 417 else
418 basename = modname; 418 basename = modname;
419 sprintf(filelist, "%s/%.*s.mod", modverdir, 419 snprintf(filelist, sizeof(filelist), "%s/%.*s.mod", modverdir,
420 (int) strlen(basename) - 2, basename); 420 (int) strlen(basename) - 2, basename);
421 421
422 file = grab_file(filelist, &len); 422 file = grab_file(filelist, &len);
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index a4f31c900fa6..c5d473393816 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -115,7 +115,9 @@ git --git-dir=$(srctree)/.git archive --prefix=$(perf-tar)/ \
115 -o $(perf-tar).tar; \ 115 -o $(perf-tar).tar; \
116mkdir -p $(perf-tar); \ 116mkdir -p $(perf-tar); \
117git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \ 117git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \
118tar rf $(perf-tar).tar $(perf-tar)/HEAD; \ 118(cd $(srctree)/tools/perf; \
119util/PERF-VERSION-GEN ../../$(perf-tar)/ 2>/dev/null); \
120tar rf $(perf-tar).tar $(perf-tar)/HEAD $(perf-tar)/PERF-VERSION-FILE; \
119rm -r $(perf-tar); \ 121rm -r $(perf-tar); \
120$(if $(findstring tar-src,$@),, \ 122$(if $(findstring tar-src,$@),, \
121$(if $(findstring bz2,$@),bzip2, \ 123$(if $(findstring bz2,$@),bzip2, \
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index acb86507828a..90e521fde35f 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -41,9 +41,9 @@ create_package() {
41 parisc*) 41 parisc*)
42 debarch=hppa ;; 42 debarch=hppa ;;
43 mips*) 43 mips*)
44 debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y .config && echo el) ;; 44 debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el) ;;
45 arm*) 45 arm*)
46 debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el) ;; 46 debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el) ;;
47 *) 47 *)
48 echo "" >&2 48 echo "" >&2
49 echo "** ** ** WARNING ** ** **" >&2 49 echo "** ** ** WARNING ** ** **" >&2
@@ -78,17 +78,35 @@ tmpdir="$objtree/debian/tmp"
78fwdir="$objtree/debian/fwtmp" 78fwdir="$objtree/debian/fwtmp"
79kernel_headers_dir="$objtree/debian/hdrtmp" 79kernel_headers_dir="$objtree/debian/hdrtmp"
80libc_headers_dir="$objtree/debian/headertmp" 80libc_headers_dir="$objtree/debian/headertmp"
81dbg_dir="$objtree/debian/dbgtmp"
81packagename=linux-image-$version 82packagename=linux-image-$version
82fwpackagename=linux-firmware-image 83fwpackagename=linux-firmware-image-$version
83kernel_headers_packagename=linux-headers-$version 84kernel_headers_packagename=linux-headers-$version
84libc_headers_packagename=linux-libc-dev 85libc_headers_packagename=linux-libc-dev
86dbg_packagename=$packagename-dbg
85 87
86if [ "$ARCH" = "um" ] ; then 88if [ "$ARCH" = "um" ] ; then
87 packagename=user-mode-linux-$version 89 packagename=user-mode-linux-$version
88fi 90fi
89 91
92# Not all arches have the same installed path in debian
93# XXX: have each arch Makefile export a variable of the canonical image install
94# path instead
95case $ARCH in
96um)
97 installed_image_path="usr/bin/linux-$version"
98 ;;
99parisc|mips|powerpc)
100 installed_image_path="boot/vmlinux-$version"
101 ;;
102*)
103 installed_image_path="boot/vmlinuz-$version"
104esac
105
106BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
107
90# Setup the directory structure 108# Setup the directory structure
91rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" 109rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir"
92mkdir -m 755 -p "$tmpdir/DEBIAN" 110mkdir -m 755 -p "$tmpdir/DEBIAN"
93mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" 111mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename"
94mkdir -m 755 -p "$fwdir/DEBIAN" 112mkdir -m 755 -p "$fwdir/DEBIAN"
@@ -101,26 +119,29 @@ mkdir -p "$kernel_headers_dir/lib/modules/$version/"
101if [ "$ARCH" = "um" ] ; then 119if [ "$ARCH" = "um" ] ; then
102 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" 120 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin"
103fi 121fi
122if [ -n "$BUILD_DEBUG" ] ; then
123 mkdir -p "$dbg_dir/usr/share/doc/$dbg_packagename"
124 mkdir -m 755 -p "$dbg_dir/DEBIAN"
125fi
104 126
105# Build and install the kernel 127# Build and install the kernel
106if [ "$ARCH" = "um" ] ; then 128if [ "$ARCH" = "um" ] ; then
107 $MAKE linux 129 $MAKE linux
108 cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map" 130 cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
109 cp .config "$tmpdir/usr/share/doc/$packagename/config" 131 cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
110 gzip "$tmpdir/usr/share/doc/$packagename/config" 132 gzip "$tmpdir/usr/share/doc/$packagename/config"
111 cp $KBUILD_IMAGE "$tmpdir/usr/bin/linux-$version"
112else 133else
113 cp System.map "$tmpdir/boot/System.map-$version" 134 cp System.map "$tmpdir/boot/System.map-$version"
114 cp .config "$tmpdir/boot/config-$version" 135 cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version"
115 # Not all arches include the boot path in KBUILD_IMAGE 136fi
116 if [ -e $KBUILD_IMAGE ]; then 137# Not all arches include the boot path in KBUILD_IMAGE
117 cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" 138if [ -e $KBUILD_IMAGE ]; then
118 else 139 cp $KBUILD_IMAGE "$tmpdir/$installed_image_path"
119 cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" 140else
120 fi 141 cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/$installed_image_path"
121fi 142fi
122 143
123if grep -q '^CONFIG_MODULES=y' .config ; then 144if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
124 INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install 145 INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install
125 rm -f "$tmpdir/lib/modules/$version/build" 146 rm -f "$tmpdir/lib/modules/$version/build"
126 rm -f "$tmpdir/lib/modules/$version/source" 147 rm -f "$tmpdir/lib/modules/$version/source"
@@ -128,6 +149,20 @@ if grep -q '^CONFIG_MODULES=y' .config ; then
128 mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" 149 mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/"
129 rmdir "$tmpdir/lib/modules/$version" 150 rmdir "$tmpdir/lib/modules/$version"
130 fi 151 fi
152 if [ -n "$BUILD_DEBUG" ] ; then
153 (
154 cd $tmpdir
155 for module in $(find lib/modules/ -name *.ko); do
156 mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module)
157 # only keep debug symbols in the debug file
158 objcopy --only-keep-debug $module $dbg_dir/usr/lib/debug/$module
159 # strip original module from debug symbols
160 objcopy --strip-debug $module
161 # then add a link to those
162 objcopy --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $module
163 done
164 )
165 fi
131fi 166fi
132 167
133if [ "$ARCH" != "um" ]; then 168if [ "$ARCH" != "um" ]; then
@@ -149,7 +184,7 @@ set -e
149# Pass maintainer script parameters to hook scripts 184# Pass maintainer script parameters to hook scripts
150export DEB_MAINT_PARAMS="\$*" 185export DEB_MAINT_PARAMS="\$*"
151 186
152test -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d 187test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
153exit 0 188exit 0
154EOF 189EOF
155 chmod 755 "$tmpdir/DEBIAN/$script" 190 chmod 755 "$tmpdir/DEBIAN/$script"
@@ -245,11 +280,12 @@ fi
245# Build header package 280# Build header package
246(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles") 281(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles")
247(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles") 282(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles")
248(cd $objtree; find arch/$SRCARCH/include .config Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles") 283(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles")
249destdir=$kernel_headers_dir/usr/src/linux-headers-$version 284destdir=$kernel_headers_dir/usr/src/linux-headers-$version
250mkdir -p "$destdir" 285mkdir -p "$destdir"
251(cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -) 286(cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -)
252(cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -) 287(cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
288(cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be
253ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" 289ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
254rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" 290rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
255arch=$(dpkg --print-architecture) 291arch=$(dpkg --print-architecture)
@@ -299,4 +335,30 @@ fi
299 335
300create_package "$packagename" "$tmpdir" 336create_package "$packagename" "$tmpdir"
301 337
338if [ -n "$BUILD_DEBUG" ] ; then
339 # Build debug package
340 # Different tools want the image in different locations
341 # perf
342 mkdir -p $dbg_dir/usr/lib/debug/lib/modules/$version/
343 cp vmlinux $dbg_dir/usr/lib/debug/lib/modules/$version/
344 # systemtap
345 mkdir -p $dbg_dir/usr/lib/debug/boot/
346 ln -s ../lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/boot/vmlinux-$version
347 # kdump-tools
348 ln -s lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/vmlinux-$version
349
350 cat <<EOF >> debian/control
351
352Package: $dbg_packagename
353Section: debug
354Provides: linux-debug, linux-debug-$version
355Architecture: any
356Description: Linux kernel debugging symbols for $version
357 This package will come in handy if you need to debug the kernel. It provides
358 all the necessary debug symbols for the kernel and its modules.
359EOF
360
361 create_package "$dbg_packagename" "$dbg_dir"
362fi
363
302exit 0 364exit 0
diff --git a/scripts/package/buildtar b/scripts/package/buildtar
index cdd9bb909bcd..aa22f9447ddc 100644
--- a/scripts/package/buildtar
+++ b/scripts/package/buildtar
@@ -87,6 +87,27 @@ case "${ARCH}" in
87 [ -f "${objtree}/vmlinux.SYS" ] && cp -v -- "${objtree}/vmlinux.SYS" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.SYS" 87 [ -f "${objtree}/vmlinux.SYS" ] && cp -v -- "${objtree}/vmlinux.SYS" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.SYS"
88 [ -f "${objtree}/vmlinux.dsk" ] && cp -v -- "${objtree}/vmlinux.dsk" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.dsk" 88 [ -f "${objtree}/vmlinux.dsk" ] && cp -v -- "${objtree}/vmlinux.dsk" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.dsk"
89 ;; 89 ;;
90 mips)
91 if [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.bin" ]; then
92 cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.bin" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
93 elif [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.ecoff" ]; then
94 cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.ecoff" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
95 elif [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.srec" ]; then
96 cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.srec" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
97 elif [ -f "${objtree}/vmlinux.32" ]; then
98 cp -v -- "${objtree}/vmlinux.32" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
99 elif [ -f "${objtree}/vmlinux.64" ]; then
100 cp -v -- "${objtree}/vmlinux.64" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
101 elif [ -f "${objtree}/arch/mips/boot/vmlinux.bin" ]; then
102 cp -v -- "${objtree}/arch/mips/boot/vmlinux.bin" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
103 elif [ -f "${objtree}/arch/mips/boot/vmlinux.ecoff" ]; then
104 cp -v -- "${objtree}/arch/mips/boot/vmlinux.ecoff" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
105 elif [ -f "${objtree}/arch/mips/boot/vmlinux.srec" ]; then
106 cp -v -- "${objtree}/arch/mips/boot/vmlinux.srec" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
107 elif [ -f "${objtree}/vmlinux" ]; then
108 cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
109 fi
110 ;;
90 *) 111 *)
91 [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${KERNELRELEASE}" 112 [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${KERNELRELEASE}"
92 echo "" >&2 113 echo "" >&2
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index fdd3fbf4d4a4..13957602f7ca 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# Output a simple RPM spec file that uses no fancy features requiring 3# Output a simple RPM spec file.
4# RPM v4. This is intended to work with any RPM distro. 4# This version assumes a minimum of RPM 4.0.3.
5# 5#
6# The only gothic bit here is redefining install_post to avoid 6# The only gothic bit here is redefining install_post to avoid
7# stripping the symbols from files in the kernel which we want 7# stripping the symbols from files in the kernel which we want
@@ -59,6 +59,14 @@ echo "header files define structures and constants that are needed for"
59echo "building most standard programs and are also needed for rebuilding the" 59echo "building most standard programs and are also needed for rebuilding the"
60echo "glibc package." 60echo "glibc package."
61echo "" 61echo ""
62echo "%package devel"
63echo "Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel"
64echo "Group: System Environment/Kernel"
65echo "AutoReqProv: no"
66echo "%description -n kernel-devel"
67echo "This package provides kernel headers and makefiles sufficient to build modules"
68echo "against the $__KERNELRELEASE kernel package."
69echo ""
62 70
63if ! $PREBUILT; then 71if ! $PREBUILT; then
64echo "%prep" 72echo "%prep"
@@ -77,13 +85,14 @@ echo "%install"
77echo 'KBUILD_IMAGE=$(make image_name)' 85echo 'KBUILD_IMAGE=$(make image_name)'
78echo "%ifarch ia64" 86echo "%ifarch ia64"
79echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' 87echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
80echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
81echo "%else" 88echo "%else"
82echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' 89echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
83echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
84echo "%endif" 90echo "%endif"
91echo 'mkdir -p $RPM_BUILD_ROOT'"/lib/firmware/$KERNELRELEASE"
85 92
86echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= modules_install' 93echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= mod-fw= modules_install'
94echo 'INSTALL_FW_PATH=$RPM_BUILD_ROOT'"/lib/firmware/$KERNELRELEASE"
95echo 'make INSTALL_FW_PATH=$INSTALL_FW_PATH' firmware_install
87echo "%ifarch ia64" 96echo "%ifarch ia64"
88echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" 97echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
89echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" 98echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
@@ -108,18 +117,43 @@ echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
108echo 'mv vmlinux.orig vmlinux' 117echo 'mv vmlinux.orig vmlinux'
109echo "%endif" 118echo "%endif"
110 119
120echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/{build,source}"
121echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE"
122echo "EXCLUDES=\"$RCS_TAR_IGNORE --exclude .tmp_versions --exclude=*vmlinux* --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation --exclude=firmware --exclude .config.old --exclude .missing-syscalls.d\""
123echo "tar "'$EXCLUDES'" -cf- . | (cd "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE;tar xvf -)"
124echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE"
125echo "ln -sf /usr/src/kernels/$KERNELRELEASE build"
126echo "ln -sf /usr/src/kernels/$KERNELRELEASE source"
127
111echo "" 128echo ""
112echo "%clean" 129echo "%clean"
113echo 'rm -rf $RPM_BUILD_ROOT' 130echo 'rm -rf $RPM_BUILD_ROOT'
114echo "" 131echo ""
132echo "%post"
133echo "if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then"
134echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/vmlinuz-$KERNELRELEASE-rpm"
135echo "cp /boot/System.map-$KERNELRELEASE /boot/System.map-$KERNELRELEASE-rpm"
136echo "rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE"
137echo "/sbin/installkernel $KERNELRELEASE /boot/vmlinuz-$KERNELRELEASE-rpm /boot/System.map-$KERNELRELEASE-rpm"
138echo "rm -f /boot/vmlinuz-$KERNELRELEASE-rpm /boot/System.map-$KERNELRELEASE-rpm"
139echo "fi"
140echo ""
115echo "%files" 141echo "%files"
116echo '%defattr (-, root, root)' 142echo '%defattr (-, root, root)'
117echo "%dir /lib/modules" 143echo "%dir /lib/modules"
118echo "/lib/modules/$KERNELRELEASE" 144echo "/lib/modules/$KERNELRELEASE"
119echo "/lib/firmware" 145echo "%exclude /lib/modules/$KERNELRELEASE/build"
146echo "%exclude /lib/modules/$KERNELRELEASE/source"
147echo "/lib/firmware/$KERNELRELEASE"
120echo "/boot/*" 148echo "/boot/*"
121echo "" 149echo ""
122echo "%files headers" 150echo "%files headers"
123echo '%defattr (-, root, root)' 151echo '%defattr (-, root, root)'
124echo "/usr/include" 152echo "/usr/include"
125echo "" 153echo ""
154echo "%files devel"
155echo '%defattr (-, root, root)'
156echo "/usr/src/kernels/$KERNELRELEASE"
157echo "/lib/modules/$KERNELRELEASE/build"
158echo "/lib/modules/$KERNELRELEASE/source"
159echo ""
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index a674fd5507c1..d0da66396f62 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -214,13 +214,13 @@ $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)";
214$weak_regex = "^[0-9a-fA-F]+\\s+([wW])\\s+(\\S+)"; 214$weak_regex = "^[0-9a-fA-F]+\\s+([wW])\\s+(\\S+)";
215$section_regex = "Disassembly of section\\s+(\\S+):"; 215$section_regex = "Disassembly of section\\s+(\\S+):";
216$function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; 216$function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:";
217$mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; 217$mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s(mcount|__fentry__)\$";
218$section_type = '@progbits'; 218$section_type = '@progbits';
219$mcount_adjust = 0; 219$mcount_adjust = 0;
220$type = ".long"; 220$type = ".long";
221 221
222if ($arch eq "x86_64") { 222if ($arch eq "x86_64") {
223 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; 223 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s(mcount|__fentry__)([+-]0x[0-9a-zA-Z]+)?\$";
224 $type = ".quad"; 224 $type = ".quad";
225 $alignment = 8; 225 $alignment = 8;
226 $mcount_adjust = -1; 226 $mcount_adjust = -1;
diff --git a/scripts/show_delta b/scripts/show_delta
index 17df3051747a..e25732b5d701 100755
--- a/scripts/show_delta
+++ b/scripts/show_delta
@@ -13,7 +13,7 @@ import sys
13import string 13import string
14 14
15def usage(): 15def usage():
16 print """usage: show_delta [<options>] <filename> 16 print ("""usage: show_delta [<options>] <filename>
17 17
18This program parses the output from a set of printk message lines which 18This program parses the output from a set of printk message lines which
19have time data prefixed because the CONFIG_PRINTK_TIME option is set, or 19have time data prefixed because the CONFIG_PRINTK_TIME option is set, or
@@ -35,7 +35,7 @@ ex: $ dmesg >timefile
35 35
36will show times relative to the line in the kernel output 36will show times relative to the line in the kernel output
37starting with "NET4". 37starting with "NET4".
38""" 38""")
39 sys.exit(1) 39 sys.exit(1)
40 40
41# returns a tuple containing the seconds and text for each message line 41# returns a tuple containing the seconds and text for each message line
@@ -94,11 +94,11 @@ def main():
94 try: 94 try:
95 lines = open(filein,"r").readlines() 95 lines = open(filein,"r").readlines()
96 except: 96 except:
97 print "Problem opening file: %s" % filein 97 print ("Problem opening file: %s" % filein)
98 sys.exit(1) 98 sys.exit(1)
99 99
100 if base_str: 100 if base_str:
101 print 'base= "%s"' % base_str 101 print ('base= "%s"' % base_str)
102 # assume a numeric base. If that fails, try searching 102 # assume a numeric base. If that fails, try searching
103 # for a matching line. 103 # for a matching line.
104 try: 104 try:
@@ -117,13 +117,13 @@ def main():
117 # stop at first match 117 # stop at first match
118 break 118 break
119 if not found: 119 if not found:
120 print 'Couldn\'t find line matching base pattern "%s"' % base_str 120 print ('Couldn\'t find line matching base pattern "%s"' % base_str)
121 sys.exit(1) 121 sys.exit(1)
122 else: 122 else:
123 base_time = 0.0 123 base_time = 0.0
124 124
125 for line in lines: 125 for line in lines:
126 print convert_line(line, base_time), 126 print (convert_line(line, base_time),)
127 127
128main() 128main()
129 129
diff --git a/scripts/sortextable.c b/scripts/sortextable.c
index f9ce1160419b..5f7a8b663cb9 100644
--- a/scripts/sortextable.c
+++ b/scripts/sortextable.c
@@ -64,14 +64,6 @@ fail_file(void)
64 longjmp(jmpenv, SJ_FAIL); 64 longjmp(jmpenv, SJ_FAIL);
65} 65}
66 66
67static void __attribute__((noreturn))
68succeed_file(void)
69{
70 cleanup();
71 longjmp(jmpenv, SJ_SUCCEED);
72}
73
74
75/* 67/*
76 * Get the whole file as a programming convenience in order to avoid 68 * Get the whole file as a programming convenience in order to avoid
77 * malloc+lseek+read+free of many pieces. If successful, then mmap 69 * malloc+lseek+read+free of many pieces. If successful, then mmap
@@ -160,6 +152,30 @@ static void (*w2)(uint16_t, uint16_t *);
160 152
161typedef void (*table_sort_t)(char *, int); 153typedef void (*table_sort_t)(char *, int);
162 154
155/*
156 * Move reserved section indices SHN_LORESERVE..SHN_HIRESERVE out of
157 * the way to -256..-1, to avoid conflicting with real section
158 * indices.
159 */
160#define SPECIAL(i) ((i) - (SHN_HIRESERVE + 1))
161
162static inline int is_shndx_special(unsigned int i)
163{
164 return i != SHN_XINDEX && i >= SHN_LORESERVE && i <= SHN_HIRESERVE;
165}
166
167/* Accessor for sym->st_shndx, hides ugliness of "64k sections" */
168static inline unsigned int get_secindex(unsigned int shndx,
169 unsigned int sym_offs,
170 const Elf32_Word *symtab_shndx_start)
171{
172 if (is_shndx_special(shndx))
173 return SPECIAL(shndx);
174 if (shndx != SHN_XINDEX)
175 return shndx;
176 return r(&symtab_shndx_start[sym_offs]);
177}
178
163/* 32 bit and 64 bit are very similar */ 179/* 32 bit and 64 bit are very similar */
164#include "sortextable.h" 180#include "sortextable.h"
165#define SORTEXTABLE_64 181#define SORTEXTABLE_64
diff --git a/scripts/sortextable.h b/scripts/sortextable.h
index f5eb43d42926..8fac3fd697a6 100644
--- a/scripts/sortextable.h
+++ b/scripts/sortextable.h
@@ -98,6 +98,8 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort)
98 Elf_Shdr *symtab_sec = NULL; 98 Elf_Shdr *symtab_sec = NULL;
99 Elf_Shdr *extab_sec = NULL; 99 Elf_Shdr *extab_sec = NULL;
100 Elf_Sym *sym; 100 Elf_Sym *sym;
101 const Elf_Sym *symtab;
102 Elf32_Word *symtab_shndx_start = NULL;
101 Elf_Sym *sort_needed_sym; 103 Elf_Sym *sort_needed_sym;
102 Elf_Shdr *sort_needed_sec; 104 Elf_Shdr *sort_needed_sec;
103 Elf_Rel *relocs = NULL; 105 Elf_Rel *relocs = NULL;
@@ -109,11 +111,22 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort)
109 int extab_index = 0; 111 int extab_index = 0;
110 int i; 112 int i;
111 int idx; 113 int idx;
114 unsigned int num_sections;
115 unsigned int secindex_strings;
112 116
113 shdr = (Elf_Shdr *)((char *)ehdr + _r(&ehdr->e_shoff)); 117 shdr = (Elf_Shdr *)((char *)ehdr + _r(&ehdr->e_shoff));
114 shstrtab_sec = shdr + r2(&ehdr->e_shstrndx); 118
119 num_sections = r2(&ehdr->e_shnum);
120 if (num_sections == SHN_UNDEF)
121 num_sections = _r(&shdr[0].sh_size);
122
123 secindex_strings = r2(&ehdr->e_shstrndx);
124 if (secindex_strings == SHN_XINDEX)
125 secindex_strings = r(&shdr[0].sh_link);
126
127 shstrtab_sec = shdr + secindex_strings;
115 secstrtab = (const char *)ehdr + _r(&shstrtab_sec->sh_offset); 128 secstrtab = (const char *)ehdr + _r(&shstrtab_sec->sh_offset);
116 for (i = 0; i < r2(&ehdr->e_shnum); i++) { 129 for (i = 0; i < num_sections; i++) {
117 idx = r(&shdr[i].sh_name); 130 idx = r(&shdr[i].sh_name);
118 if (strcmp(secstrtab + idx, "__ex_table") == 0) { 131 if (strcmp(secstrtab + idx, "__ex_table") == 0) {
119 extab_sec = shdr + i; 132 extab_sec = shdr + i;
@@ -129,6 +142,9 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort)
129 symtab_sec = shdr + i; 142 symtab_sec = shdr + i;
130 if (strcmp(secstrtab + idx, ".strtab") == 0) 143 if (strcmp(secstrtab + idx, ".strtab") == 0)
131 strtab_sec = shdr + i; 144 strtab_sec = shdr + i;
145 if (r(&shdr[i].sh_type) == SHT_SYMTAB_SHNDX)
146 symtab_shndx_start = (Elf32_Word *)(
147 (const char *)ehdr + _r(&shdr[i].sh_offset));
132 } 148 }
133 if (strtab_sec == NULL) { 149 if (strtab_sec == NULL) {
134 fprintf(stderr, "no .strtab in file: %s\n", fname); 150 fprintf(stderr, "no .strtab in file: %s\n", fname);
@@ -138,6 +154,8 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort)
138 fprintf(stderr, "no .symtab in file: %s\n", fname); 154 fprintf(stderr, "no .symtab in file: %s\n", fname);
139 fail_file(); 155 fail_file();
140 } 156 }
157 symtab = (const Elf_Sym *)((const char *)ehdr +
158 _r(&symtab_sec->sh_offset));
141 if (extab_sec == NULL) { 159 if (extab_sec == NULL) {
142 fprintf(stderr, "no __ex_table in file: %s\n", fname); 160 fprintf(stderr, "no __ex_table in file: %s\n", fname);
143 fail_file(); 161 fail_file();
@@ -176,7 +194,9 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort)
176 fname); 194 fname);
177 fail_file(); 195 fail_file();
178 } 196 }
179 sort_needed_sec = &shdr[r2(&sort_needed_sym->st_shndx)]; 197 sort_needed_sec = &shdr[get_secindex(r2(&sym->st_shndx),
198 sort_needed_sym - symtab,
199 symtab_shndx_start)];
180 sort_done_location = (void *)ehdr + 200 sort_done_location = (void *)ehdr +
181 _r(&sort_needed_sec->sh_offset) + 201 _r(&sort_needed_sec->sh_offset) +
182 _r(&sort_needed_sym->st_value) - 202 _r(&sort_needed_sym->st_value) -
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 74f02e4dddd2..58c455929091 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -149,15 +149,16 @@ dogtags()
149exuberant() 149exuberant()
150{ 150{
151 all_target_sources | xargs $1 -a \ 151 all_target_sources | xargs $1 -a \
152 -I __initdata,__exitdata,__initconst,__devinitdata \ 152 -I __initdata,__exitdata,__initconst, \
153 -I __devinitconst,__cpuinitdata,__initdata_memblock \ 153 -I __cpuinitdata,__initdata_memblock \
154 -I __refdata,__attribute \ 154 -I __refdata,__attribute,__maybe_unused,__always_unused \
155 -I __acquires,__releases,__deprecated \ 155 -I __acquires,__releases,__deprecated \
156 -I __read_mostly,__aligned,____cacheline_aligned \ 156 -I __read_mostly,__aligned,____cacheline_aligned \
157 -I ____cacheline_aligned_in_smp \ 157 -I ____cacheline_aligned_in_smp \
158 -I __cacheline_aligned,__cacheline_aligned_in_smp \
158 -I ____cacheline_internodealigned_in_smp \ 159 -I ____cacheline_internodealigned_in_smp \
159 -I __used,__packed,__packed2__,__must_check,__must_hold \ 160 -I __used,__packed,__packed2__,__must_check,__must_hold \
160 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ 161 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL,ACPI_EXPORT_SYMBOL \
161 -I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \ 162 -I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \
162 -I static,const \ 163 -I static,const \
163 --extra=+f --c-kinds=+px \ 164 --extra=+f --c-kinds=+px \