diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.lib | 15 | ||||
-rwxr-xr-x | scripts/checkpatch.pl | 652 | ||||
-rwxr-xr-x | scripts/config | 2 | ||||
-rw-r--r-- | scripts/dtc/dtc-lexer.l | 2 | ||||
-rw-r--r-- | scripts/dtc/dtc-lexer.lex.c_shipped | 232 | ||||
-rw-r--r-- | scripts/dtc/dtc-parser.tab.c_shipped | 715 | ||||
-rw-r--r-- | scripts/dtc/dtc-parser.tab.h_shipped | 14 | ||||
-rw-r--r-- | scripts/kconfig/lxdialog/menubox.c | 9 | ||||
-rw-r--r-- | scripts/kconfig/mconf.c | 11 | ||||
-rw-r--r-- | scripts/kconfig/menu.c | 15 | ||||
-rw-r--r-- | scripts/mod/devicetable-offsets.c | 6 | ||||
-rw-r--r-- | scripts/mod/file2alias.c | 20 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 54 | ||||
-rw-r--r-- | scripts/package/Makefile | 2 | ||||
-rw-r--r-- | scripts/sortextable.c | 5 |
15 files changed, 1124 insertions, 630 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index a5c05ae95225..49392ecbef17 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -149,7 +149,7 @@ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ | |||
149 | 149 | ||
150 | ld_flags = $(LDFLAGS) $(ldflags-y) | 150 | ld_flags = $(LDFLAGS) $(ldflags-y) |
151 | 151 | ||
152 | dtc_cpp_flags = -Wp,-MD,$(depfile).pre -nostdinc \ | 152 | dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ |
153 | -I$(srctree)/arch/$(SRCARCH)/boot/dts \ | 153 | -I$(srctree)/arch/$(SRCARCH)/boot/dts \ |
154 | -I$(srctree)/arch/$(SRCARCH)/boot/dts/include \ | 154 | -I$(srctree)/arch/$(SRCARCH)/boot/dts/include \ |
155 | -undef -D__DTS__ | 155 | -undef -D__DTS__ |
@@ -264,14 +264,14 @@ $(obj)/%.dtb.S: $(obj)/%.dtb | |||
264 | quiet_cmd_dtc = DTC $@ | 264 | quiet_cmd_dtc = DTC $@ |
265 | cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ | 265 | cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ |
266 | $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \ | 266 | $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \ |
267 | -i $(srctree)/arch/$(SRCARCH)/boot/dts $(DTC_FLAGS) \ | 267 | -i $(dir $<) $(DTC_FLAGS) \ |
268 | -d $(depfile).dtc $(dtc-tmp) ; \ | 268 | -d $(depfile).dtc.tmp $(dtc-tmp) ; \ |
269 | cat $(depfile).pre $(depfile).dtc > $(depfile) | 269 | cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) |
270 | 270 | ||
271 | $(obj)/%.dtb: $(src)/%.dts FORCE | 271 | $(obj)/%.dtb: $(src)/%.dts FORCE |
272 | $(call if_changed_dep,dtc) | 272 | $(call if_changed_dep,dtc) |
273 | 273 | ||
274 | dtc-tmp = $(subst $(comma),_,$(dot-target).dts) | 274 | dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) |
275 | 275 | ||
276 | # Bzip2 | 276 | # Bzip2 |
277 | # --------------------------------------------------------------------------- | 277 | # --------------------------------------------------------------------------- |
@@ -311,6 +311,11 @@ cmd_lzo = (cat $(filter-out FORCE,$^) | \ | |||
311 | lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | 311 | lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ |
312 | (rm -f $@ ; false) | 312 | (rm -f $@ ; false) |
313 | 313 | ||
314 | quiet_cmd_lz4 = LZ4 $@ | ||
315 | cmd_lz4 = (cat $(filter-out FORCE,$^) | \ | ||
316 | lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | ||
317 | (rm -f $@ ; false) | ||
318 | |||
314 | # U-Boot mkimage | 319 | # U-Boot mkimage |
315 | # --------------------------------------------------------------------------- | 320 | # --------------------------------------------------------------------------- |
316 | 321 | ||
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b954de58304f..2ee9eb750560 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -6,6 +6,7 @@ | |||
6 | # Licensed under the terms of the GNU GPL License version 2 | 6 | # Licensed under the terms of the GNU GPL License version 2 |
7 | 7 | ||
8 | use strict; | 8 | use strict; |
9 | use POSIX; | ||
9 | 10 | ||
10 | my $P = $0; | 11 | my $P = $0; |
11 | $P =~ s@.*/@@g; | 12 | $P =~ s@.*/@@g; |
@@ -27,9 +28,11 @@ my $summary = 1; | |||
27 | my $mailback = 0; | 28 | my $mailback = 0; |
28 | my $summary_file = 0; | 29 | my $summary_file = 0; |
29 | my $show_types = 0; | 30 | my $show_types = 0; |
31 | my $fix = 0; | ||
30 | my $root; | 32 | my $root; |
31 | my %debug; | 33 | my %debug; |
32 | my %ignore_type = (); | 34 | my %ignore_type = (); |
35 | my %camelcase = (); | ||
33 | my @ignore = (); | 36 | my @ignore = (); |
34 | my $help = 0; | 37 | my $help = 0; |
35 | my $configuration_file = ".checkpatch.conf"; | 38 | my $configuration_file = ".checkpatch.conf"; |
@@ -63,6 +66,11 @@ Options: | |||
63 | is all off) | 66 | is all off) |
64 | --test-only=WORD report only warnings/errors containing WORD | 67 | --test-only=WORD report only warnings/errors containing WORD |
65 | literally | 68 | literally |
69 | --fix EXPERIMENTAL - may create horrible results | ||
70 | If correctable single-line errors exist, create | ||
71 | "<inputfile>.EXPERIMENTAL-checkpatch-fixes" | ||
72 | with potential errors corrected to the preferred | ||
73 | checkpatch style | ||
66 | -h, --help, --version display this help and exit | 74 | -h, --help, --version display this help and exit |
67 | 75 | ||
68 | When FILE is - read standard input. | 76 | When FILE is - read standard input. |
@@ -114,7 +122,7 @@ GetOptions( | |||
114 | 'summary!' => \$summary, | 122 | 'summary!' => \$summary, |
115 | 'mailback!' => \$mailback, | 123 | 'mailback!' => \$mailback, |
116 | 'summary-file!' => \$summary_file, | 124 | 'summary-file!' => \$summary_file, |
117 | 125 | 'fix!' => \$fix, | |
118 | 'debug=s' => \%debug, | 126 | 'debug=s' => \%debug, |
119 | 'test-only=s' => \$tst_only, | 127 | 'test-only=s' => \$tst_only, |
120 | 'h|help' => \$help, | 128 | 'h|help' => \$help, |
@@ -230,17 +238,22 @@ our $Inline = qr{inline|__always_inline|noinline}; | |||
230 | our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]}; | 238 | our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]}; |
231 | our $Lval = qr{$Ident(?:$Member)*}; | 239 | our $Lval = qr{$Ident(?:$Member)*}; |
232 | 240 | ||
241 | our $Int_type = qr{(?i)llu|ull|ll|lu|ul|l|u}; | ||
242 | our $Binary = qr{(?i)0b[01]+$Int_type?}; | ||
243 | our $Hex = qr{(?i)0x[0-9a-f]+$Int_type?}; | ||
244 | our $Int = qr{[0-9]+$Int_type?}; | ||
233 | our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?}; | 245 | our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?}; |
234 | our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?}; | 246 | our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?}; |
235 | our $Float_int = qr{(?i)[0-9]+e-?[0-9]+[fl]?}; | 247 | our $Float_int = qr{(?i)[0-9]+e-?[0-9]+[fl]?}; |
236 | our $Float = qr{$Float_hex|$Float_dec|$Float_int}; | 248 | our $Float = qr{$Float_hex|$Float_dec|$Float_int}; |
237 | our $Constant = qr{$Float|(?i)(?:0x[0-9a-f]+|[0-9]+)[ul]*}; | 249 | our $Constant = qr{$Float|$Binary|$Hex|$Int}; |
238 | our $Assignment = qr{\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=}; | 250 | our $Assignment = qr{\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=}; |
239 | our $Compare = qr{<=|>=|==|!=|<|>}; | 251 | our $Compare = qr{<=|>=|==|!=|<|>}; |
252 | our $Arithmetic = qr{\+|-|\*|\/|%}; | ||
240 | our $Operators = qr{ | 253 | our $Operators = qr{ |
241 | <=|>=|==|!=| | 254 | <=|>=|==|!=| |
242 | =>|->|<<|>>|<|>|!|~| | 255 | =>|->|<<|>>|<|>|!|~| |
243 | &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|% | 256 | &&|\|\||,|\^|\+\+|--|&|\||$Arithmetic |
244 | }x; | 257 | }x; |
245 | 258 | ||
246 | our $NonptrType; | 259 | our $NonptrType; |
@@ -269,7 +282,7 @@ our $typeTypedefs = qr{(?x: | |||
269 | 282 | ||
270 | our $logFunctions = qr{(?x: | 283 | our $logFunctions = qr{(?x: |
271 | printk(?:_ratelimited|_once|)| | 284 | printk(?:_ratelimited|_once|)| |
272 | [a-z0-9]+_(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)| | 285 | (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)| |
273 | WARN(?:_RATELIMIT|_ONCE|)| | 286 | WARN(?:_RATELIMIT|_ONCE|)| |
274 | panic| | 287 | panic| |
275 | MODULE_[A-Z_]+ | 288 | MODULE_[A-Z_]+ |
@@ -338,7 +351,6 @@ sub build_types { | |||
338 | } | 351 | } |
339 | build_types(); | 352 | build_types(); |
340 | 353 | ||
341 | |||
342 | our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*}; | 354 | our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*}; |
343 | 355 | ||
344 | # Using $balanced_parens, $LvalOrFunc, or $FuncArg | 356 | # Using $balanced_parens, $LvalOrFunc, or $FuncArg |
@@ -358,10 +370,94 @@ sub deparenthesize { | |||
358 | return $string; | 370 | return $string; |
359 | } | 371 | } |
360 | 372 | ||
373 | sub seed_camelcase_file { | ||
374 | my ($file) = @_; | ||
375 | |||
376 | return if (!(-f $file)); | ||
377 | |||
378 | local $/; | ||
379 | |||
380 | open(my $include_file, '<', "$file") | ||
381 | or warn "$P: Can't read '$file' $!\n"; | ||
382 | my $text = <$include_file>; | ||
383 | close($include_file); | ||
384 | |||
385 | my @lines = split('\n', $text); | ||
386 | |||
387 | foreach my $line (@lines) { | ||
388 | next if ($line !~ /(?:[A-Z][a-z]|[a-z][A-Z])/); | ||
389 | if ($line =~ /^[ \t]*(?:#[ \t]*define|typedef\s+$Type)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)/) { | ||
390 | $camelcase{$1} = 1; | ||
391 | } | ||
392 | elsif ($line =~ /^\s*$Declare\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*\(/) { | ||
393 | $camelcase{$1} = 1; | ||
394 | } | ||
395 | } | ||
396 | } | ||
397 | |||
398 | my $camelcase_seeded = 0; | ||
399 | sub seed_camelcase_includes { | ||
400 | return if ($camelcase_seeded); | ||
401 | |||
402 | my $files; | ||
403 | my $camelcase_cache = ""; | ||
404 | my @include_files = (); | ||
405 | |||
406 | $camelcase_seeded = 1; | ||
407 | |||
408 | if (-d ".git") { | ||
409 | my $git_last_include_commit = `git log --no-merges --pretty=format:"%h%n" -1 -- include`; | ||
410 | chomp $git_last_include_commit; | ||
411 | $camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit"; | ||
412 | } else { | ||
413 | my $last_mod_date = 0; | ||
414 | $files = `find $root/include -name "*.h"`; | ||
415 | @include_files = split('\n', $files); | ||
416 | foreach my $file (@include_files) { | ||
417 | my $date = POSIX::strftime("%Y%m%d%H%M", | ||
418 | localtime((stat $file)[9])); | ||
419 | $last_mod_date = $date if ($last_mod_date < $date); | ||
420 | } | ||
421 | $camelcase_cache = ".checkpatch-camelcase.date.$last_mod_date"; | ||
422 | } | ||
423 | |||
424 | if ($camelcase_cache ne "" && -f $camelcase_cache) { | ||
425 | open(my $camelcase_file, '<', "$camelcase_cache") | ||
426 | or warn "$P: Can't read '$camelcase_cache' $!\n"; | ||
427 | while (<$camelcase_file>) { | ||
428 | chomp; | ||
429 | $camelcase{$_} = 1; | ||
430 | } | ||
431 | close($camelcase_file); | ||
432 | |||
433 | return; | ||
434 | } | ||
435 | |||
436 | if (-d ".git") { | ||
437 | $files = `git ls-files "include/*.h"`; | ||
438 | @include_files = split('\n', $files); | ||
439 | } | ||
440 | |||
441 | foreach my $file (@include_files) { | ||
442 | seed_camelcase_file($file); | ||
443 | } | ||
444 | |||
445 | if ($camelcase_cache ne "") { | ||
446 | unlink glob ".checkpatch-camelcase.*"; | ||
447 | open(my $camelcase_file, '>', "$camelcase_cache") | ||
448 | or warn "$P: Can't write '$camelcase_cache' $!\n"; | ||
449 | foreach (sort { lc($a) cmp lc($b) } keys(%camelcase)) { | ||
450 | print $camelcase_file ("$_\n"); | ||
451 | } | ||
452 | close($camelcase_file); | ||
453 | } | ||
454 | } | ||
455 | |||
361 | $chk_signoff = 0 if ($file); | 456 | $chk_signoff = 0 if ($file); |
362 | 457 | ||
363 | my @rawlines = (); | 458 | my @rawlines = (); |
364 | my @lines = (); | 459 | my @lines = (); |
460 | my @fixed = (); | ||
365 | my $vname; | 461 | my $vname; |
366 | for my $filename (@ARGV) { | 462 | for my $filename (@ARGV) { |
367 | my $FILE; | 463 | my $FILE; |
@@ -389,6 +485,7 @@ for my $filename (@ARGV) { | |||
389 | } | 485 | } |
390 | @rawlines = (); | 486 | @rawlines = (); |
391 | @lines = (); | 487 | @lines = (); |
488 | @fixed = (); | ||
392 | } | 489 | } |
393 | 490 | ||
394 | exit($exit); | 491 | exit($exit); |
@@ -429,7 +526,7 @@ sub parse_email { | |||
429 | $comment = $2 if defined $2; | 526 | $comment = $2 if defined $2; |
430 | $formatted_email =~ s/$address.*$//; | 527 | $formatted_email =~ s/$address.*$//; |
431 | $name = $formatted_email; | 528 | $name = $formatted_email; |
432 | $name =~ s/^\s+|\s+$//g; | 529 | $name = trim($name); |
433 | $name =~ s/^\"|\"$//g; | 530 | $name =~ s/^\"|\"$//g; |
434 | # If there's a name left after stripping spaces and | 531 | # If there's a name left after stripping spaces and |
435 | # leading quotes, and the address doesn't have both | 532 | # leading quotes, and the address doesn't have both |
@@ -444,9 +541,9 @@ sub parse_email { | |||
444 | } | 541 | } |
445 | } | 542 | } |
446 | 543 | ||
447 | $name =~ s/^\s+|\s+$//g; | 544 | $name = trim($name); |
448 | $name =~ s/^\"|\"$//g; | 545 | $name =~ s/^\"|\"$//g; |
449 | $address =~ s/^\s+|\s+$//g; | 546 | $address = trim($address); |
450 | $address =~ s/^\<|\>$//g; | 547 | $address =~ s/^\<|\>$//g; |
451 | 548 | ||
452 | if ($name =~ /[^\w \-]/i) { ##has "must quote" chars | 549 | if ($name =~ /[^\w \-]/i) { ##has "must quote" chars |
@@ -462,9 +559,9 @@ sub format_email { | |||
462 | 559 | ||
463 | my $formatted_email; | 560 | my $formatted_email; |
464 | 561 | ||
465 | $name =~ s/^\s+|\s+$//g; | 562 | $name = trim($name); |
466 | $name =~ s/^\"|\"$//g; | 563 | $name =~ s/^\"|\"$//g; |
467 | $address =~ s/^\s+|\s+$//g; | 564 | $address = trim($address); |
468 | 565 | ||
469 | if ($name =~ /[^\w \-]/i) { ##has "must quote" chars | 566 | if ($name =~ /[^\w \-]/i) { ##has "must quote" chars |
470 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes | 567 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes |
@@ -1286,19 +1383,25 @@ sub ERROR { | |||
1286 | if (report("ERROR", $_[0], $_[1])) { | 1383 | if (report("ERROR", $_[0], $_[1])) { |
1287 | our $clean = 0; | 1384 | our $clean = 0; |
1288 | our $cnt_error++; | 1385 | our $cnt_error++; |
1386 | return 1; | ||
1289 | } | 1387 | } |
1388 | return 0; | ||
1290 | } | 1389 | } |
1291 | sub WARN { | 1390 | sub WARN { |
1292 | if (report("WARNING", $_[0], $_[1])) { | 1391 | if (report("WARNING", $_[0], $_[1])) { |
1293 | our $clean = 0; | 1392 | our $clean = 0; |
1294 | our $cnt_warn++; | 1393 | our $cnt_warn++; |
1394 | return 1; | ||
1295 | } | 1395 | } |
1396 | return 0; | ||
1296 | } | 1397 | } |
1297 | sub CHK { | 1398 | sub CHK { |
1298 | if ($check && report("CHECK", $_[0], $_[1])) { | 1399 | if ($check && report("CHECK", $_[0], $_[1])) { |
1299 | our $clean = 0; | 1400 | our $clean = 0; |
1300 | our $cnt_chk++; | 1401 | our $cnt_chk++; |
1402 | return 1; | ||
1301 | } | 1403 | } |
1404 | return 0; | ||
1302 | } | 1405 | } |
1303 | 1406 | ||
1304 | sub check_absolute_file { | 1407 | sub check_absolute_file { |
@@ -1329,6 +1432,29 @@ sub check_absolute_file { | |||
1329 | } | 1432 | } |
1330 | } | 1433 | } |
1331 | 1434 | ||
1435 | sub trim { | ||
1436 | my ($string) = @_; | ||
1437 | |||
1438 | $string =~ s/(^\s+|\s+$)//g; | ||
1439 | |||
1440 | return $string; | ||
1441 | } | ||
1442 | |||
1443 | sub tabify { | ||
1444 | my ($leading) = @_; | ||
1445 | |||
1446 | my $source_indent = 8; | ||
1447 | my $max_spaces_before_tab = $source_indent - 1; | ||
1448 | my $spaces_to_tab = " " x $source_indent; | ||
1449 | |||
1450 | #convert leading spaces to tabs | ||
1451 | 1 while $leading =~ s@^([\t]*)$spaces_to_tab@$1\t@g; | ||
1452 | #Remove spaces before a tab | ||
1453 | 1 while $leading =~ s@^([\t]*)( {1,$max_spaces_before_tab})\t@$1\t@g; | ||
1454 | |||
1455 | return "$leading"; | ||
1456 | } | ||
1457 | |||
1332 | sub pos_last_openparen { | 1458 | sub pos_last_openparen { |
1333 | my ($line) = @_; | 1459 | my ($line) = @_; |
1334 | 1460 | ||
@@ -1406,7 +1532,6 @@ sub process { | |||
1406 | my %suppress_export; | 1532 | my %suppress_export; |
1407 | my $suppress_statement = 0; | 1533 | my $suppress_statement = 0; |
1408 | 1534 | ||
1409 | my %camelcase = (); | ||
1410 | 1535 | ||
1411 | # Pre-scan the patch sanitizing the lines. | 1536 | # Pre-scan the patch sanitizing the lines. |
1412 | # Pre-scan the patch looking for any __setup documentation. | 1537 | # Pre-scan the patch looking for any __setup documentation. |
@@ -1420,6 +1545,8 @@ sub process { | |||
1420 | $linenr++; | 1545 | $linenr++; |
1421 | $line = $rawline; | 1546 | $line = $rawline; |
1422 | 1547 | ||
1548 | push(@fixed, $rawline) if ($fix); | ||
1549 | |||
1423 | if ($rawline=~/^\+\+\+\s+(\S+)/) { | 1550 | if ($rawline=~/^\+\+\+\s+(\S+)/) { |
1424 | $setup_docs = 0; | 1551 | $setup_docs = 0; |
1425 | if ($1 =~ m@Documentation/kernel-parameters.txt$@) { | 1552 | if ($1 =~ m@Documentation/kernel-parameters.txt$@) { |
@@ -1611,16 +1738,29 @@ sub process { | |||
1611 | "Non-standard signature: $sign_off\n" . $herecurr); | 1738 | "Non-standard signature: $sign_off\n" . $herecurr); |
1612 | } | 1739 | } |
1613 | if (defined $space_before && $space_before ne "") { | 1740 | if (defined $space_before && $space_before ne "") { |
1614 | WARN("BAD_SIGN_OFF", | 1741 | if (WARN("BAD_SIGN_OFF", |
1615 | "Do not use whitespace before $ucfirst_sign_off\n" . $herecurr); | 1742 | "Do not use whitespace before $ucfirst_sign_off\n" . $herecurr) && |
1743 | $fix) { | ||
1744 | $fixed[$linenr - 1] = | ||
1745 | "$ucfirst_sign_off $email"; | ||
1746 | } | ||
1616 | } | 1747 | } |
1617 | if ($sign_off =~ /-by:$/i && $sign_off ne $ucfirst_sign_off) { | 1748 | if ($sign_off =~ /-by:$/i && $sign_off ne $ucfirst_sign_off) { |
1618 | WARN("BAD_SIGN_OFF", | 1749 | if (WARN("BAD_SIGN_OFF", |
1619 | "'$ucfirst_sign_off' is the preferred signature form\n" . $herecurr); | 1750 | "'$ucfirst_sign_off' is the preferred signature form\n" . $herecurr) && |
1751 | $fix) { | ||
1752 | $fixed[$linenr - 1] = | ||
1753 | "$ucfirst_sign_off $email"; | ||
1754 | } | ||
1755 | |||
1620 | } | 1756 | } |
1621 | if (!defined $space_after || $space_after ne " ") { | 1757 | if (!defined $space_after || $space_after ne " ") { |
1622 | WARN("BAD_SIGN_OFF", | 1758 | if (WARN("BAD_SIGN_OFF", |
1623 | "Use a single space after $ucfirst_sign_off\n" . $herecurr); | 1759 | "Use a single space after $ucfirst_sign_off\n" . $herecurr) && |
1760 | $fix) { | ||
1761 | $fixed[$linenr - 1] = | ||
1762 | "$ucfirst_sign_off $email"; | ||
1763 | } | ||
1624 | } | 1764 | } |
1625 | 1765 | ||
1626 | my ($email_name, $email_address, $comment) = parse_email($email); | 1766 | my ($email_name, $email_address, $comment) = parse_email($email); |
@@ -1710,8 +1850,12 @@ sub process { | |||
1710 | 1850 | ||
1711 | } elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) { | 1851 | } elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) { |
1712 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; | 1852 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; |
1713 | ERROR("TRAILING_WHITESPACE", | 1853 | if (ERROR("TRAILING_WHITESPACE", |
1714 | "trailing whitespace\n" . $herevet); | 1854 | "trailing whitespace\n" . $herevet) && |
1855 | $fix) { | ||
1856 | $fixed[$linenr - 1] =~ s/^(\+.*?)\s+$/$1/; | ||
1857 | } | ||
1858 | |||
1715 | $rpt_cleaners = 1; | 1859 | $rpt_cleaners = 1; |
1716 | } | 1860 | } |
1717 | 1861 | ||
@@ -1806,8 +1950,12 @@ sub process { | |||
1806 | 1950 | ||
1807 | # check for spaces before a quoted newline | 1951 | # check for spaces before a quoted newline |
1808 | if ($rawline =~ /^.*\".*\s\\n/) { | 1952 | if ($rawline =~ /^.*\".*\s\\n/) { |
1809 | WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE", | 1953 | if (WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE", |
1810 | "unnecessary whitespace before a quoted newline\n" . $herecurr); | 1954 | "unnecessary whitespace before a quoted newline\n" . $herecurr) && |
1955 | $fix) { | ||
1956 | $fixed[$linenr - 1] =~ s/^(\+.*\".*)\s+\\n/$1\\n/; | ||
1957 | } | ||
1958 | |||
1811 | } | 1959 | } |
1812 | 1960 | ||
1813 | # check for adding lines without a newline. | 1961 | # check for adding lines without a newline. |
@@ -1838,16 +1986,23 @@ sub process { | |||
1838 | if ($rawline =~ /^\+\s* \t\s*\S/ || | 1986 | if ($rawline =~ /^\+\s* \t\s*\S/ || |
1839 | $rawline =~ /^\+\s* \s*/) { | 1987 | $rawline =~ /^\+\s* \s*/) { |
1840 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; | 1988 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; |
1841 | ERROR("CODE_INDENT", | ||
1842 | "code indent should use tabs where possible\n" . $herevet); | ||
1843 | $rpt_cleaners = 1; | 1989 | $rpt_cleaners = 1; |
1990 | if (ERROR("CODE_INDENT", | ||
1991 | "code indent should use tabs where possible\n" . $herevet) && | ||
1992 | $fix) { | ||
1993 | $fixed[$linenr - 1] =~ s/^\+([ \t]+)/"\+" . tabify($1)/e; | ||
1994 | } | ||
1844 | } | 1995 | } |
1845 | 1996 | ||
1846 | # check for space before tabs. | 1997 | # check for space before tabs. |
1847 | if ($rawline =~ /^\+/ && $rawline =~ / \t/) { | 1998 | if ($rawline =~ /^\+/ && $rawline =~ / \t/) { |
1848 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; | 1999 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; |
1849 | WARN("SPACE_BEFORE_TAB", | 2000 | if (WARN("SPACE_BEFORE_TAB", |
1850 | "please, no space before tabs\n" . $herevet); | 2001 | "please, no space before tabs\n" . $herevet) && |
2002 | $fix) { | ||
2003 | $fixed[$linenr - 1] =~ | ||
2004 | s/(^\+.*) +\t/$1\t/; | ||
2005 | } | ||
1851 | } | 2006 | } |
1852 | 2007 | ||
1853 | # check for && or || at the start of a line | 2008 | # check for && or || at the start of a line |
@@ -1875,25 +2030,42 @@ sub process { | |||
1875 | 2030 | ||
1876 | if ($newindent ne $goodtabindent && | 2031 | if ($newindent ne $goodtabindent && |
1877 | $newindent ne $goodspaceindent) { | 2032 | $newindent ne $goodspaceindent) { |
1878 | CHK("PARENTHESIS_ALIGNMENT", | 2033 | |
1879 | "Alignment should match open parenthesis\n" . $hereprev); | 2034 | if (CHK("PARENTHESIS_ALIGNMENT", |
2035 | "Alignment should match open parenthesis\n" . $hereprev) && | ||
2036 | $fix && $line =~ /^\+/) { | ||
2037 | $fixed[$linenr - 1] =~ | ||
2038 | s/^\+[ \t]*/\+$goodtabindent/; | ||
2039 | } | ||
1880 | } | 2040 | } |
1881 | } | 2041 | } |
1882 | } | 2042 | } |
1883 | 2043 | ||
1884 | if ($line =~ /^\+.*\*[ \t]*\)[ \t]+/) { | 2044 | if ($line =~ /^\+.*\*[ \t]*\)[ \t]+(?!$Assignment|$Arithmetic)/) { |
1885 | CHK("SPACING", | 2045 | if (CHK("SPACING", |
1886 | "No space is necessary after a cast\n" . $hereprev); | 2046 | "No space is necessary after a cast\n" . $hereprev) && |
2047 | $fix) { | ||
2048 | $fixed[$linenr - 1] =~ | ||
2049 | s/^(\+.*\*[ \t]*\))[ \t]+/$1/; | ||
2050 | } | ||
1887 | } | 2051 | } |
1888 | 2052 | ||
1889 | if ($realfile =~ m@^(drivers/net/|net/)@ && | 2053 | if ($realfile =~ m@^(drivers/net/|net/)@ && |
1890 | $rawline =~ /^\+[ \t]*\/\*[ \t]*$/ && | 2054 | $prevrawline =~ /^\+[ \t]*\/\*[ \t]*$/ && |
1891 | $prevrawline =~ /^\+[ \t]*$/) { | 2055 | $rawline =~ /^\+[ \t]*\*/) { |
1892 | WARN("NETWORKING_BLOCK_COMMENT_STYLE", | 2056 | WARN("NETWORKING_BLOCK_COMMENT_STYLE", |
1893 | "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev); | 2057 | "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev); |
1894 | } | 2058 | } |
1895 | 2059 | ||
1896 | if ($realfile =~ m@^(drivers/net/|net/)@ && | 2060 | if ($realfile =~ m@^(drivers/net/|net/)@ && |
2061 | $prevrawline =~ /^\+[ \t]*\/\*/ && #starting /* | ||
2062 | $prevrawline !~ /\*\/[ \t]*$/ && #no trailing */ | ||
2063 | $rawline !~ /^\+[ \t]*\*/) { #no leading * | ||
2064 | WARN("NETWORKING_BLOCK_COMMENT_STYLE", | ||
2065 | "networking block comments start with * on subsequent lines\n" . $hereprev); | ||
2066 | } | ||
2067 | |||
2068 | if ($realfile =~ m@^(drivers/net/|net/)@ && | ||
1897 | $rawline !~ m@^\+[ \t]*\*/[ \t]*$@ && #trailing */ | 2069 | $rawline !~ m@^\+[ \t]*\*/[ \t]*$@ && #trailing */ |
1898 | $rawline !~ m@^\+.*/\*.*\*/[ \t]*$@ && #inline /*...*/ | 2070 | $rawline !~ m@^\+.*/\*.*\*/[ \t]*$@ && #inline /*...*/ |
1899 | $rawline !~ m@^\+.*\*{2,}/[ \t]*$@ && #trailing **/ | 2071 | $rawline !~ m@^\+.*\*{2,}/[ \t]*$@ && #trailing **/ |
@@ -1907,10 +2079,13 @@ sub process { | |||
1907 | # 1) within comments | 2079 | # 1) within comments |
1908 | # 2) indented preprocessor commands | 2080 | # 2) indented preprocessor commands |
1909 | # 3) hanging labels | 2081 | # 3) hanging labels |
1910 | if ($rawline =~ /^\+ / && $line !~ /\+ *(?:$;|#|$Ident:)/) { | 2082 | if ($rawline =~ /^\+ / && $line !~ /^\+ *(?:$;|#|$Ident:)/) { |
1911 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; | 2083 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; |
1912 | WARN("LEADING_SPACE", | 2084 | if (WARN("LEADING_SPACE", |
1913 | "please, no spaces at the start of a line\n" . $herevet); | 2085 | "please, no spaces at the start of a line\n" . $herevet) && |
2086 | $fix) { | ||
2087 | $fixed[$linenr - 1] =~ s/^\+([ \t]+)/"\+" . tabify($1)/e; | ||
2088 | } | ||
1914 | } | 2089 | } |
1915 | 2090 | ||
1916 | # check we are in a valid C source file if not then ignore this hunk | 2091 | # check we are in a valid C source file if not then ignore this hunk |
@@ -2200,7 +2375,7 @@ sub process { | |||
2200 | $prev_values = substr($curr_values, -1); | 2375 | $prev_values = substr($curr_values, -1); |
2201 | 2376 | ||
2202 | #ignore lines not being added | 2377 | #ignore lines not being added |
2203 | if ($line=~/^[^\+]/) {next;} | 2378 | next if ($line =~ /^[^\+]/); |
2204 | 2379 | ||
2205 | # TEST: allow direct testing of the type matcher. | 2380 | # TEST: allow direct testing of the type matcher. |
2206 | if ($dbg_type) { | 2381 | if ($dbg_type) { |
@@ -2251,8 +2426,15 @@ sub process { | |||
2251 | 2426 | ||
2252 | # no C99 // comments | 2427 | # no C99 // comments |
2253 | if ($line =~ m{//}) { | 2428 | if ($line =~ m{//}) { |
2254 | ERROR("C99_COMMENTS", | 2429 | if (ERROR("C99_COMMENTS", |
2255 | "do not use C99 // comments\n" . $herecurr); | 2430 | "do not use C99 // comments\n" . $herecurr) && |
2431 | $fix) { | ||
2432 | my $line = $fixed[$linenr - 1]; | ||
2433 | if ($line =~ /\/\/(.*)$/) { | ||
2434 | my $comment = trim($1); | ||
2435 | $fixed[$linenr - 1] =~ s@\/\/(.*)$@/\* $comment \*/@; | ||
2436 | } | ||
2437 | } | ||
2256 | } | 2438 | } |
2257 | # Remove C99 comments. | 2439 | # Remove C99 comments. |
2258 | $line =~ s@//.*@@; | 2440 | $line =~ s@//.*@@; |
@@ -2351,7 +2533,7 @@ sub process { | |||
2351 | # (char*[ const]) | 2533 | # (char*[ const]) |
2352 | while ($line =~ m{(\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\))}g) { | 2534 | while ($line =~ m{(\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\))}g) { |
2353 | #print "AA<$1>\n"; | 2535 | #print "AA<$1>\n"; |
2354 | my ($from, $to) = ($2, $2); | 2536 | my ($ident, $from, $to) = ($1, $2, $2); |
2355 | 2537 | ||
2356 | # Should start with a space. | 2538 | # Should start with a space. |
2357 | $to =~ s/^(\S)/ $1/; | 2539 | $to =~ s/^(\S)/ $1/; |
@@ -2361,15 +2543,22 @@ sub process { | |||
2361 | while ($to =~ s/\*\s+\*/\*\*/) { | 2543 | while ($to =~ s/\*\s+\*/\*\*/) { |
2362 | } | 2544 | } |
2363 | 2545 | ||
2364 | #print "from<$from> to<$to>\n"; | 2546 | ## print "1: from<$from> to<$to> ident<$ident>\n"; |
2365 | if ($from ne $to) { | 2547 | if ($from ne $to) { |
2366 | ERROR("POINTER_LOCATION", | 2548 | if (ERROR("POINTER_LOCATION", |
2367 | "\"(foo$from)\" should be \"(foo$to)\"\n" . $herecurr); | 2549 | "\"(foo$from)\" should be \"(foo$to)\"\n" . $herecurr) && |
2550 | $fix) { | ||
2551 | my $sub_from = $ident; | ||
2552 | my $sub_to = $ident; | ||
2553 | $sub_to =~ s/\Q$from\E/$to/; | ||
2554 | $fixed[$linenr - 1] =~ | ||
2555 | s@\Q$sub_from\E@$sub_to@; | ||
2556 | } | ||
2368 | } | 2557 | } |
2369 | } | 2558 | } |
2370 | while ($line =~ m{(\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident))}g) { | 2559 | while ($line =~ m{(\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident))}g) { |
2371 | #print "BB<$1>\n"; | 2560 | #print "BB<$1>\n"; |
2372 | my ($from, $to, $ident) = ($2, $2, $3); | 2561 | my ($match, $from, $to, $ident) = ($1, $2, $2, $3); |
2373 | 2562 | ||
2374 | # Should start with a space. | 2563 | # Should start with a space. |
2375 | $to =~ s/^(\S)/ $1/; | 2564 | $to =~ s/^(\S)/ $1/; |
@@ -2381,10 +2570,18 @@ sub process { | |||
2381 | # Modifiers should have spaces. | 2570 | # Modifiers should have spaces. |
2382 | $to =~ s/(\b$Modifier$)/$1 /; | 2571 | $to =~ s/(\b$Modifier$)/$1 /; |
2383 | 2572 | ||
2384 | #print "from<$from> to<$to> ident<$ident>\n"; | 2573 | ## print "2: from<$from> to<$to> ident<$ident>\n"; |
2385 | if ($from ne $to && $ident !~ /^$Modifier$/) { | 2574 | if ($from ne $to && $ident !~ /^$Modifier$/) { |
2386 | ERROR("POINTER_LOCATION", | 2575 | if (ERROR("POINTER_LOCATION", |
2387 | "\"foo${from}bar\" should be \"foo${to}bar\"\n" . $herecurr); | 2576 | "\"foo${from}bar\" should be \"foo${to}bar\"\n" . $herecurr) && |
2577 | $fix) { | ||
2578 | |||
2579 | my $sub_from = $match; | ||
2580 | my $sub_to = $match; | ||
2581 | $sub_to =~ s/\Q$from\E/$to/; | ||
2582 | $fixed[$linenr - 1] =~ | ||
2583 | s@\Q$sub_from\E@$sub_to@; | ||
2584 | } | ||
2388 | } | 2585 | } |
2389 | } | 2586 | } |
2390 | 2587 | ||
@@ -2470,9 +2667,13 @@ sub process { | |||
2470 | } | 2667 | } |
2471 | 2668 | ||
2472 | # missing space after union, struct or enum definition | 2669 | # missing space after union, struct or enum definition |
2473 | if ($line =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?(?:\s+$Ident)?[=\{]/) { | 2670 | if ($line =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident){1,2}[=\{]/) { |
2474 | WARN("SPACING", | 2671 | if (WARN("SPACING", |
2475 | "missing space after $1 definition\n" . $herecurr); | 2672 | "missing space after $1 definition\n" . $herecurr) && |
2673 | $fix) { | ||
2674 | $fixed[$linenr - 1] =~ | ||
2675 | s/^(.\s*(?:typedef\s+)?(?:enum|union|struct)(?:\s+$Ident){1,2})([=\{])/$1 $2/; | ||
2676 | } | ||
2476 | } | 2677 | } |
2477 | 2678 | ||
2478 | # check for spacing round square brackets; allowed: | 2679 | # check for spacing round square brackets; allowed: |
@@ -2484,8 +2685,12 @@ sub process { | |||
2484 | if ($prefix !~ /$Type\s+$/ && | 2685 | if ($prefix !~ /$Type\s+$/ && |
2485 | ($where != 0 || $prefix !~ /^.\s+$/) && | 2686 | ($where != 0 || $prefix !~ /^.\s+$/) && |
2486 | $prefix !~ /[{,]\s+$/) { | 2687 | $prefix !~ /[{,]\s+$/) { |
2487 | ERROR("BRACKET_SPACE", | 2688 | if (ERROR("BRACKET_SPACE", |
2488 | "space prohibited before open square bracket '['\n" . $herecurr); | 2689 | "space prohibited before open square bracket '['\n" . $herecurr) && |
2690 | $fix) { | ||
2691 | $fixed[$linenr - 1] =~ | ||
2692 | s/^(\+.*?)\s+\[/$1\[/; | ||
2693 | } | ||
2489 | } | 2694 | } |
2490 | } | 2695 | } |
2491 | 2696 | ||
@@ -2502,7 +2707,6 @@ sub process { | |||
2502 | __attribute__|format|__extension__| | 2707 | __attribute__|format|__extension__| |
2503 | asm|__asm__)$/x) | 2708 | asm|__asm__)$/x) |
2504 | { | 2709 | { |
2505 | |||
2506 | # cpp #define statements have non-optional spaces, ie | 2710 | # cpp #define statements have non-optional spaces, ie |
2507 | # if there is a space between the name and the open | 2711 | # if there is a space between the name and the open |
2508 | # parenthesis it is simply not a parameter group. | 2712 | # parenthesis it is simply not a parameter group. |
@@ -2516,19 +2720,20 @@ sub process { | |||
2516 | } elsif ($ctx =~ /$Type$/) { | 2720 | } elsif ($ctx =~ /$Type$/) { |
2517 | 2721 | ||
2518 | } else { | 2722 | } else { |
2519 | WARN("SPACING", | 2723 | if (WARN("SPACING", |
2520 | "space prohibited between function name and open parenthesis '('\n" . $herecurr); | 2724 | "space prohibited between function name and open parenthesis '('\n" . $herecurr) && |
2725 | $fix) { | ||
2726 | $fixed[$linenr - 1] =~ | ||
2727 | s/\b$name\s+\(/$name\(/; | ||
2728 | } | ||
2521 | } | 2729 | } |
2522 | } | 2730 | } |
2523 | 2731 | ||
2524 | # check for whitespace before a non-naked semicolon | ||
2525 | if ($line =~ /^\+.*\S\s+;/) { | ||
2526 | WARN("SPACING", | ||
2527 | "space prohibited before semicolon\n" . $herecurr); | ||
2528 | } | ||
2529 | |||
2530 | # Check operator spacing. | 2732 | # Check operator spacing. |
2531 | if (!($line=~/\#\s*include/)) { | 2733 | if (!($line=~/\#\s*include/)) { |
2734 | my $fixed_line = ""; | ||
2735 | my $line_fixed = 0; | ||
2736 | |||
2532 | my $ops = qr{ | 2737 | my $ops = qr{ |
2533 | <<=|>>=|<=|>=|==|!=| | 2738 | <<=|>>=|<=|>=|==|!=| |
2534 | \+=|-=|\*=|\/=|%=|\^=|\|=|&=| | 2739 | \+=|-=|\*=|\/=|%=|\^=|\|=|&=| |
@@ -2537,11 +2742,30 @@ sub process { | |||
2537 | \?|: | 2742 | \?|: |
2538 | }x; | 2743 | }x; |
2539 | my @elements = split(/($ops|;)/, $opline); | 2744 | my @elements = split(/($ops|;)/, $opline); |
2745 | |||
2746 | ## print("element count: <" . $#elements . ">\n"); | ||
2747 | ## foreach my $el (@elements) { | ||
2748 | ## print("el: <$el>\n"); | ||
2749 | ## } | ||
2750 | |||
2751 | my @fix_elements = (); | ||
2540 | my $off = 0; | 2752 | my $off = 0; |
2541 | 2753 | ||
2754 | foreach my $el (@elements) { | ||
2755 | push(@fix_elements, substr($rawline, $off, length($el))); | ||
2756 | $off += length($el); | ||
2757 | } | ||
2758 | |||
2759 | $off = 0; | ||
2760 | |||
2542 | my $blank = copy_spacing($opline); | 2761 | my $blank = copy_spacing($opline); |
2543 | 2762 | ||
2544 | for (my $n = 0; $n < $#elements; $n += 2) { | 2763 | for (my $n = 0; $n < $#elements; $n += 2) { |
2764 | |||
2765 | my $good = $fix_elements[$n] . $fix_elements[$n + 1]; | ||
2766 | |||
2767 | ## print("n: <$n> good: <$good>\n"); | ||
2768 | |||
2545 | $off += length($elements[$n]); | 2769 | $off += length($elements[$n]); |
2546 | 2770 | ||
2547 | # Pick up the preceding and succeeding characters. | 2771 | # Pick up the preceding and succeeding characters. |
@@ -2598,8 +2822,11 @@ sub process { | |||
2598 | } elsif ($op eq ';') { | 2822 | } elsif ($op eq ';') { |
2599 | if ($ctx !~ /.x[WEBC]/ && | 2823 | if ($ctx !~ /.x[WEBC]/ && |
2600 | $cc !~ /^\\/ && $cc !~ /^;/) { | 2824 | $cc !~ /^\\/ && $cc !~ /^;/) { |
2601 | ERROR("SPACING", | 2825 | if (ERROR("SPACING", |
2602 | "space required after that '$op' $at\n" . $hereptr); | 2826 | "space required after that '$op' $at\n" . $hereptr)) { |
2827 | $good = trim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " "; | ||
2828 | $line_fixed = 1; | ||
2829 | } | ||
2603 | } | 2830 | } |
2604 | 2831 | ||
2605 | # // is a comment | 2832 | # // is a comment |
@@ -2610,15 +2837,24 @@ sub process { | |||
2610 | # : when part of a bitfield | 2837 | # : when part of a bitfield |
2611 | } elsif ($op eq '->' || $opv eq ':B') { | 2838 | } elsif ($op eq '->' || $opv eq ':B') { |
2612 | if ($ctx =~ /Wx.|.xW/) { | 2839 | if ($ctx =~ /Wx.|.xW/) { |
2613 | ERROR("SPACING", | 2840 | if (ERROR("SPACING", |
2614 | "spaces prohibited around that '$op' $at\n" . $hereptr); | 2841 | "spaces prohibited around that '$op' $at\n" . $hereptr)) { |
2842 | $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]); | ||
2843 | $line_fixed = 1; | ||
2844 | if (defined $fix_elements[$n + 2]) { | ||
2845 | $fix_elements[$n + 2] =~ s/^\s+//; | ||
2846 | } | ||
2847 | } | ||
2615 | } | 2848 | } |
2616 | 2849 | ||
2617 | # , must have a space on the right. | 2850 | # , must have a space on the right. |
2618 | } elsif ($op eq ',') { | 2851 | } elsif ($op eq ',') { |
2619 | if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) { | 2852 | if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) { |
2620 | ERROR("SPACING", | 2853 | if (ERROR("SPACING", |
2621 | "space required after that '$op' $at\n" . $hereptr); | 2854 | "space required after that '$op' $at\n" . $hereptr)) { |
2855 | $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]) . " "; | ||
2856 | $line_fixed = 1; | ||
2857 | } | ||
2622 | } | 2858 | } |
2623 | 2859 | ||
2624 | # '*' as part of a type definition -- reported already. | 2860 | # '*' as part of a type definition -- reported already. |
@@ -2632,34 +2868,58 @@ sub process { | |||
2632 | $opv eq '*U' || $opv eq '-U' || | 2868 | $opv eq '*U' || $opv eq '-U' || |
2633 | $opv eq '&U' || $opv eq '&&U') { | 2869 | $opv eq '&U' || $opv eq '&&U') { |
2634 | if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) { | 2870 | if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) { |
2635 | ERROR("SPACING", | 2871 | if (ERROR("SPACING", |
2636 | "space required before that '$op' $at\n" . $hereptr); | 2872 | "space required before that '$op' $at\n" . $hereptr)) { |
2873 | $good = trim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]); | ||
2874 | $line_fixed = 1; | ||
2875 | } | ||
2637 | } | 2876 | } |
2638 | if ($op eq '*' && $cc =~/\s*$Modifier\b/) { | 2877 | if ($op eq '*' && $cc =~/\s*$Modifier\b/) { |
2639 | # A unary '*' may be const | 2878 | # A unary '*' may be const |
2640 | 2879 | ||
2641 | } elsif ($ctx =~ /.xW/) { | 2880 | } elsif ($ctx =~ /.xW/) { |
2642 | ERROR("SPACING", | 2881 | if (ERROR("SPACING", |
2643 | "space prohibited after that '$op' $at\n" . $hereptr); | 2882 | "space prohibited after that '$op' $at\n" . $hereptr)) { |
2883 | $fixed_line =~ s/\s+$//; | ||
2884 | $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]); | ||
2885 | $line_fixed = 1; | ||
2886 | if (defined $fix_elements[$n + 2]) { | ||
2887 | $fix_elements[$n + 2] =~ s/^\s+//; | ||
2888 | } | ||
2889 | } | ||
2644 | } | 2890 | } |
2645 | 2891 | ||
2646 | # unary ++ and unary -- are allowed no space on one side. | 2892 | # unary ++ and unary -- are allowed no space on one side. |
2647 | } elsif ($op eq '++' or $op eq '--') { | 2893 | } elsif ($op eq '++' or $op eq '--') { |
2648 | if ($ctx !~ /[WEOBC]x[^W]/ && $ctx !~ /[^W]x[WOBEC]/) { | 2894 | if ($ctx !~ /[WEOBC]x[^W]/ && $ctx !~ /[^W]x[WOBEC]/) { |
2649 | ERROR("SPACING", | 2895 | if (ERROR("SPACING", |
2650 | "space required one side of that '$op' $at\n" . $hereptr); | 2896 | "space required one side of that '$op' $at\n" . $hereptr)) { |
2897 | $fixed_line =~ s/\s+$//; | ||
2898 | $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]) . " "; | ||
2899 | $line_fixed = 1; | ||
2900 | } | ||
2651 | } | 2901 | } |
2652 | if ($ctx =~ /Wx[BE]/ || | 2902 | if ($ctx =~ /Wx[BE]/ || |
2653 | ($ctx =~ /Wx./ && $cc =~ /^;/)) { | 2903 | ($ctx =~ /Wx./ && $cc =~ /^;/)) { |
2654 | ERROR("SPACING", | 2904 | if (ERROR("SPACING", |
2655 | "space prohibited before that '$op' $at\n" . $hereptr); | 2905 | "space prohibited before that '$op' $at\n" . $hereptr)) { |
2906 | $fixed_line =~ s/\s+$//; | ||
2907 | $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]); | ||
2908 | $line_fixed = 1; | ||
2909 | } | ||
2656 | } | 2910 | } |
2657 | if ($ctx =~ /ExW/) { | 2911 | if ($ctx =~ /ExW/) { |
2658 | ERROR("SPACING", | 2912 | if (ERROR("SPACING", |
2659 | "space prohibited after that '$op' $at\n" . $hereptr); | 2913 | "space prohibited after that '$op' $at\n" . $hereptr)) { |
2914 | $fixed_line =~ s/\s+$//; | ||
2915 | $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]); | ||
2916 | $line_fixed = 1; | ||
2917 | if (defined $fix_elements[$n + 2]) { | ||
2918 | $fix_elements[$n + 2] =~ s/^\s+//; | ||
2919 | } | ||
2920 | } | ||
2660 | } | 2921 | } |
2661 | 2922 | ||
2662 | |||
2663 | # << and >> may either have or not have spaces both sides | 2923 | # << and >> may either have or not have spaces both sides |
2664 | } elsif ($op eq '<<' or $op eq '>>' or | 2924 | } elsif ($op eq '<<' or $op eq '>>' or |
2665 | $op eq '&' or $op eq '^' or $op eq '|' or | 2925 | $op eq '&' or $op eq '^' or $op eq '|' or |
@@ -2668,17 +2928,23 @@ sub process { | |||
2668 | $op eq '%') | 2928 | $op eq '%') |
2669 | { | 2929 | { |
2670 | if ($ctx =~ /Wx[^WCE]|[^WCE]xW/) { | 2930 | if ($ctx =~ /Wx[^WCE]|[^WCE]xW/) { |
2671 | ERROR("SPACING", | 2931 | if (ERROR("SPACING", |
2672 | "need consistent spacing around '$op' $at\n" . | 2932 | "need consistent spacing around '$op' $at\n" . $hereptr)) { |
2673 | $hereptr); | 2933 | $fixed_line =~ s/\s+$//; |
2934 | $good = trim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " "; | ||
2935 | $line_fixed = 1; | ||
2936 | } | ||
2674 | } | 2937 | } |
2675 | 2938 | ||
2676 | # A colon needs no spaces before when it is | 2939 | # A colon needs no spaces before when it is |
2677 | # terminating a case value or a label. | 2940 | # terminating a case value or a label. |
2678 | } elsif ($opv eq ':C' || $opv eq ':L') { | 2941 | } elsif ($opv eq ':C' || $opv eq ':L') { |
2679 | if ($ctx =~ /Wx./) { | 2942 | if ($ctx =~ /Wx./) { |
2680 | ERROR("SPACING", | 2943 | if (ERROR("SPACING", |
2681 | "space prohibited before that '$op' $at\n" . $hereptr); | 2944 | "space prohibited before that '$op' $at\n" . $hereptr)) { |
2945 | $good = trim($fix_elements[$n]) . trim($fix_elements[$n + 1]); | ||
2946 | $line_fixed = 1; | ||
2947 | } | ||
2682 | } | 2948 | } |
2683 | 2949 | ||
2684 | # All the others need spaces both sides. | 2950 | # All the others need spaces both sides. |
@@ -2701,11 +2967,39 @@ sub process { | |||
2701 | } | 2967 | } |
2702 | 2968 | ||
2703 | if ($ok == 0) { | 2969 | if ($ok == 0) { |
2704 | ERROR("SPACING", | 2970 | if (ERROR("SPACING", |
2705 | "spaces required around that '$op' $at\n" . $hereptr); | 2971 | "spaces required around that '$op' $at\n" . $hereptr)) { |
2972 | $good = trim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " "; | ||
2973 | $good = $fix_elements[$n] . " " . trim($fix_elements[$n + 1]) . " "; | ||
2974 | $line_fixed = 1; | ||
2975 | } | ||
2706 | } | 2976 | } |
2707 | } | 2977 | } |
2708 | $off += length($elements[$n + 1]); | 2978 | $off += length($elements[$n + 1]); |
2979 | |||
2980 | ## print("n: <$n> GOOD: <$good>\n"); | ||
2981 | |||
2982 | $fixed_line = $fixed_line . $good; | ||
2983 | } | ||
2984 | |||
2985 | if (($#elements % 2) == 0) { | ||
2986 | $fixed_line = $fixed_line . $fix_elements[$#elements]; | ||
2987 | } | ||
2988 | |||
2989 | if ($fix && $line_fixed && $fixed_line ne $fixed[$linenr - 1]) { | ||
2990 | $fixed[$linenr - 1] = $fixed_line; | ||
2991 | } | ||
2992 | |||
2993 | |||
2994 | } | ||
2995 | |||
2996 | # check for whitespace before a non-naked semicolon | ||
2997 | if ($line =~ /^\+.*\S\s+;/) { | ||
2998 | if (WARN("SPACING", | ||
2999 | "space prohibited before semicolon\n" . $herecurr) && | ||
3000 | $fix) { | ||
3001 | 1 while $fixed[$linenr - 1] =~ | ||
3002 | s/^(\+.*\S)\s+;/$1;/; | ||
2709 | } | 3003 | } |
2710 | } | 3004 | } |
2711 | 3005 | ||
@@ -2734,10 +3028,22 @@ sub process { | |||
2734 | #need space before brace following if, while, etc | 3028 | #need space before brace following if, while, etc |
2735 | if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) || | 3029 | if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) || |
2736 | $line =~ /do{/) { | 3030 | $line =~ /do{/) { |
2737 | ERROR("SPACING", | 3031 | if (ERROR("SPACING", |
2738 | "space required before the open brace '{'\n" . $herecurr); | 3032 | "space required before the open brace '{'\n" . $herecurr) && |
3033 | $fix) { | ||
3034 | $fixed[$linenr - 1] =~ | ||
3035 | s/^(\+.*(?:do|\))){/$1 {/; | ||
3036 | } | ||
2739 | } | 3037 | } |
2740 | 3038 | ||
3039 | ## # check for blank lines before declarations | ||
3040 | ## if ($line =~ /^.\t+$Type\s+$Ident(?:\s*=.*)?;/ && | ||
3041 | ## $prevrawline =~ /^.\s*$/) { | ||
3042 | ## WARN("SPACING", | ||
3043 | ## "No blank lines before declarations\n" . $hereprev); | ||
3044 | ## } | ||
3045 | ## | ||
3046 | |||
2741 | # closing brace should have a space following it when it has anything | 3047 | # closing brace should have a space following it when it has anything |
2742 | # on the line | 3048 | # on the line |
2743 | if ($line =~ /}(?!(?:,|;|\)))\S/) { | 3049 | if ($line =~ /}(?!(?:,|;|\)))\S/) { |
@@ -2747,32 +3053,52 @@ sub process { | |||
2747 | 3053 | ||
2748 | # check spacing on square brackets | 3054 | # check spacing on square brackets |
2749 | if ($line =~ /\[\s/ && $line !~ /\[\s*$/) { | 3055 | if ($line =~ /\[\s/ && $line !~ /\[\s*$/) { |
2750 | ERROR("SPACING", | 3056 | if (ERROR("SPACING", |
2751 | "space prohibited after that open square bracket '['\n" . $herecurr); | 3057 | "space prohibited after that open square bracket '['\n" . $herecurr) && |
3058 | $fix) { | ||
3059 | $fixed[$linenr - 1] =~ | ||
3060 | s/\[\s+/\[/; | ||
3061 | } | ||
2752 | } | 3062 | } |
2753 | if ($line =~ /\s\]/) { | 3063 | if ($line =~ /\s\]/) { |
2754 | ERROR("SPACING", | 3064 | if (ERROR("SPACING", |
2755 | "space prohibited before that close square bracket ']'\n" . $herecurr); | 3065 | "space prohibited before that close square bracket ']'\n" . $herecurr) && |
3066 | $fix) { | ||
3067 | $fixed[$linenr - 1] =~ | ||
3068 | s/\s+\]/\]/; | ||
3069 | } | ||
2756 | } | 3070 | } |
2757 | 3071 | ||
2758 | # check spacing on parentheses | 3072 | # check spacing on parentheses |
2759 | if ($line =~ /\(\s/ && $line !~ /\(\s*(?:\\)?$/ && | 3073 | if ($line =~ /\(\s/ && $line !~ /\(\s*(?:\\)?$/ && |
2760 | $line !~ /for\s*\(\s+;/) { | 3074 | $line !~ /for\s*\(\s+;/) { |
2761 | ERROR("SPACING", | 3075 | if (ERROR("SPACING", |
2762 | "space prohibited after that open parenthesis '('\n" . $herecurr); | 3076 | "space prohibited after that open parenthesis '('\n" . $herecurr) && |
3077 | $fix) { | ||
3078 | $fixed[$linenr - 1] =~ | ||
3079 | s/\(\s+/\(/; | ||
3080 | } | ||
2763 | } | 3081 | } |
2764 | if ($line =~ /(\s+)\)/ && $line !~ /^.\s*\)/ && | 3082 | if ($line =~ /(\s+)\)/ && $line !~ /^.\s*\)/ && |
2765 | $line !~ /for\s*\(.*;\s+\)/ && | 3083 | $line !~ /for\s*\(.*;\s+\)/ && |
2766 | $line !~ /:\s+\)/) { | 3084 | $line !~ /:\s+\)/) { |
2767 | ERROR("SPACING", | 3085 | if (ERROR("SPACING", |
2768 | "space prohibited before that close parenthesis ')'\n" . $herecurr); | 3086 | "space prohibited before that close parenthesis ')'\n" . $herecurr) && |
3087 | $fix) { | ||
3088 | $fixed[$linenr - 1] =~ | ||
3089 | s/\s+\)/\)/; | ||
3090 | } | ||
2769 | } | 3091 | } |
2770 | 3092 | ||
2771 | #goto labels aren't indented, allow a single space however | 3093 | #goto labels aren't indented, allow a single space however |
2772 | if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and | 3094 | if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and |
2773 | !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) { | 3095 | !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) { |
2774 | WARN("INDENTED_LABEL", | 3096 | if (WARN("INDENTED_LABEL", |
2775 | "labels should not be indented\n" . $herecurr); | 3097 | "labels should not be indented\n" . $herecurr) && |
3098 | $fix) { | ||
3099 | $fixed[$linenr - 1] =~ | ||
3100 | s/^(.)\s+/$1/; | ||
3101 | } | ||
2776 | } | 3102 | } |
2777 | 3103 | ||
2778 | # Return is not a function. | 3104 | # Return is not a function. |
@@ -2809,8 +3135,13 @@ sub process { | |||
2809 | } | 3135 | } |
2810 | 3136 | ||
2811 | # Need a space before open parenthesis after if, while etc | 3137 | # Need a space before open parenthesis after if, while etc |
2812 | if ($line=~/\b(if|while|for|switch)\(/) { | 3138 | if ($line =~ /\b(if|while|for|switch)\(/) { |
2813 | ERROR("SPACING", "space required before the open parenthesis '('\n" . $herecurr); | 3139 | if (ERROR("SPACING", |
3140 | "space required before the open parenthesis '('\n" . $herecurr) && | ||
3141 | $fix) { | ||
3142 | $fixed[$linenr - 1] =~ | ||
3143 | s/\b(if|while|for|switch)\(/$1 \(/; | ||
3144 | } | ||
2814 | } | 3145 | } |
2815 | 3146 | ||
2816 | # Check for illegal assignment in if conditional -- and check for trailing | 3147 | # Check for illegal assignment in if conditional -- and check for trailing |
@@ -2934,16 +3265,29 @@ sub process { | |||
2934 | } | 3265 | } |
2935 | } | 3266 | } |
2936 | 3267 | ||
2937 | #CamelCase | 3268 | #Specific variable tests |
2938 | while ($line =~ m{($Constant|$Lval)}g) { | 3269 | while ($line =~ m{($Constant|$Lval)}g) { |
2939 | my $var = $1; | 3270 | my $var = $1; |
2940 | if ($var !~ /$Constant/ && | 3271 | |
2941 | $var =~ /[A-Z]\w*[a-z]|[a-z]\w*[A-Z]/ && | 3272 | #gcc binary extension |
2942 | $var !~ /"^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ && | 3273 | if ($var =~ /^$Binary$/) { |
2943 | !defined $camelcase{$var}) { | 3274 | WARN("GCC_BINARY_CONSTANT", |
2944 | $camelcase{$var} = 1; | 3275 | "Avoid gcc v4.3+ binary constant extension: <$var>\n" . $herecurr); |
2945 | WARN("CAMELCASE", | 3276 | } |
2946 | "Avoid CamelCase: <$var>\n" . $herecurr); | 3277 | |
3278 | #CamelCase | ||
3279 | if ($var !~ /^$Constant$/ && | ||
3280 | $var =~ /[A-Z][a-z]|[a-z][A-Z]/ && | ||
3281 | #Ignore Page<foo> variants | ||
3282 | $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ && | ||
3283 | #Ignore SI style variants like nS, mV and dB (ie: max_uV, regulator_min_uA_show) | ||
3284 | $var !~ /^(?:[a-z_]*?)_?[a-z][A-Z](?:_[a-z_]+)?$/) { | ||
3285 | seed_camelcase_includes() if ($check); | ||
3286 | if (!defined $camelcase{$var}) { | ||
3287 | $camelcase{$var} = 1; | ||
3288 | CHK("CAMELCASE", | ||
3289 | "Avoid CamelCase: <$var>\n" . $herecurr); | ||
3290 | } | ||
2947 | } | 3291 | } |
2948 | } | 3292 | } |
2949 | 3293 | ||
@@ -3021,7 +3365,7 @@ sub process { | |||
3021 | if ($dstat ne '' && | 3365 | if ($dstat ne '' && |
3022 | $dstat !~ /^(?:$Ident|-?$Constant),$/ && # 10, // foo(), | 3366 | $dstat !~ /^(?:$Ident|-?$Constant),$/ && # 10, // foo(), |
3023 | $dstat !~ /^(?:$Ident|-?$Constant);$/ && # foo(); | 3367 | $dstat !~ /^(?:$Ident|-?$Constant);$/ && # foo(); |
3024 | $dstat !~ /^[!~-]?(?:$Ident|$Constant)$/ && # 10 // foo() // !foo // ~foo // -foo | 3368 | $dstat !~ /^[!~-]?(?:$Lval|$Constant)$/ && # 10 // foo() // !foo // ~foo // -foo // foo->bar // foo.bar->baz |
3025 | $dstat !~ /^'X'$/ && # character constants | 3369 | $dstat !~ /^'X'$/ && # character constants |
3026 | $dstat !~ /$exceptions/ && | 3370 | $dstat !~ /$exceptions/ && |
3027 | $dstat !~ /^\.$Ident\s*=/ && # .foo = | 3371 | $dstat !~ /^\.$Ident\s*=/ && # .foo = |
@@ -3230,11 +3574,11 @@ sub process { | |||
3230 | } | 3574 | } |
3231 | 3575 | ||
3232 | # check for unnecessary blank lines around braces | 3576 | # check for unnecessary blank lines around braces |
3233 | if (($line =~ /^.\s*}\s*$/ && $prevline =~ /^.\s*$/)) { | 3577 | if (($line =~ /^.\s*}\s*$/ && $prevrawline =~ /^.\s*$/)) { |
3234 | CHK("BRACES", | 3578 | CHK("BRACES", |
3235 | "Blank lines aren't necessary before a close brace '}'\n" . $hereprev); | 3579 | "Blank lines aren't necessary before a close brace '}'\n" . $hereprev); |
3236 | } | 3580 | } |
3237 | if (($line =~ /^.\s*$/ && $prevline =~ /^..*{\s*$/)) { | 3581 | if (($rawline =~ /^.\s*$/ && $prevline =~ /^..*{\s*$/)) { |
3238 | CHK("BRACES", | 3582 | CHK("BRACES", |
3239 | "Blank lines aren't necessary after an open brace '{'\n" . $hereprev); | 3583 | "Blank lines aren't necessary after an open brace '{'\n" . $hereprev); |
3240 | } | 3584 | } |
@@ -3279,6 +3623,18 @@ sub process { | |||
3279 | } | 3623 | } |
3280 | } | 3624 | } |
3281 | 3625 | ||
3626 | # check for comparisons of jiffies | ||
3627 | if ($line =~ /\bjiffies\s*$Compare|$Compare\s*jiffies\b/) { | ||
3628 | WARN("JIFFIES_COMPARISON", | ||
3629 | "Comparing jiffies is almost always wrong; prefer time_after, time_before and friends\n" . $herecurr); | ||
3630 | } | ||
3631 | |||
3632 | # check for comparisons of get_jiffies_64() | ||
3633 | if ($line =~ /\bget_jiffies_64\s*\(\s*\)\s*$Compare|$Compare\s*get_jiffies_64\s*\(\s*\)/) { | ||
3634 | WARN("JIFFIES_COMPARISON", | ||
3635 | "Comparing get_jiffies_64() is almost always wrong; prefer time_after64, time_before64 and friends\n" . $herecurr); | ||
3636 | } | ||
3637 | |||
3282 | # warn about #ifdefs in C files | 3638 | # warn about #ifdefs in C files |
3283 | # if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) { | 3639 | # if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) { |
3284 | # print "#ifdef in C files should be avoided\n"; | 3640 | # print "#ifdef in C files should be avoided\n"; |
@@ -3288,8 +3644,13 @@ sub process { | |||
3288 | 3644 | ||
3289 | # warn about spacing in #ifdefs | 3645 | # warn about spacing in #ifdefs |
3290 | if ($line =~ /^.\s*\#\s*(ifdef|ifndef|elif)\s\s+/) { | 3646 | if ($line =~ /^.\s*\#\s*(ifdef|ifndef|elif)\s\s+/) { |
3291 | ERROR("SPACING", | 3647 | if (ERROR("SPACING", |
3292 | "exactly one space required after that #$1\n" . $herecurr); | 3648 | "exactly one space required after that #$1\n" . $herecurr) && |
3649 | $fix) { | ||
3650 | $fixed[$linenr - 1] =~ | ||
3651 | s/^(.\s*\#\s*(ifdef|ifndef|elif))\s{2,}/$1 /; | ||
3652 | } | ||
3653 | |||
3293 | } | 3654 | } |
3294 | 3655 | ||
3295 | # check for spinlock_t definitions without a comment. | 3656 | # check for spinlock_t definitions without a comment. |
@@ -3495,6 +3856,14 @@ sub process { | |||
3495 | "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); | 3856 | "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); |
3496 | } | 3857 | } |
3497 | 3858 | ||
3859 | # alloc style | ||
3860 | # p = alloc(sizeof(struct foo), ...) should be p = alloc(sizeof(*p), ...) | ||
3861 | if ($^V && $^V ge 5.10.0 && | ||
3862 | $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*([kv][mz]alloc(?:_node)?)\s*\(\s*(sizeof\s*\(\s*struct\s+$Lval\s*\))/) { | ||
3863 | CHK("ALLOC_SIZEOF_STRUCT", | ||
3864 | "Prefer $3(sizeof(*$1)...) over $3($4...)\n" . $herecurr); | ||
3865 | } | ||
3866 | |||
3498 | # check for krealloc arg reuse | 3867 | # check for krealloc arg reuse |
3499 | if ($^V && $^V ge 5.10.0 && | 3868 | if ($^V && $^V ge 5.10.0 && |
3500 | $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*\1\s*,/) { | 3869 | $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*\1\s*,/) { |
@@ -3540,6 +3909,33 @@ sub process { | |||
3540 | "Using yield() is generally wrong. See yield() kernel-doc (sched/core.c)\n" . $herecurr); | 3909 | "Using yield() is generally wrong. See yield() kernel-doc (sched/core.c)\n" . $herecurr); |
3541 | } | 3910 | } |
3542 | 3911 | ||
3912 | # check for comparisons against true and false | ||
3913 | if ($line =~ /\+\s*(.*?)\b(true|false|$Lval)\s*(==|\!=)\s*(true|false|$Lval)\b(.*)$/i) { | ||
3914 | my $lead = $1; | ||
3915 | my $arg = $2; | ||
3916 | my $test = $3; | ||
3917 | my $otype = $4; | ||
3918 | my $trail = $5; | ||
3919 | my $op = "!"; | ||
3920 | |||
3921 | ($arg, $otype) = ($otype, $arg) if ($arg =~ /^(?:true|false)$/i); | ||
3922 | |||
3923 | my $type = lc($otype); | ||
3924 | if ($type =~ /^(?:true|false)$/) { | ||
3925 | if (("$test" eq "==" && "$type" eq "true") || | ||
3926 | ("$test" eq "!=" && "$type" eq "false")) { | ||
3927 | $op = ""; | ||
3928 | } | ||
3929 | |||
3930 | CHK("BOOL_COMPARISON", | ||
3931 | "Using comparison to $otype is error prone\n" . $herecurr); | ||
3932 | |||
3933 | ## maybe suggesting a correct construct would better | ||
3934 | ## "Using comparison to $otype is error prone. Perhaps use '${lead}${op}${arg}${trail}'\n" . $herecurr); | ||
3935 | |||
3936 | } | ||
3937 | } | ||
3938 | |||
3543 | # check for semaphores initialized locked | 3939 | # check for semaphores initialized locked |
3544 | if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { | 3940 | if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { |
3545 | WARN("CONSIDER_COMPLETION", | 3941 | WARN("CONSIDER_COMPLETION", |
@@ -3717,6 +4113,40 @@ sub process { | |||
3717 | print "\n\n"; | 4113 | print "\n\n"; |
3718 | } | 4114 | } |
3719 | 4115 | ||
4116 | if ($clean == 0 && $fix && "@rawlines" ne "@fixed") { | ||
4117 | my $newfile = $filename . ".EXPERIMENTAL-checkpatch-fixes"; | ||
4118 | my $linecount = 0; | ||
4119 | my $f; | ||
4120 | |||
4121 | open($f, '>', $newfile) | ||
4122 | or die "$P: Can't open $newfile for write\n"; | ||
4123 | foreach my $fixed_line (@fixed) { | ||
4124 | $linecount++; | ||
4125 | if ($file) { | ||
4126 | if ($linecount > 3) { | ||
4127 | $fixed_line =~ s/^\+//; | ||
4128 | print $f $fixed_line. "\n"; | ||
4129 | } | ||
4130 | } else { | ||
4131 | print $f $fixed_line . "\n"; | ||
4132 | } | ||
4133 | } | ||
4134 | close($f); | ||
4135 | |||
4136 | if (!$quiet) { | ||
4137 | print << "EOM"; | ||
4138 | Wrote EXPERIMENTAL --fix correction(s) to '$newfile' | ||
4139 | |||
4140 | Do _NOT_ trust the results written to this file. | ||
4141 | Do _NOT_ submit these changes without inspecting them for correctness. | ||
4142 | |||
4143 | This EXPERIMENTAL file is simply a convenience to help rewrite patches. | ||
4144 | No warranties, expressed or implied... | ||
4145 | |||
4146 | EOM | ||
4147 | } | ||
4148 | } | ||
4149 | |||
3720 | if ($clean == 1 && $quiet == 0) { | 4150 | if ($clean == 1 && $quiet == 0) { |
3721 | print "$vname has no obvious style problems and is ready for submission.\n" | 4151 | print "$vname has no obvious style problems and is ready for submission.\n" |
3722 | } | 4152 | } |
diff --git a/scripts/config b/scripts/config index bb4d3deb6d1c..a65ecbbdd32a 100755 --- a/scripts/config +++ b/scripts/config | |||
@@ -105,7 +105,7 @@ while [ "$1" != "" ] ; do | |||
105 | ;; | 105 | ;; |
106 | --refresh) | 106 | --refresh) |
107 | ;; | 107 | ;; |
108 | --*-after) | 108 | --*-after|-E|-D|-M) |
109 | checkarg "$1" | 109 | checkarg "$1" |
110 | A=$ARG | 110 | A=$ARG |
111 | checkarg "$2" | 111 | checkarg "$2" |
diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l index 254d5af88956..3b41bfca636c 100644 --- a/scripts/dtc/dtc-lexer.l +++ b/scripts/dtc/dtc-lexer.l | |||
@@ -71,7 +71,7 @@ static int pop_input_file(void); | |||
71 | push_input_file(name); | 71 | push_input_file(name); |
72 | } | 72 | } |
73 | 73 | ||
74 | <*>^"#"(line)?{WS}+[0-9]+{WS}+{STRING}({WS}+[0-9]+)? { | 74 | <*>^"#"(line)?[ \t]+[0-9]+[ \t]+{STRING}([ \t]+[0-9]+)? { |
75 | char *line, *tmp, *fn; | 75 | char *line, *tmp, *fn; |
76 | /* skip text before line # */ | 76 | /* skip text before line # */ |
77 | line = yytext; | 77 | line = yytext; |
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped index a6c5fcdfc032..2d30f41778b7 100644 --- a/scripts/dtc/dtc-lexer.lex.c_shipped +++ b/scripts/dtc/dtc-lexer.lex.c_shipped | |||
@@ -405,19 +405,19 @@ static yyconst flex_int16_t yy_accept[161] = | |||
405 | static yyconst flex_int32_t yy_ec[256] = | 405 | static yyconst flex_int32_t yy_ec[256] = |
406 | { 0, | 406 | { 0, |
407 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, | 407 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
408 | 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, | 408 | 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, |
409 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 409 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
410 | 1, 2, 4, 5, 6, 1, 1, 7, 8, 1, | 410 | 1, 2, 5, 6, 7, 1, 1, 8, 9, 1, |
411 | 1, 9, 10, 10, 11, 10, 12, 13, 14, 15, | 411 | 1, 10, 11, 11, 12, 11, 13, 14, 15, 16, |
412 | 15, 15, 15, 15, 15, 15, 15, 16, 1, 17, | 412 | 16, 16, 16, 16, 16, 16, 16, 17, 1, 18, |
413 | 18, 19, 10, 10, 20, 20, 20, 20, 20, 20, | 413 | 19, 20, 11, 11, 21, 21, 21, 21, 21, 21, |
414 | 21, 21, 21, 21, 21, 22, 21, 21, 21, 21, | 414 | 22, 22, 22, 22, 22, 23, 22, 22, 22, 22, |
415 | 21, 21, 21, 21, 23, 21, 21, 24, 21, 21, | 415 | 22, 22, 22, 22, 24, 22, 22, 25, 22, 22, |
416 | 1, 25, 26, 1, 21, 1, 20, 27, 28, 29, | 416 | 1, 26, 27, 1, 22, 1, 21, 28, 29, 30, |
417 | 417 | ||
418 | 30, 20, 21, 21, 31, 21, 21, 32, 33, 34, | 418 | 31, 21, 22, 22, 32, 22, 22, 33, 34, 35, |
419 | 35, 36, 21, 37, 38, 39, 40, 41, 21, 24, | 419 | 36, 37, 22, 38, 39, 40, 41, 42, 22, 25, |
420 | 42, 21, 43, 44, 45, 1, 1, 1, 1, 1, | 420 | 43, 22, 44, 45, 46, 1, 1, 1, 1, 1, |
421 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 421 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
422 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 422 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
423 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 423 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
@@ -434,36 +434,36 @@ static yyconst flex_int32_t yy_ec[256] = | |||
434 | 1, 1, 1, 1, 1 | 434 | 1, 1, 1, 1, 1 |
435 | } ; | 435 | } ; |
436 | 436 | ||
437 | static yyconst flex_int32_t yy_meta[46] = | 437 | static yyconst flex_int32_t yy_meta[47] = |
438 | { 0, | 438 | { 0, |
439 | 1, 1, 1, 1, 1, 2, 3, 1, 2, 2, | 439 | 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, |
440 | 2, 4, 5, 5, 5, 6, 1, 1, 1, 7, | 440 | 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, |
441 | 8, 8, 8, 8, 1, 1, 7, 7, 7, 7, | 441 | 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, |
442 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | 442 | 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, |
443 | 8, 8, 3, 1, 1 | 443 | 8, 8, 8, 3, 1, 1 |
444 | } ; | 444 | } ; |
445 | 445 | ||
446 | static yyconst flex_int16_t yy_base[175] = | 446 | static yyconst flex_int16_t yy_base[175] = |
447 | { 0, | 447 | { 0, |
448 | 0, 388, 381, 40, 41, 386, 71, 385, 34, 44, | 448 | 0, 385, 378, 40, 41, 383, 72, 382, 34, 44, |
449 | 390, 395, 60, 62, 371, 112, 111, 111, 111, 104, | 449 | 388, 393, 61, 117, 368, 116, 115, 115, 115, 48, |
450 | 370, 106, 371, 342, 124, 119, 0, 144, 395, 0, | 450 | 367, 107, 368, 339, 127, 120, 0, 147, 393, 0, |
451 | 123, 0, 159, 153, 165, 167, 395, 130, 395, 382, | 451 | 127, 0, 133, 156, 168, 153, 393, 125, 393, 380, |
452 | 395, 0, 372, 122, 395, 157, 374, 379, 350, 21, | 452 | 393, 0, 369, 127, 393, 160, 371, 377, 347, 21, |
453 | 346, 349, 395, 395, 395, 395, 395, 362, 395, 395, | 453 | 343, 346, 393, 393, 393, 393, 393, 359, 393, 393, |
454 | 181, 346, 342, 395, 359, 0, 191, 343, 190, 351, | 454 | 183, 343, 339, 393, 356, 0, 183, 340, 187, 348, |
455 | 350, 0, 0, 0, 173, 362, 177, 367, 357, 329, | 455 | 347, 0, 0, 0, 178, 359, 195, 365, 354, 326, |
456 | 335, 328, 337, 331, 206, 329, 334, 327, 395, 338, | 456 | 332, 325, 334, 328, 204, 326, 331, 324, 393, 335, |
457 | 170, 314, 346, 345, 318, 325, 343, 158, 316, 212, | 457 | 150, 311, 343, 342, 315, 322, 340, 179, 313, 207, |
458 | 458 | ||
459 | 322, 319, 320, 395, 340, 336, 308, 305, 314, 304, | 459 | 319, 316, 317, 393, 337, 333, 305, 302, 311, 301, |
460 | 295, 138, 208, 220, 395, 292, 305, 265, 264, 254, | 460 | 310, 190, 338, 337, 393, 307, 322, 301, 305, 277, |
461 | 201, 222, 285, 275, 273, 270, 236, 235, 225, 115, | 461 | 208, 311, 307, 278, 271, 270, 248, 246, 213, 130, |
462 | 395, 395, 252, 216, 216, 217, 214, 230, 209, 220, | 462 | 393, 393, 263, 235, 207, 221, 218, 229, 213, 213, |
463 | 213, 239, 211, 217, 216, 209, 229, 395, 240, 225, | 463 | 206, 234, 218, 210, 208, 193, 219, 393, 223, 204, |
464 | 206, 169, 395, 395, 116, 106, 99, 54, 395, 395, | 464 | 176, 157, 393, 393, 120, 106, 97, 119, 393, 393, |
465 | 254, 260, 268, 272, 276, 282, 289, 293, 301, 309, | 465 | 245, 251, 259, 263, 267, 273, 280, 284, 292, 300, |
466 | 313, 319, 327, 335 | 466 | 304, 310, 318, 326 |
467 | } ; | 467 | } ; |
468 | 468 | ||
469 | static yyconst flex_int16_t yy_def[175] = | 469 | static yyconst flex_int16_t yy_def[175] = |
@@ -489,108 +489,108 @@ static yyconst flex_int16_t yy_def[175] = | |||
489 | 160, 160, 160, 160 | 489 | 160, 160, 160, 160 |
490 | } ; | 490 | } ; |
491 | 491 | ||
492 | static yyconst flex_int16_t yy_nxt[441] = | 492 | static yyconst flex_int16_t yy_nxt[440] = |
493 | { 0, | 493 | { 0, |
494 | 12, 13, 14, 15, 16, 12, 17, 18, 12, 12, | 494 | 12, 13, 14, 13, 15, 16, 12, 17, 18, 12, |
495 | 12, 19, 12, 12, 12, 12, 20, 21, 22, 23, | 495 | 12, 12, 19, 12, 12, 12, 12, 20, 21, 22, |
496 | 23, 23, 23, 23, 12, 12, 23, 23, 23, 23, | 496 | 23, 23, 23, 23, 23, 12, 12, 23, 23, 23, |
497 | 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, | 497 | 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, |
498 | 23, 23, 12, 24, 12, 25, 34, 35, 35, 25, | 498 | 23, 23, 23, 12, 24, 12, 25, 34, 35, 35, |
499 | 81, 26, 26, 27, 27, 27, 34, 35, 35, 82, | 499 | 25, 81, 26, 26, 27, 27, 27, 34, 35, 35, |
500 | 28, 36, 36, 36, 36, 159, 29, 28, 28, 28, | 500 | 82, 28, 36, 36, 36, 53, 54, 29, 28, 28, |
501 | 28, 12, 13, 14, 15, 16, 30, 17, 18, 30, | 501 | 28, 28, 12, 13, 14, 13, 15, 16, 30, 17, |
502 | 30, 30, 26, 30, 30, 30, 12, 20, 21, 22, | 502 | 18, 30, 30, 30, 26, 30, 30, 30, 12, 20, |
503 | 31, 31, 31, 31, 31, 32, 12, 31, 31, 31, | 503 | 21, 22, 31, 31, 31, 31, 31, 32, 12, 31, |
504 | 504 | ||
505 | 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, | 505 | 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, |
506 | 31, 31, 31, 12, 24, 12, 39, 41, 45, 47, | 506 | 31, 31, 31, 31, 31, 12, 24, 12, 36, 36, |
507 | 53, 54, 48, 56, 57, 61, 61, 47, 66, 45, | 507 | 36, 39, 41, 45, 47, 56, 57, 48, 61, 47, |
508 | 48, 66, 66, 66, 39, 46, 40, 49, 59, 50, | 508 | 39, 159, 48, 66, 61, 45, 66, 66, 66, 158, |
509 | 158, 51, 122, 52, 157, 49, 46, 50, 136, 63, | 509 | 46, 40, 49, 59, 50, 157, 51, 49, 52, 50, |
510 | 137, 52, 156, 43, 40, 62, 65, 65, 65, 59, | 510 | 40, 63, 46, 52, 36, 36, 36, 156, 43, 62, |
511 | 61, 61, 123, 65, 75, 69, 69, 69, 36, 36, | 511 | 65, 65, 65, 59, 136, 68, 137, 65, 75, 69, |
512 | 65, 65, 65, 65, 70, 71, 72, 69, 69, 69, | 512 | 69, 69, 70, 71, 65, 65, 65, 65, 70, 71, |
513 | 45, 46, 61, 61, 109, 77, 70, 71, 93, 110, | 513 | 72, 69, 69, 69, 61, 46, 45, 155, 154, 66, |
514 | 68, 70, 71, 85, 85, 85, 66, 46, 155, 66, | 514 | 70, 71, 66, 66, 66, 122, 85, 85, 85, 59, |
515 | 515 | ||
516 | 66, 66, 69, 69, 69, 122, 59, 100, 100, 61, | 516 | 69, 69, 69, 46, 77, 100, 109, 93, 100, 70, |
517 | 61, 70, 71, 100, 100, 148, 112, 154, 85, 85, | 517 | 71, 110, 112, 122, 129, 123, 153, 85, 85, 85, |
518 | 85, 61, 61, 129, 129, 123, 129, 129, 135, 135, | 518 | 135, 135, 135, 148, 148, 160, 135, 135, 135, 152, |
519 | 135, 142, 142, 148, 143, 149, 153, 135, 135, 135, | 519 | 142, 142, 142, 123, 143, 142, 142, 142, 151, 143, |
520 | 142, 142, 160, 143, 152, 151, 150, 146, 145, 144, | 520 | 150, 146, 145, 149, 149, 38, 38, 38, 38, 38, |
521 | 141, 140, 139, 149, 38, 38, 38, 38, 38, 38, | 521 | 38, 38, 38, 42, 144, 141, 140, 42, 42, 44, |
522 | 38, 38, 42, 138, 134, 133, 42, 42, 44, 44, | 522 | 44, 44, 44, 44, 44, 44, 44, 58, 58, 58, |
523 | 44, 44, 44, 44, 44, 44, 58, 58, 58, 58, | 523 | 58, 64, 139, 64, 66, 138, 134, 66, 133, 66, |
524 | 64, 132, 64, 66, 131, 130, 66, 160, 66, 66, | 524 | 66, 67, 132, 131, 67, 67, 67, 67, 73, 130, |
525 | 67, 128, 127, 67, 67, 67, 67, 73, 126, 73, | 525 | 73, 73, 76, 76, 76, 76, 76, 76, 76, 76, |
526 | 526 | ||
527 | 73, 76, 76, 76, 76, 76, 76, 76, 76, 78, | 527 | 78, 78, 78, 78, 78, 78, 78, 78, 91, 160, |
528 | 78, 78, 78, 78, 78, 78, 78, 91, 125, 91, | 528 | 91, 92, 129, 92, 92, 128, 92, 92, 121, 121, |
529 | 92, 124, 92, 92, 120, 92, 92, 121, 121, 121, | 529 | 121, 121, 121, 121, 121, 121, 147, 147, 147, 147, |
530 | 121, 121, 121, 121, 121, 147, 147, 147, 147, 147, | 530 | 147, 147, 147, 147, 127, 126, 125, 124, 61, 61, |
531 | 147, 147, 147, 119, 118, 117, 116, 115, 47, 114, | 531 | 120, 119, 118, 117, 116, 115, 47, 114, 110, 113, |
532 | 110, 113, 111, 108, 107, 106, 48, 105, 104, 89, | 532 | 111, 108, 107, 106, 48, 105, 104, 89, 103, 102, |
533 | 103, 102, 101, 99, 98, 97, 96, 95, 94, 79, | 533 | 101, 99, 98, 97, 96, 95, 94, 79, 77, 90, |
534 | 77, 90, 89, 88, 59, 87, 86, 59, 84, 83, | 534 | 89, 88, 59, 87, 86, 59, 84, 83, 80, 79, |
535 | 80, 79, 77, 74, 160, 60, 59, 55, 37, 160, | 535 | 77, 74, 160, 60, 59, 55, 37, 160, 33, 25, |
536 | 33, 25, 26, 25, 11, 160, 160, 160, 160, 160, | 536 | 26, 25, 11, 160, 160, 160, 160, 160, 160, 160, |
537 | 537 | ||
538 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 538 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, |
539 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 539 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, |
540 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 540 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, |
541 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160 | 541 | 160, 160, 160, 160, 160, 160, 160, 160, 160 |
542 | } ; | 542 | } ; |
543 | 543 | ||
544 | static yyconst flex_int16_t yy_chk[441] = | 544 | static yyconst flex_int16_t yy_chk[440] = |
545 | { 0, | 545 | { 0, |
546 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 546 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
547 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 547 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
548 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 548 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
549 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 549 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
550 | 1, 1, 1, 1, 1, 4, 9, 9, 9, 10, | 550 | 1, 1, 1, 1, 1, 1, 4, 9, 9, 9, |
551 | 50, 4, 5, 5, 5, 5, 10, 10, 10, 50, | 551 | 10, 50, 4, 5, 5, 5, 5, 10, 10, 10, |
552 | 5, 13, 13, 14, 14, 158, 5, 5, 5, 5, | 552 | 50, 5, 13, 13, 13, 20, 20, 5, 5, 5, |
553 | 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 553 | 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, |
554 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 554 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
555 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 555 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
556 | 556 | ||
557 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 557 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
558 | 7, 7, 7, 7, 7, 7, 16, 17, 18, 19, | 558 | 7, 7, 7, 7, 7, 7, 7, 7, 14, 14, |
559 | 20, 20, 19, 22, 22, 25, 25, 26, 31, 44, | 559 | 14, 16, 17, 18, 19, 22, 22, 19, 25, 26, |
560 | 26, 31, 31, 31, 38, 18, 16, 19, 31, 19, | 560 | 38, 158, 26, 31, 33, 44, 31, 31, 31, 157, |
561 | 157, 19, 112, 19, 156, 26, 44, 26, 130, 26, | 561 | 18, 16, 19, 31, 19, 156, 19, 26, 19, 26, |
562 | 130, 26, 155, 17, 38, 25, 28, 28, 28, 28, | 562 | 38, 26, 44, 26, 36, 36, 36, 155, 17, 25, |
563 | 33, 33, 112, 28, 46, 34, 34, 34, 36, 36, | 563 | 28, 28, 28, 28, 130, 33, 130, 28, 46, 34, |
564 | 28, 28, 28, 28, 34, 34, 34, 35, 35, 35, | 564 | 34, 34, 91, 91, 28, 28, 28, 28, 34, 34, |
565 | 75, 46, 61, 61, 98, 77, 35, 35, 77, 98, | 565 | 34, 35, 35, 35, 61, 46, 75, 152, 151, 67, |
566 | 33, 91, 91, 61, 61, 61, 67, 75, 152, 67, | 566 | 35, 35, 67, 67, 67, 112, 61, 61, 61, 67, |
567 | 567 | ||
568 | 67, 67, 69, 69, 69, 121, 67, 85, 85, 113, | 568 | 69, 69, 69, 75, 77, 85, 98, 77, 100, 69, |
569 | 113, 69, 69, 100, 100, 143, 100, 151, 85, 85, | 569 | 69, 98, 100, 121, 129, 112, 150, 85, 85, 85, |
570 | 85, 114, 114, 122, 122, 121, 129, 129, 135, 135, | 570 | 135, 135, 135, 143, 147, 149, 129, 129, 129, 146, |
571 | 135, 138, 138, 147, 138, 143, 150, 129, 129, 129, | 571 | 138, 138, 138, 121, 138, 142, 142, 142, 145, 142, |
572 | 142, 142, 149, 142, 146, 145, 144, 141, 140, 139, | 572 | 144, 141, 140, 143, 147, 161, 161, 161, 161, 161, |
573 | 137, 136, 134, 147, 161, 161, 161, 161, 161, 161, | 573 | 161, 161, 161, 162, 139, 137, 136, 162, 162, 163, |
574 | 161, 161, 162, 133, 128, 127, 162, 162, 163, 163, | 574 | 163, 163, 163, 163, 163, 163, 163, 164, 164, 164, |
575 | 163, 163, 163, 163, 163, 163, 164, 164, 164, 164, | 575 | 164, 165, 134, 165, 166, 133, 128, 166, 127, 166, |
576 | 165, 126, 165, 166, 125, 124, 166, 123, 166, 166, | 576 | 166, 167, 126, 125, 167, 167, 167, 167, 168, 124, |
577 | 167, 120, 119, 167, 167, 167, 167, 168, 118, 168, | 577 | 168, 168, 169, 169, 169, 169, 169, 169, 169, 169, |
578 | 578 | ||
579 | 168, 169, 169, 169, 169, 169, 169, 169, 169, 170, | 579 | 170, 170, 170, 170, 170, 170, 170, 170, 171, 123, |
580 | 170, 170, 170, 170, 170, 170, 170, 171, 117, 171, | 580 | 171, 172, 122, 172, 172, 120, 172, 172, 173, 173, |
581 | 172, 116, 172, 172, 111, 172, 172, 173, 173, 173, | 581 | 173, 173, 173, 173, 173, 173, 174, 174, 174, 174, |
582 | 173, 173, 173, 173, 173, 174, 174, 174, 174, 174, | 582 | 174, 174, 174, 174, 119, 118, 117, 116, 114, 113, |
583 | 174, 174, 174, 110, 109, 108, 107, 106, 105, 103, | 583 | 111, 110, 109, 108, 107, 106, 105, 103, 102, 101, |
584 | 102, 101, 99, 97, 96, 95, 94, 93, 92, 90, | 584 | 99, 97, 96, 95, 94, 93, 92, 90, 88, 87, |
585 | 88, 87, 86, 84, 83, 82, 81, 80, 79, 78, | 585 | 86, 84, 83, 82, 81, 80, 79, 78, 76, 71, |
586 | 76, 71, 70, 68, 65, 63, 62, 58, 52, 51, | 586 | 70, 68, 65, 63, 62, 58, 52, 51, 49, 48, |
587 | 49, 48, 47, 43, 40, 24, 23, 21, 15, 11, | 587 | 47, 43, 40, 24, 23, 21, 15, 11, 8, 6, |
588 | 8, 6, 3, 2, 160, 160, 160, 160, 160, 160, | 588 | 3, 2, 160, 160, 160, 160, 160, 160, 160, 160, |
589 | 589 | ||
590 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 590 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, |
591 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 591 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, |
592 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 592 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, |
593 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160 | 593 | 160, 160, 160, 160, 160, 160, 160, 160, 160 |
594 | } ; | 594 | } ; |
595 | 595 | ||
596 | static yy_state_type yy_last_accepting_state; | 596 | static yy_state_type yy_last_accepting_state; |
diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped index 4af55900a15b..ee1d8c3042fb 100644 --- a/scripts/dtc/dtc-parser.tab.c_shipped +++ b/scripts/dtc/dtc-parser.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,7 +65,7 @@ | |||
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 */ | 68 | /* Line 268 of yacc.c */ |
71 | #line 21 "dtc-parser.y" | 69 | #line 21 "dtc-parser.y" |
72 | 70 | ||
73 | #include <stdio.h> | 71 | #include <stdio.h> |
@@ -88,8 +86,8 @@ static unsigned long long eval_literal(const char *s, int base, int bits); | |||
88 | static unsigned char eval_char_literal(const char *s); | 86 | static unsigned char eval_char_literal(const char *s); |
89 | 87 | ||
90 | 88 | ||
91 | /* Line 189 of yacc.c */ | 89 | /* Line 268 of yacc.c */ |
92 | #line 93 "dtc-parser.tab.c" | 90 | #line 91 "dtc-parser.tab.c" |
93 | 91 | ||
94 | /* Enabling traces. */ | 92 | /* Enabling traces. */ |
95 | #ifndef YYDEBUG | 93 | #ifndef YYDEBUG |
@@ -147,7 +145,7 @@ static unsigned char eval_char_literal(const char *s); | |||
147 | typedef union YYSTYPE | 145 | typedef union YYSTYPE |
148 | { | 146 | { |
149 | 147 | ||
150 | /* Line 214 of yacc.c */ | 148 | /* Line 293 of yacc.c */ |
151 | #line 40 "dtc-parser.y" | 149 | #line 40 "dtc-parser.y" |
152 | 150 | ||
153 | char *propnodename; | 151 | char *propnodename; |
@@ -171,8 +169,8 @@ typedef union YYSTYPE | |||
171 | 169 | ||
172 | 170 | ||
173 | 171 | ||
174 | /* Line 214 of yacc.c */ | 172 | /* Line 293 of yacc.c */ |
175 | #line 176 "dtc-parser.tab.c" | 173 | #line 174 "dtc-parser.tab.c" |
176 | } YYSTYPE; | 174 | } YYSTYPE; |
177 | # define YYSTYPE_IS_TRIVIAL 1 | 175 | # define YYSTYPE_IS_TRIVIAL 1 |
178 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | 176 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
@@ -183,8 +181,8 @@ typedef union YYSTYPE | |||
183 | /* Copy the second part of user declarations. */ | 181 | /* Copy the second part of user declarations. */ |
184 | 182 | ||
185 | 183 | ||
186 | /* Line 264 of yacc.c */ | 184 | /* Line 343 of yacc.c */ |
187 | #line 188 "dtc-parser.tab.c" | 185 | #line 186 "dtc-parser.tab.c" |
188 | 186 | ||
189 | #ifdef short | 187 | #ifdef short |
190 | # undef short | 188 | # undef short |
@@ -234,7 +232,7 @@ typedef short int yytype_int16; | |||
234 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) | 232 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
235 | 233 | ||
236 | #ifndef YY_ | 234 | #ifndef YY_ |
237 | # if YYENABLE_NLS | 235 | # if defined YYENABLE_NLS && YYENABLE_NLS |
238 | # if ENABLE_NLS | 236 | # if ENABLE_NLS |
239 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ | 237 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
240 | # define YY_(msgid) dgettext ("bison-runtime", msgid) | 238 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
@@ -287,11 +285,11 @@ YYID (yyi) | |||
287 | # define alloca _alloca | 285 | # define alloca _alloca |
288 | # else | 286 | # else |
289 | # define YYSTACK_ALLOC alloca | 287 | # define YYSTACK_ALLOC alloca |
290 | # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ | 288 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ |
291 | || defined __cplusplus || defined _MSC_VER) | 289 | || defined __cplusplus || defined _MSC_VER) |
292 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | 290 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
293 | # ifndef _STDLIB_H | 291 | # ifndef EXIT_SUCCESS |
294 | # define _STDLIB_H 1 | 292 | # define EXIT_SUCCESS 0 |
295 | # endif | 293 | # endif |
296 | # endif | 294 | # endif |
297 | # endif | 295 | # endif |
@@ -314,24 +312,24 @@ YYID (yyi) | |||
314 | # ifndef YYSTACK_ALLOC_MAXIMUM | 312 | # ifndef YYSTACK_ALLOC_MAXIMUM |
315 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM | 313 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
316 | # endif | 314 | # endif |
317 | # if (defined __cplusplus && ! defined _STDLIB_H \ | 315 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
318 | && ! ((defined YYMALLOC || defined malloc) \ | 316 | && ! ((defined YYMALLOC || defined malloc) \ |
319 | && (defined YYFREE || defined free))) | 317 | && (defined YYFREE || defined free))) |
320 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | 318 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
321 | # ifndef _STDLIB_H | 319 | # ifndef EXIT_SUCCESS |
322 | # define _STDLIB_H 1 | 320 | # define EXIT_SUCCESS 0 |
323 | # endif | 321 | # endif |
324 | # endif | 322 | # endif |
325 | # ifndef YYMALLOC | 323 | # ifndef YYMALLOC |
326 | # define YYMALLOC malloc | 324 | # define YYMALLOC malloc |
327 | # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ | 325 | # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ |
328 | || defined __cplusplus || defined _MSC_VER) | 326 | || defined __cplusplus || defined _MSC_VER) |
329 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ | 327 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
330 | # endif | 328 | # endif |
331 | # endif | 329 | # endif |
332 | # ifndef YYFREE | 330 | # ifndef YYFREE |
333 | # define YYFREE free | 331 | # define YYFREE free |
334 | # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ | 332 | # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ |
335 | || defined __cplusplus || defined _MSC_VER) | 333 | || defined __cplusplus || defined _MSC_VER) |
336 | void free (void *); /* INFRINGES ON USER NAME SPACE */ | 334 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
337 | # endif | 335 | # endif |
@@ -360,23 +358,7 @@ union yyalloc | |||
360 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ | 358 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
361 | + YYSTACK_GAP_MAXIMUM) | 359 | + YYSTACK_GAP_MAXIMUM) |
362 | 360 | ||
363 | /* Copy COUNT objects from FROM to TO. The source and destination do | 361 | # define YYCOPY_NEEDED 1 |
364 | not overlap. */ | ||
365 | # ifndef YYCOPY | ||
366 | # if defined __GNUC__ && 1 < __GNUC__ | ||
367 | # define YYCOPY(To, From, Count) \ | ||
368 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | ||
369 | # else | ||
370 | # define YYCOPY(To, From, Count) \ | ||
371 | do \ | ||
372 | { \ | ||
373 | YYSIZE_T yyi; \ | ||
374 | for (yyi = 0; yyi < (Count); yyi++) \ | ||
375 | (To)[yyi] = (From)[yyi]; \ | ||
376 | } \ | ||
377 | while (YYID (0)) | ||
378 | # endif | ||
379 | # endif | ||
380 | 362 | ||
381 | /* Relocate STACK from its old location to the new one. The | 363 | /* Relocate STACK from its old location to the new one. The |
382 | local variables YYSIZE and YYSTACKSIZE give the old and new number of | 364 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
@@ -396,6 +378,26 @@ union yyalloc | |||
396 | 378 | ||
397 | #endif | 379 | #endif |
398 | 380 | ||
381 | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED | ||
382 | /* Copy COUNT objects from FROM to TO. The source and destination do | ||
383 | not overlap. */ | ||
384 | # ifndef YYCOPY | ||
385 | # if defined __GNUC__ && 1 < __GNUC__ | ||
386 | # define YYCOPY(To, From, Count) \ | ||
387 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | ||
388 | # else | ||
389 | # define YYCOPY(To, From, Count) \ | ||
390 | do \ | ||
391 | { \ | ||
392 | YYSIZE_T yyi; \ | ||
393 | for (yyi = 0; yyi < (Count); yyi++) \ | ||
394 | (To)[yyi] = (From)[yyi]; \ | ||
395 | } \ | ||
396 | while (YYID (0)) | ||
397 | # endif | ||
398 | # endif | ||
399 | #endif /* !YYCOPY_NEEDED */ | ||
400 | |||
399 | /* YYFINAL -- State number of the termination state. */ | 401 | /* YYFINAL -- State number of the termination state. */ |
400 | #define YYFINAL 4 | 402 | #define YYFINAL 4 |
401 | /* YYLAST -- Last index in YYTABLE. */ | 403 | /* YYLAST -- Last index in YYTABLE. */ |
@@ -571,8 +573,8 @@ static const yytype_uint8 yyr2[] = | |||
571 | 2, 0, 2, 2, 0, 2, 2, 2, 3, 2 | 573 | 2, 0, 2, 2, 0, 2, 2, 2, 3, 2 |
572 | }; | 574 | }; |
573 | 575 | ||
574 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | 576 | /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. |
575 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero | 577 | Performed when YYTABLE doesn't specify something else to do. Zero |
576 | means the default is an error. */ | 578 | means the default is an error. */ |
577 | static const yytype_uint8 yydefact[] = | 579 | static const yytype_uint8 yydefact[] = |
578 | { | 580 | { |
@@ -633,8 +635,7 @@ static const yytype_int8 yypgoto[] = | |||
633 | 635 | ||
634 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | 636 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
635 | positive, shift that token. If negative, reduce the rule which | 637 | positive, shift that token. If negative, reduce the rule which |
636 | number is the opposite. If zero, do what YYDEFACT says. | 638 | number is the opposite. If YYTABLE_NINF, syntax error. */ |
637 | If YYTABLE_NINF, syntax error. */ | ||
638 | #define YYTABLE_NINF -1 | 639 | #define YYTABLE_NINF -1 |
639 | static const yytype_uint8 yytable[] = | 640 | static const yytype_uint8 yytable[] = |
640 | { | 641 | { |
@@ -654,6 +655,12 @@ static const yytype_uint8 yytable[] = | |||
654 | 137, 0, 73, 139 | 655 | 137, 0, 73, 139 |
655 | }; | 656 | }; |
656 | 657 | ||
658 | #define yypact_value_is_default(yystate) \ | ||
659 | ((yystate) == (-78)) | ||
660 | |||
661 | #define yytable_value_is_error(yytable_value) \ | ||
662 | YYID (0) | ||
663 | |||
657 | static const yytype_int16 yycheck[] = | 664 | static const yytype_int16 yycheck[] = |
658 | { | 665 | { |
659 | 5, 38, 39, 17, 18, 19, 12, 12, 17, 18, | 666 | 5, 38, 39, 17, 18, 19, 12, 12, 17, 18, |
@@ -705,9 +712,18 @@ static const yytype_uint8 yystos[] = | |||
705 | 712 | ||
706 | /* Like YYERROR except do call yyerror. This remains here temporarily | 713 | /* Like YYERROR except do call yyerror. This remains here temporarily |
707 | to ease the transition to the new meaning of YYERROR, for GCC. | 714 | to ease the transition to the new meaning of YYERROR, for GCC. |
708 | Once GCC version 2 has supplanted version 1, this can go. */ | 715 | Once GCC version 2 has supplanted version 1, this can go. However, |
716 | YYFAIL appears to be in use. Nevertheless, it is formally deprecated | ||
717 | in Bison 2.4.2's NEWS entry, where a plan to phase it out is | ||
718 | discussed. */ | ||
709 | 719 | ||
710 | #define YYFAIL goto yyerrlab | 720 | #define YYFAIL goto yyerrlab |
721 | #if defined YYFAIL | ||
722 | /* This is here to suppress warnings from the GCC cpp's | ||
723 | -Wunused-macros. Normally we don't worry about that warning, but | ||
724 | some users do, and we want to make it easy for users to remove | ||
725 | YYFAIL uses, which will produce warnings from Bison 2.5. */ | ||
726 | #endif | ||
711 | 727 | ||
712 | #define YYRECOVERING() (!!yyerrstatus) | 728 | #define YYRECOVERING() (!!yyerrstatus) |
713 | 729 | ||
@@ -717,7 +733,6 @@ do \ | |||
717 | { \ | 733 | { \ |
718 | yychar = (Token); \ | 734 | yychar = (Token); \ |
719 | yylval = (Value); \ | 735 | yylval = (Value); \ |
720 | yytoken = YYTRANSLATE (yychar); \ | ||
721 | YYPOPSTACK (1); \ | 736 | YYPOPSTACK (1); \ |
722 | goto yybackup; \ | 737 | goto yybackup; \ |
723 | } \ | 738 | } \ |
@@ -759,19 +774,10 @@ while (YYID (0)) | |||
759 | #endif | 774 | #endif |
760 | 775 | ||
761 | 776 | ||
762 | /* YY_LOCATION_PRINT -- Print the location on the stream. | 777 | /* This macro is provided for backward compatibility. */ |
763 | This macro was not mandated originally: define only if we know | ||
764 | we won't break user code: when these are the locations we know. */ | ||
765 | 778 | ||
766 | #ifndef YY_LOCATION_PRINT | 779 | #ifndef YY_LOCATION_PRINT |
767 | # if YYLTYPE_IS_TRIVIAL | 780 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
768 | # define YY_LOCATION_PRINT(File, Loc) \ | ||
769 | fprintf (File, "%d.%d-%d.%d", \ | ||
770 | (Loc).first_line, (Loc).first_column, \ | ||
771 | (Loc).last_line, (Loc).last_column) | ||
772 | # else | ||
773 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | ||
774 | # endif | ||
775 | #endif | 781 | #endif |
776 | 782 | ||
777 | 783 | ||
@@ -963,7 +969,6 @@ int yydebug; | |||
963 | # define YYMAXDEPTH 10000 | 969 | # define YYMAXDEPTH 10000 |
964 | #endif | 970 | #endif |
965 | 971 | ||
966 | |||
967 | 972 | ||
968 | #if YYERROR_VERBOSE | 973 | #if YYERROR_VERBOSE |
969 | 974 | ||
@@ -1066,115 +1071,142 @@ yytnamerr (char *yyres, const char *yystr) | |||
1066 | } | 1071 | } |
1067 | # endif | 1072 | # endif |
1068 | 1073 | ||
1069 | /* Copy into YYRESULT an error message about the unexpected token | 1074 | /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message |
1070 | YYCHAR while in state YYSTATE. Return the number of bytes copied, | 1075 | about the unexpected token YYTOKEN for the state stack whose top is |
1071 | including the terminating null byte. If YYRESULT is null, do not | 1076 | YYSSP. |
1072 | copy anything; just return the number of bytes that would be | ||
1073 | copied. As a special case, return 0 if an ordinary "syntax error" | ||
1074 | message will do. Return YYSIZE_MAXIMUM if overflow occurs during | ||
1075 | size calculation. */ | ||
1076 | static YYSIZE_T | ||
1077 | yysyntax_error (char *yyresult, int yystate, int yychar) | ||
1078 | { | ||
1079 | int yyn = yypact[yystate]; | ||
1080 | 1077 | ||
1081 | if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) | 1078 | Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is |
1082 | return 0; | 1079 | not large enough to hold the message. In that case, also set |
1083 | else | 1080 | *YYMSG_ALLOC to the required number of bytes. Return 2 if the |
1081 | required number of bytes is too large to store. */ | ||
1082 | static int | ||
1083 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | ||
1084 | yytype_int16 *yyssp, int yytoken) | ||
1085 | { | ||
1086 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); | ||
1087 | YYSIZE_T yysize = yysize0; | ||
1088 | YYSIZE_T yysize1; | ||
1089 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; | ||
1090 | /* Internationalized format string. */ | ||
1091 | const char *yyformat = 0; | ||
1092 | /* Arguments of yyformat. */ | ||
1093 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | ||
1094 | /* Number of reported tokens (one for the "unexpected", one per | ||
1095 | "expected"). */ | ||
1096 | int yycount = 0; | ||
1097 | |||
1098 | /* There are many possibilities here to consider: | ||
1099 | - Assume YYFAIL is not used. It's too flawed to consider. See | ||
1100 | <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> | ||
1101 | for details. YYERROR is fine as it does not invoke this | ||
1102 | function. | ||
1103 | - If this state is a consistent state with a default action, then | ||
1104 | the only way this function was invoked is if the default action | ||
1105 | is an error action. In that case, don't check for expected | ||
1106 | tokens because there are none. | ||
1107 | - The only way there can be no lookahead present (in yychar) is if | ||
1108 | this state is a consistent state with a default action. Thus, | ||
1109 | detecting the absence of a lookahead is sufficient to determine | ||
1110 | that there is no unexpected or expected token to report. In that | ||
1111 | case, just report a simple "syntax error". | ||
1112 | - Don't assume there isn't a lookahead just because this state is a | ||
1113 | consistent state with a default action. There might have been a | ||
1114 | previous inconsistent state, consistent state with a non-default | ||
1115 | action, or user semantic action that manipulated yychar. | ||
1116 | - Of course, the expected token list depends on states to have | ||
1117 | correct lookahead information, and it depends on the parser not | ||
1118 | to perform extra reductions after fetching a lookahead from the | ||
1119 | scanner and before detecting a syntax error. Thus, state merging | ||
1120 | (from LALR or IELR) and default reductions corrupt the expected | ||
1121 | token list. However, the list is correct for canonical LR with | ||
1122 | one exception: it will still contain any token that will not be | ||
1123 | accepted due to an error action in a later state. | ||
1124 | */ | ||
1125 | if (yytoken != YYEMPTY) | ||
1084 | { | 1126 | { |
1085 | int yytype = YYTRANSLATE (yychar); | 1127 | int yyn = yypact[*yyssp]; |
1086 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); | 1128 | yyarg[yycount++] = yytname[yytoken]; |
1087 | YYSIZE_T yysize = yysize0; | 1129 | if (!yypact_value_is_default (yyn)) |
1088 | YYSIZE_T yysize1; | 1130 | { |
1089 | int yysize_overflow = 0; | 1131 | /* Start YYX at -YYN if negative to avoid negative indexes in |
1090 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; | 1132 | YYCHECK. In other words, skip the first -YYN actions for |
1091 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | 1133 | this state because they are default actions. */ |
1092 | int yyx; | 1134 | int yyxbegin = yyn < 0 ? -yyn : 0; |
1093 | 1135 | /* Stay within bounds of both yycheck and yytname. */ | |
1094 | # if 0 | 1136 | int yychecklim = YYLAST - yyn + 1; |
1095 | /* This is so xgettext sees the translatable formats that are | 1137 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
1096 | constructed on the fly. */ | 1138 | int yyx; |
1097 | YY_("syntax error, unexpected %s"); | 1139 | |
1098 | YY_("syntax error, unexpected %s, expecting %s"); | 1140 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
1099 | YY_("syntax error, unexpected %s, expecting %s or %s"); | 1141 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR |
1100 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); | 1142 | && !yytable_value_is_error (yytable[yyx + yyn])) |
1101 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); | 1143 | { |
1102 | # endif | 1144 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
1103 | char *yyfmt; | 1145 | { |
1104 | char const *yyf; | 1146 | yycount = 1; |
1105 | static char const yyunexpected[] = "syntax error, unexpected %s"; | 1147 | yysize = yysize0; |
1106 | static char const yyexpecting[] = ", expecting %s"; | 1148 | break; |
1107 | static char const yyor[] = " or %s"; | 1149 | } |
1108 | char yyformat[sizeof yyunexpected | 1150 | yyarg[yycount++] = yytname[yyx]; |
1109 | + sizeof yyexpecting - 1 | 1151 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
1110 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) | 1152 | if (! (yysize <= yysize1 |
1111 | * (sizeof yyor - 1))]; | 1153 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
1112 | char const *yyprefix = yyexpecting; | 1154 | return 2; |
1113 | 1155 | yysize = yysize1; | |
1114 | /* Start YYX at -YYN if negative to avoid negative indexes in | 1156 | } |
1115 | YYCHECK. */ | 1157 | } |
1116 | int yyxbegin = yyn < 0 ? -yyn : 0; | 1158 | } |
1117 | |||
1118 | /* Stay within bounds of both yycheck and yytname. */ | ||
1119 | int yychecklim = YYLAST - yyn + 1; | ||
1120 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; | ||
1121 | int yycount = 1; | ||
1122 | |||
1123 | yyarg[0] = yytname[yytype]; | ||
1124 | yyfmt = yystpcpy (yyformat, yyunexpected); | ||
1125 | |||
1126 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | ||
1127 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | ||
1128 | { | ||
1129 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) | ||
1130 | { | ||
1131 | yycount = 1; | ||
1132 | yysize = yysize0; | ||
1133 | yyformat[sizeof yyunexpected - 1] = '\0'; | ||
1134 | break; | ||
1135 | } | ||
1136 | yyarg[yycount++] = yytname[yyx]; | ||
1137 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); | ||
1138 | yysize_overflow |= (yysize1 < yysize); | ||
1139 | yysize = yysize1; | ||
1140 | yyfmt = yystpcpy (yyfmt, yyprefix); | ||
1141 | yyprefix = yyor; | ||
1142 | } | ||
1143 | 1159 | ||
1144 | yyf = YY_(yyformat); | 1160 | switch (yycount) |
1145 | yysize1 = yysize + yystrlen (yyf); | 1161 | { |
1146 | yysize_overflow |= (yysize1 < yysize); | 1162 | # define YYCASE_(N, S) \ |
1147 | yysize = yysize1; | 1163 | case N: \ |
1164 | yyformat = S; \ | ||
1165 | break | ||
1166 | YYCASE_(0, YY_("syntax error")); | ||
1167 | YYCASE_(1, YY_("syntax error, unexpected %s")); | ||
1168 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); | ||
1169 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); | ||
1170 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); | ||
1171 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); | ||
1172 | # undef YYCASE_ | ||
1173 | } | ||
1148 | 1174 | ||
1149 | if (yysize_overflow) | 1175 | yysize1 = yysize + yystrlen (yyformat); |
1150 | return YYSIZE_MAXIMUM; | 1176 | if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
1177 | return 2; | ||
1178 | yysize = yysize1; | ||
1151 | 1179 | ||
1152 | if (yyresult) | 1180 | if (*yymsg_alloc < yysize) |
1153 | { | 1181 | { |
1154 | /* Avoid sprintf, as that infringes on the user's name space. | 1182 | *yymsg_alloc = 2 * yysize; |
1155 | Don't have undefined behavior even if the translation | 1183 | if (! (yysize <= *yymsg_alloc |
1156 | produced a string with the wrong number of "%s"s. */ | 1184 | && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
1157 | char *yyp = yyresult; | 1185 | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
1158 | int yyi = 0; | 1186 | return 1; |
1159 | while ((*yyp = *yyf) != '\0') | ||
1160 | { | ||
1161 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) | ||
1162 | { | ||
1163 | yyp += yytnamerr (yyp, yyarg[yyi++]); | ||
1164 | yyf += 2; | ||
1165 | } | ||
1166 | else | ||
1167 | { | ||
1168 | yyp++; | ||
1169 | yyf++; | ||
1170 | } | ||
1171 | } | ||
1172 | } | ||
1173 | return yysize; | ||
1174 | } | 1187 | } |
1188 | |||
1189 | /* Avoid sprintf, as that infringes on the user's name space. | ||
1190 | Don't have undefined behavior even if the translation | ||
1191 | produced a string with the wrong number of "%s"s. */ | ||
1192 | { | ||
1193 | char *yyp = *yymsg; | ||
1194 | int yyi = 0; | ||
1195 | while ((*yyp = *yyformat) != '\0') | ||
1196 | if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) | ||
1197 | { | ||
1198 | yyp += yytnamerr (yyp, yyarg[yyi++]); | ||
1199 | yyformat += 2; | ||
1200 | } | ||
1201 | else | ||
1202 | { | ||
1203 | yyp++; | ||
1204 | yyformat++; | ||
1205 | } | ||
1206 | } | ||
1207 | return 0; | ||
1175 | } | 1208 | } |
1176 | #endif /* YYERROR_VERBOSE */ | 1209 | #endif /* YYERROR_VERBOSE */ |
1177 | |||
1178 | 1210 | ||
1179 | /*-----------------------------------------------. | 1211 | /*-----------------------------------------------. |
1180 | | Release the memory associated to this symbol. | | 1212 | | Release the memory associated to this symbol. | |
@@ -1207,6 +1239,7 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1207 | } | 1239 | } |
1208 | } | 1240 | } |
1209 | 1241 | ||
1242 | |||
1210 | /* Prevent warnings from -Wmissing-prototypes. */ | 1243 | /* Prevent warnings from -Wmissing-prototypes. */ |
1211 | #ifdef YYPARSE_PARAM | 1244 | #ifdef YYPARSE_PARAM |
1212 | #if defined __STDC__ || defined __cplusplus | 1245 | #if defined __STDC__ || defined __cplusplus |
@@ -1233,10 +1266,9 @@ YYSTYPE yylval; | |||
1233 | int yynerrs; | 1266 | int yynerrs; |
1234 | 1267 | ||
1235 | 1268 | ||
1236 | 1269 | /*----------. | |
1237 | /*-------------------------. | 1270 | | yyparse. | |
1238 | | yyparse or yypush_parse. | | 1271 | `----------*/ |
1239 | `-------------------------*/ | ||
1240 | 1272 | ||
1241 | #ifdef YYPARSE_PARAM | 1273 | #ifdef YYPARSE_PARAM |
1242 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 1274 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
@@ -1260,8 +1292,6 @@ yyparse () | |||
1260 | #endif | 1292 | #endif |
1261 | #endif | 1293 | #endif |
1262 | { | 1294 | { |
1263 | |||
1264 | |||
1265 | int yystate; | 1295 | int yystate; |
1266 | /* Number of tokens to shift before error messages enabled. */ | 1296 | /* Number of tokens to shift before error messages enabled. */ |
1267 | int yyerrstatus; | 1297 | int yyerrstatus; |
@@ -1416,7 +1446,7 @@ yybackup: | |||
1416 | 1446 | ||
1417 | /* First try to decide what to do without reference to lookahead token. */ | 1447 | /* First try to decide what to do without reference to lookahead token. */ |
1418 | yyn = yypact[yystate]; | 1448 | yyn = yypact[yystate]; |
1419 | if (yyn == YYPACT_NINF) | 1449 | if (yypact_value_is_default (yyn)) |
1420 | goto yydefault; | 1450 | goto yydefault; |
1421 | 1451 | ||
1422 | /* Not known => get a lookahead token if don't already have one. */ | 1452 | /* Not known => get a lookahead token if don't already have one. */ |
@@ -1447,8 +1477,8 @@ yybackup: | |||
1447 | yyn = yytable[yyn]; | 1477 | yyn = yytable[yyn]; |
1448 | if (yyn <= 0) | 1478 | if (yyn <= 0) |
1449 | { | 1479 | { |
1450 | if (yyn == 0 || yyn == YYTABLE_NINF) | 1480 | if (yytable_value_is_error (yyn)) |
1451 | goto yyerrlab; | 1481 | goto yyerrlab; |
1452 | yyn = -yyn; | 1482 | yyn = -yyn; |
1453 | goto yyreduce; | 1483 | goto yyreduce; |
1454 | } | 1484 | } |
@@ -1503,72 +1533,72 @@ yyreduce: | |||
1503 | { | 1533 | { |
1504 | case 2: | 1534 | case 2: |
1505 | 1535 | ||
1506 | /* Line 1455 of yacc.c */ | 1536 | /* Line 1806 of yacc.c */ |
1507 | #line 110 "dtc-parser.y" | 1537 | #line 110 "dtc-parser.y" |
1508 | { | 1538 | { |
1509 | the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), | 1539 | the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), |
1510 | guess_boot_cpuid((yyvsp[(4) - (4)].node))); | 1540 | guess_boot_cpuid((yyvsp[(4) - (4)].node))); |
1511 | ;} | 1541 | } |
1512 | break; | 1542 | break; |
1513 | 1543 | ||
1514 | case 3: | 1544 | case 3: |
1515 | 1545 | ||
1516 | /* Line 1455 of yacc.c */ | 1546 | /* Line 1806 of yacc.c */ |
1517 | #line 118 "dtc-parser.y" | 1547 | #line 118 "dtc-parser.y" |
1518 | { | 1548 | { |
1519 | (yyval.re) = NULL; | 1549 | (yyval.re) = NULL; |
1520 | ;} | 1550 | } |
1521 | break; | 1551 | break; |
1522 | 1552 | ||
1523 | case 4: | 1553 | case 4: |
1524 | 1554 | ||
1525 | /* Line 1455 of yacc.c */ | 1555 | /* Line 1806 of yacc.c */ |
1526 | #line 122 "dtc-parser.y" | 1556 | #line 122 "dtc-parser.y" |
1527 | { | 1557 | { |
1528 | (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); | 1558 | (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); |
1529 | ;} | 1559 | } |
1530 | break; | 1560 | break; |
1531 | 1561 | ||
1532 | case 5: | 1562 | case 5: |
1533 | 1563 | ||
1534 | /* Line 1455 of yacc.c */ | 1564 | /* Line 1806 of yacc.c */ |
1535 | #line 129 "dtc-parser.y" | 1565 | #line 129 "dtc-parser.y" |
1536 | { | 1566 | { |
1537 | (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer)); | 1567 | (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer)); |
1538 | ;} | 1568 | } |
1539 | break; | 1569 | break; |
1540 | 1570 | ||
1541 | case 6: | 1571 | case 6: |
1542 | 1572 | ||
1543 | /* Line 1455 of yacc.c */ | 1573 | /* Line 1806 of yacc.c */ |
1544 | #line 133 "dtc-parser.y" | 1574 | #line 133 "dtc-parser.y" |
1545 | { | 1575 | { |
1546 | add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref)); | 1576 | add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref)); |
1547 | (yyval.re) = (yyvsp[(2) - (2)].re); | 1577 | (yyval.re) = (yyvsp[(2) - (2)].re); |
1548 | ;} | 1578 | } |
1549 | break; | 1579 | break; |
1550 | 1580 | ||
1551 | case 7: | 1581 | case 7: |
1552 | 1582 | ||
1553 | /* Line 1455 of yacc.c */ | 1583 | /* Line 1806 of yacc.c */ |
1554 | #line 141 "dtc-parser.y" | 1584 | #line 141 "dtc-parser.y" |
1555 | { | 1585 | { |
1556 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), ""); | 1586 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), ""); |
1557 | ;} | 1587 | } |
1558 | break; | 1588 | break; |
1559 | 1589 | ||
1560 | case 8: | 1590 | case 8: |
1561 | 1591 | ||
1562 | /* Line 1455 of yacc.c */ | 1592 | /* Line 1806 of yacc.c */ |
1563 | #line 145 "dtc-parser.y" | 1593 | #line 145 "dtc-parser.y" |
1564 | { | 1594 | { |
1565 | (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); | 1595 | (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); |
1566 | ;} | 1596 | } |
1567 | break; | 1597 | break; |
1568 | 1598 | ||
1569 | case 9: | 1599 | case 9: |
1570 | 1600 | ||
1571 | /* Line 1455 of yacc.c */ | 1601 | /* Line 1806 of yacc.c */ |
1572 | #line 149 "dtc-parser.y" | 1602 | #line 149 "dtc-parser.y" |
1573 | { | 1603 | { |
1574 | struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref)); | 1604 | struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref)); |
@@ -1578,12 +1608,12 @@ yyreduce: | |||
1578 | else | 1608 | else |
1579 | print_error("label or path, '%s', not found", (yyvsp[(2) - (3)].labelref)); | 1609 | print_error("label or path, '%s', not found", (yyvsp[(2) - (3)].labelref)); |
1580 | (yyval.node) = (yyvsp[(1) - (3)].node); | 1610 | (yyval.node) = (yyvsp[(1) - (3)].node); |
1581 | ;} | 1611 | } |
1582 | break; | 1612 | break; |
1583 | 1613 | ||
1584 | case 10: | 1614 | case 10: |
1585 | 1615 | ||
1586 | /* Line 1455 of yacc.c */ | 1616 | /* Line 1806 of yacc.c */ |
1587 | #line 159 "dtc-parser.y" | 1617 | #line 159 "dtc-parser.y" |
1588 | { | 1618 | { |
1589 | struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref)); | 1619 | struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref)); |
@@ -1594,112 +1624,112 @@ yyreduce: | |||
1594 | delete_node(target); | 1624 | delete_node(target); |
1595 | 1625 | ||
1596 | (yyval.node) = (yyvsp[(1) - (4)].node); | 1626 | (yyval.node) = (yyvsp[(1) - (4)].node); |
1597 | ;} | 1627 | } |
1598 | break; | 1628 | break; |
1599 | 1629 | ||
1600 | case 11: | 1630 | case 11: |
1601 | 1631 | ||
1602 | /* Line 1455 of yacc.c */ | 1632 | /* Line 1806 of yacc.c */ |
1603 | #line 173 "dtc-parser.y" | 1633 | #line 173 "dtc-parser.y" |
1604 | { | 1634 | { |
1605 | (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); | 1635 | (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); |
1606 | ;} | 1636 | } |
1607 | break; | 1637 | break; |
1608 | 1638 | ||
1609 | case 12: | 1639 | case 12: |
1610 | 1640 | ||
1611 | /* Line 1455 of yacc.c */ | 1641 | /* Line 1806 of yacc.c */ |
1612 | #line 180 "dtc-parser.y" | 1642 | #line 180 "dtc-parser.y" |
1613 | { | 1643 | { |
1614 | (yyval.proplist) = NULL; | 1644 | (yyval.proplist) = NULL; |
1615 | ;} | 1645 | } |
1616 | break; | 1646 | break; |
1617 | 1647 | ||
1618 | case 13: | 1648 | case 13: |
1619 | 1649 | ||
1620 | /* Line 1455 of yacc.c */ | 1650 | /* Line 1806 of yacc.c */ |
1621 | #line 184 "dtc-parser.y" | 1651 | #line 184 "dtc-parser.y" |
1622 | { | 1652 | { |
1623 | (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); | 1653 | (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); |
1624 | ;} | 1654 | } |
1625 | break; | 1655 | break; |
1626 | 1656 | ||
1627 | case 14: | 1657 | case 14: |
1628 | 1658 | ||
1629 | /* Line 1455 of yacc.c */ | 1659 | /* Line 1806 of yacc.c */ |
1630 | #line 191 "dtc-parser.y" | 1660 | #line 191 "dtc-parser.y" |
1631 | { | 1661 | { |
1632 | (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data)); | 1662 | (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data)); |
1633 | ;} | 1663 | } |
1634 | break; | 1664 | break; |
1635 | 1665 | ||
1636 | case 15: | 1666 | case 15: |
1637 | 1667 | ||
1638 | /* Line 1455 of yacc.c */ | 1668 | /* Line 1806 of yacc.c */ |
1639 | #line 195 "dtc-parser.y" | 1669 | #line 195 "dtc-parser.y" |
1640 | { | 1670 | { |
1641 | (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data); | 1671 | (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data); |
1642 | ;} | 1672 | } |
1643 | break; | 1673 | break; |
1644 | 1674 | ||
1645 | case 16: | 1675 | case 16: |
1646 | 1676 | ||
1647 | /* Line 1455 of yacc.c */ | 1677 | /* Line 1806 of yacc.c */ |
1648 | #line 199 "dtc-parser.y" | 1678 | #line 199 "dtc-parser.y" |
1649 | { | 1679 | { |
1650 | (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename)); | 1680 | (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename)); |
1651 | ;} | 1681 | } |
1652 | break; | 1682 | break; |
1653 | 1683 | ||
1654 | case 17: | 1684 | case 17: |
1655 | 1685 | ||
1656 | /* Line 1455 of yacc.c */ | 1686 | /* Line 1806 of yacc.c */ |
1657 | #line 203 "dtc-parser.y" | 1687 | #line 203 "dtc-parser.y" |
1658 | { | 1688 | { |
1659 | add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref)); | 1689 | add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref)); |
1660 | (yyval.prop) = (yyvsp[(2) - (2)].prop); | 1690 | (yyval.prop) = (yyvsp[(2) - (2)].prop); |
1661 | ;} | 1691 | } |
1662 | break; | 1692 | break; |
1663 | 1693 | ||
1664 | case 18: | 1694 | case 18: |
1665 | 1695 | ||
1666 | /* Line 1455 of yacc.c */ | 1696 | /* Line 1806 of yacc.c */ |
1667 | #line 211 "dtc-parser.y" | 1697 | #line 211 "dtc-parser.y" |
1668 | { | 1698 | { |
1669 | (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); | 1699 | (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); |
1670 | ;} | 1700 | } |
1671 | break; | 1701 | break; |
1672 | 1702 | ||
1673 | case 19: | 1703 | case 19: |
1674 | 1704 | ||
1675 | /* Line 1455 of yacc.c */ | 1705 | /* Line 1806 of yacc.c */ |
1676 | #line 215 "dtc-parser.y" | 1706 | #line 215 "dtc-parser.y" |
1677 | { | 1707 | { |
1678 | (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data); | 1708 | (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data); |
1679 | ;} | 1709 | } |
1680 | break; | 1710 | break; |
1681 | 1711 | ||
1682 | case 20: | 1712 | case 20: |
1683 | 1713 | ||
1684 | /* Line 1455 of yacc.c */ | 1714 | /* Line 1806 of yacc.c */ |
1685 | #line 219 "dtc-parser.y" | 1715 | #line 219 "dtc-parser.y" |
1686 | { | 1716 | { |
1687 | (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); | 1717 | (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); |
1688 | ;} | 1718 | } |
1689 | break; | 1719 | break; |
1690 | 1720 | ||
1691 | case 21: | 1721 | case 21: |
1692 | 1722 | ||
1693 | /* Line 1455 of yacc.c */ | 1723 | /* Line 1806 of yacc.c */ |
1694 | #line 223 "dtc-parser.y" | 1724 | #line 223 "dtc-parser.y" |
1695 | { | 1725 | { |
1696 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); | 1726 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); |
1697 | ;} | 1727 | } |
1698 | break; | 1728 | break; |
1699 | 1729 | ||
1700 | case 22: | 1730 | case 22: |
1701 | 1731 | ||
1702 | /* Line 1455 of yacc.c */ | 1732 | /* Line 1806 of yacc.c */ |
1703 | #line 227 "dtc-parser.y" | 1733 | #line 227 "dtc-parser.y" |
1704 | { | 1734 | { |
1705 | FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL); | 1735 | FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL); |
@@ -1716,12 +1746,12 @@ yyreduce: | |||
1716 | 1746 | ||
1717 | (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d); | 1747 | (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d); |
1718 | fclose(f); | 1748 | fclose(f); |
1719 | ;} | 1749 | } |
1720 | break; | 1750 | break; |
1721 | 1751 | ||
1722 | case 23: | 1752 | case 23: |
1723 | 1753 | ||
1724 | /* Line 1455 of yacc.c */ | 1754 | /* Line 1806 of yacc.c */ |
1725 | #line 244 "dtc-parser.y" | 1755 | #line 244 "dtc-parser.y" |
1726 | { | 1756 | { |
1727 | FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL); | 1757 | FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL); |
@@ -1731,48 +1761,48 @@ yyreduce: | |||
1731 | 1761 | ||
1732 | (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d); | 1762 | (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d); |
1733 | fclose(f); | 1763 | fclose(f); |
1734 | ;} | 1764 | } |
1735 | break; | 1765 | break; |
1736 | 1766 | ||
1737 | case 24: | 1767 | case 24: |
1738 | 1768 | ||
1739 | /* Line 1455 of yacc.c */ | 1769 | /* Line 1806 of yacc.c */ |
1740 | #line 254 "dtc-parser.y" | 1770 | #line 254 "dtc-parser.y" |
1741 | { | 1771 | { |
1742 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1772 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); |
1743 | ;} | 1773 | } |
1744 | break; | 1774 | break; |
1745 | 1775 | ||
1746 | case 25: | 1776 | case 25: |
1747 | 1777 | ||
1748 | /* Line 1455 of yacc.c */ | 1778 | /* Line 1806 of yacc.c */ |
1749 | #line 261 "dtc-parser.y" | 1779 | #line 261 "dtc-parser.y" |
1750 | { | 1780 | { |
1751 | (yyval.data) = empty_data; | 1781 | (yyval.data) = empty_data; |
1752 | ;} | 1782 | } |
1753 | break; | 1783 | break; |
1754 | 1784 | ||
1755 | case 26: | 1785 | case 26: |
1756 | 1786 | ||
1757 | /* Line 1455 of yacc.c */ | 1787 | /* Line 1806 of yacc.c */ |
1758 | #line 265 "dtc-parser.y" | 1788 | #line 265 "dtc-parser.y" |
1759 | { | 1789 | { |
1760 | (yyval.data) = (yyvsp[(1) - (2)].data); | 1790 | (yyval.data) = (yyvsp[(1) - (2)].data); |
1761 | ;} | 1791 | } |
1762 | break; | 1792 | break; |
1763 | 1793 | ||
1764 | case 27: | 1794 | case 27: |
1765 | 1795 | ||
1766 | /* Line 1455 of yacc.c */ | 1796 | /* Line 1806 of yacc.c */ |
1767 | #line 269 "dtc-parser.y" | 1797 | #line 269 "dtc-parser.y" |
1768 | { | 1798 | { |
1769 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1799 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); |
1770 | ;} | 1800 | } |
1771 | break; | 1801 | break; |
1772 | 1802 | ||
1773 | case 28: | 1803 | case 28: |
1774 | 1804 | ||
1775 | /* Line 1455 of yacc.c */ | 1805 | /* Line 1806 of yacc.c */ |
1776 | #line 276 "dtc-parser.y" | 1806 | #line 276 "dtc-parser.y" |
1777 | { | 1807 | { |
1778 | (yyval.array).data = empty_data; | 1808 | (yyval.array).data = empty_data; |
@@ -1787,22 +1817,22 @@ yyreduce: | |||
1787 | " are currently supported"); | 1817 | " are currently supported"); |
1788 | (yyval.array).bits = 32; | 1818 | (yyval.array).bits = 32; |
1789 | } | 1819 | } |
1790 | ;} | 1820 | } |
1791 | break; | 1821 | break; |
1792 | 1822 | ||
1793 | case 29: | 1823 | case 29: |
1794 | 1824 | ||
1795 | /* Line 1455 of yacc.c */ | 1825 | /* Line 1806 of yacc.c */ |
1796 | #line 291 "dtc-parser.y" | 1826 | #line 291 "dtc-parser.y" |
1797 | { | 1827 | { |
1798 | (yyval.array).data = empty_data; | 1828 | (yyval.array).data = empty_data; |
1799 | (yyval.array).bits = 32; | 1829 | (yyval.array).bits = 32; |
1800 | ;} | 1830 | } |
1801 | break; | 1831 | break; |
1802 | 1832 | ||
1803 | case 30: | 1833 | case 30: |
1804 | 1834 | ||
1805 | /* Line 1455 of yacc.c */ | 1835 | /* Line 1806 of yacc.c */ |
1806 | #line 296 "dtc-parser.y" | 1836 | #line 296 "dtc-parser.y" |
1807 | { | 1837 | { |
1808 | if ((yyvsp[(1) - (2)].array).bits < 64) { | 1838 | if ((yyvsp[(1) - (2)].array).bits < 64) { |
@@ -1822,12 +1852,12 @@ yyreduce: | |||
1822 | } | 1852 | } |
1823 | 1853 | ||
1824 | (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits); | 1854 | (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits); |
1825 | ;} | 1855 | } |
1826 | break; | 1856 | break; |
1827 | 1857 | ||
1828 | case 31: | 1858 | case 31: |
1829 | 1859 | ||
1830 | /* Line 1455 of yacc.c */ | 1860 | /* Line 1806 of yacc.c */ |
1831 | #line 316 "dtc-parser.y" | 1861 | #line 316 "dtc-parser.y" |
1832 | { | 1862 | { |
1833 | uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits); | 1863 | uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits); |
@@ -1841,288 +1871,299 @@ yyreduce: | |||
1841 | "arrays with 32-bit elements."); | 1871 | "arrays with 32-bit elements."); |
1842 | 1872 | ||
1843 | (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits); | 1873 | (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits); |
1844 | ;} | 1874 | } |
1845 | break; | 1875 | break; |
1846 | 1876 | ||
1847 | case 32: | 1877 | case 32: |
1848 | 1878 | ||
1849 | /* Line 1455 of yacc.c */ | 1879 | /* Line 1806 of yacc.c */ |
1850 | #line 330 "dtc-parser.y" | 1880 | #line 330 "dtc-parser.y" |
1851 | { | 1881 | { |
1852 | (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref)); | 1882 | (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref)); |
1853 | ;} | 1883 | } |
1854 | break; | 1884 | break; |
1855 | 1885 | ||
1856 | case 33: | 1886 | case 33: |
1857 | 1887 | ||
1858 | /* Line 1455 of yacc.c */ | 1888 | /* Line 1806 of yacc.c */ |
1859 | #line 337 "dtc-parser.y" | 1889 | #line 337 "dtc-parser.y" |
1860 | { | 1890 | { |
1861 | (yyval.integer) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64); | 1891 | (yyval.integer) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64); |
1862 | ;} | 1892 | } |
1863 | break; | 1893 | break; |
1864 | 1894 | ||
1865 | case 34: | 1895 | case 34: |
1866 | 1896 | ||
1867 | /* Line 1455 of yacc.c */ | 1897 | /* Line 1806 of yacc.c */ |
1868 | #line 341 "dtc-parser.y" | 1898 | #line 341 "dtc-parser.y" |
1869 | { | 1899 | { |
1870 | (yyval.integer) = eval_char_literal((yyvsp[(1) - (1)].literal)); | 1900 | (yyval.integer) = eval_char_literal((yyvsp[(1) - (1)].literal)); |
1871 | ;} | 1901 | } |
1872 | break; | 1902 | break; |
1873 | 1903 | ||
1874 | case 35: | 1904 | case 35: |
1875 | 1905 | ||
1876 | /* Line 1455 of yacc.c */ | 1906 | /* Line 1806 of yacc.c */ |
1877 | #line 345 "dtc-parser.y" | 1907 | #line 345 "dtc-parser.y" |
1878 | { | 1908 | { |
1879 | (yyval.integer) = (yyvsp[(2) - (3)].integer); | 1909 | (yyval.integer) = (yyvsp[(2) - (3)].integer); |
1880 | ;} | 1910 | } |
1881 | break; | 1911 | break; |
1882 | 1912 | ||
1883 | case 38: | 1913 | case 38: |
1884 | 1914 | ||
1885 | /* Line 1455 of yacc.c */ | 1915 | /* Line 1806 of yacc.c */ |
1886 | #line 356 "dtc-parser.y" | 1916 | #line 356 "dtc-parser.y" |
1887 | { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); ;} | 1917 | { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); } |
1888 | break; | 1918 | break; |
1889 | 1919 | ||
1890 | case 40: | 1920 | case 40: |
1891 | 1921 | ||
1892 | /* Line 1455 of yacc.c */ | 1922 | /* Line 1806 of yacc.c */ |
1893 | #line 361 "dtc-parser.y" | 1923 | #line 361 "dtc-parser.y" |
1894 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); ;} | 1924 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); } |
1895 | break; | 1925 | break; |
1896 | 1926 | ||
1897 | case 42: | 1927 | case 42: |
1898 | 1928 | ||
1899 | /* Line 1455 of yacc.c */ | 1929 | /* Line 1806 of yacc.c */ |
1900 | #line 366 "dtc-parser.y" | 1930 | #line 366 "dtc-parser.y" |
1901 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); ;} | 1931 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); } |
1902 | break; | 1932 | break; |
1903 | 1933 | ||
1904 | case 44: | 1934 | case 44: |
1905 | 1935 | ||
1906 | /* Line 1455 of yacc.c */ | 1936 | /* Line 1806 of yacc.c */ |
1907 | #line 371 "dtc-parser.y" | 1937 | #line 371 "dtc-parser.y" |
1908 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); ;} | 1938 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); } |
1909 | break; | 1939 | break; |
1910 | 1940 | ||
1911 | case 46: | 1941 | case 46: |
1912 | 1942 | ||
1913 | /* Line 1455 of yacc.c */ | 1943 | /* Line 1806 of yacc.c */ |
1914 | #line 376 "dtc-parser.y" | 1944 | #line 376 "dtc-parser.y" |
1915 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); ;} | 1945 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); } |
1916 | break; | 1946 | break; |
1917 | 1947 | ||
1918 | case 48: | 1948 | case 48: |
1919 | 1949 | ||
1920 | /* Line 1455 of yacc.c */ | 1950 | /* Line 1806 of yacc.c */ |
1921 | #line 381 "dtc-parser.y" | 1951 | #line 381 "dtc-parser.y" |
1922 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); ;} | 1952 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); } |
1923 | break; | 1953 | break; |
1924 | 1954 | ||
1925 | case 50: | 1955 | case 50: |
1926 | 1956 | ||
1927 | /* Line 1455 of yacc.c */ | 1957 | /* Line 1806 of yacc.c */ |
1928 | #line 386 "dtc-parser.y" | 1958 | #line 386 "dtc-parser.y" |
1929 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); ;} | 1959 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); } |
1930 | break; | 1960 | break; |
1931 | 1961 | ||
1932 | case 51: | 1962 | case 51: |
1933 | 1963 | ||
1934 | /* Line 1455 of yacc.c */ | 1964 | /* Line 1806 of yacc.c */ |
1935 | #line 387 "dtc-parser.y" | 1965 | #line 387 "dtc-parser.y" |
1936 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); ;} | 1966 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); } |
1937 | break; | 1967 | break; |
1938 | 1968 | ||
1939 | case 53: | 1969 | case 53: |
1940 | 1970 | ||
1941 | /* Line 1455 of yacc.c */ | 1971 | /* Line 1806 of yacc.c */ |
1942 | #line 392 "dtc-parser.y" | 1972 | #line 392 "dtc-parser.y" |
1943 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); ;} | 1973 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); } |
1944 | break; | 1974 | break; |
1945 | 1975 | ||
1946 | case 54: | 1976 | case 54: |
1947 | 1977 | ||
1948 | /* Line 1455 of yacc.c */ | 1978 | /* Line 1806 of yacc.c */ |
1949 | #line 393 "dtc-parser.y" | 1979 | #line 393 "dtc-parser.y" |
1950 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); ;} | 1980 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); } |
1951 | break; | 1981 | break; |
1952 | 1982 | ||
1953 | case 55: | 1983 | case 55: |
1954 | 1984 | ||
1955 | /* Line 1455 of yacc.c */ | 1985 | /* Line 1806 of yacc.c */ |
1956 | #line 394 "dtc-parser.y" | 1986 | #line 394 "dtc-parser.y" |
1957 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); ;} | 1987 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); } |
1958 | break; | 1988 | break; |
1959 | 1989 | ||
1960 | case 56: | 1990 | case 56: |
1961 | 1991 | ||
1962 | /* Line 1455 of yacc.c */ | 1992 | /* Line 1806 of yacc.c */ |
1963 | #line 395 "dtc-parser.y" | 1993 | #line 395 "dtc-parser.y" |
1964 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); ;} | 1994 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); } |
1965 | break; | 1995 | break; |
1966 | 1996 | ||
1967 | case 57: | 1997 | case 57: |
1968 | 1998 | ||
1969 | /* Line 1455 of yacc.c */ | 1999 | /* Line 1806 of yacc.c */ |
1970 | #line 399 "dtc-parser.y" | 2000 | #line 399 "dtc-parser.y" |
1971 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); ;} | 2001 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); } |
1972 | break; | 2002 | break; |
1973 | 2003 | ||
1974 | case 58: | 2004 | case 58: |
1975 | 2005 | ||
1976 | /* Line 1455 of yacc.c */ | 2006 | /* Line 1806 of yacc.c */ |
1977 | #line 400 "dtc-parser.y" | 2007 | #line 400 "dtc-parser.y" |
1978 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); ;} | 2008 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); } |
1979 | break; | 2009 | break; |
1980 | 2010 | ||
1981 | case 60: | 2011 | case 60: |
1982 | 2012 | ||
1983 | /* Line 1455 of yacc.c */ | 2013 | /* Line 1806 of yacc.c */ |
1984 | #line 405 "dtc-parser.y" | 2014 | #line 405 "dtc-parser.y" |
1985 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} | 2015 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); } |
1986 | break; | 2016 | break; |
1987 | 2017 | ||
1988 | case 61: | 2018 | case 61: |
1989 | 2019 | ||
1990 | /* Line 1455 of yacc.c */ | 2020 | /* Line 1806 of yacc.c */ |
1991 | #line 406 "dtc-parser.y" | 2021 | #line 406 "dtc-parser.y" |
1992 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); ;} | 2022 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); } |
1993 | break; | 2023 | break; |
1994 | 2024 | ||
1995 | case 63: | 2025 | case 63: |
1996 | 2026 | ||
1997 | /* Line 1455 of yacc.c */ | 2027 | /* Line 1806 of yacc.c */ |
1998 | #line 411 "dtc-parser.y" | 2028 | #line 411 "dtc-parser.y" |
1999 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); ;} | 2029 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); } |
2000 | break; | 2030 | break; |
2001 | 2031 | ||
2002 | case 64: | 2032 | case 64: |
2003 | 2033 | ||
2004 | /* Line 1455 of yacc.c */ | 2034 | /* Line 1806 of yacc.c */ |
2005 | #line 412 "dtc-parser.y" | 2035 | #line 412 "dtc-parser.y" |
2006 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); ;} | 2036 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); } |
2007 | break; | 2037 | break; |
2008 | 2038 | ||
2009 | case 65: | 2039 | case 65: |
2010 | 2040 | ||
2011 | /* Line 1455 of yacc.c */ | 2041 | /* Line 1806 of yacc.c */ |
2012 | #line 413 "dtc-parser.y" | 2042 | #line 413 "dtc-parser.y" |
2013 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); ;} | 2043 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); } |
2014 | break; | 2044 | break; |
2015 | 2045 | ||
2016 | case 68: | 2046 | case 68: |
2017 | 2047 | ||
2018 | /* Line 1455 of yacc.c */ | 2048 | /* Line 1806 of yacc.c */ |
2019 | #line 419 "dtc-parser.y" | 2049 | #line 419 "dtc-parser.y" |
2020 | { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} | 2050 | { (yyval.integer) = -(yyvsp[(2) - (2)].integer); } |
2021 | break; | 2051 | break; |
2022 | 2052 | ||
2023 | case 69: | 2053 | case 69: |
2024 | 2054 | ||
2025 | /* Line 1455 of yacc.c */ | 2055 | /* Line 1806 of yacc.c */ |
2026 | #line 420 "dtc-parser.y" | 2056 | #line 420 "dtc-parser.y" |
2027 | { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); ;} | 2057 | { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); } |
2028 | break; | 2058 | break; |
2029 | 2059 | ||
2030 | case 70: | 2060 | case 70: |
2031 | 2061 | ||
2032 | /* Line 1455 of yacc.c */ | 2062 | /* Line 1806 of yacc.c */ |
2033 | #line 421 "dtc-parser.y" | 2063 | #line 421 "dtc-parser.y" |
2034 | { (yyval.integer) = !(yyvsp[(2) - (2)].integer); ;} | 2064 | { (yyval.integer) = !(yyvsp[(2) - (2)].integer); } |
2035 | break; | 2065 | break; |
2036 | 2066 | ||
2037 | case 71: | 2067 | case 71: |
2038 | 2068 | ||
2039 | /* Line 1455 of yacc.c */ | 2069 | /* Line 1806 of yacc.c */ |
2040 | #line 426 "dtc-parser.y" | 2070 | #line 426 "dtc-parser.y" |
2041 | { | 2071 | { |
2042 | (yyval.data) = empty_data; | 2072 | (yyval.data) = empty_data; |
2043 | ;} | 2073 | } |
2044 | break; | 2074 | break; |
2045 | 2075 | ||
2046 | case 72: | 2076 | case 72: |
2047 | 2077 | ||
2048 | /* Line 1455 of yacc.c */ | 2078 | /* Line 1806 of yacc.c */ |
2049 | #line 430 "dtc-parser.y" | 2079 | #line 430 "dtc-parser.y" |
2050 | { | 2080 | { |
2051 | (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); | 2081 | (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); |
2052 | ;} | 2082 | } |
2053 | break; | 2083 | break; |
2054 | 2084 | ||
2055 | case 73: | 2085 | case 73: |
2056 | 2086 | ||
2057 | /* Line 1455 of yacc.c */ | 2087 | /* Line 1806 of yacc.c */ |
2058 | #line 434 "dtc-parser.y" | 2088 | #line 434 "dtc-parser.y" |
2059 | { | 2089 | { |
2060 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 2090 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); |
2061 | ;} | 2091 | } |
2062 | break; | 2092 | break; |
2063 | 2093 | ||
2064 | case 74: | 2094 | case 74: |
2065 | 2095 | ||
2066 | /* Line 1455 of yacc.c */ | 2096 | /* Line 1806 of yacc.c */ |
2067 | #line 441 "dtc-parser.y" | 2097 | #line 441 "dtc-parser.y" |
2068 | { | 2098 | { |
2069 | (yyval.nodelist) = NULL; | 2099 | (yyval.nodelist) = NULL; |
2070 | ;} | 2100 | } |
2071 | break; | 2101 | break; |
2072 | 2102 | ||
2073 | case 75: | 2103 | case 75: |
2074 | 2104 | ||
2075 | /* Line 1455 of yacc.c */ | 2105 | /* Line 1806 of yacc.c */ |
2076 | #line 445 "dtc-parser.y" | 2106 | #line 445 "dtc-parser.y" |
2077 | { | 2107 | { |
2078 | (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); | 2108 | (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); |
2079 | ;} | 2109 | } |
2080 | break; | 2110 | break; |
2081 | 2111 | ||
2082 | case 76: | 2112 | case 76: |
2083 | 2113 | ||
2084 | /* Line 1455 of yacc.c */ | 2114 | /* Line 1806 of yacc.c */ |
2085 | #line 449 "dtc-parser.y" | 2115 | #line 449 "dtc-parser.y" |
2086 | { | 2116 | { |
2087 | print_error("syntax error: properties must precede subnodes"); | 2117 | print_error("syntax error: properties must precede subnodes"); |
2088 | YYERROR; | 2118 | YYERROR; |
2089 | ;} | 2119 | } |
2090 | break; | 2120 | break; |
2091 | 2121 | ||
2092 | case 77: | 2122 | case 77: |
2093 | 2123 | ||
2094 | /* Line 1455 of yacc.c */ | 2124 | /* Line 1806 of yacc.c */ |
2095 | #line 457 "dtc-parser.y" | 2125 | #line 457 "dtc-parser.y" |
2096 | { | 2126 | { |
2097 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename)); | 2127 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename)); |
2098 | ;} | 2128 | } |
2099 | break; | 2129 | break; |
2100 | 2130 | ||
2101 | case 78: | 2131 | case 78: |
2102 | 2132 | ||
2103 | /* Line 1455 of yacc.c */ | 2133 | /* Line 1806 of yacc.c */ |
2104 | #line 461 "dtc-parser.y" | 2134 | #line 461 "dtc-parser.y" |
2105 | { | 2135 | { |
2106 | (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename)); | 2136 | (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename)); |
2107 | ;} | 2137 | } |
2108 | break; | 2138 | break; |
2109 | 2139 | ||
2110 | case 79: | 2140 | case 79: |
2111 | 2141 | ||
2112 | /* Line 1455 of yacc.c */ | 2142 | /* Line 1806 of yacc.c */ |
2113 | #line 465 "dtc-parser.y" | 2143 | #line 465 "dtc-parser.y" |
2114 | { | 2144 | { |
2115 | add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref)); | 2145 | add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref)); |
2116 | (yyval.node) = (yyvsp[(2) - (2)].node); | 2146 | (yyval.node) = (yyvsp[(2) - (2)].node); |
2117 | ;} | 2147 | } |
2118 | break; | 2148 | break; |
2119 | 2149 | ||
2120 | 2150 | ||
2121 | 2151 | ||
2122 | /* Line 1455 of yacc.c */ | 2152 | /* Line 1806 of yacc.c */ |
2123 | #line 2124 "dtc-parser.tab.c" | 2153 | #line 2154 "dtc-parser.tab.c" |
2124 | default: break; | 2154 | default: break; |
2125 | } | 2155 | } |
2156 | /* User semantic actions sometimes alter yychar, and that requires | ||
2157 | that yytoken be updated with the new translation. We take the | ||
2158 | approach of translating immediately before every use of yytoken. | ||
2159 | One alternative is translating here after every semantic action, | ||
2160 | but that translation would be missed if the semantic action invokes | ||
2161 | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or | ||
2162 | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an | ||
2163 | incorrect destructor might then be invoked immediately. In the | ||
2164 | case of YYERROR or YYBACKUP, subsequent parser actions might lead | ||
2165 | to an incorrect destructor call or verbose syntax error message | ||
2166 | before the lookahead is translated. */ | ||
2126 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); | 2167 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
2127 | 2168 | ||
2128 | YYPOPSTACK (yylen); | 2169 | YYPOPSTACK (yylen); |
@@ -2150,6 +2191,10 @@ yyreduce: | |||
2150 | | yyerrlab -- here on detecting error | | 2191 | | yyerrlab -- here on detecting error | |
2151 | `------------------------------------*/ | 2192 | `------------------------------------*/ |
2152 | yyerrlab: | 2193 | yyerrlab: |
2194 | /* Make sure we have latest lookahead translation. See comments at | ||
2195 | user semantic actions for why this is necessary. */ | ||
2196 | yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); | ||
2197 | |||
2153 | /* If not already recovering from an error, report this error. */ | 2198 | /* If not already recovering from an error, report this error. */ |
2154 | if (!yyerrstatus) | 2199 | if (!yyerrstatus) |
2155 | { | 2200 | { |
@@ -2157,37 +2202,36 @@ yyerrlab: | |||
2157 | #if ! YYERROR_VERBOSE | 2202 | #if ! YYERROR_VERBOSE |
2158 | yyerror (YY_("syntax error")); | 2203 | yyerror (YY_("syntax error")); |
2159 | #else | 2204 | #else |
2205 | # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ | ||
2206 | yyssp, yytoken) | ||
2160 | { | 2207 | { |
2161 | YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); | 2208 | char const *yymsgp = YY_("syntax error"); |
2162 | if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) | 2209 | int yysyntax_error_status; |
2163 | { | 2210 | yysyntax_error_status = YYSYNTAX_ERROR; |
2164 | YYSIZE_T yyalloc = 2 * yysize; | 2211 | if (yysyntax_error_status == 0) |
2165 | if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) | 2212 | yymsgp = yymsg; |
2166 | yyalloc = YYSTACK_ALLOC_MAXIMUM; | 2213 | else if (yysyntax_error_status == 1) |
2167 | if (yymsg != yymsgbuf) | 2214 | { |
2168 | YYSTACK_FREE (yymsg); | 2215 | if (yymsg != yymsgbuf) |
2169 | yymsg = (char *) YYSTACK_ALLOC (yyalloc); | 2216 | YYSTACK_FREE (yymsg); |
2170 | if (yymsg) | 2217 | yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); |
2171 | yymsg_alloc = yyalloc; | 2218 | if (!yymsg) |
2172 | else | 2219 | { |
2173 | { | 2220 | yymsg = yymsgbuf; |
2174 | yymsg = yymsgbuf; | 2221 | yymsg_alloc = sizeof yymsgbuf; |
2175 | yymsg_alloc = sizeof yymsgbuf; | 2222 | yysyntax_error_status = 2; |
2176 | } | 2223 | } |
2177 | } | 2224 | else |
2178 | 2225 | { | |
2179 | if (0 < yysize && yysize <= yymsg_alloc) | 2226 | yysyntax_error_status = YYSYNTAX_ERROR; |
2180 | { | 2227 | yymsgp = yymsg; |
2181 | (void) yysyntax_error (yymsg, yystate, yychar); | 2228 | } |
2182 | yyerror (yymsg); | 2229 | } |
2183 | } | 2230 | yyerror (yymsgp); |
2184 | else | 2231 | if (yysyntax_error_status == 2) |
2185 | { | 2232 | goto yyexhaustedlab; |
2186 | yyerror (YY_("syntax error")); | ||
2187 | if (yysize != 0) | ||
2188 | goto yyexhaustedlab; | ||
2189 | } | ||
2190 | } | 2233 | } |
2234 | # undef YYSYNTAX_ERROR | ||
2191 | #endif | 2235 | #endif |
2192 | } | 2236 | } |
2193 | 2237 | ||
@@ -2246,7 +2290,7 @@ yyerrlab1: | |||
2246 | for (;;) | 2290 | for (;;) |
2247 | { | 2291 | { |
2248 | yyn = yypact[yystate]; | 2292 | yyn = yypact[yystate]; |
2249 | if (yyn != YYPACT_NINF) | 2293 | if (!yypact_value_is_default (yyn)) |
2250 | { | 2294 | { |
2251 | yyn += YYTERROR; | 2295 | yyn += YYTERROR; |
2252 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | 2296 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
@@ -2305,8 +2349,13 @@ yyexhaustedlab: | |||
2305 | 2349 | ||
2306 | yyreturn: | 2350 | yyreturn: |
2307 | if (yychar != YYEMPTY) | 2351 | if (yychar != YYEMPTY) |
2308 | yydestruct ("Cleanup: discarding lookahead", | 2352 | { |
2309 | yytoken, &yylval); | 2353 | /* Make sure we have latest lookahead translation. See comments at |
2354 | user semantic actions for why this is necessary. */ | ||
2355 | yytoken = YYTRANSLATE (yychar); | ||
2356 | yydestruct ("Cleanup: discarding lookahead", | ||
2357 | yytoken, &yylval); | ||
2358 | } | ||
2310 | /* Do not reclaim the symbols of the rule which action triggered | 2359 | /* Do not reclaim the symbols of the rule which action triggered |
2311 | this YYABORT or YYACCEPT. */ | 2360 | this YYABORT or YYACCEPT. */ |
2312 | YYPOPSTACK (yylen); | 2361 | YYPOPSTACK (yylen); |
@@ -2331,7 +2380,7 @@ yyreturn: | |||
2331 | 2380 | ||
2332 | 2381 | ||
2333 | 2382 | ||
2334 | /* Line 1675 of yacc.c */ | 2383 | /* Line 2067 of yacc.c */ |
2335 | #line 471 "dtc-parser.y" | 2384 | #line 471 "dtc-parser.y" |
2336 | 2385 | ||
2337 | 2386 | ||
diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped index 9d2dce41211f..25d3b88c6132 100644 --- a/scripts/dtc/dtc-parser.tab.h_shipped +++ b/scripts/dtc/dtc-parser.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 |
@@ -70,7 +68,7 @@ | |||
70 | typedef union YYSTYPE | 68 | typedef union YYSTYPE |
71 | { | 69 | { |
72 | 70 | ||
73 | /* Line 1676 of yacc.c */ | 71 | /* Line 2068 of yacc.c */ |
74 | #line 40 "dtc-parser.y" | 72 | #line 40 "dtc-parser.y" |
75 | 73 | ||
76 | char *propnodename; | 74 | char *propnodename; |
@@ -94,8 +92,8 @@ typedef union YYSTYPE | |||
94 | 92 | ||
95 | 93 | ||
96 | 94 | ||
97 | /* Line 1676 of yacc.c */ | 95 | /* Line 2068 of yacc.c */ |
98 | #line 99 "dtc-parser.tab.h" | 96 | #line 97 "dtc-parser.tab.h" |
99 | } YYSTYPE; | 97 | } YYSTYPE; |
100 | # define YYSTYPE_IS_TRIVIAL 1 | 98 | # define YYSTYPE_IS_TRIVIAL 1 |
101 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | 99 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c index 48d382e7e374..38cd69c5660e 100644 --- a/scripts/kconfig/lxdialog/menubox.c +++ b/scripts/kconfig/lxdialog/menubox.c | |||
@@ -303,10 +303,11 @@ do_resize: | |||
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | if (i < max_choice || | 306 | if (item_count() != 0 && |
307 | key == KEY_UP || key == KEY_DOWN || | 307 | (i < max_choice || |
308 | key == '-' || key == '+' || | 308 | key == KEY_UP || key == KEY_DOWN || |
309 | key == KEY_PPAGE || key == KEY_NPAGE) { | 309 | key == '-' || key == '+' || |
310 | key == KEY_PPAGE || key == KEY_NPAGE)) { | ||
310 | /* Remove highligt of current item */ | 311 | /* Remove highligt of current item */ |
311 | print_item(scroll + choice, choice, FALSE); | 312 | print_item(scroll + choice, choice, FALSE); |
312 | 313 | ||
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 387dc8daf7b2..a69cbd78fb38 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -670,11 +670,12 @@ static void conf(struct menu *menu, struct menu *active_menu) | |||
670 | active_menu, &s_scroll); | 670 | active_menu, &s_scroll); |
671 | if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) | 671 | if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) |
672 | break; | 672 | break; |
673 | if (!item_activate_selected()) | 673 | if (item_count() != 0) { |
674 | continue; | 674 | if (!item_activate_selected()) |
675 | if (!item_tag()) | 675 | continue; |
676 | continue; | 676 | if (!item_tag()) |
677 | 677 | continue; | |
678 | } | ||
678 | submenu = item_data(); | 679 | submenu = item_data(); |
679 | active_menu = item_data(); | 680 | active_menu = item_data(); |
680 | if (submenu) | 681 | if (submenu) |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index b5c7d90df9df..fd3f0180e08f 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -146,11 +146,24 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e | |||
146 | struct menu *menu = current_entry; | 146 | struct menu *menu = current_entry; |
147 | 147 | ||
148 | while ((menu = menu->parent) != NULL) { | 148 | while ((menu = menu->parent) != NULL) { |
149 | struct expr *dup_expr; | ||
150 | |||
149 | if (!menu->visibility) | 151 | if (!menu->visibility) |
150 | continue; | 152 | continue; |
153 | /* | ||
154 | * Do not add a reference to the | ||
155 | * menu's visibility expression but | ||
156 | * use a copy of it. Otherwise the | ||
157 | * expression reduction functions | ||
158 | * will modify expressions that have | ||
159 | * multiple references which can | ||
160 | * cause unwanted side effects. | ||
161 | */ | ||
162 | dup_expr = expr_copy(menu->visibility); | ||
163 | |||
151 | prop->visible.expr | 164 | prop->visible.expr |
152 | = expr_alloc_and(prop->visible.expr, | 165 | = expr_alloc_and(prop->visible.expr, |
153 | menu->visibility); | 166 | dup_expr); |
154 | } | 167 | } |
155 | } | 168 | } |
156 | 169 | ||
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index e66d4d258e1a..bb5d115ca671 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c | |||
@@ -177,5 +177,11 @@ int main(void) | |||
177 | DEVID(mei_cl_device_id); | 177 | DEVID(mei_cl_device_id); |
178 | DEVID_FIELD(mei_cl_device_id, name); | 178 | DEVID_FIELD(mei_cl_device_id, name); |
179 | 179 | ||
180 | DEVID(rio_device_id); | ||
181 | DEVID_FIELD(rio_device_id, did); | ||
182 | DEVID_FIELD(rio_device_id, vid); | ||
183 | DEVID_FIELD(rio_device_id, asm_did); | ||
184 | DEVID_FIELD(rio_device_id, asm_vid); | ||
185 | |||
180 | return 0; | 186 | return 0; |
181 | } | 187 | } |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index ab554564569a..23708636b05c 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -1147,6 +1147,26 @@ static int do_mei_entry(const char *filename, void *symval, | |||
1147 | } | 1147 | } |
1148 | ADD_TO_DEVTABLE("mei", mei_cl_device_id, do_mei_entry); | 1148 | ADD_TO_DEVTABLE("mei", mei_cl_device_id, do_mei_entry); |
1149 | 1149 | ||
1150 | /* Looks like: rapidio:vNdNavNadN */ | ||
1151 | static int do_rio_entry(const char *filename, | ||
1152 | void *symval, char *alias) | ||
1153 | { | ||
1154 | DEF_FIELD(symval, rio_device_id, did); | ||
1155 | DEF_FIELD(symval, rio_device_id, vid); | ||
1156 | DEF_FIELD(symval, rio_device_id, asm_did); | ||
1157 | DEF_FIELD(symval, rio_device_id, asm_vid); | ||
1158 | |||
1159 | strcpy(alias, "rapidio:"); | ||
1160 | ADD(alias, "v", vid != RIO_ANY_ID, vid); | ||
1161 | ADD(alias, "d", did != RIO_ANY_ID, did); | ||
1162 | ADD(alias, "av", asm_vid != RIO_ANY_ID, asm_vid); | ||
1163 | ADD(alias, "ad", asm_did != RIO_ANY_ID, asm_did); | ||
1164 | |||
1165 | add_wildcard(alias); | ||
1166 | return 1; | ||
1167 | } | ||
1168 | ADD_TO_DEVTABLE("rapidio", rio_device_id, do_rio_entry); | ||
1169 | |||
1150 | /* Does namelen bytes of name exactly match the symbol? */ | 1170 | /* Does namelen bytes of name exactly match the symbol? */ |
1151 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) | 1171 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) |
1152 | { | 1172 | { |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index a4be8e112bb6..62164348ecf7 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -861,37 +861,34 @@ static void check_section(const char *modname, struct elf_info *elf, | |||
861 | 861 | ||
862 | 862 | ||
863 | #define ALL_INIT_DATA_SECTIONS \ | 863 | #define ALL_INIT_DATA_SECTIONS \ |
864 | ".init.setup$", ".init.rodata$", \ | 864 | ".init.setup$", ".init.rodata$", ".meminit.rodata$", \ |
865 | ".cpuinit.rodata$", ".meminit.rodata$", \ | 865 | ".init.data$", ".meminit.data$" |
866 | ".init.data$", ".cpuinit.data$", ".meminit.data$" | ||
867 | #define ALL_EXIT_DATA_SECTIONS \ | 866 | #define ALL_EXIT_DATA_SECTIONS \ |
868 | ".exit.data$", ".cpuexit.data$", ".memexit.data$" | 867 | ".exit.data$", ".memexit.data$" |
869 | 868 | ||
870 | #define ALL_INIT_TEXT_SECTIONS \ | 869 | #define ALL_INIT_TEXT_SECTIONS \ |
871 | ".init.text$", ".cpuinit.text$", ".meminit.text$" | 870 | ".init.text$", ".meminit.text$" |
872 | #define ALL_EXIT_TEXT_SECTIONS \ | 871 | #define ALL_EXIT_TEXT_SECTIONS \ |
873 | ".exit.text$", ".cpuexit.text$", ".memexit.text$" | 872 | ".exit.text$", ".memexit.text$" |
874 | 873 | ||
875 | #define ALL_PCI_INIT_SECTIONS \ | 874 | #define ALL_PCI_INIT_SECTIONS \ |
876 | ".pci_fixup_early$", ".pci_fixup_header$", ".pci_fixup_final$", \ | 875 | ".pci_fixup_early$", ".pci_fixup_header$", ".pci_fixup_final$", \ |
877 | ".pci_fixup_enable$", ".pci_fixup_resume$", \ | 876 | ".pci_fixup_enable$", ".pci_fixup_resume$", \ |
878 | ".pci_fixup_resume_early$", ".pci_fixup_suspend$" | 877 | ".pci_fixup_resume_early$", ".pci_fixup_suspend$" |
879 | 878 | ||
880 | #define ALL_XXXINIT_SECTIONS CPU_INIT_SECTIONS, MEM_INIT_SECTIONS | 879 | #define ALL_XXXINIT_SECTIONS MEM_INIT_SECTIONS |
881 | #define ALL_XXXEXIT_SECTIONS CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS | 880 | #define ALL_XXXEXIT_SECTIONS MEM_EXIT_SECTIONS |
882 | 881 | ||
883 | #define ALL_INIT_SECTIONS INIT_SECTIONS, ALL_XXXINIT_SECTIONS | 882 | #define ALL_INIT_SECTIONS INIT_SECTIONS, ALL_XXXINIT_SECTIONS |
884 | #define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS | 883 | #define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS |
885 | 884 | ||
886 | #define DATA_SECTIONS ".data$", ".data.rel$" | 885 | #define DATA_SECTIONS ".data$", ".data.rel$" |
887 | #define TEXT_SECTIONS ".text$" | 886 | #define TEXT_SECTIONS ".text$", ".text.unlikely$" |
888 | 887 | ||
889 | #define INIT_SECTIONS ".init.*" | 888 | #define INIT_SECTIONS ".init.*" |
890 | #define CPU_INIT_SECTIONS ".cpuinit.*" | ||
891 | #define MEM_INIT_SECTIONS ".meminit.*" | 889 | #define MEM_INIT_SECTIONS ".meminit.*" |
892 | 890 | ||
893 | #define EXIT_SECTIONS ".exit.*" | 891 | #define EXIT_SECTIONS ".exit.*" |
894 | #define CPU_EXIT_SECTIONS ".cpuexit.*" | ||
895 | #define MEM_EXIT_SECTIONS ".memexit.*" | 892 | #define MEM_EXIT_SECTIONS ".memexit.*" |
896 | 893 | ||
897 | /* init data sections */ | 894 | /* init data sections */ |
@@ -979,48 +976,20 @@ const struct sectioncheck sectioncheck[] = { | |||
979 | .mismatch = DATA_TO_ANY_EXIT, | 976 | .mismatch = DATA_TO_ANY_EXIT, |
980 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 977 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
981 | }, | 978 | }, |
982 | /* Do not reference init code/data from cpuinit/meminit code/data */ | 979 | /* Do not reference init code/data from meminit code/data */ |
983 | { | 980 | { |
984 | .fromsec = { ALL_XXXINIT_SECTIONS, NULL }, | 981 | .fromsec = { ALL_XXXINIT_SECTIONS, NULL }, |
985 | .tosec = { INIT_SECTIONS, NULL }, | 982 | .tosec = { INIT_SECTIONS, NULL }, |
986 | .mismatch = XXXINIT_TO_SOME_INIT, | 983 | .mismatch = XXXINIT_TO_SOME_INIT, |
987 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 984 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
988 | }, | 985 | }, |
989 | /* Do not reference cpuinit code/data from meminit code/data */ | 986 | /* Do not reference exit code/data from memexit code/data */ |
990 | { | ||
991 | .fromsec = { MEM_INIT_SECTIONS, NULL }, | ||
992 | .tosec = { CPU_INIT_SECTIONS, NULL }, | ||
993 | .mismatch = XXXINIT_TO_SOME_INIT, | ||
994 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | ||
995 | }, | ||
996 | /* Do not reference meminit code/data from cpuinit code/data */ | ||
997 | { | ||
998 | .fromsec = { CPU_INIT_SECTIONS, NULL }, | ||
999 | .tosec = { MEM_INIT_SECTIONS, NULL }, | ||
1000 | .mismatch = XXXINIT_TO_SOME_INIT, | ||
1001 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | ||
1002 | }, | ||
1003 | /* Do not reference exit code/data from cpuexit/memexit code/data */ | ||
1004 | { | 987 | { |
1005 | .fromsec = { ALL_XXXEXIT_SECTIONS, NULL }, | 988 | .fromsec = { ALL_XXXEXIT_SECTIONS, NULL }, |
1006 | .tosec = { EXIT_SECTIONS, NULL }, | 989 | .tosec = { EXIT_SECTIONS, NULL }, |
1007 | .mismatch = XXXEXIT_TO_SOME_EXIT, | 990 | .mismatch = XXXEXIT_TO_SOME_EXIT, |
1008 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 991 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
1009 | }, | 992 | }, |
1010 | /* Do not reference cpuexit code/data from memexit code/data */ | ||
1011 | { | ||
1012 | .fromsec = { MEM_EXIT_SECTIONS, NULL }, | ||
1013 | .tosec = { CPU_EXIT_SECTIONS, NULL }, | ||
1014 | .mismatch = XXXEXIT_TO_SOME_EXIT, | ||
1015 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | ||
1016 | }, | ||
1017 | /* Do not reference memexit code/data from cpuexit code/data */ | ||
1018 | { | ||
1019 | .fromsec = { CPU_EXIT_SECTIONS, NULL }, | ||
1020 | .tosec = { MEM_EXIT_SECTIONS, NULL }, | ||
1021 | .mismatch = XXXEXIT_TO_SOME_EXIT, | ||
1022 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | ||
1023 | }, | ||
1024 | /* Do not use exit code/data from init code */ | 993 | /* Do not use exit code/data from init code */ |
1025 | { | 994 | { |
1026 | .fromsec = { ALL_INIT_SECTIONS, NULL }, | 995 | .fromsec = { ALL_INIT_SECTIONS, NULL }, |
@@ -1089,8 +1058,6 @@ static const struct sectioncheck *section_mismatch( | |||
1089 | * Pattern 2: | 1058 | * Pattern 2: |
1090 | * Many drivers utilise a *driver container with references to | 1059 | * Many drivers utilise a *driver container with references to |
1091 | * add, remove, probe functions etc. | 1060 | * add, remove, probe functions etc. |
1092 | * These functions may often be marked __cpuinit and we do not want to | ||
1093 | * warn here. | ||
1094 | * the pattern is identified by: | 1061 | * the pattern is identified by: |
1095 | * tosec = init or exit section | 1062 | * tosec = init or exit section |
1096 | * fromsec = data section | 1063 | * fromsec = data section |
@@ -1249,7 +1216,6 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, | |||
1249 | /* | 1216 | /* |
1250 | * Convert a section name to the function/data attribute | 1217 | * Convert a section name to the function/data attribute |
1251 | * .init.text => __init | 1218 | * .init.text => __init |
1252 | * .cpuinit.data => __cpudata | ||
1253 | * .memexitconst => __memconst | 1219 | * .memexitconst => __memconst |
1254 | * etc. | 1220 | * etc. |
1255 | * | 1221 | * |
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 84a406070f6f..a4f31c900fa6 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
@@ -63,7 +63,7 @@ binrpm-pkg: FORCE | |||
63 | mv -f $(objtree)/.tmp_version $(objtree)/.version | 63 | mv -f $(objtree)/.tmp_version $(objtree)/.version |
64 | 64 | ||
65 | $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \ | 65 | $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \ |
66 | $(UTS_MACHINE) -bb $< | 66 | $(UTS_MACHINE) -bb $(objtree)/binkernel.spec |
67 | rm binkernel.spec | 67 | rm binkernel.spec |
68 | 68 | ||
69 | # Deb target | 69 | # Deb target |
diff --git a/scripts/sortextable.c b/scripts/sortextable.c index 1f10e89d15b4..f9ce1160419b 100644 --- a/scripts/sortextable.c +++ b/scripts/sortextable.c | |||
@@ -31,6 +31,10 @@ | |||
31 | #include <tools/be_byteshift.h> | 31 | #include <tools/be_byteshift.h> |
32 | #include <tools/le_byteshift.h> | 32 | #include <tools/le_byteshift.h> |
33 | 33 | ||
34 | #ifndef EM_AARCH64 | ||
35 | #define EM_AARCH64 183 | ||
36 | #endif | ||
37 | |||
34 | static int fd_map; /* File descriptor for file being modified. */ | 38 | static int fd_map; /* File descriptor for file being modified. */ |
35 | static int mmap_failed; /* Boolean flag. */ | 39 | static int mmap_failed; /* Boolean flag. */ |
36 | static void *ehdr_curr; /* current ElfXX_Ehdr * for resource cleanup */ | 40 | static void *ehdr_curr; /* current ElfXX_Ehdr * for resource cleanup */ |
@@ -249,6 +253,7 @@ do_file(char const *const fname) | |||
249 | custom_sort = sort_relative_table; | 253 | custom_sort = sort_relative_table; |
250 | break; | 254 | break; |
251 | case EM_ARM: | 255 | case EM_ARM: |
256 | case EM_AARCH64: | ||
252 | case EM_MIPS: | 257 | case EM_MIPS: |
253 | break; | 258 | break; |
254 | } /* end switch */ | 259 | } /* end switch */ |