diff options
author | Paul Moore <pmoore@redhat.com> | 2014-06-18 01:30:23 +0400 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2014-06-18 01:30:23 +0400 |
commit | 170b5910d9fbea79de1bb40df22eda5f98250c0c (patch) | |
tree | ca9560e878d2842d45c6f99077d0d8b8f8b0f9ba /scripts | |
parent | 47dd0b76ace953bd2c0479076db0d3e3b9594003 (diff) | |
parent | 1860e379875dfe7271c649058aeddffe5afd9d0d (diff) | |
download | linux-170b5910d9fbea79de1bb40df22eda5f98250c0c.tar.xz |
Merge tag 'v3.15' into next
Linux 3.15
Diffstat (limited to 'scripts')
43 files changed, 1651 insertions, 973 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 547e15daf03d..122f95c95869 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -3,6 +3,7 @@ # Convenient variables comma := , +quote := " squote := ' empty := space := $(empty) $(empty) @@ -155,6 +156,15 @@ ld-option = $(call try-run,\ # Important: no spaces around options ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2)) +# ld-version +# Usage: $(call ld-version) +# Note this is mainly for HJ Lu's 3 number binutil versions +ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh) + +# ld-ifversion +# Usage: $(call ld-ifversion, -ge, 22252, y) +ld-ifversion = $(shell [ $(call ld-version) $(1) $(2) ] && echo $(3)) + ###### ### diff --git a/scripts/Makefile b/scripts/Makefile index 01e7adb838d9..1d07860f6c42 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -27,10 +27,10 @@ always := $(hostprogs-y) $(hostprogs-m) hostprogs-y += unifdef docproc # These targets are used internally to avoid "is up to date" messages -PHONY += build_unifdef -build_unifdef: scripts/unifdef FORCE +PHONY += build_unifdef build_docproc +build_unifdef: $(obj)/unifdef @: -build_docproc: scripts/docproc FORCE +build_docproc: $(obj)/docproc @: subdir-$(CONFIG_MODVERSIONS) += genksyms diff --git a/scripts/Makefile.build b/scripts/Makefile.build index d5d859c80729..003bc263105a 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -65,12 +65,22 @@ warning- := $(empty) warning-1 := -Wextra -Wunused -Wno-unused-parameter warning-1 += -Wmissing-declarations warning-1 += -Wmissing-format-attribute -warning-1 += -Wmissing-prototypes +warning-1 += $(call cc-option, -Wmissing-prototypes) warning-1 += -Wold-style-definition warning-1 += $(call cc-option, -Wmissing-include-dirs) warning-1 += $(call cc-option, -Wunused-but-set-variable) warning-1 += $(call cc-disable-warning, missing-field-initializers) +# Clang +warning-1 += $(call cc-disable-warning, initializer-overrides) +warning-1 += $(call cc-disable-warning, unused-value) +warning-1 += $(call cc-disable-warning, format) +warning-1 += $(call cc-disable-warning, unknown-warning-option) +warning-1 += $(call cc-disable-warning, sign-compare) +warning-1 += $(call cc-disable-warning, format-zero-length) +warning-1 += $(call cc-disable-warning, uninitialized) +warning-1 += $(call cc-option, -fcatch-undefined-behavior) + warning-2 := -Waggregate-return warning-2 += -Wcast-align warning-2 += -Wdisabled-optimization @@ -198,7 +208,7 @@ $(multi-objs-y:.o=.s) : modname = $(modname-multi) $(multi-objs-y:.o=.lst) : modname = $(modname-multi) quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ -cmd_cc_s_c = $(CC) $(c_flags) -fverbose-asm -S -o $@ $< +cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $< $(obj)/%.s: $(src)/%.c FORCE $(call if_changed_dep,cc_s_c) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 79c059e70860..6a5b0decb797 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -274,6 +274,18 @@ $(obj)/%.dtb: $(src)/%.dts FORCE dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) +# Helper targets for Installing DTBs into the boot directory +quiet_cmd_dtb_install = INSTALL $< + cmd_dtb_install = cp $< $(2) + +_dtbinst_pre_: + $(Q)if [ -d $(INSTALL_DTBS_PATH).old ]; then rm -rf $(INSTALL_DTBS_PATH).old; fi + $(Q)if [ -d $(INSTALL_DTBS_PATH) ]; then mv $(INSTALL_DTBS_PATH) $(INSTALL_DTBS_PATH).old; fi + $(Q)mkdir -p $(INSTALL_DTBS_PATH) + +%.dtb_dtbinst_: $(obj)/%.dtb _dtbinst_pre_ + $(call cmd,dtb_install,$(INSTALL_DTBS_PATH)) + # Bzip2 # --------------------------------------------------------------------------- @@ -368,7 +380,3 @@ quiet_cmd_xzmisc = XZMISC $@ cmd_xzmisc = (cat $(filter-out FORCE,$^) | \ xz --check=crc32 --lzma2=dict=1MiB) > $@ || \ (rm -f $@ ; false) - -# misc stuff -# --------------------------------------------------------------------------- -quote:=" diff --git a/scripts/bootgraph.pl b/scripts/bootgraph.pl index b78fca994a15..9ca667bcaee9 100644 --- a/scripts/bootgraph.pl +++ b/scripts/bootgraph.pl @@ -38,6 +38,31 @@ # use strict; +use Getopt::Long; +my $header = 0; + +sub help { + my $text = << "EOM"; +Usage: +1) dmesg | perl scripts/bootgraph.pl [OPTION] > output.svg +2) perl scripts/bootgraph.pl -h + +Options: + -header Insert kernel version and date +EOM + my $std=shift; + if ($std == 1) { + print STDERR $text; + } else { + print $text; + } + exit; +} + +GetOptions( + 'h|help' =>\&help, + 'header' =>\$header +); my %start; my %end; @@ -49,6 +74,11 @@ my $count = 0; my %pids; my %pidctr; +my $headerstep = 20; +my $xheader = 15; +my $yheader = 25; +my $cyheader = 0; + while (<>) { my $line = $_; if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_\.]+)\+/) { @@ -112,15 +142,23 @@ if ($count == 0) { print STDERR <<END; No data found in the dmesg. Make sure that 'printk.time=1' and 'initcall_debug' are passed on the kernel command line. -Usage: - dmesg | perl scripts/bootgraph.pl > output.svg END + help(1); exit 1; } print "<?xml version=\"1.0\" standalone=\"no\"?> \n"; print "<svg width=\"2000\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n"; + +if ($header) { + my $version = `uname -a`; + my $date = `date`; + print "<text transform=\"translate($xheader,$yheader)\">Kernel version: $version</text>\n"; + $cyheader = $yheader+$headerstep; + print "<text transform=\"translate($xheader,$cyheader)\">Date: $date</text>\n"; +} + my @styles; $styles[0] = "fill:rgb(0,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 464dcef79b35..34eb2160489d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -281,7 +281,7 @@ our $Attribute = qr{ __weak }x; our $Modifier; -our $Inline = qr{inline|__always_inline|noinline}; +our $Inline = qr{inline|__always_inline|noinline|__inline|__inline__}; our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]}; our $Lval = qr{$Ident(?:$Member)*}; @@ -289,13 +289,14 @@ our $Int_type = qr{(?i)llu|ull|ll|lu|ul|l|u}; our $Binary = qr{(?i)0b[01]+$Int_type?}; our $Hex = qr{(?i)0x[0-9a-f]+$Int_type?}; our $Int = qr{[0-9]+$Int_type?}; +our $Octal = qr{0[0-7]+$Int_type?}; our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?}; our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?}; our $Float_int = qr{(?i)[0-9]+e-?[0-9]+[fl]?}; our $Float = qr{$Float_hex|$Float_dec|$Float_int}; -our $Constant = qr{$Float|$Binary|$Hex|$Int}; +our $Constant = qr{$Float|$Binary|$Octal|$Hex|$Int}; our $Assignment = qr{\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=}; -our $Compare = qr{<=|>=|==|!=|<|>}; +our $Compare = qr{<=|>=|==|!=|<|(?<!-)>}; our $Arithmetic = qr{\+|-|\*|\/|%}; our $Operators = qr{ <=|>=|==|!=| @@ -303,6 +304,8 @@ our $Operators = qr{ &&|\|\||,|\^|\+\+|--|&|\||$Arithmetic }x; +our $c90_Keywords = qr{do|for|while|if|else|return|goto|continue|switch|default|case|break}x; + our $NonptrType; our $NonptrTypeWithAttr; our $Type; @@ -378,6 +381,22 @@ our @modifierList = ( qr{fastcall}, ); +our @mode_permission_funcs = ( + ["module_param", 3], + ["module_param_(?:array|named|string)", 4], + ["module_param_array_named", 5], + ["debugfs_create_(?:file|u8|u16|u32|u64|x8|x16|x32|x64|size_t|atomic_t|bool|blob|regset32|u32_array)", 2], + ["proc_create(?:_data|)", 2], + ["(?:CLASS|DEVICE|SENSOR)_ATTR", 2], +); + +#Create a search pattern for all these functions to speed up a loop below +our $mode_perms_search = ""; +foreach my $entry (@mode_permission_funcs) { + $mode_perms_search .= '|' if ($mode_perms_search ne ""); + $mode_perms_search .= $entry->[0]; +} + our $allowed_asm_includes = qr{(?x: irq| memory @@ -412,7 +431,7 @@ sub build_types { (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*|\[\])+|(?:\s*\[\s*\])+)? (?:\s+$Inline|\s+$Modifier)* }x; - $Declare = qr{(?:$Storage\s+)?$Type}; + $Declare = qr{(?:$Storage\s+(?:$Inline\s+)?)?$Type}; } build_types(); @@ -423,15 +442,20 @@ our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*}; # Any use must be runtime checked with $^V our $balanced_parens = qr/(\((?:[^\(\)]++|(?-1))*\))/; -our $LvalOrFunc = qr{($Lval)\s*($balanced_parens{0,1})\s*}; +our $LvalOrFunc = qr{((?:[\&\*]\s*)?$Lval)\s*($balanced_parens{0,1})\s*}; our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant)}; sub deparenthesize { my ($string) = @_; return "" if (!defined($string)); - $string =~ s@^\s*\(\s*@@g; - $string =~ s@\s*\)\s*$@@g; + + while ($string =~ /^\s*\(.*\)\s*$/) { + $string =~ s@^\s*\(\s*@@; + $string =~ s@\s*\)\s*$@@; + } + $string =~ s@\s+@ @g; + return $string; } @@ -1421,21 +1445,25 @@ sub possible { my $prefix = ''; sub show_type { - return defined $use_type{$_[0]} if (scalar keys %use_type > 0); + my ($type) = @_; + + return defined $use_type{$type} if (scalar keys %use_type > 0); - return !defined $ignore_type{$_[0]}; + return !defined $ignore_type{$type}; } sub report { - if (!show_type($_[1]) || - (defined $tst_only && $_[2] !~ /\Q$tst_only\E/)) { + my ($level, $type, $msg) = @_; + + if (!show_type($type) || + (defined $tst_only && $msg !~ /\Q$tst_only\E/)) { return 0; } my $line; if ($show_types) { - $line = "$prefix$_[0]:$_[1]: $_[2]\n"; + $line = "$prefix$level:$type: $msg\n"; } else { - $line = "$prefix$_[0]: $_[2]\n"; + $line = "$prefix$level: $msg\n"; } $line = (split('\n', $line))[0] . "\n" if ($terse); @@ -1443,12 +1471,15 @@ sub report { return 1; } + sub report_dump { our @report; } sub ERROR { - if (report("ERROR", $_[0], $_[1])) { + my ($type, $msg) = @_; + + if (report("ERROR", $type, $msg)) { our $clean = 0; our $cnt_error++; return 1; @@ -1456,7 +1487,9 @@ sub ERROR { return 0; } sub WARN { - if (report("WARNING", $_[0], $_[1])) { + my ($type, $msg) = @_; + + if (report("WARNING", $type, $msg)) { our $clean = 0; our $cnt_warn++; return 1; @@ -1464,7 +1497,9 @@ sub WARN { return 0; } sub CHK { - if ($check && report("CHECK", $_[0], $_[1])) { + my ($type, $msg) = @_; + + if ($check && report("CHECK", $type, $msg)) { our $clean = 0; our $cnt_chk++; return 1; @@ -1574,7 +1609,7 @@ sub pos_last_openparen { } } - return $last_openparen + 1; + return length(expand_tabs(substr($line, 0, $last_openparen))) + 1; } sub process { @@ -1891,6 +1926,12 @@ sub process { } } +# Check for unwanted Gerrit info + if ($in_commit_log && $line =~ /^\s*change-id:/i) { + ERROR("GERRIT_CHANGE_ID", + "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr); + } + # Check for wrappage within a valid hunk of the file if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) { ERROR("CORRUPTED_PATCH", @@ -2041,13 +2082,17 @@ sub process { } # check for DT compatible documentation - if (defined $root && $realfile =~ /\.dts/ && - $rawline =~ /^\+\s*compatible\s*=/) { + if (defined $root && + (($realfile =~ /\.dtsi?$/ && $line =~ /^\+\s*compatible\s*=\s*\"/) || + ($realfile =~ /\.[ch]$/ && $line =~ /^\+.*\.compatible\s*=\s*\"/))) { + my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g; + my $dt_path = $root . "/Documentation/devicetree/bindings/"; + my $vp_file = $dt_path . "vendor-prefixes.txt"; + foreach my $compat (@compats) { my $compat2 = $compat; - my $dt_path = $root . "/Documentation/devicetree/bindings/"; $compat2 =~ s/\,[a-z]*\-/\,<\.\*>\-/; `grep -Erq "$compat|$compat2" $dt_path`; if ( $? >> 8 ) { @@ -2055,14 +2100,12 @@ sub process { "DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr); } - my $vendor = $compat; - my $vendor_path = $dt_path . "vendor-prefixes.txt"; - next if (! -f $vendor_path); - $vendor =~ s/^([a-zA-Z0-9]+)\,.*/$1/; - `grep -Eq "$vendor" $vendor_path`; + next if $compat !~ /^([a-zA-Z0-9\-]+)\,/; + my $vendor = $1; + `grep -Eq "^$vendor\\b" $vp_file`; if ( $? >> 8 ) { WARN("UNDOCUMENTED_DT_STRING", - "DT compatible string vendor \"$vendor\" appears un-documented -- check $vendor_path\n" . $herecurr); + "DT compatible string vendor \"$vendor\" appears un-documented -- check $vp_file\n" . $herecurr); } } } @@ -2159,7 +2202,7 @@ sub process { # check multi-line statement indentation matches previous line if ($^V && $^V ge 5.10.0 && - $prevline =~ /^\+(\t*)(if \(|$Ident\().*(\&\&|\|\||,)\s*$/) { + $prevline =~ /^\+([ \t]*)((?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|$Ident\s*=\s*$Ident\s*)\(.*(\&\&|\|\||,)\s*$/) { $prevline =~ /^\+(\t*)(.*)$/; my $oldindent = $1; my $rest = $2; @@ -2198,7 +2241,8 @@ sub process { if ($realfile =~ m@^(drivers/net/|net/)@ && $prevrawline =~ /^\+[ \t]*\/\*[ \t]*$/ && - $rawline =~ /^\+[ \t]*\*/) { + $rawline =~ /^\+[ \t]*\*/ && + $realline > 2) { WARN("NETWORKING_BLOCK_COMMENT_STYLE", "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev); } @@ -2221,6 +2265,21 @@ sub process { "networking block comments put the trailing */ on a separate line\n" . $herecurr); } +# check for missing blank lines after declarations + if ($realfile =~ m@^(drivers/net/|net/)@ && + $prevline =~ /^\+\s+$Declare\s+$Ident/ && + !($prevline =~ /(?:$Compare|$Assignment|$Operators)\s*$/ || + $prevline =~ /(?:\{\s*|\\)$/) && #extended lines + $sline =~ /^\+\s+/ && #Not at char 1 + !($sline =~ /^\+\s+$Declare/ || + $sline =~ /^\+\s+$Ident\s+$Ident/ || #eg: typedef foo + $sline =~ /^\+\s+(?:union|struct|enum|typedef)\b/ || + $sline =~ /^\+\s+(?:$|[\{\}\.\#\"\?\:\(])/ || + $sline =~ /^\+\s+\(?\s*(?:$Compare|$Assignment|$Operators)/)) { + WARN("SPACING", + "networking uses a blank line after declarations\n" . $hereprev); + } + # check for spaces at the beginning of a line. # Exceptions: # 1) within comments @@ -2665,6 +2724,13 @@ sub process { $herecurr); } +# check for non-global char *foo[] = {"bar", ...} declarations. + if ($line =~ /^.\s+(?:static\s+|const\s+)?char\s+\*\s*\w+\s*\[\s*\]\s*=\s*\{/) { + WARN("STATIC_CONST_CHAR_ARRAY", + "char * array declaration might be better as static const\n" . + $herecurr); + } + # check for function declarations without arguments like "int foo()" if ($line =~ /(\b$Type\s+$Ident)\s*\(\s*\)/) { if (ERROR("FUNCTION_WITHOUT_ARGS", @@ -2799,7 +2865,7 @@ sub process { my $level2 = $level; $level2 = "dbg" if ($level eq "debug"); WARN("PREFER_PR_LEVEL", - "Prefer netdev_$level2(netdev, ... then dev_$level2(dev, ... then pr_$level(... to printk(KERN_$orig ...\n" . $herecurr); + "Prefer [subsystem eg: netdev]_$level2([subsystem]dev, ... then dev_$level2(dev, ... then pr_$level(... to printk(KERN_$orig ...\n" . $herecurr); } if ($line =~ /\bpr_warning\s*\(/) { @@ -2848,10 +2914,7 @@ sub process { # Function pointer declarations # check spacing between type, funcptr, and args # canonical declaration is "type (*funcptr)(args...)" -# -# the $Declare variable will capture all spaces after the type -# so check it for trailing missing spaces or multiple spaces - if ($line =~ /^.\s*($Declare)\((\s*)\*(\s*)$Ident(\s*)\)(\s*)\(/) { + if ($line =~ /^.\s*($Declare)\((\s*)\*(\s*)($Ident)(\s*)\)(\s*)\(/) { my $declare = $1; my $pre_pointer_space = $2; my $post_pointer_space = $3; @@ -2859,16 +2922,30 @@ sub process { my $post_funcname_space = $5; my $pre_args_space = $6; - if ($declare !~ /\s$/) { +# the $Declare variable will capture all spaces after the type +# so check it for a missing trailing missing space but pointer return types +# don't need a space so don't warn for those. + my $post_declare_space = ""; + if ($declare =~ /(\s+)$/) { + $post_declare_space = $1; + $declare = rtrim($declare); + } + if ($declare !~ /\*$/ && $post_declare_space =~ /^$/) { WARN("SPACING", "missing space after return type\n" . $herecurr); + $post_declare_space = " "; } # unnecessary space "type (*funcptr)(args...)" - elsif ($declare =~ /\s{2,}$/) { - WARN("SPACING", - "Multiple spaces after return type\n" . $herecurr); - } +# This test is not currently implemented because these declarations are +# equivalent to +# int foo(int bar, ...) +# and this is form shouldn't/doesn't generate a checkpatch warning. +# +# elsif ($declare =~ /\s{2,}$/) { +# WARN("SPACING", +# "Multiple spaces after return type\n" . $herecurr); +# } # unnecessary space "type ( *funcptr)(args...)" if (defined $pre_pointer_space && @@ -2900,7 +2977,7 @@ sub process { if (show_type("SPACING") && $fix) { $fixed[$linenr - 1] =~ - s/^(.\s*$Declare)\(\s*\*\s*($Ident)\s*\)\s*\(/rtrim($1) . " " . "\(\*$2\)\("/ex; + s/^(.\s*)$Declare\s*\(\s*\*\s*$Ident\s*\)\s*\(/$1 . $declare . $post_declare_space . '(*' . $funcname . ')('/ex; } } @@ -3061,10 +3138,13 @@ sub process { # // is a comment } elsif ($op eq '//') { + # : when part of a bitfield + } elsif ($opv eq ':B') { + # skip the bitfield test for now + # No spaces for: # -> - # : when part of a bitfield - } elsif ($op eq '->' || $opv eq ':B') { + } elsif ($op eq '->') { if ($ctx =~ /Wx.|.xW/) { if (ERROR("SPACING", "spaces prohibited around that '$op' $at\n" . $hereptr)) { @@ -3334,14 +3414,17 @@ sub process { } } -# Return is not a function. +# return is not a function if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) { my $spacing = $1; if ($^V && $^V ge 5.10.0 && - $stat =~ /^.\s*return\s*$balanced_parens\s*;\s*$/) { - ERROR("RETURN_PARENTHESES", - "return is not a function, parentheses are not required\n" . $herecurr); - + $stat =~ /^.\s*return\s*($balanced_parens)\s*;\s*$/) { + my $value = $1; + $value = deparenthesize($value); + if ($value =~ m/^\s*$FuncArg\s*(?:\?|$)/) { + ERROR("RETURN_PARENTHESES", + "return is not a function, parentheses are not required\n" . $herecurr); + } } elsif ($spacing !~ /\s+/) { ERROR("SPACING", "space required before the open parenthesis '('\n" . $herecurr); @@ -3910,12 +3993,30 @@ sub process { } } +# don't use __constant_<foo> functions outside of include/uapi/ + if ($realfile !~ m@^include/uapi/@ && + $line =~ /(__constant_(?:htons|ntohs|[bl]e(?:16|32|64)_to_cpu|cpu_to_[bl]e(?:16|32|64)))\s*\(/) { + my $constant_func = $1; + my $func = $constant_func; + $func =~ s/^__constant_//; + if (WARN("CONSTANT_CONVERSION", + "$constant_func should be $func\n" . $herecurr) && + $fix) { + $fixed[$linenr - 1] =~ s/\b$constant_func\b/$func/g; + } + } + # prefer usleep_range over udelay if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) { + my $delay = $1; # ignore udelay's < 10, however - if (! ($1 < 10) ) { + if (! ($delay < 10) ) { CHK("USLEEP_RANGE", - "usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt\n" . $line); + "usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt\n" . $herecurr); + } + if ($delay > 2000) { + WARN("LONG_UDELAY", + "long udelay - prefer mdelay; see arch/arm/include/asm/delay.h\n" . $herecurr); } } @@ -3923,7 +4024,7 @@ sub process { if ($line =~ /\bmsleep\s*\((\d+)\);/) { if ($1 < 20) { WARN("MSLEEP", - "msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt\n" . $line); + "msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt\n" . $herecurr); } } @@ -4149,7 +4250,7 @@ sub process { # check for naked sscanf if ($^V && $^V ge 5.10.0 && defined $stat && - $stat =~ /\bsscanf\b/ && + $line =~ /\bsscanf\b/ && ($stat !~ /$Ident\s*=\s*sscanf\s*$balanced_parens/ && $stat !~ /\bsscanf\s*$balanced_parens\s*(?:$Compare)/ && $stat !~ /(?:$Compare)\s*\bsscanf\s*$balanced_parens/)) { @@ -4240,12 +4341,6 @@ sub process { "$1 uses number as first arg, sizeof is generally wrong\n" . $herecurr); } -# check for GFP_NOWAIT use - if ($line =~ /\b__GFP_NOFAIL\b/) { - WARN("__GFP_NOFAIL", - "Use of __GFP_NOFAIL is deprecated, no new users should be added\n" . $herecurr); - } - # check for multiple semicolons if ($line =~ /;\s*;\s*$/) { if (WARN("ONE_SEMICOLON", @@ -4457,6 +4552,34 @@ sub process { WARN("EXPORTED_WORLD_WRITABLE", "Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr); } + +# Mode permission misuses where it seems decimal should be octal +# This uses a shortcut match to avoid unnecessary uses of a slow foreach loop + if ($^V && $^V ge 5.10.0 && + $line =~ /$mode_perms_search/) { + foreach my $entry (@mode_permission_funcs) { + my $func = $entry->[0]; + my $arg_pos = $entry->[1]; + + my $skip_args = ""; + if ($arg_pos > 1) { + $arg_pos--; + $skip_args = "(?:\\s*$FuncArg\\s*,\\s*){$arg_pos,$arg_pos}"; + } + my $test = "\\b$func\\s*\\(${skip_args}([\\d]+)\\s*[,\\)]"; + if ($line =~ /$test/) { + my $val = $1; + $val = $6 if ($skip_args ne ""); + + if ($val !~ /^0$/ && + (($val =~ /^$Int$/ && $val !~ /^$Octal$/) || + length($val) ne 4)) { + ERROR("NON_OCTAL_PERMISSIONS", + "Use 4 digit octal (0777) not decimal permissions\n" . $herecurr); + } + } + } + } } # If we have no input at all, then there is nothing to report on diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh index fd8fa9aa7c4e..5b3add31f9f1 100755 --- a/scripts/checksyscalls.sh +++ b/scripts/checksyscalls.sh @@ -25,7 +25,7 @@ cat << EOF #define __IGNORE_rmdir /* unlinkat */ #define __IGNORE_lchown /* fchownat */ #define __IGNORE_access /* faccessat */ -#define __IGNORE_rename /* renameat */ +#define __IGNORE_rename /* renameat2 */ #define __IGNORE_readlink /* readlinkat */ #define __IGNORE_symlink /* symlinkat */ #define __IGNORE_utimes /* futimesat */ @@ -37,6 +37,9 @@ cat << EOF #define __IGNORE_lstat64 /* fstatat64 */ #endif +/* Missing flags argument */ +#define __IGNORE_renameat /* renameat2 */ + /* CLOEXEC flag */ #define __IGNORE_pipe /* pipe2 */ #define __IGNORE_dup2 /* dup3 */ diff --git a/scripts/coccinelle/api/ptr_ret.cocci b/scripts/coccinelle/api/ptr_ret.cocci index e18f8402e37c..dd58dab5d411 100644 --- a/scripts/coccinelle/api/ptr_ret.cocci +++ b/scripts/coccinelle/api/ptr_ret.cocci @@ -7,7 +7,7 @@ // URL: http://coccinelle.lip6.fr/ // Options: --no-includes --include-headers // -// Keywords: ERR_PTR, PTR_ERR, PTR_RET, PTR_ERR_OR_ZERO +// Keywords: ERR_PTR, PTR_ERR, PTR_ERR_OR_ZERO // Version min: 2.6.39 // @@ -62,35 +62,35 @@ position p3; p << r1.p1; @@ -coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") +coccilib.org.print_todo(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") @script:python depends on org@ p << r2.p2; @@ -coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") +coccilib.org.print_todo(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") @script:python depends on org@ p << r3.p3; @@ -coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") +coccilib.org.print_todo(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") @script:python depends on report@ p << r1.p1; @@ -coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") +coccilib.report.print_report(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") @script:python depends on report@ p << r2.p2; @@ -coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") +coccilib.report.print_report(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") @script:python depends on report@ p << r3.p3; @@ -coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") +coccilib.report.print_report(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") diff --git a/scripts/coccinelle/misc/memcpy-assign.cocci b/scripts/coccinelle/misc/memcpy-assign.cocci deleted file mode 100644 index afd058be497f..000000000000 --- a/scripts/coccinelle/misc/memcpy-assign.cocci +++ /dev/null @@ -1,103 +0,0 @@ -// -// Replace memcpy with struct assignment. -// -// Confidence: High -// Copyright: (C) 2012 Peter Senna Tschudin, INRIA/LIP6. GPLv2. -// URL: http://coccinelle.lip6.fr/ -// Comments: -// Options: --no-includes --include-headers - -virtual patch -virtual report -virtual context -virtual org - -@r1 depends on !patch@ -identifier struct_name; -struct struct_name to; -struct struct_name from; -struct struct_name *top; -struct struct_name *fromp; -position p; -@@ -memcpy@p(\(&(to)\|top\), \(&(from)\|fromp\), \(sizeof(to)\|sizeof(from)\|sizeof(struct struct_name)\|sizeof(*top)\|sizeof(*fromp)\)) - -@script:python depends on report@ -p << r1.p; -@@ -coccilib.report.print_report(p[0],"Replace memcpy with struct assignment") - -@depends on context@ -position r1.p; -@@ -*memcpy@p(...); - -@script:python depends on org@ -p << r1.p; -@@ -cocci.print_main("Replace memcpy with struct assignment",p) - -@depends on patch@ -identifier struct_name; -struct struct_name to; -struct struct_name from; -@@ -( --memcpy(&(to), &(from), sizeof(to)); -+to = from; -| --memcpy(&(to), &(from), sizeof(from)); -+to = from; -| --memcpy(&(to), &(from), sizeof(struct struct_name)); -+to = from; -) - -@depends on patch@ -identifier struct_name; -struct struct_name to; -struct struct_name *from; -@@ -( --memcpy(&(to), from, sizeof(to)); -+to = *from; -| --memcpy(&(to), from, sizeof(*from)); -+to = *from; -| --memcpy(&(to), from, sizeof(struct struct_name)); -+to = *from; -) - -@depends on patch@ -identifier struct_name; -struct struct_name *to; -struct struct_name from; -@@ -( --memcpy(to, &(from), sizeof(*to)); -+ *to = from; -| --memcpy(to, &(from), sizeof(from)); -+ *to = from; -| --memcpy(to, &(from), sizeof(struct struct_name)); -+ *to = from; -) - -@depends on patch@ -identifier struct_name; -struct struct_name *to; -struct struct_name *from; -@@ -( --memcpy(to, from, sizeof(*to)); -+ *to = *from; -| --memcpy(to, from, sizeof(*from)); -+ *to = *from; -| --memcpy(to, from, sizeof(struct struct_name)); -+ *to = *from; -) - diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped index ee1d8c3042fb..c8769d550cfb 100644 --- a/scripts/dtc/dtc-parser.tab.c_shipped +++ b/scripts/dtc/dtc-parser.tab.c_shipped @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 2.7.12-4996. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.5" +#define YYBISON_VERSION "2.7.12-4996" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,14 +58,11 @@ /* Pull parsers. */ #define YYPULL 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 /* Copy the first part of user declarations. */ - -/* Line 268 of yacc.c */ +/* Line 371 of yacc.c */ #line 21 "dtc-parser.y" #include <stdio.h> @@ -85,14 +82,16 @@ extern int treesource_error; static unsigned long long eval_literal(const char *s, int base, int bits); static unsigned char eval_char_literal(const char *s); +/* Line 371 of yacc.c */ +#line 87 "dtc-parser.tab.c" -/* Line 268 of yacc.c */ -#line 91 "dtc-parser.tab.c" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif +# ifndef YY_NULL +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULL nullptr +# else +# define YY_NULL 0 +# endif +# endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -102,11 +101,17 @@ static unsigned char eval_char_literal(const char *s); # define YYERROR_VERBOSE 0 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 +/* In a future release of Bison, this section will be replaced + by #include "dtc-parser.tab.h". */ +#ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED +# define YY_YY_DTC_PARSER_TAB_H_INCLUDED +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; #endif - /* Tokens. */ #ifndef YYTOKENTYPE @@ -140,12 +145,10 @@ static unsigned char eval_char_literal(const char *s); #endif - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { - -/* Line 293 of yacc.c */ +/* Line 387 of yacc.c */ #line 40 "dtc-parser.y" char *propnodename; @@ -168,21 +171,36 @@ typedef union YYSTYPE uint64_t integer; - -/* Line 293 of yacc.c */ -#line 174 "dtc-parser.tab.c" +/* Line 387 of yacc.c */ +#line 176 "dtc-parser.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif +extern YYSTYPE yylval; -/* Copy the second part of user declarations. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ +#endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ -/* Line 343 of yacc.c */ -#line 186 "dtc-parser.tab.c" +/* Copy the second part of user declarations. */ + +/* Line 390 of yacc.c */ +#line 204 "dtc-parser.tab.c" #ifdef short # undef short @@ -235,24 +253,33 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if (! defined __GNUC__ || __GNUC__ < 2 \ + || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) +# define __attribute__(Spec) /* empty */ # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif + /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint -# define YYID(n) (n) +# define YYID(N) (N) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) @@ -288,6 +315,7 @@ YYID (yyi) # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -379,20 +407,20 @@ union yyalloc #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from FROM to TO. The source and destination do +/* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ while (YYID (0)) # endif # endif @@ -513,7 +541,7 @@ static const yytype_uint16 yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -530,7 +558,7 @@ static const char *const yytname[] = "integer_expr", "integer_trinary", "integer_or", "integer_and", "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq", "integer_rela", "integer_shift", "integer_add", "integer_mul", - "integer_unary", "bytestring", "subnodes", "subnode", 0 + "integer_unary", "bytestring", "subnodes", "subnode", YY_NULL }; #endif @@ -655,10 +683,10 @@ static const yytype_uint8 yytable[] = 137, 0, 73, 139 }; -#define yypact_value_is_default(yystate) \ - ((yystate) == (-78)) +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-78))) -#define yytable_value_is_error(yytable_value) \ +#define yytable_value_is_error(Yytable_value) \ YYID (0) static const yytype_int16 yycheck[] = @@ -727,62 +755,35 @@ static const yytype_uint8 yystos[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) - +/* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - /* This macro is provided for backward compatibility. */ - #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif /* YYLEX -- calling `yylex' with the right arguments. */ - #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else @@ -832,6 +833,8 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) YYSTYPE const * const yyvaluep; #endif { + FILE *yyo = yyoutput; + YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT @@ -840,11 +843,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) # else YYUSE (yyoutput); # endif - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -1083,12 +1082,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = 0; + const char *yyformat = YY_NULL; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1148,11 +1146,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } } } } @@ -1172,10 +1172,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } if (*yymsg_alloc < yysize) { @@ -1231,36 +1233,26 @@ yydestruct (yymsg, yytype, yyvaluep) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - switch (yytype) - { - - default: - break; - } + YYUSE (yytype); } -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ /* The lookahead symbol. */ int yychar; + +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; +YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); /* Number of syntax errors so far. */ int yynerrs; @@ -1300,7 +1292,7 @@ yyparse () `yyss': related to states. `yyvs': related to semantic values. - Refer to the stacks thru separate pointers, to allow yyoverflow + Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1318,7 +1310,7 @@ yyparse () int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken; + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1336,9 +1328,8 @@ yyparse () Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1347,14 +1338,6 @@ yyparse () yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - goto yysetstate; /*------------------------------------------------------------. @@ -1495,7 +1478,9 @@ yybackup: yychar = YYEMPTY; yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1532,8 +1517,7 @@ yyreduce: switch (yyn) { case 2: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 110 "dtc-parser.y" { the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), @@ -1542,8 +1526,7 @@ yyreduce: break; case 3: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 118 "dtc-parser.y" { (yyval.re) = NULL; @@ -1551,8 +1534,7 @@ yyreduce: break; case 4: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 122 "dtc-parser.y" { (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); @@ -1560,8 +1542,7 @@ yyreduce: break; case 5: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 129 "dtc-parser.y" { (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer)); @@ -1569,8 +1550,7 @@ yyreduce: break; case 6: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 133 "dtc-parser.y" { add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref)); @@ -1579,8 +1559,7 @@ yyreduce: break; case 7: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 141 "dtc-parser.y" { (yyval.node) = name_node((yyvsp[(2) - (2)].node), ""); @@ -1588,8 +1567,7 @@ yyreduce: break; case 8: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 145 "dtc-parser.y" { (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); @@ -1597,8 +1575,7 @@ yyreduce: break; case 9: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 149 "dtc-parser.y" { struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref)); @@ -1612,8 +1589,7 @@ yyreduce: break; case 10: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 159 "dtc-parser.y" { struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref)); @@ -1628,8 +1604,7 @@ yyreduce: break; case 11: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 173 "dtc-parser.y" { (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); @@ -1637,8 +1612,7 @@ yyreduce: break; case 12: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 180 "dtc-parser.y" { (yyval.proplist) = NULL; @@ -1646,8 +1620,7 @@ yyreduce: break; case 13: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 184 "dtc-parser.y" { (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); @@ -1655,8 +1628,7 @@ yyreduce: break; case 14: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 191 "dtc-parser.y" { (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data)); @@ -1664,8 +1636,7 @@ yyreduce: break; case 15: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 195 "dtc-parser.y" { (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data); @@ -1673,8 +1644,7 @@ yyreduce: break; case 16: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 199 "dtc-parser.y" { (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename)); @@ -1682,8 +1652,7 @@ yyreduce: break; case 17: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 203 "dtc-parser.y" { add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref)); @@ -1692,8 +1661,7 @@ yyreduce: break; case 18: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 211 "dtc-parser.y" { (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); @@ -1701,8 +1669,7 @@ yyreduce: break; case 19: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 215 "dtc-parser.y" { (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data); @@ -1710,8 +1677,7 @@ yyreduce: break; case 20: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 219 "dtc-parser.y" { (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); @@ -1719,8 +1685,7 @@ yyreduce: break; case 21: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 223 "dtc-parser.y" { (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); @@ -1728,8 +1693,7 @@ yyreduce: break; case 22: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 227 "dtc-parser.y" { FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL); @@ -1750,8 +1714,7 @@ yyreduce: break; case 23: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 244 "dtc-parser.y" { FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL); @@ -1765,8 +1728,7 @@ yyreduce: break; case 24: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 254 "dtc-parser.y" { (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); @@ -1774,8 +1736,7 @@ yyreduce: break; case 25: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 261 "dtc-parser.y" { (yyval.data) = empty_data; @@ -1783,8 +1744,7 @@ yyreduce: break; case 26: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 265 "dtc-parser.y" { (yyval.data) = (yyvsp[(1) - (2)].data); @@ -1792,8 +1752,7 @@ yyreduce: break; case 27: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 269 "dtc-parser.y" { (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); @@ -1801,8 +1760,7 @@ yyreduce: break; case 28: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 276 "dtc-parser.y" { (yyval.array).data = empty_data; @@ -1821,8 +1779,7 @@ yyreduce: break; case 29: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 291 "dtc-parser.y" { (yyval.array).data = empty_data; @@ -1831,8 +1788,7 @@ yyreduce: break; case 30: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 296 "dtc-parser.y" { if ((yyvsp[(1) - (2)].array).bits < 64) { @@ -1856,8 +1812,7 @@ yyreduce: break; case 31: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 316 "dtc-parser.y" { uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits); @@ -1875,8 +1830,7 @@ yyreduce: break; case 32: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 330 "dtc-parser.y" { (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref)); @@ -1884,8 +1838,7 @@ yyreduce: break; case 33: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 337 "dtc-parser.y" { (yyval.integer) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64); @@ -1893,8 +1846,7 @@ yyreduce: break; case 34: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 341 "dtc-parser.y" { (yyval.integer) = eval_char_literal((yyvsp[(1) - (1)].literal)); @@ -1902,8 +1854,7 @@ yyreduce: break; case 35: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 345 "dtc-parser.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); @@ -1911,162 +1862,139 @@ yyreduce: break; case 38: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 356 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); } break; case 40: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 361 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); } break; case 42: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 366 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); } break; case 44: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 371 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); } break; case 46: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 376 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); } break; case 48: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 381 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); } break; case 50: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 386 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); } break; case 51: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 387 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); } break; case 53: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 392 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); } break; case 54: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 393 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); } break; case 55: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 394 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); } break; case 56: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 395 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); } break; case 57: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 399 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); } break; case 58: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 400 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); } break; case 60: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 405 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); } break; case 61: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 406 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); } break; case 63: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 411 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); } break; case 64: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 412 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); } break; case 65: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 413 "dtc-parser.y" { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); } break; case 68: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 419 "dtc-parser.y" { (yyval.integer) = -(yyvsp[(2) - (2)].integer); } break; case 69: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 420 "dtc-parser.y" { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); } break; case 70: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 421 "dtc-parser.y" { (yyval.integer) = !(yyvsp[(2) - (2)].integer); } break; case 71: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 426 "dtc-parser.y" { (yyval.data) = empty_data; @@ -2074,8 +2002,7 @@ yyreduce: break; case 72: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 430 "dtc-parser.y" { (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); @@ -2083,8 +2010,7 @@ yyreduce: break; case 73: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 434 "dtc-parser.y" { (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); @@ -2092,8 +2018,7 @@ yyreduce: break; case 74: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 441 "dtc-parser.y" { (yyval.nodelist) = NULL; @@ -2101,8 +2026,7 @@ yyreduce: break; case 75: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 445 "dtc-parser.y" { (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); @@ -2110,8 +2034,7 @@ yyreduce: break; case 76: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 449 "dtc-parser.y" { print_error("syntax error: properties must precede subnodes"); @@ -2120,8 +2043,7 @@ yyreduce: break; case 77: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 457 "dtc-parser.y" { (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename)); @@ -2129,8 +2051,7 @@ yyreduce: break; case 78: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 461 "dtc-parser.y" { (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename)); @@ -2138,8 +2059,7 @@ yyreduce: break; case 79: - -/* Line 1806 of yacc.c */ +/* Line 1787 of yacc.c */ #line 465 "dtc-parser.y" { add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref)); @@ -2148,9 +2068,8 @@ yyreduce: break; - -/* Line 1806 of yacc.c */ -#line 2154 "dtc-parser.tab.c" +/* Line 1787 of yacc.c */ +#line 2073 "dtc-parser.tab.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2313,7 +2232,9 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -2337,7 +2258,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2379,8 +2300,7 @@ yyreturn: } - -/* Line 2067 of yacc.c */ +/* Line 2050 of yacc.c */ #line 471 "dtc-parser.y" @@ -2444,4 +2364,3 @@ static unsigned char eval_char_literal(const char *s) return c; } - diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped index 25d3b88c6132..b2e7a86cd85e 100644 --- a/scripts/dtc/dtc-parser.tab.h_shipped +++ b/scripts/dtc/dtc-parser.tab.h_shipped @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 2.7.12-4996. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +30,15 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +#ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED +# define YY_YY_DTC_PARSER_TAB_H_INCLUDED +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif /* Tokens. */ #ifndef YYTOKENTYPE @@ -63,12 +72,10 @@ #endif - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { - -/* Line 2068 of yacc.c */ +/* Line 2053 of yacc.c */ #line 40 "dtc-parser.y" char *propnodename; @@ -91,9 +98,8 @@ typedef union YYSTYPE uint64_t integer; - -/* Line 2068 of yacc.c */ -#line 97 "dtc-parser.tab.h" +/* Line 2053 of yacc.c */ +#line 103 "dtc-parser.tab.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -102,4 +108,18 @@ typedef union YYSTYPE extern YYSTYPE yylval; +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ +#endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c index a375683c1534..e3c96536fd9d 100644 --- a/scripts/dtc/dtc.c +++ b/scripts/dtc/dtc.c @@ -21,8 +21,6 @@ #include "dtc.h" #include "srcpos.h" -#include "version_gen.h" - /* * Command line options */ @@ -49,55 +47,60 @@ static void fill_fullpaths(struct node *tree, const char *prefix) fill_fullpaths(child, tree->fullpath); } -static void __attribute__ ((noreturn)) usage(void) -{ - fprintf(stderr, "Usage:\n"); - fprintf(stderr, "\tdtc [options] <input file>\n"); - fprintf(stderr, "\nOptions:\n"); - fprintf(stderr, "\t-h\n"); - fprintf(stderr, "\t\tThis help text\n"); - fprintf(stderr, "\t-q\n"); - fprintf(stderr, "\t\tQuiet: -q suppress warnings, -qq errors, -qqq all\n"); - fprintf(stderr, "\t-I <input format>\n"); - fprintf(stderr, "\t\tInput formats are:\n"); - fprintf(stderr, "\t\t\tdts - device tree source text\n"); - fprintf(stderr, "\t\t\tdtb - device tree blob\n"); - fprintf(stderr, "\t\t\tfs - /proc/device-tree style directory\n"); - fprintf(stderr, "\t-o <output file>\n"); - fprintf(stderr, "\t-O <output format>\n"); - fprintf(stderr, "\t\tOutput formats are:\n"); - fprintf(stderr, "\t\t\tdts - device tree source text\n"); - fprintf(stderr, "\t\t\tdtb - device tree blob\n"); - fprintf(stderr, "\t\t\tasm - assembler source\n"); - fprintf(stderr, "\t-V <output version>\n"); - fprintf(stderr, "\t\tBlob version to produce, defaults to %d (relevant for dtb\n\t\tand asm output only)\n", DEFAULT_FDT_VERSION); - fprintf(stderr, "\t-d <output dependency file>\n"); - fprintf(stderr, "\t-R <number>\n"); - fprintf(stderr, "\t\tMake space for <number> reserve map entries (relevant for \n\t\tdtb and asm output only)\n"); - fprintf(stderr, "\t-S <bytes>\n"); - fprintf(stderr, "\t\tMake the blob at least <bytes> long (extra space)\n"); - fprintf(stderr, "\t-p <bytes>\n"); - fprintf(stderr, "\t\tAdd padding to the blob of <bytes> long (extra space)\n"); - fprintf(stderr, "\t-b <number>\n"); - fprintf(stderr, "\t\tSet the physical boot cpu\n"); - fprintf(stderr, "\t-f\n"); - fprintf(stderr, "\t\tForce - try to produce output even if the input tree has errors\n"); - fprintf(stderr, "\t-i\n"); - fprintf(stderr, "\t\tAdd a path to search for include files\n"); - fprintf(stderr, "\t-s\n"); - fprintf(stderr, "\t\tSort nodes and properties before outputting (only useful for\n\t\tcomparing trees)\n"); - fprintf(stderr, "\t-v\n"); - fprintf(stderr, "\t\tPrint DTC version and exit\n"); - fprintf(stderr, "\t-H <phandle format>\n"); - fprintf(stderr, "\t\tphandle formats are:\n"); - fprintf(stderr, "\t\t\tlegacy - \"linux,phandle\" properties only\n"); - fprintf(stderr, "\t\t\tepapr - \"phandle\" properties only\n"); - fprintf(stderr, "\t\t\tboth - Both \"linux,phandle\" and \"phandle\" properties\n"); - fprintf(stderr, "\t-W [no-]<checkname>\n"); - fprintf(stderr, "\t-E [no-]<checkname>\n"); - fprintf(stderr, "\t\t\tenable or disable warnings and errors\n"); - exit(3); -} +/* Usage related data. */ +static const char usage_synopsis[] = "dtc [options] <input file>"; +static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv"; +static struct option const usage_long_opts[] = { + {"quiet", no_argument, NULL, 'q'}, + {"in-format", a_argument, NULL, 'I'}, + {"out", a_argument, NULL, 'o'}, + {"out-format", a_argument, NULL, 'O'}, + {"out-version", a_argument, NULL, 'V'}, + {"out-dependency", a_argument, NULL, 'd'}, + {"reserve", a_argument, NULL, 'R'}, + {"space", a_argument, NULL, 'S'}, + {"pad", a_argument, NULL, 'p'}, + {"boot-cpu", a_argument, NULL, 'b'}, + {"force", no_argument, NULL, 'f'}, + {"include", a_argument, NULL, 'i'}, + {"sort", no_argument, NULL, 's'}, + {"phandle", a_argument, NULL, 'H'}, + {"warning", a_argument, NULL, 'W'}, + {"error", a_argument, NULL, 'E'}, + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'v'}, + {NULL, no_argument, NULL, 0x0}, +}; +static const char * const usage_opts_help[] = { + "\n\tQuiet: -q suppress warnings, -qq errors, -qqq all", + "\n\tInput formats are:\n" + "\t\tdts - device tree source text\n" + "\t\tdtb - device tree blob\n" + "\t\tfs - /proc/device-tree style directory", + "\n\tOutput file", + "\n\tOutput formats are:\n" + "\t\tdts - device tree source text\n" + "\t\tdtb - device tree blob\n" + "\t\tasm - assembler source", + "\n\tBlob version to produce, defaults to %d (for dtb and asm output)", //, DEFAULT_FDT_VERSION); + "\n\tOutput dependency file", + "\n\ttMake space for <number> reserve map entries (for dtb and asm output)", + "\n\tMake the blob at least <bytes> long (extra space)", + "\n\tAdd padding to the blob of <bytes> long (extra space)", + "\n\tSet the physical boot cpu", + "\n\tTry to produce output even if the input tree has errors", + "\n\tAdd a path to search for include files", + "\n\tSort nodes and properties before outputting (useful for comparing trees)", + "\n\tValid phandle formats are:\n" + "\t\tlegacy - \"linux,phandle\" properties only\n" + "\t\tepapr - \"phandle\" properties only\n" + "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties", + "\n\tEnable/disable warnings (prefix with \"no-\")", + "\n\tEnable/disable errors (prefix with \"no-\")", + "\n\tPrint this help and exit", + "\n\tPrint version and exit", + NULL, +}; int main(int argc, char *argv[]) { @@ -118,8 +121,7 @@ int main(int argc, char *argv[]) minsize = 0; padsize = 0; - while ((opt = getopt(argc, argv, "hI:O:o:V:d:R:S:p:fqb:i:vH:sW:E:")) - != EOF) { + while ((opt = util_getopt_long()) != EOF) { switch (opt) { case 'I': inform = optarg; @@ -158,8 +160,7 @@ int main(int argc, char *argv[]) srcfile_add_search_path(optarg); break; case 'v': - printf("Version: %s\n", DTC_VERSION); - exit(0); + util_version(); case 'H': if (streq(optarg, "legacy")) phandle_format = PHANDLE_LEGACY; @@ -185,13 +186,14 @@ int main(int argc, char *argv[]) break; case 'h': + usage(NULL); default: - usage(); + usage("unknown option"); } } if (argc > (optind+1)) - usage(); + usage("missing files"); else if (argc < (optind+1)) arg = "-"; else @@ -201,9 +203,6 @@ int main(int argc, char *argv[]) if (minsize && padsize) die("Can't set both -p and -S\n"); - if (minsize) - fprintf(stderr, "DTC: Use of \"-S\" is deprecated; it will be removed soon, use \"-p\" instead\n"); - if (depname) { depfile = fopen(depname, "w"); if (!depfile) diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h index 3e42a071070e..264a20cf66a8 100644 --- a/scripts/dtc/dtc.h +++ b/scripts/dtc/dtc.h @@ -66,7 +66,6 @@ typedef uint32_t cell_t; #define strneq(a, b, n) (strncmp((a), (b), (n)) == 0) #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) /* Data blobs */ enum markertype { diff --git a/scripts/dtc/srcpos.c b/scripts/dtc/srcpos.c index 246ab4bc0d9d..c20bc5315bc1 100644 --- a/scripts/dtc/srcpos.c +++ b/scripts/dtc/srcpos.c @@ -297,9 +297,9 @@ srcpos_verror(struct srcpos *pos, char const *fmt, va_list va) srcstr = srcpos_string(pos); - fprintf(stdout, "Error: %s ", srcstr); - vfprintf(stdout, fmt, va); - fprintf(stdout, "\n"); + fprintf(stderr, "Error: %s ", srcstr); + vfprintf(stderr, fmt, va); + fprintf(stderr, "\n"); } void diff --git a/scripts/dtc/update-dtc-source.sh b/scripts/dtc/update-dtc-source.sh new file mode 100755 index 000000000000..feb01ef26be4 --- /dev/null +++ b/scripts/dtc/update-dtc-source.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# Simple script to update the version of DTC carried by the Linux kernel +# +# This script assumes that the dtc and the linux git trees are in the +# same directory. After building dtc in the dtc directory, it copies the +# source files and generated source files into the scripts/dtc directory +# in the kernel and creates a git commit updating them to the new +# version. +# +# Usage: from the top level Linux source tree, run: +# $ ./scripts/dtc/update-dtc-source.sh +# +# The script will change into the dtc tree, build and test dtc, copy the +# relevant files into the kernel tree and create a git commit. The commit +# message will need to be modified to reflect the version of DTC being +# imported +# +# TODO: +# This script is pretty basic, but it is seldom used so a few manual tasks +# aren't a big deal. If anyone is interested in making it more robust, the +# the following would be nice: +# * Actually fail to complete if any testcase fails. +# - The dtc "make check" target needs to return a failure +# * Extract the version number from the dtc repo for the commit message +# * Build dtc in the kernel tree +# * run 'make check" on dtc built from the kernel tree + +set -ev + +DTC_UPSTREAM_PATH=`pwd`/../dtc +DTC_LINUX_PATH=`pwd`/scripts/dtc + +DTC_SOURCE="checks.c data.c dtc.c dtc.h flattree.c fstree.c livetree.c srcpos.c \ + srcpos.h treesource.c util.c util.h version_gen.h Makefile.dtc \ + dtc-lexer.l dtc-parser.y" +DTC_GENERATED="dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h" + +# Build DTC +cd $DTC_UPSTREAM_PATH +make clean +make check + +# Copy the files into the Linux tree +cd $DTC_LINUX_PATH +for f in $DTC_SOURCE; do + cp ${DTC_UPSTREAM_PATH}/${f} ${f} + git add ${f} +done +for f in $DTC_GENERATED; do + cp ${DTC_UPSTREAM_PATH}/$f ${f}_shipped + git add ${f}_shipped +done + +git commit -e -v -m "scripts/dtc: Update to upstream version [CHANGEME]" diff --git a/scripts/dtc/util.c b/scripts/dtc/util.c index 2422c34e11df..3055c16e980d 100644 --- a/scripts/dtc/util.c +++ b/scripts/dtc/util.c @@ -34,6 +34,7 @@ #include "libfdt.h" #include "util.h" +#include "version_gen.h" char *xstrdup(const char *s) { @@ -72,7 +73,7 @@ char *join_path(const char *path, const char *name) int util_is_printable_string(const void *data, int len) { const char *s = data; - const char *ss; + const char *ss, *se; /* zero length is not */ if (len == 0) @@ -82,13 +83,19 @@ int util_is_printable_string(const void *data, int len) if (s[len - 1] != '\0') return 0; - ss = s; - while (*s && isprint(*s)) - s++; + se = s + len; - /* not zero, or not done yet */ - if (*s != '\0' || (s + 1 - ss) < len) - return 0; + while (s < se) { + ss = s; + while (s < se && *s && isprint(*s)) + s++; + + /* not zero, or not done yet */ + if (*s != '\0' || s == ss) + return 0; + + s++; + } return 1; } @@ -191,7 +198,7 @@ char get_escape_char(const char *s, int *i) return val; } -int utilfdt_read_err(const char *filename, char **buffp) +int utilfdt_read_err_len(const char *filename, char **buffp, off_t *len) { int fd = 0; /* assume stdin */ char *buf = NULL; @@ -206,12 +213,12 @@ int utilfdt_read_err(const char *filename, char **buffp) } /* Loop until we have read everything */ - buf = malloc(bufsize); + buf = xmalloc(bufsize); do { /* Expand the buffer to hold the next chunk */ if (offset == bufsize) { bufsize *= 2; - buf = realloc(buf, bufsize); + buf = xrealloc(buf, bufsize); if (!buf) { ret = ENOMEM; break; @@ -232,13 +239,20 @@ int utilfdt_read_err(const char *filename, char **buffp) free(buf); else *buffp = buf; + *len = bufsize; return ret; } -char *utilfdt_read(const char *filename) +int utilfdt_read_err(const char *filename, char **buffp) +{ + off_t len; + return utilfdt_read_err_len(filename, buffp, &len); +} + +char *utilfdt_read_len(const char *filename, off_t *len) { char *buff; - int ret = utilfdt_read_err(filename, &buff); + int ret = utilfdt_read_err_len(filename, &buff, len); if (ret) { fprintf(stderr, "Couldn't open blob from '%s': %s\n", filename, @@ -249,6 +263,12 @@ char *utilfdt_read(const char *filename) return buff; } +char *utilfdt_read(const char *filename) +{ + off_t len; + return utilfdt_read_len(filename, &len); +} + int utilfdt_write_err(const char *filename, const void *blob) { int fd = 1; /* assume stdout */ @@ -329,3 +349,100 @@ int utilfdt_decode_type(const char *fmt, int *type, int *size) return -1; return 0; } + +void utilfdt_print_data(const char *data, int len) +{ + int i; + const char *p = data; + const char *s; + + /* no data, don't print */ + if (len == 0) + return; + + if (util_is_printable_string(data, len)) { + printf(" = "); + + s = data; + do { + printf("\"%s\"", s); + s += strlen(s) + 1; + if (s < data + len) + printf(", "); + } while (s < data + len); + + } else if ((len % 4) == 0) { + const uint32_t *cell = (const uint32_t *)data; + + printf(" = <"); + for (i = 0; i < len; i += 4) + printf("0x%08x%s", fdt32_to_cpu(cell[i]), + i < (len - 4) ? " " : ""); + printf(">"); + } else { + printf(" = ["); + for (i = 0; i < len; i++) + printf("%02x%s", *p++, i < len - 1 ? " " : ""); + printf("]"); + } +} + +void util_version(void) +{ + printf("Version: %s\n", DTC_VERSION); + exit(0); +} + +void util_usage(const char *errmsg, const char *synopsis, + const char *short_opts, struct option const long_opts[], + const char * const opts_help[]) +{ + FILE *fp = errmsg ? stderr : stdout; + const char a_arg[] = "<arg>"; + size_t a_arg_len = strlen(a_arg) + 1; + size_t i; + int optlen; + + fprintf(fp, + "Usage: %s\n" + "\n" + "Options: -[%s]\n", synopsis, short_opts); + + /* prescan the --long opt length to auto-align */ + optlen = 0; + for (i = 0; long_opts[i].name; ++i) { + /* +1 is for space between --opt and help text */ + int l = strlen(long_opts[i].name) + 1; + if (long_opts[i].has_arg == a_argument) + l += a_arg_len; + if (optlen < l) + optlen = l; + } + + for (i = 0; long_opts[i].name; ++i) { + /* helps when adding new applets or options */ + assert(opts_help[i] != NULL); + + /* first output the short flag if it has one */ + if (long_opts[i].val > '~') + fprintf(fp, " "); + else + fprintf(fp, " -%c, ", long_opts[i].val); + + /* then the long flag */ + if (long_opts[i].has_arg == no_argument) + fprintf(fp, "--%-*s", optlen, long_opts[i].name); + else + fprintf(fp, "--%s %s%*s", long_opts[i].name, a_arg, + (int)(optlen - strlen(long_opts[i].name) - a_arg_len), ""); + + /* finally the help text */ + fprintf(fp, "%s\n", opts_help[i]); + } + + if (errmsg) { + fprintf(fp, "\nError: %s\n", errmsg); + exit(EXIT_FAILURE); + } else + exit(EXIT_SUCCESS); +} diff --git a/scripts/dtc/util.h b/scripts/dtc/util.h index c8eb45d9f04b..8f40b4499359 100644 --- a/scripts/dtc/util.h +++ b/scripts/dtc/util.h @@ -2,6 +2,7 @@ #define _UTIL_H #include <stdarg.h> +#include <getopt.h> /* * Copyright 2011 The Chromium Authors, All Rights Reserved. @@ -23,7 +24,9 @@ * USA */ -static inline void __attribute__((noreturn)) die(char * str, ...) +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + +static inline void __attribute__((noreturn)) die(const char *str, ...) { va_list ap; @@ -57,12 +60,14 @@ extern char *xstrdup(const char *s); extern char *join_path(const char *path, const char *name); /** - * Check a string of a given length to see if it is all printable and - * has a valid terminator. + * Check a property of a given length to see if it is all printable and + * has a valid terminator. The property can contain either a single string, + * or multiple strings each of non-zero length. * * @param data The string to check * @param len The string length including terminator - * @return 1 if a valid printable string, 0 if not */ + * @return 1 if a valid printable string, 0 if not + */ int util_is_printable_string(const void *data, int len); /* @@ -83,6 +88,13 @@ char get_escape_char(const char *s, int *i); char *utilfdt_read(const char *filename); /** + * Like utilfdt_read(), but also passes back the size of the file read. + * + * @param len If non-NULL, the amount of data we managed to read + */ +char *utilfdt_read_len(const char *filename, off_t *len); + +/** * Read a device tree file into a buffer. Does not report errors, but only * returns them. The value returned can be passed to strerror() to obtain * an error message for the user. @@ -93,6 +105,12 @@ char *utilfdt_read(const char *filename); */ int utilfdt_read_err(const char *filename, char **buffp); +/** + * Like utilfdt_read_err(), but also passes back the size of the file read. + * + * @param len If non-NULL, the amount of data we managed to read + */ +int utilfdt_read_err_len(const char *filename, char **buffp, off_t *len); /** * Write a device tree buffer to a file. This will report any errors on @@ -148,6 +166,85 @@ int utilfdt_decode_type(const char *fmt, int *type, int *size); #define USAGE_TYPE_MSG \ "<type>\ts=string, i=int, u=unsigned, x=hex\n" \ "\tOptional modifier prefix:\n" \ - "\t\thh or b=byte, h=2 byte, l=4 byte (default)\n"; + "\t\thh or b=byte, h=2 byte, l=4 byte (default)"; + +/** + * Print property data in a readable format to stdout + * + * Properties that look like strings will be printed as strings. Otherwise + * the data will be displayed either as cells (if len is a multiple of 4 + * bytes) or bytes. + * + * If len is 0 then this function does nothing. + * + * @param data Pointers to property data + * @param len Length of property data + */ +void utilfdt_print_data(const char *data, int len); + +/** + * Show source version and exit + */ +void util_version(void) __attribute__((noreturn)); + +/** + * Show usage and exit + * + * This helps standardize the output of various utils. You most likely want + * to use the usage() helper below rather than call this. + * + * @param errmsg If non-NULL, an error message to display + * @param synopsis The initial example usage text (and possible examples) + * @param short_opts The string of short options + * @param long_opts The structure of long options + * @param opts_help An array of help strings (should align with long_opts) + */ +void util_usage(const char *errmsg, const char *synopsis, + const char *short_opts, struct option const long_opts[], + const char * const opts_help[]) __attribute__((noreturn)); + +/** + * Show usage and exit + * + * If you name all your usage variables with usage_xxx, then you can call this + * help macro rather than expanding all arguments yourself. + * + * @param errmsg If non-NULL, an error message to display + */ +#define usage(errmsg) \ + util_usage(errmsg, usage_synopsis, usage_short_opts, \ + usage_long_opts, usage_opts_help) + +/** + * Call getopt_long() with standard options + * + * Since all util code runs getopt in the same way, provide a helper. + */ +#define util_getopt_long() getopt_long(argc, argv, usage_short_opts, \ + usage_long_opts, NULL) + +/* Helper for aligning long_opts array */ +#define a_argument required_argument + +/* Helper for usage_short_opts string constant */ +#define USAGE_COMMON_SHORT_OPTS "hV" + +/* Helper for usage_long_opts option array */ +#define USAGE_COMMON_LONG_OPTS \ + {"help", no_argument, NULL, 'h'}, \ + {"version", no_argument, NULL, 'V'}, \ + {NULL, no_argument, NULL, 0x0} + +/* Helper for usage_opts_help array */ +#define USAGE_COMMON_OPTS_HELP \ + "Print this help and exit", \ + "Print version and exit", \ + NULL + +/* Helper for getopt case statements */ +#define case_USAGE_COMMON_FLAGS \ + case 'h': usage(NULL); \ + case 'V': util_version(); \ + case '?': usage("unknown option"); #endif /* _UTIL_H */ diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h index 6158b867df99..54d4e904433a 100644 --- a/scripts/dtc/version_gen.h +++ b/scripts/dtc/version_gen.h @@ -1 +1 @@ -#define DTC_VERSION "DTC 1.2.0-g37c0b6a0" +#define DTC_VERSION "DTC 1.4.0-dirty" diff --git a/scripts/gcc-ld b/scripts/gcc-ld new file mode 100644 index 000000000000..cadab9a13ed7 --- /dev/null +++ b/scripts/gcc-ld @@ -0,0 +1,29 @@ +#!/bin/sh +# run gcc with ld options +# used as a wrapper to execute link time optimizations +# yes virginia, this is not pretty + +ARGS="-nostdlib" + +while [ "$1" != "" ] ; do + case "$1" in + -save-temps|-m32|-m64) N="$1" ;; + -r) N="$1" ;; + -[Wg]*) N="$1" ;; + -[olv]|-[Ofd]*|-nostdlib) N="$1" ;; + --end-group|--start-group) + N="-Wl,$1" ;; + -[RTFGhIezcbyYu]*|\ +--script|--defsym|-init|-Map|--oformat|-rpath|\ +-rpath-link|--sort-section|--section-start|-Tbss|-Tdata|-Ttext|\ +--version-script|--dynamic-list|--version-exports-symbol|--wrap|-m) + A="$1" ; shift ; N="-Wl,$A,$1" ;; + -[m]*) N="$1" ;; + -*) N="-Wl,$1" ;; + *) N="$1" ;; + esac + ARGS="$ARGS $N" + shift +done + +exec $CC $ARGS diff --git a/scripts/genksyms/keywords.gperf b/scripts/genksyms/keywords.gperf index 3e77a943e7b7..a9096d993172 100644 --- a/scripts/genksyms/keywords.gperf +++ b/scripts/genksyms/keywords.gperf @@ -23,6 +23,8 @@ __inline, INLINE_KEYW __inline__, INLINE_KEYW __signed, SIGNED_KEYW __signed__, SIGNED_KEYW +__typeof, TYPEOF_KEYW +__typeof__, TYPEOF_KEYW __volatile, VOLATILE_KEYW __volatile__, VOLATILE_KEYW # According to rth, c99 defines _Bool, __restrict, __restrict__, restrict. KAO @@ -51,9 +53,8 @@ signed, SIGNED_KEYW static, STATIC_KEYW struct, STRUCT_KEYW typedef, TYPEDEF_KEYW +typeof, TYPEOF_KEYW union, UNION_KEYW unsigned, UNSIGNED_KEYW void, VOID_KEYW volatile, VOLATILE_KEYW -typeof, TYPEOF_KEYW -__typeof__, TYPEOF_KEYW diff --git a/scripts/genksyms/keywords.hash.c_shipped b/scripts/genksyms/keywords.hash.c_shipped index 82062607e8c0..e9452482e198 100644 --- a/scripts/genksyms/keywords.hash.c_shipped +++ b/scripts/genksyms/keywords.hash.c_shipped @@ -34,7 +34,7 @@ struct resword; static const struct resword *is_reserved_word(register const char *str, register unsigned int len); #line 8 "scripts/genksyms/keywords.gperf" struct resword { const char *name; int token; }; -/* maximum key range = 64, duplicates = 0 */ +/* maximum key range = 98, duplicates = 0 */ #ifdef __GNUC__ __inline @@ -48,32 +48,32 @@ is_reserved_hash (register const char *str, register unsigned int len) { static const unsigned char asso_values[] = { - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 0, - 67, 67, 67, 67, 67, 67, 15, 67, 67, 67, - 0, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 0, 67, 0, 67, 5, - 25, 20, 15, 30, 67, 15, 67, 67, 10, 0, - 10, 40, 20, 67, 10, 5, 0, 10, 15, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67 + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 0, + 101, 101, 101, 101, 101, 101, 15, 101, 101, 101, + 0, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 0, 101, 0, 101, 5, + 25, 20, 55, 30, 101, 15, 101, 101, 10, 0, + 10, 40, 10, 101, 10, 5, 0, 10, 15, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101 }; return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]]; } @@ -89,17 +89,17 @@ is_reserved_word (register const char *str, register unsigned int len) { enum { - TOTAL_KEYWORDS = 45, + TOTAL_KEYWORDS = 46, MIN_WORD_LENGTH = 3, MAX_WORD_LENGTH = 24, MIN_HASH_VALUE = 3, - MAX_HASH_VALUE = 66 + MAX_HASH_VALUE = 100 }; static const struct resword wordlist[] = { {""}, {""}, {""}, -#line 33 "scripts/genksyms/keywords.gperf" +#line 35 "scripts/genksyms/keywords.gperf" {"asm", ASM_KEYW}, {""}, #line 15 "scripts/genksyms/keywords.gperf" @@ -108,7 +108,7 @@ is_reserved_word (register const char *str, register unsigned int len) #line 16 "scripts/genksyms/keywords.gperf" {"__asm__", ASM_KEYW}, {""}, {""}, -#line 59 "scripts/genksyms/keywords.gperf" +#line 27 "scripts/genksyms/keywords.gperf" {"__typeof__", TYPEOF_KEYW}, {""}, #line 19 "scripts/genksyms/keywords.gperf" @@ -119,31 +119,31 @@ is_reserved_word (register const char *str, register unsigned int len) {"__const__", CONST_KEYW}, #line 25 "scripts/genksyms/keywords.gperf" {"__signed__", SIGNED_KEYW}, -#line 51 "scripts/genksyms/keywords.gperf" +#line 53 "scripts/genksyms/keywords.gperf" {"static", STATIC_KEYW}, {""}, -#line 46 "scripts/genksyms/keywords.gperf" +#line 48 "scripts/genksyms/keywords.gperf" {"int", INT_KEYW}, -#line 39 "scripts/genksyms/keywords.gperf" +#line 41 "scripts/genksyms/keywords.gperf" {"char", CHAR_KEYW}, -#line 40 "scripts/genksyms/keywords.gperf" +#line 42 "scripts/genksyms/keywords.gperf" {"const", CONST_KEYW}, -#line 52 "scripts/genksyms/keywords.gperf" +#line 54 "scripts/genksyms/keywords.gperf" {"struct", STRUCT_KEYW}, -#line 31 "scripts/genksyms/keywords.gperf" +#line 33 "scripts/genksyms/keywords.gperf" {"__restrict__", RESTRICT_KEYW}, -#line 32 "scripts/genksyms/keywords.gperf" +#line 34 "scripts/genksyms/keywords.gperf" {"restrict", RESTRICT_KEYW}, #line 12 "scripts/genksyms/keywords.gperf" {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW}, #line 23 "scripts/genksyms/keywords.gperf" {"__inline__", INLINE_KEYW}, {""}, -#line 27 "scripts/genksyms/keywords.gperf" +#line 29 "scripts/genksyms/keywords.gperf" {"__volatile__", VOLATILE_KEYW}, #line 10 "scripts/genksyms/keywords.gperf" {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, -#line 30 "scripts/genksyms/keywords.gperf" +#line 32 "scripts/genksyms/keywords.gperf" {"_restrict", RESTRICT_KEYW}, {""}, #line 17 "scripts/genksyms/keywords.gperf" @@ -152,56 +152,65 @@ is_reserved_word (register const char *str, register unsigned int len) {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, #line 21 "scripts/genksyms/keywords.gperf" {"__extension__", EXTENSION_KEYW}, -#line 42 "scripts/genksyms/keywords.gperf" +#line 44 "scripts/genksyms/keywords.gperf" {"enum", ENUM_KEYW}, #line 13 "scripts/genksyms/keywords.gperf" {"EXPORT_UNUSED_SYMBOL", EXPORT_SYMBOL_KEYW}, -#line 43 "scripts/genksyms/keywords.gperf" +#line 45 "scripts/genksyms/keywords.gperf" {"extern", EXTERN_KEYW}, {""}, #line 24 "scripts/genksyms/keywords.gperf" {"__signed", SIGNED_KEYW}, #line 14 "scripts/genksyms/keywords.gperf" {"EXPORT_UNUSED_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, -#line 54 "scripts/genksyms/keywords.gperf" +#line 57 "scripts/genksyms/keywords.gperf" {"union", UNION_KEYW}, -#line 58 "scripts/genksyms/keywords.gperf" - {"typeof", TYPEOF_KEYW}, -#line 53 "scripts/genksyms/keywords.gperf" - {"typedef", TYPEDEF_KEYW}, + {""}, {""}, #line 22 "scripts/genksyms/keywords.gperf" {"__inline", INLINE_KEYW}, -#line 38 "scripts/genksyms/keywords.gperf" +#line 40 "scripts/genksyms/keywords.gperf" {"auto", AUTO_KEYW}, -#line 26 "scripts/genksyms/keywords.gperf" +#line 28 "scripts/genksyms/keywords.gperf" {"__volatile", VOLATILE_KEYW}, {""}, {""}, -#line 55 "scripts/genksyms/keywords.gperf" +#line 58 "scripts/genksyms/keywords.gperf" {"unsigned", UNSIGNED_KEYW}, {""}, -#line 49 "scripts/genksyms/keywords.gperf" +#line 51 "scripts/genksyms/keywords.gperf" {"short", SHORT_KEYW}, -#line 45 "scripts/genksyms/keywords.gperf" +#line 47 "scripts/genksyms/keywords.gperf" {"inline", INLINE_KEYW}, {""}, -#line 57 "scripts/genksyms/keywords.gperf" +#line 60 "scripts/genksyms/keywords.gperf" {"volatile", VOLATILE_KEYW}, -#line 47 "scripts/genksyms/keywords.gperf" +#line 49 "scripts/genksyms/keywords.gperf" {"long", LONG_KEYW}, -#line 29 "scripts/genksyms/keywords.gperf" +#line 31 "scripts/genksyms/keywords.gperf" {"_Bool", BOOL_KEYW}, {""}, {""}, -#line 48 "scripts/genksyms/keywords.gperf" +#line 50 "scripts/genksyms/keywords.gperf" {"register", REGISTER_KEYW}, -#line 56 "scripts/genksyms/keywords.gperf" +#line 59 "scripts/genksyms/keywords.gperf" {"void", VOID_KEYW}, -#line 44 "scripts/genksyms/keywords.gperf" - {"float", FLOAT_KEYW}, -#line 41 "scripts/genksyms/keywords.gperf" + {""}, +#line 43 "scripts/genksyms/keywords.gperf" {"double", DOUBLE_KEYW}, + {""}, +#line 26 "scripts/genksyms/keywords.gperf" + {"__typeof", TYPEOF_KEYW}, + {""}, {""}, +#line 52 "scripts/genksyms/keywords.gperf" + {"signed", SIGNED_KEYW}, {""}, {""}, {""}, {""}, -#line 50 "scripts/genksyms/keywords.gperf" - {"signed", SIGNED_KEYW} +#line 56 "scripts/genksyms/keywords.gperf" + {"typeof", TYPEOF_KEYW}, +#line 55 "scripts/genksyms/keywords.gperf" + {"typedef", TYPEDEF_KEYW}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 46 "scripts/genksyms/keywords.gperf" + {"float", FLOAT_KEYW} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l index f770071719cb..e583565f2011 100644 --- a/scripts/genksyms/lex.l +++ b/scripts/genksyms/lex.l @@ -129,8 +129,9 @@ int yylex(void) { static enum { - ST_NOTSTARTED, ST_NORMAL, ST_ATTRIBUTE, ST_ASM, ST_BRACKET, ST_BRACE, - ST_EXPRESSION, ST_TABLE_1, ST_TABLE_2, ST_TABLE_3, ST_TABLE_4, + ST_NOTSTARTED, ST_NORMAL, ST_ATTRIBUTE, ST_ASM, ST_TYPEOF, ST_TYPEOF_1, + ST_BRACKET, ST_BRACE, ST_EXPRESSION, + ST_TABLE_1, ST_TABLE_2, ST_TABLE_3, ST_TABLE_4, ST_TABLE_5, ST_TABLE_6 } lexstate = ST_NOTSTARTED; @@ -198,6 +199,10 @@ repeat: lexstate = ST_ASM; count = 0; goto repeat; + case TYPEOF_KEYW: + lexstate = ST_TYPEOF; + count = 0; + goto repeat; case STRUCT_KEYW: case UNION_KEYW: @@ -284,6 +289,48 @@ repeat: } break; + case ST_TYPEOF: + switch (token) + { + case '(': + if ( ++count == 1 ) + lexstate = ST_TYPEOF_1; + else + APP; + goto repeat; + case ')': + APP; + if (--count == 0) + { + lexstate = ST_NORMAL; + token = TYPEOF_PHRASE; + break; + } + goto repeat; + default: + APP; + goto repeat; + } + break; + + case ST_TYPEOF_1: + if (token == IDENT) + { + if (is_reserved_word(yytext, yyleng) + || find_symbol(yytext, SYM_TYPEDEF, 1)) + { + yyless(0); + unput('('); + lexstate = ST_NORMAL; + token = TYPEOF_KEYW; + break; + } + _APP("(", 1); + } + APP; + lexstate = ST_TYPEOF; + goto repeat; + case ST_BRACKET: APP; switch (token) diff --git a/scripts/genksyms/lex.lex.c_shipped b/scripts/genksyms/lex.lex.c_shipped index 0bf4157e6161..f82740a69b85 100644 --- a/scripts/genksyms/lex.lex.c_shipped +++ b/scripts/genksyms/lex.lex.c_shipped @@ -1938,8 +1938,9 @@ int yylex(void) { static enum { - ST_NOTSTARTED, ST_NORMAL, ST_ATTRIBUTE, ST_ASM, ST_BRACKET, ST_BRACE, - ST_EXPRESSION, ST_TABLE_1, ST_TABLE_2, ST_TABLE_3, ST_TABLE_4, + ST_NOTSTARTED, ST_NORMAL, ST_ATTRIBUTE, ST_ASM, ST_TYPEOF, ST_TYPEOF_1, + ST_BRACKET, ST_BRACE, ST_EXPRESSION, + ST_TABLE_1, ST_TABLE_2, ST_TABLE_3, ST_TABLE_4, ST_TABLE_5, ST_TABLE_6 } lexstate = ST_NOTSTARTED; @@ -2007,6 +2008,10 @@ repeat: lexstate = ST_ASM; count = 0; goto repeat; + case TYPEOF_KEYW: + lexstate = ST_TYPEOF; + count = 0; + goto repeat; case STRUCT_KEYW: case UNION_KEYW: @@ -2093,6 +2098,48 @@ repeat: } break; + case ST_TYPEOF: + switch (token) + { + case '(': + if ( ++count == 1 ) + lexstate = ST_TYPEOF_1; + else + APP; + goto repeat; + case ')': + APP; + if (--count == 0) + { + lexstate = ST_NORMAL; + token = TYPEOF_PHRASE; + break; + } + goto repeat; + default: + APP; + goto repeat; + } + break; + + case ST_TYPEOF_1: + if (token == IDENT) + { + if (is_reserved_word(yytext, yyleng) + || find_symbol(yytext, SYM_TYPEDEF, 1)) + { + yyless(0); + unput('('); + lexstate = ST_NORMAL; + token = TYPEOF_KEYW; + break; + } + _APP("(", 1); + } + APP; + lexstate = ST_TYPEOF; + goto repeat; + case ST_BRACKET: APP; switch (token) diff --git a/scripts/genksyms/parse.tab.c_shipped b/scripts/genksyms/parse.tab.c_shipped index ece53c79bb59..c9f0f0ce82ff 100644 --- a/scripts/genksyms/parse.tab.c_shipped +++ b/scripts/genksyms/parse.tab.c_shipped @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 2.5.1. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.5" +#define YYBISON_VERSION "2.5.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -117,6 +117,14 @@ static void record_compound(struct string_list **keyw, +# ifndef YY_NULL +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULL nullptr +# else +# define YY_NULL 0 +# endif +# endif + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -171,18 +179,19 @@ static void record_compound(struct string_list **keyw, EXPORT_SYMBOL_KEYW = 284, ASM_PHRASE = 285, ATTRIBUTE_PHRASE = 286, - BRACE_PHRASE = 287, - BRACKET_PHRASE = 288, - EXPRESSION_PHRASE = 289, - CHAR = 290, - DOTS = 291, - IDENT = 292, - INT = 293, - REAL = 294, - STRING = 295, - TYPE = 296, - OTHER = 297, - FILENAME = 298 + TYPEOF_PHRASE = 287, + BRACE_PHRASE = 288, + BRACKET_PHRASE = 289, + EXPRESSION_PHRASE = 290, + CHAR = 291, + DOTS = 292, + IDENT = 293, + INT = 294, + REAL = 295, + STRING = 296, + TYPE = 297, + OTHER = 298, + FILENAME = 299 }; #endif @@ -304,6 +313,7 @@ YYID (yyi) # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -395,20 +405,20 @@ union yyalloc #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from FROM to TO. The source and destination do +/* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ while (YYID (0)) # endif # endif @@ -417,20 +427,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 4 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 532 +#define YYLAST 514 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 53 +#define YYNTOKENS 54 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 49 /* YYNRULES -- Number of rules. */ #define YYNRULES 132 /* YYNRULES -- Number of states. */ -#define YYNSTATES 188 +#define YYNSTATES 187 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 298 +#define YYMAXUTOK 299 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -442,15 +452,15 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 47, 49, 48, 2, 46, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 52, 44, - 2, 50, 2, 2, 2, 2, 2, 2, 2, 2, + 48, 49, 50, 2, 47, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 53, 45, + 2, 51, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 51, 2, 45, 2, 2, 2, 2, + 2, 2, 2, 52, 2, 46, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -467,7 +477,7 @@ static const yytype_uint8 yytranslate[] = 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43 + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 }; #if YYDEBUG @@ -478,78 +488,77 @@ static const yytype_uint16 yyprhs[] = 0, 0, 3, 5, 8, 9, 12, 13, 18, 19, 23, 25, 27, 29, 31, 34, 37, 41, 42, 44, 46, 50, 55, 56, 58, 60, 63, 65, 67, 69, - 71, 73, 75, 77, 79, 81, 87, 92, 95, 98, - 101, 105, 109, 113, 116, 119, 122, 124, 126, 128, - 130, 132, 134, 136, 138, 140, 142, 144, 147, 148, - 150, 152, 155, 157, 159, 161, 163, 166, 168, 170, - 175, 180, 183, 187, 191, 194, 196, 198, 200, 205, - 210, 213, 217, 221, 224, 226, 230, 231, 233, 235, - 239, 242, 245, 247, 248, 250, 252, 257, 262, 265, - 269, 273, 277, 278, 280, 283, 287, 291, 292, 294, - 296, 299, 303, 306, 307, 309, 311, 315, 318, 321, - 323, 326, 327, 330, 334, 339, 341, 345, 347, 351, - 354, 355, 357 + 71, 73, 75, 77, 79, 81, 86, 88, 91, 94, + 97, 101, 105, 109, 112, 115, 118, 120, 122, 124, + 126, 128, 130, 132, 134, 136, 138, 140, 143, 144, + 146, 148, 151, 153, 155, 157, 159, 162, 164, 166, + 171, 176, 179, 183, 187, 190, 192, 194, 196, 201, + 206, 209, 213, 217, 220, 222, 226, 227, 229, 231, + 235, 238, 241, 243, 244, 246, 248, 253, 258, 261, + 265, 269, 273, 274, 276, 279, 283, 287, 288, 290, + 292, 295, 299, 302, 303, 305, 307, 311, 314, 317, + 319, 322, 323, 326, 330, 335, 337, 341, 343, 347, + 350, 351, 353 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 54, 0, -1, 55, -1, 54, 55, -1, -1, 56, - 57, -1, -1, 12, 23, 58, 60, -1, -1, 23, - 59, 60, -1, 60, -1, 84, -1, 99, -1, 101, - -1, 1, 44, -1, 1, 45, -1, 64, 61, 44, - -1, -1, 62, -1, 63, -1, 62, 46, 63, -1, - 74, 100, 95, 85, -1, -1, 65, -1, 66, -1, - 65, 66, -1, 67, -1, 68, -1, 5, -1, 17, - -1, 21, -1, 11, -1, 14, -1, 69, -1, 73, - -1, 28, 47, 65, 48, 49, -1, 28, 47, 65, - 49, -1, 22, 37, -1, 24, 37, -1, 10, 37, - -1, 22, 37, 87, -1, 24, 37, 87, -1, 10, - 37, 96, -1, 10, 96, -1, 22, 87, -1, 24, - 87, -1, 7, -1, 19, -1, 15, -1, 16, -1, - 20, -1, 25, -1, 13, -1, 9, -1, 26, -1, - 6, -1, 41, -1, 48, 71, -1, -1, 72, -1, - 73, -1, 72, 73, -1, 8, -1, 27, -1, 31, - -1, 18, -1, 70, 74, -1, 75, -1, 37, -1, - 75, 47, 78, 49, -1, 75, 47, 1, 49, -1, - 75, 33, -1, 47, 74, 49, -1, 47, 1, 49, - -1, 70, 76, -1, 77, -1, 37, -1, 41, -1, - 77, 47, 78, 49, -1, 77, 47, 1, 49, -1, - 77, 33, -1, 47, 76, 49, -1, 47, 1, 49, - -1, 79, 36, -1, 79, -1, 80, 46, 36, -1, - -1, 80, -1, 81, -1, 80, 46, 81, -1, 65, - 82, -1, 70, 82, -1, 83, -1, -1, 37, -1, - 41, -1, 83, 47, 78, 49, -1, 83, 47, 1, - 49, -1, 83, 33, -1, 47, 82, 49, -1, 47, - 1, 49, -1, 64, 74, 32, -1, -1, 86, -1, - 50, 34, -1, 51, 88, 45, -1, 51, 1, 45, - -1, -1, 89, -1, 90, -1, 89, 90, -1, 64, - 91, 44, -1, 1, 44, -1, -1, 92, -1, 93, - -1, 92, 46, 93, -1, 76, 95, -1, 37, 94, - -1, 94, -1, 52, 34, -1, -1, 95, 31, -1, - 51, 97, 45, -1, 51, 97, 46, 45, -1, 98, - -1, 97, 46, 98, -1, 37, -1, 37, 50, 34, - -1, 30, 44, -1, -1, 30, -1, 29, 47, 37, - 49, 44, -1 + 55, 0, -1, 56, -1, 55, 56, -1, -1, 57, + 58, -1, -1, 12, 23, 59, 61, -1, -1, 23, + 60, 61, -1, 61, -1, 85, -1, 100, -1, 102, + -1, 1, 45, -1, 1, 46, -1, 65, 62, 45, + -1, -1, 63, -1, 64, -1, 63, 47, 64, -1, + 75, 101, 96, 86, -1, -1, 66, -1, 67, -1, + 66, 67, -1, 68, -1, 69, -1, 5, -1, 17, + -1, 21, -1, 11, -1, 14, -1, 70, -1, 74, + -1, 28, 48, 82, 49, -1, 32, -1, 22, 38, + -1, 24, 38, -1, 10, 38, -1, 22, 38, 88, + -1, 24, 38, 88, -1, 10, 38, 97, -1, 10, + 97, -1, 22, 88, -1, 24, 88, -1, 7, -1, + 19, -1, 15, -1, 16, -1, 20, -1, 25, -1, + 13, -1, 9, -1, 26, -1, 6, -1, 42, -1, + 50, 72, -1, -1, 73, -1, 74, -1, 73, 74, + -1, 8, -1, 27, -1, 31, -1, 18, -1, 71, + 75, -1, 76, -1, 38, -1, 76, 48, 79, 49, + -1, 76, 48, 1, 49, -1, 76, 34, -1, 48, + 75, 49, -1, 48, 1, 49, -1, 71, 77, -1, + 78, -1, 38, -1, 42, -1, 78, 48, 79, 49, + -1, 78, 48, 1, 49, -1, 78, 34, -1, 48, + 77, 49, -1, 48, 1, 49, -1, 80, 37, -1, + 80, -1, 81, 47, 37, -1, -1, 81, -1, 82, + -1, 81, 47, 82, -1, 66, 83, -1, 71, 83, + -1, 84, -1, -1, 38, -1, 42, -1, 84, 48, + 79, 49, -1, 84, 48, 1, 49, -1, 84, 34, + -1, 48, 83, 49, -1, 48, 1, 49, -1, 65, + 75, 33, -1, -1, 87, -1, 51, 35, -1, 52, + 89, 46, -1, 52, 1, 46, -1, -1, 90, -1, + 91, -1, 90, 91, -1, 65, 92, 45, -1, 1, + 45, -1, -1, 93, -1, 94, -1, 93, 47, 94, + -1, 77, 96, -1, 38, 95, -1, 95, -1, 53, + 35, -1, -1, 96, 31, -1, 52, 98, 46, -1, + 52, 98, 47, 46, -1, 99, -1, 98, 47, 99, + -1, 38, -1, 38, 51, 35, -1, 30, 45, -1, + -1, 30, -1, 29, 48, 38, 49, 45, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 123, 123, 124, 128, 128, 134, 134, 136, 136, - 138, 139, 140, 141, 142, 143, 147, 161, 162, 166, - 174, 187, 193, 194, 198, 199, 203, 209, 213, 214, - 215, 216, 217, 221, 222, 223, 224, 228, 230, 232, - 236, 238, 240, 245, 248, 249, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 267, 272, 273, - 277, 278, 282, 282, 282, 283, 291, 292, 296, 305, - 307, 309, 311, 313, 320, 321, 325, 326, 327, 329, - 331, 333, 335, 340, 341, 342, 346, 347, 351, 352, - 357, 362, 364, 368, 369, 377, 381, 383, 385, 387, - 389, 394, 403, 404, 409, 414, 415, 419, 420, 424, - 425, 429, 431, 436, 437, 441, 442, 446, 447, 448, - 452, 456, 457, 461, 462, 466, 467, 470, 475, 483, - 487, 488, 492 + 0, 124, 124, 125, 129, 129, 135, 135, 137, 137, + 139, 140, 141, 142, 143, 144, 148, 162, 163, 167, + 175, 188, 194, 195, 199, 200, 204, 210, 214, 215, + 216, 217, 218, 222, 223, 224, 225, 229, 231, 233, + 237, 239, 241, 246, 249, 250, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 268, 273, 274, + 278, 279, 283, 283, 283, 284, 292, 293, 297, 306, + 308, 310, 312, 314, 321, 322, 326, 327, 328, 330, + 332, 334, 336, 341, 342, 343, 347, 348, 352, 353, + 358, 363, 365, 369, 370, 378, 382, 384, 386, 388, + 390, 395, 404, 405, 410, 415, 416, 420, 421, 425, + 426, 430, 432, 437, 438, 442, 443, 447, 448, 449, + 453, 457, 458, 462, 463, 467, 468, 471, 476, 484, + 488, 489, 493 }; #endif @@ -565,9 +574,9 @@ static const char *const yytname[] = "SHORT_KEYW", "SIGNED_KEYW", "STATIC_KEYW", "STRUCT_KEYW", "TYPEDEF_KEYW", "UNION_KEYW", "UNSIGNED_KEYW", "VOID_KEYW", "VOLATILE_KEYW", "TYPEOF_KEYW", "EXPORT_SYMBOL_KEYW", "ASM_PHRASE", - "ATTRIBUTE_PHRASE", "BRACE_PHRASE", "BRACKET_PHRASE", + "ATTRIBUTE_PHRASE", "TYPEOF_PHRASE", "BRACE_PHRASE", "BRACKET_PHRASE", "EXPRESSION_PHRASE", "CHAR", "DOTS", "IDENT", "INT", "REAL", "STRING", - "TYPE", "OTHER", "FILENAME", "';'", "'}'", "','", "'('", "'*'", "')'", + "TYPE", "OTHER", "FILENAME", "';'", "'}'", "','", "'('", "')'", "'*'", "'='", "'{'", "':'", "$accept", "declaration_seq", "declaration", "$@1", "declaration1", "$@2", "$@3", "simple_declaration", "init_declarator_list_opt", "init_declarator_list", "init_declarator", @@ -584,7 +593,7 @@ static const char *const yytname[] = "member_declarator_list_opt", "member_declarator_list", "member_declarator", "member_bitfield_declarator", "attribute_opt", "enum_body", "enumerator_list", "enumerator", "asm_definition", - "asm_phrase_opt", "export_definition", 0 + "asm_phrase_opt", "export_definition", YY_NULL }; #endif @@ -597,28 +606,28 @@ static const yytype_uint16 yytoknum[] = 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 59, 125, 44, 40, 42, 41, - 61, 123, 58 + 295, 296, 297, 298, 299, 59, 125, 44, 40, 41, + 42, 61, 123, 58 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 53, 54, 54, 56, 55, 58, 57, 59, 57, - 57, 57, 57, 57, 57, 57, 60, 61, 61, 62, - 62, 63, 64, 64, 65, 65, 66, 66, 67, 67, - 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 70, 71, 71, - 72, 72, 73, 73, 73, 73, 74, 74, 75, 75, - 75, 75, 75, 75, 76, 76, 77, 77, 77, 77, - 77, 77, 77, 78, 78, 78, 79, 79, 80, 80, - 81, 82, 82, 83, 83, 83, 83, 83, 83, 83, - 83, 84, 85, 85, 86, 87, 87, 88, 88, 89, - 89, 90, 90, 91, 91, 92, 92, 93, 93, 93, - 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, - 100, 100, 101 + 0, 54, 55, 55, 57, 56, 59, 58, 60, 58, + 58, 58, 58, 58, 58, 58, 61, 62, 62, 63, + 63, 64, 65, 65, 66, 66, 67, 67, 68, 68, + 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 71, 72, 72, + 73, 73, 74, 74, 74, 74, 75, 75, 76, 76, + 76, 76, 76, 76, 77, 77, 78, 78, 78, 78, + 78, 78, 78, 79, 79, 79, 80, 80, 81, 81, + 82, 83, 83, 84, 84, 84, 84, 84, 84, 84, + 84, 85, 86, 86, 87, 88, 88, 89, 89, 90, + 90, 91, 91, 92, 92, 93, 93, 94, 94, 94, + 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, + 101, 101, 102 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -627,7 +636,7 @@ static const yytype_uint8 yyr2[] = 0, 2, 1, 2, 0, 2, 0, 4, 0, 3, 1, 1, 1, 1, 2, 2, 3, 0, 1, 1, 3, 4, 0, 1, 1, 2, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 5, 4, 2, 2, 2, + 1, 1, 1, 1, 1, 4, 1, 2, 2, 2, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 4, @@ -648,68 +657,68 @@ static const yytype_uint8 yydefact[] = 4, 4, 2, 0, 1, 3, 0, 28, 55, 46, 62, 53, 0, 31, 0, 52, 32, 48, 49, 29, 65, 47, 50, 30, 0, 8, 0, 51, 54, 63, - 0, 0, 0, 64, 56, 5, 10, 17, 23, 24, - 26, 27, 33, 34, 11, 12, 13, 14, 15, 39, - 0, 43, 6, 37, 0, 44, 22, 38, 45, 0, - 0, 129, 68, 0, 58, 0, 18, 19, 0, 130, - 67, 25, 42, 127, 0, 125, 22, 40, 0, 113, - 0, 0, 109, 9, 17, 41, 0, 0, 0, 0, - 57, 59, 60, 16, 0, 66, 131, 101, 121, 71, - 0, 0, 123, 0, 7, 112, 106, 76, 77, 0, - 0, 0, 121, 75, 0, 114, 115, 119, 105, 0, - 110, 130, 0, 36, 0, 73, 72, 61, 20, 102, - 0, 93, 0, 84, 87, 88, 128, 124, 126, 118, - 0, 76, 0, 120, 74, 117, 80, 0, 111, 0, - 35, 132, 122, 0, 21, 103, 70, 94, 56, 0, - 93, 90, 92, 69, 83, 0, 82, 81, 0, 0, - 116, 104, 0, 95, 0, 91, 98, 0, 85, 89, - 79, 78, 100, 99, 0, 0, 97, 96 + 0, 0, 0, 64, 36, 56, 5, 10, 17, 23, + 24, 26, 27, 33, 34, 11, 12, 13, 14, 15, + 39, 0, 43, 6, 37, 0, 44, 22, 38, 45, + 0, 0, 129, 68, 0, 58, 0, 18, 19, 0, + 130, 67, 25, 42, 127, 0, 125, 22, 40, 0, + 113, 0, 0, 109, 9, 17, 41, 93, 0, 0, + 0, 0, 57, 59, 60, 16, 0, 66, 131, 101, + 121, 71, 0, 0, 123, 0, 7, 112, 106, 76, + 77, 0, 0, 0, 121, 75, 0, 114, 115, 119, + 105, 0, 110, 130, 94, 56, 0, 93, 90, 92, + 35, 0, 73, 72, 61, 20, 102, 0, 0, 84, + 87, 88, 128, 124, 126, 118, 0, 76, 0, 120, + 74, 117, 80, 0, 111, 0, 0, 95, 0, 91, + 98, 0, 132, 122, 0, 21, 103, 70, 69, 83, + 0, 82, 81, 0, 0, 116, 100, 99, 0, 0, + 104, 85, 89, 79, 78, 97, 96 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 1, 2, 3, 35, 76, 56, 36, 65, 66, - 67, 79, 38, 39, 40, 41, 42, 68, 90, 91, - 43, 121, 70, 112, 113, 132, 133, 134, 135, 161, - 162, 44, 154, 155, 55, 80, 81, 82, 114, 115, - 116, 117, 129, 51, 74, 75, 45, 98, 46 + -1, 1, 2, 3, 36, 77, 57, 37, 66, 67, + 68, 80, 39, 40, 41, 42, 43, 69, 92, 93, + 44, 123, 71, 114, 115, 138, 139, 140, 141, 128, + 129, 45, 165, 166, 56, 81, 82, 83, 116, 117, + 118, 119, 136, 52, 75, 76, 46, 100, 47 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -135 +#define YYPACT_NINF -140 static const yytype_int16 yypact[] = { - -135, 20, -135, 321, -135, -135, 30, -135, -135, -135, - -135, -135, -28, -135, 2, -135, -135, -135, -135, -135, - -135, -135, -135, -135, -6, -135, 9, -135, -135, -135, - -5, 15, -17, -135, -135, -135, -135, 18, 491, -135, - -135, -135, -135, -135, -135, -135, -135, -135, -135, -22, - 31, -135, -135, 19, 106, -135, 491, 19, -135, 491, - 50, -135, -135, 11, -3, 51, 57, -135, 18, -14, - 14, -135, -135, 48, 46, -135, 491, -135, 33, 32, - 59, 154, -135, -135, 18, -135, 365, 56, 60, 61, - -135, -3, -135, -135, 18, -135, -135, -135, -135, -135, - 202, 74, -135, -23, -135, -135, -135, 77, -135, 16, - 101, 49, -135, 34, 92, 93, -135, -135, -135, 94, - -135, 110, 95, -135, 97, -135, -135, -135, -135, -20, - 96, 410, 99, 113, 100, -135, -135, -135, -135, -135, - 103, -135, 107, -135, -135, 111, -135, 239, -135, 32, - -135, -135, -135, 123, -135, -135, -135, -135, -135, 3, - 52, -135, 38, -135, -135, 454, -135, -135, 117, 128, - -135, -135, 134, -135, 135, -135, -135, 276, -135, -135, - -135, -135, -135, -135, 137, 138, -135, -135 + -140, 29, -140, 207, -140, -140, 40, -140, -140, -140, + -140, -140, -27, -140, 44, -140, -140, -140, -140, -140, + -140, -140, -140, -140, -22, -140, -18, -140, -140, -140, + -9, 22, 28, -140, -140, -140, -140, -140, 42, 472, + -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, + 46, 43, -140, -140, 47, 107, -140, 472, 47, -140, + 472, 62, -140, -140, 16, -3, 57, 56, -140, 42, + 35, -11, -140, -140, 53, 48, -140, 472, -140, 51, + 21, 59, 157, -140, -140, 42, -140, 388, 58, 60, + 70, 81, -140, -3, -140, -140, 42, -140, -140, -140, + -140, -140, 253, 71, -140, -20, -140, -140, -140, 83, + -140, 5, 102, 34, -140, 12, 95, 94, -140, -140, + -140, 97, -140, 113, -140, -140, 2, 41, -140, 27, + -140, 99, -140, -140, -140, -140, -24, 98, 101, 109, + 104, -140, -140, -140, -140, -140, 105, -140, 110, -140, + -140, 117, -140, 298, -140, 21, 112, -140, 120, -140, + -140, 343, -140, -140, 121, -140, -140, -140, -140, -140, + 434, -140, -140, 131, 137, -140, -140, -140, 138, 141, + -140, -140, -140, -140, -140, -140, -140 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -135, -135, 187, -135, -135, -135, -135, -50, -135, -135, - 98, 0, -59, -37, -135, -135, -135, -77, -135, -135, - -54, -30, -135, -90, -135, -134, -135, -135, 24, -58, - -135, -135, -135, -135, -18, -135, -135, 109, -135, -135, - 44, 87, 84, 148, -135, 102, -135, -135, -135 + -140, -140, 190, -140, -140, -140, -140, -45, -140, -140, + 96, 1, -60, -31, -140, -140, -140, -78, -140, -140, + -55, -7, -140, -92, -140, -139, -140, -140, -59, -39, + -140, -140, -140, -140, -13, -140, -140, 111, -140, -140, + 39, 87, 84, 147, -140, 106, -140, -140, -140 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -718,149 +727,145 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -109 static const yytype_int16 yytable[] = { - 86, 71, 111, 37, 172, 10, 83, 69, 58, 49, - 92, 152, 88, 169, 73, 20, 96, 140, 97, 142, - 4, 144, 137, 50, 29, 52, 104, 61, 33, 50, - 153, 53, 111, 89, 111, 77, -93, 127, 95, 85, - 157, 131, 59, 185, 173, 54, 57, 99, 62, 71, - 159, 64, -93, 141, 160, 62, 84, 108, 63, 64, - 54, 100, 60, 109, 64, 63, 64, 146, 73, 107, - 54, 176, 111, 108, 47, 48, 84, 105, 106, 109, - 64, 147, 160, 160, 110, 177, 141, 87, 131, 157, - 108, 102, 103, 173, 71, 93, 109, 64, 101, 159, - 64, 174, 175, 94, 118, 124, 131, 78, 136, 125, - 126, 7, 8, 9, 10, 11, 12, 13, 131, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 110, - 26, 27, 28, 29, 30, 143, 148, 33, 105, 149, - 96, 151, 152, -22, 150, 156, 165, 34, 163, 164, - -22, -107, 166, -22, -22, 119, 167, 171, -22, 7, - 8, 9, 10, 11, 12, 13, 180, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 181, 26, 27, - 28, 29, 30, 182, 183, 33, 186, 187, 5, 179, - 120, -22, 128, 170, 139, 34, 145, 72, -22, -108, - 0, -22, -22, 130, 0, 138, -22, 7, 8, 9, - 10, 11, 12, 13, 0, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 0, 26, 27, 28, 29, - 30, 0, 0, 33, 0, 0, 0, 0, -86, 0, - 168, 0, 0, 34, 7, 8, 9, 10, 11, 12, - 13, -86, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 0, 26, 27, 28, 29, 30, 0, 0, - 33, 0, 0, 0, 0, -86, 0, 184, 0, 0, - 34, 7, 8, 9, 10, 11, 12, 13, -86, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, - 26, 27, 28, 29, 30, 0, 0, 33, 0, 0, - 0, 0, -86, 0, 0, 0, 0, 34, 0, 0, - 0, 0, 6, 0, 0, -86, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 0, 0, 0, 0, 0, -22, 0, - 0, 0, 34, 0, 0, -22, 0, 0, -22, -22, - 7, 8, 9, 10, 11, 12, 13, 0, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 0, 26, - 27, 28, 29, 30, 0, 0, 33, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, - 0, 0, 0, 122, 123, 7, 8, 9, 10, 11, - 12, 13, 0, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 0, 26, 27, 28, 29, 30, 0, - 0, 33, 0, 0, 0, 0, 0, 157, 0, 0, - 0, 158, 0, 0, 0, 0, 0, 159, 64, 7, + 87, 88, 113, 156, 38, 10, 146, 163, 72, 127, + 94, 50, 84, 59, 174, 20, 54, 90, 74, 148, + 58, 150, 179, 101, 29, 51, 143, 164, 33, 4, + 55, 70, 106, 113, 55, 113, -93, 102, 134, 60, + 124, 78, 87, 147, 157, 86, 152, 110, 127, 127, + 126, -93, 65, 111, 63, 65, 72, 91, 85, 109, + 153, 160, 97, 110, 64, 98, 65, 53, 99, 111, + 61, 65, 147, 62, 112, 161, 110, 113, 85, 124, + 63, 74, 111, 157, 65, 48, 49, 158, 159, 126, + 64, 65, 65, 87, 104, 105, 107, 108, 51, 55, + 89, 87, 95, 96, 103, 120, 142, 130, 79, 131, + 87, 182, 7, 8, 9, 10, 11, 12, 13, 132, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 133, 26, 27, 28, 29, 30, 112, 149, 33, 34, + 154, 155, 107, 98, 162, -22, 169, 167, 163, 35, + 168, 170, -22, -107, 171, -22, 180, -22, 121, 172, + -22, 176, 7, 8, 9, 10, 11, 12, 13, 177, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 183, 26, 27, 28, 29, 30, 184, 185, 33, 34, + 186, 5, 135, 122, 175, -22, 145, 73, 151, 35, + 0, 0, -22, -108, 0, -22, 0, -22, 6, 0, + -22, 144, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 0, 0, 0, 0, 0, -22, 0, 0, 0, 35, + 0, 0, -22, 0, 137, -22, 0, -22, 7, 8, + 9, 10, 11, 12, 13, 0, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 0, 26, 27, 28, + 29, 30, 0, 0, 33, 34, 0, 0, 0, 0, + -86, 0, 0, 0, 0, 35, 0, 0, 0, 173, + 0, 0, -86, 7, 8, 9, 10, 11, 12, 13, + 0, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 0, 26, 27, 28, 29, 30, 0, 0, 33, + 34, 0, 0, 0, 0, -86, 0, 0, 0, 0, + 35, 0, 0, 0, 178, 0, 0, -86, 7, 8, + 9, 10, 11, 12, 13, 0, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 0, 26, 27, 28, + 29, 30, 0, 0, 33, 34, 0, 0, 0, 0, + -86, 0, 0, 0, 0, 35, 0, 0, 0, 0, + 0, 0, -86, 7, 8, 9, 10, 11, 12, 13, + 0, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 0, 26, 27, 28, 29, 30, 0, 0, 33, + 34, 0, 0, 0, 0, 0, 124, 0, 0, 0, + 125, 0, 0, 0, 0, 0, 126, 0, 65, 7, 8, 9, 10, 11, 12, 13, 0, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, 26, 27, - 28, 29, 30, 0, 0, 33, 0, 0, 0, 0, - 178, 0, 0, 0, 0, 34, 7, 8, 9, 10, - 11, 12, 13, 0, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 0, 26, 27, 28, 29, 30, - 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 34 + 28, 29, 30, 0, 0, 33, 34, 0, 0, 0, + 0, 181, 0, 0, 0, 0, 35, 7, 8, 9, + 10, 11, 12, 13, 0, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 0, 26, 27, 28, 29, + 30, 0, 0, 33, 34, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 35 }; #define yypact_value_is_default(yystate) \ - ((yystate) == (-135)) + ((yystate) == (-140)) #define yytable_value_is_error(yytable_value) \ YYID (0) static const yytype_int16 yycheck[] = { - 59, 38, 79, 3, 1, 8, 56, 37, 26, 37, - 64, 31, 1, 147, 37, 18, 30, 1, 32, 109, - 0, 111, 45, 51, 27, 23, 76, 44, 31, 51, - 50, 37, 109, 63, 111, 53, 33, 91, 68, 57, - 37, 100, 47, 177, 41, 51, 37, 33, 37, 86, - 47, 48, 49, 37, 131, 37, 56, 41, 47, 48, - 51, 47, 47, 47, 48, 47, 48, 33, 37, 37, - 51, 33, 149, 41, 44, 45, 76, 44, 45, 47, - 48, 47, 159, 160, 52, 47, 37, 37, 147, 37, - 41, 45, 46, 41, 131, 44, 47, 48, 50, 47, - 48, 159, 160, 46, 45, 49, 165, 1, 34, 49, - 49, 5, 6, 7, 8, 9, 10, 11, 177, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 52, - 24, 25, 26, 27, 28, 34, 44, 31, 44, 46, - 30, 44, 31, 37, 49, 49, 46, 41, 49, 36, - 44, 45, 49, 47, 48, 1, 49, 34, 52, 5, - 6, 7, 8, 9, 10, 11, 49, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 49, 24, 25, - 26, 27, 28, 49, 49, 31, 49, 49, 1, 165, - 81, 37, 94, 149, 107, 41, 112, 49, 44, 45, - -1, 47, 48, 1, -1, 103, 52, 5, 6, 7, - 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, -1, 24, 25, 26, 27, - 28, -1, -1, 31, -1, -1, -1, -1, 36, -1, - 1, -1, -1, 41, 5, 6, 7, 8, 9, 10, - 11, 49, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, -1, 24, 25, 26, 27, 28, -1, -1, - 31, -1, -1, -1, -1, 36, -1, 1, -1, -1, - 41, 5, 6, 7, 8, 9, 10, 11, 49, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, - 24, 25, 26, 27, 28, -1, -1, 31, -1, -1, - -1, -1, 36, -1, -1, -1, -1, 41, -1, -1, - -1, -1, 1, -1, -1, 49, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, -1, -1, -1, -1, -1, 37, -1, - -1, -1, 41, -1, -1, 44, -1, -1, 47, 48, - 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, - 25, 26, 27, 28, -1, -1, 31, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, - -1, -1, -1, 48, 49, 5, 6, 7, 8, 9, - 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, -1, 24, 25, 26, 27, 28, -1, - -1, 31, -1, -1, -1, -1, -1, 37, -1, -1, - -1, 41, -1, -1, -1, -1, -1, 47, 48, 5, + 60, 60, 80, 1, 3, 8, 1, 31, 39, 87, + 65, 38, 57, 26, 153, 18, 38, 1, 38, 111, + 38, 113, 161, 34, 27, 52, 46, 51, 31, 0, + 52, 38, 77, 111, 52, 113, 34, 48, 93, 48, + 38, 54, 102, 38, 42, 58, 34, 42, 126, 127, + 48, 49, 50, 48, 38, 50, 87, 64, 57, 38, + 48, 34, 69, 42, 48, 30, 50, 23, 33, 48, + 48, 50, 38, 45, 53, 48, 42, 155, 77, 38, + 38, 38, 48, 42, 50, 45, 46, 126, 127, 48, + 48, 50, 50, 153, 46, 47, 45, 46, 52, 52, + 38, 161, 45, 47, 51, 46, 35, 49, 1, 49, + 170, 170, 5, 6, 7, 8, 9, 10, 11, 49, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 49, 24, 25, 26, 27, 28, 53, 35, 31, 32, + 45, 47, 45, 30, 45, 38, 37, 49, 31, 42, + 49, 47, 45, 46, 49, 48, 35, 50, 1, 49, + 53, 49, 5, 6, 7, 8, 9, 10, 11, 49, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 49, 24, 25, 26, 27, 28, 49, 49, 31, 32, + 49, 1, 96, 82, 155, 38, 109, 50, 114, 42, + -1, -1, 45, 46, -1, 48, -1, 50, 1, -1, + 53, 105, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + -1, -1, -1, -1, -1, 38, -1, -1, -1, 42, + -1, -1, 45, -1, 1, 48, -1, 50, 5, 6, + 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, -1, 24, 25, 26, + 27, 28, -1, -1, 31, 32, -1, -1, -1, -1, + 37, -1, -1, -1, -1, 42, -1, -1, -1, 1, + -1, -1, 49, 5, 6, 7, 8, 9, 10, 11, + -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, -1, 24, 25, 26, 27, 28, -1, -1, 31, + 32, -1, -1, -1, -1, 37, -1, -1, -1, -1, + 42, -1, -1, -1, 1, -1, -1, 49, 5, 6, + 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, -1, 24, 25, 26, + 27, 28, -1, -1, 31, 32, -1, -1, -1, -1, + 37, -1, -1, -1, -1, 42, -1, -1, -1, -1, + -1, -1, 49, 5, 6, 7, 8, 9, 10, 11, + -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, -1, 24, 25, 26, 27, 28, -1, -1, 31, + 32, -1, -1, -1, -1, -1, 38, -1, -1, -1, + 42, -1, -1, -1, -1, -1, 48, -1, 50, 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, 25, - 26, 27, 28, -1, -1, 31, -1, -1, -1, -1, - 36, -1, -1, -1, -1, 41, 5, 6, 7, 8, - 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, -1, 24, 25, 26, 27, 28, - -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 41 + 26, 27, 28, -1, -1, 31, 32, -1, -1, -1, + -1, 37, -1, -1, -1, -1, 42, 5, 6, 7, + 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, -1, 24, 25, 26, 27, + 28, -1, -1, 31, 32, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 42 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 54, 55, 56, 0, 55, 1, 5, 6, 7, + 0, 55, 56, 57, 0, 56, 1, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 41, 57, 60, 64, 65, 66, - 67, 68, 69, 73, 84, 99, 101, 44, 45, 37, - 51, 96, 23, 37, 51, 87, 59, 37, 87, 47, - 47, 44, 37, 47, 48, 61, 62, 63, 70, 74, - 75, 66, 96, 37, 97, 98, 58, 87, 1, 64, - 88, 89, 90, 60, 64, 87, 65, 37, 1, 74, - 71, 72, 73, 44, 46, 74, 30, 32, 100, 33, - 47, 50, 45, 46, 60, 44, 45, 37, 41, 47, - 52, 70, 76, 77, 91, 92, 93, 94, 45, 1, - 90, 74, 48, 49, 49, 49, 49, 73, 63, 95, - 1, 65, 78, 79, 80, 81, 34, 45, 98, 94, - 1, 37, 76, 34, 76, 95, 33, 47, 44, 46, - 49, 44, 31, 50, 85, 86, 49, 37, 41, 47, - 70, 82, 83, 49, 36, 46, 49, 49, 1, 78, - 93, 34, 1, 41, 82, 82, 33, 47, 36, 81, - 49, 49, 49, 49, 1, 78, 49, 49 + 28, 29, 30, 31, 32, 42, 58, 61, 65, 66, + 67, 68, 69, 70, 74, 85, 100, 102, 45, 46, + 38, 52, 97, 23, 38, 52, 88, 60, 38, 88, + 48, 48, 45, 38, 48, 50, 62, 63, 64, 71, + 75, 76, 67, 97, 38, 98, 99, 59, 88, 1, + 65, 89, 90, 91, 61, 65, 88, 66, 82, 38, + 1, 75, 72, 73, 74, 45, 47, 75, 30, 33, + 101, 34, 48, 51, 46, 47, 61, 45, 46, 38, + 42, 48, 53, 71, 77, 78, 92, 93, 94, 95, + 46, 1, 91, 75, 38, 42, 48, 71, 83, 84, + 49, 49, 49, 49, 74, 64, 96, 1, 79, 80, + 81, 82, 35, 46, 99, 95, 1, 38, 77, 35, + 77, 96, 34, 48, 45, 47, 1, 42, 83, 83, + 34, 48, 45, 31, 51, 86, 87, 49, 49, 37, + 47, 49, 49, 1, 79, 94, 49, 49, 1, 79, + 35, 37, 82, 49, 49, 49, 49 }; #define yyerrok (yyerrstatus = 0) @@ -890,17 +895,18 @@ static const yytype_uint8 yystos[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ @@ -995,6 +1001,8 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) YYSTYPE const * const yyvaluep; #endif { + FILE *yyo = yyoutput; + YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT @@ -1246,12 +1254,12 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = 0; + const char *yyformat = YY_NULL; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1311,7 +1319,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; @@ -1463,7 +1471,7 @@ yyparse () `yyss': related to states. `yyvs': related to semantic values. - Refer to the stacks thru separate pointers, to allow yyoverflow + Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -2346,7 +2354,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ diff --git a/scripts/genksyms/parse.tab.h_shipped b/scripts/genksyms/parse.tab.h_shipped index 93240a3cdecc..a4737dec4532 100644 --- a/scripts/genksyms/parse.tab.h_shipped +++ b/scripts/genksyms/parse.tab.h_shipped @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 2.5.1. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -66,18 +66,19 @@ EXPORT_SYMBOL_KEYW = 284, ASM_PHRASE = 285, ATTRIBUTE_PHRASE = 286, - BRACE_PHRASE = 287, - BRACKET_PHRASE = 288, - EXPRESSION_PHRASE = 289, - CHAR = 290, - DOTS = 291, - IDENT = 292, - INT = 293, - REAL = 294, - STRING = 295, - TYPE = 296, - OTHER = 297, - FILENAME = 298 + TYPEOF_PHRASE = 287, + BRACE_PHRASE = 288, + BRACKET_PHRASE = 289, + EXPRESSION_PHRASE = 290, + CHAR = 291, + DOTS = 292, + IDENT = 293, + INT = 294, + REAL = 295, + STRING = 296, + TYPE = 297, + OTHER = 298, + FILENAME = 299 }; #endif diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y index 23c39998ad86..b9f4cf202302 100644 --- a/scripts/genksyms/parse.y +++ b/scripts/genksyms/parse.y @@ -103,6 +103,7 @@ static void record_compound(struct string_list **keyw, %token ASM_PHRASE %token ATTRIBUTE_PHRASE +%token TYPEOF_PHRASE %token BRACE_PHRASE %token BRACKET_PHRASE %token EXPRESSION_PHRASE @@ -220,8 +221,8 @@ storage_class_specifier: type_specifier: simple_type_specifier | cvar_qualifier - | TYPEOF_KEYW '(' decl_specifier_seq '*' ')' - | TYPEOF_KEYW '(' decl_specifier_seq ')' + | TYPEOF_KEYW '(' parameter_declaration ')' + | TYPEOF_PHRASE /* References to s/u/e's defined elsewhere. Rearrange things so that it is easier to expand the definition fully later. */ diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 10085de886fe..1237dd7fb4ca 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -36,13 +36,13 @@ struct sym_entry { unsigned char *sym; }; -struct text_range { - const char *stext, *etext; +struct addr_range { + const char *start_sym, *end_sym; unsigned long long start, end; }; static unsigned long long _text; -static struct text_range text_ranges[] = { +static struct addr_range text_ranges[] = { { "_stext", "_etext" }, { "_sinittext", "_einittext" }, { "_stext_l1", "_etext_l1" }, /* Blackfin on-chip L1 inst SRAM */ @@ -51,9 +51,14 @@ static struct text_range text_ranges[] = { #define text_range_text (&text_ranges[0]) #define text_range_inittext (&text_ranges[1]) +static struct addr_range percpu_range = { + "__per_cpu_start", "__per_cpu_end", -1ULL, 0 +}; + static struct sym_entry *table; static unsigned int table_size, table_cnt; static int all_symbols = 0; +static int absolute_percpu = 0; static char symbol_prefix_char = '\0'; static unsigned long long kernel_start_addr = 0; @@ -83,19 +88,20 @@ static inline int is_arm_mapping_symbol(const char *str) && (str[2] == '\0' || str[2] == '.'); } -static int read_symbol_tr(const char *sym, unsigned long long addr) +static int check_symbol_range(const char *sym, unsigned long long addr, + struct addr_range *ranges, int entries) { size_t i; - struct text_range *tr; + struct addr_range *ar; - for (i = 0; i < ARRAY_SIZE(text_ranges); ++i) { - tr = &text_ranges[i]; + for (i = 0; i < entries; ++i) { + ar = &ranges[i]; - if (strcmp(sym, tr->stext) == 0) { - tr->start = addr; + if (strcmp(sym, ar->start_sym) == 0) { + ar->start = addr; return 0; - } else if (strcmp(sym, tr->etext) == 0) { - tr->end = addr; + } else if (strcmp(sym, ar->end_sym) == 0) { + ar->end = addr; return 0; } } @@ -130,7 +136,8 @@ static int read_symbol(FILE *in, struct sym_entry *s) /* Ignore most absolute/undefined (?) symbols. */ if (strcmp(sym, "_text") == 0) _text = s->addr; - else if (read_symbol_tr(sym, s->addr) == 0) + else if (check_symbol_range(sym, s->addr, text_ranges, + ARRAY_SIZE(text_ranges)) == 0) /* nothing to do */; else if (toupper(stype) == 'A') { @@ -164,18 +171,22 @@ static int read_symbol(FILE *in, struct sym_entry *s) strcpy((char *)s->sym + 1, str); s->sym[0] = stype; + /* Record if we've found __per_cpu_start/end. */ + check_symbol_range(sym, s->addr, &percpu_range, 1); + return 0; } -static int symbol_valid_tr(struct sym_entry *s) +static int symbol_in_range(struct sym_entry *s, struct addr_range *ranges, + int entries) { size_t i; - struct text_range *tr; + struct addr_range *ar; - for (i = 0; i < ARRAY_SIZE(text_ranges); ++i) { - tr = &text_ranges[i]; + for (i = 0; i < entries; ++i) { + ar = &ranges[i]; - if (s->addr >= tr->start && s->addr <= tr->end) + if (s->addr >= ar->start && s->addr <= ar->end) return 1; } @@ -214,7 +225,8 @@ static int symbol_valid(struct sym_entry *s) /* if --all-symbols is not specified, then symbols outside the text * and inittext sections are discarded */ if (!all_symbols) { - if (symbol_valid_tr(s) == 0) + if (symbol_in_range(s, text_ranges, + ARRAY_SIZE(text_ranges)) == 0) return 0; /* Corner case. Discard any symbols with the same value as * _etext _einittext; they can move between pass 1 and 2 when @@ -223,9 +235,11 @@ static int symbol_valid(struct sym_entry *s) * rules. */ if ((s->addr == text_range_text->end && - strcmp((char *)s->sym + offset, text_range_text->etext)) || + strcmp((char *)s->sym + offset, + text_range_text->end_sym)) || (s->addr == text_range_inittext->end && - strcmp((char *)s->sym + offset, text_range_inittext->etext))) + strcmp((char *)s->sym + offset, + text_range_inittext->end_sym))) return 0; } @@ -298,6 +312,11 @@ static int expand_symbol(unsigned char *data, int len, char *result) return total; } +static int symbol_absolute(struct sym_entry *s) +{ + return toupper(s->sym[0]) == 'A'; +} + static void write_src(void) { unsigned int i, k, off; @@ -325,7 +344,7 @@ static void write_src(void) */ output_label("kallsyms_addresses"); for (i = 0; i < table_cnt; i++) { - if (toupper(table[i].sym[0]) != 'A') { + if (!symbol_absolute(&table[i])) { if (_text <= table[i].addr) printf("\tPTR\t_text + %#llx\n", table[i].addr - _text); @@ -646,6 +665,15 @@ static void sort_symbols(void) qsort(table, table_cnt, sizeof(struct sym_entry), compare_symbols); } +static void make_percpus_absolute(void) +{ + unsigned int i; + + for (i = 0; i < table_cnt; i++) + if (symbol_in_range(&table[i], &percpu_range, 1)) + table[i].sym[0] = 'A'; +} + int main(int argc, char **argv) { if (argc >= 2) { @@ -653,6 +681,8 @@ int main(int argc, char **argv) for (i = 1; i < argc; i++) { if(strcmp(argv[i], "--all-symbols") == 0) all_symbols = 1; + else if (strcmp(argv[i], "--absolute-percpu") == 0) + absolute_percpu = 1; else if (strncmp(argv[i], "--symbol-prefix=", 16) == 0) { char *p = &argv[i][16]; /* skip quote */ @@ -669,6 +699,8 @@ int main(int argc, char **argv) usage(); read_map(stdin); + if (absolute_percpu) + make_percpus_absolute(); sort_symbols(); optimize_token_table(); write_src(); diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 87f723804079..f88d90f20228 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -1178,7 +1178,10 @@ bool conf_set_all_new_symbols(enum conf_def_mode mode) sym->def[S_DEF_USER].tri = mod; break; case def_no: - sym->def[S_DEF_USER].tri = no; + if (sym->flags & SYMBOL_ALLNOCONFIG_Y) + sym->def[S_DEF_USER].tri = yes; + else + sym->def[S_DEF_USER].tri = no; break; case def_random: sym->def[S_DEF_USER].tri = no; diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index ba663e1dc7e3..412ea8a2abb8 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -109,6 +109,9 @@ struct symbol { /* choice values need to be set before calculating this symbol value */ #define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000 +/* Set symbol to y if allnoconfig; used for symbols that hide others */ +#define SYMBOL_ALLNOCONFIG_Y 0x200000 + #define SYMBOL_MAXLENGTH 256 #define SYMBOL_HASHSIZE 9973 diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 09f4edfdc911..d5daa7af8b49 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -61,6 +61,7 @@ enum conf_def_mode { #define T_OPT_MODULES 1 #define T_OPT_DEFCONFIG_LIST 2 #define T_OPT_ENV 3 +#define T_OPT_ALLNOCONFIG_Y 4 struct kconf_id { int name; diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index db1512ae30cc..3ac2c9c6e280 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -217,6 +217,9 @@ void menu_add_option(int token, char *arg) case T_OPT_ENV: prop_add_env(arg); break; + case T_OPT_ALLNOCONFIG_Y: + current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y; + break; } } diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf index f14ab41154b6..b6ac02d604f1 100644 --- a/scripts/kconfig/zconf.gperf +++ b/scripts/kconfig/zconf.gperf @@ -44,4 +44,5 @@ on, T_ON, TF_PARAM modules, T_OPT_MODULES, TF_OPTION defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION env, T_OPT_ENV, TF_OPTION +allnoconfig_y, T_OPT_ALLNOCONFIG_Y,TF_OPTION %% diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped index 40df0005daa9..c77a8eff1ef2 100644 --- a/scripts/kconfig/zconf.hash.c_shipped +++ b/scripts/kconfig/zconf.hash.c_shipped @@ -55,10 +55,10 @@ kconf_id_hash (register const char *str, register unsigned int len) 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 25, 25, + 73, 73, 73, 73, 73, 73, 73, 5, 25, 25, 0, 0, 0, 5, 0, 0, 73, 73, 5, 0, 10, 5, 45, 73, 20, 20, 0, 15, 15, 73, - 20, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 20, 5, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, @@ -106,6 +106,7 @@ struct kconf_id_strings_t char kconf_id_strings_str23[sizeof("mainmenu")]; char kconf_id_strings_str25[sizeof("menuconfig")]; char kconf_id_strings_str27[sizeof("modules")]; + char kconf_id_strings_str28[sizeof("allnoconfig_y")]; char kconf_id_strings_str29[sizeof("menu")]; char kconf_id_strings_str31[sizeof("select")]; char kconf_id_strings_str32[sizeof("comment")]; @@ -141,6 +142,7 @@ static const struct kconf_id_strings_t kconf_id_strings_contents = "mainmenu", "menuconfig", "modules", + "allnoconfig_y", "menu", "select", "comment", @@ -170,7 +172,7 @@ kconf_id_lookup (register const char *str, register unsigned int len) { enum { - TOTAL_KEYWORDS = 32, + TOTAL_KEYWORDS = 33, MIN_WORD_LENGTH = 2, MAX_WORD_LENGTH = 14, MIN_HASH_VALUE = 2, @@ -219,7 +221,8 @@ kconf_id_lookup (register const char *str, register unsigned int len) {-1}, #line 44 "scripts/kconfig/zconf.gperf" {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION}, - {-1}, +#line 47 "scripts/kconfig/zconf.gperf" + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_OPT_ALLNOCONFIG_Y,TF_OPTION}, #line 16 "scripts/kconfig/zconf.gperf" {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND}, {-1}, @@ -282,5 +285,5 @@ kconf_id_lookup (register const char *str, register unsigned int len) } return 0; } -#line 47 "scripts/kconfig/zconf.gperf" +#line 48 "scripts/kconfig/zconf.gperf" diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh new file mode 100755 index 000000000000..198580d245e0 --- /dev/null +++ b/scripts/ld-version.sh @@ -0,0 +1,8 @@ +#!/usr/bin/awk -f +# extract linker version number from stdin and turn into single number + { + gsub(".*)", ""); + split($1,a, "."); + print a[1]*10000000 + a[2]*100000 + a[3]*10000 + a[4]*100 + a[5]; + exit + } diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 2dcb37736d84..86a4fe75f453 100644 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -86,6 +86,10 @@ kallsyms() kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET" fi + if [ -n "${CONFIG_X86_64}" ]; then + kallsymopt="${kallsymopt} --absolute-percpu" + fi + local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index f221ddf69080..cfb8440cc0b2 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -76,7 +76,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN" echo \#define LINUX_COMPILE_BY \"`echo $LINUX_COMPILE_BY | $UTS_TRUNCATE`\" echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\" - echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\" + echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | grep ' version '`\" ) > .tmpcompile # Only replace the real compile.h if the new one is different, diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index bb5d115ca671..f282516acc7b 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c @@ -174,6 +174,9 @@ int main(void) DEVID_FIELD(x86_cpu_id, model); DEVID_FIELD(x86_cpu_id, vendor); + DEVID(cpu_feature); + DEVID_FIELD(cpu_feature, feature); + DEVID(mei_cl_device_id); DEVID_FIELD(mei_cl_device_id, name); diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 25e5cb0aaef6..1924990a737f 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -42,7 +42,7 @@ typedef unsigned char __u8; /* This array collects all instances that use the generic do_table */ struct devtable { - const char *device_id; /* name of table, __mod_<name>_device_table. */ + const char *device_id; /* name of table, __mod_<name>__*_device_table. */ unsigned long id_size; void *function; }; @@ -146,7 +146,8 @@ static void device_id_check(const char *modname, const char *device_id, if (size % id_size || size < id_size) { fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo " - "of the size of section __mod_%s_device_table=%lu.\n" + "of the size of " + "section __mod_%s__<identifier>_device_table=%lu.\n" "Fix definition of struct %s_device_id " "in mod_devicetable.h\n", modname, device_id, id_size, device_id, size, device_id); @@ -1110,7 +1111,7 @@ static int do_amba_entry(const char *filename, } ADD_TO_DEVTABLE("amba", amba_id, do_amba_entry); -/* LOOKS like x86cpu:vendor:VVVV:family:FFFF:model:MMMM:feature:*,FEAT,* +/* LOOKS like cpu:type:x86,venVVVVfamFFFFmodMMMM:feature:*,FEAT,* * All fields are numbers. It would be nicer to use strings for vendor * and feature, but getting those out of the build system here is too * complicated. @@ -1124,10 +1125,10 @@ static int do_x86cpu_entry(const char *filename, void *symval, DEF_FIELD(symval, x86_cpu_id, model); DEF_FIELD(symval, x86_cpu_id, vendor); - strcpy(alias, "x86cpu:"); - ADD(alias, "vendor:", vendor != X86_VENDOR_ANY, vendor); - ADD(alias, ":family:", family != X86_FAMILY_ANY, family); - ADD(alias, ":model:", model != X86_MODEL_ANY, model); + strcpy(alias, "cpu:type:x86,"); + ADD(alias, "ven", vendor != X86_VENDOR_ANY, vendor); + ADD(alias, "fam", family != X86_FAMILY_ANY, family); + ADD(alias, "mod", model != X86_MODEL_ANY, model); strcat(alias, ":feature:*"); if (feature != X86_FEATURE_ANY) sprintf(alias + strlen(alias), "%04X*", feature); @@ -1135,6 +1136,16 @@ static int do_x86cpu_entry(const char *filename, void *symval, } ADD_TO_DEVTABLE("x86cpu", x86_cpu_id, do_x86cpu_entry); +/* LOOKS like cpu:type:*:feature:*FEAT* */ +static int do_cpu_entry(const char *filename, void *symval, char *alias) +{ + DEF_FIELD(symval, cpu_feature, feature); + + sprintf(alias, "cpu:type:*:feature:*%04X*", feature); + return 1; +} +ADD_TO_DEVTABLE("cpu", cpu_feature, do_cpu_entry); + /* Looks like: mei:S */ static int do_mei_entry(const char *filename, void *symval, char *alias) @@ -1206,7 +1217,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, { void *symval; char *zeros = NULL; - const char *name; + const char *name, *identifier; unsigned int namelen; /* We're looking for a section relative symbol */ @@ -1217,7 +1228,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT) return; - /* All our symbols are of form <prefix>__mod_XXX_device_table. */ + /* All our symbols are of form <prefix>__mod_<name>__<identifier>_device_table. */ name = strstr(symname, "__mod_"); if (!name) return; @@ -1227,7 +1238,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, return; if (strcmp(name + namelen - strlen("_device_table"), "_device_table")) return; - namelen -= strlen("_device_table"); + identifier = strstr(name, "__"); + if (!identifier) + return; + namelen = identifier - name; /* Handle all-NULL symbols allocated into .bss */ if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) { diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 99a45fdc1bbf..066355673930 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -623,7 +623,10 @@ static void handle_modversions(struct module *mod, struct elf_info *info, switch (sym->st_shndx) { case SHN_COMMON: - warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name); + if (!strncmp(symname, "__gnu_lto_", sizeof("__gnu_lto_")-1)) { + /* Should warn here, but modpost runs before the linker */ + } else + warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name); break; case SHN_UNDEF: /* undefined symbol */ @@ -849,6 +852,7 @@ static const char *section_white_list[] = ".xt.lit", /* xtensa */ ".arcextmap*", /* arc */ ".gnu.linkonce.arcext*", /* arc : modules */ + ".gnu.lto*", NULL }; @@ -1455,6 +1459,10 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf, to = find_elf_symbol(elf, r->r_addend, sym); tosym = sym_name(elf, to); + if (!strncmp(fromsym, "reference___initcall", + sizeof("reference___initcall")-1)) + return; + /* check whitelist - we may ignore it */ if (secref_whitelist(mismatch, fromsec, fromsym, tosec, tosym)) { @@ -1693,6 +1701,19 @@ static void check_sec_ref(struct module *mod, const char *modname, } } +static char *remove_dot(char *s) +{ + char *end; + int n = strcspn(s, "."); + + if (n > 0 && s[n] != 0) { + strtoul(s + n + 1, &end, 10); + if (end > s + n + 1 && (*end == '.' || *end == 0)) + s[n] = 0; + } + return s; +} + static void read_symbols(char *modname) { const char *symname; @@ -1731,7 +1752,7 @@ static void read_symbols(char *modname) } for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { - symname = info.strtab + sym->st_name; + symname = remove_dot(info.strtab + sym->st_name); handle_modversions(mod, &info, sym, symname); handle_moddevtable(mod, &info, sym, symname); diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 51207e4d5f8b..168b43dc0a59 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h @@ -127,7 +127,7 @@ struct elf_info { Elf_Section export_gpl_sec; Elf_Section export_unused_gpl_sec; Elf_Section export_gpl_future_sec; - const char *strtab; + char *strtab; char *modinfo; unsigned int modinfo_len; diff --git a/scripts/objdiff b/scripts/objdiff new file mode 100755 index 000000000000..b3e4f10bfc3e --- /dev/null +++ b/scripts/objdiff @@ -0,0 +1,141 @@ +#!/bin/bash + +# objdiff - a small script for validating that a commit or series of commits +# didn't change object code. +# +# Copyright 2014, Jason Cooper <jason@lakedaemon.net> +# +# Licensed under the terms of the GNU GPL version 2 + +# usage example: +# +# $ git checkout COMMIT_A +# $ <your fancy build command here> +# $ ./scripts/objdiff record path/to/*.o +# +# $ git checkout COMMIT_B +# $ <your fancy build command here> +# $ ./scripts/objdiff record path/to/*.o +# +# $ ./scripts/objdiff diff COMMIT_A COMMIT_B +# $ + +# And to clean up (everything is in .tmp_objdiff/*) +# $ ./scripts/objdiff clean all +# +# Note: 'make mrproper' will also remove .tmp_objdiff + +GIT_DIR="`git rev-parse --git-dir`" + +if [ -d "$GIT_DIR" ]; then + TMPD="${GIT_DIR%git}tmp_objdiff" + + [ -d "$TMPD" ] || mkdir "$TMPD" +else + echo "ERROR: git directory not found." + exit 1 +fi + +usage() { + echo "Usage: $0 <command> <args>" + echo " record <list of object files>" + echo " diff <commitA> <commitB>" + echo " clean all | <commit>" + exit 1 +} + +dorecord() { + [ $# -eq 0 ] && usage + + FILES="$*" + + CMT="`git rev-parse --short HEAD`" + + OBJDUMP="${CROSS_COMPILE}objdump" + OBJDIFFD="$TMPD/$CMT" + + [ ! -d "$OBJDIFFD" ] && mkdir -p "$OBJDIFFD" + + for f in $FILES; do + dn="${f%/*}" + bn="${f##*/}" + + [ ! -d "$OBJDIFFD/$dn" ] && mkdir -p "$OBJDIFFD/$dn" + + # remove addresses for a more clear diff + # http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and + $OBJDUMP -D "$f" | sed "s/^[[:space:]]\+[0-9a-f]\+//" \ + >"$OBJDIFFD/$dn/$bn" + done +} + +dodiff() { + [ $# -ne 2 ] && [ $# -ne 0 ] && usage + + if [ $# -eq 0 ]; then + SRC="`git rev-parse --short HEAD^`" + DST="`git rev-parse --short HEAD`" + else + SRC="`git rev-parse --short $1`" + DST="`git rev-parse --short $2`" + fi + + DIFF="`which colordiff`" + + if [ ${#DIFF} -eq 0 ] || [ ! -x "$DIFF" ]; then + DIFF="`which diff`" + fi + + SRCD="$TMPD/$SRC" + DSTD="$TMPD/$DST" + + if [ ! -d "$SRCD" ]; then + echo "ERROR: $SRCD doesn't exist" + exit 1 + fi + + if [ ! -d "$DSTD" ]; then + echo "ERROR: $DSTD doesn't exist" + exit 1 + fi + + $DIFF -Nurd $SRCD $DSTD +} + +doclean() { + [ $# -eq 0 ] && usage + [ $# -gt 1 ] && usage + + if [ "x$1" = "xall" ]; then + rm -rf $TMPD/* + else + CMT="`git rev-parse --short $1`" + + if [ -d "$TMPD/$CMT" ]; then + rm -rf $TMPD/$CMT + else + echo "$CMT not found" + fi + fi +} + +[ $# -eq 0 ] && usage + +case "$1" in + record) + shift + dorecord $* + ;; + diff) + shift + dodiff $* + ;; + clean) + shift + doclean $* + ;; + *) + echo "Unrecognized command '$1'" + exit 1 + ;; +esac diff --git a/scripts/sortextable.c b/scripts/sortextable.c index cc49062acdee..1052d4834a44 100644 --- a/scripts/sortextable.c +++ b/scripts/sortextable.c @@ -35,6 +35,10 @@ #define EM_ARCOMPACT 93 #endif +#ifndef EM_XTENSA +#define EM_XTENSA 94 +#endif + #ifndef EM_AARCH64 #define EM_AARCH64 183 #endif @@ -281,6 +285,7 @@ do_file(char const *const fname) case EM_AARCH64: case EM_MICROBLAZE: case EM_MIPS: + case EM_XTENSA: break; } /* end switch */ diff --git a/scripts/tags.sh b/scripts/tags.sh index 58c455929091..f2c5b006a3d7 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -11,11 +11,10 @@ if [ "$KBUILD_VERBOSE" = "1" ]; then set -x fi -# This is a duplicate of RCS_FIND_IGNORE without escaped '()' -ignore="( -name SCCS -o -name BitKeeper -o -name .svn -o \ - -name CVS -o -name .pc -o -name .hg -o \ - -name .git ) \ - -prune -o" +# RCS_FIND_IGNORE has escaped ()s -- remove them. +ignore="$(echo "$RCS_FIND_IGNORE" | sed 's|\\||g' )" +# tags and cscope files should also ignore MODVERSION *.mod.c files +ignore="$ignore ( -name *.mod.c ) -prune -o" # Do not use full path if we do not use O=.. builds # Use make O=. {tags|cscope} |