diff options
Diffstat (limited to 'scripts')
58 files changed, 1769 insertions, 1881 deletions
diff --git a/scripts/.gitignore b/scripts/.gitignore index 105b21f0818..fb070fa1038 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore | |||
@@ -9,3 +9,5 @@ unifdef | |||
9 | ihex2fw | 9 | ihex2fw |
10 | recordmcount | 10 | recordmcount |
11 | docproc | 11 | docproc |
12 | sortextable | ||
13 | asn1_compiler | ||
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index be39cd1c74c..d897278b1f9 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -21,6 +21,10 @@ depfile = $(subst $(comma),_,$(dot-target).d) | |||
21 | basetarget = $(basename $(notdir $@)) | 21 | basetarget = $(basename $(notdir $@)) |
22 | 22 | ||
23 | ### | 23 | ### |
24 | # filename of first prerequisite with directory and extension stripped | ||
25 | baseprereq = $(basename $(notdir $<)) | ||
26 | |||
27 | ### | ||
24 | # Escape single quote for use in echo statements | 28 | # Escape single quote for use in echo statements |
25 | escsq = $(subst $(squote),'\$(squote)',$1) | 29 | escsq = $(subst $(squote),'\$(squote)',$1) |
26 | 30 | ||
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 93b2b5938a2..aeea84a2483 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -160,13 +160,51 @@ ld_flags = $(LDFLAGS) $(ldflags-y) | |||
160 | modname-multi = $(sort $(foreach m,$(multi-used),\ | 160 | modname-multi = $(sort $(foreach m,$(multi-used),\ |
161 | $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=)))) | 161 | $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=)))) |
162 | 162 | ||
163 | ifdef REGENERATE_PARSERS | ||
164 | |||
165 | # GPERF | ||
166 | # --------------------------------------------------------------------------- | ||
167 | quiet_cmd_gperf = GPERF $@ | ||
168 | cmd_gperf = gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $< | ||
169 | |||
170 | $(src)/%.hash.c_shipped: $(src)/%.gperf | ||
171 | $(call cmd,gperf) | ||
172 | |||
173 | # LEX | ||
174 | # --------------------------------------------------------------------------- | ||
175 | LEX_PREFIX = $(if $(LEX_PREFIX_${baseprereq}),$(LEX_PREFIX_${baseprereq}),yy) | ||
176 | |||
177 | quiet_cmd_flex = LEX $@ | ||
178 | cmd_flex = flex -o$@ -L -P $(LEX_PREFIX) $< | ||
179 | |||
180 | $(src)/%.lex.c_shipped: $(src)/%.l | ||
181 | $(call cmd,flex) | ||
182 | |||
183 | # YACC | ||
184 | # --------------------------------------------------------------------------- | ||
185 | YACC_PREFIX = $(if $(YACC_PREFIX_${baseprereq}),$(YACC_PREFIX_${baseprereq}),yy) | ||
186 | |||
187 | quiet_cmd_bison = YACC $@ | ||
188 | cmd_bison = bison -o$@ -t -l -p $(YACC_PREFIX) $< | ||
189 | |||
190 | $(src)/%.tab.c_shipped: $(src)/%.y | ||
191 | $(call cmd,bison) | ||
192 | |||
193 | quiet_cmd_bison_h = YACC $@ | ||
194 | cmd_bison_h = bison -o/dev/null --defines=$@ -t -l -p $(YACC_PREFIX) $< | ||
195 | |||
196 | $(src)/%.tab.h_shipped: $(src)/%.y | ||
197 | $(call cmd,bison_h) | ||
198 | |||
199 | endif | ||
200 | |||
163 | # Shipped files | 201 | # Shipped files |
164 | # =========================================================================== | 202 | # =========================================================================== |
165 | 203 | ||
166 | quiet_cmd_shipped = SHIPPED $@ | 204 | quiet_cmd_shipped = SHIPPED $@ |
167 | cmd_shipped = cat $< > $@ | 205 | cmd_shipped = cat $< > $@ |
168 | 206 | ||
169 | $(obj)/%:: $(src)/%_shipped | 207 | $(obj)/%: $(src)/%_shipped |
170 | $(call cmd,shipped) | 208 | $(call cmd,shipped) |
171 | 209 | ||
172 | # Commands useful for building a boot image | 210 | # Commands useful for building a boot image |
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 56dfafc73c1..08dce14f2dc 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | # Step 3 is used to place certain information in the module's ELF | 19 | # Step 3 is used to place certain information in the module's ELF |
20 | # section, including information such as: | 20 | # section, including information such as: |
21 | # Version magic (see include/vermagic.h for full details) | 21 | # Version magic (see include/linux/vermagic.h for full details) |
22 | # - Kernel release | 22 | # - Kernel release |
23 | # - SMP is CONFIG_SMP | 23 | # - SMP is CONFIG_SMP |
24 | # - PREEMPT is CONFIG_PREEMPT | 24 | # - PREEMPT is CONFIG_PREEMPT |
diff --git a/scripts/bootgraph.pl b/scripts/bootgraph.pl index 12caa822a23..b78fca994a1 100644 --- a/scripts/bootgraph.pl +++ b/scripts/bootgraph.pl | |||
@@ -44,7 +44,7 @@ my %end; | |||
44 | my %type; | 44 | my %type; |
45 | my $done = 0; | 45 | my $done = 0; |
46 | my $maxtime = 0; | 46 | my $maxtime = 0; |
47 | my $firsttime = 100; | 47 | my $firsttime = 99999; |
48 | my $count = 0; | 48 | my $count = 0; |
49 | my %pids; | 49 | my %pids; |
50 | my %pidctr; | 50 | my %pidctr; |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b0aa2c68059..3dfc47134e5 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -10,7 +10,7 @@ use strict; | |||
10 | my $P = $0; | 10 | my $P = $0; |
11 | $P =~ s@.*/@@g; | 11 | $P =~ s@.*/@@g; |
12 | 12 | ||
13 | my $V = '0.31'; | 13 | my $V = '0.32'; |
14 | 14 | ||
15 | use Getopt::Long qw(:config no_auto_abbrev); | 15 | use Getopt::Long qw(:config no_auto_abbrev); |
16 | 16 | ||
@@ -26,9 +26,13 @@ my $check = 0; | |||
26 | my $summary = 1; | 26 | my $summary = 1; |
27 | my $mailback = 0; | 27 | my $mailback = 0; |
28 | my $summary_file = 0; | 28 | my $summary_file = 0; |
29 | my $show_types = 0; | ||
29 | my $root; | 30 | my $root; |
30 | my %debug; | 31 | my %debug; |
32 | my %ignore_type = (); | ||
33 | my @ignore = (); | ||
31 | my $help = 0; | 34 | my $help = 0; |
35 | my $configuration_file = ".checkpatch.conf"; | ||
32 | 36 | ||
33 | sub help { | 37 | sub help { |
34 | my ($exitcode) = @_; | 38 | my ($exitcode) = @_; |
@@ -46,6 +50,8 @@ Options: | |||
46 | --terse one line per report | 50 | --terse one line per report |
47 | -f, --file treat FILE as regular source file | 51 | -f, --file treat FILE as regular source file |
48 | --subjective, --strict enable more subjective tests | 52 | --subjective, --strict enable more subjective tests |
53 | --ignore TYPE(,TYPE2...) ignore various comma separated message types | ||
54 | --show-types show the message "types" in the output | ||
49 | --root=PATH PATH to the kernel tree root | 55 | --root=PATH PATH to the kernel tree root |
50 | --no-summary suppress the per-file summary | 56 | --no-summary suppress the per-file summary |
51 | --mailback only produce a report in case of warnings/errors | 57 | --mailback only produce a report in case of warnings/errors |
@@ -63,6 +69,32 @@ EOM | |||
63 | exit($exitcode); | 69 | exit($exitcode); |
64 | } | 70 | } |
65 | 71 | ||
72 | my $conf = which_conf($configuration_file); | ||
73 | if (-f $conf) { | ||
74 | my @conf_args; | ||
75 | open(my $conffile, '<', "$conf") | ||
76 | or warn "$P: Can't find a readable $configuration_file file $!\n"; | ||
77 | |||
78 | while (<$conffile>) { | ||
79 | my $line = $_; | ||
80 | |||
81 | $line =~ s/\s*\n?$//g; | ||
82 | $line =~ s/^\s*//g; | ||
83 | $line =~ s/\s+/ /g; | ||
84 | |||
85 | next if ($line =~ m/^\s*#/); | ||
86 | next if ($line =~ m/^\s*$/); | ||
87 | |||
88 | my @words = split(" ", $line); | ||
89 | foreach my $word (@words) { | ||
90 | last if ($word =~ m/^#/); | ||
91 | push (@conf_args, $word); | ||
92 | } | ||
93 | } | ||
94 | close($conffile); | ||
95 | unshift(@ARGV, @conf_args) if @conf_args; | ||
96 | } | ||
97 | |||
66 | GetOptions( | 98 | GetOptions( |
67 | 'q|quiet+' => \$quiet, | 99 | 'q|quiet+' => \$quiet, |
68 | 'tree!' => \$tree, | 100 | 'tree!' => \$tree, |
@@ -73,6 +105,8 @@ GetOptions( | |||
73 | 'f|file!' => \$file, | 105 | 'f|file!' => \$file, |
74 | 'subjective!' => \$check, | 106 | 'subjective!' => \$check, |
75 | 'strict!' => \$check, | 107 | 'strict!' => \$check, |
108 | 'ignore=s' => \@ignore, | ||
109 | 'show-types!' => \$show_types, | ||
76 | 'root=s' => \$root, | 110 | 'root=s' => \$root, |
77 | 'summary!' => \$summary, | 111 | 'summary!' => \$summary, |
78 | 'mailback!' => \$mailback, | 112 | 'mailback!' => \$mailback, |
@@ -93,6 +127,19 @@ if ($#ARGV < 0) { | |||
93 | exit(1); | 127 | exit(1); |
94 | } | 128 | } |
95 | 129 | ||
130 | @ignore = split(/,/, join(',',@ignore)); | ||
131 | foreach my $word (@ignore) { | ||
132 | $word =~ s/\s*\n?$//g; | ||
133 | $word =~ s/^\s*//g; | ||
134 | $word =~ s/\s+/ /g; | ||
135 | $word =~ tr/[a-z]/[A-Z]/; | ||
136 | |||
137 | next if ($word =~ m/^\s*#/); | ||
138 | next if ($word =~ m/^\s*$/); | ||
139 | |||
140 | $ignore_type{$word}++; | ||
141 | } | ||
142 | |||
96 | my $dbg_values = 0; | 143 | my $dbg_values = 0; |
97 | my $dbg_possible = 0; | 144 | my $dbg_possible = 0; |
98 | my $dbg_type = 0; | 145 | my $dbg_type = 0; |
@@ -145,7 +192,8 @@ our $Sparse = qr{ | |||
145 | __must_check| | 192 | __must_check| |
146 | __init_refok| | 193 | __init_refok| |
147 | __kprobes| | 194 | __kprobes| |
148 | __ref | 195 | __ref| |
196 | __rcu | ||
149 | }x; | 197 | }x; |
150 | 198 | ||
151 | # Notes to $Attribute: | 199 | # Notes to $Attribute: |
@@ -209,13 +257,23 @@ our $typeTypedefs = qr{(?x: | |||
209 | )}; | 257 | )}; |
210 | 258 | ||
211 | our $logFunctions = qr{(?x: | 259 | our $logFunctions = qr{(?x: |
212 | printk| | 260 | printk(?:_ratelimited|_once|)| |
213 | [a-z]+_(emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)| | 261 | [a-z0-9]+_(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)| |
214 | WARN| | 262 | WARN(?:_RATELIMIT|_ONCE|)| |
215 | panic| | 263 | panic| |
216 | MODULE_[A-Z_]+ | 264 | MODULE_[A-Z_]+ |
217 | )}; | 265 | )}; |
218 | 266 | ||
267 | our $signature_tags = qr{(?xi: | ||
268 | Signed-off-by:| | ||
269 | Acked-by:| | ||
270 | Tested-by:| | ||
271 | Reviewed-by:| | ||
272 | Reported-by:| | ||
273 | To:| | ||
274 | Cc: | ||
275 | )}; | ||
276 | |||
219 | our @typeList = ( | 277 | our @typeList = ( |
220 | qr{void}, | 278 | qr{void}, |
221 | qr{(?:unsigned\s+)?char}, | 279 | qr{(?:unsigned\s+)?char}, |
@@ -268,6 +326,20 @@ sub build_types { | |||
268 | } | 326 | } |
269 | build_types(); | 327 | build_types(); |
270 | 328 | ||
329 | our $match_balanced_parentheses = qr/(\((?:[^\(\)]+|(-1))*\))/; | ||
330 | |||
331 | our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*}; | ||
332 | our $LvalOrFunc = qr{($Lval)\s*($match_balanced_parentheses{0,1})\s*}; | ||
333 | |||
334 | sub deparenthesize { | ||
335 | my ($string) = @_; | ||
336 | return "" if (!defined($string)); | ||
337 | $string =~ s@^\s*\(\s*@@g; | ||
338 | $string =~ s@\s*\)\s*$@@g; | ||
339 | $string =~ s@\s+@ @g; | ||
340 | return $string; | ||
341 | } | ||
342 | |||
271 | $chk_signoff = 0 if ($file); | 343 | $chk_signoff = 0 if ($file); |
272 | 344 | ||
273 | my @dep_includes = (); | 345 | my @dep_includes = (); |
@@ -339,6 +411,88 @@ sub top_of_kernel_tree { | |||
339 | } | 411 | } |
340 | } | 412 | } |
341 | return 1; | 413 | return 1; |
414 | } | ||
415 | |||
416 | sub parse_email { | ||
417 | my ($formatted_email) = @_; | ||
418 | |||
419 | my $name = ""; | ||
420 | my $address = ""; | ||
421 | my $comment = ""; | ||
422 | |||
423 | if ($formatted_email =~ /^(.*)<(\S+\@\S+)>(.*)$/) { | ||
424 | $name = $1; | ||
425 | $address = $2; | ||
426 | $comment = $3 if defined $3; | ||
427 | } elsif ($formatted_email =~ /^\s*<(\S+\@\S+)>(.*)$/) { | ||
428 | $address = $1; | ||
429 | $comment = $2 if defined $2; | ||
430 | } elsif ($formatted_email =~ /(\S+\@\S+)(.*)$/) { | ||
431 | $address = $1; | ||
432 | $comment = $2 if defined $2; | ||
433 | $formatted_email =~ s/$address.*$//; | ||
434 | $name = $formatted_email; | ||
435 | $name =~ s/^\s+|\s+$//g; | ||
436 | $name =~ s/^\"|\"$//g; | ||
437 | # If there's a name left after stripping spaces and | ||
438 | # leading quotes, and the address doesn't have both | ||
439 | # leading and trailing angle brackets, the address | ||
440 | # is invalid. ie: | ||
441 | # "joe smith joe@smith.com" bad | ||
442 | # "joe smith <joe@smith.com" bad | ||
443 | if ($name ne "" && $address !~ /^<[^>]+>$/) { | ||
444 | $name = ""; | ||
445 | $address = ""; | ||
446 | $comment = ""; | ||
447 | } | ||
448 | } | ||
449 | |||
450 | $name =~ s/^\s+|\s+$//g; | ||
451 | $name =~ s/^\"|\"$//g; | ||
452 | $address =~ s/^\s+|\s+$//g; | ||
453 | $address =~ s/^\<|\>$//g; | ||
454 | |||
455 | if ($name =~ /[^\w \-]/i) { ##has "must quote" chars | ||
456 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes | ||
457 | $name = "\"$name\""; | ||
458 | } | ||
459 | |||
460 | return ($name, $address, $comment); | ||
461 | } | ||
462 | |||
463 | sub format_email { | ||
464 | my ($name, $address) = @_; | ||
465 | |||
466 | my $formatted_email; | ||
467 | |||
468 | $name =~ s/^\s+|\s+$//g; | ||
469 | $name =~ s/^\"|\"$//g; | ||
470 | $address =~ s/^\s+|\s+$//g; | ||
471 | |||
472 | if ($name =~ /[^\w \-]/i) { ##has "must quote" chars | ||
473 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes | ||
474 | $name = "\"$name\""; | ||
475 | } | ||
476 | |||
477 | if ("$name" eq "") { | ||
478 | $formatted_email = "$address"; | ||
479 | } else { | ||
480 | $formatted_email = "$name <$address>"; | ||
481 | } | ||
482 | |||
483 | return $formatted_email; | ||
484 | } | ||
485 | |||
486 | sub which_conf { | ||
487 | my ($conf) = @_; | ||
488 | |||
489 | foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) { | ||
490 | if (-e "$path/$conf") { | ||
491 | return "$path/$conf"; | ||
492 | } | ||
493 | } | ||
494 | |||
495 | return ""; | ||
342 | } | 496 | } |
343 | 497 | ||
344 | sub expand_tabs { | 498 | sub expand_tabs { |
@@ -1086,12 +1240,21 @@ sub possible { | |||
1086 | 1240 | ||
1087 | my $prefix = ''; | 1241 | my $prefix = ''; |
1088 | 1242 | ||
1243 | sub show_type { | ||
1244 | return !defined $ignore_type{$_[0]}; | ||
1245 | } | ||
1246 | |||
1089 | sub report { | 1247 | sub report { |
1090 | if (defined $tst_only && $_[0] !~ /\Q$tst_only\E/) { | 1248 | if (!show_type($_[1]) || |
1249 | (defined $tst_only && $_[2] !~ /\Q$tst_only\E/)) { | ||
1091 | return 0; | 1250 | return 0; |
1092 | } | 1251 | } |
1093 | my $line = $prefix . $_[0]; | 1252 | my $line; |
1094 | 1253 | if ($show_types) { | |
1254 | $line = "$prefix$_[0]:$_[1]: $_[2]\n"; | ||
1255 | } else { | ||
1256 | $line = "$prefix$_[0]: $_[2]\n"; | ||
1257 | } | ||
1095 | $line = (split('\n', $line))[0] . "\n" if ($terse); | 1258 | $line = (split('\n', $line))[0] . "\n" if ($terse); |
1096 | 1259 | ||
1097 | push(our @report, $line); | 1260 | push(our @report, $line); |
@@ -1101,20 +1264,21 @@ sub report { | |||
1101 | sub report_dump { | 1264 | sub report_dump { |
1102 | our @report; | 1265 | our @report; |
1103 | } | 1266 | } |
1267 | |||
1104 | sub ERROR { | 1268 | sub ERROR { |
1105 | if (report("ERROR: $_[0]\n")) { | 1269 | if (report("ERROR", $_[0], $_[1])) { |
1106 | our $clean = 0; | 1270 | our $clean = 0; |
1107 | our $cnt_error++; | 1271 | our $cnt_error++; |
1108 | } | 1272 | } |
1109 | } | 1273 | } |
1110 | sub WARN { | 1274 | sub WARN { |
1111 | if (report("WARNING: $_[0]\n")) { | 1275 | if (report("WARNING", $_[0], $_[1])) { |
1112 | our $clean = 0; | 1276 | our $clean = 0; |
1113 | our $cnt_warn++; | 1277 | our $cnt_warn++; |
1114 | } | 1278 | } |
1115 | } | 1279 | } |
1116 | sub CHK { | 1280 | sub CHK { |
1117 | if ($check && report("CHECK: $_[0]\n")) { | 1281 | if ($check && report("CHECK", $_[0], $_[1])) { |
1118 | our $clean = 0; | 1282 | our $clean = 0; |
1119 | our $cnt_chk++; | 1283 | our $cnt_chk++; |
1120 | } | 1284 | } |
@@ -1143,7 +1307,8 @@ sub check_absolute_file { | |||
1143 | 1307 | ||
1144 | ##print "prefix<$prefix>\n"; | 1308 | ##print "prefix<$prefix>\n"; |
1145 | if ($prefix ne ".../") { | 1309 | if ($prefix ne ".../") { |
1146 | WARN("use relative pathname instead of absolute in changelog text\n" . $herecurr); | 1310 | WARN("USE_RELATIVE_PATH", |
1311 | "use relative pathname instead of absolute in changelog text\n" . $herecurr); | ||
1147 | } | 1312 | } |
1148 | } | 1313 | } |
1149 | 1314 | ||
@@ -1340,11 +1505,13 @@ sub process { | |||
1340 | $p1_prefix = $1; | 1505 | $p1_prefix = $1; |
1341 | if (!$file && $tree && $p1_prefix ne '' && | 1506 | if (!$file && $tree && $p1_prefix ne '' && |
1342 | -e "$root/$p1_prefix") { | 1507 | -e "$root/$p1_prefix") { |
1343 | WARN("patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n"); | 1508 | WARN("PATCH_PREFIX", |
1509 | "patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n"); | ||
1344 | } | 1510 | } |
1345 | 1511 | ||
1346 | if ($realfile =~ m@^include/asm/@) { | 1512 | if ($realfile =~ m@^include/asm/@) { |
1347 | ERROR("do not modify files in include/asm, change architecture specific files in include/asm-<architecture>\n" . "$here$rawline\n"); | 1513 | ERROR("MODIFIED_INCLUDE_ASM", |
1514 | "do not modify files in include/asm, change architecture specific files in include/asm-<architecture>\n" . "$here$rawline\n"); | ||
1348 | } | 1515 | } |
1349 | next; | 1516 | next; |
1350 | } | 1517 | } |
@@ -1361,27 +1528,61 @@ sub process { | |||
1361 | if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) { | 1528 | if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) { |
1362 | my $permhere = $here . "FILE: $realfile\n"; | 1529 | my $permhere = $here . "FILE: $realfile\n"; |
1363 | if ($realfile =~ /(Makefile|Kconfig|\.c|\.h|\.S|\.tmpl)$/) { | 1530 | if ($realfile =~ /(Makefile|Kconfig|\.c|\.h|\.S|\.tmpl)$/) { |
1364 | ERROR("do not set execute permissions for source files\n" . $permhere); | 1531 | ERROR("EXECUTE_PERMISSIONS", |
1532 | "do not set execute permissions for source files\n" . $permhere); | ||
1365 | } | 1533 | } |
1366 | } | 1534 | } |
1367 | 1535 | ||
1368 | #check the patch for a signoff: | 1536 | # Check the patch for a signoff: |
1369 | if ($line =~ /^\s*signed-off-by:/i) { | 1537 | if ($line =~ /^\s*signed-off-by:/i) { |
1370 | # This is a signoff, if ugly, so do not double report. | ||
1371 | $signoff++; | 1538 | $signoff++; |
1372 | if (!($line =~ /^\s*Signed-off-by:/)) { | 1539 | } |
1373 | WARN("Signed-off-by: is the preferred form\n" . | 1540 | |
1374 | $herecurr); | 1541 | # Check signature styles |
1542 | if ($line =~ /^(\s*)($signature_tags)(\s*)(.*)/) { | ||
1543 | my $space_before = $1; | ||
1544 | my $sign_off = $2; | ||
1545 | my $space_after = $3; | ||
1546 | my $email = $4; | ||
1547 | my $ucfirst_sign_off = ucfirst(lc($sign_off)); | ||
1548 | |||
1549 | if (defined $space_before && $space_before ne "") { | ||
1550 | WARN("BAD_SIGN_OFF", | ||
1551 | "Do not use whitespace before $ucfirst_sign_off\n" . $herecurr); | ||
1375 | } | 1552 | } |
1376 | if ($line =~ /^\s*signed-off-by:\S/i) { | 1553 | if ($sign_off =~ /-by:$/i && $sign_off ne $ucfirst_sign_off) { |
1377 | WARN("space required after Signed-off-by:\n" . | 1554 | WARN("BAD_SIGN_OFF", |
1378 | $herecurr); | 1555 | "'$ucfirst_sign_off' is the preferred signature form\n" . $herecurr); |
1556 | } | ||
1557 | if (!defined $space_after || $space_after ne " ") { | ||
1558 | WARN("BAD_SIGN_OFF", | ||
1559 | "Use a single space after $ucfirst_sign_off\n" . $herecurr); | ||
1560 | } | ||
1561 | |||
1562 | my ($email_name, $email_address, $comment) = parse_email($email); | ||
1563 | my $suggested_email = format_email(($email_name, $email_address)); | ||
1564 | if ($suggested_email eq "") { | ||
1565 | ERROR("BAD_SIGN_OFF", | ||
1566 | "Unrecognized email address: '$email'\n" . $herecurr); | ||
1567 | } else { | ||
1568 | my $dequoted = $suggested_email; | ||
1569 | $dequoted =~ s/^"//; | ||
1570 | $dequoted =~ s/" </ </; | ||
1571 | # Don't force email to have quotes | ||
1572 | # Allow just an angle bracketed address | ||
1573 | if ("$dequoted$comment" ne $email && | ||
1574 | "<$email_address>$comment" ne $email && | ||
1575 | "$suggested_email$comment" ne $email) { | ||
1576 | WARN("BAD_SIGN_OFF", | ||
1577 | "email address '$email' might be better as '$suggested_email$comment'\n" . $herecurr); | ||
1578 | } | ||
1379 | } | 1579 | } |
1380 | } | 1580 | } |
1381 | 1581 | ||
1382 | # Check for wrappage within a valid hunk of the file | 1582 | # Check for wrappage within a valid hunk of the file |
1383 | if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) { | 1583 | if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) { |
1384 | ERROR("patch seems to be corrupt (line wrapped?)\n" . | 1584 | ERROR("CORRUPTED_PATCH", |
1585 | "patch seems to be corrupt (line wrapped?)\n" . | ||
1385 | $herecurr) if (!$emitted_corrupt++); | 1586 | $herecurr) if (!$emitted_corrupt++); |
1386 | } | 1587 | } |
1387 | 1588 | ||
@@ -1408,7 +1609,8 @@ sub process { | |||
1408 | my $ptr = substr($blank, 0, length($utf8_prefix)) . "^"; | 1609 | my $ptr = substr($blank, 0, length($utf8_prefix)) . "^"; |
1409 | my $hereptr = "$hereline$ptr\n"; | 1610 | my $hereptr = "$hereline$ptr\n"; |
1410 | 1611 | ||
1411 | ERROR("Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr); | 1612 | CHK("INVALID_UTF8", |
1613 | "Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr); | ||
1412 | } | 1614 | } |
1413 | 1615 | ||
1414 | # ignore non-hunk lines and lines being removed | 1616 | # ignore non-hunk lines and lines being removed |
@@ -1417,11 +1619,13 @@ sub process { | |||
1417 | #trailing whitespace | 1619 | #trailing whitespace |
1418 | if ($line =~ /^\+.*\015/) { | 1620 | if ($line =~ /^\+.*\015/) { |
1419 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; | 1621 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; |
1420 | ERROR("DOS line endings\n" . $herevet); | 1622 | ERROR("DOS_LINE_ENDINGS", |
1623 | "DOS line endings\n" . $herevet); | ||
1421 | 1624 | ||
1422 | } elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) { | 1625 | } elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) { |
1423 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; | 1626 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; |
1424 | ERROR("trailing whitespace\n" . $herevet); | 1627 | ERROR("TRAILING_WHITESPACE", |
1628 | "trailing whitespace\n" . $herevet); | ||
1425 | $rpt_cleaners = 1; | 1629 | $rpt_cleaners = 1; |
1426 | } | 1630 | } |
1427 | 1631 | ||
@@ -1452,7 +1656,8 @@ sub process { | |||
1452 | } | 1656 | } |
1453 | $length++; | 1657 | $length++; |
1454 | } | 1658 | } |
1455 | WARN("please write a paragraph that describes the config symbol fully\n" . $herecurr) if ($is_end && $length < 4); | 1659 | WARN("CONFIG_DESCRIPTION", |
1660 | "please write a paragraph that describes the config symbol fully\n" . $herecurr) if ($is_end && $length < 4); | ||
1456 | #print "is_end<$is_end> length<$length>\n"; | 1661 | #print "is_end<$is_end> length<$length>\n"; |
1457 | } | 1662 | } |
1458 | 1663 | ||
@@ -1466,28 +1671,33 @@ sub process { | |||
1466 | $line =~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) && | 1671 | $line =~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) && |
1467 | $length > 80) | 1672 | $length > 80) |
1468 | { | 1673 | { |
1469 | WARN("line over 80 characters\n" . $herecurr); | 1674 | WARN("LONG_LINE", |
1675 | "line over 80 characters\n" . $herecurr); | ||
1470 | } | 1676 | } |
1471 | 1677 | ||
1472 | # check for spaces before a quoted newline | 1678 | # check for spaces before a quoted newline |
1473 | if ($rawline =~ /^.*\".*\s\\n/) { | 1679 | if ($rawline =~ /^.*\".*\s\\n/) { |
1474 | WARN("unnecessary whitespace before a quoted newline\n" . $herecurr); | 1680 | WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE", |
1681 | "unnecessary whitespace before a quoted newline\n" . $herecurr); | ||
1475 | } | 1682 | } |
1476 | 1683 | ||
1477 | # check for adding lines without a newline. | 1684 | # check for adding lines without a newline. |
1478 | if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) { | 1685 | if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) { |
1479 | WARN("adding a line without newline at end of file\n" . $herecurr); | 1686 | WARN("MISSING_EOF_NEWLINE", |
1687 | "adding a line without newline at end of file\n" . $herecurr); | ||
1480 | } | 1688 | } |
1481 | 1689 | ||
1482 | # Blackfin: use hi/lo macros | 1690 | # Blackfin: use hi/lo macros |
1483 | if ($realfile =~ m@arch/blackfin/.*\.S$@) { | 1691 | if ($realfile =~ m@arch/blackfin/.*\.S$@) { |
1484 | if ($line =~ /\.[lL][[:space:]]*=.*&[[:space:]]*0x[fF][fF][fF][fF]/) { | 1692 | if ($line =~ /\.[lL][[:space:]]*=.*&[[:space:]]*0x[fF][fF][fF][fF]/) { |
1485 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | 1693 | my $herevet = "$here\n" . cat_vet($line) . "\n"; |
1486 | ERROR("use the LO() macro, not (... & 0xFFFF)\n" . $herevet); | 1694 | ERROR("LO_MACRO", |
1695 | "use the LO() macro, not (... & 0xFFFF)\n" . $herevet); | ||
1487 | } | 1696 | } |
1488 | if ($line =~ /\.[hH][[:space:]]*=.*>>[[:space:]]*16/) { | 1697 | if ($line =~ /\.[hH][[:space:]]*=.*>>[[:space:]]*16/) { |
1489 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | 1698 | my $herevet = "$here\n" . cat_vet($line) . "\n"; |
1490 | ERROR("use the HI() macro, not (... >> 16)\n" . $herevet); | 1699 | ERROR("HI_MACRO", |
1700 | "use the HI() macro, not (... >> 16)\n" . $herevet); | ||
1491 | } | 1701 | } |
1492 | } | 1702 | } |
1493 | 1703 | ||
@@ -1499,14 +1709,16 @@ sub process { | |||
1499 | if ($rawline =~ /^\+\s* \t\s*\S/ || | 1709 | if ($rawline =~ /^\+\s* \t\s*\S/ || |
1500 | $rawline =~ /^\+\s* \s*/) { | 1710 | $rawline =~ /^\+\s* \s*/) { |
1501 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; | 1711 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; |
1502 | ERROR("code indent should use tabs where possible\n" . $herevet); | 1712 | ERROR("CODE_INDENT", |
1713 | "code indent should use tabs where possible\n" . $herevet); | ||
1503 | $rpt_cleaners = 1; | 1714 | $rpt_cleaners = 1; |
1504 | } | 1715 | } |
1505 | 1716 | ||
1506 | # check for space before tabs. | 1717 | # check for space before tabs. |
1507 | if ($rawline =~ /^\+/ && $rawline =~ / \t/) { | 1718 | if ($rawline =~ /^\+/ && $rawline =~ / \t/) { |
1508 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; | 1719 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; |
1509 | WARN("please, no space before tabs\n" . $herevet); | 1720 | WARN("SPACE_BEFORE_TAB", |
1721 | "please, no space before tabs\n" . $herevet); | ||
1510 | } | 1722 | } |
1511 | 1723 | ||
1512 | # check for spaces at the beginning of a line. | 1724 | # check for spaces at the beginning of a line. |
@@ -1516,7 +1728,8 @@ sub process { | |||
1516 | # 3) hanging labels | 1728 | # 3) hanging labels |
1517 | if ($rawline =~ /^\+ / && $line !~ /\+ *(?:$;|#|$Ident:)/) { | 1729 | if ($rawline =~ /^\+ / && $line !~ /\+ *(?:$;|#|$Ident:)/) { |
1518 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; | 1730 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; |
1519 | WARN("please, no spaces at the start of a line\n" . $herevet); | 1731 | WARN("LEADING_SPACE", |
1732 | "please, no spaces at the start of a line\n" . $herevet); | ||
1520 | } | 1733 | } |
1521 | 1734 | ||
1522 | # check we are in a valid C source file if not then ignore this hunk | 1735 | # check we are in a valid C source file if not then ignore this hunk |
@@ -1524,17 +1737,20 @@ sub process { | |||
1524 | 1737 | ||
1525 | # check for RCS/CVS revision markers | 1738 | # check for RCS/CVS revision markers |
1526 | if ($rawline =~ /^\+.*\$(Revision|Log|Id)(?:\$|)/) { | 1739 | if ($rawline =~ /^\+.*\$(Revision|Log|Id)(?:\$|)/) { |
1527 | WARN("CVS style keyword markers, these will _not_ be updated\n". $herecurr); | 1740 | WARN("CVS_KEYWORD", |
1741 | "CVS style keyword markers, these will _not_ be updated\n". $herecurr); | ||
1528 | } | 1742 | } |
1529 | 1743 | ||
1530 | # Blackfin: don't use __builtin_bfin_[cs]sync | 1744 | # Blackfin: don't use __builtin_bfin_[cs]sync |
1531 | if ($line =~ /__builtin_bfin_csync/) { | 1745 | if ($line =~ /__builtin_bfin_csync/) { |
1532 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | 1746 | my $herevet = "$here\n" . cat_vet($line) . "\n"; |
1533 | ERROR("use the CSYNC() macro in asm/blackfin.h\n" . $herevet); | 1747 | ERROR("CSYNC", |
1748 | "use the CSYNC() macro in asm/blackfin.h\n" . $herevet); | ||
1534 | } | 1749 | } |
1535 | if ($line =~ /__builtin_bfin_ssync/) { | 1750 | if ($line =~ /__builtin_bfin_ssync/) { |
1536 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | 1751 | my $herevet = "$here\n" . cat_vet($line) . "\n"; |
1537 | ERROR("use the SSYNC() macro in asm/blackfin.h\n" . $herevet); | 1752 | ERROR("SSYNC", |
1753 | "use the SSYNC() macro in asm/blackfin.h\n" . $herevet); | ||
1538 | } | 1754 | } |
1539 | 1755 | ||
1540 | # Check for potential 'bare' types | 1756 | # Check for potential 'bare' types |
@@ -1623,7 +1839,8 @@ sub process { | |||
1623 | } | 1839 | } |
1624 | } | 1840 | } |
1625 | if ($err ne '') { | 1841 | if ($err ne '') { |
1626 | ERROR("switch and case should be at the same indent\n$hereline$err"); | 1842 | ERROR("SWITCH_CASE_INDENT_LEVEL", |
1843 | "switch and case should be at the same indent\n$hereline$err"); | ||
1627 | } | 1844 | } |
1628 | } | 1845 | } |
1629 | 1846 | ||
@@ -1651,7 +1868,8 @@ sub process { | |||
1651 | #print "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]>\n"; | 1868 | #print "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]>\n"; |
1652 | 1869 | ||
1653 | if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln -1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) { | 1870 | if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln -1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) { |
1654 | ERROR("that open brace { should be on the previous line\n" . | 1871 | ERROR("OPEN_BRACE", |
1872 | "that open brace { should be on the previous line\n" . | ||
1655 | "$here\n$ctx\n$rawlines[$ctx_ln - 1]\n"); | 1873 | "$here\n$ctx\n$rawlines[$ctx_ln - 1]\n"); |
1656 | } | 1874 | } |
1657 | if ($level == 0 && $pre_ctx !~ /}\s*while\s*\($/ && | 1875 | if ($level == 0 && $pre_ctx !~ /}\s*while\s*\($/ && |
@@ -1660,7 +1878,8 @@ sub process { | |||
1660 | { | 1878 | { |
1661 | my ($nlength, $nindent) = line_stats($lines[$ctx_ln - 1]); | 1879 | my ($nlength, $nindent) = line_stats($lines[$ctx_ln - 1]); |
1662 | if ($nindent > $indent) { | 1880 | if ($nindent > $indent) { |
1663 | WARN("trailing semicolon indicates no statements, indent implies otherwise\n" . | 1881 | WARN("TRAILING_SEMICOLON", |
1882 | "trailing semicolon indicates no statements, indent implies otherwise\n" . | ||
1664 | "$here\n$ctx\n$rawlines[$ctx_ln - 1]\n"); | 1883 | "$here\n$ctx\n$rawlines[$ctx_ln - 1]\n"); |
1665 | } | 1884 | } |
1666 | } | 1885 | } |
@@ -1748,7 +1967,8 @@ sub process { | |||
1748 | 1967 | ||
1749 | if ($check && (($sindent % 8) != 0 || | 1968 | if ($check && (($sindent % 8) != 0 || |
1750 | ($sindent <= $indent && $s ne ''))) { | 1969 | ($sindent <= $indent && $s ne ''))) { |
1751 | WARN("suspect code indent for conditional statements ($indent, $sindent)\n" . $herecurr . "$stat_real\n"); | 1970 | WARN("SUSPECT_CODE_INDENT", |
1971 | "suspect code indent for conditional statements ($indent, $sindent)\n" . $herecurr . "$stat_real\n"); | ||
1752 | } | 1972 | } |
1753 | } | 1973 | } |
1754 | 1974 | ||
@@ -1771,18 +1991,22 @@ sub process { | |||
1771 | # TEST: allow direct testing of the type matcher. | 1991 | # TEST: allow direct testing of the type matcher. |
1772 | if ($dbg_type) { | 1992 | if ($dbg_type) { |
1773 | if ($line =~ /^.\s*$Declare\s*$/) { | 1993 | if ($line =~ /^.\s*$Declare\s*$/) { |
1774 | ERROR("TEST: is type\n" . $herecurr); | 1994 | ERROR("TEST_TYPE", |
1995 | "TEST: is type\n" . $herecurr); | ||
1775 | } elsif ($dbg_type > 1 && $line =~ /^.+($Declare)/) { | 1996 | } elsif ($dbg_type > 1 && $line =~ /^.+($Declare)/) { |
1776 | ERROR("TEST: is not type ($1 is)\n". $herecurr); | 1997 | ERROR("TEST_NOT_TYPE", |
1998 | "TEST: is not type ($1 is)\n". $herecurr); | ||
1777 | } | 1999 | } |
1778 | next; | 2000 | next; |
1779 | } | 2001 | } |
1780 | # TEST: allow direct testing of the attribute matcher. | 2002 | # TEST: allow direct testing of the attribute matcher. |
1781 | if ($dbg_attr) { | 2003 | if ($dbg_attr) { |
1782 | if ($line =~ /^.\s*$Modifier\s*$/) { | 2004 | if ($line =~ /^.\s*$Modifier\s*$/) { |
1783 | ERROR("TEST: is attr\n" . $herecurr); | 2005 | ERROR("TEST_ATTR", |
2006 | "TEST: is attr\n" . $herecurr); | ||
1784 | } elsif ($dbg_attr > 1 && $line =~ /^.+($Modifier)/) { | 2007 | } elsif ($dbg_attr > 1 && $line =~ /^.+($Modifier)/) { |
1785 | ERROR("TEST: is not attr ($1 is)\n". $herecurr); | 2008 | ERROR("TEST_NOT_ATTR", |
2009 | "TEST: is not attr ($1 is)\n". $herecurr); | ||
1786 | } | 2010 | } |
1787 | next; | 2011 | next; |
1788 | } | 2012 | } |
@@ -1790,7 +2014,8 @@ sub process { | |||
1790 | # check for initialisation to aggregates open brace on the next line | 2014 | # check for initialisation to aggregates open brace on the next line |
1791 | if ($line =~ /^.\s*{/ && | 2015 | if ($line =~ /^.\s*{/ && |
1792 | $prevline =~ /(?:^|[^=])=\s*$/) { | 2016 | $prevline =~ /(?:^|[^=])=\s*$/) { |
1793 | ERROR("that open brace { should be on the previous line\n" . $hereprev); | 2017 | ERROR("OPEN_BRACE", |
2018 | "that open brace { should be on the previous line\n" . $hereprev); | ||
1794 | } | 2019 | } |
1795 | 2020 | ||
1796 | # | 2021 | # |
@@ -1801,14 +2026,16 @@ sub process { | |||
1801 | if ($rawline =~ m{^.\s*\#\s*include\s+[<"](.*)[">]}) { | 2026 | if ($rawline =~ m{^.\s*\#\s*include\s+[<"](.*)[">]}) { |
1802 | my $path = $1; | 2027 | my $path = $1; |
1803 | if ($path =~ m{//}) { | 2028 | if ($path =~ m{//}) { |
1804 | ERROR("malformed #include filename\n" . | 2029 | ERROR("MALFORMED_INCLUDE", |
2030 | "malformed #include filename\n" . | ||
1805 | $herecurr); | 2031 | $herecurr); |
1806 | } | 2032 | } |
1807 | } | 2033 | } |
1808 | 2034 | ||
1809 | # no C99 // comments | 2035 | # no C99 // comments |
1810 | if ($line =~ m{//}) { | 2036 | if ($line =~ m{//}) { |
1811 | ERROR("do not use C99 // comments\n" . $herecurr); | 2037 | ERROR("C99_COMMENTS", |
2038 | "do not use C99 // comments\n" . $herecurr); | ||
1812 | } | 2039 | } |
1813 | # Remove C99 comments. | 2040 | # Remove C99 comments. |
1814 | $line =~ s@//.*@@; | 2041 | $line =~ s@//.*@@; |
@@ -1855,35 +2082,41 @@ sub process { | |||
1855 | } | 2082 | } |
1856 | if (defined $suppress_export{$linenr} && | 2083 | if (defined $suppress_export{$linenr} && |
1857 | $suppress_export{$linenr} == 2) { | 2084 | $suppress_export{$linenr} == 2) { |
1858 | WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); | 2085 | WARN("EXPORT_SYMBOL", |
2086 | "EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); | ||
1859 | } | 2087 | } |
1860 | 2088 | ||
1861 | # check for global initialisers. | 2089 | # check for global initialisers. |
1862 | if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) { | 2090 | if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) { |
1863 | ERROR("do not initialise globals to 0 or NULL\n" . | 2091 | ERROR("GLOBAL_INITIALISERS", |
2092 | "do not initialise globals to 0 or NULL\n" . | ||
1864 | $herecurr); | 2093 | $herecurr); |
1865 | } | 2094 | } |
1866 | # check for static initialisers. | 2095 | # check for static initialisers. |
1867 | if ($line =~ /\bstatic\s.*=\s*(0|NULL|false)\s*;/) { | 2096 | if ($line =~ /\bstatic\s.*=\s*(0|NULL|false)\s*;/) { |
1868 | ERROR("do not initialise statics to 0 or NULL\n" . | 2097 | ERROR("INITIALISED_STATIC", |
2098 | "do not initialise statics to 0 or NULL\n" . | ||
1869 | $herecurr); | 2099 | $herecurr); |
1870 | } | 2100 | } |
1871 | 2101 | ||
1872 | # check for static const char * arrays. | 2102 | # check for static const char * arrays. |
1873 | if ($line =~ /\bstatic\s+const\s+char\s*\*\s*(\w+)\s*\[\s*\]\s*=\s*/) { | 2103 | if ($line =~ /\bstatic\s+const\s+char\s*\*\s*(\w+)\s*\[\s*\]\s*=\s*/) { |
1874 | WARN("static const char * array should probably be static const char * const\n" . | 2104 | WARN("STATIC_CONST_CHAR_ARRAY", |
2105 | "static const char * array should probably be static const char * const\n" . | ||
1875 | $herecurr); | 2106 | $herecurr); |
1876 | } | 2107 | } |
1877 | 2108 | ||
1878 | # check for static char foo[] = "bar" declarations. | 2109 | # check for static char foo[] = "bar" declarations. |
1879 | if ($line =~ /\bstatic\s+char\s+(\w+)\s*\[\s*\]\s*=\s*"/) { | 2110 | if ($line =~ /\bstatic\s+char\s+(\w+)\s*\[\s*\]\s*=\s*"/) { |
1880 | WARN("static char array declaration should probably be static const char\n" . | 2111 | WARN("STATIC_CONST_CHAR_ARRAY", |
2112 | "static char array declaration should probably be static const char\n" . | ||
1881 | $herecurr); | 2113 | $herecurr); |
1882 | } | 2114 | } |
1883 | 2115 | ||
1884 | # check for declarations of struct pci_device_id | 2116 | # check for declarations of struct pci_device_id |
1885 | if ($line =~ /\bstruct\s+pci_device_id\s+\w+\s*\[\s*\]\s*\=\s*\{/) { | 2117 | if ($line =~ /\bstruct\s+pci_device_id\s+\w+\s*\[\s*\]\s*\=\s*\{/) { |
1886 | WARN("Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id\n" . $herecurr); | 2118 | WARN("DEFINE_PCI_DEVICE_TABLE", |
2119 | "Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id\n" . $herecurr); | ||
1887 | } | 2120 | } |
1888 | 2121 | ||
1889 | # check for new typedefs, only function parameters and sparse annotations | 2122 | # check for new typedefs, only function parameters and sparse annotations |
@@ -1893,7 +2126,8 @@ sub process { | |||
1893 | $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ && | 2126 | $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ && |
1894 | $line !~ /\b$typeTypedefs\b/ && | 2127 | $line !~ /\b$typeTypedefs\b/ && |
1895 | $line !~ /\b__bitwise(?:__|)\b/) { | 2128 | $line !~ /\b__bitwise(?:__|)\b/) { |
1896 | WARN("do not add new typedefs\n" . $herecurr); | 2129 | WARN("NEW_TYPEDEFS", |
2130 | "do not add new typedefs\n" . $herecurr); | ||
1897 | } | 2131 | } |
1898 | 2132 | ||
1899 | # * goes on variable not on type | 2133 | # * goes on variable not on type |
@@ -1911,7 +2145,8 @@ sub process { | |||
1911 | 2145 | ||
1912 | #print "from<$from> to<$to>\n"; | 2146 | #print "from<$from> to<$to>\n"; |
1913 | if ($from ne $to) { | 2147 | if ($from ne $to) { |
1914 | ERROR("\"(foo$from)\" should be \"(foo$to)\"\n" . $herecurr); | 2148 | ERROR("POINTER_LOCATION", |
2149 | "\"(foo$from)\" should be \"(foo$to)\"\n" . $herecurr); | ||
1915 | } | 2150 | } |
1916 | } elsif ($line =~ m{\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident)}) { | 2151 | } elsif ($line =~ m{\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident)}) { |
1917 | my ($from, $to, $ident) = ($1, $1, $2); | 2152 | my ($from, $to, $ident) = ($1, $1, $2); |
@@ -1928,7 +2163,8 @@ sub process { | |||
1928 | 2163 | ||
1929 | #print "from<$from> to<$to> ident<$ident>\n"; | 2164 | #print "from<$from> to<$to> ident<$ident>\n"; |
1930 | if ($from ne $to && $ident !~ /^$Modifier$/) { | 2165 | if ($from ne $to && $ident !~ /^$Modifier$/) { |
1931 | ERROR("\"foo${from}bar\" should be \"foo${to}bar\"\n" . $herecurr); | 2166 | ERROR("POINTER_LOCATION", |
2167 | "\"foo${from}bar\" should be \"foo${to}bar\"\n" . $herecurr); | ||
1932 | } | 2168 | } |
1933 | } | 2169 | } |
1934 | 2170 | ||
@@ -1940,12 +2176,14 @@ sub process { | |||
1940 | # } | 2176 | # } |
1941 | 2177 | ||
1942 | if ($line =~ /\bLINUX_VERSION_CODE\b/) { | 2178 | if ($line =~ /\bLINUX_VERSION_CODE\b/) { |
1943 | WARN("LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged\n" . $herecurr); | 2179 | WARN("LINUX_VERSION_CODE", |
2180 | "LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged\n" . $herecurr); | ||
1944 | } | 2181 | } |
1945 | 2182 | ||
1946 | # check for uses of printk_ratelimit | 2183 | # check for uses of printk_ratelimit |
1947 | if ($line =~ /\bprintk_ratelimit\s*\(/) { | 2184 | if ($line =~ /\bprintk_ratelimit\s*\(/) { |
1948 | WARN("Prefer printk_ratelimited or pr_<level>_ratelimited to printk_ratelimit\n" . $herecurr); | 2185 | WARN("PRINTK_RATELIMITED", |
2186 | "Prefer printk_ratelimited or pr_<level>_ratelimited to printk_ratelimit\n" . $herecurr); | ||
1949 | } | 2187 | } |
1950 | 2188 | ||
1951 | # printk should use KERN_* levels. Note that follow on printk's on the | 2189 | # printk should use KERN_* levels. Note that follow on printk's on the |
@@ -1967,7 +2205,8 @@ sub process { | |||
1967 | } | 2205 | } |
1968 | } | 2206 | } |
1969 | if ($ok == 0) { | 2207 | if ($ok == 0) { |
1970 | WARN("printk() should include KERN_ facility level\n" . $herecurr); | 2208 | WARN("PRINTK_WITHOUT_KERN_LEVEL", |
2209 | "printk() should include KERN_ facility level\n" . $herecurr); | ||
1971 | } | 2210 | } |
1972 | } | 2211 | } |
1973 | 2212 | ||
@@ -1975,18 +2214,21 @@ sub process { | |||
1975 | # or if closed on same line | 2214 | # or if closed on same line |
1976 | if (($line=~/$Type\s*$Ident\(.*\).*\s{/) and | 2215 | if (($line=~/$Type\s*$Ident\(.*\).*\s{/) and |
1977 | !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) { | 2216 | !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) { |
1978 | ERROR("open brace '{' following function declarations go on the next line\n" . $herecurr); | 2217 | ERROR("OPEN_BRACE", |
2218 | "open brace '{' following function declarations go on the next line\n" . $herecurr); | ||
1979 | } | 2219 | } |
1980 | 2220 | ||
1981 | # open braces for enum, union and struct go on the same line. | 2221 | # open braces for enum, union and struct go on the same line. |
1982 | if ($line =~ /^.\s*{/ && | 2222 | if ($line =~ /^.\s*{/ && |
1983 | $prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) { | 2223 | $prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) { |
1984 | ERROR("open brace '{' following $1 go on the same line\n" . $hereprev); | 2224 | ERROR("OPEN_BRACE", |
2225 | "open brace '{' following $1 go on the same line\n" . $hereprev); | ||
1985 | } | 2226 | } |
1986 | 2227 | ||
1987 | # missing space after union, struct or enum definition | 2228 | # missing space after union, struct or enum definition |
1988 | if ($line =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?(?:\s+$Ident)?[=\{]/) { | 2229 | if ($line =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?(?:\s+$Ident)?[=\{]/) { |
1989 | WARN("missing space after $1 definition\n" . $herecurr); | 2230 | WARN("SPACING", |
2231 | "missing space after $1 definition\n" . $herecurr); | ||
1990 | } | 2232 | } |
1991 | 2233 | ||
1992 | # check for spacing round square brackets; allowed: | 2234 | # check for spacing round square brackets; allowed: |
@@ -1998,7 +2240,8 @@ sub process { | |||
1998 | if ($prefix !~ /$Type\s+$/ && | 2240 | if ($prefix !~ /$Type\s+$/ && |
1999 | ($where != 0 || $prefix !~ /^.\s+$/) && | 2241 | ($where != 0 || $prefix !~ /^.\s+$/) && |
2000 | $prefix !~ /{\s+$/) { | 2242 | $prefix !~ /{\s+$/) { |
2001 | ERROR("space prohibited before open square bracket '['\n" . $herecurr); | 2243 | ERROR("BRACKET_SPACE", |
2244 | "space prohibited before open square bracket '['\n" . $herecurr); | ||
2002 | } | 2245 | } |
2003 | } | 2246 | } |
2004 | 2247 | ||
@@ -2029,7 +2272,8 @@ sub process { | |||
2029 | } elsif ($ctx =~ /$Type$/) { | 2272 | } elsif ($ctx =~ /$Type$/) { |
2030 | 2273 | ||
2031 | } else { | 2274 | } else { |
2032 | WARN("space prohibited between function name and open parenthesis '('\n" . $herecurr); | 2275 | WARN("SPACING", |
2276 | "space prohibited between function name and open parenthesis '('\n" . $herecurr); | ||
2033 | } | 2277 | } |
2034 | } | 2278 | } |
2035 | # Check operator spacing. | 2279 | # Check operator spacing. |
@@ -2103,7 +2347,8 @@ sub process { | |||
2103 | } elsif ($op eq ';') { | 2347 | } elsif ($op eq ';') { |
2104 | if ($ctx !~ /.x[WEBC]/ && | 2348 | if ($ctx !~ /.x[WEBC]/ && |
2105 | $cc !~ /^\\/ && $cc !~ /^;/) { | 2349 | $cc !~ /^\\/ && $cc !~ /^;/) { |
2106 | ERROR("space required after that '$op' $at\n" . $hereptr); | 2350 | ERROR("SPACING", |
2351 | "space required after that '$op' $at\n" . $hereptr); | ||
2107 | } | 2352 | } |
2108 | 2353 | ||
2109 | # // is a comment | 2354 | # // is a comment |
@@ -2114,13 +2359,15 @@ sub process { | |||
2114 | # : when part of a bitfield | 2359 | # : when part of a bitfield |
2115 | } elsif ($op eq '->' || $opv eq ':B') { | 2360 | } elsif ($op eq '->' || $opv eq ':B') { |
2116 | if ($ctx =~ /Wx.|.xW/) { | 2361 | if ($ctx =~ /Wx.|.xW/) { |
2117 | ERROR("spaces prohibited around that '$op' $at\n" . $hereptr); | 2362 | ERROR("SPACING", |
2363 | "spaces prohibited around that '$op' $at\n" . $hereptr); | ||
2118 | } | 2364 | } |
2119 | 2365 | ||
2120 | # , must have a space on the right. | 2366 | # , must have a space on the right. |
2121 | } elsif ($op eq ',') { | 2367 | } elsif ($op eq ',') { |
2122 | if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) { | 2368 | if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) { |
2123 | ERROR("space required after that '$op' $at\n" . $hereptr); | 2369 | ERROR("SPACING", |
2370 | "space required after that '$op' $at\n" . $hereptr); | ||
2124 | } | 2371 | } |
2125 | 2372 | ||
2126 | # '*' as part of a type definition -- reported already. | 2373 | # '*' as part of a type definition -- reported already. |
@@ -2134,26 +2381,31 @@ sub process { | |||
2134 | $opv eq '*U' || $opv eq '-U' || | 2381 | $opv eq '*U' || $opv eq '-U' || |
2135 | $opv eq '&U' || $opv eq '&&U') { | 2382 | $opv eq '&U' || $opv eq '&&U') { |
2136 | if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) { | 2383 | if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) { |
2137 | ERROR("space required before that '$op' $at\n" . $hereptr); | 2384 | ERROR("SPACING", |
2385 | "space required before that '$op' $at\n" . $hereptr); | ||
2138 | } | 2386 | } |
2139 | if ($op eq '*' && $cc =~/\s*$Modifier\b/) { | 2387 | if ($op eq '*' && $cc =~/\s*$Modifier\b/) { |
2140 | # A unary '*' may be const | 2388 | # A unary '*' may be const |
2141 | 2389 | ||
2142 | } elsif ($ctx =~ /.xW/) { | 2390 | } elsif ($ctx =~ /.xW/) { |
2143 | ERROR("space prohibited after that '$op' $at\n" . $hereptr); | 2391 | ERROR("SPACING", |
2392 | "space prohibited after that '$op' $at\n" . $hereptr); | ||
2144 | } | 2393 | } |
2145 | 2394 | ||
2146 | # unary ++ and unary -- are allowed no space on one side. | 2395 | # unary ++ and unary -- are allowed no space on one side. |
2147 | } elsif ($op eq '++' or $op eq '--') { | 2396 | } elsif ($op eq '++' or $op eq '--') { |
2148 | if ($ctx !~ /[WEOBC]x[^W]/ && $ctx !~ /[^W]x[WOBEC]/) { | 2397 | if ($ctx !~ /[WEOBC]x[^W]/ && $ctx !~ /[^W]x[WOBEC]/) { |
2149 | ERROR("space required one side of that '$op' $at\n" . $hereptr); | 2398 | ERROR("SPACING", |
2399 | "space required one side of that '$op' $at\n" . $hereptr); | ||
2150 | } | 2400 | } |
2151 | if ($ctx =~ /Wx[BE]/ || | 2401 | if ($ctx =~ /Wx[BE]/ || |
2152 | ($ctx =~ /Wx./ && $cc =~ /^;/)) { | 2402 | ($ctx =~ /Wx./ && $cc =~ /^;/)) { |
2153 | ERROR("space prohibited before that '$op' $at\n" . $hereptr); | 2403 | ERROR("SPACING", |
2404 | "space prohibited before that '$op' $at\n" . $hereptr); | ||
2154 | } | 2405 | } |
2155 | if ($ctx =~ /ExW/) { | 2406 | if ($ctx =~ /ExW/) { |
2156 | ERROR("space prohibited after that '$op' $at\n" . $hereptr); | 2407 | ERROR("SPACING", |
2408 | "space prohibited after that '$op' $at\n" . $hereptr); | ||
2157 | } | 2409 | } |
2158 | 2410 | ||
2159 | 2411 | ||
@@ -2165,7 +2417,8 @@ sub process { | |||
2165 | $op eq '%') | 2417 | $op eq '%') |
2166 | { | 2418 | { |
2167 | if ($ctx =~ /Wx[^WCE]|[^WCE]xW/) { | 2419 | if ($ctx =~ /Wx[^WCE]|[^WCE]xW/) { |
2168 | ERROR("need consistent spacing around '$op' $at\n" . | 2420 | ERROR("SPACING", |
2421 | "need consistent spacing around '$op' $at\n" . | ||
2169 | $hereptr); | 2422 | $hereptr); |
2170 | } | 2423 | } |
2171 | 2424 | ||
@@ -2173,7 +2426,8 @@ sub process { | |||
2173 | # terminating a case value or a label. | 2426 | # terminating a case value or a label. |
2174 | } elsif ($opv eq ':C' || $opv eq ':L') { | 2427 | } elsif ($opv eq ':C' || $opv eq ':L') { |
2175 | if ($ctx =~ /Wx./) { | 2428 | if ($ctx =~ /Wx./) { |
2176 | ERROR("space prohibited before that '$op' $at\n" . $hereptr); | 2429 | ERROR("SPACING", |
2430 | "space prohibited before that '$op' $at\n" . $hereptr); | ||
2177 | } | 2431 | } |
2178 | 2432 | ||
2179 | # All the others need spaces both sides. | 2433 | # All the others need spaces both sides. |
@@ -2196,7 +2450,8 @@ sub process { | |||
2196 | } | 2450 | } |
2197 | 2451 | ||
2198 | if ($ok == 0) { | 2452 | if ($ok == 0) { |
2199 | ERROR("spaces required around that '$op' $at\n" . $hereptr); | 2453 | ERROR("SPACING", |
2454 | "spaces required around that '$op' $at\n" . $hereptr); | ||
2200 | } | 2455 | } |
2201 | } | 2456 | } |
2202 | $off += length($elements[$n + 1]); | 2457 | $off += length($elements[$n + 1]); |
@@ -2205,7 +2460,8 @@ sub process { | |||
2205 | 2460 | ||
2206 | # check for multiple assignments | 2461 | # check for multiple assignments |
2207 | if ($line =~ /^.\s*$Lval\s*=\s*$Lval\s*=(?!=)/) { | 2462 | if ($line =~ /^.\s*$Lval\s*=\s*$Lval\s*=(?!=)/) { |
2208 | CHK("multiple assignments should be avoided\n" . $herecurr); | 2463 | CHK("MULTIPLE_ASSIGNMENTS", |
2464 | "multiple assignments should be avoided\n" . $herecurr); | ||
2209 | } | 2465 | } |
2210 | 2466 | ||
2211 | ## # check for multiple declarations, allowing for a function declaration | 2467 | ## # check for multiple declarations, allowing for a function declaration |
@@ -2219,45 +2475,53 @@ sub process { | |||
2219 | ## while ($ln =~ s/\([^\(\)]*\)//g) { | 2475 | ## while ($ln =~ s/\([^\(\)]*\)//g) { |
2220 | ## } | 2476 | ## } |
2221 | ## if ($ln =~ /,/) { | 2477 | ## if ($ln =~ /,/) { |
2222 | ## WARN("declaring multiple variables together should be avoided\n" . $herecurr); | 2478 | ## WARN("MULTIPLE_DECLARATION", |
2479 | ## "declaring multiple variables together should be avoided\n" . $herecurr); | ||
2223 | ## } | 2480 | ## } |
2224 | ## } | 2481 | ## } |
2225 | 2482 | ||
2226 | #need space before brace following if, while, etc | 2483 | #need space before brace following if, while, etc |
2227 | if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) || | 2484 | if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) || |
2228 | $line =~ /do{/) { | 2485 | $line =~ /do{/) { |
2229 | ERROR("space required before the open brace '{'\n" . $herecurr); | 2486 | ERROR("SPACING", |
2487 | "space required before the open brace '{'\n" . $herecurr); | ||
2230 | } | 2488 | } |
2231 | 2489 | ||
2232 | # closing brace should have a space following it when it has anything | 2490 | # closing brace should have a space following it when it has anything |
2233 | # on the line | 2491 | # on the line |
2234 | if ($line =~ /}(?!(?:,|;|\)))\S/) { | 2492 | if ($line =~ /}(?!(?:,|;|\)))\S/) { |
2235 | ERROR("space required after that close brace '}'\n" . $herecurr); | 2493 | ERROR("SPACING", |
2494 | "space required after that close brace '}'\n" . $herecurr); | ||
2236 | } | 2495 | } |
2237 | 2496 | ||
2238 | # check spacing on square brackets | 2497 | # check spacing on square brackets |
2239 | if ($line =~ /\[\s/ && $line !~ /\[\s*$/) { | 2498 | if ($line =~ /\[\s/ && $line !~ /\[\s*$/) { |
2240 | ERROR("space prohibited after that open square bracket '['\n" . $herecurr); | 2499 | ERROR("SPACING", |
2500 | "space prohibited after that open square bracket '['\n" . $herecurr); | ||
2241 | } | 2501 | } |
2242 | if ($line =~ /\s\]/) { | 2502 | if ($line =~ /\s\]/) { |
2243 | ERROR("space prohibited before that close square bracket ']'\n" . $herecurr); | 2503 | ERROR("SPACING", |
2504 | "space prohibited before that close square bracket ']'\n" . $herecurr); | ||
2244 | } | 2505 | } |
2245 | 2506 | ||
2246 | # check spacing on parentheses | 2507 | # check spacing on parentheses |
2247 | if ($line =~ /\(\s/ && $line !~ /\(\s*(?:\\)?$/ && | 2508 | if ($line =~ /\(\s/ && $line !~ /\(\s*(?:\\)?$/ && |
2248 | $line !~ /for\s*\(\s+;/) { | 2509 | $line !~ /for\s*\(\s+;/) { |
2249 | ERROR("space prohibited after that open parenthesis '('\n" . $herecurr); | 2510 | ERROR("SPACING", |
2511 | "space prohibited after that open parenthesis '('\n" . $herecurr); | ||
2250 | } | 2512 | } |
2251 | if ($line =~ /(\s+)\)/ && $line !~ /^.\s*\)/ && | 2513 | if ($line =~ /(\s+)\)/ && $line !~ /^.\s*\)/ && |
2252 | $line !~ /for\s*\(.*;\s+\)/ && | 2514 | $line !~ /for\s*\(.*;\s+\)/ && |
2253 | $line !~ /:\s+\)/) { | 2515 | $line !~ /:\s+\)/) { |
2254 | ERROR("space prohibited before that close parenthesis ')'\n" . $herecurr); | 2516 | ERROR("SPACING", |
2517 | "space prohibited before that close parenthesis ')'\n" . $herecurr); | ||
2255 | } | 2518 | } |
2256 | 2519 | ||
2257 | #goto labels aren't indented, allow a single space however | 2520 | #goto labels aren't indented, allow a single space however |
2258 | if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and | 2521 | if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and |
2259 | !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) { | 2522 | !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) { |
2260 | WARN("labels should not be indented\n" . $herecurr); | 2523 | WARN("INDENTED_LABEL", |
2524 | "labels should not be indented\n" . $herecurr); | ||
2261 | } | 2525 | } |
2262 | 2526 | ||
2263 | # Return is not a function. | 2527 | # Return is not a function. |
@@ -2276,23 +2540,48 @@ sub process { | |||
2276 | } | 2540 | } |
2277 | #print "value<$value>\n"; | 2541 | #print "value<$value>\n"; |
2278 | if ($value =~ /^\s*(?:$Ident|-?$Constant)\s*$/) { | 2542 | if ($value =~ /^\s*(?:$Ident|-?$Constant)\s*$/) { |
2279 | ERROR("return is not a function, parentheses are not required\n" . $herecurr); | 2543 | ERROR("RETURN_PARENTHESES", |
2544 | "return is not a function, parentheses are not required\n" . $herecurr); | ||
2280 | 2545 | ||
2281 | } elsif ($spacing !~ /\s+/) { | 2546 | } elsif ($spacing !~ /\s+/) { |
2282 | ERROR("space required before the open parenthesis '('\n" . $herecurr); | 2547 | ERROR("SPACING", |
2548 | "space required before the open parenthesis '('\n" . $herecurr); | ||
2283 | } | 2549 | } |
2284 | } | 2550 | } |
2285 | # Return of what appears to be an errno should normally be -'ve | 2551 | # Return of what appears to be an errno should normally be -'ve |
2286 | if ($line =~ /^.\s*return\s*(E[A-Z]*)\s*;/) { | 2552 | if ($line =~ /^.\s*return\s*(E[A-Z]*)\s*;/) { |
2287 | my $name = $1; | 2553 | my $name = $1; |
2288 | if ($name ne 'EOF' && $name ne 'ERROR') { | 2554 | if ($name ne 'EOF' && $name ne 'ERROR') { |
2289 | WARN("return of an errno should typically be -ve (return -$1)\n" . $herecurr); | 2555 | WARN("USE_NEGATIVE_ERRNO", |
2556 | "return of an errno should typically be -ve (return -$1)\n" . $herecurr); | ||
2557 | } | ||
2558 | } | ||
2559 | |||
2560 | # typecasts on min/max could be min_t/max_t | ||
2561 | if ($line =~ /^\+(?:.*?)\b(min|max)\s*\($Typecast{0,1}($LvalOrFunc)\s*,\s*$Typecast{0,1}($LvalOrFunc)\s*\)/) { | ||
2562 | if (defined $2 || defined $8) { | ||
2563 | my $call = $1; | ||
2564 | my $cast1 = deparenthesize($2); | ||
2565 | my $arg1 = $3; | ||
2566 | my $cast2 = deparenthesize($8); | ||
2567 | my $arg2 = $9; | ||
2568 | my $cast; | ||
2569 | |||
2570 | if ($cast1 ne "" && $cast2 ne "") { | ||
2571 | $cast = "$cast1 or $cast2"; | ||
2572 | } elsif ($cast1 ne "") { | ||
2573 | $cast = $cast1; | ||
2574 | } else { | ||
2575 | $cast = $cast2; | ||
2576 | } | ||
2577 | WARN("MINMAX", | ||
2578 | "$call() should probably be ${call}_t($cast, $arg1, $arg2)\n" . $herecurr); | ||
2290 | } | 2579 | } |
2291 | } | 2580 | } |
2292 | 2581 | ||
2293 | # Need a space before open parenthesis after if, while etc | 2582 | # Need a space before open parenthesis after if, while etc |
2294 | if ($line=~/\b(if|while|for|switch)\(/) { | 2583 | if ($line=~/\b(if|while|for|switch)\(/) { |
2295 | ERROR("space required before the open parenthesis '('\n" . $herecurr); | 2584 | ERROR("SPACING", "space required before the open parenthesis '('\n" . $herecurr); |
2296 | } | 2585 | } |
2297 | 2586 | ||
2298 | # Check for illegal assignment in if conditional -- and check for trailing | 2587 | # Check for illegal assignment in if conditional -- and check for trailing |
@@ -2320,7 +2609,8 @@ sub process { | |||
2320 | my ($s, $c) = ($stat, $cond); | 2609 | my ($s, $c) = ($stat, $cond); |
2321 | 2610 | ||
2322 | if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/s) { | 2611 | if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/s) { |
2323 | ERROR("do not use assignment in if condition\n" . $herecurr); | 2612 | ERROR("ASSIGN_IN_IF", |
2613 | "do not use assignment in if condition\n" . $herecurr); | ||
2324 | } | 2614 | } |
2325 | 2615 | ||
2326 | # Find out what is on the end of the line after the | 2616 | # Find out what is on the end of the line after the |
@@ -2342,7 +2632,8 @@ sub process { | |||
2342 | $stat_real = "[...]\n$stat_real"; | 2632 | $stat_real = "[...]\n$stat_real"; |
2343 | } | 2633 | } |
2344 | 2634 | ||
2345 | ERROR("trailing statements should be on next line\n" . $herecurr . $stat_real); | 2635 | ERROR("TRAILING_STATEMENTS", |
2636 | "trailing statements should be on next line\n" . $herecurr . $stat_real); | ||
2346 | } | 2637 | } |
2347 | } | 2638 | } |
2348 | 2639 | ||
@@ -2358,7 +2649,8 @@ sub process { | |||
2358 | (?:\&\&|\|\||\)|\]) | 2649 | (?:\&\&|\|\||\)|\]) |
2359 | )/x) | 2650 | )/x) |
2360 | { | 2651 | { |
2361 | WARN("boolean test with hexadecimal, perhaps just 1 \& or \|?\n" . $herecurr); | 2652 | WARN("HEXADECIMAL_BOOLEAN_TEST", |
2653 | "boolean test with hexadecimal, perhaps just 1 \& or \|?\n" . $herecurr); | ||
2362 | } | 2654 | } |
2363 | 2655 | ||
2364 | # if and else should not have general statements after it | 2656 | # if and else should not have general statements after it |
@@ -2366,12 +2658,14 @@ sub process { | |||
2366 | my $s = $1; | 2658 | my $s = $1; |
2367 | $s =~ s/$;//g; # Remove any comments | 2659 | $s =~ s/$;//g; # Remove any comments |
2368 | if ($s !~ /^\s*(?:\sif|(?:{|)\s*\\?\s*$)/) { | 2660 | if ($s !~ /^\s*(?:\sif|(?:{|)\s*\\?\s*$)/) { |
2369 | ERROR("trailing statements should be on next line\n" . $herecurr); | 2661 | ERROR("TRAILING_STATEMENTS", |
2662 | "trailing statements should be on next line\n" . $herecurr); | ||
2370 | } | 2663 | } |
2371 | } | 2664 | } |
2372 | # if should not continue a brace | 2665 | # if should not continue a brace |
2373 | if ($line =~ /}\s*if\b/) { | 2666 | if ($line =~ /}\s*if\b/) { |
2374 | ERROR("trailing statements should be on next line\n" . | 2667 | ERROR("TRAILING_STATEMENTS", |
2668 | "trailing statements should be on next line\n" . | ||
2375 | $herecurr); | 2669 | $herecurr); |
2376 | } | 2670 | } |
2377 | # case and default should not have general statements after them | 2671 | # case and default should not have general statements after them |
@@ -2381,14 +2675,16 @@ sub process { | |||
2381 | \s*return\s+ | 2675 | \s*return\s+ |
2382 | )/xg) | 2676 | )/xg) |
2383 | { | 2677 | { |
2384 | ERROR("trailing statements should be on next line\n" . $herecurr); | 2678 | ERROR("TRAILING_STATEMENTS", |
2679 | "trailing statements should be on next line\n" . $herecurr); | ||
2385 | } | 2680 | } |
2386 | 2681 | ||
2387 | # Check for }<nl>else {, these must be at the same | 2682 | # Check for }<nl>else {, these must be at the same |
2388 | # indent level to be relevant to each other. | 2683 | # indent level to be relevant to each other. |
2389 | if ($prevline=~/}\s*$/ and $line=~/^.\s*else\s*/ and | 2684 | if ($prevline=~/}\s*$/ and $line=~/^.\s*else\s*/ and |
2390 | $previndent == $indent) { | 2685 | $previndent == $indent) { |
2391 | ERROR("else should follow close brace '}'\n" . $hereprev); | 2686 | ERROR("ELSE_AFTER_BRACE", |
2687 | "else should follow close brace '}'\n" . $hereprev); | ||
2392 | } | 2688 | } |
2393 | 2689 | ||
2394 | if ($prevline=~/}\s*$/ and $line=~/^.\s*while\s*/ and | 2690 | if ($prevline=~/}\s*$/ and $line=~/^.\s*while\s*/ and |
@@ -2401,7 +2697,8 @@ sub process { | |||
2401 | $s =~ s/\n.*//g; | 2697 | $s =~ s/\n.*//g; |
2402 | 2698 | ||
2403 | if ($s =~ /^\s*;/) { | 2699 | if ($s =~ /^\s*;/) { |
2404 | ERROR("while should follow close brace '}'\n" . $hereprev); | 2700 | ERROR("WHILE_AFTER_BRACE", |
2701 | "while should follow close brace '}'\n" . $hereprev); | ||
2405 | } | 2702 | } |
2406 | } | 2703 | } |
2407 | 2704 | ||
@@ -2414,7 +2711,8 @@ sub process { | |||
2414 | 2711 | ||
2415 | #no spaces allowed after \ in define | 2712 | #no spaces allowed after \ in define |
2416 | if ($line=~/\#\s*define.*\\\s$/) { | 2713 | if ($line=~/\#\s*define.*\\\s$/) { |
2417 | WARN("Whitepspace after \\ makes next lines useless\n" . $herecurr); | 2714 | WARN("WHITESPACE_AFTER_LINE_CONTINUATION", |
2715 | "Whitepspace after \\ makes next lines useless\n" . $herecurr); | ||
2418 | } | 2716 | } |
2419 | 2717 | ||
2420 | #warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line) | 2718 | #warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line) |
@@ -2426,9 +2724,11 @@ sub process { | |||
2426 | $1 !~ /$allowed_asm_includes/) | 2724 | $1 !~ /$allowed_asm_includes/) |
2427 | { | 2725 | { |
2428 | if ($realfile =~ m{^arch/}) { | 2726 | if ($realfile =~ m{^arch/}) { |
2429 | CHK("Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr); | 2727 | CHK("ARCH_INCLUDE_LINUX", |
2728 | "Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr); | ||
2430 | } else { | 2729 | } else { |
2431 | WARN("Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr); | 2730 | WARN("INCLUDE_LINUX", |
2731 | "Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr); | ||
2432 | } | 2732 | } |
2433 | } | 2733 | } |
2434 | } | 2734 | } |
@@ -2512,7 +2812,8 @@ sub process { | |||
2512 | if ($rest !~ /while\s*\(/ && | 2812 | if ($rest !~ /while\s*\(/ && |
2513 | $dstat !~ /$exceptions/) | 2813 | $dstat !~ /$exceptions/) |
2514 | { | 2814 | { |
2515 | ERROR("Macros with multiple statements should be enclosed in a do - while loop\n" . "$here\n$ctx\n"); | 2815 | ERROR("MULTISTATEMENT_MACRO_USE_DO_WHILE", |
2816 | "Macros with multiple statements should be enclosed in a do - while loop\n" . "$here\n$ctx\n"); | ||
2516 | } | 2817 | } |
2517 | 2818 | ||
2518 | } elsif ($ctx !~ /;/) { | 2819 | } elsif ($ctx !~ /;/) { |
@@ -2522,7 +2823,8 @@ sub process { | |||
2522 | $dstat !~ /^\.$Ident\s*=/ && | 2823 | $dstat !~ /^\.$Ident\s*=/ && |
2523 | $dstat =~ /$Operators/) | 2824 | $dstat =~ /$Operators/) |
2524 | { | 2825 | { |
2525 | ERROR("Macros with complex values should be enclosed in parenthesis\n" . "$here\n$ctx\n"); | 2826 | ERROR("COMPLEX_MACRO", |
2827 | "Macros with complex values should be enclosed in parenthesis\n" . "$here\n$ctx\n"); | ||
2526 | } | 2828 | } |
2527 | } | 2829 | } |
2528 | } | 2830 | } |
@@ -2533,7 +2835,8 @@ sub process { | |||
2533 | # ALIGN(...) | 2835 | # ALIGN(...) |
2534 | # VMLINUX_SYMBOL(...) | 2836 | # VMLINUX_SYMBOL(...) |
2535 | if ($realfile eq 'vmlinux.lds.h' && $line =~ /(?:(?:^|\s)$Ident\s*=|=\s*$Ident(?:\s|$))/) { | 2837 | if ($realfile eq 'vmlinux.lds.h' && $line =~ /(?:(?:^|\s)$Ident\s*=|=\s*$Ident(?:\s|$))/) { |
2536 | WARN("vmlinux.lds.h needs VMLINUX_SYMBOL() around C-visible symbols\n" . $herecurr); | 2838 | WARN("MISSING_VMLINUX_SYMBOL", |
2839 | "vmlinux.lds.h needs VMLINUX_SYMBOL() around C-visible symbols\n" . $herecurr); | ||
2537 | } | 2840 | } |
2538 | 2841 | ||
2539 | # check for redundant bracing round if etc | 2842 | # check for redundant bracing round if etc |
@@ -2581,7 +2884,8 @@ sub process { | |||
2581 | } | 2884 | } |
2582 | } | 2885 | } |
2583 | if ($seen && !$allowed) { | 2886 | if ($seen && !$allowed) { |
2584 | WARN("braces {} are not necessary for any arm of this statement\n" . $herectx); | 2887 | WARN("BRACES", |
2888 | "braces {} are not necessary for any arm of this statement\n" . $herectx); | ||
2585 | } | 2889 | } |
2586 | } | 2890 | } |
2587 | } | 2891 | } |
@@ -2635,33 +2939,38 @@ sub process { | |||
2635 | $herectx .= raw_line($linenr, $n) . "\n";; | 2939 | $herectx .= raw_line($linenr, $n) . "\n";; |
2636 | } | 2940 | } |
2637 | 2941 | ||
2638 | WARN("braces {} are not necessary for single statement blocks\n" . $herectx); | 2942 | WARN("BRACES", |
2943 | "braces {} are not necessary for single statement blocks\n" . $herectx); | ||
2639 | } | 2944 | } |
2640 | } | 2945 | } |
2641 | 2946 | ||
2642 | # don't include deprecated include files (uses RAW line) | 2947 | # don't include deprecated include files (uses RAW line) |
2643 | for my $inc (@dep_includes) { | 2948 | for my $inc (@dep_includes) { |
2644 | if ($rawline =~ m@^.\s*\#\s*include\s*\<$inc>@) { | 2949 | if ($rawline =~ m@^.\s*\#\s*include\s*\<$inc>@) { |
2645 | ERROR("Don't use <$inc>: see Documentation/feature-removal-schedule.txt\n" . $herecurr); | 2950 | ERROR("DEPRECATED_INCLUDE", |
2951 | "Don't use <$inc>: see Documentation/feature-removal-schedule.txt\n" . $herecurr); | ||
2646 | } | 2952 | } |
2647 | } | 2953 | } |
2648 | 2954 | ||
2649 | # don't use deprecated functions | 2955 | # don't use deprecated functions |
2650 | for my $func (@dep_functions) { | 2956 | for my $func (@dep_functions) { |
2651 | if ($line =~ /\b$func\b/) { | 2957 | if ($line =~ /\b$func\b/) { |
2652 | ERROR("Don't use $func(): see Documentation/feature-removal-schedule.txt\n" . $herecurr); | 2958 | ERROR("DEPRECATED_FUNCTION", |
2959 | "Don't use $func(): see Documentation/feature-removal-schedule.txt\n" . $herecurr); | ||
2653 | } | 2960 | } |
2654 | } | 2961 | } |
2655 | 2962 | ||
2656 | # no volatiles please | 2963 | # no volatiles please |
2657 | my $asm_volatile = qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b}; | 2964 | my $asm_volatile = qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b}; |
2658 | if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/) { | 2965 | if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/) { |
2659 | WARN("Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr); | 2966 | WARN("VOLATILE", |
2967 | "Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr); | ||
2660 | } | 2968 | } |
2661 | 2969 | ||
2662 | # warn about #if 0 | 2970 | # warn about #if 0 |
2663 | if ($line =~ /^.\s*\#\s*if\s+0\b/) { | 2971 | if ($line =~ /^.\s*\#\s*if\s+0\b/) { |
2664 | CHK("if this code is redundant consider removing it\n" . | 2972 | CHK("REDUNDANT_CODE", |
2973 | "if this code is redundant consider removing it\n" . | ||
2665 | $herecurr); | 2974 | $herecurr); |
2666 | } | 2975 | } |
2667 | 2976 | ||
@@ -2669,14 +2978,16 @@ sub process { | |||
2669 | if ($prevline =~ /\bif\s*\(([^\)]*)\)/) { | 2978 | if ($prevline =~ /\bif\s*\(([^\)]*)\)/) { |
2670 | my $expr = $1; | 2979 | my $expr = $1; |
2671 | if ($line =~ /\bkfree\(\Q$expr\E\);/) { | 2980 | if ($line =~ /\bkfree\(\Q$expr\E\);/) { |
2672 | WARN("kfree(NULL) is safe this check is probably not required\n" . $hereprev); | 2981 | WARN("NEEDLESS_KFREE", |
2982 | "kfree(NULL) is safe this check is probably not required\n" . $hereprev); | ||
2673 | } | 2983 | } |
2674 | } | 2984 | } |
2675 | # check for needless usb_free_urb() checks | 2985 | # check for needless usb_free_urb() checks |
2676 | if ($prevline =~ /\bif\s*\(([^\)]*)\)/) { | 2986 | if ($prevline =~ /\bif\s*\(([^\)]*)\)/) { |
2677 | my $expr = $1; | 2987 | my $expr = $1; |
2678 | if ($line =~ /\busb_free_urb\(\Q$expr\E\);/) { | 2988 | if ($line =~ /\busb_free_urb\(\Q$expr\E\);/) { |
2679 | WARN("usb_free_urb(NULL) is safe this check is probably not required\n" . $hereprev); | 2989 | WARN("NEEDLESS_USB_FREE_URB", |
2990 | "usb_free_urb(NULL) is safe this check is probably not required\n" . $hereprev); | ||
2680 | } | 2991 | } |
2681 | } | 2992 | } |
2682 | 2993 | ||
@@ -2684,14 +2995,16 @@ sub process { | |||
2684 | if ($line =~ /\budelay\s*\(\s*(\w+)\s*\)/) { | 2995 | if ($line =~ /\budelay\s*\(\s*(\w+)\s*\)/) { |
2685 | # ignore udelay's < 10, however | 2996 | # ignore udelay's < 10, however |
2686 | if (! (($1 =~ /(\d+)/) && ($1 < 10)) ) { | 2997 | if (! (($1 =~ /(\d+)/) && ($1 < 10)) ) { |
2687 | CHK("usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt\n" . $line); | 2998 | CHK("USLEEP_RANGE", |
2999 | "usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt\n" . $line); | ||
2688 | } | 3000 | } |
2689 | } | 3001 | } |
2690 | 3002 | ||
2691 | # warn about unexpectedly long msleep's | 3003 | # warn about unexpectedly long msleep's |
2692 | if ($line =~ /\bmsleep\s*\((\d+)\);/) { | 3004 | if ($line =~ /\bmsleep\s*\((\d+)\);/) { |
2693 | if ($1 < 20) { | 3005 | if ($1 < 20) { |
2694 | WARN("msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt\n" . $line); | 3006 | WARN("MSLEEP", |
3007 | "msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt\n" . $line); | ||
2695 | } | 3008 | } |
2696 | } | 3009 | } |
2697 | 3010 | ||
@@ -2704,7 +3017,8 @@ sub process { | |||
2704 | 3017 | ||
2705 | # warn about spacing in #ifdefs | 3018 | # warn about spacing in #ifdefs |
2706 | if ($line =~ /^.\s*\#\s*(ifdef|ifndef|elif)\s\s+/) { | 3019 | if ($line =~ /^.\s*\#\s*(ifdef|ifndef|elif)\s\s+/) { |
2707 | ERROR("exactly one space required after that #$1\n" . $herecurr); | 3020 | ERROR("SPACING", |
3021 | "exactly one space required after that #$1\n" . $herecurr); | ||
2708 | } | 3022 | } |
2709 | 3023 | ||
2710 | # check for spinlock_t definitions without a comment. | 3024 | # check for spinlock_t definitions without a comment. |
@@ -2712,50 +3026,65 @@ sub process { | |||
2712 | $line =~ /^.\s*(DEFINE_MUTEX)\s*\(/) { | 3026 | $line =~ /^.\s*(DEFINE_MUTEX)\s*\(/) { |
2713 | my $which = $1; | 3027 | my $which = $1; |
2714 | if (!ctx_has_comment($first_line, $linenr)) { | 3028 | if (!ctx_has_comment($first_line, $linenr)) { |
2715 | CHK("$1 definition without comment\n" . $herecurr); | 3029 | CHK("UNCOMMENTED_DEFINITION", |
3030 | "$1 definition without comment\n" . $herecurr); | ||
2716 | } | 3031 | } |
2717 | } | 3032 | } |
2718 | # check for memory barriers without a comment. | 3033 | # check for memory barriers without a comment. |
2719 | if ($line =~ /\b(mb|rmb|wmb|read_barrier_depends|smp_mb|smp_rmb|smp_wmb|smp_read_barrier_depends)\(/) { | 3034 | if ($line =~ /\b(mb|rmb|wmb|read_barrier_depends|smp_mb|smp_rmb|smp_wmb|smp_read_barrier_depends)\(/) { |
2720 | if (!ctx_has_comment($first_line, $linenr)) { | 3035 | if (!ctx_has_comment($first_line, $linenr)) { |
2721 | CHK("memory barrier without comment\n" . $herecurr); | 3036 | CHK("MEMORY_BARRIER", |
3037 | "memory barrier without comment\n" . $herecurr); | ||
2722 | } | 3038 | } |
2723 | } | 3039 | } |
2724 | # check of hardware specific defines | 3040 | # check of hardware specific defines |
2725 | if ($line =~ m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) { | 3041 | if ($line =~ m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) { |
2726 | CHK("architecture specific defines should be avoided\n" . $herecurr); | 3042 | CHK("ARCH_DEFINES", |
3043 | "architecture specific defines should be avoided\n" . $herecurr); | ||
2727 | } | 3044 | } |
2728 | 3045 | ||
2729 | # Check that the storage class is at the beginning of a declaration | 3046 | # Check that the storage class is at the beginning of a declaration |
2730 | if ($line =~ /\b$Storage\b/ && $line !~ /^.\s*$Storage\b/) { | 3047 | if ($line =~ /\b$Storage\b/ && $line !~ /^.\s*$Storage\b/) { |
2731 | WARN("storage class should be at the beginning of the declaration\n" . $herecurr) | 3048 | WARN("STORAGE_CLASS", |
3049 | "storage class should be at the beginning of the declaration\n" . $herecurr) | ||
2732 | } | 3050 | } |
2733 | 3051 | ||
2734 | # check the location of the inline attribute, that it is between | 3052 | # check the location of the inline attribute, that it is between |
2735 | # storage class and type. | 3053 | # storage class and type. |
2736 | if ($line =~ /\b$Type\s+$Inline\b/ || | 3054 | if ($line =~ /\b$Type\s+$Inline\b/ || |
2737 | $line =~ /\b$Inline\s+$Storage\b/) { | 3055 | $line =~ /\b$Inline\s+$Storage\b/) { |
2738 | ERROR("inline keyword should sit between storage class and type\n" . $herecurr); | 3056 | ERROR("INLINE_LOCATION", |
3057 | "inline keyword should sit between storage class and type\n" . $herecurr); | ||
2739 | } | 3058 | } |
2740 | 3059 | ||
2741 | # Check for __inline__ and __inline, prefer inline | 3060 | # Check for __inline__ and __inline, prefer inline |
2742 | if ($line =~ /\b(__inline__|__inline)\b/) { | 3061 | if ($line =~ /\b(__inline__|__inline)\b/) { |
2743 | WARN("plain inline is preferred over $1\n" . $herecurr); | 3062 | WARN("INLINE", |
3063 | "plain inline is preferred over $1\n" . $herecurr); | ||
2744 | } | 3064 | } |
2745 | 3065 | ||
2746 | # Check for __attribute__ packed, prefer __packed | 3066 | # Check for __attribute__ packed, prefer __packed |
2747 | if ($line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) { | 3067 | if ($line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) { |
2748 | WARN("__packed is preferred over __attribute__((packed))\n" . $herecurr); | 3068 | WARN("PREFER_PACKED", |
3069 | "__packed is preferred over __attribute__((packed))\n" . $herecurr); | ||
3070 | } | ||
3071 | |||
3072 | # Check for __attribute__ aligned, prefer __aligned | ||
3073 | if ($line =~ /\b__attribute__\s*\(\s*\(.*aligned/) { | ||
3074 | WARN("PREFER_ALIGNED", | ||
3075 | "__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr); | ||
2749 | } | 3076 | } |
2750 | 3077 | ||
2751 | # check for sizeof(&) | 3078 | # check for sizeof(&) |
2752 | if ($line =~ /\bsizeof\s*\(\s*\&/) { | 3079 | if ($line =~ /\bsizeof\s*\(\s*\&/) { |
2753 | WARN("sizeof(& should be avoided\n" . $herecurr); | 3080 | WARN("SIZEOF_ADDRESS", |
3081 | "sizeof(& should be avoided\n" . $herecurr); | ||
2754 | } | 3082 | } |
2755 | 3083 | ||
2756 | # check for line continuations in quoted strings with odd counts of " | 3084 | # check for line continuations in quoted strings with odd counts of " |
2757 | if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) { | 3085 | if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) { |
2758 | WARN("Avoid line continuations in quoted strings\n" . $herecurr); | 3086 | WARN("LINE_CONTINUATIONS", |
3087 | "Avoid line continuations in quoted strings\n" . $herecurr); | ||
2759 | } | 3088 | } |
2760 | 3089 | ||
2761 | # check for new externs in .c files. | 3090 | # check for new externs in .c files. |
@@ -2772,17 +3101,20 @@ sub process { | |||
2772 | if ($s =~ /^\s*;/ && | 3101 | if ($s =~ /^\s*;/ && |
2773 | $function_name ne 'uninitialized_var') | 3102 | $function_name ne 'uninitialized_var') |
2774 | { | 3103 | { |
2775 | WARN("externs should be avoided in .c files\n" . $herecurr); | 3104 | WARN("AVOID_EXTERNS", |
3105 | "externs should be avoided in .c files\n" . $herecurr); | ||
2776 | } | 3106 | } |
2777 | 3107 | ||
2778 | if ($paren_space =~ /\n/) { | 3108 | if ($paren_space =~ /\n/) { |
2779 | WARN("arguments for function declarations should follow identifier\n" . $herecurr); | 3109 | WARN("FUNCTION_ARGUMENTS", |
3110 | "arguments for function declarations should follow identifier\n" . $herecurr); | ||
2780 | } | 3111 | } |
2781 | 3112 | ||
2782 | } elsif ($realfile =~ /\.c$/ && defined $stat && | 3113 | } elsif ($realfile =~ /\.c$/ && defined $stat && |
2783 | $stat =~ /^.\s*extern\s+/) | 3114 | $stat =~ /^.\s*extern\s+/) |
2784 | { | 3115 | { |
2785 | WARN("externs should be avoided in .c files\n" . $herecurr); | 3116 | WARN("AVOID_EXTERNS", |
3117 | "externs should be avoided in .c files\n" . $herecurr); | ||
2786 | } | 3118 | } |
2787 | 3119 | ||
2788 | # checks for new __setup's | 3120 | # checks for new __setup's |
@@ -2790,37 +3122,44 @@ sub process { | |||
2790 | my $name = $1; | 3122 | my $name = $1; |
2791 | 3123 | ||
2792 | if (!grep(/$name/, @setup_docs)) { | 3124 | if (!grep(/$name/, @setup_docs)) { |
2793 | CHK("__setup appears un-documented -- check Documentation/kernel-parameters.txt\n" . $herecurr); | 3125 | CHK("UNDOCUMENTED_SETUP", |
3126 | "__setup appears un-documented -- check Documentation/kernel-parameters.txt\n" . $herecurr); | ||
2794 | } | 3127 | } |
2795 | } | 3128 | } |
2796 | 3129 | ||
2797 | # check for pointless casting of kmalloc return | 3130 | # check for pointless casting of kmalloc return |
2798 | if ($line =~ /\*\s*\)\s*[kv][czm]alloc(_node){0,1}\b/) { | 3131 | if ($line =~ /\*\s*\)\s*[kv][czm]alloc(_node){0,1}\b/) { |
2799 | WARN("unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); | 3132 | WARN("UNNECESSARY_CASTS", |
3133 | "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); | ||
2800 | } | 3134 | } |
2801 | 3135 | ||
2802 | # check for multiple semicolons | 3136 | # check for multiple semicolons |
2803 | if ($line =~ /;\s*;\s*$/) { | 3137 | if ($line =~ /;\s*;\s*$/) { |
2804 | WARN("Statements terminations use 1 semicolon\n" . $herecurr); | 3138 | WARN("ONE_SEMICOLON", |
3139 | "Statements terminations use 1 semicolon\n" . $herecurr); | ||
2805 | } | 3140 | } |
2806 | 3141 | ||
2807 | # check for gcc specific __FUNCTION__ | 3142 | # check for gcc specific __FUNCTION__ |
2808 | if ($line =~ /__FUNCTION__/) { | 3143 | if ($line =~ /__FUNCTION__/) { |
2809 | WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); | 3144 | WARN("USE_FUNC", |
3145 | "__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); | ||
2810 | } | 3146 | } |
2811 | 3147 | ||
2812 | # check for semaphores initialized locked | 3148 | # check for semaphores initialized locked |
2813 | if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { | 3149 | if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { |
2814 | WARN("consider using a completion\n" . $herecurr); | 3150 | WARN("CONSIDER_COMPLETION", |
3151 | "consider using a completion\n" . $herecurr); | ||
2815 | 3152 | ||
2816 | } | 3153 | } |
2817 | # recommend kstrto* over simple_strto* | 3154 | # recommend kstrto* over simple_strto* |
2818 | if ($line =~ /\bsimple_(strto.*?)\s*\(/) { | 3155 | if ($line =~ /\bsimple_(strto.*?)\s*\(/) { |
2819 | WARN("consider using kstrto* in preference to simple_$1\n" . $herecurr); | 3156 | WARN("CONSIDER_KSTRTO", |
3157 | "consider using kstrto* in preference to simple_$1\n" . $herecurr); | ||
2820 | } | 3158 | } |
2821 | # check for __initcall(), use device_initcall() explicitly please | 3159 | # check for __initcall(), use device_initcall() explicitly please |
2822 | if ($line =~ /^.\s*__initcall\s*\(/) { | 3160 | if ($line =~ /^.\s*__initcall\s*\(/) { |
2823 | WARN("please use device_initcall() instead of __initcall()\n" . $herecurr); | 3161 | WARN("USE_DEVICE_INITCALL", |
3162 | "please use device_initcall() instead of __initcall()\n" . $herecurr); | ||
2824 | } | 3163 | } |
2825 | # check for various ops structs, ensure they are const. | 3164 | # check for various ops structs, ensure they are const. |
2826 | my $struct_ops = qr{acpi_dock_ops| | 3165 | my $struct_ops = qr{acpi_dock_ops| |
@@ -2862,7 +3201,8 @@ sub process { | |||
2862 | wd_ops}x; | 3201 | wd_ops}x; |
2863 | if ($line !~ /\bconst\b/ && | 3202 | if ($line !~ /\bconst\b/ && |
2864 | $line =~ /\bstruct\s+($struct_ops)\b/) { | 3203 | $line =~ /\bstruct\s+($struct_ops)\b/) { |
2865 | WARN("struct $1 should normally be const\n" . | 3204 | WARN("CONST_STRUCT", |
3205 | "struct $1 should normally be const\n" . | ||
2866 | $herecurr); | 3206 | $herecurr); |
2867 | } | 3207 | } |
2868 | 3208 | ||
@@ -2875,7 +3215,8 @@ sub process { | |||
2875 | $line !~ /\[[^\]]*\.\.\.[^\]]*NR_CPUS[^\]]*\]/ && | 3215 | $line !~ /\[[^\]]*\.\.\.[^\]]*NR_CPUS[^\]]*\]/ && |
2876 | $line !~ /\[[^\]]*NR_CPUS[^\]]*\.\.\.[^\]]*\]/) | 3216 | $line !~ /\[[^\]]*NR_CPUS[^\]]*\.\.\.[^\]]*\]/) |
2877 | { | 3217 | { |
2878 | WARN("usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc\n" . $herecurr); | 3218 | WARN("NR_CPUS", |
3219 | "usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc\n" . $herecurr); | ||
2879 | } | 3220 | } |
2880 | 3221 | ||
2881 | # check for %L{u,d,i} in strings | 3222 | # check for %L{u,d,i} in strings |
@@ -2884,7 +3225,8 @@ sub process { | |||
2884 | $string = substr($rawline, $-[1], $+[1] - $-[1]); | 3225 | $string = substr($rawline, $-[1], $+[1] - $-[1]); |
2885 | $string =~ s/%%/__/g; | 3226 | $string =~ s/%%/__/g; |
2886 | if ($string =~ /(?<!%)%L[udi]/) { | 3227 | if ($string =~ /(?<!%)%L[udi]/) { |
2887 | WARN("\%Ld/%Lu are not-standard C, use %lld/%llu\n" . $herecurr); | 3228 | WARN("PRINTF_L", |
3229 | "\%Ld/%Lu are not-standard C, use %lld/%llu\n" . $herecurr); | ||
2888 | last; | 3230 | last; |
2889 | } | 3231 | } |
2890 | } | 3232 | } |
@@ -2892,9 +3234,11 @@ sub process { | |||
2892 | # whine mightly about in_atomic | 3234 | # whine mightly about in_atomic |
2893 | if ($line =~ /\bin_atomic\s*\(/) { | 3235 | if ($line =~ /\bin_atomic\s*\(/) { |
2894 | if ($realfile =~ m@^drivers/@) { | 3236 | if ($realfile =~ m@^drivers/@) { |
2895 | ERROR("do not use in_atomic in drivers\n" . $herecurr); | 3237 | ERROR("IN_ATOMIC", |
3238 | "do not use in_atomic in drivers\n" . $herecurr); | ||
2896 | } elsif ($realfile !~ m@^kernel/@) { | 3239 | } elsif ($realfile !~ m@^kernel/@) { |
2897 | WARN("use of in_atomic() is incorrect outside core kernel code\n" . $herecurr); | 3240 | WARN("IN_ATOMIC", |
3241 | "use of in_atomic() is incorrect outside core kernel code\n" . $herecurr); | ||
2898 | } | 3242 | } |
2899 | } | 3243 | } |
2900 | 3244 | ||
@@ -2904,18 +3248,21 @@ sub process { | |||
2904 | if ($realfile !~ m@^kernel/lockdep@ && | 3248 | if ($realfile !~ m@^kernel/lockdep@ && |
2905 | $realfile !~ m@^include/linux/lockdep@ && | 3249 | $realfile !~ m@^include/linux/lockdep@ && |
2906 | $realfile !~ m@^drivers/base/core@) { | 3250 | $realfile !~ m@^drivers/base/core@) { |
2907 | ERROR("lockdep_no_validate class is reserved for device->mutex.\n" . $herecurr); | 3251 | ERROR("LOCKDEP", |
3252 | "lockdep_no_validate class is reserved for device->mutex.\n" . $herecurr); | ||
2908 | } | 3253 | } |
2909 | } | 3254 | } |
2910 | 3255 | ||
2911 | if ($line =~ /debugfs_create_file.*S_IWUGO/ || | 3256 | if ($line =~ /debugfs_create_file.*S_IWUGO/ || |
2912 | $line =~ /DEVICE_ATTR.*S_IWUGO/ ) { | 3257 | $line =~ /DEVICE_ATTR.*S_IWUGO/ ) { |
2913 | WARN("Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr); | 3258 | WARN("EXPORTED_WORLD_WRITABLE", |
3259 | "Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr); | ||
2914 | } | 3260 | } |
2915 | 3261 | ||
2916 | # Check for memset with swapped arguments | 3262 | # Check for memset with swapped arguments |
2917 | if ($line =~ /memset.*\,(\ |)(0x|)0(\ |0|)\);/) { | 3263 | if ($line =~ /memset.*\,(\ |)(0x|)0(\ |0|)\);/) { |
2918 | ERROR("memset size is 3rd argument, not the second.\n" . $herecurr); | 3264 | ERROR("MEMSET", |
3265 | "memset size is 3rd argument, not the second.\n" . $herecurr); | ||
2919 | } | 3266 | } |
2920 | } | 3267 | } |
2921 | 3268 | ||
@@ -2938,10 +3285,12 @@ sub process { | |||
2938 | } | 3285 | } |
2939 | 3286 | ||
2940 | if (!$is_patch) { | 3287 | if (!$is_patch) { |
2941 | ERROR("Does not appear to be a unified-diff format patch\n"); | 3288 | ERROR("NOT_UNIFIED_DIFF", |
3289 | "Does not appear to be a unified-diff format patch\n"); | ||
2942 | } | 3290 | } |
2943 | if ($is_patch && $chk_signoff && $signoff == 0) { | 3291 | if ($is_patch && $chk_signoff && $signoff == 0) { |
2944 | ERROR("Missing Signed-off-by: line(s)\n"); | 3292 | ERROR("MISSING_SIGN_OFF", |
3293 | "Missing Signed-off-by: line(s)\n"); | ||
2945 | } | 3294 | } |
2946 | 3295 | ||
2947 | print report_dump(); | 3296 | print report_dump(); |
@@ -2963,13 +3312,25 @@ sub process { | |||
2963 | } | 3312 | } |
2964 | } | 3313 | } |
2965 | 3314 | ||
3315 | if (keys %ignore_type) { | ||
3316 | print "NOTE: Ignored message types:"; | ||
3317 | foreach my $ignore (sort keys %ignore_type) { | ||
3318 | print " $ignore"; | ||
3319 | } | ||
3320 | print "\n"; | ||
3321 | print "\n" if ($quiet == 0); | ||
3322 | } | ||
3323 | |||
2966 | if ($clean == 1 && $quiet == 0) { | 3324 | if ($clean == 1 && $quiet == 0) { |
2967 | print "$vname has no obvious style problems and is ready for submission.\n" | 3325 | print "$vname has no obvious style problems and is ready for submission.\n" |
2968 | } | 3326 | } |
2969 | if ($clean == 0 && $quiet == 0) { | 3327 | if ($clean == 0 && $quiet == 0) { |
2970 | print "$vname has style problems, please review. If any of these errors\n"; | 3328 | print << "EOM"; |
2971 | print "are false positives report them to the maintainer, see\n"; | 3329 | $vname has style problems, please review. |
2972 | print "CHECKPATCH in MAINTAINERS.\n"; | 3330 | |
3331 | If any of these errors are false positives, please report | ||
3332 | them to the maintainer, see CHECKPATCH in MAINTAINERS. | ||
3333 | EOM | ||
2973 | } | 3334 | } |
2974 | 3335 | ||
2975 | return $clean; | 3336 | return $clean; |
diff --git a/scripts/docproc.c b/scripts/docproc.c index 98dec87974d..4cfdc1797eb 100644 --- a/scripts/docproc.c +++ b/scripts/docproc.c | |||
@@ -205,8 +205,7 @@ static void find_export_symbols(char * filename) | |||
205 | PATH_MAX - strlen(real_filename)); | 205 | PATH_MAX - strlen(real_filename)); |
206 | sym = add_new_file(filename); | 206 | sym = add_new_file(filename); |
207 | fp = fopen(real_filename, "r"); | 207 | fp = fopen(real_filename, "r"); |
208 | if (fp == NULL) | 208 | if (fp == NULL) { |
209 | { | ||
210 | fprintf(stderr, "docproc: "); | 209 | fprintf(stderr, "docproc: "); |
211 | perror(real_filename); | 210 | perror(real_filename); |
212 | exit(1); | 211 | exit(1); |
@@ -487,8 +486,7 @@ static void parse_file(FILE *infile) | |||
487 | default: | 486 | default: |
488 | defaultline(line); | 487 | defaultline(line); |
489 | } | 488 | } |
490 | } | 489 | } else { |
491 | else { | ||
492 | defaultline(line); | 490 | defaultline(line); |
493 | } | 491 | } |
494 | } | 492 | } |
@@ -519,8 +517,7 @@ int main(int argc, char *argv[]) | |||
519 | exit(2); | 517 | exit(2); |
520 | } | 518 | } |
521 | 519 | ||
522 | if (strcmp("doc", argv[1]) == 0) | 520 | if (strcmp("doc", argv[1]) == 0) { |
523 | { | ||
524 | /* Need to do this in two passes. | 521 | /* Need to do this in two passes. |
525 | * First pass is used to collect all symbols exported | 522 | * First pass is used to collect all symbols exported |
526 | * in the various files; | 523 | * in the various files; |
@@ -556,9 +553,7 @@ int main(int argc, char *argv[]) | |||
556 | fprintf(stderr, "Warning: didn't use docs for %s\n", | 553 | fprintf(stderr, "Warning: didn't use docs for %s\n", |
557 | all_list[i]); | 554 | all_list[i]); |
558 | } | 555 | } |
559 | } | 556 | } else if (strcmp("depend", argv[1]) == 0) { |
560 | else if (strcmp("depend", argv[1]) == 0) | ||
561 | { | ||
562 | /* Create first part of dependency chain | 557 | /* Create first part of dependency chain |
563 | * file.tmpl */ | 558 | * file.tmpl */ |
564 | printf("%s\t", argv[2]); | 559 | printf("%s\t", argv[2]); |
@@ -571,9 +566,7 @@ int main(int argc, char *argv[]) | |||
571 | findall = adddep; | 566 | findall = adddep; |
572 | parse_file(infile); | 567 | parse_file(infile); |
573 | printf("\n"); | 568 | printf("\n"); |
574 | } | 569 | } else { |
575 | else | ||
576 | { | ||
577 | fprintf(stderr, "Unknown option: %s\n", argv[1]); | 570 | fprintf(stderr, "Unknown option: %s\n", argv[1]); |
578 | exit(1); | 571 | exit(1); |
579 | } | 572 | } |
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile index 04a31c17639..6d1c6bb9f22 100644 --- a/scripts/dtc/Makefile +++ b/scripts/dtc/Makefile | |||
@@ -25,31 +25,5 @@ HOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC) | |||
25 | HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC) | 25 | HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC) |
26 | 26 | ||
27 | # dependencies on generated files need to be listed explicitly | 27 | # dependencies on generated files need to be listed explicitly |
28 | $(obj)/dtc-parser.tab.o: $(obj)/dtc-parser.tab.c $(obj)/dtc-parser.tab.h | 28 | $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h |
29 | $(obj)/dtc-lexer.lex.o: $(obj)/dtc-lexer.lex.c $(obj)/dtc-parser.tab.h | ||
30 | 29 | ||
31 | targets += dtc-parser.tab.c dtc-lexer.lex.c | ||
32 | |||
33 | clean-files += dtc-parser.tab.h | ||
34 | |||
35 | # GENERATE_PARSER := 1 # Uncomment to rebuild flex/bison output | ||
36 | |||
37 | ifdef GENERATE_PARSER | ||
38 | |||
39 | BISON = bison | ||
40 | FLEX = flex | ||
41 | |||
42 | quiet_cmd_bison = BISON $@ | ||
43 | cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped | ||
44 | quiet_cmd_flex = FLEX $@ | ||
45 | cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped | ||
46 | |||
47 | $(obj)/dtc-parser.tab.c: $(src)/dtc-parser.y FORCE | ||
48 | $(call if_changed,bison) | ||
49 | |||
50 | $(obj)/dtc-parser.tab.h: $(obj)/dtc-parser.tab.c | ||
51 | |||
52 | $(obj)/dtc-lexer.lex.c: $(src)/dtc-lexer.l FORCE | ||
53 | $(call if_changed,flex) | ||
54 | |||
55 | endif | ||
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped index 50c4420b4b2..8bbe1281705 100644 --- a/scripts/dtc/dtc-lexer.lex.c_shipped +++ b/scripts/dtc/dtc-lexer.lex.c_shipped | |||
@@ -1,6 +1,5 @@ | |||
1 | #line 2 "dtc-lexer.lex.c" | ||
2 | 1 | ||
3 | #line 4 "dtc-lexer.lex.c" | 2 | #line 3 "scripts/dtc/dtc-lexer.lex.c_shipped" |
4 | 3 | ||
5 | #define YY_INT_ALIGNED short int | 4 | #define YY_INT_ALIGNED short int |
6 | 5 | ||
@@ -54,6 +53,7 @@ typedef int flex_int32_t; | |||
54 | typedef unsigned char flex_uint8_t; | 53 | typedef unsigned char flex_uint8_t; |
55 | typedef unsigned short int flex_uint16_t; | 54 | typedef unsigned short int flex_uint16_t; |
56 | typedef unsigned int flex_uint32_t; | 55 | typedef unsigned int flex_uint32_t; |
56 | #endif /* ! C99 */ | ||
57 | 57 | ||
58 | /* Limits of integral types. */ | 58 | /* Limits of integral types. */ |
59 | #ifndef INT8_MIN | 59 | #ifndef INT8_MIN |
@@ -84,8 +84,6 @@ typedef unsigned int flex_uint32_t; | |||
84 | #define UINT32_MAX (4294967295U) | 84 | #define UINT32_MAX (4294967295U) |
85 | #endif | 85 | #endif |
86 | 86 | ||
87 | #endif /* ! C99 */ | ||
88 | |||
89 | #endif /* ! FLEXINT_H */ | 87 | #endif /* ! FLEXINT_H */ |
90 | 88 | ||
91 | #ifdef __cplusplus | 89 | #ifdef __cplusplus |
@@ -142,15 +140,7 @@ typedef unsigned int flex_uint32_t; | |||
142 | 140 | ||
143 | /* Size of default input buffer. */ | 141 | /* Size of default input buffer. */ |
144 | #ifndef YY_BUF_SIZE | 142 | #ifndef YY_BUF_SIZE |
145 | #ifdef __ia64__ | ||
146 | /* On IA-64, the buffer size is 16k, not 8k. | ||
147 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. | ||
148 | * Ditto for the __ia64__ case accordingly. | ||
149 | */ | ||
150 | #define YY_BUF_SIZE 32768 | ||
151 | #else | ||
152 | #define YY_BUF_SIZE 16384 | 143 | #define YY_BUF_SIZE 16384 |
153 | #endif /* __ia64__ */ | ||
154 | #endif | 144 | #endif |
155 | 145 | ||
156 | /* The state buf must be large enough to hold one state per character in the main buffer. | 146 | /* The state buf must be large enough to hold one state per character in the main buffer. |
@@ -550,7 +540,6 @@ int yy_flex_debug = 0; | |||
550 | #define YY_MORE_ADJ 0 | 540 | #define YY_MORE_ADJ 0 |
551 | #define YY_RESTORE_YY_MORE_OFFSET | 541 | #define YY_RESTORE_YY_MORE_OFFSET |
552 | char *yytext; | 542 | char *yytext; |
553 | #line 1 "dtc-lexer.l" | ||
554 | /* | 543 | /* |
555 | * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. | 544 | * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. |
556 | * | 545 | * |
@@ -572,10 +561,6 @@ char *yytext; | |||
572 | */ | 561 | */ |
573 | #define YY_NO_INPUT 1 | 562 | #define YY_NO_INPUT 1 |
574 | 563 | ||
575 | |||
576 | |||
577 | |||
578 | #line 37 "dtc-lexer.l" | ||
579 | #include "dtc.h" | 564 | #include "dtc.h" |
580 | #include "srcpos.h" | 565 | #include "srcpos.h" |
581 | #include "dtc-parser.tab.h" | 566 | #include "dtc-parser.tab.h" |
@@ -603,7 +588,6 @@ static int dts_version = 1; | |||
603 | 588 | ||
604 | static void push_input_file(const char *filename); | 589 | static void push_input_file(const char *filename); |
605 | static int pop_input_file(void); | 590 | static int pop_input_file(void); |
606 | #line 607 "dtc-lexer.lex.c" | ||
607 | 591 | ||
608 | #define INITIAL 0 | 592 | #define INITIAL 0 |
609 | #define INCLUDE 1 | 593 | #define INCLUDE 1 |
@@ -686,12 +670,7 @@ static int input (void ); | |||
686 | 670 | ||
687 | /* Amount of stuff to slurp up with each read. */ | 671 | /* Amount of stuff to slurp up with each read. */ |
688 | #ifndef YY_READ_BUF_SIZE | 672 | #ifndef YY_READ_BUF_SIZE |
689 | #ifdef __ia64__ | ||
690 | /* On IA-64, the buffer size is 16k, not 8k */ | ||
691 | #define YY_READ_BUF_SIZE 16384 | ||
692 | #else | ||
693 | #define YY_READ_BUF_SIZE 8192 | 673 | #define YY_READ_BUF_SIZE 8192 |
694 | #endif /* __ia64__ */ | ||
695 | #endif | 674 | #endif |
696 | 675 | ||
697 | /* Copy whatever the last rule matched to the standard output. */ | 676 | /* Copy whatever the last rule matched to the standard output. */ |
@@ -710,7 +689,7 @@ static int input (void ); | |||
710 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ | 689 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
711 | { \ | 690 | { \ |
712 | int c = '*'; \ | 691 | int c = '*'; \ |
713 | size_t n; \ | 692 | unsigned n; \ |
714 | for ( n = 0; n < max_size && \ | 693 | for ( n = 0; n < max_size && \ |
715 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ | 694 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
716 | buf[n] = (char) c; \ | 695 | buf[n] = (char) c; \ |
@@ -792,10 +771,6 @@ YY_DECL | |||
792 | register char *yy_cp, *yy_bp; | 771 | register char *yy_cp, *yy_bp; |
793 | register int yy_act; | 772 | register int yy_act; |
794 | 773 | ||
795 | #line 66 "dtc-lexer.l" | ||
796 | |||
797 | #line 798 "dtc-lexer.lex.c" | ||
798 | |||
799 | if ( !(yy_init) ) | 774 | if ( !(yy_init) ) |
800 | { | 775 | { |
801 | (yy_init) = 1; | 776 | (yy_init) = 1; |
@@ -876,7 +851,6 @@ do_action: /* This label is used only to access EOF actions. */ | |||
876 | case 1: | 851 | case 1: |
877 | /* rule 1 can match eol */ | 852 | /* rule 1 can match eol */ |
878 | YY_RULE_SETUP | 853 | YY_RULE_SETUP |
879 | #line 67 "dtc-lexer.l" | ||
880 | { | 854 | { |
881 | char *name = strchr(yytext, '\"') + 1; | 855 | char *name = strchr(yytext, '\"') + 1; |
882 | yytext[yyleng-1] = '\0'; | 856 | yytext[yyleng-1] = '\0'; |
@@ -888,7 +862,6 @@ case YY_STATE_EOF(INCLUDE): | |||
888 | case YY_STATE_EOF(BYTESTRING): | 862 | case YY_STATE_EOF(BYTESTRING): |
889 | case YY_STATE_EOF(PROPNODENAME): | 863 | case YY_STATE_EOF(PROPNODENAME): |
890 | case YY_STATE_EOF(V1): | 864 | case YY_STATE_EOF(V1): |
891 | #line 73 "dtc-lexer.l" | ||
892 | { | 865 | { |
893 | if (!pop_input_file()) { | 866 | if (!pop_input_file()) { |
894 | yyterminate(); | 867 | yyterminate(); |
@@ -898,7 +871,6 @@ case YY_STATE_EOF(V1): | |||
898 | case 2: | 871 | case 2: |
899 | /* rule 2 can match eol */ | 872 | /* rule 2 can match eol */ |
900 | YY_RULE_SETUP | 873 | YY_RULE_SETUP |
901 | #line 79 "dtc-lexer.l" | ||
902 | { | 874 | { |
903 | DPRINT("String: %s\n", yytext); | 875 | DPRINT("String: %s\n", yytext); |
904 | yylval.data = data_copy_escape_string(yytext+1, | 876 | yylval.data = data_copy_escape_string(yytext+1, |
@@ -908,7 +880,6 @@ YY_RULE_SETUP | |||
908 | YY_BREAK | 880 | YY_BREAK |
909 | case 3: | 881 | case 3: |
910 | YY_RULE_SETUP | 882 | YY_RULE_SETUP |
911 | #line 86 "dtc-lexer.l" | ||
912 | { | 883 | { |
913 | DPRINT("Keyword: /dts-v1/\n"); | 884 | DPRINT("Keyword: /dts-v1/\n"); |
914 | dts_version = 1; | 885 | dts_version = 1; |
@@ -918,7 +889,6 @@ YY_RULE_SETUP | |||
918 | YY_BREAK | 889 | YY_BREAK |
919 | case 4: | 890 | case 4: |
920 | YY_RULE_SETUP | 891 | YY_RULE_SETUP |
921 | #line 93 "dtc-lexer.l" | ||
922 | { | 892 | { |
923 | DPRINT("Keyword: /memreserve/\n"); | 893 | DPRINT("Keyword: /memreserve/\n"); |
924 | BEGIN_DEFAULT(); | 894 | BEGIN_DEFAULT(); |
@@ -927,7 +897,6 @@ YY_RULE_SETUP | |||
927 | YY_BREAK | 897 | YY_BREAK |
928 | case 5: | 898 | case 5: |
929 | YY_RULE_SETUP | 899 | YY_RULE_SETUP |
930 | #line 99 "dtc-lexer.l" | ||
931 | { | 900 | { |
932 | DPRINT("Label: %s\n", yytext); | 901 | DPRINT("Label: %s\n", yytext); |
933 | yylval.labelref = xstrdup(yytext); | 902 | yylval.labelref = xstrdup(yytext); |
@@ -937,7 +906,6 @@ YY_RULE_SETUP | |||
937 | YY_BREAK | 906 | YY_BREAK |
938 | case 6: | 907 | case 6: |
939 | YY_RULE_SETUP | 908 | YY_RULE_SETUP |
940 | #line 106 "dtc-lexer.l" | ||
941 | { | 909 | { |
942 | yylval.literal = xstrdup(yytext); | 910 | yylval.literal = xstrdup(yytext); |
943 | DPRINT("Literal: '%s'\n", yylval.literal); | 911 | DPRINT("Literal: '%s'\n", yylval.literal); |
@@ -946,7 +914,6 @@ YY_RULE_SETUP | |||
946 | YY_BREAK | 914 | YY_BREAK |
947 | case 7: | 915 | case 7: |
948 | YY_RULE_SETUP | 916 | YY_RULE_SETUP |
949 | #line 112 "dtc-lexer.l" | ||
950 | { /* label reference */ | 917 | { /* label reference */ |
951 | DPRINT("Ref: %s\n", yytext+1); | 918 | DPRINT("Ref: %s\n", yytext+1); |
952 | yylval.labelref = xstrdup(yytext+1); | 919 | yylval.labelref = xstrdup(yytext+1); |
@@ -955,7 +922,6 @@ YY_RULE_SETUP | |||
955 | YY_BREAK | 922 | YY_BREAK |
956 | case 8: | 923 | case 8: |
957 | YY_RULE_SETUP | 924 | YY_RULE_SETUP |
958 | #line 118 "dtc-lexer.l" | ||
959 | { /* new-style path reference */ | 925 | { /* new-style path reference */ |
960 | yytext[yyleng-1] = '\0'; | 926 | yytext[yyleng-1] = '\0'; |
961 | DPRINT("Ref: %s\n", yytext+2); | 927 | DPRINT("Ref: %s\n", yytext+2); |
@@ -965,7 +931,6 @@ YY_RULE_SETUP | |||
965 | YY_BREAK | 931 | YY_BREAK |
966 | case 9: | 932 | case 9: |
967 | YY_RULE_SETUP | 933 | YY_RULE_SETUP |
968 | #line 125 "dtc-lexer.l" | ||
969 | { | 934 | { |
970 | yylval.byte = strtol(yytext, NULL, 16); | 935 | yylval.byte = strtol(yytext, NULL, 16); |
971 | DPRINT("Byte: %02x\n", (int)yylval.byte); | 936 | DPRINT("Byte: %02x\n", (int)yylval.byte); |
@@ -974,7 +939,6 @@ YY_RULE_SETUP | |||
974 | YY_BREAK | 939 | YY_BREAK |
975 | case 10: | 940 | case 10: |
976 | YY_RULE_SETUP | 941 | YY_RULE_SETUP |
977 | #line 131 "dtc-lexer.l" | ||
978 | { | 942 | { |
979 | DPRINT("/BYTESTRING\n"); | 943 | DPRINT("/BYTESTRING\n"); |
980 | BEGIN_DEFAULT(); | 944 | BEGIN_DEFAULT(); |
@@ -983,7 +947,6 @@ YY_RULE_SETUP | |||
983 | YY_BREAK | 947 | YY_BREAK |
984 | case 11: | 948 | case 11: |
985 | YY_RULE_SETUP | 949 | YY_RULE_SETUP |
986 | #line 137 "dtc-lexer.l" | ||
987 | { | 950 | { |
988 | DPRINT("PropNodeName: %s\n", yytext); | 951 | DPRINT("PropNodeName: %s\n", yytext); |
989 | yylval.propnodename = xstrdup(yytext); | 952 | yylval.propnodename = xstrdup(yytext); |
@@ -993,7 +956,6 @@ YY_RULE_SETUP | |||
993 | YY_BREAK | 956 | YY_BREAK |
994 | case 12: | 957 | case 12: |
995 | YY_RULE_SETUP | 958 | YY_RULE_SETUP |
996 | #line 144 "dtc-lexer.l" | ||
997 | { | 959 | { |
998 | DPRINT("Binary Include\n"); | 960 | DPRINT("Binary Include\n"); |
999 | return DT_INCBIN; | 961 | return DT_INCBIN; |
@@ -1002,24 +964,20 @@ YY_RULE_SETUP | |||
1002 | case 13: | 964 | case 13: |
1003 | /* rule 13 can match eol */ | 965 | /* rule 13 can match eol */ |
1004 | YY_RULE_SETUP | 966 | YY_RULE_SETUP |
1005 | #line 149 "dtc-lexer.l" | ||
1006 | /* eat whitespace */ | 967 | /* eat whitespace */ |
1007 | YY_BREAK | 968 | YY_BREAK |
1008 | case 14: | 969 | case 14: |
1009 | /* rule 14 can match eol */ | 970 | /* rule 14 can match eol */ |
1010 | YY_RULE_SETUP | 971 | YY_RULE_SETUP |
1011 | #line 150 "dtc-lexer.l" | ||
1012 | /* eat C-style comments */ | 972 | /* eat C-style comments */ |
1013 | YY_BREAK | 973 | YY_BREAK |
1014 | case 15: | 974 | case 15: |
1015 | /* rule 15 can match eol */ | 975 | /* rule 15 can match eol */ |
1016 | YY_RULE_SETUP | 976 | YY_RULE_SETUP |
1017 | #line 151 "dtc-lexer.l" | ||
1018 | /* eat C++-style comments */ | 977 | /* eat C++-style comments */ |
1019 | YY_BREAK | 978 | YY_BREAK |
1020 | case 16: | 979 | case 16: |
1021 | YY_RULE_SETUP | 980 | YY_RULE_SETUP |
1022 | #line 153 "dtc-lexer.l" | ||
1023 | { | 981 | { |
1024 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], | 982 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], |
1025 | (unsigned)yytext[0]); | 983 | (unsigned)yytext[0]); |
@@ -1037,10 +995,8 @@ YY_RULE_SETUP | |||
1037 | YY_BREAK | 995 | YY_BREAK |
1038 | case 17: | 996 | case 17: |
1039 | YY_RULE_SETUP | 997 | YY_RULE_SETUP |
1040 | #line 168 "dtc-lexer.l" | ||
1041 | ECHO; | 998 | ECHO; |
1042 | YY_BREAK | 999 | YY_BREAK |
1043 | #line 1044 "dtc-lexer.lex.c" | ||
1044 | 1000 | ||
1045 | case YY_END_OF_BUFFER: | 1001 | case YY_END_OF_BUFFER: |
1046 | { | 1002 | { |
@@ -1756,8 +1712,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) | |||
1756 | 1712 | ||
1757 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will | 1713 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will |
1758 | * scan from a @e copy of @a bytes. | 1714 | * scan from a @e copy of @a bytes. |
1759 | * @param yybytes the byte buffer to scan | 1715 | * @param bytes the byte buffer to scan |
1760 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. | 1716 | * @param len the number of bytes in the buffer pointed to by @a bytes. |
1761 | * | 1717 | * |
1762 | * @return the newly allocated buffer state object. | 1718 | * @return the newly allocated buffer state object. |
1763 | */ | 1719 | */ |
@@ -1996,10 +1952,6 @@ void yyfree (void * ptr ) | |||
1996 | 1952 | ||
1997 | #define YYTABLES_NAME "yytables" | 1953 | #define YYTABLES_NAME "yytables" |
1998 | 1954 | ||
1999 | #line 168 "dtc-lexer.l" | ||
2000 | |||
2001 | |||
2002 | |||
2003 | static void push_input_file(const char *filename) | 1955 | static void push_input_file(const char *filename) |
2004 | { | 1956 | { |
2005 | assert(filename); | 1957 | assert(filename); |
@@ -2011,7 +1963,6 @@ static void push_input_file(const char *filename) | |||
2011 | yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE)); | 1963 | yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE)); |
2012 | } | 1964 | } |
2013 | 1965 | ||
2014 | |||
2015 | static int pop_input_file(void) | 1966 | static int pop_input_file(void) |
2016 | { | 1967 | { |
2017 | if (srcfile_pop() == 0) | 1968 | if (srcfile_pop() == 0) |
diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped index 9be2eea18a3..b05921e1e84 100644 --- a/scripts/dtc/dtc-parser.tab.c_shipped +++ b/scripts/dtc/dtc-parser.tab.c_shipped | |||
@@ -1,10 +1,9 @@ | |||
1 | 1 | /* A Bison parser, made by GNU Bison 2.4.3. */ | |
2 | /* A Bison parser, made by GNU Bison 2.4.1. */ | ||
3 | 2 | ||
4 | /* Skeleton implementation for Bison's Yacc-like parsers in C | 3 | /* Skeleton implementation for Bison's Yacc-like parsers in C |
5 | 4 | ||
6 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | 5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
7 | Free Software Foundation, Inc. | 6 | 2009, 2010 Free Software Foundation, Inc. |
8 | 7 | ||
9 | This program is free software: you can redistribute it and/or modify | 8 | This program is free software: you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by |
@@ -46,7 +45,7 @@ | |||
46 | #define YYBISON 1 | 45 | #define YYBISON 1 |
47 | 46 | ||
48 | /* Bison version. */ | 47 | /* Bison version. */ |
49 | #define YYBISON_VERSION "2.4.1" | 48 | #define YYBISON_VERSION "2.4.3" |
50 | 49 | ||
51 | /* Skeleton name. */ | 50 | /* Skeleton name. */ |
52 | #define YYSKELETON_NAME "yacc.c" | 51 | #define YYSKELETON_NAME "yacc.c" |
@@ -67,8 +66,6 @@ | |||
67 | 66 | ||
68 | /* Copy the first part of user declarations. */ | 67 | /* Copy the first part of user declarations. */ |
69 | 68 | ||
70 | /* Line 189 of yacc.c */ | ||
71 | #line 21 "dtc-parser.y" | ||
72 | 69 | ||
73 | #include <stdio.h> | 70 | #include <stdio.h> |
74 | 71 | ||
@@ -87,12 +84,10 @@ extern int treesource_error; | |||
87 | static unsigned long long eval_literal(const char *s, int base, int bits); | 84 | static unsigned long long eval_literal(const char *s, int base, int bits); |
88 | 85 | ||
89 | 86 | ||
90 | /* Line 189 of yacc.c */ | ||
91 | #line 92 "dtc-parser.tab.c" | ||
92 | 87 | ||
93 | /* Enabling traces. */ | 88 | /* Enabling traces. */ |
94 | #ifndef YYDEBUG | 89 | #ifndef YYDEBUG |
95 | # define YYDEBUG 0 | 90 | # define YYDEBUG 1 |
96 | #endif | 91 | #endif |
97 | 92 | ||
98 | /* Enabling verbose error messages. */ | 93 | /* Enabling verbose error messages. */ |
@@ -134,8 +129,6 @@ static unsigned long long eval_literal(const char *s, int base, int bits); | |||
134 | typedef union YYSTYPE | 129 | typedef union YYSTYPE |
135 | { | 130 | { |
136 | 131 | ||
137 | /* Line 214 of yacc.c */ | ||
138 | #line 39 "dtc-parser.y" | ||
139 | 132 | ||
140 | char *propnodename; | 133 | char *propnodename; |
141 | char *literal; | 134 | char *literal; |
@@ -154,8 +147,6 @@ typedef union YYSTYPE | |||
154 | 147 | ||
155 | 148 | ||
156 | 149 | ||
157 | /* Line 214 of yacc.c */ | ||
158 | #line 159 "dtc-parser.tab.c" | ||
159 | } YYSTYPE; | 150 | } YYSTYPE; |
160 | # define YYSTYPE_IS_TRIVIAL 1 | 151 | # define YYSTYPE_IS_TRIVIAL 1 |
161 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | 152 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
@@ -166,8 +157,6 @@ typedef union YYSTYPE | |||
166 | /* Copy the second part of user declarations. */ | 157 | /* Copy the second part of user declarations. */ |
167 | 158 | ||
168 | 159 | ||
169 | /* Line 264 of yacc.c */ | ||
170 | #line 171 "dtc-parser.tab.c" | ||
171 | 160 | ||
172 | #ifdef short | 161 | #ifdef short |
173 | # undef short | 162 | # undef short |
@@ -217,7 +206,7 @@ typedef short int yytype_int16; | |||
217 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) | 206 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
218 | 207 | ||
219 | #ifndef YY_ | 208 | #ifndef YY_ |
220 | # if YYENABLE_NLS | 209 | # if defined YYENABLE_NLS && YYENABLE_NLS |
221 | # if ENABLE_NLS | 210 | # if ENABLE_NLS |
222 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ | 211 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
223 | # define YY_(msgid) dgettext ("bison-runtime", msgid) | 212 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
@@ -607,9 +596,18 @@ static const yytype_uint8 yystos[] = | |||
607 | 596 | ||
608 | /* Like YYERROR except do call yyerror. This remains here temporarily | 597 | /* Like YYERROR except do call yyerror. This remains here temporarily |
609 | to ease the transition to the new meaning of YYERROR, for GCC. | 598 | to ease the transition to the new meaning of YYERROR, for GCC. |
610 | Once GCC version 2 has supplanted version 1, this can go. */ | 599 | Once GCC version 2 has supplanted version 1, this can go. However, |
600 | YYFAIL appears to be in use. Nevertheless, it is formally deprecated | ||
601 | in Bison 2.4.2's NEWS entry, where a plan to phase it out is | ||
602 | discussed. */ | ||
611 | 603 | ||
612 | #define YYFAIL goto yyerrlab | 604 | #define YYFAIL goto yyerrlab |
605 | #if defined YYFAIL | ||
606 | /* This is here to suppress warnings from the GCC cpp's | ||
607 | -Wunused-macros. Normally we don't worry about that warning, but | ||
608 | some users do, and we want to make it easy for users to remove | ||
609 | YYFAIL uses, which will produce warnings from Bison 2.5. */ | ||
610 | #endif | ||
613 | 611 | ||
614 | #define YYRECOVERING() (!!yyerrstatus) | 612 | #define YYRECOVERING() (!!yyerrstatus) |
615 | 613 | ||
@@ -666,7 +664,7 @@ while (YYID (0)) | |||
666 | we won't break user code: when these are the locations we know. */ | 664 | we won't break user code: when these are the locations we know. */ |
667 | 665 | ||
668 | #ifndef YY_LOCATION_PRINT | 666 | #ifndef YY_LOCATION_PRINT |
669 | # if YYLTYPE_IS_TRIVIAL | 667 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL |
670 | # define YY_LOCATION_PRINT(File, Loc) \ | 668 | # define YY_LOCATION_PRINT(File, Loc) \ |
671 | fprintf (File, "%d.%d-%d.%d", \ | 669 | fprintf (File, "%d.%d-%d.%d", \ |
672 | (Loc).first_line, (Loc).first_column, \ | 670 | (Loc).first_line, (Loc).first_column, \ |
@@ -1405,8 +1403,6 @@ yyreduce: | |||
1405 | { | 1403 | { |
1406 | case 2: | 1404 | case 2: |
1407 | 1405 | ||
1408 | /* Line 1455 of yacc.c */ | ||
1409 | #line 87 "dtc-parser.y" | ||
1410 | { | 1406 | { |
1411 | the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), | 1407 | the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), |
1412 | guess_boot_cpuid((yyvsp[(4) - (4)].node))); | 1408 | guess_boot_cpuid((yyvsp[(4) - (4)].node))); |
@@ -1415,8 +1411,6 @@ yyreduce: | |||
1415 | 1411 | ||
1416 | case 3: | 1412 | case 3: |
1417 | 1413 | ||
1418 | /* Line 1455 of yacc.c */ | ||
1419 | #line 95 "dtc-parser.y" | ||
1420 | { | 1414 | { |
1421 | (yyval.re) = NULL; | 1415 | (yyval.re) = NULL; |
1422 | ;} | 1416 | ;} |
@@ -1424,8 +1418,6 @@ yyreduce: | |||
1424 | 1418 | ||
1425 | case 4: | 1419 | case 4: |
1426 | 1420 | ||
1427 | /* Line 1455 of yacc.c */ | ||
1428 | #line 99 "dtc-parser.y" | ||
1429 | { | 1421 | { |
1430 | (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); | 1422 | (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); |
1431 | ;} | 1423 | ;} |
@@ -1433,8 +1425,6 @@ yyreduce: | |||
1433 | 1425 | ||
1434 | case 5: | 1426 | case 5: |
1435 | 1427 | ||
1436 | /* Line 1455 of yacc.c */ | ||
1437 | #line 106 "dtc-parser.y" | ||
1438 | { | 1428 | { |
1439 | (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].addr), (yyvsp[(3) - (4)].addr)); | 1429 | (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].addr), (yyvsp[(3) - (4)].addr)); |
1440 | ;} | 1430 | ;} |
@@ -1442,8 +1432,6 @@ yyreduce: | |||
1442 | 1432 | ||
1443 | case 6: | 1433 | case 6: |
1444 | 1434 | ||
1445 | /* Line 1455 of yacc.c */ | ||
1446 | #line 110 "dtc-parser.y" | ||
1447 | { | 1435 | { |
1448 | add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref)); | 1436 | add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref)); |
1449 | (yyval.re) = (yyvsp[(2) - (2)].re); | 1437 | (yyval.re) = (yyvsp[(2) - (2)].re); |
@@ -1452,8 +1440,6 @@ yyreduce: | |||
1452 | 1440 | ||
1453 | case 7: | 1441 | case 7: |
1454 | 1442 | ||
1455 | /* Line 1455 of yacc.c */ | ||
1456 | #line 118 "dtc-parser.y" | ||
1457 | { | 1443 | { |
1458 | (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64); | 1444 | (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64); |
1459 | ;} | 1445 | ;} |
@@ -1461,8 +1447,6 @@ yyreduce: | |||
1461 | 1447 | ||
1462 | case 8: | 1448 | case 8: |
1463 | 1449 | ||
1464 | /* Line 1455 of yacc.c */ | ||
1465 | #line 125 "dtc-parser.y" | ||
1466 | { | 1450 | { |
1467 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), ""); | 1451 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), ""); |
1468 | ;} | 1452 | ;} |
@@ -1470,8 +1454,6 @@ yyreduce: | |||
1470 | 1454 | ||
1471 | case 9: | 1455 | case 9: |
1472 | 1456 | ||
1473 | /* Line 1455 of yacc.c */ | ||
1474 | #line 129 "dtc-parser.y" | ||
1475 | { | 1457 | { |
1476 | (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); | 1458 | (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); |
1477 | ;} | 1459 | ;} |
@@ -1479,8 +1461,6 @@ yyreduce: | |||
1479 | 1461 | ||
1480 | case 10: | 1462 | case 10: |
1481 | 1463 | ||
1482 | /* Line 1455 of yacc.c */ | ||
1483 | #line 133 "dtc-parser.y" | ||
1484 | { | 1464 | { |
1485 | struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref)); | 1465 | struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref)); |
1486 | 1466 | ||
@@ -1494,8 +1474,6 @@ yyreduce: | |||
1494 | 1474 | ||
1495 | case 11: | 1475 | case 11: |
1496 | 1476 | ||
1497 | /* Line 1455 of yacc.c */ | ||
1498 | #line 146 "dtc-parser.y" | ||
1499 | { | 1477 | { |
1500 | (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); | 1478 | (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); |
1501 | ;} | 1479 | ;} |
@@ -1503,8 +1481,6 @@ yyreduce: | |||
1503 | 1481 | ||
1504 | case 12: | 1482 | case 12: |
1505 | 1483 | ||
1506 | /* Line 1455 of yacc.c */ | ||
1507 | #line 153 "dtc-parser.y" | ||
1508 | { | 1484 | { |
1509 | (yyval.proplist) = NULL; | 1485 | (yyval.proplist) = NULL; |
1510 | ;} | 1486 | ;} |
@@ -1512,8 +1488,6 @@ yyreduce: | |||
1512 | 1488 | ||
1513 | case 13: | 1489 | case 13: |
1514 | 1490 | ||
1515 | /* Line 1455 of yacc.c */ | ||
1516 | #line 157 "dtc-parser.y" | ||
1517 | { | 1491 | { |
1518 | (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); | 1492 | (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); |
1519 | ;} | 1493 | ;} |
@@ -1521,8 +1495,6 @@ yyreduce: | |||
1521 | 1495 | ||
1522 | case 14: | 1496 | case 14: |
1523 | 1497 | ||
1524 | /* Line 1455 of yacc.c */ | ||
1525 | #line 164 "dtc-parser.y" | ||
1526 | { | 1498 | { |
1527 | (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data)); | 1499 | (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data)); |
1528 | ;} | 1500 | ;} |
@@ -1530,8 +1502,6 @@ yyreduce: | |||
1530 | 1502 | ||
1531 | case 15: | 1503 | case 15: |
1532 | 1504 | ||
1533 | /* Line 1455 of yacc.c */ | ||
1534 | #line 168 "dtc-parser.y" | ||
1535 | { | 1505 | { |
1536 | (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data); | 1506 | (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data); |
1537 | ;} | 1507 | ;} |
@@ -1539,8 +1509,6 @@ yyreduce: | |||
1539 | 1509 | ||
1540 | case 16: | 1510 | case 16: |
1541 | 1511 | ||
1542 | /* Line 1455 of yacc.c */ | ||
1543 | #line 172 "dtc-parser.y" | ||
1544 | { | 1512 | { |
1545 | add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref)); | 1513 | add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref)); |
1546 | (yyval.prop) = (yyvsp[(2) - (2)].prop); | 1514 | (yyval.prop) = (yyvsp[(2) - (2)].prop); |
@@ -1549,8 +1517,6 @@ yyreduce: | |||
1549 | 1517 | ||
1550 | case 17: | 1518 | case 17: |
1551 | 1519 | ||
1552 | /* Line 1455 of yacc.c */ | ||
1553 | #line 180 "dtc-parser.y" | ||
1554 | { | 1520 | { |
1555 | (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); | 1521 | (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); |
1556 | ;} | 1522 | ;} |
@@ -1558,8 +1524,6 @@ yyreduce: | |||
1558 | 1524 | ||
1559 | case 18: | 1525 | case 18: |
1560 | 1526 | ||
1561 | /* Line 1455 of yacc.c */ | ||
1562 | #line 184 "dtc-parser.y" | ||
1563 | { | 1527 | { |
1564 | (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); | 1528 | (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); |
1565 | ;} | 1529 | ;} |
@@ -1567,8 +1531,6 @@ yyreduce: | |||
1567 | 1531 | ||
1568 | case 19: | 1532 | case 19: |
1569 | 1533 | ||
1570 | /* Line 1455 of yacc.c */ | ||
1571 | #line 188 "dtc-parser.y" | ||
1572 | { | 1534 | { |
1573 | (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); | 1535 | (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); |
1574 | ;} | 1536 | ;} |
@@ -1576,8 +1538,6 @@ yyreduce: | |||
1576 | 1538 | ||
1577 | case 20: | 1539 | case 20: |
1578 | 1540 | ||
1579 | /* Line 1455 of yacc.c */ | ||
1580 | #line 192 "dtc-parser.y" | ||
1581 | { | 1541 | { |
1582 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); | 1542 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); |
1583 | ;} | 1543 | ;} |
@@ -1585,8 +1545,6 @@ yyreduce: | |||
1585 | 1545 | ||
1586 | case 21: | 1546 | case 21: |
1587 | 1547 | ||
1588 | /* Line 1455 of yacc.c */ | ||
1589 | #line 196 "dtc-parser.y" | ||
1590 | { | 1548 | { |
1591 | FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL); | 1549 | FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL); |
1592 | struct data d; | 1550 | struct data d; |
@@ -1607,8 +1565,6 @@ yyreduce: | |||
1607 | 1565 | ||
1608 | case 22: | 1566 | case 22: |
1609 | 1567 | ||
1610 | /* Line 1455 of yacc.c */ | ||
1611 | #line 213 "dtc-parser.y" | ||
1612 | { | 1568 | { |
1613 | FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL); | 1569 | FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL); |
1614 | struct data d = empty_data; | 1570 | struct data d = empty_data; |
@@ -1622,8 +1578,6 @@ yyreduce: | |||
1622 | 1578 | ||
1623 | case 23: | 1579 | case 23: |
1624 | 1580 | ||
1625 | /* Line 1455 of yacc.c */ | ||
1626 | #line 223 "dtc-parser.y" | ||
1627 | { | 1581 | { |
1628 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1582 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); |
1629 | ;} | 1583 | ;} |
@@ -1631,8 +1585,6 @@ yyreduce: | |||
1631 | 1585 | ||
1632 | case 24: | 1586 | case 24: |
1633 | 1587 | ||
1634 | /* Line 1455 of yacc.c */ | ||
1635 | #line 230 "dtc-parser.y" | ||
1636 | { | 1588 | { |
1637 | (yyval.data) = empty_data; | 1589 | (yyval.data) = empty_data; |
1638 | ;} | 1590 | ;} |
@@ -1640,8 +1592,6 @@ yyreduce: | |||
1640 | 1592 | ||
1641 | case 25: | 1593 | case 25: |
1642 | 1594 | ||
1643 | /* Line 1455 of yacc.c */ | ||
1644 | #line 234 "dtc-parser.y" | ||
1645 | { | 1595 | { |
1646 | (yyval.data) = (yyvsp[(1) - (2)].data); | 1596 | (yyval.data) = (yyvsp[(1) - (2)].data); |
1647 | ;} | 1597 | ;} |
@@ -1649,8 +1599,6 @@ yyreduce: | |||
1649 | 1599 | ||
1650 | case 26: | 1600 | case 26: |
1651 | 1601 | ||
1652 | /* Line 1455 of yacc.c */ | ||
1653 | #line 238 "dtc-parser.y" | ||
1654 | { | 1602 | { |
1655 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1603 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); |
1656 | ;} | 1604 | ;} |
@@ -1658,8 +1606,6 @@ yyreduce: | |||
1658 | 1606 | ||
1659 | case 27: | 1607 | case 27: |
1660 | 1608 | ||
1661 | /* Line 1455 of yacc.c */ | ||
1662 | #line 245 "dtc-parser.y" | ||
1663 | { | 1609 | { |
1664 | (yyval.data) = empty_data; | 1610 | (yyval.data) = empty_data; |
1665 | ;} | 1611 | ;} |
@@ -1667,8 +1613,6 @@ yyreduce: | |||
1667 | 1613 | ||
1668 | case 28: | 1614 | case 28: |
1669 | 1615 | ||
1670 | /* Line 1455 of yacc.c */ | ||
1671 | #line 249 "dtc-parser.y" | ||
1672 | { | 1616 | { |
1673 | (yyval.data) = data_append_cell((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].cell)); | 1617 | (yyval.data) = data_append_cell((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].cell)); |
1674 | ;} | 1618 | ;} |
@@ -1676,8 +1620,6 @@ yyreduce: | |||
1676 | 1620 | ||
1677 | case 29: | 1621 | case 29: |
1678 | 1622 | ||
1679 | /* Line 1455 of yacc.c */ | ||
1680 | #line 253 "dtc-parser.y" | ||
1681 | { | 1623 | { |
1682 | (yyval.data) = data_append_cell(data_add_marker((yyvsp[(1) - (2)].data), REF_PHANDLE, | 1624 | (yyval.data) = data_append_cell(data_add_marker((yyvsp[(1) - (2)].data), REF_PHANDLE, |
1683 | (yyvsp[(2) - (2)].labelref)), -1); | 1625 | (yyvsp[(2) - (2)].labelref)), -1); |
@@ -1686,8 +1628,6 @@ yyreduce: | |||
1686 | 1628 | ||
1687 | case 30: | 1629 | case 30: |
1688 | 1630 | ||
1689 | /* Line 1455 of yacc.c */ | ||
1690 | #line 258 "dtc-parser.y" | ||
1691 | { | 1631 | { |
1692 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1632 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); |
1693 | ;} | 1633 | ;} |
@@ -1695,8 +1635,6 @@ yyreduce: | |||
1695 | 1635 | ||
1696 | case 31: | 1636 | case 31: |
1697 | 1637 | ||
1698 | /* Line 1455 of yacc.c */ | ||
1699 | #line 265 "dtc-parser.y" | ||
1700 | { | 1638 | { |
1701 | (yyval.cell) = eval_literal((yyvsp[(1) - (1)].literal), 0, 32); | 1639 | (yyval.cell) = eval_literal((yyvsp[(1) - (1)].literal), 0, 32); |
1702 | ;} | 1640 | ;} |
@@ -1704,8 +1642,6 @@ yyreduce: | |||
1704 | 1642 | ||
1705 | case 32: | 1643 | case 32: |
1706 | 1644 | ||
1707 | /* Line 1455 of yacc.c */ | ||
1708 | #line 272 "dtc-parser.y" | ||
1709 | { | 1645 | { |
1710 | (yyval.data) = empty_data; | 1646 | (yyval.data) = empty_data; |
1711 | ;} | 1647 | ;} |
@@ -1713,8 +1649,6 @@ yyreduce: | |||
1713 | 1649 | ||
1714 | case 33: | 1650 | case 33: |
1715 | 1651 | ||
1716 | /* Line 1455 of yacc.c */ | ||
1717 | #line 276 "dtc-parser.y" | ||
1718 | { | 1652 | { |
1719 | (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); | 1653 | (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); |
1720 | ;} | 1654 | ;} |
@@ -1722,8 +1656,6 @@ yyreduce: | |||
1722 | 1656 | ||
1723 | case 34: | 1657 | case 34: |
1724 | 1658 | ||
1725 | /* Line 1455 of yacc.c */ | ||
1726 | #line 280 "dtc-parser.y" | ||
1727 | { | 1659 | { |
1728 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1660 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); |
1729 | ;} | 1661 | ;} |
@@ -1731,8 +1663,6 @@ yyreduce: | |||
1731 | 1663 | ||
1732 | case 35: | 1664 | case 35: |
1733 | 1665 | ||
1734 | /* Line 1455 of yacc.c */ | ||
1735 | #line 287 "dtc-parser.y" | ||
1736 | { | 1666 | { |
1737 | (yyval.nodelist) = NULL; | 1667 | (yyval.nodelist) = NULL; |
1738 | ;} | 1668 | ;} |
@@ -1740,8 +1670,6 @@ yyreduce: | |||
1740 | 1670 | ||
1741 | case 36: | 1671 | case 36: |
1742 | 1672 | ||
1743 | /* Line 1455 of yacc.c */ | ||
1744 | #line 291 "dtc-parser.y" | ||
1745 | { | 1673 | { |
1746 | (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); | 1674 | (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); |
1747 | ;} | 1675 | ;} |
@@ -1749,8 +1677,6 @@ yyreduce: | |||
1749 | 1677 | ||
1750 | case 37: | 1678 | case 37: |
1751 | 1679 | ||
1752 | /* Line 1455 of yacc.c */ | ||
1753 | #line 295 "dtc-parser.y" | ||
1754 | { | 1680 | { |
1755 | print_error("syntax error: properties must precede subnodes"); | 1681 | print_error("syntax error: properties must precede subnodes"); |
1756 | YYERROR; | 1682 | YYERROR; |
@@ -1759,8 +1685,6 @@ yyreduce: | |||
1759 | 1685 | ||
1760 | case 38: | 1686 | case 38: |
1761 | 1687 | ||
1762 | /* Line 1455 of yacc.c */ | ||
1763 | #line 303 "dtc-parser.y" | ||
1764 | { | 1688 | { |
1765 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename)); | 1689 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename)); |
1766 | ;} | 1690 | ;} |
@@ -1768,8 +1692,6 @@ yyreduce: | |||
1768 | 1692 | ||
1769 | case 39: | 1693 | case 39: |
1770 | 1694 | ||
1771 | /* Line 1455 of yacc.c */ | ||
1772 | #line 307 "dtc-parser.y" | ||
1773 | { | 1695 | { |
1774 | add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref)); | 1696 | add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref)); |
1775 | (yyval.node) = (yyvsp[(2) - (2)].node); | 1697 | (yyval.node) = (yyvsp[(2) - (2)].node); |
@@ -1778,8 +1700,6 @@ yyreduce: | |||
1778 | 1700 | ||
1779 | 1701 | ||
1780 | 1702 | ||
1781 | /* Line 1455 of yacc.c */ | ||
1782 | #line 1783 "dtc-parser.tab.c" | ||
1783 | default: break; | 1703 | default: break; |
1784 | } | 1704 | } |
1785 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); | 1705 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
@@ -1990,8 +1910,6 @@ yyreturn: | |||
1990 | 1910 | ||
1991 | 1911 | ||
1992 | 1912 | ||
1993 | /* Line 1675 of yacc.c */ | ||
1994 | #line 313 "dtc-parser.y" | ||
1995 | 1913 | ||
1996 | 1914 | ||
1997 | void print_error(char const *fmt, ...) | 1915 | void print_error(char const *fmt, ...) |
diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped index 95c9547adea..4ee682bb7d3 100644 --- a/scripts/dtc/dtc-parser.tab.h_shipped +++ b/scripts/dtc/dtc-parser.tab.h_shipped | |||
@@ -1,10 +1,9 @@ | |||
1 | 1 | /* A Bison parser, made by GNU Bison 2.4.3. */ | |
2 | /* A Bison parser, made by GNU Bison 2.4.1. */ | ||
3 | 2 | ||
4 | /* Skeleton interface for Bison's Yacc-like parsers in C | 3 | /* Skeleton interface for Bison's Yacc-like parsers in C |
5 | 4 | ||
6 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | 5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
7 | Free Software Foundation, Inc. | 6 | 2009, 2010 Free Software Foundation, Inc. |
8 | 7 | ||
9 | This program is free software: you can redistribute it and/or modify | 8 | This program is free software: you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by |
@@ -58,8 +57,6 @@ | |||
58 | typedef union YYSTYPE | 57 | typedef union YYSTYPE |
59 | { | 58 | { |
60 | 59 | ||
61 | /* Line 1676 of yacc.c */ | ||
62 | #line 39 "dtc-parser.y" | ||
63 | 60 | ||
64 | char *propnodename; | 61 | char *propnodename; |
65 | char *literal; | 62 | char *literal; |
@@ -78,8 +75,6 @@ typedef union YYSTYPE | |||
78 | 75 | ||
79 | 76 | ||
80 | 77 | ||
81 | /* Line 1676 of yacc.c */ | ||
82 | #line 83 "dtc-parser.tab.h" | ||
83 | } YYSTYPE; | 78 | } YYSTYPE; |
84 | # define YYSTYPE_IS_TRIVIAL 1 | 79 | # define YYSTYPE_IS_TRIVIAL 1 |
85 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | 80 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
diff --git a/scripts/gcc-goto.sh b/scripts/gcc-goto.sh index 520d16b1ffa..98cffcb941e 100644 --- a/scripts/gcc-goto.sh +++ b/scripts/gcc-goto.sh | |||
@@ -1,5 +1,5 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # Test for gcc 'asm goto' suport | 2 | # Test for gcc 'asm goto' support |
3 | # Copyright (C) 2010, Jason Baron <jbaron@redhat.com> | 3 | # Copyright (C) 2010, Jason Baron <jbaron@redhat.com> |
4 | 4 | ||
5 | echo "int main(void) { entry: asm goto (\"\"::::entry); return 0; }" | $@ -x c - -c -o /dev/null >/dev/null 2>&1 && echo "y" | 5 | echo "int main(void) { entry: asm goto (\"\"::::entry); return 0; }" | $@ -x c - -c -o /dev/null >/dev/null 2>&1 && echo "y" |
diff --git a/scripts/genksyms/.gitignore b/scripts/genksyms/.gitignore index be5cadb1b90..86dc07a01b4 100644 --- a/scripts/genksyms/.gitignore +++ b/scripts/genksyms/.gitignore | |||
@@ -1,4 +1,5 @@ | |||
1 | keywords.c | 1 | *.hash.c |
2 | lex.c | 2 | *.lex.c |
3 | parse.[ch] | 3 | *.tab.c |
4 | *.tab.h | ||
4 | genksyms | 5 | genksyms |
diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile index 13d03cf05d9..aca33b98bf6 100644 --- a/scripts/genksyms/Makefile +++ b/scripts/genksyms/Makefile | |||
@@ -2,52 +2,13 @@ | |||
2 | hostprogs-y := genksyms | 2 | hostprogs-y := genksyms |
3 | always := $(hostprogs-y) | 3 | always := $(hostprogs-y) |
4 | 4 | ||
5 | genksyms-objs := genksyms.o parse.o lex.o | 5 | genksyms-objs := genksyms.o parse.tab.o lex.lex.o |
6 | 6 | ||
7 | # -I needed for generated C source (shipped source) | 7 | # -I needed for generated C source (shipped source) |
8 | HOSTCFLAGS_parse.o := -Wno-uninitialized -I$(src) | 8 | HOSTCFLAGS_parse.tab.o := -I$(src) |
9 | HOSTCFLAGS_lex.lex.o := -I$(src) | ||
9 | 10 | ||
10 | # dependencies on generated files need to be listed explicitly | 11 | # dependencies on generated files need to be listed explicitly |
11 | $(obj)/lex.o: $(obj)/parse.h $(obj)/keywords.c | 12 | $(obj)/lex.lex.o: $(obj)/keywords.hash.c $(obj)/parse.tab.h |
12 | 13 | ||
13 | # -I needed for generated C source (shipped source) | 14 | clean-files := keywords.hash.c lex.lex.c parse.tab.c parse.tab.h |
14 | HOSTCFLAGS_lex.o := -I$(src) | ||
15 | |||
16 | ifdef GENERATE_PARSER | ||
17 | |||
18 | # gperf | ||
19 | |||
20 | quiet_cmd_keywords.c = GPERF $@ | ||
21 | cmd_keywords.c = gperf -L ANSI-C -a -C -E -g -H is_reserved_hash \ | ||
22 | -k 1,3,$$ -N is_reserved_word -p -t $< > $@ | ||
23 | |||
24 | $(obj)/keywords.c: $(obj)/keywords.gperf FORCE | ||
25 | $(call if_changed,keywords.c) | ||
26 | cp $@ $@_shipped | ||
27 | |||
28 | # flex | ||
29 | |||
30 | quiet_cmd_lex.c = FLEX $@ | ||
31 | cmd_lex.c = flex -o$@ -d $< | ||
32 | |||
33 | $(obj)/lex.c: $(obj)/lex.l $(obj)/keywords.c FORCE | ||
34 | $(call if_changed,lex.c) | ||
35 | cp $@ $@_shipped | ||
36 | |||
37 | # bison | ||
38 | |||
39 | quiet_cmd_parse.c = BISON $@ | ||
40 | cmd_parse.c = bison -o$@ -dtv $(filter-out FORCE,$^) | ||
41 | |||
42 | $(obj)/parse.c: $(obj)/parse.y FORCE | ||
43 | $(call if_changed,parse.c) | ||
44 | cp $@ $@_shipped | ||
45 | cp $(@:.c=.h) $(@:.c=.h)_shipped | ||
46 | |||
47 | $(obj)/parse.h: $(obj)/parse.c ; | ||
48 | |||
49 | clean-files += parse.output | ||
50 | |||
51 | endif | ||
52 | |||
53 | targets += keywords.c lex.c parse.c parse.h | ||
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c index f9e75531ea0..8a106499ec4 100644 --- a/scripts/genksyms/genksyms.c +++ b/scripts/genksyms/genksyms.c | |||
@@ -40,7 +40,8 @@ static struct symbol *symtab[HASH_BUCKETS]; | |||
40 | static FILE *debugfile; | 40 | static FILE *debugfile; |
41 | 41 | ||
42 | int cur_line = 1; | 42 | int cur_line = 1; |
43 | char *cur_filename; | 43 | char *cur_filename, *source_file; |
44 | int in_source_file; | ||
44 | 45 | ||
45 | static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types, | 46 | static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types, |
46 | flag_preserve, flag_warnings; | 47 | flag_preserve, flag_warnings; |
@@ -448,7 +449,7 @@ static struct string_list *read_node(FILE *f) | |||
448 | node.string = buffer; | 449 | node.string = buffer; |
449 | 450 | ||
450 | if (node.string[1] == '#') { | 451 | if (node.string[1] == '#') { |
451 | int n; | 452 | size_t n; |
452 | 453 | ||
453 | for (n = 0; n < ARRAY_SIZE(symbol_types); n++) { | 454 | for (n = 0; n < ARRAY_SIZE(symbol_types); n++) { |
454 | if (node.string[0] == symbol_types[n].n) { | 455 | if (node.string[0] == symbol_types[n].n) { |
diff --git a/scripts/genksyms/genksyms.h b/scripts/genksyms/genksyms.h index 7ec52ae3846..3bffdcaaa27 100644 --- a/scripts/genksyms/genksyms.h +++ b/scripts/genksyms/genksyms.h | |||
@@ -37,6 +37,7 @@ enum symbol_status { | |||
37 | struct string_list { | 37 | struct string_list { |
38 | struct string_list *next; | 38 | struct string_list *next; |
39 | enum symbol_type tag; | 39 | enum symbol_type tag; |
40 | int in_source_file; | ||
40 | char *string; | 41 | char *string; |
41 | }; | 42 | }; |
42 | 43 | ||
@@ -57,7 +58,8 @@ typedef struct string_list **yystype; | |||
57 | #define YYSTYPE yystype | 58 | #define YYSTYPE yystype |
58 | 59 | ||
59 | extern int cur_line; | 60 | extern int cur_line; |
60 | extern char *cur_filename; | 61 | extern char *cur_filename, *source_file; |
62 | extern int in_source_file; | ||
61 | 63 | ||
62 | struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact); | 64 | struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact); |
63 | struct symbol *add_symbol(const char *name, enum symbol_type type, | 65 | struct symbol *add_symbol(const char *name, enum symbol_type type, |
diff --git a/scripts/genksyms/keywords.gperf b/scripts/genksyms/keywords.gperf index e6349acb6f2..3e77a943e7b 100644 --- a/scripts/genksyms/keywords.gperf +++ b/scripts/genksyms/keywords.gperf | |||
@@ -1,3 +1,6 @@ | |||
1 | %language=ANSI-C | ||
2 | %define hash-function-name is_reserved_hash | ||
3 | %define lookup-function-name is_reserved_word | ||
1 | %{ | 4 | %{ |
2 | struct resword; | 5 | struct resword; |
3 | static const struct resword *is_reserved_word(register const char *str, register unsigned int len); | 6 | static const struct resword *is_reserved_word(register const char *str, register unsigned int len); |
diff --git a/scripts/genksyms/keywords.c_shipped b/scripts/genksyms/keywords.hash.c_shipped index 8060e06798b..82062607e8c 100644 --- a/scripts/genksyms/keywords.c_shipped +++ b/scripts/genksyms/keywords.hash.c_shipped | |||
@@ -1,5 +1,5 @@ | |||
1 | /* ANSI-C code produced by gperf version 3.0.4 */ | 1 | /* ANSI-C code produced by gperf version 3.0.4 */ |
2 | /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ | 2 | /* Command-line: gperf -t --output-file scripts/genksyms/keywords.hash.c_shipped -a -C -E -g -k '1,3,$' -p -t scripts/genksyms/keywords.gperf */ |
3 | 3 | ||
4 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | 4 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ |
5 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | 5 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ |
@@ -28,11 +28,11 @@ | |||
28 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." | 28 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #line 1 "scripts/genksyms/keywords.gperf" | 31 | #line 4 "scripts/genksyms/keywords.gperf" |
32 | 32 | ||
33 | struct resword; | 33 | struct resword; |
34 | static const struct resword *is_reserved_word(register const char *str, register unsigned int len); | 34 | static const struct resword *is_reserved_word(register const char *str, register unsigned int len); |
35 | #line 5 "scripts/genksyms/keywords.gperf" | 35 | #line 8 "scripts/genksyms/keywords.gperf" |
36 | struct resword { const char *name; int token; }; | 36 | struct resword { const char *name; int token; }; |
37 | /* maximum key range = 64, duplicates = 0 */ | 37 | /* maximum key range = 64, duplicates = 0 */ |
38 | 38 | ||
@@ -99,108 +99,108 @@ is_reserved_word (register const char *str, register unsigned int len) | |||
99 | static const struct resword wordlist[] = | 99 | static const struct resword wordlist[] = |
100 | { | 100 | { |
101 | {""}, {""}, {""}, | 101 | {""}, {""}, {""}, |
102 | #line 30 "scripts/genksyms/keywords.gperf" | 102 | #line 33 "scripts/genksyms/keywords.gperf" |
103 | {"asm", ASM_KEYW}, | 103 | {"asm", ASM_KEYW}, |
104 | {""}, | 104 | {""}, |
105 | #line 12 "scripts/genksyms/keywords.gperf" | 105 | #line 15 "scripts/genksyms/keywords.gperf" |
106 | {"__asm", ASM_KEYW}, | 106 | {"__asm", ASM_KEYW}, |
107 | {""}, | 107 | {""}, |
108 | #line 13 "scripts/genksyms/keywords.gperf" | 108 | #line 16 "scripts/genksyms/keywords.gperf" |
109 | {"__asm__", ASM_KEYW}, | 109 | {"__asm__", ASM_KEYW}, |
110 | {""}, {""}, | 110 | {""}, {""}, |
111 | #line 56 "scripts/genksyms/keywords.gperf" | 111 | #line 59 "scripts/genksyms/keywords.gperf" |
112 | {"__typeof__", TYPEOF_KEYW}, | 112 | {"__typeof__", TYPEOF_KEYW}, |
113 | {""}, | 113 | {""}, |
114 | #line 16 "scripts/genksyms/keywords.gperf" | 114 | #line 19 "scripts/genksyms/keywords.gperf" |
115 | {"__const", CONST_KEYW}, | 115 | {"__const", CONST_KEYW}, |
116 | #line 15 "scripts/genksyms/keywords.gperf" | 116 | #line 18 "scripts/genksyms/keywords.gperf" |
117 | {"__attribute__", ATTRIBUTE_KEYW}, | 117 | {"__attribute__", ATTRIBUTE_KEYW}, |
118 | #line 17 "scripts/genksyms/keywords.gperf" | 118 | #line 20 "scripts/genksyms/keywords.gperf" |
119 | {"__const__", CONST_KEYW}, | 119 | {"__const__", CONST_KEYW}, |
120 | #line 22 "scripts/genksyms/keywords.gperf" | 120 | #line 25 "scripts/genksyms/keywords.gperf" |
121 | {"__signed__", SIGNED_KEYW}, | 121 | {"__signed__", SIGNED_KEYW}, |
122 | #line 48 "scripts/genksyms/keywords.gperf" | 122 | #line 51 "scripts/genksyms/keywords.gperf" |
123 | {"static", STATIC_KEYW}, | 123 | {"static", STATIC_KEYW}, |
124 | {""}, | 124 | {""}, |
125 | #line 43 "scripts/genksyms/keywords.gperf" | 125 | #line 46 "scripts/genksyms/keywords.gperf" |
126 | {"int", INT_KEYW}, | 126 | {"int", INT_KEYW}, |
127 | #line 36 "scripts/genksyms/keywords.gperf" | 127 | #line 39 "scripts/genksyms/keywords.gperf" |
128 | {"char", CHAR_KEYW}, | 128 | {"char", CHAR_KEYW}, |
129 | #line 37 "scripts/genksyms/keywords.gperf" | 129 | #line 40 "scripts/genksyms/keywords.gperf" |
130 | {"const", CONST_KEYW}, | 130 | {"const", CONST_KEYW}, |
131 | #line 49 "scripts/genksyms/keywords.gperf" | 131 | #line 52 "scripts/genksyms/keywords.gperf" |
132 | {"struct", STRUCT_KEYW}, | 132 | {"struct", STRUCT_KEYW}, |
133 | #line 28 "scripts/genksyms/keywords.gperf" | 133 | #line 31 "scripts/genksyms/keywords.gperf" |
134 | {"__restrict__", RESTRICT_KEYW}, | 134 | {"__restrict__", RESTRICT_KEYW}, |
135 | #line 29 "scripts/genksyms/keywords.gperf" | 135 | #line 32 "scripts/genksyms/keywords.gperf" |
136 | {"restrict", RESTRICT_KEYW}, | 136 | {"restrict", RESTRICT_KEYW}, |
137 | #line 9 "scripts/genksyms/keywords.gperf" | 137 | #line 12 "scripts/genksyms/keywords.gperf" |
138 | {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW}, | 138 | {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW}, |
139 | #line 20 "scripts/genksyms/keywords.gperf" | 139 | #line 23 "scripts/genksyms/keywords.gperf" |
140 | {"__inline__", INLINE_KEYW}, | 140 | {"__inline__", INLINE_KEYW}, |
141 | {""}, | 141 | {""}, |
142 | #line 24 "scripts/genksyms/keywords.gperf" | 142 | #line 27 "scripts/genksyms/keywords.gperf" |
143 | {"__volatile__", VOLATILE_KEYW}, | 143 | {"__volatile__", VOLATILE_KEYW}, |
144 | #line 7 "scripts/genksyms/keywords.gperf" | 144 | #line 10 "scripts/genksyms/keywords.gperf" |
145 | {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, | 145 | {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, |
146 | #line 27 "scripts/genksyms/keywords.gperf" | 146 | #line 30 "scripts/genksyms/keywords.gperf" |
147 | {"_restrict", RESTRICT_KEYW}, | 147 | {"_restrict", RESTRICT_KEYW}, |
148 | {""}, | 148 | {""}, |
149 | #line 14 "scripts/genksyms/keywords.gperf" | 149 | #line 17 "scripts/genksyms/keywords.gperf" |
150 | {"__attribute", ATTRIBUTE_KEYW}, | 150 | {"__attribute", ATTRIBUTE_KEYW}, |
151 | #line 8 "scripts/genksyms/keywords.gperf" | 151 | #line 11 "scripts/genksyms/keywords.gperf" |
152 | {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, | 152 | {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, |
153 | #line 18 "scripts/genksyms/keywords.gperf" | 153 | #line 21 "scripts/genksyms/keywords.gperf" |
154 | {"__extension__", EXTENSION_KEYW}, | 154 | {"__extension__", EXTENSION_KEYW}, |
155 | #line 39 "scripts/genksyms/keywords.gperf" | 155 | #line 42 "scripts/genksyms/keywords.gperf" |
156 | {"enum", ENUM_KEYW}, | 156 | {"enum", ENUM_KEYW}, |
157 | #line 10 "scripts/genksyms/keywords.gperf" | 157 | #line 13 "scripts/genksyms/keywords.gperf" |
158 | {"EXPORT_UNUSED_SYMBOL", EXPORT_SYMBOL_KEYW}, | 158 | {"EXPORT_UNUSED_SYMBOL", EXPORT_SYMBOL_KEYW}, |
159 | #line 40 "scripts/genksyms/keywords.gperf" | 159 | #line 43 "scripts/genksyms/keywords.gperf" |
160 | {"extern", EXTERN_KEYW}, | 160 | {"extern", EXTERN_KEYW}, |
161 | {""}, | 161 | {""}, |
162 | #line 21 "scripts/genksyms/keywords.gperf" | 162 | #line 24 "scripts/genksyms/keywords.gperf" |
163 | {"__signed", SIGNED_KEYW}, | 163 | {"__signed", SIGNED_KEYW}, |
164 | #line 11 "scripts/genksyms/keywords.gperf" | 164 | #line 14 "scripts/genksyms/keywords.gperf" |
165 | {"EXPORT_UNUSED_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, | 165 | {"EXPORT_UNUSED_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, |
166 | #line 51 "scripts/genksyms/keywords.gperf" | 166 | #line 54 "scripts/genksyms/keywords.gperf" |
167 | {"union", UNION_KEYW}, | 167 | {"union", UNION_KEYW}, |
168 | #line 55 "scripts/genksyms/keywords.gperf" | 168 | #line 58 "scripts/genksyms/keywords.gperf" |
169 | {"typeof", TYPEOF_KEYW}, | 169 | {"typeof", TYPEOF_KEYW}, |
170 | #line 50 "scripts/genksyms/keywords.gperf" | 170 | #line 53 "scripts/genksyms/keywords.gperf" |
171 | {"typedef", TYPEDEF_KEYW}, | 171 | {"typedef", TYPEDEF_KEYW}, |
172 | #line 19 "scripts/genksyms/keywords.gperf" | 172 | #line 22 "scripts/genksyms/keywords.gperf" |
173 | {"__inline", INLINE_KEYW}, | 173 | {"__inline", INLINE_KEYW}, |
174 | #line 35 "scripts/genksyms/keywords.gperf" | 174 | #line 38 "scripts/genksyms/keywords.gperf" |
175 | {"auto", AUTO_KEYW}, | 175 | {"auto", AUTO_KEYW}, |
176 | #line 23 "scripts/genksyms/keywords.gperf" | 176 | #line 26 "scripts/genksyms/keywords.gperf" |
177 | {"__volatile", VOLATILE_KEYW}, | 177 | {"__volatile", VOLATILE_KEYW}, |
178 | {""}, {""}, | 178 | {""}, {""}, |
179 | #line 52 "scripts/genksyms/keywords.gperf" | 179 | #line 55 "scripts/genksyms/keywords.gperf" |
180 | {"unsigned", UNSIGNED_KEYW}, | 180 | {"unsigned", UNSIGNED_KEYW}, |
181 | {""}, | 181 | {""}, |
182 | #line 46 "scripts/genksyms/keywords.gperf" | 182 | #line 49 "scripts/genksyms/keywords.gperf" |
183 | {"short", SHORT_KEYW}, | 183 | {"short", SHORT_KEYW}, |
184 | #line 42 "scripts/genksyms/keywords.gperf" | 184 | #line 45 "scripts/genksyms/keywords.gperf" |
185 | {"inline", INLINE_KEYW}, | 185 | {"inline", INLINE_KEYW}, |
186 | {""}, | 186 | {""}, |
187 | #line 54 "scripts/genksyms/keywords.gperf" | 187 | #line 57 "scripts/genksyms/keywords.gperf" |
188 | {"volatile", VOLATILE_KEYW}, | 188 | {"volatile", VOLATILE_KEYW}, |
189 | #line 44 "scripts/genksyms/keywords.gperf" | 189 | #line 47 "scripts/genksyms/keywords.gperf" |
190 | {"long", LONG_KEYW}, | 190 | {"long", LONG_KEYW}, |
191 | #line 26 "scripts/genksyms/keywords.gperf" | 191 | #line 29 "scripts/genksyms/keywords.gperf" |
192 | {"_Bool", BOOL_KEYW}, | 192 | {"_Bool", BOOL_KEYW}, |
193 | {""}, {""}, | 193 | {""}, {""}, |
194 | #line 45 "scripts/genksyms/keywords.gperf" | 194 | #line 48 "scripts/genksyms/keywords.gperf" |
195 | {"register", REGISTER_KEYW}, | 195 | {"register", REGISTER_KEYW}, |
196 | #line 53 "scripts/genksyms/keywords.gperf" | 196 | #line 56 "scripts/genksyms/keywords.gperf" |
197 | {"void", VOID_KEYW}, | 197 | {"void", VOID_KEYW}, |
198 | #line 41 "scripts/genksyms/keywords.gperf" | 198 | #line 44 "scripts/genksyms/keywords.gperf" |
199 | {"float", FLOAT_KEYW}, | 199 | {"float", FLOAT_KEYW}, |
200 | #line 38 "scripts/genksyms/keywords.gperf" | 200 | #line 41 "scripts/genksyms/keywords.gperf" |
201 | {"double", DOUBLE_KEYW}, | 201 | {"double", DOUBLE_KEYW}, |
202 | {""}, {""}, {""}, {""}, | 202 | {""}, {""}, {""}, {""}, |
203 | #line 47 "scripts/genksyms/keywords.gperf" | 203 | #line 50 "scripts/genksyms/keywords.gperf" |
204 | {"signed", SIGNED_KEYW} | 204 | {"signed", SIGNED_KEYW} |
205 | }; | 205 | }; |
206 | 206 | ||
diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l index e4ddd493fec..f770071719c 100644 --- a/scripts/genksyms/lex.l +++ b/scripts/genksyms/lex.l | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <ctype.h> | 29 | #include <ctype.h> |
30 | 30 | ||
31 | #include "genksyms.h" | 31 | #include "genksyms.h" |
32 | #include "parse.h" | 32 | #include "parse.tab.h" |
33 | 33 | ||
34 | /* We've got a two-level lexer here. We let flex do basic tokenization | 34 | /* We've got a two-level lexer here. We let flex do basic tokenization |
35 | and then we categorize those basic tokens in the second stage. */ | 35 | and then we categorize those basic tokens in the second stage. */ |
@@ -94,7 +94,7 @@ MC_TOKEN ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>) | |||
94 | 94 | ||
95 | /* Bring in the keyword recognizer. */ | 95 | /* Bring in the keyword recognizer. */ |
96 | 96 | ||
97 | #include "keywords.c" | 97 | #include "keywords.hash.c" |
98 | 98 | ||
99 | 99 | ||
100 | /* Macros to append to our phrase collection list. */ | 100 | /* Macros to append to our phrase collection list. */ |
@@ -116,6 +116,7 @@ MC_TOKEN ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>) | |||
116 | cur_node->tag = \ | 116 | cur_node->tag = \ |
117 | find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\ | 117 | find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\ |
118 | SYM_ENUM_CONST : SYM_NORMAL ; \ | 118 | SYM_ENUM_CONST : SYM_NORMAL ; \ |
119 | cur_node->in_source_file = in_source_file; \ | ||
119 | } while (0) | 120 | } while (0) |
120 | 121 | ||
121 | #define APP _APP(yytext, yyleng) | 122 | #define APP _APP(yytext, yyleng) |
@@ -166,6 +167,13 @@ repeat: | |||
166 | cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1); | 167 | cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1); |
167 | cur_line = atoi(yytext+2); | 168 | cur_line = atoi(yytext+2); |
168 | 169 | ||
170 | if (!source_file) { | ||
171 | source_file = xstrdup(cur_filename); | ||
172 | in_source_file = 1; | ||
173 | } else { | ||
174 | in_source_file = (strcmp(cur_filename, source_file) == 0); | ||
175 | } | ||
176 | |||
169 | goto repeat; | 177 | goto repeat; |
170 | } | 178 | } |
171 | 179 | ||
diff --git a/scripts/genksyms/lex.c_shipped b/scripts/genksyms/lex.lex.c_shipped index af4939041e4..0bf4157e616 100644 --- a/scripts/genksyms/lex.c_shipped +++ b/scripts/genksyms/lex.lex.c_shipped | |||
@@ -1,20 +1,10 @@ | |||
1 | #line 2 "scripts/genksyms/lex.c" | ||
2 | 1 | ||
3 | #line 4 "scripts/genksyms/lex.c" | 2 | #line 3 "scripts/genksyms/lex.lex.c_shipped" |
4 | 3 | ||
5 | #define YY_INT_ALIGNED short int | 4 | #define YY_INT_ALIGNED short int |
6 | 5 | ||
7 | /* A lexical scanner generated by flex */ | 6 | /* A lexical scanner generated by flex */ |
8 | 7 | ||
9 | /* %not-for-header */ | ||
10 | |||
11 | /* %if-c-only */ | ||
12 | /* %if-not-reentrant */ | ||
13 | |||
14 | /* %endif */ | ||
15 | /* %endif */ | ||
16 | /* %ok-for-header */ | ||
17 | |||
18 | #define FLEX_SCANNER | 8 | #define FLEX_SCANNER |
19 | #define YY_FLEX_MAJOR_VERSION 2 | 9 | #define YY_FLEX_MAJOR_VERSION 2 |
20 | #define YY_FLEX_MINOR_VERSION 5 | 10 | #define YY_FLEX_MINOR_VERSION 5 |
@@ -23,32 +13,16 @@ | |||
23 | #define FLEX_BETA | 13 | #define FLEX_BETA |
24 | #endif | 14 | #endif |
25 | 15 | ||
26 | /* %if-c++-only */ | ||
27 | /* %endif */ | ||
28 | |||
29 | /* %if-c-only */ | ||
30 | |||
31 | /* %endif */ | ||
32 | |||
33 | /* %if-c-only */ | ||
34 | |||
35 | /* %endif */ | ||
36 | |||
37 | /* First, we deal with platform-specific or compiler-specific issues. */ | 16 | /* First, we deal with platform-specific or compiler-specific issues. */ |
38 | 17 | ||
39 | /* begin standard C headers. */ | 18 | /* begin standard C headers. */ |
40 | /* %if-c-only */ | ||
41 | #include <stdio.h> | 19 | #include <stdio.h> |
42 | #include <string.h> | 20 | #include <string.h> |
43 | #include <errno.h> | 21 | #include <errno.h> |
44 | #include <stdlib.h> | 22 | #include <stdlib.h> |
45 | /* %endif */ | ||
46 | 23 | ||
47 | /* %if-tables-serialization */ | ||
48 | /* %endif */ | ||
49 | /* end standard C headers. */ | 24 | /* end standard C headers. */ |
50 | 25 | ||
51 | /* %if-c-or-c++ */ | ||
52 | /* flex integer type definitions */ | 26 | /* flex integer type definitions */ |
53 | 27 | ||
54 | #ifndef FLEXINT_H | 28 | #ifndef FLEXINT_H |
@@ -112,11 +86,6 @@ typedef unsigned int flex_uint32_t; | |||
112 | 86 | ||
113 | #endif /* ! FLEXINT_H */ | 87 | #endif /* ! FLEXINT_H */ |
114 | 88 | ||
115 | /* %endif */ | ||
116 | |||
117 | /* %if-c++-only */ | ||
118 | /* %endif */ | ||
119 | |||
120 | #ifdef __cplusplus | 89 | #ifdef __cplusplus |
121 | 90 | ||
122 | /* The "const" storage-class-modifier is valid. */ | 91 | /* The "const" storage-class-modifier is valid. */ |
@@ -138,13 +107,8 @@ typedef unsigned int flex_uint32_t; | |||
138 | #define yyconst | 107 | #define yyconst |
139 | #endif | 108 | #endif |
140 | 109 | ||
141 | /* %not-for-header */ | ||
142 | |||
143 | /* Returned upon end-of-file. */ | 110 | /* Returned upon end-of-file. */ |
144 | #define YY_NULL 0 | 111 | #define YY_NULL 0 |
145 | /* %ok-for-header */ | ||
146 | |||
147 | /* %not-for-header */ | ||
148 | 112 | ||
149 | /* Promotes a possibly negative, possibly signed char to an unsigned | 113 | /* Promotes a possibly negative, possibly signed char to an unsigned |
150 | * integer for use as an array index. If the signed char is negative, | 114 | * integer for use as an array index. If the signed char is negative, |
@@ -152,14 +116,6 @@ typedef unsigned int flex_uint32_t; | |||
152 | * double cast. | 116 | * double cast. |
153 | */ | 117 | */ |
154 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) | 118 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) |
155 | /* %ok-for-header */ | ||
156 | |||
157 | /* %if-reentrant */ | ||
158 | /* %endif */ | ||
159 | |||
160 | /* %if-not-reentrant */ | ||
161 | |||
162 | /* %endif */ | ||
163 | 119 | ||
164 | /* Enter a start condition. This macro really ought to take a parameter, | 120 | /* Enter a start condition. This macro really ought to take a parameter, |
165 | * but we do it the disgusting crufty way forced on us by the ()-less | 121 | * but we do it the disgusting crufty way forced on us by the ()-less |
@@ -196,15 +152,9 @@ typedef unsigned int flex_uint32_t; | |||
196 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | 152 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
197 | #endif | 153 | #endif |
198 | 154 | ||
199 | /* %if-not-reentrant */ | ||
200 | extern int yyleng; | 155 | extern int yyleng; |
201 | /* %endif */ | ||
202 | 156 | ||
203 | /* %if-c-only */ | ||
204 | /* %if-not-reentrant */ | ||
205 | extern FILE *yyin, *yyout; | 157 | extern FILE *yyin, *yyout; |
206 | /* %endif */ | ||
207 | /* %endif */ | ||
208 | 158 | ||
209 | #define EOB_ACT_CONTINUE_SCAN 0 | 159 | #define EOB_ACT_CONTINUE_SCAN 0 |
210 | #define EOB_ACT_END_OF_FILE 1 | 160 | #define EOB_ACT_END_OF_FILE 1 |
@@ -237,12 +187,7 @@ typedef size_t yy_size_t; | |||
237 | #define YY_STRUCT_YY_BUFFER_STATE | 187 | #define YY_STRUCT_YY_BUFFER_STATE |
238 | struct yy_buffer_state | 188 | struct yy_buffer_state |
239 | { | 189 | { |
240 | /* %if-c-only */ | ||
241 | FILE *yy_input_file; | 190 | FILE *yy_input_file; |
242 | /* %endif */ | ||
243 | |||
244 | /* %if-c++-only */ | ||
245 | /* %endif */ | ||
246 | 191 | ||
247 | char *yy_ch_buf; /* input buffer */ | 192 | char *yy_ch_buf; /* input buffer */ |
248 | char *yy_buf_pos; /* current position in input buffer */ | 193 | char *yy_buf_pos; /* current position in input buffer */ |
@@ -303,19 +248,10 @@ struct yy_buffer_state | |||
303 | }; | 248 | }; |
304 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ | 249 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ |
305 | 250 | ||
306 | /* %if-c-only Standard (non-C++) definition */ | ||
307 | /* %not-for-header */ | ||
308 | |||
309 | /* %if-not-reentrant */ | ||
310 | |||
311 | /* Stack of input buffers. */ | 251 | /* Stack of input buffers. */ |
312 | static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ | 252 | static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ |
313 | static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ | 253 | static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ |
314 | static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ | 254 | static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ |
315 | /* %endif */ | ||
316 | /* %ok-for-header */ | ||
317 | |||
318 | /* %endif */ | ||
319 | 255 | ||
320 | /* We provide macros for accessing buffer states in case in the | 256 | /* We provide macros for accessing buffer states in case in the |
321 | * future we want to put the buffer states in a more general | 257 | * future we want to put the buffer states in a more general |
@@ -332,11 +268,6 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ | |||
332 | */ | 268 | */ |
333 | #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] | 269 | #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] |
334 | 270 | ||
335 | /* %if-c-only Standard (non-C++) definition */ | ||
336 | |||
337 | /* %if-not-reentrant */ | ||
338 | /* %not-for-header */ | ||
339 | |||
340 | /* yy_hold_char holds the character lost when yytext is formed. */ | 271 | /* yy_hold_char holds the character lost when yytext is formed. */ |
341 | static char yy_hold_char; | 272 | static char yy_hold_char; |
342 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ | 273 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ |
@@ -351,9 +282,6 @@ static int yy_start = 0; /* start state number */ | |||
351 | * instead of setting up a fresh yyin. A bit of a hack ... | 282 | * instead of setting up a fresh yyin. A bit of a hack ... |
352 | */ | 283 | */ |
353 | static int yy_did_buffer_switch_on_eof; | 284 | static int yy_did_buffer_switch_on_eof; |
354 | /* %ok-for-header */ | ||
355 | |||
356 | /* %endif */ | ||
357 | 285 | ||
358 | void yyrestart (FILE *input_file ); | 286 | void yyrestart (FILE *input_file ); |
359 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); | 287 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); |
@@ -373,8 +301,6 @@ YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); | |||
373 | YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); | 301 | YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); |
374 | YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); | 302 | YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); |
375 | 303 | ||
376 | /* %endif */ | ||
377 | |||
378 | void *yyalloc (yy_size_t ); | 304 | void *yyalloc (yy_size_t ); |
379 | void *yyrealloc (void *,yy_size_t ); | 305 | void *yyrealloc (void *,yy_size_t ); |
380 | void yyfree (void * ); | 306 | void yyfree (void * ); |
@@ -403,14 +329,11 @@ void yyfree (void * ); | |||
403 | 329 | ||
404 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) | 330 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) |
405 | 331 | ||
406 | /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ | ||
407 | /* Begin user sect3 */ | 332 | /* Begin user sect3 */ |
408 | 333 | ||
409 | #define yywrap(n) 1 | 334 | #define yywrap(n) 1 |
410 | #define YY_SKIP_YYWRAP | 335 | #define YY_SKIP_YYWRAP |
411 | 336 | ||
412 | #define FLEX_DEBUG | ||
413 | |||
414 | typedef unsigned char YY_CHAR; | 337 | typedef unsigned char YY_CHAR; |
415 | 338 | ||
416 | FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; | 339 | FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; |
@@ -424,28 +347,21 @@ int yylineno = 1; | |||
424 | extern char *yytext; | 347 | extern char *yytext; |
425 | #define yytext_ptr yytext | 348 | #define yytext_ptr yytext |
426 | 349 | ||
427 | /* %if-c-only Standard (non-C++) definition */ | ||
428 | |||
429 | static yy_state_type yy_get_previous_state (void ); | 350 | static yy_state_type yy_get_previous_state (void ); |
430 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); | 351 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); |
431 | static int yy_get_next_buffer (void ); | 352 | static int yy_get_next_buffer (void ); |
432 | static void yy_fatal_error (yyconst char msg[] ); | 353 | static void yy_fatal_error (yyconst char msg[] ); |
433 | 354 | ||
434 | /* %endif */ | ||
435 | |||
436 | /* Done after the current pattern has been matched and before the | 355 | /* Done after the current pattern has been matched and before the |
437 | * corresponding action - sets up yytext. | 356 | * corresponding action - sets up yytext. |
438 | */ | 357 | */ |
439 | #define YY_DO_BEFORE_ACTION \ | 358 | #define YY_DO_BEFORE_ACTION \ |
440 | (yytext_ptr) = yy_bp; \ | 359 | (yytext_ptr) = yy_bp; \ |
441 | /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\ | ||
442 | yyleng = (size_t) (yy_cp - yy_bp); \ | 360 | yyleng = (size_t) (yy_cp - yy_bp); \ |
443 | (yy_hold_char) = *yy_cp; \ | 361 | (yy_hold_char) = *yy_cp; \ |
444 | *yy_cp = '\0'; \ | 362 | *yy_cp = '\0'; \ |
445 | /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\ | ||
446 | (yy_c_buf_p) = yy_cp; | 363 | (yy_c_buf_p) = yy_cp; |
447 | 364 | ||
448 | /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ | ||
449 | #define YY_NUM_RULES 13 | 365 | #define YY_NUM_RULES 13 |
450 | #define YY_END_OF_BUFFER 14 | 366 | #define YY_END_OF_BUFFER 14 |
451 | /* This struct is not used in this scanner, | 367 | /* This struct is not used in this scanner, |
@@ -610,13 +526,7 @@ static yy_state_type yy_last_accepting_state; | |||
610 | static char *yy_last_accepting_cpos; | 526 | static char *yy_last_accepting_cpos; |
611 | 527 | ||
612 | extern int yy_flex_debug; | 528 | extern int yy_flex_debug; |
613 | int yy_flex_debug = 1; | 529 | int yy_flex_debug = 0; |
614 | |||
615 | static yyconst flex_int16_t yy_rule_linenum[13] = | ||
616 | { 0, | ||
617 | 67, 68, 69, 72, 75, 76, 77, 83, 84, 85, | ||
618 | 87, 90 | ||
619 | } ; | ||
620 | 530 | ||
621 | /* The intent behind this definition is that it'll catch | 531 | /* The intent behind this definition is that it'll catch |
622 | * any uses of REJECT which flex missed. | 532 | * any uses of REJECT which flex missed. |
@@ -626,7 +536,6 @@ static yyconst flex_int16_t yy_rule_linenum[13] = | |||
626 | #define YY_MORE_ADJ 0 | 536 | #define YY_MORE_ADJ 0 |
627 | #define YY_RESTORE_YY_MORE_OFFSET | 537 | #define YY_RESTORE_YY_MORE_OFFSET |
628 | char *yytext; | 538 | char *yytext; |
629 | #line 1 "scripts/genksyms/lex.l" | ||
630 | /* Lexical analysis for genksyms. | 539 | /* Lexical analysis for genksyms. |
631 | Copyright 1996, 1997 Linux International. | 540 | Copyright 1996, 1997 Linux International. |
632 | 541 | ||
@@ -648,7 +557,6 @@ char *yytext; | |||
648 | You should have received a copy of the GNU General Public License | 557 | You should have received a copy of the GNU General Public License |
649 | along with this program; if not, write to the Free Software Foundation, | 558 | along with this program; if not, write to the Free Software Foundation, |
650 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 559 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
651 | #line 25 "scripts/genksyms/lex.l" | ||
652 | 560 | ||
653 | #include <limits.h> | 561 | #include <limits.h> |
654 | #include <stdlib.h> | 562 | #include <stdlib.h> |
@@ -656,7 +564,7 @@ char *yytext; | |||
656 | #include <ctype.h> | 564 | #include <ctype.h> |
657 | 565 | ||
658 | #include "genksyms.h" | 566 | #include "genksyms.h" |
659 | #include "parse.h" | 567 | #include "parse.tab.h" |
660 | 568 | ||
661 | /* We've got a two-level lexer here. We let flex do basic tokenization | 569 | /* We've got a two-level lexer here. We let flex do basic tokenization |
662 | and then we categorize those basic tokens in the second stage. */ | 570 | and then we categorize those basic tokens in the second stage. */ |
@@ -664,7 +572,6 @@ char *yytext; | |||
664 | 572 | ||
665 | /* We don't do multiple input files. */ | 573 | /* We don't do multiple input files. */ |
666 | #define YY_NO_INPUT 1 | 574 | #define YY_NO_INPUT 1 |
667 | #line 668 "scripts/genksyms/lex.c" | ||
668 | 575 | ||
669 | #define INITIAL 0 | 576 | #define INITIAL 0 |
670 | 577 | ||
@@ -673,28 +580,15 @@ char *yytext; | |||
673 | * down here because we want the user's section 1 to have been scanned first. | 580 | * down here because we want the user's section 1 to have been scanned first. |
674 | * The user has a chance to override it with an option. | 581 | * The user has a chance to override it with an option. |
675 | */ | 582 | */ |
676 | /* %if-c-only */ | ||
677 | #include <unistd.h> | 583 | #include <unistd.h> |
678 | /* %endif */ | ||
679 | /* %if-c++-only */ | ||
680 | /* %endif */ | ||
681 | #endif | 584 | #endif |
682 | 585 | ||
683 | #ifndef YY_EXTRA_TYPE | 586 | #ifndef YY_EXTRA_TYPE |
684 | #define YY_EXTRA_TYPE void * | 587 | #define YY_EXTRA_TYPE void * |
685 | #endif | 588 | #endif |
686 | 589 | ||
687 | /* %if-c-only Reentrant structure and macros (non-C++). */ | ||
688 | /* %if-reentrant */ | ||
689 | /* %if-c-only */ | ||
690 | |||
691 | static int yy_init_globals (void ); | 590 | static int yy_init_globals (void ); |
692 | 591 | ||
693 | /* %endif */ | ||
694 | /* %if-reentrant */ | ||
695 | /* %endif */ | ||
696 | /* %endif End reentrant structures and macros. */ | ||
697 | |||
698 | /* Accessor methods to globals. | 592 | /* Accessor methods to globals. |
699 | These are made visible to non-reentrant scanners for convenience. */ | 593 | These are made visible to non-reentrant scanners for convenience. */ |
700 | 594 | ||
@@ -724,9 +618,6 @@ int yyget_lineno (void ); | |||
724 | 618 | ||
725 | void yyset_lineno (int line_number ); | 619 | void yyset_lineno (int line_number ); |
726 | 620 | ||
727 | /* %if-bison-bridge */ | ||
728 | /* %endif */ | ||
729 | |||
730 | /* Macros after this point can all be overridden by user definitions in | 621 | /* Macros after this point can all be overridden by user definitions in |
731 | * section 1. | 622 | * section 1. |
732 | */ | 623 | */ |
@@ -739,14 +630,8 @@ extern int yywrap (void ); | |||
739 | #endif | 630 | #endif |
740 | #endif | 631 | #endif |
741 | 632 | ||
742 | /* %not-for-header */ | ||
743 | |||
744 | static void yyunput (int c,char *buf_ptr ); | 633 | static void yyunput (int c,char *buf_ptr ); |
745 | 634 | ||
746 | /* %ok-for-header */ | ||
747 | |||
748 | /* %endif */ | ||
749 | |||
750 | #ifndef yytext_ptr | 635 | #ifndef yytext_ptr |
751 | static void yy_flex_strncpy (char *,yyconst char *,int ); | 636 | static void yy_flex_strncpy (char *,yyconst char *,int ); |
752 | #endif | 637 | #endif |
@@ -756,23 +641,15 @@ static int yy_flex_strlen (yyconst char * ); | |||
756 | #endif | 641 | #endif |
757 | 642 | ||
758 | #ifndef YY_NO_INPUT | 643 | #ifndef YY_NO_INPUT |
759 | /* %if-c-only Standard (non-C++) definition */ | ||
760 | /* %not-for-header */ | ||
761 | 644 | ||
762 | #ifdef __cplusplus | 645 | #ifdef __cplusplus |
763 | static int yyinput (void ); | 646 | static int yyinput (void ); |
764 | #else | 647 | #else |
765 | static int input (void ); | 648 | static int input (void ); |
766 | #endif | 649 | #endif |
767 | /* %ok-for-header */ | ||
768 | 650 | ||
769 | /* %endif */ | ||
770 | #endif | 651 | #endif |
771 | 652 | ||
772 | /* %if-c-only */ | ||
773 | |||
774 | /* %endif */ | ||
775 | |||
776 | /* Amount of stuff to slurp up with each read. */ | 653 | /* Amount of stuff to slurp up with each read. */ |
777 | #ifndef YY_READ_BUF_SIZE | 654 | #ifndef YY_READ_BUF_SIZE |
778 | #define YY_READ_BUF_SIZE 8192 | 655 | #define YY_READ_BUF_SIZE 8192 |
@@ -780,14 +657,10 @@ static int input (void ); | |||
780 | 657 | ||
781 | /* Copy whatever the last rule matched to the standard output. */ | 658 | /* Copy whatever the last rule matched to the standard output. */ |
782 | #ifndef ECHO | 659 | #ifndef ECHO |
783 | /* %if-c-only Standard (non-C++) definition */ | ||
784 | /* This used to be an fputs(), but since the string might contain NUL's, | 660 | /* This used to be an fputs(), but since the string might contain NUL's, |
785 | * we now use fwrite(). | 661 | * we now use fwrite(). |
786 | */ | 662 | */ |
787 | #define ECHO fwrite( yytext, yyleng, 1, yyout ) | 663 | #define ECHO fwrite( yytext, yyleng, 1, yyout ) |
788 | /* %endif */ | ||
789 | /* %if-c++-only C++ definition */ | ||
790 | /* %endif */ | ||
791 | #endif | 664 | #endif |
792 | 665 | ||
793 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | 666 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
@@ -795,7 +668,6 @@ static int input (void ); | |||
795 | */ | 668 | */ |
796 | #ifndef YY_INPUT | 669 | #ifndef YY_INPUT |
797 | #define YY_INPUT(buf,result,max_size) \ | 670 | #define YY_INPUT(buf,result,max_size) \ |
798 | /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ | ||
799 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ | 671 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
800 | { \ | 672 | { \ |
801 | int c = '*'; \ | 673 | int c = '*'; \ |
@@ -824,8 +696,6 @@ static int input (void ); | |||
824 | } \ | 696 | } \ |
825 | }\ | 697 | }\ |
826 | \ | 698 | \ |
827 | /* %if-c++-only C++ definition \ */\ | ||
828 | /* %endif */ | ||
829 | 699 | ||
830 | #endif | 700 | #endif |
831 | 701 | ||
@@ -844,39 +714,20 @@ static int input (void ); | |||
844 | 714 | ||
845 | /* Report a fatal error. */ | 715 | /* Report a fatal error. */ |
846 | #ifndef YY_FATAL_ERROR | 716 | #ifndef YY_FATAL_ERROR |
847 | /* %if-c-only */ | ||
848 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) | 717 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) |
849 | /* %endif */ | ||
850 | /* %if-c++-only */ | ||
851 | /* %endif */ | ||
852 | #endif | 718 | #endif |
853 | 719 | ||
854 | /* %if-tables-serialization structures and prototypes */ | ||
855 | /* %not-for-header */ | ||
856 | |||
857 | /* %ok-for-header */ | ||
858 | |||
859 | /* %not-for-header */ | ||
860 | |||
861 | /* %tables-yydmap generated elements */ | ||
862 | /* %endif */ | ||
863 | /* end tables serialization structures and prototypes */ | 720 | /* end tables serialization structures and prototypes */ |
864 | 721 | ||
865 | /* %ok-for-header */ | ||
866 | |||
867 | /* Default declaration of generated scanner - a define so the user can | 722 | /* Default declaration of generated scanner - a define so the user can |
868 | * easily add parameters. | 723 | * easily add parameters. |
869 | */ | 724 | */ |
870 | #ifndef YY_DECL | 725 | #ifndef YY_DECL |
871 | #define YY_DECL_IS_OURS 1 | 726 | #define YY_DECL_IS_OURS 1 |
872 | /* %if-c-only Standard (non-C++) definition */ | ||
873 | 727 | ||
874 | extern int yylex (void); | 728 | extern int yylex (void); |
875 | 729 | ||
876 | #define YY_DECL int yylex (void) | 730 | #define YY_DECL int yylex (void) |
877 | /* %endif */ | ||
878 | /* %if-c++-only C++ definition */ | ||
879 | /* %endif */ | ||
880 | #endif /* !YY_DECL */ | 731 | #endif /* !YY_DECL */ |
881 | 732 | ||
882 | /* Code executed at the beginning of each rule, after yytext and yyleng | 733 | /* Code executed at the beginning of each rule, after yytext and yyleng |
@@ -891,15 +742,12 @@ extern int yylex (void); | |||
891 | #define YY_BREAK break; | 742 | #define YY_BREAK break; |
892 | #endif | 743 | #endif |
893 | 744 | ||
894 | /* %% [6.0] YY_RULE_SETUP definition goes here */ | ||
895 | #define YY_RULE_SETUP \ | 745 | #define YY_RULE_SETUP \ |
896 | if ( yyleng > 0 ) \ | 746 | if ( yyleng > 0 ) \ |
897 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ | 747 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ |
898 | (yytext[yyleng - 1] == '\n'); \ | 748 | (yytext[yyleng - 1] == '\n'); \ |
899 | YY_USER_ACTION | 749 | YY_USER_ACTION |
900 | 750 | ||
901 | /* %not-for-header */ | ||
902 | |||
903 | /** The main scanner function which does all the work. | 751 | /** The main scanner function which does all the work. |
904 | */ | 752 | */ |
905 | YY_DECL | 753 | YY_DECL |
@@ -908,13 +756,7 @@ YY_DECL | |||
908 | register char *yy_cp, *yy_bp; | 756 | register char *yy_cp, *yy_bp; |
909 | register int yy_act; | 757 | register int yy_act; |
910 | 758 | ||
911 | /* %% [7.0] user's declarations go here */ | ||
912 | #line 63 "scripts/genksyms/lex.l" | ||
913 | |||
914 | |||
915 | |||
916 | /* Keep track of our location in the original source files. */ | 759 | /* Keep track of our location in the original source files. */ |
917 | #line 918 "scripts/genksyms/lex.c" | ||
918 | 760 | ||
919 | if ( !(yy_init) ) | 761 | if ( !(yy_init) ) |
920 | { | 762 | { |
@@ -928,18 +770,10 @@ YY_DECL | |||
928 | (yy_start) = 1; /* first start state */ | 770 | (yy_start) = 1; /* first start state */ |
929 | 771 | ||
930 | if ( ! yyin ) | 772 | if ( ! yyin ) |
931 | /* %if-c-only */ | ||
932 | yyin = stdin; | 773 | yyin = stdin; |
933 | /* %endif */ | ||
934 | /* %if-c++-only */ | ||
935 | /* %endif */ | ||
936 | 774 | ||
937 | if ( ! yyout ) | 775 | if ( ! yyout ) |
938 | /* %if-c-only */ | ||
939 | yyout = stdout; | 776 | yyout = stdout; |
940 | /* %endif */ | ||
941 | /* %if-c++-only */ | ||
942 | /* %endif */ | ||
943 | 777 | ||
944 | if ( ! YY_CURRENT_BUFFER ) { | 778 | if ( ! YY_CURRENT_BUFFER ) { |
945 | yyensure_buffer_stack (); | 779 | yyensure_buffer_stack (); |
@@ -952,7 +786,6 @@ YY_DECL | |||
952 | 786 | ||
953 | while ( 1 ) /* loops until end-of-file is reached */ | 787 | while ( 1 ) /* loops until end-of-file is reached */ |
954 | { | 788 | { |
955 | /* %% [8.0] yymore()-related code goes here */ | ||
956 | yy_cp = (yy_c_buf_p); | 789 | yy_cp = (yy_c_buf_p); |
957 | 790 | ||
958 | /* Support of yytext. */ | 791 | /* Support of yytext. */ |
@@ -963,7 +796,6 @@ YY_DECL | |||
963 | */ | 796 | */ |
964 | yy_bp = yy_cp; | 797 | yy_bp = yy_cp; |
965 | 798 | ||
966 | /* %% [9.0] code to set up and find next match goes here */ | ||
967 | yy_current_state = (yy_start); | 799 | yy_current_state = (yy_start); |
968 | yy_current_state += YY_AT_BOL(); | 800 | yy_current_state += YY_AT_BOL(); |
969 | yy_match: | 801 | yy_match: |
@@ -987,7 +819,6 @@ yy_match: | |||
987 | while ( yy_base[yy_current_state] != 266 ); | 819 | while ( yy_base[yy_current_state] != 266 ); |
988 | 820 | ||
989 | yy_find_action: | 821 | yy_find_action: |
990 | /* %% [10.0] code to find the action number goes here */ | ||
991 | yy_act = yy_accept[yy_current_state]; | 822 | yy_act = yy_accept[yy_current_state]; |
992 | if ( yy_act == 0 ) | 823 | if ( yy_act == 0 ) |
993 | { /* have to back up */ | 824 | { /* have to back up */ |
@@ -998,30 +829,10 @@ yy_find_action: | |||
998 | 829 | ||
999 | YY_DO_BEFORE_ACTION; | 830 | YY_DO_BEFORE_ACTION; |
1000 | 831 | ||
1001 | /* %% [11.0] code for yylineno update goes here */ | ||
1002 | |||
1003 | do_action: /* This label is used only to access EOF actions. */ | 832 | do_action: /* This label is used only to access EOF actions. */ |
1004 | 833 | ||
1005 | /* %% [12.0] debug code goes here */ | ||
1006 | if ( yy_flex_debug ) | ||
1007 | { | ||
1008 | if ( yy_act == 0 ) | ||
1009 | fprintf( stderr, "--scanner backing up\n" ); | ||
1010 | else if ( yy_act < 13 ) | ||
1011 | fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", | ||
1012 | (long)yy_rule_linenum[yy_act], yytext ); | ||
1013 | else if ( yy_act == 13 ) | ||
1014 | fprintf( stderr, "--accepting default rule (\"%s\")\n", | ||
1015 | yytext ); | ||
1016 | else if ( yy_act == 14 ) | ||
1017 | fprintf( stderr, "--(end of buffer or a NUL)\n" ); | ||
1018 | else | ||
1019 | fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); | ||
1020 | } | ||
1021 | |||
1022 | switch ( yy_act ) | 834 | switch ( yy_act ) |
1023 | { /* beginning of action switch */ | 835 | { /* beginning of action switch */ |
1024 | /* %% [13.0] actions go here */ | ||
1025 | case 0: /* must back up */ | 836 | case 0: /* must back up */ |
1026 | /* undo the effects of YY_DO_BEFORE_ACTION */ | 837 | /* undo the effects of YY_DO_BEFORE_ACTION */ |
1027 | *yy_cp = (yy_hold_char); | 838 | *yy_cp = (yy_hold_char); |
@@ -1032,42 +843,35 @@ do_action: /* This label is used only to access EOF actions. */ | |||
1032 | case 1: | 843 | case 1: |
1033 | /* rule 1 can match eol */ | 844 | /* rule 1 can match eol */ |
1034 | YY_RULE_SETUP | 845 | YY_RULE_SETUP |
1035 | #line 67 "scripts/genksyms/lex.l" | ||
1036 | return FILENAME; | 846 | return FILENAME; |
1037 | YY_BREAK | 847 | YY_BREAK |
1038 | case 2: | 848 | case 2: |
1039 | /* rule 2 can match eol */ | 849 | /* rule 2 can match eol */ |
1040 | YY_RULE_SETUP | 850 | YY_RULE_SETUP |
1041 | #line 68 "scripts/genksyms/lex.l" | ||
1042 | cur_line++; | 851 | cur_line++; |
1043 | YY_BREAK | 852 | YY_BREAK |
1044 | case 3: | 853 | case 3: |
1045 | /* rule 3 can match eol */ | 854 | /* rule 3 can match eol */ |
1046 | YY_RULE_SETUP | 855 | YY_RULE_SETUP |
1047 | #line 69 "scripts/genksyms/lex.l" | ||
1048 | cur_line++; | 856 | cur_line++; |
1049 | YY_BREAK | 857 | YY_BREAK |
1050 | /* Ignore all other whitespace. */ | 858 | /* Ignore all other whitespace. */ |
1051 | case 4: | 859 | case 4: |
1052 | YY_RULE_SETUP | 860 | YY_RULE_SETUP |
1053 | #line 72 "scripts/genksyms/lex.l" | ||
1054 | ; | 861 | ; |
1055 | YY_BREAK | 862 | YY_BREAK |
1056 | case 5: | 863 | case 5: |
1057 | /* rule 5 can match eol */ | 864 | /* rule 5 can match eol */ |
1058 | YY_RULE_SETUP | 865 | YY_RULE_SETUP |
1059 | #line 75 "scripts/genksyms/lex.l" | ||
1060 | return STRING; | 866 | return STRING; |
1061 | YY_BREAK | 867 | YY_BREAK |
1062 | case 6: | 868 | case 6: |
1063 | /* rule 6 can match eol */ | 869 | /* rule 6 can match eol */ |
1064 | YY_RULE_SETUP | 870 | YY_RULE_SETUP |
1065 | #line 76 "scripts/genksyms/lex.l" | ||
1066 | return CHAR; | 871 | return CHAR; |
1067 | YY_BREAK | 872 | YY_BREAK |
1068 | case 7: | 873 | case 7: |
1069 | YY_RULE_SETUP | 874 | YY_RULE_SETUP |
1070 | #line 77 "scripts/genksyms/lex.l" | ||
1071 | return IDENT; | 875 | return IDENT; |
1072 | YY_BREAK | 876 | YY_BREAK |
1073 | /* The Pedant requires that the other C multi-character tokens be | 877 | /* The Pedant requires that the other C multi-character tokens be |
@@ -1076,36 +880,29 @@ return IDENT; | |||
1076 | around them properly. */ | 880 | around them properly. */ |
1077 | case 8: | 881 | case 8: |
1078 | YY_RULE_SETUP | 882 | YY_RULE_SETUP |
1079 | #line 83 "scripts/genksyms/lex.l" | ||
1080 | return OTHER; | 883 | return OTHER; |
1081 | YY_BREAK | 884 | YY_BREAK |
1082 | case 9: | 885 | case 9: |
1083 | YY_RULE_SETUP | 886 | YY_RULE_SETUP |
1084 | #line 84 "scripts/genksyms/lex.l" | ||
1085 | return INT; | 887 | return INT; |
1086 | YY_BREAK | 888 | YY_BREAK |
1087 | case 10: | 889 | case 10: |
1088 | YY_RULE_SETUP | 890 | YY_RULE_SETUP |
1089 | #line 85 "scripts/genksyms/lex.l" | ||
1090 | return REAL; | 891 | return REAL; |
1091 | YY_BREAK | 892 | YY_BREAK |
1092 | case 11: | 893 | case 11: |
1093 | YY_RULE_SETUP | 894 | YY_RULE_SETUP |
1094 | #line 87 "scripts/genksyms/lex.l" | ||
1095 | return DOTS; | 895 | return DOTS; |
1096 | YY_BREAK | 896 | YY_BREAK |
1097 | /* All other tokens are single characters. */ | 897 | /* All other tokens are single characters. */ |
1098 | case 12: | 898 | case 12: |
1099 | YY_RULE_SETUP | 899 | YY_RULE_SETUP |
1100 | #line 90 "scripts/genksyms/lex.l" | ||
1101 | return yytext[0]; | 900 | return yytext[0]; |
1102 | YY_BREAK | 901 | YY_BREAK |
1103 | case 13: | 902 | case 13: |
1104 | YY_RULE_SETUP | 903 | YY_RULE_SETUP |
1105 | #line 93 "scripts/genksyms/lex.l" | ||
1106 | ECHO; | 904 | ECHO; |
1107 | YY_BREAK | 905 | YY_BREAK |
1108 | #line 1109 "scripts/genksyms/lex.c" | ||
1109 | case YY_STATE_EOF(INITIAL): | 906 | case YY_STATE_EOF(INITIAL): |
1110 | yyterminate(); | 907 | yyterminate(); |
1111 | 908 | ||
@@ -1172,7 +969,6 @@ case YY_STATE_EOF(INITIAL): | |||
1172 | 969 | ||
1173 | else | 970 | else |
1174 | { | 971 | { |
1175 | /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ | ||
1176 | yy_cp = (yy_c_buf_p); | 972 | yy_cp = (yy_c_buf_p); |
1177 | goto yy_find_action; | 973 | goto yy_find_action; |
1178 | } | 974 | } |
@@ -1238,14 +1034,6 @@ case YY_STATE_EOF(INITIAL): | |||
1238 | } /* end of action switch */ | 1034 | } /* end of action switch */ |
1239 | } /* end of scanning one token */ | 1035 | } /* end of scanning one token */ |
1240 | } /* end of yylex */ | 1036 | } /* end of yylex */ |
1241 | /* %ok-for-header */ | ||
1242 | |||
1243 | /* %if-c++-only */ | ||
1244 | /* %not-for-header */ | ||
1245 | |||
1246 | /* %ok-for-header */ | ||
1247 | |||
1248 | /* %endif */ | ||
1249 | 1037 | ||
1250 | /* yy_get_next_buffer - try to read in a new buffer | 1038 | /* yy_get_next_buffer - try to read in a new buffer |
1251 | * | 1039 | * |
@@ -1254,11 +1042,7 @@ case YY_STATE_EOF(INITIAL): | |||
1254 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position | 1042 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
1255 | * EOB_ACT_END_OF_FILE - end of file | 1043 | * EOB_ACT_END_OF_FILE - end of file |
1256 | */ | 1044 | */ |
1257 | /* %if-c-only */ | ||
1258 | static int yy_get_next_buffer (void) | 1045 | static int yy_get_next_buffer (void) |
1259 | /* %endif */ | ||
1260 | /* %if-c++-only */ | ||
1261 | /* %endif */ | ||
1262 | { | 1046 | { |
1263 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; | 1047 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; |
1264 | register char *source = (yytext_ptr); | 1048 | register char *source = (yytext_ptr); |
@@ -1392,24 +1176,16 @@ static int yy_get_next_buffer (void) | |||
1392 | 1176 | ||
1393 | /* yy_get_previous_state - get the state just before the EOB char was reached */ | 1177 | /* yy_get_previous_state - get the state just before the EOB char was reached */ |
1394 | 1178 | ||
1395 | /* %if-c-only */ | ||
1396 | /* %not-for-header */ | ||
1397 | |||
1398 | static yy_state_type yy_get_previous_state (void) | 1179 | static yy_state_type yy_get_previous_state (void) |
1399 | /* %endif */ | ||
1400 | /* %if-c++-only */ | ||
1401 | /* %endif */ | ||
1402 | { | 1180 | { |
1403 | register yy_state_type yy_current_state; | 1181 | register yy_state_type yy_current_state; |
1404 | register char *yy_cp; | 1182 | register char *yy_cp; |
1405 | 1183 | ||
1406 | /* %% [15.0] code to get the start state into yy_current_state goes here */ | ||
1407 | yy_current_state = (yy_start); | 1184 | yy_current_state = (yy_start); |
1408 | yy_current_state += YY_AT_BOL(); | 1185 | yy_current_state += YY_AT_BOL(); |
1409 | 1186 | ||
1410 | for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) | 1187 | for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) |
1411 | { | 1188 | { |
1412 | /* %% [16.0] code to find the next state goes here */ | ||
1413 | register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); | 1189 | register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); |
1414 | if ( yy_accept[yy_current_state] ) | 1190 | if ( yy_accept[yy_current_state] ) |
1415 | { | 1191 | { |
@@ -1433,15 +1209,10 @@ static int yy_get_next_buffer (void) | |||
1433 | * synopsis | 1209 | * synopsis |
1434 | * next_state = yy_try_NUL_trans( current_state ); | 1210 | * next_state = yy_try_NUL_trans( current_state ); |
1435 | */ | 1211 | */ |
1436 | /* %if-c-only */ | ||
1437 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) | 1212 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) |
1438 | /* %endif */ | ||
1439 | /* %if-c++-only */ | ||
1440 | /* %endif */ | ||
1441 | { | 1213 | { |
1442 | register int yy_is_jam; | 1214 | register int yy_is_jam; |
1443 | /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ | 1215 | register char *yy_cp = (yy_c_buf_p); |
1444 | register char *yy_cp = (yy_c_buf_p); | ||
1445 | 1216 | ||
1446 | register YY_CHAR yy_c = 1; | 1217 | register YY_CHAR yy_c = 1; |
1447 | if ( yy_accept[yy_current_state] ) | 1218 | if ( yy_accept[yy_current_state] ) |
@@ -1461,12 +1232,7 @@ static int yy_get_next_buffer (void) | |||
1461 | return yy_is_jam ? 0 : yy_current_state; | 1232 | return yy_is_jam ? 0 : yy_current_state; |
1462 | } | 1233 | } |
1463 | 1234 | ||
1464 | /* %if-c-only */ | ||
1465 | |||
1466 | static void yyunput (int c, register char * yy_bp ) | 1235 | static void yyunput (int c, register char * yy_bp ) |
1467 | /* %endif */ | ||
1468 | /* %if-c++-only */ | ||
1469 | /* %endif */ | ||
1470 | { | 1236 | { |
1471 | register char *yy_cp; | 1237 | register char *yy_cp; |
1472 | 1238 | ||
@@ -1498,17 +1264,11 @@ static int yy_get_next_buffer (void) | |||
1498 | 1264 | ||
1499 | *--yy_cp = (char) c; | 1265 | *--yy_cp = (char) c; |
1500 | 1266 | ||
1501 | /* %% [18.0] update yylineno here */ | ||
1502 | |||
1503 | (yytext_ptr) = yy_bp; | 1267 | (yytext_ptr) = yy_bp; |
1504 | (yy_hold_char) = *yy_cp; | 1268 | (yy_hold_char) = *yy_cp; |
1505 | (yy_c_buf_p) = yy_cp; | 1269 | (yy_c_buf_p) = yy_cp; |
1506 | } | 1270 | } |
1507 | /* %if-c-only */ | ||
1508 | |||
1509 | /* %endif */ | ||
1510 | 1271 | ||
1511 | /* %if-c-only */ | ||
1512 | #ifndef YY_NO_INPUT | 1272 | #ifndef YY_NO_INPUT |
1513 | #ifdef __cplusplus | 1273 | #ifdef __cplusplus |
1514 | static int yyinput (void) | 1274 | static int yyinput (void) |
@@ -1516,9 +1276,6 @@ static int yy_get_next_buffer (void) | |||
1516 | static int input (void) | 1276 | static int input (void) |
1517 | #endif | 1277 | #endif |
1518 | 1278 | ||
1519 | /* %endif */ | ||
1520 | /* %if-c++-only */ | ||
1521 | /* %endif */ | ||
1522 | { | 1279 | { |
1523 | int c; | 1280 | int c; |
1524 | 1281 | ||
@@ -1582,25 +1339,18 @@ static int yy_get_next_buffer (void) | |||
1582 | *(yy_c_buf_p) = '\0'; /* preserve yytext */ | 1339 | *(yy_c_buf_p) = '\0'; /* preserve yytext */ |
1583 | (yy_hold_char) = *++(yy_c_buf_p); | 1340 | (yy_hold_char) = *++(yy_c_buf_p); |
1584 | 1341 | ||
1585 | /* %% [19.0] update BOL and yylineno */ | ||
1586 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); | 1342 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); |
1587 | 1343 | ||
1588 | return c; | 1344 | return c; |
1589 | } | 1345 | } |
1590 | /* %if-c-only */ | ||
1591 | #endif /* ifndef YY_NO_INPUT */ | 1346 | #endif /* ifndef YY_NO_INPUT */ |
1592 | /* %endif */ | ||
1593 | 1347 | ||
1594 | /** Immediately switch to a different input stream. | 1348 | /** Immediately switch to a different input stream. |
1595 | * @param input_file A readable stream. | 1349 | * @param input_file A readable stream. |
1596 | * | 1350 | * |
1597 | * @note This function does not reset the start condition to @c INITIAL . | 1351 | * @note This function does not reset the start condition to @c INITIAL . |
1598 | */ | 1352 | */ |
1599 | /* %if-c-only */ | ||
1600 | void yyrestart (FILE * input_file ) | 1353 | void yyrestart (FILE * input_file ) |
1601 | /* %endif */ | ||
1602 | /* %if-c++-only */ | ||
1603 | /* %endif */ | ||
1604 | { | 1354 | { |
1605 | 1355 | ||
1606 | if ( ! YY_CURRENT_BUFFER ){ | 1356 | if ( ! YY_CURRENT_BUFFER ){ |
@@ -1617,11 +1367,7 @@ static int yy_get_next_buffer (void) | |||
1617 | * @param new_buffer The new input buffer. | 1367 | * @param new_buffer The new input buffer. |
1618 | * | 1368 | * |
1619 | */ | 1369 | */ |
1620 | /* %if-c-only */ | ||
1621 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) | 1370 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) |
1622 | /* %endif */ | ||
1623 | /* %if-c++-only */ | ||
1624 | /* %endif */ | ||
1625 | { | 1371 | { |
1626 | 1372 | ||
1627 | /* TODO. We should be able to replace this entire function body | 1373 | /* TODO. We should be able to replace this entire function body |
@@ -1652,11 +1398,7 @@ static int yy_get_next_buffer (void) | |||
1652 | (yy_did_buffer_switch_on_eof) = 1; | 1398 | (yy_did_buffer_switch_on_eof) = 1; |
1653 | } | 1399 | } |
1654 | 1400 | ||
1655 | /* %if-c-only */ | ||
1656 | static void yy_load_buffer_state (void) | 1401 | static void yy_load_buffer_state (void) |
1657 | /* %endif */ | ||
1658 | /* %if-c++-only */ | ||
1659 | /* %endif */ | ||
1660 | { | 1402 | { |
1661 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | 1403 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
1662 | (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; | 1404 | (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; |
@@ -1670,11 +1412,7 @@ static void yy_load_buffer_state (void) | |||
1670 | * | 1412 | * |
1671 | * @return the allocated buffer state. | 1413 | * @return the allocated buffer state. |
1672 | */ | 1414 | */ |
1673 | /* %if-c-only */ | ||
1674 | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) | 1415 | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) |
1675 | /* %endif */ | ||
1676 | /* %if-c++-only */ | ||
1677 | /* %endif */ | ||
1678 | { | 1416 | { |
1679 | YY_BUFFER_STATE b; | 1417 | YY_BUFFER_STATE b; |
1680 | 1418 | ||
@@ -1702,11 +1440,7 @@ static void yy_load_buffer_state (void) | |||
1702 | * @param b a buffer created with yy_create_buffer() | 1440 | * @param b a buffer created with yy_create_buffer() |
1703 | * | 1441 | * |
1704 | */ | 1442 | */ |
1705 | /* %if-c-only */ | ||
1706 | void yy_delete_buffer (YY_BUFFER_STATE b ) | 1443 | void yy_delete_buffer (YY_BUFFER_STATE b ) |
1707 | /* %endif */ | ||
1708 | /* %if-c++-only */ | ||
1709 | /* %endif */ | ||
1710 | { | 1444 | { |
1711 | 1445 | ||
1712 | if ( ! b ) | 1446 | if ( ! b ) |
@@ -1721,26 +1455,15 @@ static void yy_load_buffer_state (void) | |||
1721 | yyfree((void *) b ); | 1455 | yyfree((void *) b ); |
1722 | } | 1456 | } |
1723 | 1457 | ||
1724 | /* %if-c-only */ | ||
1725 | |||
1726 | #ifndef __cplusplus | 1458 | #ifndef __cplusplus |
1727 | extern int isatty (int ); | 1459 | extern int isatty (int ); |
1728 | #endif /* __cplusplus */ | 1460 | #endif /* __cplusplus */ |
1729 | 1461 | ||
1730 | /* %endif */ | ||
1731 | |||
1732 | /* %if-c++-only */ | ||
1733 | /* %endif */ | ||
1734 | |||
1735 | /* Initializes or reinitializes a buffer. | 1462 | /* Initializes or reinitializes a buffer. |
1736 | * This function is sometimes called more than once on the same buffer, | 1463 | * This function is sometimes called more than once on the same buffer, |
1737 | * such as during a yyrestart() or at EOF. | 1464 | * such as during a yyrestart() or at EOF. |
1738 | */ | 1465 | */ |
1739 | /* %if-c-only */ | ||
1740 | static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) | 1466 | static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) |
1741 | /* %endif */ | ||
1742 | /* %if-c++-only */ | ||
1743 | /* %endif */ | ||
1744 | 1467 | ||
1745 | { | 1468 | { |
1746 | int oerrno = errno; | 1469 | int oerrno = errno; |
@@ -1759,13 +1482,8 @@ extern int isatty (int ); | |||
1759 | b->yy_bs_column = 0; | 1482 | b->yy_bs_column = 0; |
1760 | } | 1483 | } |
1761 | 1484 | ||
1762 | /* %if-c-only */ | ||
1763 | |||
1764 | b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; | 1485 | b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; |
1765 | 1486 | ||
1766 | /* %endif */ | ||
1767 | /* %if-c++-only */ | ||
1768 | /* %endif */ | ||
1769 | errno = oerrno; | 1487 | errno = oerrno; |
1770 | } | 1488 | } |
1771 | 1489 | ||
@@ -1773,11 +1491,7 @@ extern int isatty (int ); | |||
1773 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. | 1491 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. |
1774 | * | 1492 | * |
1775 | */ | 1493 | */ |
1776 | /* %if-c-only */ | ||
1777 | void yy_flush_buffer (YY_BUFFER_STATE b ) | 1494 | void yy_flush_buffer (YY_BUFFER_STATE b ) |
1778 | /* %endif */ | ||
1779 | /* %if-c++-only */ | ||
1780 | /* %endif */ | ||
1781 | { | 1495 | { |
1782 | if ( ! b ) | 1496 | if ( ! b ) |
1783 | return; | 1497 | return; |
@@ -1800,18 +1514,13 @@ extern int isatty (int ); | |||
1800 | yy_load_buffer_state( ); | 1514 | yy_load_buffer_state( ); |
1801 | } | 1515 | } |
1802 | 1516 | ||
1803 | /* %if-c-or-c++ */ | ||
1804 | /** Pushes the new state onto the stack. The new state becomes | 1517 | /** Pushes the new state onto the stack. The new state becomes |
1805 | * the current state. This function will allocate the stack | 1518 | * the current state. This function will allocate the stack |
1806 | * if necessary. | 1519 | * if necessary. |
1807 | * @param new_buffer The new state. | 1520 | * @param new_buffer The new state. |
1808 | * | 1521 | * |
1809 | */ | 1522 | */ |
1810 | /* %if-c-only */ | ||
1811 | void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) | 1523 | void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) |
1812 | /* %endif */ | ||
1813 | /* %if-c++-only */ | ||
1814 | /* %endif */ | ||
1815 | { | 1524 | { |
1816 | if (new_buffer == NULL) | 1525 | if (new_buffer == NULL) |
1817 | return; | 1526 | return; |
@@ -1836,18 +1545,12 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) | |||
1836 | yy_load_buffer_state( ); | 1545 | yy_load_buffer_state( ); |
1837 | (yy_did_buffer_switch_on_eof) = 1; | 1546 | (yy_did_buffer_switch_on_eof) = 1; |
1838 | } | 1547 | } |
1839 | /* %endif */ | ||
1840 | 1548 | ||
1841 | /* %if-c-or-c++ */ | ||
1842 | /** Removes and deletes the top of the stack, if present. | 1549 | /** Removes and deletes the top of the stack, if present. |
1843 | * The next element becomes the new top. | 1550 | * The next element becomes the new top. |
1844 | * | 1551 | * |
1845 | */ | 1552 | */ |
1846 | /* %if-c-only */ | ||
1847 | void yypop_buffer_state (void) | 1553 | void yypop_buffer_state (void) |
1848 | /* %endif */ | ||
1849 | /* %if-c++-only */ | ||
1850 | /* %endif */ | ||
1851 | { | 1554 | { |
1852 | if (!YY_CURRENT_BUFFER) | 1555 | if (!YY_CURRENT_BUFFER) |
1853 | return; | 1556 | return; |
@@ -1862,17 +1565,11 @@ void yypop_buffer_state (void) | |||
1862 | (yy_did_buffer_switch_on_eof) = 1; | 1565 | (yy_did_buffer_switch_on_eof) = 1; |
1863 | } | 1566 | } |
1864 | } | 1567 | } |
1865 | /* %endif */ | ||
1866 | 1568 | ||
1867 | /* %if-c-or-c++ */ | ||
1868 | /* Allocates the stack if it does not exist. | 1569 | /* Allocates the stack if it does not exist. |
1869 | * Guarantees space for at least one push. | 1570 | * Guarantees space for at least one push. |
1870 | */ | 1571 | */ |
1871 | /* %if-c-only */ | ||
1872 | static void yyensure_buffer_stack (void) | 1572 | static void yyensure_buffer_stack (void) |
1873 | /* %endif */ | ||
1874 | /* %if-c++-only */ | ||
1875 | /* %endif */ | ||
1876 | { | 1573 | { |
1877 | int num_to_alloc; | 1574 | int num_to_alloc; |
1878 | 1575 | ||
@@ -1914,9 +1611,7 @@ static void yyensure_buffer_stack (void) | |||
1914 | (yy_buffer_stack_max) = num_to_alloc; | 1611 | (yy_buffer_stack_max) = num_to_alloc; |
1915 | } | 1612 | } |
1916 | } | 1613 | } |
1917 | /* %endif */ | ||
1918 | 1614 | ||
1919 | /* %if-c-only */ | ||
1920 | /** Setup the input buffer state to scan directly from a user-specified character buffer. | 1615 | /** Setup the input buffer state to scan directly from a user-specified character buffer. |
1921 | * @param base the character buffer | 1616 | * @param base the character buffer |
1922 | * @param size the size in bytes of the character buffer | 1617 | * @param size the size in bytes of the character buffer |
@@ -1951,9 +1646,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) | |||
1951 | 1646 | ||
1952 | return b; | 1647 | return b; |
1953 | } | 1648 | } |
1954 | /* %endif */ | ||
1955 | 1649 | ||
1956 | /* %if-c-only */ | ||
1957 | /** Setup the input buffer state to scan a string. The next call to yylex() will | 1650 | /** Setup the input buffer state to scan a string. The next call to yylex() will |
1958 | * scan from a @e copy of @a str. | 1651 | * scan from a @e copy of @a str. |
1959 | * @param yystr a NUL-terminated string to scan | 1652 | * @param yystr a NUL-terminated string to scan |
@@ -1967,9 +1660,7 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) | |||
1967 | 1660 | ||
1968 | return yy_scan_bytes(yystr,strlen(yystr) ); | 1661 | return yy_scan_bytes(yystr,strlen(yystr) ); |
1969 | } | 1662 | } |
1970 | /* %endif */ | ||
1971 | 1663 | ||
1972 | /* %if-c-only */ | ||
1973 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will | 1664 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will |
1974 | * scan from a @e copy of @a bytes. | 1665 | * scan from a @e copy of @a bytes. |
1975 | * @param bytes the byte buffer to scan | 1666 | * @param bytes the byte buffer to scan |
@@ -2006,21 +1697,16 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) | |||
2006 | 1697 | ||
2007 | return b; | 1698 | return b; |
2008 | } | 1699 | } |
2009 | /* %endif */ | ||
2010 | 1700 | ||
2011 | #ifndef YY_EXIT_FAILURE | 1701 | #ifndef YY_EXIT_FAILURE |
2012 | #define YY_EXIT_FAILURE 2 | 1702 | #define YY_EXIT_FAILURE 2 |
2013 | #endif | 1703 | #endif |
2014 | 1704 | ||
2015 | /* %if-c-only */ | ||
2016 | static void yy_fatal_error (yyconst char* msg ) | 1705 | static void yy_fatal_error (yyconst char* msg ) |
2017 | { | 1706 | { |
2018 | (void) fprintf( stderr, "%s\n", msg ); | 1707 | (void) fprintf( stderr, "%s\n", msg ); |
2019 | exit( YY_EXIT_FAILURE ); | 1708 | exit( YY_EXIT_FAILURE ); |
2020 | } | 1709 | } |
2021 | /* %endif */ | ||
2022 | /* %if-c++-only */ | ||
2023 | /* %endif */ | ||
2024 | 1710 | ||
2025 | /* Redefine yyless() so it works in section 3 code. */ | 1711 | /* Redefine yyless() so it works in section 3 code. */ |
2026 | 1712 | ||
@@ -2041,10 +1727,6 @@ static void yy_fatal_error (yyconst char* msg ) | |||
2041 | 1727 | ||
2042 | /* Accessor methods (get/set functions) to struct members. */ | 1728 | /* Accessor methods (get/set functions) to struct members. */ |
2043 | 1729 | ||
2044 | /* %if-c-only */ | ||
2045 | /* %if-reentrant */ | ||
2046 | /* %endif */ | ||
2047 | |||
2048 | /** Get the current line number. | 1730 | /** Get the current line number. |
2049 | * | 1731 | * |
2050 | */ | 1732 | */ |
@@ -2087,9 +1769,6 @@ char *yyget_text (void) | |||
2087 | return yytext; | 1769 | return yytext; |
2088 | } | 1770 | } |
2089 | 1771 | ||
2090 | /* %if-reentrant */ | ||
2091 | /* %endif */ | ||
2092 | |||
2093 | /** Set the current line number. | 1772 | /** Set the current line number. |
2094 | * @param line_number | 1773 | * @param line_number |
2095 | * | 1774 | * |
@@ -2126,14 +1805,6 @@ void yyset_debug (int bdebug ) | |||
2126 | yy_flex_debug = bdebug ; | 1805 | yy_flex_debug = bdebug ; |
2127 | } | 1806 | } |
2128 | 1807 | ||
2129 | /* %endif */ | ||
2130 | |||
2131 | /* %if-reentrant */ | ||
2132 | /* %if-bison-bridge */ | ||
2133 | /* %endif */ | ||
2134 | /* %endif if-c-only */ | ||
2135 | |||
2136 | /* %if-c-only */ | ||
2137 | static int yy_init_globals (void) | 1808 | static int yy_init_globals (void) |
2138 | { | 1809 | { |
2139 | /* Initialization is the same as for the non-reentrant scanner. | 1810 | /* Initialization is the same as for the non-reentrant scanner. |
@@ -2161,9 +1832,7 @@ static int yy_init_globals (void) | |||
2161 | */ | 1832 | */ |
2162 | return 0; | 1833 | return 0; |
2163 | } | 1834 | } |
2164 | /* %endif */ | ||
2165 | 1835 | ||
2166 | /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ | ||
2167 | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ | 1836 | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ |
2168 | int yylex_destroy (void) | 1837 | int yylex_destroy (void) |
2169 | { | 1838 | { |
@@ -2183,11 +1852,8 @@ int yylex_destroy (void) | |||
2183 | * yylex() is called, initialization will occur. */ | 1852 | * yylex() is called, initialization will occur. */ |
2184 | yy_init_globals( ); | 1853 | yy_init_globals( ); |
2185 | 1854 | ||
2186 | /* %if-reentrant */ | ||
2187 | /* %endif */ | ||
2188 | return 0; | 1855 | return 0; |
2189 | } | 1856 | } |
2190 | /* %endif */ | ||
2191 | 1857 | ||
2192 | /* | 1858 | /* |
2193 | * Internal utility routines. | 1859 | * Internal utility routines. |
@@ -2235,21 +1901,11 @@ void yyfree (void * ptr ) | |||
2235 | free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ | 1901 | free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ |
2236 | } | 1902 | } |
2237 | 1903 | ||
2238 | /* %if-tables-serialization definitions */ | ||
2239 | /* %define-yytables The name for this specific scanner's tables. */ | ||
2240 | #define YYTABLES_NAME "yytables" | 1904 | #define YYTABLES_NAME "yytables" |
2241 | /* %endif */ | ||
2242 | |||
2243 | /* %ok-for-header */ | ||
2244 | |||
2245 | #line 93 "scripts/genksyms/lex.l" | ||
2246 | |||
2247 | |||
2248 | 1905 | ||
2249 | /* Bring in the keyword recognizer. */ | 1906 | /* Bring in the keyword recognizer. */ |
2250 | 1907 | ||
2251 | #include "keywords.c" | 1908 | #include "keywords.hash.c" |
2252 | |||
2253 | 1909 | ||
2254 | /* Macros to append to our phrase collection list. */ | 1910 | /* Macros to append to our phrase collection list. */ |
2255 | 1911 | ||
@@ -2270,11 +1926,11 @@ void yyfree (void * ptr ) | |||
2270 | cur_node->tag = \ | 1926 | cur_node->tag = \ |
2271 | find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\ | 1927 | find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\ |
2272 | SYM_ENUM_CONST : SYM_NORMAL ; \ | 1928 | SYM_ENUM_CONST : SYM_NORMAL ; \ |
1929 | cur_node->in_source_file = in_source_file; \ | ||
2273 | } while (0) | 1930 | } while (0) |
2274 | 1931 | ||
2275 | #define APP _APP(yytext, yyleng) | 1932 | #define APP _APP(yytext, yyleng) |
2276 | 1933 | ||
2277 | |||
2278 | /* The second stage lexer. Here we incorporate knowledge of the state | 1934 | /* The second stage lexer. Here we incorporate knowledge of the state |
2279 | of the parser to tailor the tokens that are returned. */ | 1935 | of the parser to tailor the tokens that are returned. */ |
2280 | 1936 | ||
@@ -2320,6 +1976,13 @@ repeat: | |||
2320 | cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1); | 1976 | cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1); |
2321 | cur_line = atoi(yytext+2); | 1977 | cur_line = atoi(yytext+2); |
2322 | 1978 | ||
1979 | if (!source_file) { | ||
1980 | source_file = xstrdup(cur_filename); | ||
1981 | in_source_file = 1; | ||
1982 | } else { | ||
1983 | in_source_file = (strcmp(cur_filename, source_file) == 0); | ||
1984 | } | ||
1985 | |||
2323 | goto repeat; | 1986 | goto repeat; |
2324 | } | 1987 | } |
2325 | 1988 | ||
diff --git a/scripts/genksyms/parse.c_shipped b/scripts/genksyms/parse.tab.c_shipped index 1a0b8607fb0..ece53c79bb5 100644 --- a/scripts/genksyms/parse.c_shipped +++ b/scripts/genksyms/parse.tab.c_shipped | |||
@@ -1,10 +1,8 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.5. */ | ||
1 | 2 | ||
2 | /* A Bison parser, made by GNU Bison 2.4.1. */ | 3 | /* Bison implementation for Yacc-like parsers in C |
3 | |||
4 | /* Skeleton implementation for Bison's Yacc-like parsers in C | ||
5 | 4 | ||
6 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | 5 | Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. |
7 | Free Software Foundation, Inc. | ||
8 | 6 | ||
9 | 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 |
10 | 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 |
@@ -46,7 +44,7 @@ | |||
46 | #define YYBISON 1 | 44 | #define YYBISON 1 |
47 | 45 | ||
48 | /* Bison version. */ | 46 | /* Bison version. */ |
49 | #define YYBISON_VERSION "2.4.1" | 47 | #define YYBISON_VERSION "2.5" |
50 | 48 | ||
51 | /* Skeleton name. */ | 49 | /* Skeleton name. */ |
52 | #define YYSKELETON_NAME "yacc.c" | 50 | #define YYSKELETON_NAME "yacc.c" |
@@ -67,8 +65,6 @@ | |||
67 | 65 | ||
68 | /* Copy the first part of user declarations. */ | 66 | /* Copy the first part of user declarations. */ |
69 | 67 | ||
70 | /* Line 189 of yacc.c */ | ||
71 | #line 24 "scripts/genksyms/parse.y" | ||
72 | 68 | ||
73 | 69 | ||
74 | #include <assert.h> | 70 | #include <assert.h> |
@@ -99,10 +95,27 @@ remove_list(struct string_list **pb, struct string_list **pe) | |||
99 | free_list(b, e); | 95 | free_list(b, e); |
100 | } | 96 | } |
101 | 97 | ||
98 | /* Record definition of a struct/union/enum */ | ||
99 | static void record_compound(struct string_list **keyw, | ||
100 | struct string_list **ident, | ||
101 | struct string_list **body, | ||
102 | enum symbol_type type) | ||
103 | { | ||
104 | struct string_list *b = *body, *i = *ident, *r; | ||
105 | |||
106 | if (i->in_source_file) { | ||
107 | remove_node(keyw); | ||
108 | (*ident)->tag = type; | ||
109 | remove_list(body, ident); | ||
110 | return; | ||
111 | } | ||
112 | r = copy_node(i); r->tag = type; | ||
113 | r->next = (*keyw)->next; *body = r; (*keyw)->next = NULL; | ||
114 | add_symbol(i->string, type, b, is_extern); | ||
115 | } | ||
116 | |||
102 | 117 | ||
103 | 118 | ||
104 | /* Line 189 of yacc.c */ | ||
105 | #line 106 "scripts/genksyms/parse.c" | ||
106 | 119 | ||
107 | /* Enabling traces. */ | 120 | /* Enabling traces. */ |
108 | #ifndef YYDEBUG | 121 | #ifndef YYDEBUG |
@@ -186,8 +199,6 @@ typedef int YYSTYPE; | |||
186 | /* Copy the second part of user declarations. */ | 199 | /* Copy the second part of user declarations. */ |
187 | 200 | ||
188 | 201 | ||
189 | /* Line 264 of yacc.c */ | ||
190 | #line 191 "scripts/genksyms/parse.c" | ||
191 | 202 | ||
192 | #ifdef short | 203 | #ifdef short |
193 | # undef short | 204 | # undef short |
@@ -237,7 +248,7 @@ typedef short int yytype_int16; | |||
237 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) | 248 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
238 | 249 | ||
239 | #ifndef YY_ | 250 | #ifndef YY_ |
240 | # if YYENABLE_NLS | 251 | # if defined YYENABLE_NLS && YYENABLE_NLS |
241 | # if ENABLE_NLS | 252 | # if ENABLE_NLS |
242 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ | 253 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
243 | # define YY_(msgid) dgettext ("bison-runtime", msgid) | 254 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
@@ -290,11 +301,11 @@ YYID (yyi) | |||
290 | # define alloca _alloca | 301 | # define alloca _alloca |
291 | # else | 302 | # else |
292 | # define YYSTACK_ALLOC alloca | 303 | # define YYSTACK_ALLOC alloca |
293 | # 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__ \ |
294 | || defined __cplusplus || defined _MSC_VER) | 305 | || defined __cplusplus || defined _MSC_VER) |
295 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | 306 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
296 | # ifndef _STDLIB_H | 307 | # ifndef EXIT_SUCCESS |
297 | # define _STDLIB_H 1 | 308 | # define EXIT_SUCCESS 0 |
298 | # endif | 309 | # endif |
299 | # endif | 310 | # endif |
300 | # endif | 311 | # endif |
@@ -317,24 +328,24 @@ YYID (yyi) | |||
317 | # ifndef YYSTACK_ALLOC_MAXIMUM | 328 | # ifndef YYSTACK_ALLOC_MAXIMUM |
318 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM | 329 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
319 | # endif | 330 | # endif |
320 | # if (defined __cplusplus && ! defined _STDLIB_H \ | 331 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
321 | && ! ((defined YYMALLOC || defined malloc) \ | 332 | && ! ((defined YYMALLOC || defined malloc) \ |
322 | && (defined YYFREE || defined free))) | 333 | && (defined YYFREE || defined free))) |
323 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | 334 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
324 | # ifndef _STDLIB_H | 335 | # ifndef EXIT_SUCCESS |
325 | # define _STDLIB_H 1 | 336 | # define EXIT_SUCCESS 0 |
326 | # endif | 337 | # endif |
327 | # endif | 338 | # endif |
328 | # ifndef YYMALLOC | 339 | # ifndef YYMALLOC |
329 | # define YYMALLOC malloc | 340 | # define YYMALLOC malloc |
330 | # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ | 341 | # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ |
331 | || defined __cplusplus || defined _MSC_VER) | 342 | || defined __cplusplus || defined _MSC_VER) |
332 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ | 343 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
333 | # endif | 344 | # endif |
334 | # endif | 345 | # endif |
335 | # ifndef YYFREE | 346 | # ifndef YYFREE |
336 | # define YYFREE free | 347 | # define YYFREE free |
337 | # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ | 348 | # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ |
338 | || defined __cplusplus || defined _MSC_VER) | 349 | || defined __cplusplus || defined _MSC_VER) |
339 | void free (void *); /* INFRINGES ON USER NAME SPACE */ | 350 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
340 | # endif | 351 | # endif |
@@ -363,23 +374,7 @@ union yyalloc | |||
363 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ | 374 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
364 | + YYSTACK_GAP_MAXIMUM) | 375 | + YYSTACK_GAP_MAXIMUM) |
365 | 376 | ||
366 | /* Copy COUNT objects from FROM to TO. The source and destination do | 377 | # define YYCOPY_NEEDED 1 |
367 | not overlap. */ | ||
368 | # ifndef YYCOPY | ||
369 | # if defined __GNUC__ && 1 < __GNUC__ | ||
370 | # define YYCOPY(To, From, Count) \ | ||
371 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | ||
372 | # else | ||
373 | # define YYCOPY(To, From, Count) \ | ||
374 | do \ | ||
375 | { \ | ||
376 | YYSIZE_T yyi; \ | ||
377 | for (yyi = 0; yyi < (Count); yyi++) \ | ||
378 | (To)[yyi] = (From)[yyi]; \ | ||
379 | } \ | ||
380 | while (YYID (0)) | ||
381 | # endif | ||
382 | # endif | ||
383 | 378 | ||
384 | /* Relocate STACK from its old location to the new one. The | 379 | /* Relocate STACK from its old location to the new one. The |
385 | 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 |
@@ -399,6 +394,26 @@ union yyalloc | |||
399 | 394 | ||
400 | #endif | 395 | #endif |
401 | 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 | |||
402 | /* YYFINAL -- State number of the termination state. */ | 417 | /* YYFINAL -- State number of the termination state. */ |
403 | #define YYFINAL 4 | 418 | #define YYFINAL 4 |
404 | /* YYLAST -- Last index in YYTABLE. */ | 419 | /* YYLAST -- Last index in YYTABLE. */ |
@@ -521,20 +536,20 @@ static const yytype_int8 yyrhs[] = | |||
521 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | 536 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
522 | static const yytype_uint16 yyrline[] = | 537 | static const yytype_uint16 yyrline[] = |
523 | { | 538 | { |
524 | 0, 104, 104, 105, 109, 109, 115, 115, 117, 117, | 539 | 0, 123, 123, 124, 128, 128, 134, 134, 136, 136, |
525 | 119, 120, 121, 122, 123, 124, 128, 142, 143, 147, | 540 | 138, 139, 140, 141, 142, 143, 147, 161, 162, 166, |
526 | 155, 168, 174, 175, 179, 180, 184, 190, 194, 195, | 541 | 174, 187, 193, 194, 198, 199, 203, 209, 213, 214, |
527 | 196, 197, 198, 202, 203, 204, 205, 209, 211, 213, | 542 | 215, 216, 217, 221, 222, 223, 224, 228, 230, 232, |
528 | 217, 224, 231, 241, 244, 245, 249, 250, 251, 252, | 543 | 236, 238, 240, 245, 248, 249, 253, 254, 255, 256, |
529 | 253, 254, 255, 256, 257, 258, 259, 263, 268, 269, | 544 | 257, 258, 259, 260, 261, 262, 263, 267, 272, 273, |
530 | 273, 274, 278, 278, 278, 279, 287, 288, 292, 301, | 545 | 277, 278, 282, 282, 282, 283, 291, 292, 296, 305, |
531 | 303, 305, 307, 309, 316, 317, 321, 322, 323, 325, | 546 | 307, 309, 311, 313, 320, 321, 325, 326, 327, 329, |
532 | 327, 329, 331, 336, 337, 338, 342, 343, 347, 348, | 547 | 331, 333, 335, 340, 341, 342, 346, 347, 351, 352, |
533 | 353, 358, 360, 364, 365, 373, 377, 379, 381, 383, | 548 | 357, 362, 364, 368, 369, 377, 381, 383, 385, 387, |
534 | 385, 390, 399, 400, 405, 410, 411, 415, 416, 420, | 549 | 389, 394, 403, 404, 409, 414, 415, 419, 420, 424, |
535 | 421, 425, 427, 432, 433, 437, 438, 442, 443, 444, | 550 | 425, 429, 431, 436, 437, 441, 442, 446, 447, 448, |
536 | 448, 452, 453, 457, 458, 462, 463, 466, 471, 479, | 551 | 452, 456, 457, 461, 462, 466, 467, 470, 475, 483, |
537 | 483, 484, 488 | 552 | 487, 488, 492 |
538 | }; | 553 | }; |
539 | #endif | 554 | #endif |
540 | 555 | ||
@@ -625,8 +640,8 @@ static const yytype_uint8 yyr2[] = | |||
625 | 0, 1, 5 | 640 | 0, 1, 5 |
626 | }; | 641 | }; |
627 | 642 | ||
628 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | 643 | /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. |
629 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero | 644 | Performed when YYTABLE doesn't specify something else to do. Zero |
630 | means the default is an error. */ | 645 | means the default is an error. */ |
631 | static const yytype_uint8 yydefact[] = | 646 | static const yytype_uint8 yydefact[] = |
632 | { | 647 | { |
@@ -699,8 +714,7 @@ static const yytype_int16 yypgoto[] = | |||
699 | 714 | ||
700 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | 715 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
701 | positive, shift that token. If negative, reduce the rule which | 716 | positive, shift that token. If negative, reduce the rule which |
702 | number is the opposite. If zero, do what YYDEFACT says. | 717 | number is the opposite. If YYTABLE_NINF, syntax error. */ |
703 | If YYTABLE_NINF, syntax error. */ | ||
704 | #define YYTABLE_NINF -109 | 718 | #define YYTABLE_NINF -109 |
705 | static const yytype_int16 yytable[] = | 719 | static const yytype_int16 yytable[] = |
706 | { | 720 | { |
@@ -760,6 +774,12 @@ static const yytype_int16 yytable[] = | |||
760 | 0, 0, 34 | 774 | 0, 0, 34 |
761 | }; | 775 | }; |
762 | 776 | ||
777 | #define yypact_value_is_default(yystate) \ | ||
778 | ((yystate) == (-135)) | ||
779 | |||
780 | #define yytable_value_is_error(yytable_value) \ | ||
781 | YYID (0) | ||
782 | |||
763 | static const yytype_int16 yycheck[] = | 783 | static const yytype_int16 yycheck[] = |
764 | { | 784 | { |
765 | 59, 38, 79, 3, 1, 8, 56, 37, 26, 37, | 785 | 59, 38, 79, 3, 1, 8, 56, 37, 26, 37, |
@@ -855,9 +875,18 @@ static const yytype_uint8 yystos[] = | |||
855 | 875 | ||
856 | /* Like YYERROR except do call yyerror. This remains here temporarily | 876 | /* Like YYERROR except do call yyerror. This remains here temporarily |
857 | to ease the transition to the new meaning of YYERROR, for GCC. | 877 | to ease the transition to the new meaning of YYERROR, for GCC. |
858 | Once GCC version 2 has supplanted version 1, this can go. */ | 878 | Once GCC version 2 has supplanted version 1, this can go. However, |
879 | YYFAIL appears to be in use. Nevertheless, it is formally deprecated | ||
880 | in Bison 2.4.2's NEWS entry, where a plan to phase it out is | ||
881 | discussed. */ | ||
859 | 882 | ||
860 | #define YYFAIL goto yyerrlab | 883 | #define YYFAIL goto yyerrlab |
884 | #if defined YYFAIL | ||
885 | /* This is here to suppress warnings from the GCC cpp's | ||
886 | -Wunused-macros. Normally we don't worry about that warning, but | ||
887 | some users do, and we want to make it easy for users to remove | ||
888 | YYFAIL uses, which will produce warnings from Bison 2.5. */ | ||
889 | #endif | ||
861 | 890 | ||
862 | #define YYRECOVERING() (!!yyerrstatus) | 891 | #define YYRECOVERING() (!!yyerrstatus) |
863 | 892 | ||
@@ -867,7 +896,6 @@ do \ | |||
867 | { \ | 896 | { \ |
868 | yychar = (Token); \ | 897 | yychar = (Token); \ |
869 | yylval = (Value); \ | 898 | yylval = (Value); \ |
870 | yytoken = YYTRANSLATE (yychar); \ | ||
871 | YYPOPSTACK (1); \ | 899 | YYPOPSTACK (1); \ |
872 | goto yybackup; \ | 900 | goto yybackup; \ |
873 | } \ | 901 | } \ |
@@ -909,19 +937,10 @@ while (YYID (0)) | |||
909 | #endif | 937 | #endif |
910 | 938 | ||
911 | 939 | ||
912 | /* YY_LOCATION_PRINT -- Print the location on the stream. | 940 | /* This macro is provided for backward compatibility. */ |
913 | This macro was not mandated originally: define only if we know | ||
914 | we won't break user code: when these are the locations we know. */ | ||
915 | 941 | ||
916 | #ifndef YY_LOCATION_PRINT | 942 | #ifndef YY_LOCATION_PRINT |
917 | # if YYLTYPE_IS_TRIVIAL | 943 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
918 | # define YY_LOCATION_PRINT(File, Loc) \ | ||
919 | fprintf (File, "%d.%d-%d.%d", \ | ||
920 | (Loc).first_line, (Loc).first_column, \ | ||
921 | (Loc).last_line, (Loc).last_column) | ||
922 | # else | ||
923 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | ||
924 | # endif | ||
925 | #endif | 944 | #endif |
926 | 945 | ||
927 | 946 | ||
@@ -1113,7 +1132,6 @@ int yydebug; | |||
1113 | # define YYMAXDEPTH 10000 | 1132 | # define YYMAXDEPTH 10000 |
1114 | #endif | 1133 | #endif |
1115 | 1134 | ||
1116 | |||
1117 | 1135 | ||
1118 | #if YYERROR_VERBOSE | 1136 | #if YYERROR_VERBOSE |
1119 | 1137 | ||
@@ -1216,115 +1234,142 @@ yytnamerr (char *yyres, const char *yystr) | |||
1216 | } | 1234 | } |
1217 | # endif | 1235 | # endif |
1218 | 1236 | ||
1219 | /* Copy into YYRESULT an error message about the unexpected token | 1237 | /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message |
1220 | YYCHAR while in state YYSTATE. Return the number of bytes copied, | 1238 | about the unexpected token YYTOKEN for the state stack whose top is |
1221 | including the terminating null byte. If YYRESULT is null, do not | 1239 | YYSSP. |
1222 | copy anything; just return the number of bytes that would be | ||
1223 | copied. As a special case, return 0 if an ordinary "syntax error" | ||
1224 | message will do. Return YYSIZE_MAXIMUM if overflow occurs during | ||
1225 | size calculation. */ | ||
1226 | static YYSIZE_T | ||
1227 | yysyntax_error (char *yyresult, int yystate, int yychar) | ||
1228 | { | ||
1229 | int yyn = yypact[yystate]; | ||
1230 | 1240 | ||
1231 | if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) | 1241 | Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is |
1232 | return 0; | 1242 | not large enough to hold the message. In that case, also set |
1233 | else | 1243 | *YYMSG_ALLOC to the required number of bytes. Return 2 if the |
1244 | required number of bytes is too large to store. */ | ||
1245 | static int | ||
1246 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | ||
1247 | yytype_int16 *yyssp, int yytoken) | ||
1248 | { | ||
1249 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); | ||
1250 | YYSIZE_T yysize = yysize0; | ||
1251 | YYSIZE_T yysize1; | ||
1252 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; | ||
1253 | /* Internationalized format string. */ | ||
1254 | const char *yyformat = 0; | ||
1255 | /* Arguments of yyformat. */ | ||
1256 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | ||
1257 | /* Number of reported tokens (one for the "unexpected", one per | ||
1258 | "expected"). */ | ||
1259 | int yycount = 0; | ||
1260 | |||
1261 | /* There are many possibilities here to consider: | ||
1262 | - Assume YYFAIL is not used. It's too flawed to consider. See | ||
1263 | <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> | ||
1264 | for details. YYERROR is fine as it does not invoke this | ||
1265 | function. | ||
1266 | - If this state is a consistent state with a default action, then | ||
1267 | the only way this function was invoked is if the default action | ||
1268 | is an error action. In that case, don't check for expected | ||
1269 | tokens because there are none. | ||
1270 | - The only way there can be no lookahead present (in yychar) is if | ||
1271 | this state is a consistent state with a default action. Thus, | ||
1272 | detecting the absence of a lookahead is sufficient to determine | ||
1273 | that there is no unexpected or expected token to report. In that | ||
1274 | case, just report a simple "syntax error". | ||
1275 | - Don't assume there isn't a lookahead just because this state is a | ||
1276 | consistent state with a default action. There might have been a | ||
1277 | previous inconsistent state, consistent state with a non-default | ||
1278 | action, or user semantic action that manipulated yychar. | ||
1279 | - Of course, the expected token list depends on states to have | ||
1280 | correct lookahead information, and it depends on the parser not | ||
1281 | to perform extra reductions after fetching a lookahead from the | ||
1282 | scanner and before detecting a syntax error. Thus, state merging | ||
1283 | (from LALR or IELR) and default reductions corrupt the expected | ||
1284 | token list. However, the list is correct for canonical LR with | ||
1285 | one exception: it will still contain any token that will not be | ||
1286 | accepted due to an error action in a later state. | ||
1287 | */ | ||
1288 | if (yytoken != YYEMPTY) | ||
1234 | { | 1289 | { |
1235 | int yytype = YYTRANSLATE (yychar); | 1290 | int yyn = yypact[*yyssp]; |
1236 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); | 1291 | yyarg[yycount++] = yytname[yytoken]; |
1237 | YYSIZE_T yysize = yysize0; | 1292 | if (!yypact_value_is_default (yyn)) |
1238 | YYSIZE_T yysize1; | 1293 | { |
1239 | int yysize_overflow = 0; | 1294 | /* Start YYX at -YYN if negative to avoid negative indexes in |
1240 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; | 1295 | YYCHECK. In other words, skip the first -YYN actions for |
1241 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | 1296 | this state because they are default actions. */ |
1242 | int yyx; | 1297 | int yyxbegin = yyn < 0 ? -yyn : 0; |
1243 | 1298 | /* Stay within bounds of both yycheck and yytname. */ | |
1244 | # if 0 | 1299 | int yychecklim = YYLAST - yyn + 1; |
1245 | /* This is so xgettext sees the translatable formats that are | 1300 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
1246 | constructed on the fly. */ | 1301 | int yyx; |
1247 | YY_("syntax error, unexpected %s"); | 1302 | |
1248 | YY_("syntax error, unexpected %s, expecting %s"); | 1303 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
1249 | YY_("syntax error, unexpected %s, expecting %s or %s"); | 1304 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR |
1250 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); | 1305 | && !yytable_value_is_error (yytable[yyx + yyn])) |
1251 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); | 1306 | { |
1252 | # endif | 1307 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
1253 | char *yyfmt; | 1308 | { |
1254 | char const *yyf; | 1309 | yycount = 1; |
1255 | static char const yyunexpected[] = "syntax error, unexpected %s"; | 1310 | yysize = yysize0; |
1256 | static char const yyexpecting[] = ", expecting %s"; | 1311 | break; |
1257 | static char const yyor[] = " or %s"; | 1312 | } |
1258 | char yyformat[sizeof yyunexpected | 1313 | yyarg[yycount++] = yytname[yyx]; |
1259 | + sizeof yyexpecting - 1 | 1314 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
1260 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) | 1315 | if (! (yysize <= yysize1 |
1261 | * (sizeof yyor - 1))]; | 1316 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
1262 | char const *yyprefix = yyexpecting; | 1317 | return 2; |
1263 | 1318 | yysize = yysize1; | |
1264 | /* Start YYX at -YYN if negative to avoid negative indexes in | 1319 | } |
1265 | YYCHECK. */ | 1320 | } |
1266 | int yyxbegin = yyn < 0 ? -yyn : 0; | 1321 | } |
1267 | |||
1268 | /* Stay within bounds of both yycheck and yytname. */ | ||
1269 | int yychecklim = YYLAST - yyn + 1; | ||
1270 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; | ||
1271 | int yycount = 1; | ||
1272 | |||
1273 | yyarg[0] = yytname[yytype]; | ||
1274 | yyfmt = yystpcpy (yyformat, yyunexpected); | ||
1275 | |||
1276 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | ||
1277 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | ||
1278 | { | ||
1279 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) | ||
1280 | { | ||
1281 | yycount = 1; | ||
1282 | yysize = yysize0; | ||
1283 | yyformat[sizeof yyunexpected - 1] = '\0'; | ||
1284 | break; | ||
1285 | } | ||
1286 | yyarg[yycount++] = yytname[yyx]; | ||
1287 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); | ||
1288 | yysize_overflow |= (yysize1 < yysize); | ||
1289 | yysize = yysize1; | ||
1290 | yyfmt = yystpcpy (yyfmt, yyprefix); | ||
1291 | yyprefix = yyor; | ||
1292 | } | ||
1293 | 1322 | ||
1294 | yyf = YY_(yyformat); | 1323 | switch (yycount) |
1295 | yysize1 = yysize + yystrlen (yyf); | 1324 | { |
1296 | yysize_overflow |= (yysize1 < yysize); | 1325 | # define YYCASE_(N, S) \ |
1297 | yysize = yysize1; | 1326 | case N: \ |
1327 | yyformat = S; \ | ||
1328 | break | ||
1329 | YYCASE_(0, YY_("syntax error")); | ||
1330 | YYCASE_(1, YY_("syntax error, unexpected %s")); | ||
1331 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); | ||
1332 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); | ||
1333 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); | ||
1334 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); | ||
1335 | # undef YYCASE_ | ||
1336 | } | ||
1298 | 1337 | ||
1299 | if (yysize_overflow) | 1338 | yysize1 = yysize + yystrlen (yyformat); |
1300 | return YYSIZE_MAXIMUM; | 1339 | if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
1340 | return 2; | ||
1341 | yysize = yysize1; | ||
1301 | 1342 | ||
1302 | if (yyresult) | 1343 | if (*yymsg_alloc < yysize) |
1303 | { | 1344 | { |
1304 | /* Avoid sprintf, as that infringes on the user's name space. | 1345 | *yymsg_alloc = 2 * yysize; |
1305 | Don't have undefined behavior even if the translation | 1346 | if (! (yysize <= *yymsg_alloc |
1306 | produced a string with the wrong number of "%s"s. */ | 1347 | && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
1307 | char *yyp = yyresult; | 1348 | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
1308 | int yyi = 0; | 1349 | return 1; |
1309 | while ((*yyp = *yyf) != '\0') | ||
1310 | { | ||
1311 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) | ||
1312 | { | ||
1313 | yyp += yytnamerr (yyp, yyarg[yyi++]); | ||
1314 | yyf += 2; | ||
1315 | } | ||
1316 | else | ||
1317 | { | ||
1318 | yyp++; | ||
1319 | yyf++; | ||
1320 | } | ||
1321 | } | ||
1322 | } | ||
1323 | return yysize; | ||
1324 | } | 1350 | } |
1351 | |||
1352 | /* Avoid sprintf, as that infringes on the user's name space. | ||
1353 | Don't have undefined behavior even if the translation | ||
1354 | produced a string with the wrong number of "%s"s. */ | ||
1355 | { | ||
1356 | char *yyp = *yymsg; | ||
1357 | int yyi = 0; | ||
1358 | while ((*yyp = *yyformat) != '\0') | ||
1359 | if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) | ||
1360 | { | ||
1361 | yyp += yytnamerr (yyp, yyarg[yyi++]); | ||
1362 | yyformat += 2; | ||
1363 | } | ||
1364 | else | ||
1365 | { | ||
1366 | yyp++; | ||
1367 | yyformat++; | ||
1368 | } | ||
1369 | } | ||
1370 | return 0; | ||
1325 | } | 1371 | } |
1326 | #endif /* YYERROR_VERBOSE */ | 1372 | #endif /* YYERROR_VERBOSE */ |
1327 | |||
1328 | 1373 | ||
1329 | /*-----------------------------------------------. | 1374 | /*-----------------------------------------------. |
1330 | | Release the memory associated to this symbol. | | 1375 | | Release the memory associated to this symbol. | |
@@ -1357,6 +1402,7 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1357 | } | 1402 | } |
1358 | } | 1403 | } |
1359 | 1404 | ||
1405 | |||
1360 | /* Prevent warnings from -Wmissing-prototypes. */ | 1406 | /* Prevent warnings from -Wmissing-prototypes. */ |
1361 | #ifdef YYPARSE_PARAM | 1407 | #ifdef YYPARSE_PARAM |
1362 | #if defined __STDC__ || defined __cplusplus | 1408 | #if defined __STDC__ || defined __cplusplus |
@@ -1383,10 +1429,9 @@ YYSTYPE yylval; | |||
1383 | int yynerrs; | 1429 | int yynerrs; |
1384 | 1430 | ||
1385 | 1431 | ||
1386 | 1432 | /*----------. | |
1387 | /*-------------------------. | 1433 | | yyparse. | |
1388 | | yyparse or yypush_parse. | | 1434 | `----------*/ |
1389 | `-------------------------*/ | ||
1390 | 1435 | ||
1391 | #ifdef YYPARSE_PARAM | 1436 | #ifdef YYPARSE_PARAM |
1392 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 1437 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
@@ -1410,8 +1455,6 @@ yyparse () | |||
1410 | #endif | 1455 | #endif |
1411 | #endif | 1456 | #endif |
1412 | { | 1457 | { |
1413 | |||
1414 | |||
1415 | int yystate; | 1458 | int yystate; |
1416 | /* Number of tokens to shift before error messages enabled. */ | 1459 | /* Number of tokens to shift before error messages enabled. */ |
1417 | int yyerrstatus; | 1460 | int yyerrstatus; |
@@ -1566,7 +1609,7 @@ yybackup: | |||
1566 | 1609 | ||
1567 | /* First try to decide what to do without reference to lookahead token. */ | 1610 | /* First try to decide what to do without reference to lookahead token. */ |
1568 | yyn = yypact[yystate]; | 1611 | yyn = yypact[yystate]; |
1569 | if (yyn == YYPACT_NINF) | 1612 | if (yypact_value_is_default (yyn)) |
1570 | goto yydefault; | 1613 | goto yydefault; |
1571 | 1614 | ||
1572 | /* Not known => get a lookahead token if don't already have one. */ | 1615 | /* Not known => get a lookahead token if don't already have one. */ |
@@ -1597,8 +1640,8 @@ yybackup: | |||
1597 | yyn = yytable[yyn]; | 1640 | yyn = yytable[yyn]; |
1598 | if (yyn <= 0) | 1641 | if (yyn <= 0) |
1599 | { | 1642 | { |
1600 | if (yyn == 0 || yyn == YYTABLE_NINF) | 1643 | if (yytable_value_is_error (yyn)) |
1601 | goto yyerrlab; | 1644 | goto yyerrlab; |
1602 | yyn = -yyn; | 1645 | yyn = -yyn; |
1603 | goto yyreduce; | 1646 | goto yyreduce; |
1604 | } | 1647 | } |
@@ -1653,64 +1696,46 @@ yyreduce: | |||
1653 | { | 1696 | { |
1654 | case 4: | 1697 | case 4: |
1655 | 1698 | ||
1656 | /* Line 1455 of yacc.c */ | 1699 | { is_typedef = 0; is_extern = 0; current_name = NULL; decl_spec = NULL; } |
1657 | #line 109 "scripts/genksyms/parse.y" | ||
1658 | { is_typedef = 0; is_extern = 0; current_name = NULL; decl_spec = NULL; ;} | ||
1659 | break; | 1700 | break; |
1660 | 1701 | ||
1661 | case 5: | 1702 | case 5: |
1662 | 1703 | ||
1663 | /* Line 1455 of yacc.c */ | 1704 | { free_list(*(yyvsp[(2) - (2)]), NULL); *(yyvsp[(2) - (2)]) = NULL; } |
1664 | #line 111 "scripts/genksyms/parse.y" | ||
1665 | { free_list(*(yyvsp[(2) - (2)]), NULL); *(yyvsp[(2) - (2)]) = NULL; ;} | ||
1666 | break; | 1705 | break; |
1667 | 1706 | ||
1668 | case 6: | 1707 | case 6: |
1669 | 1708 | ||
1670 | /* Line 1455 of yacc.c */ | 1709 | { is_typedef = 1; } |
1671 | #line 115 "scripts/genksyms/parse.y" | ||
1672 | { is_typedef = 1; ;} | ||
1673 | break; | 1710 | break; |
1674 | 1711 | ||
1675 | case 7: | 1712 | case 7: |
1676 | 1713 | ||
1677 | /* Line 1455 of yacc.c */ | 1714 | { (yyval) = (yyvsp[(4) - (4)]); } |
1678 | #line 116 "scripts/genksyms/parse.y" | ||
1679 | { (yyval) = (yyvsp[(4) - (4)]); ;} | ||
1680 | break; | 1715 | break; |
1681 | 1716 | ||
1682 | case 8: | 1717 | case 8: |
1683 | 1718 | ||
1684 | /* Line 1455 of yacc.c */ | 1719 | { is_typedef = 1; } |
1685 | #line 117 "scripts/genksyms/parse.y" | ||
1686 | { is_typedef = 1; ;} | ||
1687 | break; | 1720 | break; |
1688 | 1721 | ||
1689 | case 9: | 1722 | case 9: |
1690 | 1723 | ||
1691 | /* Line 1455 of yacc.c */ | 1724 | { (yyval) = (yyvsp[(3) - (3)]); } |
1692 | #line 118 "scripts/genksyms/parse.y" | ||
1693 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
1694 | break; | 1725 | break; |
1695 | 1726 | ||
1696 | case 14: | 1727 | case 14: |
1697 | 1728 | ||
1698 | /* Line 1455 of yacc.c */ | 1729 | { (yyval) = (yyvsp[(2) - (2)]); } |
1699 | #line 123 "scripts/genksyms/parse.y" | ||
1700 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
1701 | break; | 1730 | break; |
1702 | 1731 | ||
1703 | case 15: | 1732 | case 15: |
1704 | 1733 | ||
1705 | /* Line 1455 of yacc.c */ | 1734 | { (yyval) = (yyvsp[(2) - (2)]); } |
1706 | #line 124 "scripts/genksyms/parse.y" | ||
1707 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
1708 | break; | 1735 | break; |
1709 | 1736 | ||
1710 | case 16: | 1737 | case 16: |
1711 | 1738 | ||
1712 | /* Line 1455 of yacc.c */ | ||
1713 | #line 129 "scripts/genksyms/parse.y" | ||
1714 | { if (current_name) { | 1739 | { if (current_name) { |
1715 | struct string_list *decl = (*(yyvsp[(3) - (3)]))->next; | 1740 | struct string_list *decl = (*(yyvsp[(3) - (3)]))->next; |
1716 | (*(yyvsp[(3) - (3)]))->next = NULL; | 1741 | (*(yyvsp[(3) - (3)]))->next = NULL; |
@@ -1720,33 +1745,27 @@ yyreduce: | |||
1720 | current_name = NULL; | 1745 | current_name = NULL; |
1721 | } | 1746 | } |
1722 | (yyval) = (yyvsp[(3) - (3)]); | 1747 | (yyval) = (yyvsp[(3) - (3)]); |
1723 | ;} | 1748 | } |
1724 | break; | 1749 | break; |
1725 | 1750 | ||
1726 | case 17: | 1751 | case 17: |
1727 | 1752 | ||
1728 | /* Line 1455 of yacc.c */ | 1753 | { (yyval) = NULL; } |
1729 | #line 142 "scripts/genksyms/parse.y" | ||
1730 | { (yyval) = NULL; ;} | ||
1731 | break; | 1754 | break; |
1732 | 1755 | ||
1733 | case 19: | 1756 | case 19: |
1734 | 1757 | ||
1735 | /* Line 1455 of yacc.c */ | ||
1736 | #line 148 "scripts/genksyms/parse.y" | ||
1737 | { struct string_list *decl = *(yyvsp[(1) - (1)]); | 1758 | { struct string_list *decl = *(yyvsp[(1) - (1)]); |
1738 | *(yyvsp[(1) - (1)]) = NULL; | 1759 | *(yyvsp[(1) - (1)]) = NULL; |
1739 | add_symbol(current_name, | 1760 | add_symbol(current_name, |
1740 | is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); | 1761 | is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); |
1741 | current_name = NULL; | 1762 | current_name = NULL; |
1742 | (yyval) = (yyvsp[(1) - (1)]); | 1763 | (yyval) = (yyvsp[(1) - (1)]); |
1743 | ;} | 1764 | } |
1744 | break; | 1765 | break; |
1745 | 1766 | ||
1746 | case 20: | 1767 | case 20: |
1747 | 1768 | ||
1748 | /* Line 1455 of yacc.c */ | ||
1749 | #line 156 "scripts/genksyms/parse.y" | ||
1750 | { struct string_list *decl = *(yyvsp[(3) - (3)]); | 1769 | { struct string_list *decl = *(yyvsp[(3) - (3)]); |
1751 | *(yyvsp[(3) - (3)]) = NULL; | 1770 | *(yyvsp[(3) - (3)]) = NULL; |
1752 | free_list(*(yyvsp[(2) - (3)]), NULL); | 1771 | free_list(*(yyvsp[(2) - (3)]), NULL); |
@@ -1755,189 +1774,128 @@ yyreduce: | |||
1755 | is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); | 1774 | is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); |
1756 | current_name = NULL; | 1775 | current_name = NULL; |
1757 | (yyval) = (yyvsp[(3) - (3)]); | 1776 | (yyval) = (yyvsp[(3) - (3)]); |
1758 | ;} | 1777 | } |
1759 | break; | 1778 | break; |
1760 | 1779 | ||
1761 | case 21: | 1780 | case 21: |
1762 | 1781 | ||
1763 | /* Line 1455 of yacc.c */ | 1782 | { (yyval) = (yyvsp[(4) - (4)]) ? (yyvsp[(4) - (4)]) : (yyvsp[(3) - (4)]) ? (yyvsp[(3) - (4)]) : (yyvsp[(2) - (4)]) ? (yyvsp[(2) - (4)]) : (yyvsp[(1) - (4)]); } |
1764 | #line 169 "scripts/genksyms/parse.y" | ||
1765 | { (yyval) = (yyvsp[(4) - (4)]) ? (yyvsp[(4) - (4)]) : (yyvsp[(3) - (4)]) ? (yyvsp[(3) - (4)]) : (yyvsp[(2) - (4)]) ? (yyvsp[(2) - (4)]) : (yyvsp[(1) - (4)]); ;} | ||
1766 | break; | 1783 | break; |
1767 | 1784 | ||
1768 | case 22: | 1785 | case 22: |
1769 | 1786 | ||
1770 | /* Line 1455 of yacc.c */ | 1787 | { decl_spec = NULL; } |
1771 | #line 174 "scripts/genksyms/parse.y" | ||
1772 | { decl_spec = NULL; ;} | ||
1773 | break; | 1788 | break; |
1774 | 1789 | ||
1775 | case 24: | 1790 | case 24: |
1776 | 1791 | ||
1777 | /* Line 1455 of yacc.c */ | 1792 | { decl_spec = *(yyvsp[(1) - (1)]); } |
1778 | #line 179 "scripts/genksyms/parse.y" | ||
1779 | { decl_spec = *(yyvsp[(1) - (1)]); ;} | ||
1780 | break; | 1793 | break; |
1781 | 1794 | ||
1782 | case 25: | 1795 | case 25: |
1783 | 1796 | ||
1784 | /* Line 1455 of yacc.c */ | 1797 | { decl_spec = *(yyvsp[(2) - (2)]); } |
1785 | #line 180 "scripts/genksyms/parse.y" | ||
1786 | { decl_spec = *(yyvsp[(2) - (2)]); ;} | ||
1787 | break; | 1798 | break; |
1788 | 1799 | ||
1789 | case 26: | 1800 | case 26: |
1790 | 1801 | ||
1791 | /* Line 1455 of yacc.c */ | ||
1792 | #line 185 "scripts/genksyms/parse.y" | ||
1793 | { /* Version 2 checksumming ignores storage class, as that | 1802 | { /* Version 2 checksumming ignores storage class, as that |
1794 | is really irrelevant to the linkage. */ | 1803 | is really irrelevant to the linkage. */ |
1795 | remove_node((yyvsp[(1) - (1)])); | 1804 | remove_node((yyvsp[(1) - (1)])); |
1796 | (yyval) = (yyvsp[(1) - (1)]); | 1805 | (yyval) = (yyvsp[(1) - (1)]); |
1797 | ;} | 1806 | } |
1798 | break; | 1807 | break; |
1799 | 1808 | ||
1800 | case 31: | 1809 | case 31: |
1801 | 1810 | ||
1802 | /* Line 1455 of yacc.c */ | 1811 | { is_extern = 1; (yyval) = (yyvsp[(1) - (1)]); } |
1803 | #line 197 "scripts/genksyms/parse.y" | ||
1804 | { is_extern = 1; (yyval) = (yyvsp[(1) - (1)]); ;} | ||
1805 | break; | 1812 | break; |
1806 | 1813 | ||
1807 | case 32: | 1814 | case 32: |
1808 | 1815 | ||
1809 | /* Line 1455 of yacc.c */ | 1816 | { is_extern = 0; (yyval) = (yyvsp[(1) - (1)]); } |
1810 | #line 198 "scripts/genksyms/parse.y" | ||
1811 | { is_extern = 0; (yyval) = (yyvsp[(1) - (1)]); ;} | ||
1812 | break; | 1817 | break; |
1813 | 1818 | ||
1814 | case 37: | 1819 | case 37: |
1815 | 1820 | ||
1816 | /* Line 1455 of yacc.c */ | 1821 | { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_STRUCT; (yyval) = (yyvsp[(2) - (2)]); } |
1817 | #line 210 "scripts/genksyms/parse.y" | ||
1818 | { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_STRUCT; (yyval) = (yyvsp[(2) - (2)]); ;} | ||
1819 | break; | 1822 | break; |
1820 | 1823 | ||
1821 | case 38: | 1824 | case 38: |
1822 | 1825 | ||
1823 | /* Line 1455 of yacc.c */ | 1826 | { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_UNION; (yyval) = (yyvsp[(2) - (2)]); } |
1824 | #line 212 "scripts/genksyms/parse.y" | ||
1825 | { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_UNION; (yyval) = (yyvsp[(2) - (2)]); ;} | ||
1826 | break; | 1827 | break; |
1827 | 1828 | ||
1828 | case 39: | 1829 | case 39: |
1829 | 1830 | ||
1830 | /* Line 1455 of yacc.c */ | 1831 | { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_ENUM; (yyval) = (yyvsp[(2) - (2)]); } |
1831 | #line 214 "scripts/genksyms/parse.y" | ||
1832 | { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_ENUM; (yyval) = (yyvsp[(2) - (2)]); ;} | ||
1833 | break; | 1832 | break; |
1834 | 1833 | ||
1835 | case 40: | 1834 | case 40: |
1836 | 1835 | ||
1837 | /* Line 1455 of yacc.c */ | 1836 | { record_compound((yyvsp[(1) - (3)]), (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)]), SYM_STRUCT); (yyval) = (yyvsp[(3) - (3)]); } |
1838 | #line 218 "scripts/genksyms/parse.y" | ||
1839 | { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r; | ||
1840 | r = copy_node(i); r->tag = SYM_STRUCT; | ||
1841 | r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL; | ||
1842 | add_symbol(i->string, SYM_STRUCT, s, is_extern); | ||
1843 | (yyval) = (yyvsp[(3) - (3)]); | ||
1844 | ;} | ||
1845 | break; | 1837 | break; |
1846 | 1838 | ||
1847 | case 41: | 1839 | case 41: |
1848 | 1840 | ||
1849 | /* Line 1455 of yacc.c */ | 1841 | { record_compound((yyvsp[(1) - (3)]), (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)]), SYM_UNION); (yyval) = (yyvsp[(3) - (3)]); } |
1850 | #line 225 "scripts/genksyms/parse.y" | ||
1851 | { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r; | ||
1852 | r = copy_node(i); r->tag = SYM_UNION; | ||
1853 | r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL; | ||
1854 | add_symbol(i->string, SYM_UNION, s, is_extern); | ||
1855 | (yyval) = (yyvsp[(3) - (3)]); | ||
1856 | ;} | ||
1857 | break; | 1842 | break; |
1858 | 1843 | ||
1859 | case 42: | 1844 | case 42: |
1860 | 1845 | ||
1861 | /* Line 1455 of yacc.c */ | 1846 | { record_compound((yyvsp[(1) - (3)]), (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)]), SYM_ENUM); (yyval) = (yyvsp[(3) - (3)]); } |
1862 | #line 232 "scripts/genksyms/parse.y" | ||
1863 | { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r; | ||
1864 | r = copy_node(i); r->tag = SYM_ENUM; | ||
1865 | r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL; | ||
1866 | add_symbol(i->string, SYM_ENUM, s, is_extern); | ||
1867 | (yyval) = (yyvsp[(3) - (3)]); | ||
1868 | ;} | ||
1869 | break; | 1847 | break; |
1870 | 1848 | ||
1871 | case 43: | 1849 | case 43: |
1872 | 1850 | ||
1873 | /* Line 1455 of yacc.c */ | 1851 | { add_symbol(NULL, SYM_ENUM, NULL, 0); (yyval) = (yyvsp[(2) - (2)]); } |
1874 | #line 242 "scripts/genksyms/parse.y" | ||
1875 | { add_symbol(NULL, SYM_ENUM, NULL, 0); (yyval) = (yyvsp[(2) - (2)]); ;} | ||
1876 | break; | 1852 | break; |
1877 | 1853 | ||
1878 | case 44: | 1854 | case 44: |
1879 | 1855 | ||
1880 | /* Line 1455 of yacc.c */ | 1856 | { (yyval) = (yyvsp[(2) - (2)]); } |
1881 | #line 244 "scripts/genksyms/parse.y" | ||
1882 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
1883 | break; | 1857 | break; |
1884 | 1858 | ||
1885 | case 45: | 1859 | case 45: |
1886 | 1860 | ||
1887 | /* Line 1455 of yacc.c */ | 1861 | { (yyval) = (yyvsp[(2) - (2)]); } |
1888 | #line 245 "scripts/genksyms/parse.y" | ||
1889 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
1890 | break; | 1862 | break; |
1891 | 1863 | ||
1892 | case 56: | 1864 | case 56: |
1893 | 1865 | ||
1894 | /* Line 1455 of yacc.c */ | 1866 | { (*(yyvsp[(1) - (1)]))->tag = SYM_TYPEDEF; (yyval) = (yyvsp[(1) - (1)]); } |
1895 | #line 259 "scripts/genksyms/parse.y" | ||
1896 | { (*(yyvsp[(1) - (1)]))->tag = SYM_TYPEDEF; (yyval) = (yyvsp[(1) - (1)]); ;} | ||
1897 | break; | 1867 | break; |
1898 | 1868 | ||
1899 | case 57: | 1869 | case 57: |
1900 | 1870 | ||
1901 | /* Line 1455 of yacc.c */ | 1871 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); } |
1902 | #line 264 "scripts/genksyms/parse.y" | ||
1903 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} | ||
1904 | break; | 1872 | break; |
1905 | 1873 | ||
1906 | case 58: | 1874 | case 58: |
1907 | 1875 | ||
1908 | /* Line 1455 of yacc.c */ | 1876 | { (yyval) = NULL; } |
1909 | #line 268 "scripts/genksyms/parse.y" | ||
1910 | { (yyval) = NULL; ;} | ||
1911 | break; | 1877 | break; |
1912 | 1878 | ||
1913 | case 61: | 1879 | case 61: |
1914 | 1880 | ||
1915 | /* Line 1455 of yacc.c */ | 1881 | { (yyval) = (yyvsp[(2) - (2)]); } |
1916 | #line 274 "scripts/genksyms/parse.y" | ||
1917 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
1918 | break; | 1882 | break; |
1919 | 1883 | ||
1920 | case 65: | 1884 | case 65: |
1921 | 1885 | ||
1922 | /* Line 1455 of yacc.c */ | ||
1923 | #line 280 "scripts/genksyms/parse.y" | ||
1924 | { /* restrict has no effect in prototypes so ignore it */ | 1886 | { /* restrict has no effect in prototypes so ignore it */ |
1925 | remove_node((yyvsp[(1) - (1)])); | 1887 | remove_node((yyvsp[(1) - (1)])); |
1926 | (yyval) = (yyvsp[(1) - (1)]); | 1888 | (yyval) = (yyvsp[(1) - (1)]); |
1927 | ;} | 1889 | } |
1928 | break; | 1890 | break; |
1929 | 1891 | ||
1930 | case 66: | 1892 | case 66: |
1931 | 1893 | ||
1932 | /* Line 1455 of yacc.c */ | 1894 | { (yyval) = (yyvsp[(2) - (2)]); } |
1933 | #line 287 "scripts/genksyms/parse.y" | ||
1934 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
1935 | break; | 1895 | break; |
1936 | 1896 | ||
1937 | case 68: | 1897 | case 68: |
1938 | 1898 | ||
1939 | /* Line 1455 of yacc.c */ | ||
1940 | #line 293 "scripts/genksyms/parse.y" | ||
1941 | { if (current_name != NULL) { | 1899 | { if (current_name != NULL) { |
1942 | error_with_pos("unexpected second declaration name"); | 1900 | error_with_pos("unexpected second declaration name"); |
1943 | YYERROR; | 1901 | YYERROR; |
@@ -1945,361 +1903,276 @@ yyreduce: | |||
1945 | current_name = (*(yyvsp[(1) - (1)]))->string; | 1903 | current_name = (*(yyvsp[(1) - (1)]))->string; |
1946 | (yyval) = (yyvsp[(1) - (1)]); | 1904 | (yyval) = (yyvsp[(1) - (1)]); |
1947 | } | 1905 | } |
1948 | ;} | 1906 | } |
1949 | break; | 1907 | break; |
1950 | 1908 | ||
1951 | case 69: | 1909 | case 69: |
1952 | 1910 | ||
1953 | /* Line 1455 of yacc.c */ | 1911 | { (yyval) = (yyvsp[(4) - (4)]); } |
1954 | #line 302 "scripts/genksyms/parse.y" | ||
1955 | { (yyval) = (yyvsp[(4) - (4)]); ;} | ||
1956 | break; | 1912 | break; |
1957 | 1913 | ||
1958 | case 70: | 1914 | case 70: |
1959 | 1915 | ||
1960 | /* Line 1455 of yacc.c */ | 1916 | { (yyval) = (yyvsp[(4) - (4)]); } |
1961 | #line 304 "scripts/genksyms/parse.y" | ||
1962 | { (yyval) = (yyvsp[(4) - (4)]); ;} | ||
1963 | break; | 1917 | break; |
1964 | 1918 | ||
1965 | case 71: | 1919 | case 71: |
1966 | 1920 | ||
1967 | /* Line 1455 of yacc.c */ | 1921 | { (yyval) = (yyvsp[(2) - (2)]); } |
1968 | #line 306 "scripts/genksyms/parse.y" | ||
1969 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
1970 | break; | 1922 | break; |
1971 | 1923 | ||
1972 | case 72: | 1924 | case 72: |
1973 | 1925 | ||
1974 | /* Line 1455 of yacc.c */ | 1926 | { (yyval) = (yyvsp[(3) - (3)]); } |
1975 | #line 308 "scripts/genksyms/parse.y" | ||
1976 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
1977 | break; | 1927 | break; |
1978 | 1928 | ||
1979 | case 73: | 1929 | case 73: |
1980 | 1930 | ||
1981 | /* Line 1455 of yacc.c */ | 1931 | { (yyval) = (yyvsp[(3) - (3)]); } |
1982 | #line 310 "scripts/genksyms/parse.y" | ||
1983 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
1984 | break; | 1932 | break; |
1985 | 1933 | ||
1986 | case 74: | 1934 | case 74: |
1987 | 1935 | ||
1988 | /* Line 1455 of yacc.c */ | 1936 | { (yyval) = (yyvsp[(2) - (2)]); } |
1989 | #line 316 "scripts/genksyms/parse.y" | ||
1990 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
1991 | break; | 1937 | break; |
1992 | 1938 | ||
1993 | case 78: | 1939 | case 78: |
1994 | 1940 | ||
1995 | /* Line 1455 of yacc.c */ | 1941 | { (yyval) = (yyvsp[(4) - (4)]); } |
1996 | #line 324 "scripts/genksyms/parse.y" | ||
1997 | { (yyval) = (yyvsp[(4) - (4)]); ;} | ||
1998 | break; | 1942 | break; |
1999 | 1943 | ||
2000 | case 79: | 1944 | case 79: |
2001 | 1945 | ||
2002 | /* Line 1455 of yacc.c */ | 1946 | { (yyval) = (yyvsp[(4) - (4)]); } |
2003 | #line 326 "scripts/genksyms/parse.y" | ||
2004 | { (yyval) = (yyvsp[(4) - (4)]); ;} | ||
2005 | break; | 1947 | break; |
2006 | 1948 | ||
2007 | case 80: | 1949 | case 80: |
2008 | 1950 | ||
2009 | /* Line 1455 of yacc.c */ | 1951 | { (yyval) = (yyvsp[(2) - (2)]); } |
2010 | #line 328 "scripts/genksyms/parse.y" | ||
2011 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
2012 | break; | 1952 | break; |
2013 | 1953 | ||
2014 | case 81: | 1954 | case 81: |
2015 | 1955 | ||
2016 | /* Line 1455 of yacc.c */ | 1956 | { (yyval) = (yyvsp[(3) - (3)]); } |
2017 | #line 330 "scripts/genksyms/parse.y" | ||
2018 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
2019 | break; | 1957 | break; |
2020 | 1958 | ||
2021 | case 82: | 1959 | case 82: |
2022 | 1960 | ||
2023 | /* Line 1455 of yacc.c */ | 1961 | { (yyval) = (yyvsp[(3) - (3)]); } |
2024 | #line 332 "scripts/genksyms/parse.y" | ||
2025 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
2026 | break; | 1962 | break; |
2027 | 1963 | ||
2028 | case 83: | 1964 | case 83: |
2029 | 1965 | ||
2030 | /* Line 1455 of yacc.c */ | 1966 | { (yyval) = (yyvsp[(2) - (2)]); } |
2031 | #line 336 "scripts/genksyms/parse.y" | ||
2032 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
2033 | break; | 1967 | break; |
2034 | 1968 | ||
2035 | case 85: | 1969 | case 85: |
2036 | 1970 | ||
2037 | /* Line 1455 of yacc.c */ | 1971 | { (yyval) = (yyvsp[(3) - (3)]); } |
2038 | #line 338 "scripts/genksyms/parse.y" | ||
2039 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
2040 | break; | 1972 | break; |
2041 | 1973 | ||
2042 | case 86: | 1974 | case 86: |
2043 | 1975 | ||
2044 | /* Line 1455 of yacc.c */ | 1976 | { (yyval) = NULL; } |
2045 | #line 342 "scripts/genksyms/parse.y" | ||
2046 | { (yyval) = NULL; ;} | ||
2047 | break; | 1977 | break; |
2048 | 1978 | ||
2049 | case 89: | 1979 | case 89: |
2050 | 1980 | ||
2051 | /* Line 1455 of yacc.c */ | 1981 | { (yyval) = (yyvsp[(3) - (3)]); } |
2052 | #line 349 "scripts/genksyms/parse.y" | ||
2053 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
2054 | break; | 1982 | break; |
2055 | 1983 | ||
2056 | case 90: | 1984 | case 90: |
2057 | 1985 | ||
2058 | /* Line 1455 of yacc.c */ | 1986 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); } |
2059 | #line 354 "scripts/genksyms/parse.y" | ||
2060 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} | ||
2061 | break; | 1987 | break; |
2062 | 1988 | ||
2063 | case 91: | 1989 | case 91: |
2064 | 1990 | ||
2065 | /* Line 1455 of yacc.c */ | 1991 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); } |
2066 | #line 359 "scripts/genksyms/parse.y" | ||
2067 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} | ||
2068 | break; | 1992 | break; |
2069 | 1993 | ||
2070 | case 93: | 1994 | case 93: |
2071 | 1995 | ||
2072 | /* Line 1455 of yacc.c */ | 1996 | { (yyval) = NULL; } |
2073 | #line 364 "scripts/genksyms/parse.y" | ||
2074 | { (yyval) = NULL; ;} | ||
2075 | break; | 1997 | break; |
2076 | 1998 | ||
2077 | case 94: | 1999 | case 94: |
2078 | 2000 | ||
2079 | /* Line 1455 of yacc.c */ | ||
2080 | #line 366 "scripts/genksyms/parse.y" | ||
2081 | { /* For version 2 checksums, we don't want to remember | 2001 | { /* For version 2 checksums, we don't want to remember |
2082 | private parameter names. */ | 2002 | private parameter names. */ |
2083 | remove_node((yyvsp[(1) - (1)])); | 2003 | remove_node((yyvsp[(1) - (1)])); |
2084 | (yyval) = (yyvsp[(1) - (1)]); | 2004 | (yyval) = (yyvsp[(1) - (1)]); |
2085 | ;} | 2005 | } |
2086 | break; | 2006 | break; |
2087 | 2007 | ||
2088 | case 95: | 2008 | case 95: |
2089 | 2009 | ||
2090 | /* Line 1455 of yacc.c */ | ||
2091 | #line 374 "scripts/genksyms/parse.y" | ||
2092 | { remove_node((yyvsp[(1) - (1)])); | 2010 | { remove_node((yyvsp[(1) - (1)])); |
2093 | (yyval) = (yyvsp[(1) - (1)]); | 2011 | (yyval) = (yyvsp[(1) - (1)]); |
2094 | ;} | 2012 | } |
2095 | break; | 2013 | break; |
2096 | 2014 | ||
2097 | case 96: | 2015 | case 96: |
2098 | 2016 | ||
2099 | /* Line 1455 of yacc.c */ | 2017 | { (yyval) = (yyvsp[(4) - (4)]); } |
2100 | #line 378 "scripts/genksyms/parse.y" | ||
2101 | { (yyval) = (yyvsp[(4) - (4)]); ;} | ||
2102 | break; | 2018 | break; |
2103 | 2019 | ||
2104 | case 97: | 2020 | case 97: |
2105 | 2021 | ||
2106 | /* Line 1455 of yacc.c */ | 2022 | { (yyval) = (yyvsp[(4) - (4)]); } |
2107 | #line 380 "scripts/genksyms/parse.y" | ||
2108 | { (yyval) = (yyvsp[(4) - (4)]); ;} | ||
2109 | break; | 2023 | break; |
2110 | 2024 | ||
2111 | case 98: | 2025 | case 98: |
2112 | 2026 | ||
2113 | /* Line 1455 of yacc.c */ | 2027 | { (yyval) = (yyvsp[(2) - (2)]); } |
2114 | #line 382 "scripts/genksyms/parse.y" | ||
2115 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
2116 | break; | 2028 | break; |
2117 | 2029 | ||
2118 | case 99: | 2030 | case 99: |
2119 | 2031 | ||
2120 | /* Line 1455 of yacc.c */ | 2032 | { (yyval) = (yyvsp[(3) - (3)]); } |
2121 | #line 384 "scripts/genksyms/parse.y" | ||
2122 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
2123 | break; | 2033 | break; |
2124 | 2034 | ||
2125 | case 100: | 2035 | case 100: |
2126 | 2036 | ||
2127 | /* Line 1455 of yacc.c */ | 2037 | { (yyval) = (yyvsp[(3) - (3)]); } |
2128 | #line 386 "scripts/genksyms/parse.y" | ||
2129 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
2130 | break; | 2038 | break; |
2131 | 2039 | ||
2132 | case 101: | 2040 | case 101: |
2133 | 2041 | ||
2134 | /* Line 1455 of yacc.c */ | ||
2135 | #line 391 "scripts/genksyms/parse.y" | ||
2136 | { struct string_list *decl = *(yyvsp[(2) - (3)]); | 2042 | { struct string_list *decl = *(yyvsp[(2) - (3)]); |
2137 | *(yyvsp[(2) - (3)]) = NULL; | 2043 | *(yyvsp[(2) - (3)]) = NULL; |
2138 | add_symbol(current_name, SYM_NORMAL, decl, is_extern); | 2044 | add_symbol(current_name, SYM_NORMAL, decl, is_extern); |
2139 | (yyval) = (yyvsp[(3) - (3)]); | 2045 | (yyval) = (yyvsp[(3) - (3)]); |
2140 | ;} | 2046 | } |
2141 | break; | 2047 | break; |
2142 | 2048 | ||
2143 | case 102: | 2049 | case 102: |
2144 | 2050 | ||
2145 | /* Line 1455 of yacc.c */ | 2051 | { (yyval) = NULL; } |
2146 | #line 399 "scripts/genksyms/parse.y" | ||
2147 | { (yyval) = NULL; ;} | ||
2148 | break; | 2052 | break; |
2149 | 2053 | ||
2150 | case 104: | 2054 | case 104: |
2151 | 2055 | ||
2152 | /* Line 1455 of yacc.c */ | 2056 | { remove_list((yyvsp[(2) - (2)]), &(*(yyvsp[(1) - (2)]))->next); (yyval) = (yyvsp[(2) - (2)]); } |
2153 | #line 406 "scripts/genksyms/parse.y" | ||
2154 | { remove_list((yyvsp[(2) - (2)]), &(*(yyvsp[(1) - (2)]))->next); (yyval) = (yyvsp[(2) - (2)]); ;} | ||
2155 | break; | 2057 | break; |
2156 | 2058 | ||
2157 | case 105: | 2059 | case 105: |
2158 | 2060 | ||
2159 | /* Line 1455 of yacc.c */ | 2061 | { (yyval) = (yyvsp[(3) - (3)]); } |
2160 | #line 410 "scripts/genksyms/parse.y" | ||
2161 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
2162 | break; | 2062 | break; |
2163 | 2063 | ||
2164 | case 106: | 2064 | case 106: |
2165 | 2065 | ||
2166 | /* Line 1455 of yacc.c */ | 2066 | { (yyval) = (yyvsp[(3) - (3)]); } |
2167 | #line 411 "scripts/genksyms/parse.y" | ||
2168 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
2169 | break; | 2067 | break; |
2170 | 2068 | ||
2171 | case 107: | 2069 | case 107: |
2172 | 2070 | ||
2173 | /* Line 1455 of yacc.c */ | 2071 | { (yyval) = NULL; } |
2174 | #line 415 "scripts/genksyms/parse.y" | ||
2175 | { (yyval) = NULL; ;} | ||
2176 | break; | 2072 | break; |
2177 | 2073 | ||
2178 | case 110: | 2074 | case 110: |
2179 | 2075 | ||
2180 | /* Line 1455 of yacc.c */ | 2076 | { (yyval) = (yyvsp[(2) - (2)]); } |
2181 | #line 421 "scripts/genksyms/parse.y" | ||
2182 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
2183 | break; | 2077 | break; |
2184 | 2078 | ||
2185 | case 111: | 2079 | case 111: |
2186 | 2080 | ||
2187 | /* Line 1455 of yacc.c */ | 2081 | { (yyval) = (yyvsp[(3) - (3)]); } |
2188 | #line 426 "scripts/genksyms/parse.y" | ||
2189 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
2190 | break; | 2082 | break; |
2191 | 2083 | ||
2192 | case 112: | 2084 | case 112: |
2193 | 2085 | ||
2194 | /* Line 1455 of yacc.c */ | 2086 | { (yyval) = (yyvsp[(2) - (2)]); } |
2195 | #line 428 "scripts/genksyms/parse.y" | ||
2196 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
2197 | break; | 2087 | break; |
2198 | 2088 | ||
2199 | case 113: | 2089 | case 113: |
2200 | 2090 | ||
2201 | /* Line 1455 of yacc.c */ | 2091 | { (yyval) = NULL; } |
2202 | #line 432 "scripts/genksyms/parse.y" | ||
2203 | { (yyval) = NULL; ;} | ||
2204 | break; | 2092 | break; |
2205 | 2093 | ||
2206 | case 116: | 2094 | case 116: |
2207 | 2095 | ||
2208 | /* Line 1455 of yacc.c */ | 2096 | { (yyval) = (yyvsp[(3) - (3)]); } |
2209 | #line 438 "scripts/genksyms/parse.y" | ||
2210 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
2211 | break; | 2097 | break; |
2212 | 2098 | ||
2213 | case 117: | 2099 | case 117: |
2214 | 2100 | ||
2215 | /* Line 1455 of yacc.c */ | 2101 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); } |
2216 | #line 442 "scripts/genksyms/parse.y" | ||
2217 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} | ||
2218 | break; | 2102 | break; |
2219 | 2103 | ||
2220 | case 118: | 2104 | case 118: |
2221 | 2105 | ||
2222 | /* Line 1455 of yacc.c */ | 2106 | { (yyval) = (yyvsp[(2) - (2)]); } |
2223 | #line 443 "scripts/genksyms/parse.y" | ||
2224 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
2225 | break; | 2107 | break; |
2226 | 2108 | ||
2227 | case 120: | 2109 | case 120: |
2228 | 2110 | ||
2229 | /* Line 1455 of yacc.c */ | 2111 | { (yyval) = (yyvsp[(2) - (2)]); } |
2230 | #line 448 "scripts/genksyms/parse.y" | ||
2231 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
2232 | break; | 2112 | break; |
2233 | 2113 | ||
2234 | case 121: | 2114 | case 121: |
2235 | 2115 | ||
2236 | /* Line 1455 of yacc.c */ | 2116 | { (yyval) = NULL; } |
2237 | #line 452 "scripts/genksyms/parse.y" | ||
2238 | { (yyval) = NULL; ;} | ||
2239 | break; | 2117 | break; |
2240 | 2118 | ||
2241 | case 123: | 2119 | case 123: |
2242 | 2120 | ||
2243 | /* Line 1455 of yacc.c */ | 2121 | { (yyval) = (yyvsp[(3) - (3)]); } |
2244 | #line 457 "scripts/genksyms/parse.y" | ||
2245 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
2246 | break; | 2122 | break; |
2247 | 2123 | ||
2248 | case 124: | 2124 | case 124: |
2249 | 2125 | ||
2250 | /* Line 1455 of yacc.c */ | 2126 | { (yyval) = (yyvsp[(4) - (4)]); } |
2251 | #line 458 "scripts/genksyms/parse.y" | ||
2252 | { (yyval) = (yyvsp[(4) - (4)]); ;} | ||
2253 | break; | 2127 | break; |
2254 | 2128 | ||
2255 | case 127: | 2129 | case 127: |
2256 | 2130 | ||
2257 | /* Line 1455 of yacc.c */ | ||
2258 | #line 467 "scripts/genksyms/parse.y" | ||
2259 | { | 2131 | { |
2260 | const char *name = strdup((*(yyvsp[(1) - (1)]))->string); | 2132 | const char *name = strdup((*(yyvsp[(1) - (1)]))->string); |
2261 | add_symbol(name, SYM_ENUM_CONST, NULL, 0); | 2133 | add_symbol(name, SYM_ENUM_CONST, NULL, 0); |
2262 | ;} | 2134 | } |
2263 | break; | 2135 | break; |
2264 | 2136 | ||
2265 | case 128: | 2137 | case 128: |
2266 | 2138 | ||
2267 | /* Line 1455 of yacc.c */ | ||
2268 | #line 472 "scripts/genksyms/parse.y" | ||
2269 | { | 2139 | { |
2270 | const char *name = strdup((*(yyvsp[(1) - (3)]))->string); | 2140 | const char *name = strdup((*(yyvsp[(1) - (3)]))->string); |
2271 | struct string_list *expr = copy_list_range(*(yyvsp[(3) - (3)]), *(yyvsp[(2) - (3)])); | 2141 | struct string_list *expr = copy_list_range(*(yyvsp[(3) - (3)]), *(yyvsp[(2) - (3)])); |
2272 | add_symbol(name, SYM_ENUM_CONST, expr, 0); | 2142 | add_symbol(name, SYM_ENUM_CONST, expr, 0); |
2273 | ;} | 2143 | } |
2274 | break; | 2144 | break; |
2275 | 2145 | ||
2276 | case 129: | 2146 | case 129: |
2277 | 2147 | ||
2278 | /* Line 1455 of yacc.c */ | 2148 | { (yyval) = (yyvsp[(2) - (2)]); } |
2279 | #line 479 "scripts/genksyms/parse.y" | ||
2280 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
2281 | break; | 2149 | break; |
2282 | 2150 | ||
2283 | case 130: | 2151 | case 130: |
2284 | 2152 | ||
2285 | /* Line 1455 of yacc.c */ | 2153 | { (yyval) = NULL; } |
2286 | #line 483 "scripts/genksyms/parse.y" | ||
2287 | { (yyval) = NULL; ;} | ||
2288 | break; | 2154 | break; |
2289 | 2155 | ||
2290 | case 132: | 2156 | case 132: |
2291 | 2157 | ||
2292 | /* Line 1455 of yacc.c */ | 2158 | { export_symbol((*(yyvsp[(3) - (5)]))->string); (yyval) = (yyvsp[(5) - (5)]); } |
2293 | #line 489 "scripts/genksyms/parse.y" | ||
2294 | { export_symbol((*(yyvsp[(3) - (5)]))->string); (yyval) = (yyvsp[(5) - (5)]); ;} | ||
2295 | break; | 2159 | break; |
2296 | 2160 | ||
2297 | 2161 | ||
2298 | 2162 | ||
2299 | /* Line 1455 of yacc.c */ | ||
2300 | #line 2301 "scripts/genksyms/parse.c" | ||
2301 | default: break; | 2163 | default: break; |
2302 | } | 2164 | } |
2165 | /* User semantic actions sometimes alter yychar, and that requires | ||
2166 | that yytoken be updated with the new translation. We take the | ||
2167 | approach of translating immediately before every use of yytoken. | ||
2168 | One alternative is translating here after every semantic action, | ||
2169 | but that translation would be missed if the semantic action invokes | ||
2170 | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or | ||
2171 | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an | ||
2172 | incorrect destructor might then be invoked immediately. In the | ||
2173 | case of YYERROR or YYBACKUP, subsequent parser actions might lead | ||
2174 | to an incorrect destructor call or verbose syntax error message | ||
2175 | before the lookahead is translated. */ | ||
2303 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); | 2176 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
2304 | 2177 | ||
2305 | YYPOPSTACK (yylen); | 2178 | YYPOPSTACK (yylen); |
@@ -2327,6 +2200,10 @@ yyreduce: | |||
2327 | | yyerrlab -- here on detecting error | | 2200 | | yyerrlab -- here on detecting error | |
2328 | `------------------------------------*/ | 2201 | `------------------------------------*/ |
2329 | yyerrlab: | 2202 | yyerrlab: |
2203 | /* Make sure we have latest lookahead translation. See comments at | ||
2204 | user semantic actions for why this is necessary. */ | ||
2205 | yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); | ||
2206 | |||
2330 | /* If not already recovering from an error, report this error. */ | 2207 | /* If not already recovering from an error, report this error. */ |
2331 | if (!yyerrstatus) | 2208 | if (!yyerrstatus) |
2332 | { | 2209 | { |
@@ -2334,37 +2211,36 @@ yyerrlab: | |||
2334 | #if ! YYERROR_VERBOSE | 2211 | #if ! YYERROR_VERBOSE |
2335 | yyerror (YY_("syntax error")); | 2212 | yyerror (YY_("syntax error")); |
2336 | #else | 2213 | #else |
2214 | # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ | ||
2215 | yyssp, yytoken) | ||
2337 | { | 2216 | { |
2338 | YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); | 2217 | char const *yymsgp = YY_("syntax error"); |
2339 | if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) | 2218 | int yysyntax_error_status; |
2340 | { | 2219 | yysyntax_error_status = YYSYNTAX_ERROR; |
2341 | YYSIZE_T yyalloc = 2 * yysize; | 2220 | if (yysyntax_error_status == 0) |
2342 | if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) | 2221 | yymsgp = yymsg; |
2343 | yyalloc = YYSTACK_ALLOC_MAXIMUM; | 2222 | else if (yysyntax_error_status == 1) |
2344 | if (yymsg != yymsgbuf) | 2223 | { |
2345 | YYSTACK_FREE (yymsg); | 2224 | if (yymsg != yymsgbuf) |
2346 | yymsg = (char *) YYSTACK_ALLOC (yyalloc); | 2225 | YYSTACK_FREE (yymsg); |
2347 | if (yymsg) | 2226 | yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); |
2348 | yymsg_alloc = yyalloc; | 2227 | if (!yymsg) |
2349 | else | 2228 | { |
2350 | { | 2229 | yymsg = yymsgbuf; |
2351 | yymsg = yymsgbuf; | 2230 | yymsg_alloc = sizeof yymsgbuf; |
2352 | yymsg_alloc = sizeof yymsgbuf; | 2231 | yysyntax_error_status = 2; |
2353 | } | 2232 | } |
2354 | } | 2233 | else |
2355 | 2234 | { | |
2356 | if (0 < yysize && yysize <= yymsg_alloc) | 2235 | yysyntax_error_status = YYSYNTAX_ERROR; |
2357 | { | 2236 | yymsgp = yymsg; |
2358 | (void) yysyntax_error (yymsg, yystate, yychar); | 2237 | } |
2359 | yyerror (yymsg); | 2238 | } |
2360 | } | 2239 | yyerror (yymsgp); |
2361 | else | 2240 | if (yysyntax_error_status == 2) |
2362 | { | 2241 | goto yyexhaustedlab; |
2363 | yyerror (YY_("syntax error")); | ||
2364 | if (yysize != 0) | ||
2365 | goto yyexhaustedlab; | ||
2366 | } | ||
2367 | } | 2242 | } |
2243 | # undef YYSYNTAX_ERROR | ||
2368 | #endif | 2244 | #endif |
2369 | } | 2245 | } |
2370 | 2246 | ||
@@ -2423,7 +2299,7 @@ yyerrlab1: | |||
2423 | for (;;) | 2299 | for (;;) |
2424 | { | 2300 | { |
2425 | yyn = yypact[yystate]; | 2301 | yyn = yypact[yystate]; |
2426 | if (yyn != YYPACT_NINF) | 2302 | if (!yypact_value_is_default (yyn)) |
2427 | { | 2303 | { |
2428 | yyn += YYTERROR; | 2304 | yyn += YYTERROR; |
2429 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | 2305 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
@@ -2482,8 +2358,13 @@ yyexhaustedlab: | |||
2482 | 2358 | ||
2483 | yyreturn: | 2359 | yyreturn: |
2484 | if (yychar != YYEMPTY) | 2360 | if (yychar != YYEMPTY) |
2485 | yydestruct ("Cleanup: discarding lookahead", | 2361 | { |
2486 | yytoken, &yylval); | 2362 | /* Make sure we have latest lookahead translation. See comments at |
2363 | user semantic actions for why this is necessary. */ | ||
2364 | yytoken = YYTRANSLATE (yychar); | ||
2365 | yydestruct ("Cleanup: discarding lookahead", | ||
2366 | yytoken, &yylval); | ||
2367 | } | ||
2487 | /* Do not reclaim the symbols of the rule which action triggered | 2368 | /* Do not reclaim the symbols of the rule which action triggered |
2488 | this YYABORT or YYACCEPT. */ | 2369 | this YYABORT or YYACCEPT. */ |
2489 | YYPOPSTACK (yylen); | 2370 | YYPOPSTACK (yylen); |
@@ -2508,8 +2389,6 @@ yyreturn: | |||
2508 | 2389 | ||
2509 | 2390 | ||
2510 | 2391 | ||
2511 | /* Line 1675 of yacc.c */ | ||
2512 | #line 493 "scripts/genksyms/parse.y" | ||
2513 | 2392 | ||
2514 | 2393 | ||
2515 | static void | 2394 | static void |
diff --git a/scripts/genksyms/parse.h_shipped b/scripts/genksyms/parse.tab.h_shipped index 51752366925..93240a3cdec 100644 --- a/scripts/genksyms/parse.h_shipped +++ b/scripts/genksyms/parse.tab.h_shipped | |||
@@ -1,10 +1,8 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.5. */ | ||
1 | 2 | ||
2 | /* A Bison parser, made by GNU Bison 2.4.1. */ | 3 | /* Bison interface for Yacc-like parsers in C |
3 | |||
4 | /* Skeleton interface for Bison's Yacc-like parsers in C | ||
5 | 4 | ||
6 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | 5 | Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. |
7 | Free Software Foundation, Inc. | ||
8 | 6 | ||
9 | 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 |
10 | 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 |
diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y index ba5c242866c..23c39998ad8 100644 --- a/scripts/genksyms/parse.y +++ b/scripts/genksyms/parse.y | |||
@@ -51,6 +51,25 @@ remove_list(struct string_list **pb, struct string_list **pe) | |||
51 | free_list(b, e); | 51 | free_list(b, e); |
52 | } | 52 | } |
53 | 53 | ||
54 | /* Record definition of a struct/union/enum */ | ||
55 | static void record_compound(struct string_list **keyw, | ||
56 | struct string_list **ident, | ||
57 | struct string_list **body, | ||
58 | enum symbol_type type) | ||
59 | { | ||
60 | struct string_list *b = *body, *i = *ident, *r; | ||
61 | |||
62 | if (i->in_source_file) { | ||
63 | remove_node(keyw); | ||
64 | (*ident)->tag = type; | ||
65 | remove_list(body, ident); | ||
66 | return; | ||
67 | } | ||
68 | r = copy_node(i); r->tag = type; | ||
69 | r->next = (*keyw)->next; *body = r; (*keyw)->next = NULL; | ||
70 | add_symbol(i->string, type, b, is_extern); | ||
71 | } | ||
72 | |||
54 | %} | 73 | %} |
55 | 74 | ||
56 | %token ASM_KEYW | 75 | %token ASM_KEYW |
@@ -215,26 +234,11 @@ type_specifier: | |||
215 | 234 | ||
216 | /* Full definitions of an s/u/e. Record it. */ | 235 | /* Full definitions of an s/u/e. Record it. */ |
217 | | STRUCT_KEYW IDENT class_body | 236 | | STRUCT_KEYW IDENT class_body |
218 | { struct string_list *s = *$3, *i = *$2, *r; | 237 | { record_compound($1, $2, $3, SYM_STRUCT); $$ = $3; } |
219 | r = copy_node(i); r->tag = SYM_STRUCT; | ||
220 | r->next = (*$1)->next; *$3 = r; (*$1)->next = NULL; | ||
221 | add_symbol(i->string, SYM_STRUCT, s, is_extern); | ||
222 | $$ = $3; | ||
223 | } | ||
224 | | UNION_KEYW IDENT class_body | 238 | | UNION_KEYW IDENT class_body |
225 | { struct string_list *s = *$3, *i = *$2, *r; | 239 | { record_compound($1, $2, $3, SYM_UNION); $$ = $3; } |
226 | r = copy_node(i); r->tag = SYM_UNION; | ||
227 | r->next = (*$1)->next; *$3 = r; (*$1)->next = NULL; | ||
228 | add_symbol(i->string, SYM_UNION, s, is_extern); | ||
229 | $$ = $3; | ||
230 | } | ||
231 | | ENUM_KEYW IDENT enum_body | 240 | | ENUM_KEYW IDENT enum_body |
232 | { struct string_list *s = *$3, *i = *$2, *r; | 241 | { record_compound($1, $2, $3, SYM_ENUM); $$ = $3; } |
233 | r = copy_node(i); r->tag = SYM_ENUM; | ||
234 | r->next = (*$1)->next; *$3 = r; (*$1)->next = NULL; | ||
235 | add_symbol(i->string, SYM_ENUM, s, is_extern); | ||
236 | $$ = $3; | ||
237 | } | ||
238 | /* | 242 | /* |
239 | * Anonymous enum definition. Tell add_symbol() to restart its counter. | 243 | * Anonymous enum definition. Tell add_symbol() to restart its counter. |
240 | */ | 244 | */ |
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index d29a8d75cb2..4594f334105 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
@@ -328,7 +328,8 @@ sub read_mailmap { | |||
328 | # name1 <mail1> <mail2> | 328 | # name1 <mail1> <mail2> |
329 | # name1 <mail1> name2 <mail2> | 329 | # name1 <mail1> name2 <mail2> |
330 | # (see man git-shortlog) | 330 | # (see man git-shortlog) |
331 | if (/^(.+)<(.+)>$/) { | 331 | |
332 | if (/^([^<]+)<([^>]+)>$/) { | ||
332 | my $real_name = $1; | 333 | my $real_name = $1; |
333 | my $address = $2; | 334 | my $address = $2; |
334 | 335 | ||
@@ -336,13 +337,13 @@ sub read_mailmap { | |||
336 | ($real_name, $address) = parse_email("$real_name <$address>"); | 337 | ($real_name, $address) = parse_email("$real_name <$address>"); |
337 | $mailmap->{names}->{$address} = $real_name; | 338 | $mailmap->{names}->{$address} = $real_name; |
338 | 339 | ||
339 | } elsif (/^<([^\s]+)>\s*<([^\s]+)>$/) { | 340 | } elsif (/^<([^>]+)>\s*<([^>]+)>$/) { |
340 | my $real_address = $1; | 341 | my $real_address = $1; |
341 | my $wrong_address = $2; | 342 | my $wrong_address = $2; |
342 | 343 | ||
343 | $mailmap->{addresses}->{$wrong_address} = $real_address; | 344 | $mailmap->{addresses}->{$wrong_address} = $real_address; |
344 | 345 | ||
345 | } elsif (/^(.+)<([^\s]+)>\s*<([^\s]+)>$/) { | 346 | } elsif (/^(.+)<([^>]+)>\s*<([^>]+)>$/) { |
346 | my $real_name = $1; | 347 | my $real_name = $1; |
347 | my $real_address = $2; | 348 | my $real_address = $2; |
348 | my $wrong_address = $3; | 349 | my $wrong_address = $3; |
@@ -353,7 +354,7 @@ sub read_mailmap { | |||
353 | $mailmap->{names}->{$wrong_address} = $real_name; | 354 | $mailmap->{names}->{$wrong_address} = $real_name; |
354 | $mailmap->{addresses}->{$wrong_address} = $real_address; | 355 | $mailmap->{addresses}->{$wrong_address} = $real_address; |
355 | 356 | ||
356 | } elsif (/^(.+)<([^\s]+)>\s*([^\s].*)<([^\s]+)>$/) { | 357 | } elsif (/^(.+)<([^>]+)>\s*(.+)\s*<([^>]+)>$/) { |
357 | my $real_name = $1; | 358 | my $real_name = $1; |
358 | my $real_address = $2; | 359 | my $real_address = $2; |
359 | my $wrong_name = $3; | 360 | my $wrong_name = $3; |
@@ -1388,7 +1389,7 @@ sub vcs_exists { | |||
1388 | warn("$P: No supported VCS found. Add --nogit to options?\n"); | 1389 | warn("$P: No supported VCS found. Add --nogit to options?\n"); |
1389 | warn("Using a git repository produces better results.\n"); | 1390 | warn("Using a git repository produces better results.\n"); |
1390 | warn("Try Linus Torvalds' latest git repository using:\n"); | 1391 | warn("Try Linus Torvalds' latest git repository using:\n"); |
1391 | warn("git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n"); | 1392 | warn("git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git\n"); |
1392 | $printed_novcs = 1; | 1393 | $printed_novcs = 1; |
1393 | } | 1394 | } |
1394 | return 0; | 1395 | return 0; |
diff --git a/scripts/gfp-translate b/scripts/gfp-translate index c9230e158a8..c9230e158a8 100644..100755 --- a/scripts/gfp-translate +++ b/scripts/gfp-translate | |||
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl index efb3be10d42..48462be328b 100644 --- a/scripts/headers_install.pl +++ b/scripts/headers_install.pl | |||
@@ -35,6 +35,7 @@ foreach my $file (@files) { | |||
35 | $line =~ s/([\s(])__iomem\s/$1/g; | 35 | $line =~ s/([\s(])__iomem\s/$1/g; |
36 | $line =~ s/\s__attribute_const__\s/ /g; | 36 | $line =~ s/\s__attribute_const__\s/ /g; |
37 | $line =~ s/\s__attribute_const__$//g; | 37 | $line =~ s/\s__attribute_const__$//g; |
38 | $line =~ s/\b__packed\b/__attribute__((packed))/g; | ||
38 | $line =~ s/^#include <linux\/compiler.h>//; | 39 | $line =~ s/^#include <linux\/compiler.h>//; |
39 | $line =~ s/(^|\s)(inline)\b/$1__$2__/g; | 40 | $line =~ s/(^|\s)(inline)\b/$1__$2__/g; |
40 | $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; | 41 | $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; |
diff --git a/scripts/kconfig/.gitignore b/scripts/kconfig/.gitignore index 624f6502e03..be603c4fef6 100644 --- a/scripts/kconfig/.gitignore +++ b/scripts/kconfig/.gitignore | |||
@@ -2,12 +2,11 @@ | |||
2 | # Generated files | 2 | # Generated files |
3 | # | 3 | # |
4 | config* | 4 | config* |
5 | lex.*.c | 5 | *.lex.c |
6 | *.tab.c | 6 | *.tab.c |
7 | *.tab.h | 7 | *.tab.h |
8 | zconf.hash.c | 8 | zconf.hash.c |
9 | *.moc | 9 | *.moc |
10 | lkc_defs.h | ||
11 | gconf.glade.h | 10 | gconf.glade.h |
12 | *.pot | 11 | *.pot |
13 | *.mo | 12 | *.mo |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index faa9a4701b6..82d2eb285b7 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -170,8 +170,8 @@ mconf-objs := mconf.o zconf.tab.o $(lxdialog) | |||
170 | nconf-objs := nconf.o zconf.tab.o nconf.gui.o | 170 | nconf-objs := nconf.o zconf.tab.o nconf.gui.o |
171 | kxgettext-objs := kxgettext.o zconf.tab.o | 171 | kxgettext-objs := kxgettext.o zconf.tab.o |
172 | qconf-cxxobjs := qconf.o | 172 | qconf-cxxobjs := qconf.o |
173 | qconf-objs := kconfig_load.o zconf.tab.o | 173 | qconf-objs := zconf.tab.o |
174 | gconf-objs := gconf.o kconfig_load.o zconf.tab.o | 174 | gconf-objs := gconf.o zconf.tab.o |
175 | 175 | ||
176 | hostprogs-y := conf | 176 | hostprogs-y := conf |
177 | 177 | ||
@@ -203,8 +203,8 @@ ifeq ($(gconf-target),1) | |||
203 | hostprogs-y += gconf | 203 | hostprogs-y += gconf |
204 | endif | 204 | endif |
205 | 205 | ||
206 | clean-files := lkc_defs.h qconf.moc .tmp_qtcheck .tmp_gtkcheck | 206 | clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck |
207 | clean-files += zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h | 207 | clean-files += zconf.tab.c zconf.lex.c zconf.hash.c gconf.glade.h |
208 | clean-files += mconf qconf gconf nconf | 208 | clean-files += mconf qconf gconf nconf |
209 | clean-files += config.pot linux.pot | 209 | clean-files += config.pot linux.pot |
210 | 210 | ||
@@ -220,15 +220,18 @@ always := dochecklxdialog | |||
220 | HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) | 220 | HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) |
221 | 221 | ||
222 | # generated files seem to need this to find local include files | 222 | # generated files seem to need this to find local include files |
223 | HOSTCFLAGS_lex.zconf.o := -I$(src) | 223 | HOSTCFLAGS_zconf.lex.o := -I$(src) |
224 | HOSTCFLAGS_zconf.tab.o := -I$(src) | 224 | HOSTCFLAGS_zconf.tab.o := -I$(src) |
225 | 225 | ||
226 | HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl | 226 | LEX_PREFIX_zconf := zconf |
227 | HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK | 227 | YACC_PREFIX_zconf := zconf |
228 | 228 | ||
229 | HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl | 229 | HOSTLOADLIBES_qconf = $(KC_QT_LIBS) |
230 | HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) | ||
231 | |||
232 | HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` | ||
230 | HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ | 233 | HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ |
231 | -D LKC_DIRECT_LINK | 234 | -Wno-missing-prototypes |
232 | 235 | ||
233 | HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) | 236 | HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) |
234 | 237 | ||
@@ -316,47 +319,15 @@ $(obj)/.tmp_gtkcheck: | |||
316 | fi | 319 | fi |
317 | endif | 320 | endif |
318 | 321 | ||
319 | $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c | 322 | $(obj)/zconf.tab.o: $(obj)/zconf.lex.c $(obj)/zconf.hash.c |
320 | |||
321 | $(obj)/kconfig_load.o: $(obj)/lkc_defs.h | ||
322 | |||
323 | $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h | ||
324 | 323 | ||
325 | $(obj)/gconf.o: $(obj)/lkc_defs.h | 324 | $(obj)/qconf.o: $(obj)/qconf.moc |
326 | 325 | ||
327 | $(obj)/%.moc: $(src)/%.h | 326 | $(obj)/%.moc: $(src)/%.h |
328 | $(KC_QT_MOC) -i $< -o $@ | 327 | $(KC_QT_MOC) -i $< -o $@ |
329 | 328 | ||
330 | $(obj)/lkc_defs.h: $(src)/lkc_proto.h | ||
331 | $(Q)sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' | ||
332 | |||
333 | # Extract gconf menu items for I18N support | 329 | # Extract gconf menu items for I18N support |
334 | $(obj)/gconf.glade.h: $(obj)/gconf.glade | 330 | $(obj)/gconf.glade.h: $(obj)/gconf.glade |
335 | $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \ | 331 | $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \ |
336 | $(obj)/gconf.glade | 332 | $(obj)/gconf.glade |
337 | 333 | ||
338 | ### | ||
339 | # The following requires flex/bison/gperf | ||
340 | # By default we use the _shipped versions, uncomment the following line if | ||
341 | # you are modifying the flex/bison src. | ||
342 | # LKC_GENPARSER := 1 | ||
343 | |||
344 | ifdef LKC_GENPARSER | ||
345 | |||
346 | $(obj)/zconf.tab.c: $(src)/zconf.y | ||
347 | $(obj)/lex.zconf.c: $(src)/zconf.l | ||
348 | $(obj)/zconf.hash.c: $(src)/zconf.gperf | ||
349 | |||
350 | %.tab.c: %.y | ||
351 | bison -l -b $* -p $(notdir $*) $< | ||
352 | cp $@ $@_shipped | ||
353 | |||
354 | lex.%.c: %.l | ||
355 | flex -L -P$(notdir $*) -o$@ $< | ||
356 | cp $@ $@_shipped | ||
357 | |||
358 | %.hash.c: %.gperf | ||
359 | gperf < $< > $@ | ||
360 | cp $@ $@_shipped | ||
361 | |||
362 | endif | ||
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 006ad817cd5..f208f900ed3 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -14,11 +14,11 @@ | |||
14 | #include <sys/stat.h> | 14 | #include <sys/stat.h> |
15 | #include <sys/time.h> | 15 | #include <sys/time.h> |
16 | 16 | ||
17 | #define LKC_DIRECT_LINK | ||
18 | #include "lkc.h" | 17 | #include "lkc.h" |
19 | 18 | ||
20 | static void conf(struct menu *menu); | 19 | static void conf(struct menu *menu); |
21 | static void check_conf(struct menu *menu); | 20 | static void check_conf(struct menu *menu); |
21 | static void xfgets(char *str, int size, FILE *in); | ||
22 | 22 | ||
23 | enum input_mode { | 23 | enum input_mode { |
24 | oldaskconfig, | 24 | oldaskconfig, |
@@ -35,8 +35,6 @@ enum input_mode { | |||
35 | oldnoconfig, | 35 | oldnoconfig, |
36 | } input_mode = oldaskconfig; | 36 | } input_mode = oldaskconfig; |
37 | 37 | ||
38 | char *defconfig_file; | ||
39 | |||
40 | static int indent = 1; | 38 | static int indent = 1; |
41 | static int valid_stdin = 1; | 39 | static int valid_stdin = 1; |
42 | static int sync_kconfig; | 40 | static int sync_kconfig; |
@@ -106,6 +104,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
106 | return 0; | 104 | return 0; |
107 | } | 105 | } |
108 | check_stdin(); | 106 | check_stdin(); |
107 | /* fall through */ | ||
109 | case oldaskconfig: | 108 | case oldaskconfig: |
110 | fflush(stdout); | 109 | fflush(stdout); |
111 | xfgets(line, 128, stdin); | 110 | xfgets(line, 128, stdin); |
@@ -150,6 +149,7 @@ static int conf_string(struct menu *menu) | |||
150 | def = NULL; | 149 | def = NULL; |
151 | break; | 150 | break; |
152 | } | 151 | } |
152 | /* fall through */ | ||
153 | default: | 153 | default: |
154 | line[strlen(line)-1] = 0; | 154 | line[strlen(line)-1] = 0; |
155 | def = line; | 155 | def = line; |
@@ -304,6 +304,7 @@ static int conf_choice(struct menu *menu) | |||
304 | break; | 304 | break; |
305 | } | 305 | } |
306 | check_stdin(); | 306 | check_stdin(); |
307 | /* fall through */ | ||
307 | case oldaskconfig: | 308 | case oldaskconfig: |
308 | fflush(stdout); | 309 | fflush(stdout); |
309 | xfgets(line, 128, stdin); | 310 | xfgets(line, 128, stdin); |
@@ -369,6 +370,7 @@ static void conf(struct menu *menu) | |||
369 | check_conf(menu); | 370 | check_conf(menu); |
370 | return; | 371 | return; |
371 | } | 372 | } |
373 | /* fall through */ | ||
372 | case P_COMMENT: | 374 | case P_COMMENT: |
373 | prompt = menu_get_prompt(menu); | 375 | prompt = menu_get_prompt(menu); |
374 | if (prompt) | 376 | if (prompt) |
@@ -456,10 +458,30 @@ static struct option long_opts[] = { | |||
456 | {NULL, 0, NULL, 0} | 458 | {NULL, 0, NULL, 0} |
457 | }; | 459 | }; |
458 | 460 | ||
461 | static void conf_usage(const char *progname) | ||
462 | { | ||
463 | |||
464 | printf("Usage: %s [option] <kconfig-file>\n", progname); | ||
465 | printf("[option] is _one_ of the following:\n"); | ||
466 | printf(" --listnewconfig List new options\n"); | ||
467 | printf(" --oldaskconfig Start a new configuration using a line-oriented program\n"); | ||
468 | printf(" --oldconfig Update a configuration using a provided .config as base\n"); | ||
469 | printf(" --silentoldconfig Same as oldconfig, but quietly, additionally update deps\n"); | ||
470 | printf(" --oldnoconfig Same as silentoldconfig but set new symbols to no\n"); | ||
471 | printf(" --defconfig <file> New config with default defined in <file>\n"); | ||
472 | printf(" --savedefconfig <file> Save the minimal current configuration to <file>\n"); | ||
473 | printf(" --allnoconfig New config where all options are answered with no\n"); | ||
474 | printf(" --allyesconfig New config where all options are answered with yes\n"); | ||
475 | printf(" --allmodconfig New config where all options are answered with mod\n"); | ||
476 | printf(" --alldefconfig New config with all symbols set to default\n"); | ||
477 | printf(" --randconfig New config with random answer to all options\n"); | ||
478 | } | ||
479 | |||
459 | int main(int ac, char **av) | 480 | int main(int ac, char **av) |
460 | { | 481 | { |
482 | const char *progname = av[0]; | ||
461 | int opt; | 483 | int opt; |
462 | const char *name; | 484 | const char *name, *defconfig_file = NULL /* gcc uninit */; |
463 | struct stat tmpstat; | 485 | struct stat tmpstat; |
464 | 486 | ||
465 | setlocale(LC_ALL, ""); | 487 | setlocale(LC_ALL, ""); |
@@ -491,14 +513,24 @@ int main(int ac, char **av) | |||
491 | srand(seed); | 513 | srand(seed); |
492 | break; | 514 | break; |
493 | } | 515 | } |
516 | case oldaskconfig: | ||
517 | case oldconfig: | ||
518 | case allnoconfig: | ||
519 | case allyesconfig: | ||
520 | case allmodconfig: | ||
521 | case alldefconfig: | ||
522 | case listnewconfig: | ||
523 | case oldnoconfig: | ||
524 | break; | ||
494 | case '?': | 525 | case '?': |
495 | fprintf(stderr, _("See README for usage info\n")); | 526 | conf_usage(progname); |
496 | exit(1); | 527 | exit(1); |
497 | break; | 528 | break; |
498 | } | 529 | } |
499 | } | 530 | } |
500 | if (ac == optind) { | 531 | if (ac == optind) { |
501 | printf(_("%s: Kconfig file missing\n"), av[0]); | 532 | printf(_("%s: Kconfig file missing\n"), av[0]); |
533 | conf_usage(progname); | ||
502 | exit(1); | 534 | exit(1); |
503 | } | 535 | } |
504 | name = av[optind]; | 536 | name = av[optind]; |
@@ -641,13 +673,11 @@ int main(int ac, char **av) | |||
641 | } | 673 | } |
642 | return 0; | 674 | return 0; |
643 | } | 675 | } |
676 | |||
644 | /* | 677 | /* |
645 | * Helper function to facilitate fgets() by Jean Sacren. | 678 | * Helper function to facilitate fgets() by Jean Sacren. |
646 | */ | 679 | */ |
647 | void xfgets(str, size, in) | 680 | void xfgets(char *str, int size, FILE *in) |
648 | char *str; | ||
649 | int size; | ||
650 | FILE *in; | ||
651 | { | 681 | { |
652 | if (fgets(str, size, in) == NULL) | 682 | if (fgets(str, size, in) == NULL) |
653 | fprintf(stderr, "\nError in reading or end of file.\n"); | 683 | fprintf(stderr, "\nError in reading or end of file.\n"); |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 2bafd9a7c8d..59b667cae5f 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -7,13 +7,13 @@ | |||
7 | #include <ctype.h> | 7 | #include <ctype.h> |
8 | #include <errno.h> | 8 | #include <errno.h> |
9 | #include <fcntl.h> | 9 | #include <fcntl.h> |
10 | #include <stdarg.h> | ||
10 | #include <stdio.h> | 11 | #include <stdio.h> |
11 | #include <stdlib.h> | 12 | #include <stdlib.h> |
12 | #include <string.h> | 13 | #include <string.h> |
13 | #include <time.h> | 14 | #include <time.h> |
14 | #include <unistd.h> | 15 | #include <unistd.h> |
15 | 16 | ||
16 | #define LKC_DIRECT_LINK | ||
17 | #include "lkc.h" | 17 | #include "lkc.h" |
18 | 18 | ||
19 | static void conf_warning(const char *fmt, ...) | 19 | static void conf_warning(const char *fmt, ...) |
@@ -128,6 +128,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) | |||
128 | sym->flags |= def_flags; | 128 | sym->flags |= def_flags; |
129 | break; | 129 | break; |
130 | } | 130 | } |
131 | /* fall through */ | ||
131 | case S_BOOLEAN: | 132 | case S_BOOLEAN: |
132 | if (p[0] == 'y') { | 133 | if (p[0] == 'y') { |
133 | sym->def[def].tri = yes; | 134 | sym->def[def].tri = yes; |
@@ -140,7 +141,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) | |||
140 | break; | 141 | break; |
141 | } | 142 | } |
142 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); | 143 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); |
143 | break; | 144 | return 1; |
144 | case S_OTHER: | 145 | case S_OTHER: |
145 | if (*p != '"') { | 146 | if (*p != '"') { |
146 | for (p2 = p; *p2 && !isspace(*p2); p2++) | 147 | for (p2 = p; *p2 && !isspace(*p2); p2++) |
@@ -148,6 +149,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) | |||
148 | sym->type = S_STRING; | 149 | sym->type = S_STRING; |
149 | goto done; | 150 | goto done; |
150 | } | 151 | } |
152 | /* fall through */ | ||
151 | case S_STRING: | 153 | case S_STRING: |
152 | if (*p++ != '"') | 154 | if (*p++ != '"') |
153 | break; | 155 | break; |
@@ -162,6 +164,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) | |||
162 | conf_warning("invalid string found"); | 164 | conf_warning("invalid string found"); |
163 | return 1; | 165 | return 1; |
164 | } | 166 | } |
167 | /* fall through */ | ||
165 | case S_INT: | 168 | case S_INT: |
166 | case S_HEX: | 169 | case S_HEX: |
167 | done: | 170 | done: |
@@ -237,6 +240,7 @@ load: | |||
237 | case S_STRING: | 240 | case S_STRING: |
238 | if (sym->def[def].val) | 241 | if (sym->def[def].val) |
239 | free(sym->def[def].val); | 242 | free(sym->def[def].val); |
243 | /* fall through */ | ||
240 | default: | 244 | default: |
241 | sym->def[def].val = NULL; | 245 | sym->def[def].val = NULL; |
242 | sym->def[def].tri = no; | 246 | sym->def[def].tri = no; |
@@ -363,6 +367,7 @@ int conf_read(const char *name) | |||
363 | break; | 367 | break; |
364 | if (!sym_is_choice(sym)) | 368 | if (!sym_is_choice(sym)) |
365 | goto sym_ok; | 369 | goto sym_ok; |
370 | /* fall through */ | ||
366 | default: | 371 | default: |
367 | if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) | 372 | if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) |
368 | goto sym_ok; | 373 | goto sym_ok; |
@@ -417,64 +422,202 @@ int conf_read(const char *name) | |||
417 | return 0; | 422 | return 0; |
418 | } | 423 | } |
419 | 424 | ||
420 | /* Write a S_STRING */ | 425 | /* |
421 | static void conf_write_string(bool headerfile, const char *name, | 426 | * Kconfig configuration printer |
422 | const char *str, FILE *out) | 427 | * |
428 | * This printer is used when generating the resulting configuration after | ||
429 | * kconfig invocation and `defconfig' files. Unset symbol might be omitted by | ||
430 | * passing a non-NULL argument to the printer. | ||
431 | * | ||
432 | */ | ||
433 | static void | ||
434 | kconfig_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) | ||
423 | { | 435 | { |
424 | int l; | 436 | |
425 | if (headerfile) | 437 | switch (sym->type) { |
426 | fprintf(out, "#define %s%s \"", CONFIG_, name); | 438 | case S_BOOLEAN: |
427 | else | 439 | case S_TRISTATE: |
428 | fprintf(out, "%s%s=\"", CONFIG_, name); | 440 | if (*value == 'n') { |
429 | 441 | bool skip_unset = (arg != NULL); | |
430 | while (1) { | 442 | |
431 | l = strcspn(str, "\"\\"); | 443 | if (!skip_unset) |
444 | fprintf(fp, "# %s%s is not set\n", | ||
445 | CONFIG_, sym->name); | ||
446 | return; | ||
447 | } | ||
448 | break; | ||
449 | default: | ||
450 | break; | ||
451 | } | ||
452 | |||
453 | fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, value); | ||
454 | } | ||
455 | |||
456 | static void | ||
457 | kconfig_print_comment(FILE *fp, const char *value, void *arg) | ||
458 | { | ||
459 | const char *p = value; | ||
460 | size_t l; | ||
461 | |||
462 | for (;;) { | ||
463 | l = strcspn(p, "\n"); | ||
464 | fprintf(fp, "#"); | ||
432 | if (l) { | 465 | if (l) { |
433 | xfwrite(str, l, 1, out); | 466 | fprintf(fp, " "); |
434 | str += l; | 467 | fwrite(p, l, 1, fp); |
468 | p += l; | ||
435 | } | 469 | } |
436 | if (!*str) | 470 | fprintf(fp, "\n"); |
471 | if (*p++ == '\0') | ||
437 | break; | 472 | break; |
438 | fprintf(out, "\\%c", *str++); | ||
439 | } | 473 | } |
440 | fputs("\"\n", out); | ||
441 | } | 474 | } |
442 | 475 | ||
443 | static void conf_write_symbol(struct symbol *sym, FILE *out, bool write_no) | 476 | static struct conf_printer kconfig_printer_cb = |
477 | { | ||
478 | .print_symbol = kconfig_print_symbol, | ||
479 | .print_comment = kconfig_print_comment, | ||
480 | }; | ||
481 | |||
482 | /* | ||
483 | * Header printer | ||
484 | * | ||
485 | * This printer is used when generating the `include/generated/autoconf.h' file. | ||
486 | */ | ||
487 | static void | ||
488 | header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) | ||
444 | { | 489 | { |
445 | const char *str; | ||
446 | 490 | ||
447 | switch (sym->type) { | 491 | switch (sym->type) { |
448 | case S_BOOLEAN: | 492 | case S_BOOLEAN: |
449 | case S_TRISTATE: | 493 | case S_TRISTATE: { |
450 | switch (sym_get_tristate_value(sym)) { | 494 | const char *suffix = ""; |
451 | case no: | 495 | |
452 | if (write_no) | 496 | switch (*value) { |
453 | fprintf(out, "# %s%s is not set\n", | 497 | case 'n': |
454 | CONFIG_, sym->name); | ||
455 | break; | ||
456 | case mod: | ||
457 | fprintf(out, "%s%s=m\n", CONFIG_, sym->name); | ||
458 | break; | ||
459 | case yes: | ||
460 | fprintf(out, "%s%s=y\n", CONFIG_, sym->name); | ||
461 | break; | 498 | break; |
499 | case 'm': | ||
500 | suffix = "_MODULE"; | ||
501 | /* fall through */ | ||
502 | default: | ||
503 | fprintf(fp, "#define %s%s%s 1\n", | ||
504 | CONFIG_, sym->name, suffix); | ||
462 | } | 505 | } |
506 | /* | ||
507 | * Generate the __enabled_CONFIG_* and | ||
508 | * __enabled_CONFIG_*_MODULE macros for use by the | ||
509 | * IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is | ||
510 | * generated even for booleans so that the IS_ENABLED() macro | ||
511 | * works. | ||
512 | */ | ||
513 | fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n", | ||
514 | sym->name, (*value == 'y')); | ||
515 | fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n", | ||
516 | sym->name, (*value == 'm')); | ||
463 | break; | 517 | break; |
464 | case S_STRING: | 518 | } |
465 | conf_write_string(false, sym->name, sym_get_string_value(sym), out); | 519 | case S_HEX: { |
520 | const char *prefix = ""; | ||
521 | |||
522 | if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X')) | ||
523 | prefix = "0x"; | ||
524 | fprintf(fp, "#define %s%s %s%s\n", | ||
525 | CONFIG_, sym->name, prefix, value); | ||
466 | break; | 526 | break; |
467 | case S_HEX: | 527 | } |
528 | case S_STRING: | ||
468 | case S_INT: | 529 | case S_INT: |
469 | str = sym_get_string_value(sym); | 530 | fprintf(fp, "#define %s%s %s\n", |
470 | fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str); | 531 | CONFIG_, sym->name, value); |
532 | break; | ||
533 | default: | ||
471 | break; | 534 | break; |
535 | } | ||
536 | |||
537 | } | ||
538 | |||
539 | static void | ||
540 | header_print_comment(FILE *fp, const char *value, void *arg) | ||
541 | { | ||
542 | const char *p = value; | ||
543 | size_t l; | ||
544 | |||
545 | fprintf(fp, "/*\n"); | ||
546 | for (;;) { | ||
547 | l = strcspn(p, "\n"); | ||
548 | fprintf(fp, " *"); | ||
549 | if (l) { | ||
550 | fprintf(fp, " "); | ||
551 | fwrite(p, l, 1, fp); | ||
552 | p += l; | ||
553 | } | ||
554 | fprintf(fp, "\n"); | ||
555 | if (*p++ == '\0') | ||
556 | break; | ||
557 | } | ||
558 | fprintf(fp, " */\n"); | ||
559 | } | ||
560 | |||
561 | static struct conf_printer header_printer_cb = | ||
562 | { | ||
563 | .print_symbol = header_print_symbol, | ||
564 | .print_comment = header_print_comment, | ||
565 | }; | ||
566 | |||
567 | /* | ||
568 | * Tristate printer | ||
569 | * | ||
570 | * This printer is used when generating the `include/config/tristate.conf' file. | ||
571 | */ | ||
572 | static void | ||
573 | tristate_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) | ||
574 | { | ||
575 | |||
576 | if (sym->type == S_TRISTATE && *value != 'n') | ||
577 | fprintf(fp, "%s%s=%c\n", CONFIG_, sym->name, (char)toupper(*value)); | ||
578 | } | ||
579 | |||
580 | static struct conf_printer tristate_printer_cb = | ||
581 | { | ||
582 | .print_symbol = tristate_print_symbol, | ||
583 | .print_comment = kconfig_print_comment, | ||
584 | }; | ||
585 | |||
586 | static void conf_write_symbol(FILE *fp, struct symbol *sym, | ||
587 | struct conf_printer *printer, void *printer_arg) | ||
588 | { | ||
589 | const char *str; | ||
590 | |||
591 | switch (sym->type) { | ||
472 | case S_OTHER: | 592 | case S_OTHER: |
473 | case S_UNKNOWN: | 593 | case S_UNKNOWN: |
474 | break; | 594 | break; |
595 | case S_STRING: | ||
596 | str = sym_get_string_value(sym); | ||
597 | str = sym_escape_string_value(str); | ||
598 | printer->print_symbol(fp, sym, str, printer_arg); | ||
599 | free((void *)str); | ||
600 | break; | ||
601 | default: | ||
602 | str = sym_get_string_value(sym); | ||
603 | printer->print_symbol(fp, sym, str, printer_arg); | ||
475 | } | 604 | } |
476 | } | 605 | } |
477 | 606 | ||
607 | static void | ||
608 | conf_write_heading(FILE *fp, struct conf_printer *printer, void *printer_arg) | ||
609 | { | ||
610 | char buf[256]; | ||
611 | |||
612 | snprintf(buf, sizeof(buf), | ||
613 | "\n" | ||
614 | "Automatically generated file; DO NOT EDIT.\n" | ||
615 | "%s\n", | ||
616 | rootmenu.prompt->text); | ||
617 | |||
618 | printer->print_comment(fp, buf, printer_arg); | ||
619 | } | ||
620 | |||
478 | /* | 621 | /* |
479 | * Write out a minimal config. | 622 | * Write out a minimal config. |
480 | * All values that has default values are skipped as this is redundant. | 623 | * All values that has default values are skipped as this is redundant. |
@@ -531,7 +674,7 @@ int conf_write_defconfig(const char *filename) | |||
531 | goto next_menu; | 674 | goto next_menu; |
532 | } | 675 | } |
533 | } | 676 | } |
534 | conf_write_symbol(sym, out, true); | 677 | conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); |
535 | } | 678 | } |
536 | next_menu: | 679 | next_menu: |
537 | if (menu->list != NULL) { | 680 | if (menu->list != NULL) { |
@@ -596,11 +739,7 @@ int conf_write(const char *name) | |||
596 | if (!out) | 739 | if (!out) |
597 | return 1; | 740 | return 1; |
598 | 741 | ||
599 | fprintf(out, _("#\n" | 742 | conf_write_heading(out, &kconfig_printer_cb, NULL); |
600 | "# Automatically generated make config: don't edit\n" | ||
601 | "# %s\n" | ||
602 | "#\n"), | ||
603 | rootmenu.prompt->text); | ||
604 | 743 | ||
605 | if (!conf_get_changed()) | 744 | if (!conf_get_changed()) |
606 | sym_clear_all_valid(); | 745 | sym_clear_all_valid(); |
@@ -621,8 +760,8 @@ int conf_write(const char *name) | |||
621 | if (!(sym->flags & SYMBOL_WRITE)) | 760 | if (!(sym->flags & SYMBOL_WRITE)) |
622 | goto next; | 761 | goto next; |
623 | sym->flags &= ~SYMBOL_WRITE; | 762 | sym->flags &= ~SYMBOL_WRITE; |
624 | /* Write config symbol to file */ | 763 | |
625 | conf_write_symbol(sym, out, true); | 764 | conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); |
626 | } | 765 | } |
627 | 766 | ||
628 | next: | 767 | next: |
@@ -771,7 +910,6 @@ out: | |||
771 | int conf_write_autoconf(void) | 910 | int conf_write_autoconf(void) |
772 | { | 911 | { |
773 | struct symbol *sym; | 912 | struct symbol *sym; |
774 | const char *str; | ||
775 | const char *name; | 913 | const char *name; |
776 | FILE *out, *tristate, *out_h; | 914 | FILE *out, *tristate, *out_h; |
777 | int i; | 915 | int i; |
@@ -800,68 +938,23 @@ int conf_write_autoconf(void) | |||
800 | return 1; | 938 | return 1; |
801 | } | 939 | } |
802 | 940 | ||
803 | fprintf(out, "#\n" | 941 | conf_write_heading(out, &kconfig_printer_cb, NULL); |
804 | "# Automatically generated make config: don't edit\n" | 942 | |
805 | "# %s\n" | 943 | conf_write_heading(tristate, &tristate_printer_cb, NULL); |
806 | "#\n", | 944 | |
807 | rootmenu.prompt->text); | 945 | conf_write_heading(out_h, &header_printer_cb, NULL); |
808 | fprintf(tristate, "#\n" | ||
809 | "# Automatically generated - do not edit\n" | ||
810 | "\n"); | ||
811 | fprintf(out_h, "/*\n" | ||
812 | " * Automatically generated C config: don't edit\n" | ||
813 | " * %s\n" | ||
814 | " */\n", | ||
815 | rootmenu.prompt->text); | ||
816 | 946 | ||
817 | for_all_symbols(i, sym) { | 947 | for_all_symbols(i, sym) { |
818 | sym_calc_value(sym); | 948 | sym_calc_value(sym); |
819 | if (!(sym->flags & SYMBOL_WRITE) || !sym->name) | 949 | if (!(sym->flags & SYMBOL_WRITE) || !sym->name) |
820 | continue; | 950 | continue; |
821 | 951 | ||
822 | /* write symbol to config file */ | 952 | /* write symbol to auto.conf, tristate and header files */ |
823 | conf_write_symbol(sym, out, false); | 953 | conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); |
824 | 954 | ||
825 | /* update autoconf and tristate files */ | 955 | conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); |
826 | switch (sym->type) { | 956 | |
827 | case S_BOOLEAN: | 957 | conf_write_symbol(out_h, sym, &header_printer_cb, NULL); |
828 | case S_TRISTATE: | ||
829 | switch (sym_get_tristate_value(sym)) { | ||
830 | case no: | ||
831 | break; | ||
832 | case mod: | ||
833 | fprintf(tristate, "%s%s=M\n", | ||
834 | CONFIG_, sym->name); | ||
835 | fprintf(out_h, "#define %s%s_MODULE 1\n", | ||
836 | CONFIG_, sym->name); | ||
837 | break; | ||
838 | case yes: | ||
839 | if (sym->type == S_TRISTATE) | ||
840 | fprintf(tristate,"%s%s=Y\n", | ||
841 | CONFIG_, sym->name); | ||
842 | fprintf(out_h, "#define %s%s 1\n", | ||
843 | CONFIG_, sym->name); | ||
844 | break; | ||
845 | } | ||
846 | break; | ||
847 | case S_STRING: | ||
848 | conf_write_string(true, sym->name, sym_get_string_value(sym), out_h); | ||
849 | break; | ||
850 | case S_HEX: | ||
851 | str = sym_get_string_value(sym); | ||
852 | if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { | ||
853 | fprintf(out_h, "#define %s%s 0x%s\n", | ||
854 | CONFIG_, sym->name, str); | ||
855 | break; | ||
856 | } | ||
857 | case S_INT: | ||
858 | str = sym_get_string_value(sym); | ||
859 | fprintf(out_h, "#define %s%s %s\n", | ||
860 | CONFIG_, sym->name, str); | ||
861 | break; | ||
862 | default: | ||
863 | break; | ||
864 | } | ||
865 | } | 958 | } |
866 | fclose(out); | 959 | fclose(out); |
867 | fclose(tristate); | 960 | fclose(tristate); |
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 001003452f6..290ce41f8ba 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c | |||
@@ -7,15 +7,13 @@ | |||
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <string.h> | 8 | #include <string.h> |
9 | 9 | ||
10 | #define LKC_DIRECT_LINK | ||
11 | #include "lkc.h" | 10 | #include "lkc.h" |
12 | 11 | ||
13 | #define DEBUG_EXPR 0 | 12 | #define DEBUG_EXPR 0 |
14 | 13 | ||
15 | struct expr *expr_alloc_symbol(struct symbol *sym) | 14 | struct expr *expr_alloc_symbol(struct symbol *sym) |
16 | { | 15 | { |
17 | struct expr *e = malloc(sizeof(*e)); | 16 | struct expr *e = calloc(1, sizeof(*e)); |
18 | memset(e, 0, sizeof(*e)); | ||
19 | e->type = E_SYMBOL; | 17 | e->type = E_SYMBOL; |
20 | e->left.sym = sym; | 18 | e->left.sym = sym; |
21 | return e; | 19 | return e; |
@@ -23,8 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym) | |||
23 | 21 | ||
24 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) | 22 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) |
25 | { | 23 | { |
26 | struct expr *e = malloc(sizeof(*e)); | 24 | struct expr *e = calloc(1, sizeof(*e)); |
27 | memset(e, 0, sizeof(*e)); | ||
28 | e->type = type; | 25 | e->type = type; |
29 | e->left.expr = ce; | 26 | e->left.expr = ce; |
30 | return e; | 27 | return e; |
@@ -32,8 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) | |||
32 | 29 | ||
33 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) | 30 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) |
34 | { | 31 | { |
35 | struct expr *e = malloc(sizeof(*e)); | 32 | struct expr *e = calloc(1, sizeof(*e)); |
36 | memset(e, 0, sizeof(*e)); | ||
37 | e->type = type; | 33 | e->type = type; |
38 | e->left.expr = e1; | 34 | e->left.expr = e1; |
39 | e->right.expr = e2; | 35 | e->right.expr = e2; |
@@ -42,8 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e | |||
42 | 38 | ||
43 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) | 39 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) |
44 | { | 40 | { |
45 | struct expr *e = malloc(sizeof(*e)); | 41 | struct expr *e = calloc(1, sizeof(*e)); |
46 | memset(e, 0, sizeof(*e)); | ||
47 | e->type = type; | 42 | e->type = type; |
48 | e->left.sym = s1; | 43 | e->left.sym = s1; |
49 | e->right.sym = s2; | 44 | e->right.sym = s2; |
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 16bfae2d321..80fce57080c 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h | |||
@@ -172,8 +172,6 @@ struct menu { | |||
172 | #define MENU_CHANGED 0x0001 | 172 | #define MENU_CHANGED 0x0001 |
173 | #define MENU_ROOT 0x0002 | 173 | #define MENU_ROOT 0x0002 |
174 | 174 | ||
175 | #ifndef SWIG | ||
176 | |||
177 | extern struct file *file_list; | 175 | extern struct file *file_list; |
178 | extern struct file *current_file; | 176 | extern struct file *current_file; |
179 | struct file *lookup_file(const char *name); | 177 | struct file *lookup_file(const char *name); |
@@ -218,7 +216,6 @@ static inline int expr_is_no(struct expr *e) | |||
218 | { | 216 | { |
219 | return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no); | 217 | return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no); |
220 | } | 218 | } |
221 | #endif | ||
222 | 219 | ||
223 | #ifdef __cplusplus | 220 | #ifdef __cplusplus |
224 | } | 221 | } |
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index a11d5f7b9ee..9f4438027df 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c | |||
@@ -285,8 +285,6 @@ void init_left_tree(void) | |||
285 | static void renderer_edited(GtkCellRendererText * cell, | 285 | static void renderer_edited(GtkCellRendererText * cell, |
286 | const gchar * path_string, | 286 | const gchar * path_string, |
287 | const gchar * new_text, gpointer user_data); | 287 | const gchar * new_text, gpointer user_data); |
288 | static void renderer_toggled(GtkCellRendererToggle * cellrenderertoggle, | ||
289 | gchar * arg1, gpointer user_data); | ||
290 | 288 | ||
291 | void init_right_tree(void) | 289 | void init_right_tree(void) |
292 | { | 290 | { |
@@ -320,8 +318,6 @@ void init_right_tree(void) | |||
320 | "inconsistent", COL_BTNINC, | 318 | "inconsistent", COL_BTNINC, |
321 | "visible", COL_BTNVIS, | 319 | "visible", COL_BTNVIS, |
322 | "radio", COL_BTNRAD, NULL); | 320 | "radio", COL_BTNRAD, NULL); |
323 | /*g_signal_connect(G_OBJECT(renderer), "toggled", | ||
324 | G_CALLBACK(renderer_toggled), NULL); */ | ||
325 | renderer = gtk_cell_renderer_text_new(); | 321 | renderer = gtk_cell_renderer_text_new(); |
326 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | 322 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), |
327 | renderer, FALSE); | 323 | renderer, FALSE); |
@@ -888,35 +884,6 @@ static void toggle_sym_value(struct menu *menu) | |||
888 | display_tree_part(); //fixme: keep exp/coll | 884 | display_tree_part(); //fixme: keep exp/coll |
889 | } | 885 | } |
890 | 886 | ||
891 | static void renderer_toggled(GtkCellRendererToggle * cell, | ||
892 | gchar * path_string, gpointer user_data) | ||
893 | { | ||
894 | GtkTreePath *path, *sel_path = NULL; | ||
895 | GtkTreeIter iter, sel_iter; | ||
896 | GtkTreeSelection *sel; | ||
897 | struct menu *menu; | ||
898 | |||
899 | path = gtk_tree_path_new_from_string(path_string); | ||
900 | if (!gtk_tree_model_get_iter(model2, &iter, path)) | ||
901 | return; | ||
902 | |||
903 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree2_w)); | ||
904 | if (gtk_tree_selection_get_selected(sel, NULL, &sel_iter)) | ||
905 | sel_path = gtk_tree_model_get_path(model2, &sel_iter); | ||
906 | if (!sel_path) | ||
907 | goto out1; | ||
908 | if (gtk_tree_path_compare(path, sel_path)) | ||
909 | goto out2; | ||
910 | |||
911 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | ||
912 | toggle_sym_value(menu); | ||
913 | |||
914 | out2: | ||
915 | gtk_tree_path_free(sel_path); | ||
916 | out1: | ||
917 | gtk_tree_path_free(path); | ||
918 | } | ||
919 | |||
920 | static gint column2index(GtkTreeViewColumn * column) | 887 | static gint column2index(GtkTreeViewColumn * column) |
921 | { | 888 | { |
922 | gint i; | 889 | gint i; |
@@ -1172,6 +1139,7 @@ static gchar **fill_row(struct menu *menu) | |||
1172 | row[COL_BTNVIS] = GINT_TO_POINTER(TRUE); | 1139 | row[COL_BTNVIS] = GINT_TO_POINTER(TRUE); |
1173 | if (sym_is_choice(sym)) | 1140 | if (sym_is_choice(sym)) |
1174 | break; | 1141 | break; |
1142 | /* fall through */ | ||
1175 | case S_TRISTATE: | 1143 | case S_TRISTATE: |
1176 | val = sym_get_tristate_value(sym); | 1144 | val = sym_get_tristate_value(sym); |
1177 | switch (val) { | 1145 | switch (val) { |
@@ -1506,10 +1474,6 @@ int main(int ac, char *av[]) | |||
1506 | char *env; | 1474 | char *env; |
1507 | gchar *glade_file; | 1475 | gchar *glade_file; |
1508 | 1476 | ||
1509 | #ifndef LKC_DIRECT_LINK | ||
1510 | kconfig_load(); | ||
1511 | #endif | ||
1512 | |||
1513 | bindtextdomain(PACKAGE, LOCALEDIR); | 1477 | bindtextdomain(PACKAGE, LOCALEDIR); |
1514 | bind_textdomain_codeset(PACKAGE, "UTF-8"); | 1478 | bind_textdomain_codeset(PACKAGE, "UTF-8"); |
1515 | textdomain(PACKAGE); | 1479 | textdomain(PACKAGE); |
diff --git a/scripts/kconfig/kconfig_load.c b/scripts/kconfig/kconfig_load.c deleted file mode 100644 index dbdcaad8232..00000000000 --- a/scripts/kconfig/kconfig_load.c +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | #include <dlfcn.h> | ||
2 | #include <stdio.h> | ||
3 | #include <stdlib.h> | ||
4 | |||
5 | #include "lkc.h" | ||
6 | |||
7 | #define P(name,type,arg) type (*name ## _p) arg | ||
8 | #include "lkc_proto.h" | ||
9 | #undef P | ||
10 | |||
11 | void kconfig_load(void) | ||
12 | { | ||
13 | void *handle; | ||
14 | char *error; | ||
15 | |||
16 | handle = dlopen("./libkconfig.so", RTLD_LAZY); | ||
17 | if (!handle) { | ||
18 | handle = dlopen("./scripts/kconfig/libkconfig.so", RTLD_LAZY); | ||
19 | if (!handle) { | ||
20 | fprintf(stderr, "%s\n", dlerror()); | ||
21 | exit(1); | ||
22 | } | ||
23 | } | ||
24 | |||
25 | #define P(name,type,arg) \ | ||
26 | { \ | ||
27 | name ## _p = dlsym(handle, #name); \ | ||
28 | if ((error = dlerror())) { \ | ||
29 | fprintf(stderr, "%s\n", error); \ | ||
30 | exit(1); \ | ||
31 | } \ | ||
32 | } | ||
33 | #include "lkc_proto.h" | ||
34 | #undef P | ||
35 | } | ||
diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c index e9d8e791bf0..2858738b22d 100644 --- a/scripts/kconfig/kxgettext.c +++ b/scripts/kconfig/kxgettext.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <string.h> | 8 | #include <string.h> |
9 | 9 | ||
10 | #define LKC_DIRECT_LINK | ||
11 | #include "lkc.h" | 10 | #include "lkc.h" |
12 | 11 | ||
13 | static char *escape(const char* text, char *bf, int len) | 12 | static char *escape(const char* text, char *bf, int len) |
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index febf0c94d55..b633bdb9f3d 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
@@ -21,12 +21,7 @@ static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; | |||
21 | extern "C" { | 21 | extern "C" { |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #ifdef LKC_DIRECT_LINK | ||
25 | #define P(name,type,arg) extern type name arg | 24 | #define P(name,type,arg) extern type name arg |
26 | #else | ||
27 | #include "lkc_defs.h" | ||
28 | #define P(name,type,arg) extern type (*name ## _p) arg | ||
29 | #endif | ||
30 | #include "lkc_proto.h" | 25 | #include "lkc_proto.h" |
31 | #undef P | 26 | #undef P |
32 | 27 | ||
@@ -68,9 +63,7 @@ struct kconf_id { | |||
68 | enum symbol_type stype; | 63 | enum symbol_type stype; |
69 | }; | 64 | }; |
70 | 65 | ||
71 | #ifdef YYDEBUG | ||
72 | extern int zconfdebug; | 66 | extern int zconfdebug; |
73 | #endif | ||
74 | 67 | ||
75 | int zconfparse(void); | 68 | int zconfparse(void); |
76 | void zconfdump(FILE *out); | 69 | void zconfdump(FILE *out); |
@@ -81,9 +74,6 @@ void zconf_nextfile(const char *name); | |||
81 | int zconf_lineno(void); | 74 | int zconf_lineno(void); |
82 | const char *zconf_curname(void); | 75 | const char *zconf_curname(void); |
83 | 76 | ||
84 | /* conf.c */ | ||
85 | void xfgets(char *str, int size, FILE *in); | ||
86 | |||
87 | /* confdata.c */ | 77 | /* confdata.c */ |
88 | const char *conf_get_configname(void); | 78 | const char *conf_get_configname(void); |
89 | const char *conf_get_autoconfig_name(void); | 79 | const char *conf_get_autoconfig_name(void); |
@@ -92,6 +82,11 @@ void sym_set_change_count(int count); | |||
92 | void sym_add_change_count(int count); | 82 | void sym_add_change_count(int count); |
93 | void conf_set_all_new_symbols(enum conf_def_mode mode); | 83 | void conf_set_all_new_symbols(enum conf_def_mode mode); |
94 | 84 | ||
85 | struct conf_printer { | ||
86 | void (*print_symbol)(FILE *, struct symbol *, const char *, void *); | ||
87 | void (*print_comment)(FILE *, const char *, void *); | ||
88 | }; | ||
89 | |||
95 | /* confdata.c and expr.c */ | 90 | /* confdata.c and expr.c */ |
96 | static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) | 91 | static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) |
97 | { | 92 | { |
@@ -99,9 +94,6 @@ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) | |||
99 | fprintf(stderr, "\nError in writing or end of file.\n"); | 94 | fprintf(stderr, "\nError in writing or end of file.\n"); |
100 | } | 95 | } |
101 | 96 | ||
102 | /* kconfig_load.c */ | ||
103 | void kconfig_load(void); | ||
104 | |||
105 | /* menu.c */ | 97 | /* menu.c */ |
106 | void _menu_init(void); | 98 | void _menu_init(void); |
107 | void menu_warn(struct menu *menu, const char *fmt, ...); | 99 | void menu_warn(struct menu *menu, const char *fmt, ...); |
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 17342fef38b..47fe9c340f9 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -31,6 +31,7 @@ P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); | |||
31 | P(sym_lookup,struct symbol *,(const char *name, int flags)); | 31 | P(sym_lookup,struct symbol *,(const char *name, int flags)); |
32 | P(sym_find,struct symbol *,(const char *name)); | 32 | P(sym_find,struct symbol *,(const char *name)); |
33 | P(sym_expand_string_value,const char *,(const char *in)); | 33 | P(sym_expand_string_value,const char *,(const char *in)); |
34 | P(sym_escape_string_value, const char *,(const char *in)); | ||
34 | P(sym_re_search,struct symbol **,(const char *pattern)); | 35 | P(sym_re_search,struct symbol **,(const char *pattern)); |
35 | P(sym_type_name,const char *,(enum symbol_type type)); | 36 | P(sym_type_name,const char *,(enum symbol_type type)); |
36 | P(sym_calc_value,void,(struct symbol *sym)); | 37 | P(sym_calc_value,void,(struct symbol *sym)); |
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh index 82cc3a85e7f..c8e8a715475 100644 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh | |||
@@ -4,7 +4,7 @@ | |||
4 | # What library to link | 4 | # What library to link |
5 | ldflags() | 5 | ldflags() |
6 | { | 6 | { |
7 | for ext in so a dylib ; do | 7 | for ext in so a dll.a dylib ; do |
8 | for lib in ncursesw ncurses curses ; do | 8 | for lib in ncursesw ncurses curses ; do |
9 | $cc -print-file-name=lib${lib}.${ext} | grep -q / | 9 | $cc -print-file-name=lib${lib}.${ext} | grep -q / |
10 | if [ $? -eq 0 ]; then | 10 | if [ $? -eq 0 ]; then |
@@ -19,12 +19,12 @@ ldflags() | |||
19 | # Where is ncurses.h? | 19 | # Where is ncurses.h? |
20 | ccflags() | 20 | ccflags() |
21 | { | 21 | { |
22 | if [ -f /usr/include/ncurses/ncurses.h ]; then | 22 | if [ -f /usr/include/ncursesw/curses.h ]; then |
23 | echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"' | ||
24 | elif [ -f /usr/include/ncurses/ncurses.h ]; then | ||
23 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' | 25 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' |
24 | elif [ -f /usr/include/ncurses/curses.h ]; then | 26 | elif [ -f /usr/include/ncurses/curses.h ]; then |
25 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"' | 27 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"' |
26 | elif [ -f /usr/include/ncursesw/curses.h ]; then | ||
27 | echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"' | ||
28 | elif [ -f /usr/include/ncurses.h ]; then | 28 | elif [ -f /usr/include/ncurses.h ]; then |
29 | echo '-DCURSES_LOC="<ncurses.h>"' | 29 | echo '-DCURSES_LOC="<ncurses.h>"' |
30 | else | 30 | else |
@@ -38,7 +38,7 @@ trap "rm -f $tmp" 0 1 2 3 15 | |||
38 | 38 | ||
39 | # Check if we can link to ncurses | 39 | # Check if we can link to ncurses |
40 | check() { | 40 | check() { |
41 | $cc -xc - -o $tmp 2>/dev/null <<'EOF' | 41 | $cc -x c - -o $tmp 2>/dev/null <<'EOF' |
42 | #include CURSES_LOC | 42 | #include CURSES_LOC |
43 | main() {} | 43 | main() {} |
44 | EOF | 44 | EOF |
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index b5211fce0d9..ee17a5264d5 100644 --- a/scripts/kconfig/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h | |||
@@ -144,6 +144,7 @@ struct dialog_info { | |||
144 | */ | 144 | */ |
145 | extern struct dialog_info dlg; | 145 | extern struct dialog_info dlg; |
146 | extern char dialog_input_result[]; | 146 | extern char dialog_input_result[]; |
147 | extern int saved_x, saved_y; /* Needed in signal handler in mconf.c */ | ||
147 | 148 | ||
148 | /* | 149 | /* |
149 | * Function prototypes | 150 | * Function prototypes |
@@ -209,7 +210,13 @@ int first_alpha(const char *string, const char *exempt); | |||
209 | int dialog_yesno(const char *title, const char *prompt, int height, int width); | 210 | int dialog_yesno(const char *title, const char *prompt, int height, int width); |
210 | int dialog_msgbox(const char *title, const char *prompt, int height, | 211 | int dialog_msgbox(const char *title, const char *prompt, int height, |
211 | int width, int pause); | 212 | int width, int pause); |
212 | int dialog_textbox(const char *title, const char *file, int height, int width); | 213 | |
214 | |||
215 | typedef void (*update_text_fn)(char *buf, size_t start, size_t end, void | ||
216 | *_data); | ||
217 | int dialog_textbox(const char *title, char *tbuf, int initial_height, | ||
218 | int initial_width, int *keys, int *_vscroll, int *_hscroll, | ||
219 | update_text_fn update_text, void *data); | ||
213 | int dialog_menu(const char *title, const char *prompt, | 220 | int dialog_menu(const char *title, const char *prompt, |
214 | const void *selected, int *s_scroll); | 221 | const void *selected, int *s_scroll); |
215 | int dialog_checklist(const char *title, const char *prompt, int height, | 222 | int dialog_checklist(const char *title, const char *prompt, int height, |
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c index c704712d022..a48bb93e090 100644 --- a/scripts/kconfig/lxdialog/textbox.c +++ b/scripts/kconfig/lxdialog/textbox.c | |||
@@ -22,23 +22,25 @@ | |||
22 | #include "dialog.h" | 22 | #include "dialog.h" |
23 | 23 | ||
24 | static void back_lines(int n); | 24 | static void back_lines(int n); |
25 | static void print_page(WINDOW * win, int height, int width); | 25 | static void print_page(WINDOW *win, int height, int width, update_text_fn |
26 | static void print_line(WINDOW * win, int row, int width); | 26 | update_text, void *data); |
27 | static void print_line(WINDOW *win, int row, int width); | ||
27 | static char *get_line(void); | 28 | static char *get_line(void); |
28 | static void print_position(WINDOW * win); | 29 | static void print_position(WINDOW * win); |
29 | 30 | ||
30 | static int hscroll; | 31 | static int hscroll; |
31 | static int begin_reached, end_reached, page_length; | 32 | static int begin_reached, end_reached, page_length; |
32 | static const char *buf; | 33 | static char *buf; |
33 | static const char *page; | 34 | static char *page; |
34 | 35 | ||
35 | /* | 36 | /* |
36 | * refresh window content | 37 | * refresh window content |
37 | */ | 38 | */ |
38 | static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, | 39 | static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, |
39 | int cur_y, int cur_x) | 40 | int cur_y, int cur_x, update_text_fn update_text, |
41 | void *data) | ||
40 | { | 42 | { |
41 | print_page(box, boxh, boxw); | 43 | print_page(box, boxh, boxw, update_text, data); |
42 | print_position(dialog); | 44 | print_position(dialog); |
43 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | 45 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ |
44 | wrefresh(dialog); | 46 | wrefresh(dialog); |
@@ -47,14 +49,18 @@ static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, | |||
47 | 49 | ||
48 | /* | 50 | /* |
49 | * Display text from a file in a dialog box. | 51 | * Display text from a file in a dialog box. |
52 | * | ||
53 | * keys is a null-terminated array | ||
54 | * update_text() may not add or remove any '\n' or '\0' in tbuf | ||
50 | */ | 55 | */ |
51 | int dialog_textbox(const char *title, const char *tbuf, | 56 | int dialog_textbox(const char *title, char *tbuf, int initial_height, |
52 | int initial_height, int initial_width) | 57 | int initial_width, int *keys, int *_vscroll, int *_hscroll, |
58 | update_text_fn update_text, void *data) | ||
53 | { | 59 | { |
54 | int i, x, y, cur_x, cur_y, key = 0; | 60 | int i, x, y, cur_x, cur_y, key = 0; |
55 | int height, width, boxh, boxw; | 61 | int height, width, boxh, boxw; |
56 | int passed_end; | ||
57 | WINDOW *dialog, *box; | 62 | WINDOW *dialog, *box; |
63 | bool done = false; | ||
58 | 64 | ||
59 | begin_reached = 1; | 65 | begin_reached = 1; |
60 | end_reached = 0; | 66 | end_reached = 0; |
@@ -63,6 +69,15 @@ int dialog_textbox(const char *title, const char *tbuf, | |||
63 | buf = tbuf; | 69 | buf = tbuf; |
64 | page = buf; /* page is pointer to start of page to be displayed */ | 70 | page = buf; /* page is pointer to start of page to be displayed */ |
65 | 71 | ||
72 | if (_vscroll && *_vscroll) { | ||
73 | begin_reached = 0; | ||
74 | |||
75 | for (i = 0; i < *_vscroll; i++) | ||
76 | get_line(); | ||
77 | } | ||
78 | if (_hscroll) | ||
79 | hscroll = *_hscroll; | ||
80 | |||
66 | do_resize: | 81 | do_resize: |
67 | getmaxyx(stdscr, height, width); | 82 | getmaxyx(stdscr, height, width); |
68 | if (height < 8 || width < 8) | 83 | if (height < 8 || width < 8) |
@@ -120,25 +135,28 @@ do_resize: | |||
120 | 135 | ||
121 | /* Print first page of text */ | 136 | /* Print first page of text */ |
122 | attr_clear(box, boxh, boxw, dlg.dialog.atr); | 137 | attr_clear(box, boxh, boxw, dlg.dialog.atr); |
123 | refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); | 138 | refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x, update_text, |
139 | data); | ||
124 | 140 | ||
125 | while ((key != KEY_ESC) && (key != '\n')) { | 141 | while (!done) { |
126 | key = wgetch(dialog); | 142 | key = wgetch(dialog); |
127 | switch (key) { | 143 | switch (key) { |
128 | case 'E': /* Exit */ | 144 | case 'E': /* Exit */ |
129 | case 'e': | 145 | case 'e': |
130 | case 'X': | 146 | case 'X': |
131 | case 'x': | 147 | case 'x': |
132 | delwin(box); | 148 | case 'q': |
133 | delwin(dialog); | 149 | case '\n': |
134 | return 0; | 150 | done = true; |
151 | break; | ||
135 | case 'g': /* First page */ | 152 | case 'g': /* First page */ |
136 | case KEY_HOME: | 153 | case KEY_HOME: |
137 | if (!begin_reached) { | 154 | if (!begin_reached) { |
138 | begin_reached = 1; | 155 | begin_reached = 1; |
139 | page = buf; | 156 | page = buf; |
140 | refresh_text_box(dialog, box, boxh, boxw, | 157 | refresh_text_box(dialog, box, boxh, boxw, |
141 | cur_y, cur_x); | 158 | cur_y, cur_x, update_text, |
159 | data); | ||
142 | } | 160 | } |
143 | break; | 161 | break; |
144 | case 'G': /* Last page */ | 162 | case 'G': /* Last page */ |
@@ -148,78 +166,48 @@ do_resize: | |||
148 | /* point to last char in buf */ | 166 | /* point to last char in buf */ |
149 | page = buf + strlen(buf); | 167 | page = buf + strlen(buf); |
150 | back_lines(boxh); | 168 | back_lines(boxh); |
151 | refresh_text_box(dialog, box, boxh, boxw, | 169 | refresh_text_box(dialog, box, boxh, boxw, cur_y, |
152 | cur_y, cur_x); | 170 | cur_x, update_text, data); |
153 | break; | 171 | break; |
154 | case 'K': /* Previous line */ | 172 | case 'K': /* Previous line */ |
155 | case 'k': | 173 | case 'k': |
156 | case KEY_UP: | 174 | case KEY_UP: |
157 | if (!begin_reached) { | 175 | if (begin_reached) |
158 | back_lines(page_length + 1); | 176 | break; |
159 | |||
160 | /* We don't call print_page() here but use | ||
161 | * scrolling to ensure faster screen update. | ||
162 | * However, 'end_reached' and 'page_length' | ||
163 | * should still be updated, and 'page' should | ||
164 | * point to start of next page. This is done | ||
165 | * by calling get_line() in the following | ||
166 | * 'for' loop. */ | ||
167 | scrollok(box, TRUE); | ||
168 | wscrl(box, -1); /* Scroll box region down one line */ | ||
169 | scrollok(box, FALSE); | ||
170 | page_length = 0; | ||
171 | passed_end = 0; | ||
172 | for (i = 0; i < boxh; i++) { | ||
173 | if (!i) { | ||
174 | /* print first line of page */ | ||
175 | print_line(box, 0, boxw); | ||
176 | wnoutrefresh(box); | ||
177 | } else | ||
178 | /* Called to update 'end_reached' and 'page' */ | ||
179 | get_line(); | ||
180 | if (!passed_end) | ||
181 | page_length++; | ||
182 | if (end_reached && !passed_end) | ||
183 | passed_end = 1; | ||
184 | } | ||
185 | 177 | ||
186 | print_position(dialog); | 178 | back_lines(page_length + 1); |
187 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | 179 | refresh_text_box(dialog, box, boxh, boxw, cur_y, |
188 | wrefresh(dialog); | 180 | cur_x, update_text, data); |
189 | } | ||
190 | break; | 181 | break; |
191 | case 'B': /* Previous page */ | 182 | case 'B': /* Previous page */ |
192 | case 'b': | 183 | case 'b': |
184 | case 'u': | ||
193 | case KEY_PPAGE: | 185 | case KEY_PPAGE: |
194 | if (begin_reached) | 186 | if (begin_reached) |
195 | break; | 187 | break; |
196 | back_lines(page_length + boxh); | 188 | back_lines(page_length + boxh); |
197 | refresh_text_box(dialog, box, boxh, boxw, | 189 | refresh_text_box(dialog, box, boxh, boxw, cur_y, |
198 | cur_y, cur_x); | 190 | cur_x, update_text, data); |
199 | break; | 191 | break; |
200 | case 'J': /* Next line */ | 192 | case 'J': /* Next line */ |
201 | case 'j': | 193 | case 'j': |
202 | case KEY_DOWN: | 194 | case KEY_DOWN: |
203 | if (!end_reached) { | 195 | if (end_reached) |
204 | begin_reached = 0; | 196 | break; |
205 | scrollok(box, TRUE); | 197 | |
206 | scroll(box); /* Scroll box region up one line */ | 198 | back_lines(page_length - 1); |
207 | scrollok(box, FALSE); | 199 | refresh_text_box(dialog, box, boxh, boxw, cur_y, |
208 | print_line(box, boxh - 1, boxw); | 200 | cur_x, update_text, data); |
209 | wnoutrefresh(box); | ||
210 | print_position(dialog); | ||
211 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | ||
212 | wrefresh(dialog); | ||
213 | } | ||
214 | break; | 201 | break; |
215 | case KEY_NPAGE: /* Next page */ | 202 | case KEY_NPAGE: /* Next page */ |
216 | case ' ': | 203 | case ' ': |
204 | case 'd': | ||
217 | if (end_reached) | 205 | if (end_reached) |
218 | break; | 206 | break; |
219 | 207 | ||
220 | begin_reached = 0; | 208 | begin_reached = 0; |
221 | refresh_text_box(dialog, box, boxh, boxw, | 209 | refresh_text_box(dialog, box, boxh, boxw, cur_y, |
222 | cur_y, cur_x); | 210 | cur_x, update_text, data); |
223 | break; | 211 | break; |
224 | case '0': /* Beginning of line */ | 212 | case '0': /* Beginning of line */ |
225 | case 'H': /* Scroll left */ | 213 | case 'H': /* Scroll left */ |
@@ -234,8 +222,8 @@ do_resize: | |||
234 | hscroll--; | 222 | hscroll--; |
235 | /* Reprint current page to scroll horizontally */ | 223 | /* Reprint current page to scroll horizontally */ |
236 | back_lines(page_length); | 224 | back_lines(page_length); |
237 | refresh_text_box(dialog, box, boxh, boxw, | 225 | refresh_text_box(dialog, box, boxh, boxw, cur_y, |
238 | cur_y, cur_x); | 226 | cur_x, update_text, data); |
239 | break; | 227 | break; |
240 | case 'L': /* Scroll right */ | 228 | case 'L': /* Scroll right */ |
241 | case 'l': | 229 | case 'l': |
@@ -245,11 +233,12 @@ do_resize: | |||
245 | hscroll++; | 233 | hscroll++; |
246 | /* Reprint current page to scroll horizontally */ | 234 | /* Reprint current page to scroll horizontally */ |
247 | back_lines(page_length); | 235 | back_lines(page_length); |
248 | refresh_text_box(dialog, box, boxh, boxw, | 236 | refresh_text_box(dialog, box, boxh, boxw, cur_y, |
249 | cur_y, cur_x); | 237 | cur_x, update_text, data); |
250 | break; | 238 | break; |
251 | case KEY_ESC: | 239 | case KEY_ESC: |
252 | key = on_key_esc(dialog); | 240 | if (on_key_esc(dialog) == KEY_ESC) |
241 | done = true; | ||
253 | break; | 242 | break; |
254 | case KEY_RESIZE: | 243 | case KEY_RESIZE: |
255 | back_lines(height); | 244 | back_lines(height); |
@@ -257,11 +246,31 @@ do_resize: | |||
257 | delwin(dialog); | 246 | delwin(dialog); |
258 | on_key_resize(); | 247 | on_key_resize(); |
259 | goto do_resize; | 248 | goto do_resize; |
249 | default: | ||
250 | for (i = 0; keys[i]; i++) { | ||
251 | if (key == keys[i]) { | ||
252 | done = true; | ||
253 | break; | ||
254 | } | ||
255 | } | ||
260 | } | 256 | } |
261 | } | 257 | } |
262 | delwin(box); | 258 | delwin(box); |
263 | delwin(dialog); | 259 | delwin(dialog); |
264 | return key; /* ESC pressed */ | 260 | if (_vscroll) { |
261 | const char *s; | ||
262 | |||
263 | s = buf; | ||
264 | *_vscroll = 0; | ||
265 | back_lines(page_length); | ||
266 | while (s < page && (s = strchr(s, '\n'))) { | ||
267 | (*_vscroll)++; | ||
268 | s++; | ||
269 | } | ||
270 | } | ||
271 | if (_hscroll) | ||
272 | *_hscroll = hscroll; | ||
273 | return key; | ||
265 | } | 274 | } |
266 | 275 | ||
267 | /* | 276 | /* |
@@ -298,12 +307,23 @@ static void back_lines(int n) | |||
298 | } | 307 | } |
299 | 308 | ||
300 | /* | 309 | /* |
301 | * Print a new page of text. Called by dialog_textbox(). | 310 | * Print a new page of text. |
302 | */ | 311 | */ |
303 | static void print_page(WINDOW * win, int height, int width) | 312 | static void print_page(WINDOW *win, int height, int width, update_text_fn |
313 | update_text, void *data) | ||
304 | { | 314 | { |
305 | int i, passed_end = 0; | 315 | int i, passed_end = 0; |
306 | 316 | ||
317 | if (update_text) { | ||
318 | char *end; | ||
319 | |||
320 | for (i = 0; i < height; i++) | ||
321 | get_line(); | ||
322 | end = page; | ||
323 | back_lines(height); | ||
324 | update_text(buf, page - buf, end - buf, data); | ||
325 | } | ||
326 | |||
307 | page_length = 0; | 327 | page_length = 0; |
308 | for (i = 0; i < height; i++) { | 328 | for (i = 0; i < height; i++) { |
309 | print_line(win, i, width); | 329 | print_line(win, i, width); |
@@ -316,11 +336,10 @@ static void print_page(WINDOW * win, int height, int width) | |||
316 | } | 336 | } |
317 | 337 | ||
318 | /* | 338 | /* |
319 | * Print a new line of text. Called by dialog_textbox() and print_page(). | 339 | * Print a new line of text. |
320 | */ | 340 | */ |
321 | static void print_line(WINDOW * win, int row, int width) | 341 | static void print_line(WINDOW * win, int row, int width) |
322 | { | 342 | { |
323 | int y, x; | ||
324 | char *line; | 343 | char *line; |
325 | 344 | ||
326 | line = get_line(); | 345 | line = get_line(); |
@@ -329,10 +348,10 @@ static void print_line(WINDOW * win, int row, int width) | |||
329 | waddch(win, ' '); | 348 | waddch(win, ' '); |
330 | waddnstr(win, line, MIN(strlen(line), width - 2)); | 349 | waddnstr(win, line, MIN(strlen(line), width - 2)); |
331 | 350 | ||
332 | getyx(win, y, x); | ||
333 | /* Clear 'residue' of previous line */ | 351 | /* Clear 'residue' of previous line */ |
334 | #if OLD_NCURSES | 352 | #if OLD_NCURSES |
335 | { | 353 | { |
354 | int x = getcurx(win); | ||
336 | int i; | 355 | int i; |
337 | for (i = 0; i < width - x; i++) | 356 | for (i = 0; i < width - x; i++) |
338 | waddch(win, ' '); | 357 | waddch(win, ' '); |
@@ -355,10 +374,8 @@ static char *get_line(void) | |||
355 | end_reached = 0; | 374 | end_reached = 0; |
356 | while (*page != '\n') { | 375 | while (*page != '\n') { |
357 | if (*page == '\0') { | 376 | if (*page == '\0') { |
358 | if (!end_reached) { | 377 | end_reached = 1; |
359 | end_reached = 1; | 378 | break; |
360 | break; | ||
361 | } | ||
362 | } else if (i < MAX_LEN) | 379 | } else if (i < MAX_LEN) |
363 | line[i++] = *(page++); | 380 | line[i++] = *(page++); |
364 | else { | 381 | else { |
@@ -371,7 +388,7 @@ static char *get_line(void) | |||
371 | if (i <= MAX_LEN) | 388 | if (i <= MAX_LEN) |
372 | line[i] = '\0'; | 389 | line[i] = '\0'; |
373 | if (!end_reached) | 390 | if (!end_reached) |
374 | page++; /* move pass '\n' */ | 391 | page++; /* move past '\n' */ |
375 | 392 | ||
376 | return line; | 393 | return line; |
377 | } | 394 | } |
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c index f2375ad7ebc..109d53117d2 100644 --- a/scripts/kconfig/lxdialog/util.c +++ b/scripts/kconfig/lxdialog/util.c | |||
@@ -23,6 +23,9 @@ | |||
23 | 23 | ||
24 | #include "dialog.h" | 24 | #include "dialog.h" |
25 | 25 | ||
26 | /* Needed in signal handler in mconf.c */ | ||
27 | int saved_x, saved_y; | ||
28 | |||
26 | struct dialog_info dlg; | 29 | struct dialog_info dlg; |
27 | 30 | ||
28 | static void set_mono_theme(void) | 31 | static void set_mono_theme(void) |
@@ -273,6 +276,10 @@ int init_dialog(const char *backtitle) | |||
273 | int height, width; | 276 | int height, width; |
274 | 277 | ||
275 | initscr(); /* Init curses */ | 278 | initscr(); /* Init curses */ |
279 | |||
280 | /* Get current cursor position for signal handler in mconf.c */ | ||
281 | getyx(stdscr, saved_y, saved_x); | ||
282 | |||
276 | getmaxyx(stdscr, height, width); | 283 | getmaxyx(stdscr, height, width); |
277 | if (height < 19 || width < 80) { | 284 | if (height < 19 || width < 80) { |
278 | endwin(); | 285 | endwin(); |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index d433c7a2474..820d2b6800f 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <unistd.h> | 18 | #include <unistd.h> |
19 | #include <locale.h> | 19 | #include <locale.h> |
20 | 20 | ||
21 | #define LKC_DIRECT_LINK | ||
22 | #include "lkc.h" | 21 | #include "lkc.h" |
23 | #include "lxdialog/dialog.h" | 22 | #include "lxdialog/dialog.h" |
24 | 23 | ||
@@ -845,6 +844,7 @@ int main(int ac, char **av) | |||
845 | "\n\n")); | 844 | "\n\n")); |
846 | return 1; | 845 | return 1; |
847 | } | 846 | } |
847 | /* fall through */ | ||
848 | case -1: | 848 | case -1: |
849 | printf(_("\n\n" | 849 | printf(_("\n\n" |
850 | "*** End of the configuration.\n" | 850 | "*** End of the configuration.\n" |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 5fdf10dc1d8..beeb92e75f8 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -3,10 +3,11 @@ | |||
3 | * Released under the terms of the GNU GPL v2.0. | 3 | * Released under the terms of the GNU GPL v2.0. |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <ctype.h> | ||
7 | #include <stdarg.h> | ||
6 | #include <stdlib.h> | 8 | #include <stdlib.h> |
7 | #include <string.h> | 9 | #include <string.h> |
8 | 10 | ||
9 | #define LKC_DIRECT_LINK | ||
10 | #include "lkc.h" | 11 | #include "lkc.h" |
11 | 12 | ||
12 | static const char nohelp_text[] = N_( | 13 | static const char nohelp_text[] = N_( |
@@ -350,7 +351,7 @@ void menu_finalize(struct menu *parent) | |||
350 | last_menu->next = NULL; | 351 | last_menu->next = NULL; |
351 | } | 352 | } |
352 | 353 | ||
353 | sym->dir_dep.expr = parent->dep; | 354 | sym->dir_dep.expr = expr_alloc_or(sym->dir_dep.expr, parent->dep); |
354 | } | 355 | } |
355 | for (menu = parent->list; menu; menu = menu->next) { | 356 | for (menu = parent->list; menu; menu = menu->next) { |
356 | if (sym && sym_is_choice(sym) && | 357 | if (sym && sym_is_choice(sym) && |
@@ -596,11 +597,10 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help) | |||
596 | struct symbol *sym = menu->sym; | 597 | struct symbol *sym = menu->sym; |
597 | 598 | ||
598 | if (menu_has_help(menu)) { | 599 | if (menu_has_help(menu)) { |
599 | if (sym->name) { | 600 | if (sym->name) |
600 | str_printf(help, "%s%s:\n\n", CONFIG_, sym->name); | 601 | str_printf(help, "%s%s:\n\n", CONFIG_, sym->name); |
601 | str_append(help, _(menu_get_help(menu))); | 602 | str_append(help, _(menu_get_help(menu))); |
602 | str_append(help, "\n"); | 603 | str_append(help, "\n"); |
603 | } | ||
604 | } else { | 604 | } else { |
605 | str_append(help, nohelp_text); | 605 | str_append(help, nohelp_text); |
606 | } | 606 | } |
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index 488dd741078..39ca1f1640e 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | #define _GNU_SOURCE | 8 | #define _GNU_SOURCE |
9 | #include <string.h> | 9 | #include <string.h> |
10 | #define LKC_DIRECT_LINK | 10 | |
11 | #include "lkc.h" | 11 | #include "lkc.h" |
12 | #include "nconf.h" | 12 | #include "nconf.h" |
13 | #include <ctype.h> | 13 | #include <ctype.h> |
@@ -1067,7 +1067,6 @@ static void conf(struct menu *menu) | |||
1067 | struct menu *submenu = 0; | 1067 | struct menu *submenu = 0; |
1068 | const char *prompt = menu_get_prompt(menu); | 1068 | const char *prompt = menu_get_prompt(menu); |
1069 | struct symbol *sym; | 1069 | struct symbol *sym; |
1070 | struct menu *active_menu = NULL; | ||
1071 | int res; | 1070 | int res; |
1072 | int current_index = 0; | 1071 | int current_index = 0; |
1073 | int last_top_row = 0; | 1072 | int last_top_row = 0; |
@@ -1152,13 +1151,9 @@ static void conf(struct menu *menu) | |||
1152 | continue; | 1151 | continue; |
1153 | 1152 | ||
1154 | submenu = (struct menu *) item_data(); | 1153 | submenu = (struct menu *) item_data(); |
1155 | active_menu = (struct menu *)item_data(); | ||
1156 | if (!submenu || !menu_is_visible(submenu)) | 1154 | if (!submenu || !menu_is_visible(submenu)) |
1157 | continue; | 1155 | continue; |
1158 | if (submenu) | 1156 | sym = submenu->sym; |
1159 | sym = submenu->sym; | ||
1160 | else | ||
1161 | sym = NULL; | ||
1162 | 1157 | ||
1163 | switch (res) { | 1158 | switch (res) { |
1164 | case ' ': | 1159 | case ' ': |
@@ -1222,20 +1217,13 @@ static void conf_message_callback(const char *fmt, va_list ap) | |||
1222 | 1217 | ||
1223 | static void show_help(struct menu *menu) | 1218 | static void show_help(struct menu *menu) |
1224 | { | 1219 | { |
1225 | struct gstr help = str_new(); | 1220 | struct gstr help; |
1226 | 1221 | ||
1227 | if (menu && menu->sym && menu_has_help(menu)) { | 1222 | if (!menu) |
1228 | if (menu->sym->name) { | 1223 | return; |
1229 | str_printf(&help, "%s%s:\n\n", CONFIG_, menu->sym->name); | 1224 | |
1230 | str_append(&help, _(menu_get_help(menu))); | 1225 | help = str_new(); |
1231 | str_append(&help, "\n"); | 1226 | menu_get_ext_help(menu, &help); |
1232 | get_symbol_str(&help, menu->sym); | ||
1233 | } else { | ||
1234 | str_append(&help, _(menu_get_help(menu))); | ||
1235 | } | ||
1236 | } else { | ||
1237 | str_append(&help, nohelp_text); | ||
1238 | } | ||
1239 | show_scroll_win(main_window, _(menu_get_prompt(menu)), str_get(&help)); | 1227 | show_scroll_win(main_window, _(menu_get_prompt(menu)), str_get(&help)); |
1240 | str_free(&help); | 1228 | str_free(&help); |
1241 | } | 1229 | } |
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index c2796b866f8..df274febb3e 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -1478,10 +1478,13 @@ void ConfigMainWindow::loadConfig(void) | |||
1478 | ConfigView::updateListAll(); | 1478 | ConfigView::updateListAll(); |
1479 | } | 1479 | } |
1480 | 1480 | ||
1481 | void ConfigMainWindow::saveConfig(void) | 1481 | bool ConfigMainWindow::saveConfig(void) |
1482 | { | 1482 | { |
1483 | if (conf_write(NULL)) | 1483 | if (conf_write(NULL)) { |
1484 | QMessageBox::information(this, "qconf", _("Unable to save configuration!")); | 1484 | QMessageBox::information(this, "qconf", _("Unable to save configuration!")); |
1485 | return false; | ||
1486 | } | ||
1487 | return true; | ||
1485 | } | 1488 | } |
1486 | 1489 | ||
1487 | void ConfigMainWindow::saveConfigAs(void) | 1490 | void ConfigMainWindow::saveConfigAs(void) |
@@ -1642,7 +1645,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) | |||
1642 | mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit")); | 1645 | mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit")); |
1643 | switch (mb.exec()) { | 1646 | switch (mb.exec()) { |
1644 | case QMessageBox::Yes: | 1647 | case QMessageBox::Yes: |
1645 | saveConfig(); | 1648 | if (saveConfig()) |
1649 | e->accept(); | ||
1650 | else | ||
1651 | e->ignore(); | ||
1652 | break; | ||
1646 | case QMessageBox::No: | 1653 | case QMessageBox::No: |
1647 | e->accept(); | 1654 | e->accept(); |
1648 | break; | 1655 | break; |
@@ -1745,10 +1752,6 @@ int main(int ac, char** av) | |||
1745 | bindtextdomain(PACKAGE, LOCALEDIR); | 1752 | bindtextdomain(PACKAGE, LOCALEDIR); |
1746 | textdomain(PACKAGE); | 1753 | textdomain(PACKAGE); |
1747 | 1754 | ||
1748 | #ifndef LKC_DIRECT_LINK | ||
1749 | kconfig_load(); | ||
1750 | #endif | ||
1751 | |||
1752 | progname = av[0]; | 1755 | progname = av[0]; |
1753 | configApp = new QApplication(ac, av); | 1756 | configApp = new QApplication(ac, av); |
1754 | if (ac > 1 && av[1][0] == '-') { | 1757 | if (ac > 1 && av[1][0] == '-') { |
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 91677d900db..3715b3e7212 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h | |||
@@ -311,7 +311,7 @@ public slots: | |||
311 | void listFocusChanged(void); | 311 | void listFocusChanged(void); |
312 | void goBack(void); | 312 | void goBack(void); |
313 | void loadConfig(void); | 313 | void loadConfig(void); |
314 | void saveConfig(void); | 314 | bool saveConfig(void); |
315 | void saveConfigAs(void); | 315 | void saveConfigAs(void); |
316 | void searchConfig(void); | 316 | void searchConfig(void); |
317 | void showSingleView(void); | 317 | void showSingleView(void); |
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index a796c95fe8a..071f00c3046 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <regex.h> | 9 | #include <regex.h> |
10 | #include <sys/utsname.h> | 10 | #include <sys/utsname.h> |
11 | 11 | ||
12 | #define LKC_DIRECT_LINK | ||
13 | #include "lkc.h" | 12 | #include "lkc.h" |
14 | 13 | ||
15 | struct symbol symbol_yes = { | 14 | struct symbol symbol_yes = { |
@@ -751,7 +750,8 @@ const char *sym_get_string_value(struct symbol *sym) | |||
751 | case no: | 750 | case no: |
752 | return "n"; | 751 | return "n"; |
753 | case mod: | 752 | case mod: |
754 | return "m"; | 753 | sym_calc_value(modules_sym); |
754 | return (modules_sym->curr.tri == no) ? "n" : "m"; | ||
755 | case yes: | 755 | case yes: |
756 | return "y"; | 756 | return "y"; |
757 | } | 757 | } |
@@ -893,6 +893,49 @@ const char *sym_expand_string_value(const char *in) | |||
893 | return res; | 893 | return res; |
894 | } | 894 | } |
895 | 895 | ||
896 | const char *sym_escape_string_value(const char *in) | ||
897 | { | ||
898 | const char *p; | ||
899 | size_t reslen; | ||
900 | char *res; | ||
901 | size_t l; | ||
902 | |||
903 | reslen = strlen(in) + strlen("\"\"") + 1; | ||
904 | |||
905 | p = in; | ||
906 | for (;;) { | ||
907 | l = strcspn(p, "\"\\"); | ||
908 | p += l; | ||
909 | |||
910 | if (p[0] == '\0') | ||
911 | break; | ||
912 | |||
913 | reslen++; | ||
914 | p++; | ||
915 | } | ||
916 | |||
917 | res = malloc(reslen); | ||
918 | res[0] = '\0'; | ||
919 | |||
920 | strcat(res, "\""); | ||
921 | |||
922 | p = in; | ||
923 | for (;;) { | ||
924 | l = strcspn(p, "\"\\"); | ||
925 | strncat(res, p, l); | ||
926 | p += l; | ||
927 | |||
928 | if (p[0] == '\0') | ||
929 | break; | ||
930 | |||
931 | strcat(res, "\\"); | ||
932 | strncat(res, p++, 1); | ||
933 | } | ||
934 | |||
935 | strcat(res, "\""); | ||
936 | return res; | ||
937 | } | ||
938 | |||
896 | struct symbol **sym_re_search(const char *pattern) | 939 | struct symbol **sym_re_search(const char *pattern) |
897 | { | 940 | { |
898 | struct symbol *sym, **sym_arr = NULL; | 941 | struct symbol *sym, **sym_arr = NULL; |
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index 6330cc871a4..d0b8b2318e4 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c | |||
@@ -5,6 +5,8 @@ | |||
5 | * Released under the terms of the GNU GPL v2.0. | 5 | * Released under the terms of the GNU GPL v2.0. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <stdarg.h> | ||
9 | #include <stdlib.h> | ||
8 | #include <string.h> | 10 | #include <string.h> |
9 | #include "lkc.h" | 11 | #include "lkc.h" |
10 | 12 | ||
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf index c9e690eb754..f14ab41154b 100644 --- a/scripts/kconfig/zconf.gperf +++ b/scripts/kconfig/zconf.gperf | |||
@@ -9,7 +9,7 @@ | |||
9 | 9 | ||
10 | struct kconf_id; | 10 | struct kconf_id; |
11 | 11 | ||
12 | static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); | 12 | static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); |
13 | 13 | ||
14 | %% | 14 | %% |
15 | mainmenu, T_MAINMENU, TF_COMMAND | 15 | mainmenu, T_MAINMENU, TF_COMMAND |
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped index 4055d5de175..40df0005daa 100644 --- a/scripts/kconfig/zconf.hash.c_shipped +++ b/scripts/kconfig/zconf.hash.c_shipped | |||
@@ -1,6 +1,5 @@ | |||
1 | /* ANSI-C code produced by gperf version 3.0.3 */ | 1 | /* ANSI-C code produced by gperf version 3.0.4 */ |
2 | /* Command-line: gperf */ | 2 | /* Command-line: gperf -t --output-file scripts/kconfig/zconf.hash.c_shipped -a -C -E -g -k '1,3,$' -p -t scripts/kconfig/zconf.gperf */ |
3 | /* Computed positions: -k'1,3' */ | ||
4 | 3 | ||
5 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | 4 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ |
6 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | 5 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ |
@@ -29,10 +28,11 @@ | |||
29 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." | 28 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." |
30 | #endif | 29 | #endif |
31 | 30 | ||
31 | #line 10 "scripts/kconfig/zconf.gperf" | ||
32 | struct kconf_id; | 32 | struct kconf_id; |
33 | 33 | ||
34 | static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); | 34 | static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); |
35 | /* maximum key range = 50, duplicates = 0 */ | 35 | /* maximum key range = 71, duplicates = 0 */ |
36 | 36 | ||
37 | #ifdef __GNUC__ | 37 | #ifdef __GNUC__ |
38 | __inline | 38 | __inline |
@@ -44,34 +44,34 @@ inline | |||
44 | static unsigned int | 44 | static unsigned int |
45 | kconf_id_hash (register const char *str, register unsigned int len) | 45 | kconf_id_hash (register const char *str, register unsigned int len) |
46 | { | 46 | { |
47 | static unsigned char asso_values[] = | 47 | static const unsigned char asso_values[] = |
48 | { | 48 | { |
49 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 49 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
50 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 50 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
51 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 51 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
52 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 52 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
53 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 53 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
54 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 54 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
55 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 55 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
56 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 56 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
57 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 57 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
58 | 52, 52, 52, 52, 52, 52, 52, 52, 40, 5, | 58 | 73, 73, 73, 73, 73, 73, 73, 73, 25, 25, |
59 | 0, 0, 5, 52, 0, 20, 52, 52, 10, 20, | 59 | 0, 0, 0, 5, 0, 0, 73, 73, 5, 0, |
60 | 5, 0, 35, 52, 0, 30, 0, 15, 0, 52, | 60 | 10, 5, 45, 73, 20, 20, 0, 15, 15, 73, |
61 | 15, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 61 | 20, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
62 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 62 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
63 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 63 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
64 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 64 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
65 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 65 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
66 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 66 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
67 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 67 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
68 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 68 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
69 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 69 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
70 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 70 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
71 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 71 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
72 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 72 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
73 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 73 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
74 | 52, 52, 52, 52, 52, 52 | 74 | 73, 73, 73, 73, 73, 73 |
75 | }; | 75 | }; |
76 | register int hval = len; | 76 | register int hval = len; |
77 | 77 | ||
@@ -85,87 +85,87 @@ kconf_id_hash (register const char *str, register unsigned int len) | |||
85 | hval += asso_values[(unsigned char)str[0]]; | 85 | hval += asso_values[(unsigned char)str[0]]; |
86 | break; | 86 | break; |
87 | } | 87 | } |
88 | return hval; | 88 | return hval + asso_values[(unsigned char)str[len - 1]]; |
89 | } | 89 | } |
90 | 90 | ||
91 | struct kconf_id_strings_t | 91 | struct kconf_id_strings_t |
92 | { | 92 | { |
93 | char kconf_id_strings_str2[sizeof("on")]; | 93 | char kconf_id_strings_str2[sizeof("if")]; |
94 | char kconf_id_strings_str3[sizeof("env")]; | 94 | char kconf_id_strings_str3[sizeof("int")]; |
95 | char kconf_id_strings_str5[sizeof("endif")]; | 95 | char kconf_id_strings_str5[sizeof("endif")]; |
96 | char kconf_id_strings_str6[sizeof("option")]; | 96 | char kconf_id_strings_str7[sizeof("default")]; |
97 | char kconf_id_strings_str7[sizeof("endmenu")]; | 97 | char kconf_id_strings_str8[sizeof("tristate")]; |
98 | char kconf_id_strings_str8[sizeof("optional")]; | ||
99 | char kconf_id_strings_str9[sizeof("endchoice")]; | 98 | char kconf_id_strings_str9[sizeof("endchoice")]; |
100 | char kconf_id_strings_str10[sizeof("range")]; | 99 | char kconf_id_strings_str12[sizeof("def_tristate")]; |
101 | char kconf_id_strings_str11[sizeof("choice")]; | ||
102 | char kconf_id_strings_str12[sizeof("default")]; | ||
103 | char kconf_id_strings_str13[sizeof("def_bool")]; | 100 | char kconf_id_strings_str13[sizeof("def_bool")]; |
104 | char kconf_id_strings_str14[sizeof("help")]; | 101 | char kconf_id_strings_str14[sizeof("defconfig_list")]; |
105 | char kconf_id_strings_str16[sizeof("config")]; | 102 | char kconf_id_strings_str17[sizeof("on")]; |
106 | char kconf_id_strings_str17[sizeof("def_tristate")]; | 103 | char kconf_id_strings_str18[sizeof("optional")]; |
107 | char kconf_id_strings_str18[sizeof("hex")]; | 104 | char kconf_id_strings_str21[sizeof("option")]; |
108 | char kconf_id_strings_str19[sizeof("defconfig_list")]; | 105 | char kconf_id_strings_str22[sizeof("endmenu")]; |
109 | char kconf_id_strings_str22[sizeof("if")]; | 106 | char kconf_id_strings_str23[sizeof("mainmenu")]; |
110 | char kconf_id_strings_str23[sizeof("int")]; | 107 | char kconf_id_strings_str25[sizeof("menuconfig")]; |
111 | char kconf_id_strings_str27[sizeof("modules")]; | 108 | char kconf_id_strings_str27[sizeof("modules")]; |
112 | char kconf_id_strings_str28[sizeof("tristate")]; | ||
113 | char kconf_id_strings_str29[sizeof("menu")]; | 109 | char kconf_id_strings_str29[sizeof("menu")]; |
110 | char kconf_id_strings_str31[sizeof("select")]; | ||
114 | char kconf_id_strings_str32[sizeof("comment")]; | 111 | char kconf_id_strings_str32[sizeof("comment")]; |
115 | char kconf_id_strings_str35[sizeof("menuconfig")]; | 112 | char kconf_id_strings_str33[sizeof("env")]; |
116 | char kconf_id_strings_str36[sizeof("string")]; | 113 | char kconf_id_strings_str35[sizeof("range")]; |
117 | char kconf_id_strings_str37[sizeof("visible")]; | 114 | char kconf_id_strings_str36[sizeof("choice")]; |
118 | char kconf_id_strings_str41[sizeof("prompt")]; | 115 | char kconf_id_strings_str39[sizeof("bool")]; |
119 | char kconf_id_strings_str42[sizeof("depends")]; | 116 | char kconf_id_strings_str41[sizeof("source")]; |
120 | char kconf_id_strings_str44[sizeof("bool")]; | 117 | char kconf_id_strings_str42[sizeof("visible")]; |
121 | char kconf_id_strings_str46[sizeof("select")]; | 118 | char kconf_id_strings_str43[sizeof("hex")]; |
119 | char kconf_id_strings_str46[sizeof("config")]; | ||
122 | char kconf_id_strings_str47[sizeof("boolean")]; | 120 | char kconf_id_strings_str47[sizeof("boolean")]; |
123 | char kconf_id_strings_str48[sizeof("mainmenu")]; | 121 | char kconf_id_strings_str51[sizeof("string")]; |
124 | char kconf_id_strings_str51[sizeof("source")]; | 122 | char kconf_id_strings_str54[sizeof("help")]; |
123 | char kconf_id_strings_str56[sizeof("prompt")]; | ||
124 | char kconf_id_strings_str72[sizeof("depends")]; | ||
125 | }; | 125 | }; |
126 | static struct kconf_id_strings_t kconf_id_strings_contents = | 126 | static const struct kconf_id_strings_t kconf_id_strings_contents = |
127 | { | 127 | { |
128 | "on", | 128 | "if", |
129 | "env", | 129 | "int", |
130 | "endif", | 130 | "endif", |
131 | "option", | ||
132 | "endmenu", | ||
133 | "optional", | ||
134 | "endchoice", | ||
135 | "range", | ||
136 | "choice", | ||
137 | "default", | 131 | "default", |
138 | "def_bool", | 132 | "tristate", |
139 | "help", | 133 | "endchoice", |
140 | "config", | ||
141 | "def_tristate", | 134 | "def_tristate", |
142 | "hex", | 135 | "def_bool", |
143 | "defconfig_list", | 136 | "defconfig_list", |
144 | "if", | 137 | "on", |
145 | "int", | 138 | "optional", |
139 | "option", | ||
140 | "endmenu", | ||
141 | "mainmenu", | ||
142 | "menuconfig", | ||
146 | "modules", | 143 | "modules", |
147 | "tristate", | ||
148 | "menu", | 144 | "menu", |
145 | "select", | ||
149 | "comment", | 146 | "comment", |
150 | "menuconfig", | 147 | "env", |
151 | "string", | 148 | "range", |
152 | "visible", | 149 | "choice", |
153 | "prompt", | ||
154 | "depends", | ||
155 | "bool", | 150 | "bool", |
156 | "select", | 151 | "source", |
152 | "visible", | ||
153 | "hex", | ||
154 | "config", | ||
157 | "boolean", | 155 | "boolean", |
158 | "mainmenu", | 156 | "string", |
159 | "source" | 157 | "help", |
158 | "prompt", | ||
159 | "depends" | ||
160 | }; | 160 | }; |
161 | #define kconf_id_strings ((const char *) &kconf_id_strings_contents) | 161 | #define kconf_id_strings ((const char *) &kconf_id_strings_contents) |
162 | #ifdef __GNUC__ | 162 | #ifdef __GNUC__ |
163 | __inline | 163 | __inline |
164 | #ifdef __GNUC_STDC_INLINE__ | 164 | #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ |
165 | __attribute__ ((__gnu_inline__)) | 165 | __attribute__ ((__gnu_inline__)) |
166 | #endif | 166 | #endif |
167 | #endif | 167 | #endif |
168 | struct kconf_id * | 168 | const struct kconf_id * |
169 | kconf_id_lookup (register const char *str, register unsigned int len) | 169 | kconf_id_lookup (register const char *str, register unsigned int len) |
170 | { | 170 | { |
171 | enum | 171 | enum |
@@ -174,54 +174,94 @@ kconf_id_lookup (register const char *str, register unsigned int len) | |||
174 | MIN_WORD_LENGTH = 2, | 174 | MIN_WORD_LENGTH = 2, |
175 | MAX_WORD_LENGTH = 14, | 175 | MAX_WORD_LENGTH = 14, |
176 | MIN_HASH_VALUE = 2, | 176 | MIN_HASH_VALUE = 2, |
177 | MAX_HASH_VALUE = 51 | 177 | MAX_HASH_VALUE = 72 |
178 | }; | 178 | }; |
179 | 179 | ||
180 | static struct kconf_id wordlist[] = | 180 | static const struct kconf_id wordlist[] = |
181 | { | 181 | { |
182 | {-1}, {-1}, | 182 | {-1}, {-1}, |
183 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_ON, TF_PARAM}, | 183 | #line 25 "scripts/kconfig/zconf.gperf" |
184 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3, T_OPT_ENV, TF_OPTION}, | 184 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_IF, TF_COMMAND|TF_PARAM}, |
185 | #line 36 "scripts/kconfig/zconf.gperf" | ||
186 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3, T_TYPE, TF_COMMAND, S_INT}, | ||
185 | {-1}, | 187 | {-1}, |
188 | #line 26 "scripts/kconfig/zconf.gperf" | ||
186 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND}, | 189 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND}, |
187 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6, T_OPTION, TF_COMMAND}, | 190 | {-1}, |
188 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_ENDMENU, TF_COMMAND}, | 191 | #line 29 "scripts/kconfig/zconf.gperf" |
189 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_OPTIONAL, TF_COMMAND}, | 192 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_DEFAULT, TF_COMMAND, S_UNKNOWN}, |
193 | #line 31 "scripts/kconfig/zconf.gperf" | ||
194 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_TYPE, TF_COMMAND, S_TRISTATE}, | ||
195 | #line 20 "scripts/kconfig/zconf.gperf" | ||
190 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9, T_ENDCHOICE, TF_COMMAND}, | 196 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9, T_ENDCHOICE, TF_COMMAND}, |
191 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10, T_RANGE, TF_COMMAND}, | 197 | {-1}, {-1}, |
192 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str11, T_CHOICE, TF_COMMAND}, | 198 | #line 32 "scripts/kconfig/zconf.gperf" |
193 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN}, | 199 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_TRISTATE}, |
200 | #line 35 "scripts/kconfig/zconf.gperf" | ||
194 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, | 201 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, |
195 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_HELP, TF_COMMAND}, | 202 | #line 45 "scripts/kconfig/zconf.gperf" |
196 | {-1}, | 203 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_OPT_DEFCONFIG_LIST,TF_OPTION}, |
197 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_CONFIG, TF_COMMAND}, | ||
198 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE}, | ||
199 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_HEX}, | ||
200 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str19, T_OPT_DEFCONFIG_LIST,TF_OPTION}, | ||
201 | {-1}, {-1}, | 204 | {-1}, {-1}, |
202 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_IF, TF_COMMAND|TF_PARAM}, | 205 | #line 43 "scripts/kconfig/zconf.gperf" |
203 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_INT}, | 206 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_ON, TF_PARAM}, |
204 | {-1}, {-1}, {-1}, | 207 | #line 28 "scripts/kconfig/zconf.gperf" |
208 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_OPTIONAL, TF_COMMAND}, | ||
209 | {-1}, {-1}, | ||
210 | #line 42 "scripts/kconfig/zconf.gperf" | ||
211 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_OPTION, TF_COMMAND}, | ||
212 | #line 17 "scripts/kconfig/zconf.gperf" | ||
213 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_ENDMENU, TF_COMMAND}, | ||
214 | #line 15 "scripts/kconfig/zconf.gperf" | ||
215 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_MAINMENU, TF_COMMAND}, | ||
216 | {-1}, | ||
217 | #line 23 "scripts/kconfig/zconf.gperf" | ||
218 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str25, T_MENUCONFIG, TF_COMMAND}, | ||
219 | {-1}, | ||
220 | #line 44 "scripts/kconfig/zconf.gperf" | ||
205 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION}, | 221 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION}, |
206 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_TRISTATE}, | 222 | {-1}, |
223 | #line 16 "scripts/kconfig/zconf.gperf" | ||
207 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND}, | 224 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND}, |
208 | {-1}, {-1}, | 225 | {-1}, |
226 | #line 39 "scripts/kconfig/zconf.gperf" | ||
227 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SELECT, TF_COMMAND}, | ||
228 | #line 21 "scripts/kconfig/zconf.gperf" | ||
209 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND}, | 229 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND}, |
210 | {-1}, {-1}, | 230 | #line 46 "scripts/kconfig/zconf.gperf" |
211 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND}, | 231 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_OPT_ENV, TF_OPTION}, |
212 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_TYPE, TF_COMMAND, S_STRING}, | ||
213 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_VISIBLE, TF_COMMAND}, | ||
214 | {-1}, {-1}, {-1}, | ||
215 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_PROMPT, TF_COMMAND}, | ||
216 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_DEPENDS, TF_COMMAND}, | ||
217 | {-1}, | 232 | {-1}, |
218 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str44, T_TYPE, TF_COMMAND, S_BOOLEAN}, | 233 | #line 40 "scripts/kconfig/zconf.gperf" |
234 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_RANGE, TF_COMMAND}, | ||
235 | #line 19 "scripts/kconfig/zconf.gperf" | ||
236 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_CHOICE, TF_COMMAND}, | ||
237 | {-1}, {-1}, | ||
238 | #line 33 "scripts/kconfig/zconf.gperf" | ||
239 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str39, T_TYPE, TF_COMMAND, S_BOOLEAN}, | ||
219 | {-1}, | 240 | {-1}, |
220 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_SELECT, TF_COMMAND}, | 241 | #line 18 "scripts/kconfig/zconf.gperf" |
242 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_SOURCE, TF_COMMAND}, | ||
243 | #line 41 "scripts/kconfig/zconf.gperf" | ||
244 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_VISIBLE, TF_COMMAND}, | ||
245 | #line 37 "scripts/kconfig/zconf.gperf" | ||
246 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str43, T_TYPE, TF_COMMAND, S_HEX}, | ||
247 | {-1}, {-1}, | ||
248 | #line 22 "scripts/kconfig/zconf.gperf" | ||
249 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_CONFIG, TF_COMMAND}, | ||
250 | #line 34 "scripts/kconfig/zconf.gperf" | ||
221 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN}, | 251 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN}, |
222 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND}, | 252 | {-1}, {-1}, {-1}, |
253 | #line 38 "scripts/kconfig/zconf.gperf" | ||
254 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str51, T_TYPE, TF_COMMAND, S_STRING}, | ||
223 | {-1}, {-1}, | 255 | {-1}, {-1}, |
224 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str51, T_SOURCE, TF_COMMAND} | 256 | #line 24 "scripts/kconfig/zconf.gperf" |
257 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str54, T_HELP, TF_COMMAND}, | ||
258 | {-1}, | ||
259 | #line 30 "scripts/kconfig/zconf.gperf" | ||
260 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str56, T_PROMPT, TF_COMMAND}, | ||
261 | {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, | ||
262 | {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, | ||
263 | #line 27 "scripts/kconfig/zconf.gperf" | ||
264 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str72, T_DEPENDS, TF_COMMAND} | ||
225 | }; | 265 | }; |
226 | 266 | ||
227 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | 267 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) |
@@ -242,4 +282,5 @@ kconf_id_lookup (register const char *str, register unsigned int len) | |||
242 | } | 282 | } |
243 | return 0; | 283 | return 0; |
244 | } | 284 | } |
285 | #line 47 "scripts/kconfig/zconf.gperf" | ||
245 | 286 | ||
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index b22f884f902..00f9d3a9cf8 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l | |||
@@ -1,5 +1,5 @@ | |||
1 | %option backup nostdinit noyywrap never-interactive full ecs | 1 | %option nostdinit noyywrap never-interactive full ecs |
2 | %option 8bit backup nodefault perf-report perf-report | 2 | %option 8bit nodefault perf-report perf-report |
3 | %option noinput | 3 | %option noinput |
4 | %x COMMAND HELP STRING PARAM | 4 | %x COMMAND HELP STRING PARAM |
5 | %{ | 5 | %{ |
@@ -14,7 +14,6 @@ | |||
14 | #include <string.h> | 14 | #include <string.h> |
15 | #include <unistd.h> | 15 | #include <unistd.h> |
16 | 16 | ||
17 | #define LKC_DIRECT_LINK | ||
18 | #include "lkc.h" | 17 | #include "lkc.h" |
19 | 18 | ||
20 | #define START_STRSIZE 16 | 19 | #define START_STRSIZE 16 |
@@ -96,7 +95,7 @@ n [A-Za-z0-9_] | |||
96 | 95 | ||
97 | <COMMAND>{ | 96 | <COMMAND>{ |
98 | {n}+ { | 97 | {n}+ { |
99 | struct kconf_id *id = kconf_id_lookup(yytext, yyleng); | 98 | const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); |
100 | BEGIN(PARAM); | 99 | BEGIN(PARAM); |
101 | current_pos.file = current_file; | 100 | current_pos.file = current_file; |
102 | current_pos.lineno = current_file->lineno; | 101 | current_pos.lineno = current_file->lineno; |
@@ -132,7 +131,7 @@ n [A-Za-z0-9_] | |||
132 | \n BEGIN(INITIAL); current_file->lineno++; return T_EOL; | 131 | \n BEGIN(INITIAL); current_file->lineno++; return T_EOL; |
133 | --- /* ignore */ | 132 | --- /* ignore */ |
134 | ({n}|[-/.])+ { | 133 | ({n}|[-/.])+ { |
135 | struct kconf_id *id = kconf_id_lookup(yytext, yyleng); | 134 | const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); |
136 | if (id && id->flags & TF_PARAM) { | 135 | if (id && id->flags & TF_PARAM) { |
137 | zconflval.id = id; | 136 | zconflval.id = id; |
138 | return id->token; | 137 | return id->token; |
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/zconf.lex.c_shipped index d9182916f72..c32b1a49f5a 100644 --- a/scripts/kconfig/lex.zconf.c_shipped +++ b/scripts/kconfig/zconf.lex.c_shipped | |||
@@ -1,5 +1,5 @@ | |||
1 | 1 | ||
2 | #line 3 "scripts/kconfig/lex.zconf.c" | 2 | #line 3 "scripts/kconfig/zconf.lex.c_shipped" |
3 | 3 | ||
4 | #define YY_INT_ALIGNED short int | 4 | #define YY_INT_ALIGNED short int |
5 | 5 | ||
@@ -72,6 +72,7 @@ typedef int flex_int32_t; | |||
72 | typedef unsigned char flex_uint8_t; | 72 | typedef unsigned char flex_uint8_t; |
73 | typedef unsigned short int flex_uint16_t; | 73 | typedef unsigned short int flex_uint16_t; |
74 | typedef unsigned int flex_uint32_t; | 74 | typedef unsigned int flex_uint32_t; |
75 | #endif /* ! C99 */ | ||
75 | 76 | ||
76 | /* Limits of integral types. */ | 77 | /* Limits of integral types. */ |
77 | #ifndef INT8_MIN | 78 | #ifndef INT8_MIN |
@@ -102,8 +103,6 @@ typedef unsigned int flex_uint32_t; | |||
102 | #define UINT32_MAX (4294967295U) | 103 | #define UINT32_MAX (4294967295U) |
103 | #endif | 104 | #endif |
104 | 105 | ||
105 | #endif /* ! C99 */ | ||
106 | |||
107 | #endif /* ! FLEXINT_H */ | 106 | #endif /* ! FLEXINT_H */ |
108 | 107 | ||
109 | #ifdef __cplusplus | 108 | #ifdef __cplusplus |
@@ -160,15 +159,7 @@ typedef unsigned int flex_uint32_t; | |||
160 | 159 | ||
161 | /* Size of default input buffer. */ | 160 | /* Size of default input buffer. */ |
162 | #ifndef YY_BUF_SIZE | 161 | #ifndef YY_BUF_SIZE |
163 | #ifdef __ia64__ | ||
164 | /* On IA-64, the buffer size is 16k, not 8k. | ||
165 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. | ||
166 | * Ditto for the __ia64__ case accordingly. | ||
167 | */ | ||
168 | #define YY_BUF_SIZE 32768 | ||
169 | #else | ||
170 | #define YY_BUF_SIZE 16384 | 162 | #define YY_BUF_SIZE 16384 |
171 | #endif /* __ia64__ */ | ||
172 | #endif | 163 | #endif |
173 | 164 | ||
174 | /* The state buf must be large enough to hold one state per character in the main buffer. | 165 | /* The state buf must be large enough to hold one state per character in the main buffer. |
@@ -785,7 +776,6 @@ char *zconftext; | |||
785 | #include <string.h> | 776 | #include <string.h> |
786 | #include <unistd.h> | 777 | #include <unistd.h> |
787 | 778 | ||
788 | #define LKC_DIRECT_LINK | ||
789 | #include "lkc.h" | 779 | #include "lkc.h" |
790 | 780 | ||
791 | #define START_STRSIZE 16 | 781 | #define START_STRSIZE 16 |
@@ -922,12 +912,7 @@ static int input (void ); | |||
922 | 912 | ||
923 | /* Amount of stuff to slurp up with each read. */ | 913 | /* Amount of stuff to slurp up with each read. */ |
924 | #ifndef YY_READ_BUF_SIZE | 914 | #ifndef YY_READ_BUF_SIZE |
925 | #ifdef __ia64__ | ||
926 | /* On IA-64, the buffer size is 16k, not 8k */ | ||
927 | #define YY_READ_BUF_SIZE 16384 | ||
928 | #else | ||
929 | #define YY_READ_BUF_SIZE 8192 | 915 | #define YY_READ_BUF_SIZE 8192 |
930 | #endif /* __ia64__ */ | ||
931 | #endif | 916 | #endif |
932 | 917 | ||
933 | /* Copy whatever the last rule matched to the standard output. */ | 918 | /* Copy whatever the last rule matched to the standard output. */ |
@@ -1100,7 +1085,7 @@ YY_RULE_SETUP | |||
1100 | case 6: | 1085 | case 6: |
1101 | YY_RULE_SETUP | 1086 | YY_RULE_SETUP |
1102 | { | 1087 | { |
1103 | struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); | 1088 | const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); |
1104 | BEGIN(PARAM); | 1089 | BEGIN(PARAM); |
1105 | current_pos.file = current_file; | 1090 | current_pos.file = current_file; |
1106 | current_pos.lineno = current_file->lineno; | 1091 | current_pos.lineno = current_file->lineno; |
@@ -1175,7 +1160,7 @@ YY_RULE_SETUP | |||
1175 | case 19: | 1160 | case 19: |
1176 | YY_RULE_SETUP | 1161 | YY_RULE_SETUP |
1177 | { | 1162 | { |
1178 | struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); | 1163 | const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); |
1179 | if (id && id->flags & TF_PARAM) { | 1164 | if (id && id->flags & TF_PARAM) { |
1180 | zconflval.id = id; | 1165 | zconflval.id = id; |
1181 | return id->token; | 1166 | return id->token; |
@@ -2073,8 +2058,8 @@ YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr ) | |||
2073 | 2058 | ||
2074 | /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will | 2059 | /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will |
2075 | * scan from a @e copy of @a bytes. | 2060 | * scan from a @e copy of @a bytes. |
2076 | * @param yybytes the byte buffer to scan | 2061 | * @param bytes the byte buffer to scan |
2077 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. | 2062 | * @param len the number of bytes in the buffer pointed to by @a bytes. |
2078 | * | 2063 | * |
2079 | * @return the newly allocated buffer state object. | 2064 | * @return the newly allocated buffer state object. |
2080 | */ | 2065 | */ |
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index 4c5495ea205..f636141e7bf 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped | |||
@@ -1,10 +1,9 @@ | |||
1 | 1 | /* A Bison parser, made by GNU Bison 2.4.3. */ | |
2 | /* A Bison parser, made by GNU Bison 2.4.1. */ | ||
3 | 2 | ||
4 | /* Skeleton implementation for Bison's Yacc-like parsers in C | 3 | /* Skeleton implementation for Bison's Yacc-like parsers in C |
5 | 4 | ||
6 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | 5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
7 | Free Software Foundation, Inc. | 6 | 2009, 2010 Free Software Foundation, Inc. |
8 | 7 | ||
9 | This program is free software: you can redistribute it and/or modify | 8 | This program is free software: you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by |
@@ -46,7 +45,7 @@ | |||
46 | #define YYBISON 1 | 45 | #define YYBISON 1 |
47 | 46 | ||
48 | /* Bison version. */ | 47 | /* Bison version. */ |
49 | #define YYBISON_VERSION "2.4.1" | 48 | #define YYBISON_VERSION "2.4.3" |
50 | 49 | ||
51 | /* Skeleton name. */ | 50 | /* Skeleton name. */ |
52 | #define YYSKELETON_NAME "yacc.c" | 51 | #define YYSKELETON_NAME "yacc.c" |
@@ -88,7 +87,6 @@ | |||
88 | #include <string.h> | 87 | #include <string.h> |
89 | #include <stdbool.h> | 88 | #include <stdbool.h> |
90 | 89 | ||
91 | #define LKC_DIRECT_LINK | ||
92 | #include "lkc.h" | 90 | #include "lkc.h" |
93 | 91 | ||
94 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) | 92 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) |
@@ -102,22 +100,18 @@ extern int zconflex(void); | |||
102 | static void zconfprint(const char *err, ...); | 100 | static void zconfprint(const char *err, ...); |
103 | static void zconf_error(const char *err, ...); | 101 | static void zconf_error(const char *err, ...); |
104 | static void zconferror(const char *err); | 102 | static void zconferror(const char *err); |
105 | static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken); | 103 | static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken); |
106 | 104 | ||
107 | struct symbol *symbol_hash[SYMBOL_HASHSIZE]; | 105 | struct symbol *symbol_hash[SYMBOL_HASHSIZE]; |
108 | 106 | ||
109 | static struct menu *current_menu, *current_entry; | 107 | static struct menu *current_menu, *current_entry; |
110 | 108 | ||
111 | #define YYDEBUG 0 | ||
112 | #if YYDEBUG | ||
113 | #define YYERROR_VERBOSE | ||
114 | #endif | ||
115 | 109 | ||
116 | 110 | ||
117 | 111 | ||
118 | /* Enabling traces. */ | 112 | /* Enabling traces. */ |
119 | #ifndef YYDEBUG | 113 | #ifndef YYDEBUG |
120 | # define YYDEBUG 0 | 114 | # define YYDEBUG 1 |
121 | #endif | 115 | #endif |
122 | 116 | ||
123 | /* Enabling verbose error messages. */ | 117 | /* Enabling verbose error messages. */ |
@@ -188,7 +182,7 @@ typedef union YYSTYPE | |||
188 | struct symbol *symbol; | 182 | struct symbol *symbol; |
189 | struct expr *expr; | 183 | struct expr *expr; |
190 | struct menu *menu; | 184 | struct menu *menu; |
191 | struct kconf_id *id; | 185 | const struct kconf_id *id; |
192 | 186 | ||
193 | 187 | ||
194 | 188 | ||
@@ -255,7 +249,7 @@ typedef short int yytype_int16; | |||
255 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) | 249 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
256 | 250 | ||
257 | #ifndef YY_ | 251 | #ifndef YY_ |
258 | # if YYENABLE_NLS | 252 | # if defined YYENABLE_NLS && YYENABLE_NLS |
259 | # if ENABLE_NLS | 253 | # if ENABLE_NLS |
260 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ | 254 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
261 | # define YY_(msgid) dgettext ("bison-runtime", msgid) | 255 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
@@ -535,18 +529,18 @@ static const yytype_int8 yyrhs[] = | |||
535 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | 529 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
536 | static const yytype_uint16 yyrline[] = | 530 | static const yytype_uint16 yyrline[] = |
537 | { | 531 | { |
538 | 0, 108, 108, 108, 110, 110, 112, 114, 115, 116, | 532 | 0, 104, 104, 104, 106, 106, 108, 110, 111, 112, |
539 | 117, 118, 119, 123, 127, 127, 127, 127, 127, 127, | 533 | 113, 114, 115, 119, 123, 123, 123, 123, 123, 123, |
540 | 127, 127, 131, 132, 133, 134, 135, 136, 140, 141, | 534 | 123, 123, 127, 128, 129, 130, 131, 132, 136, 137, |
541 | 147, 155, 161, 169, 179, 181, 182, 183, 184, 185, | 535 | 143, 151, 157, 165, 175, 177, 178, 179, 180, 181, |
542 | 186, 189, 197, 203, 213, 219, 225, 228, 230, 241, | 536 | 182, 185, 193, 199, 209, 215, 221, 224, 226, 237, |
543 | 242, 247, 256, 261, 269, 272, 274, 275, 276, 277, | 537 | 238, 243, 252, 257, 265, 268, 270, 271, 272, 273, |
544 | 278, 281, 287, 298, 304, 314, 316, 321, 329, 337, | 538 | 274, 277, 283, 294, 300, 310, 312, 317, 325, 333, |
545 | 340, 342, 343, 344, 349, 356, 363, 368, 376, 379, | 539 | 336, 338, 339, 340, 345, 352, 359, 364, 372, 375, |
546 | 381, 382, 383, 386, 394, 401, 408, 414, 421, 423, | 540 | 377, 378, 379, 382, 390, 397, 404, 410, 417, 419, |
547 | 424, 425, 428, 436, 438, 439, 442, 449, 451, 456, | 541 | 420, 421, 424, 432, 434, 435, 438, 445, 447, 452, |
548 | 457, 460, 461, 462, 466, 467, 470, 471, 474, 475, | 542 | 453, 456, 457, 458, 462, 463, 466, 467, 470, 471, |
549 | 476, 477, 478, 479, 480, 483, 484, 487, 488 | 543 | 472, 473, 474, 475, 476, 479, 480, 483, 484 |
550 | }; | 544 | }; |
551 | #endif | 545 | #endif |
552 | 546 | ||
@@ -806,9 +800,18 @@ static const yytype_uint8 yystos[] = | |||
806 | 800 | ||
807 | /* Like YYERROR except do call yyerror. This remains here temporarily | 801 | /* Like YYERROR except do call yyerror. This remains here temporarily |
808 | to ease the transition to the new meaning of YYERROR, for GCC. | 802 | to ease the transition to the new meaning of YYERROR, for GCC. |
809 | Once GCC version 2 has supplanted version 1, this can go. */ | 803 | Once GCC version 2 has supplanted version 1, this can go. However, |
804 | YYFAIL appears to be in use. Nevertheless, it is formally deprecated | ||
805 | in Bison 2.4.2's NEWS entry, where a plan to phase it out is | ||
806 | discussed. */ | ||
810 | 807 | ||
811 | #define YYFAIL goto yyerrlab | 808 | #define YYFAIL goto yyerrlab |
809 | #if defined YYFAIL | ||
810 | /* This is here to suppress warnings from the GCC cpp's | ||
811 | -Wunused-macros. Normally we don't worry about that warning, but | ||
812 | some users do, and we want to make it easy for users to remove | ||
813 | YYFAIL uses, which will produce warnings from Bison 2.5. */ | ||
814 | #endif | ||
812 | 815 | ||
813 | #define YYRECOVERING() (!!yyerrstatus) | 816 | #define YYRECOVERING() (!!yyerrstatus) |
814 | 817 | ||
@@ -865,7 +868,7 @@ while (YYID (0)) | |||
865 | we won't break user code: when these are the locations we know. */ | 868 | we won't break user code: when these are the locations we know. */ |
866 | 869 | ||
867 | #ifndef YY_LOCATION_PRINT | 870 | #ifndef YY_LOCATION_PRINT |
868 | # if YYLTYPE_IS_TRIVIAL | 871 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL |
869 | # define YY_LOCATION_PRINT(File, Loc) \ | 872 | # define YY_LOCATION_PRINT(File, Loc) \ |
870 | fprintf (File, "%d.%d-%d.%d", \ | 873 | fprintf (File, "%d.%d-%d.%d", \ |
871 | (Loc).first_line, (Loc).first_column, \ | 874 | (Loc).first_line, (Loc).first_column, \ |
@@ -1753,7 +1756,7 @@ yyreduce: | |||
1753 | case 48: | 1756 | case 48: |
1754 | 1757 | ||
1755 | { | 1758 | { |
1756 | struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string))); | 1759 | const struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string))); |
1757 | if (id && id->flags & TF_OPTION) | 1760 | if (id && id->flags & TF_OPTION) |
1758 | menu_add_option(id->token, (yyvsp[(3) - (3)].string)); | 1761 | menu_add_option(id->token, (yyvsp[(3) - (3)].string)); |
1759 | else | 1762 | else |
@@ -2258,10 +2261,8 @@ void conf_parse(const char *name) | |||
2258 | modules_sym->flags |= SYMBOL_AUTO; | 2261 | modules_sym->flags |= SYMBOL_AUTO; |
2259 | rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); | 2262 | rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); |
2260 | 2263 | ||
2261 | #if YYDEBUG | ||
2262 | if (getenv("ZCONF_DEBUG")) | 2264 | if (getenv("ZCONF_DEBUG")) |
2263 | zconfdebug = 1; | 2265 | zconfdebug = 1; |
2264 | #endif | ||
2265 | zconfparse(); | 2266 | zconfparse(); |
2266 | if (zconfnerrs) | 2267 | if (zconfnerrs) |
2267 | exit(1); | 2268 | exit(1); |
@@ -2300,7 +2301,7 @@ static const char *zconf_tokenname(int token) | |||
2300 | return "<token>"; | 2301 | return "<token>"; |
2301 | } | 2302 | } |
2302 | 2303 | ||
2303 | static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken) | 2304 | static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken) |
2304 | { | 2305 | { |
2305 | if (id->token != endtoken) { | 2306 | if (id->token != endtoken) { |
2306 | zconf_error("unexpected '%s' within %s block", | 2307 | zconf_error("unexpected '%s' within %s block", |
@@ -2345,9 +2346,7 @@ static void zconf_error(const char *err, ...) | |||
2345 | 2346 | ||
2346 | static void zconferror(const char *err) | 2347 | static void zconferror(const char *err) |
2347 | { | 2348 | { |
2348 | #if YYDEBUG | ||
2349 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); | 2349 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); |
2350 | #endif | ||
2351 | } | 2350 | } |
2352 | 2351 | ||
2353 | static void print_quoted_string(FILE *out, const char *str) | 2352 | static void print_quoted_string(FILE *out, const char *str) |
@@ -2496,7 +2495,7 @@ void zconfdump(FILE *out) | |||
2496 | } | 2495 | } |
2497 | } | 2496 | } |
2498 | 2497 | ||
2499 | #include "lex.zconf.c" | 2498 | #include "zconf.lex.c" |
2500 | #include "util.c" | 2499 | #include "util.c" |
2501 | #include "confdata.c" | 2500 | #include "confdata.c" |
2502 | #include "expr.c" | 2501 | #include "expr.c" |
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 49fb4ab664c..864da07ba4a 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <string.h> | 11 | #include <string.h> |
12 | #include <stdbool.h> | 12 | #include <stdbool.h> |
13 | 13 | ||
14 | #define LKC_DIRECT_LINK | ||
15 | #include "lkc.h" | 14 | #include "lkc.h" |
16 | 15 | ||
17 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) | 16 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) |
@@ -25,16 +24,12 @@ extern int zconflex(void); | |||
25 | static void zconfprint(const char *err, ...); | 24 | static void zconfprint(const char *err, ...); |
26 | static void zconf_error(const char *err, ...); | 25 | static void zconf_error(const char *err, ...); |
27 | static void zconferror(const char *err); | 26 | static void zconferror(const char *err); |
28 | static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken); | 27 | static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken); |
29 | 28 | ||
30 | struct symbol *symbol_hash[SYMBOL_HASHSIZE]; | 29 | struct symbol *symbol_hash[SYMBOL_HASHSIZE]; |
31 | 30 | ||
32 | static struct menu *current_menu, *current_entry; | 31 | static struct menu *current_menu, *current_entry; |
33 | 32 | ||
34 | #define YYDEBUG 0 | ||
35 | #if YYDEBUG | ||
36 | #define YYERROR_VERBOSE | ||
37 | #endif | ||
38 | %} | 33 | %} |
39 | %expect 30 | 34 | %expect 30 |
40 | 35 | ||
@@ -45,7 +40,7 @@ static struct menu *current_menu, *current_entry; | |||
45 | struct symbol *symbol; | 40 | struct symbol *symbol; |
46 | struct expr *expr; | 41 | struct expr *expr; |
47 | struct menu *menu; | 42 | struct menu *menu; |
48 | struct kconf_id *id; | 43 | const struct kconf_id *id; |
49 | } | 44 | } |
50 | 45 | ||
51 | %token <id>T_MAINMENU | 46 | %token <id>T_MAINMENU |
@@ -229,7 +224,7 @@ symbol_option_list: | |||
229 | /* empty */ | 224 | /* empty */ |
230 | | symbol_option_list T_WORD symbol_option_arg | 225 | | symbol_option_list T_WORD symbol_option_arg |
231 | { | 226 | { |
232 | struct kconf_id *id = kconf_id_lookup($2, strlen($2)); | 227 | const struct kconf_id *id = kconf_id_lookup($2, strlen($2)); |
233 | if (id && id->flags & TF_OPTION) | 228 | if (id && id->flags & TF_OPTION) |
234 | menu_add_option(id->token, $3); | 229 | menu_add_option(id->token, $3); |
235 | else | 230 | else |
@@ -503,10 +498,8 @@ void conf_parse(const char *name) | |||
503 | modules_sym->flags |= SYMBOL_AUTO; | 498 | modules_sym->flags |= SYMBOL_AUTO; |
504 | rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); | 499 | rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); |
505 | 500 | ||
506 | #if YYDEBUG | ||
507 | if (getenv("ZCONF_DEBUG")) | 501 | if (getenv("ZCONF_DEBUG")) |
508 | zconfdebug = 1; | 502 | zconfdebug = 1; |
509 | #endif | ||
510 | zconfparse(); | 503 | zconfparse(); |
511 | if (zconfnerrs) | 504 | if (zconfnerrs) |
512 | exit(1); | 505 | exit(1); |
@@ -545,7 +538,7 @@ static const char *zconf_tokenname(int token) | |||
545 | return "<token>"; | 538 | return "<token>"; |
546 | } | 539 | } |
547 | 540 | ||
548 | static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken) | 541 | static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken) |
549 | { | 542 | { |
550 | if (id->token != endtoken) { | 543 | if (id->token != endtoken) { |
551 | zconf_error("unexpected '%s' within %s block", | 544 | zconf_error("unexpected '%s' within %s block", |
@@ -590,9 +583,7 @@ static void zconf_error(const char *err, ...) | |||
590 | 583 | ||
591 | static void zconferror(const char *err) | 584 | static void zconferror(const char *err) |
592 | { | 585 | { |
593 | #if YYDEBUG | ||
594 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); | 586 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); |
595 | #endif | ||
596 | } | 587 | } |
597 | 588 | ||
598 | static void print_quoted_string(FILE *out, const char *str) | 589 | static void print_quoted_string(FILE *out, const char *str) |
@@ -741,7 +732,7 @@ void zconfdump(FILE *out) | |||
741 | } | 732 | } |
742 | } | 733 | } |
743 | 734 | ||
744 | #include "lex.zconf.c" | 735 | #include "zconf.lex.c" |
745 | #include "util.c" | 736 | #include "util.c" |
746 | #include "confdata.c" | 737 | #include "confdata.c" |
747 | #include "expr.c" | 738 | #include "expr.c" |
diff --git a/scripts/mkmakefile b/scripts/mkmakefile index 5325423ceab..0cc04426074 100644 --- a/scripts/mkmakefile +++ b/scripts/mkmakefile | |||
@@ -30,6 +30,13 @@ PATCHLEVEL = $4 | |||
30 | lastword = \$(word \$(words \$(1)),\$(1)) | 30 | lastword = \$(word \$(words \$(1)),\$(1)) |
31 | makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST))) | 31 | makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST))) |
32 | 32 | ||
33 | ifeq ("\$(origin V)", "command line") | ||
34 | VERBOSE := \$(V) | ||
35 | endif | ||
36 | ifneq (\$(VERBOSE),1) | ||
37 | Q := @ | ||
38 | endif | ||
39 | |||
33 | MAKEARGS := -C $1 | 40 | MAKEARGS := -C $1 |
34 | MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir)) | 41 | MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir)) |
35 | 42 | ||
@@ -40,7 +47,7 @@ MAKEFLAGS += --no-print-directory | |||
40 | all := \$(filter-out all Makefile,\$(MAKECMDGOALS)) | 47 | all := \$(filter-out all Makefile,\$(MAKECMDGOALS)) |
41 | 48 | ||
42 | all: | 49 | all: |
43 | \$(MAKE) \$(MAKEARGS) \$(all) | 50 | \$(Q)\$(MAKE) \$(MAKEARGS) \$(all) |
44 | 51 | ||
45 | Makefile:; | 52 | Makefile:; |
46 | 53 | ||
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 413c53693e6..a509ff8f32f 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -254,6 +254,28 @@ static enum export export_no(const char *s) | |||
254 | return export_unknown; | 254 | return export_unknown; |
255 | } | 255 | } |
256 | 256 | ||
257 | static const char *sec_name(struct elf_info *elf, int secindex); | ||
258 | |||
259 | #define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0) | ||
260 | |||
261 | static enum export export_from_secname(struct elf_info *elf, unsigned int sec) | ||
262 | { | ||
263 | const char *secname = sec_name(elf, sec); | ||
264 | |||
265 | if (strstarts(secname, "___ksymtab+")) | ||
266 | return export_plain; | ||
267 | else if (strstarts(secname, "___ksymtab_unused+")) | ||
268 | return export_unused; | ||
269 | else if (strstarts(secname, "___ksymtab_gpl+")) | ||
270 | return export_gpl; | ||
271 | else if (strstarts(secname, "___ksymtab_unused_gpl+")) | ||
272 | return export_unused_gpl; | ||
273 | else if (strstarts(secname, "___ksymtab_gpl_future+")) | ||
274 | return export_gpl_future; | ||
275 | else | ||
276 | return export_unknown; | ||
277 | } | ||
278 | |||
257 | static enum export export_from_sec(struct elf_info *elf, unsigned int sec) | 279 | static enum export export_from_sec(struct elf_info *elf, unsigned int sec) |
258 | { | 280 | { |
259 | if (sec == elf->export_sec) | 281 | if (sec == elf->export_sec) |
@@ -563,7 +585,12 @@ static void handle_modversions(struct module *mod, struct elf_info *info, | |||
563 | Elf_Sym *sym, const char *symname) | 585 | Elf_Sym *sym, const char *symname) |
564 | { | 586 | { |
565 | unsigned int crc; | 587 | unsigned int crc; |
566 | enum export export = export_from_sec(info, get_secindex(info, sym)); | 588 | enum export export; |
589 | |||
590 | if (!is_vmlinux(mod->name) && strncmp(symname, "__ksymtab", 9) == 0) | ||
591 | export = export_from_secname(info, get_secindex(info, sym)); | ||
592 | else | ||
593 | export = export_from_sec(info, get_secindex(info, sym)); | ||
567 | 594 | ||
568 | switch (sym->st_shndx) { | 595 | switch (sym->st_shndx) { |
569 | case SHN_COMMON: | 596 | case SHN_COMMON: |
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 006960ebbce..bc6aa003860 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
@@ -118,10 +118,12 @@ perf-tar=perf-$(KERNELVERSION) | |||
118 | 118 | ||
119 | quiet_cmd_perf_tar = TAR | 119 | quiet_cmd_perf_tar = TAR |
120 | cmd_perf_tar = \ | 120 | cmd_perf_tar = \ |
121 | git archive --prefix=$(perf-tar)/ HEAD^{tree} \ | 121 | git --git-dir=$(srctree)/.git archive --prefix=$(perf-tar)/ \ |
122 | $$(cat $(srctree)/tools/perf/MANIFEST) -o $(perf-tar).tar; \ | 122 | HEAD^{tree} $$(cd $(srctree); \ |
123 | echo $$(cat $(srctree)/tools/perf/MANIFEST)) \ | ||
124 | -o $(perf-tar).tar; \ | ||
123 | mkdir -p $(perf-tar); \ | 125 | mkdir -p $(perf-tar); \ |
124 | git rev-parse HEAD > $(perf-tar)/HEAD; \ | 126 | git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \ |
125 | tar rf $(perf-tar).tar $(perf-tar)/HEAD; \ | 127 | tar rf $(perf-tar).tar $(perf-tar)/HEAD; \ |
126 | rm -r $(perf-tar); \ | 128 | rm -r $(perf-tar); \ |
127 | $(if $(findstring tar-src,$@),, \ | 129 | $(if $(findstring tar-src,$@),, \ |
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 4d403844e13..8d9a5edd9c6 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -33,6 +33,12 @@ scm_version() | |||
33 | local short | 33 | local short |
34 | short=false | 34 | short=false |
35 | 35 | ||
36 | system=`echo $TARGET_SYSTEM` | ||
37 | if [ "$system" = "CARMA" ]; then | ||
38 | printf '%s' -carma | ||
39 | return | ||
40 | fi | ||
41 | |||
36 | cd "$srctree" | 42 | cd "$srctree" |
37 | if test -e .scmversion; then | 43 | if test -e .scmversion; then |
38 | cat .scmversion | 44 | cat .scmversion |