diff options
Diffstat (limited to 'scripts')
78 files changed, 3920 insertions, 2448 deletions
diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst index 909ed7a2ac61..1c15717e0d56 100644 --- a/scripts/Makefile.dtbinst +++ b/scripts/Makefile.dtbinst | |||
@@ -18,7 +18,7 @@ export dtbinst-root ?= $(obj) | |||
18 | 18 | ||
19 | include include/config/auto.conf | 19 | include include/config/auto.conf |
20 | include scripts/Kbuild.include | 20 | include scripts/Kbuild.include |
21 | include $(srctree)/$(obj)/Makefile | 21 | include $(src)/Makefile |
22 | 22 | ||
23 | PHONY += __dtbs_install_prep | 23 | PHONY += __dtbs_install_prep |
24 | __dtbs_install_prep: | 24 | __dtbs_install_prep: |
diff --git a/scripts/Makefile.fwinst b/scripts/Makefile.fwinst index 5b698add4f31..b27290035253 100644 --- a/scripts/Makefile.fwinst +++ b/scripts/Makefile.fwinst | |||
@@ -13,7 +13,7 @@ src := $(obj) | |||
13 | -include $(objtree)/.config | 13 | -include $(objtree)/.config |
14 | 14 | ||
15 | include scripts/Kbuild.include | 15 | include scripts/Kbuild.include |
16 | include $(srctree)/$(obj)/Makefile | 16 | include $(src)/Makefile |
17 | 17 | ||
18 | include scripts/Makefile.host | 18 | include scripts/Makefile.host |
19 | 19 | ||
diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan index 631619b2b118..3f874d24234f 100644 --- a/scripts/Makefile.kasan +++ b/scripts/Makefile.kasan | |||
@@ -13,12 +13,16 @@ CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \ | |||
13 | --param asan-instrumentation-with-call-threshold=$(call_threshold)) | 13 | --param asan-instrumentation-with-call-threshold=$(call_threshold)) |
14 | 14 | ||
15 | ifeq ($(call cc-option, $(CFLAGS_KASAN_MINIMAL) -Werror),) | 15 | ifeq ($(call cc-option, $(CFLAGS_KASAN_MINIMAL) -Werror),) |
16 | ifneq ($(CONFIG_COMPILE_TEST),y) | ||
16 | $(warning Cannot use CONFIG_KASAN: \ | 17 | $(warning Cannot use CONFIG_KASAN: \ |
17 | -fsanitize=kernel-address is not supported by compiler) | 18 | -fsanitize=kernel-address is not supported by compiler) |
19 | endif | ||
18 | else | 20 | else |
19 | ifeq ($(CFLAGS_KASAN),) | 21 | ifeq ($(CFLAGS_KASAN),) |
20 | $(warning CONFIG_KASAN: compiler does not support all options.\ | 22 | ifneq ($(CONFIG_COMPILE_TEST),y) |
21 | Trying minimal configuration) | 23 | $(warning CONFIG_KASAN: compiler does not support all options.\ |
24 | Trying minimal configuration) | ||
25 | endif | ||
22 | CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL) | 26 | CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL) |
23 | endif | 27 | endif |
24 | endif | 28 | endif |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 044eb4f89a91..79e86613712f 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -282,7 +282,8 @@ $(obj)/%.dtb.S: $(obj)/%.dtb | |||
282 | $(call cmd,dt_S_dtb) | 282 | $(call cmd,dt_S_dtb) |
283 | 283 | ||
284 | quiet_cmd_dtc = DTC $@ | 284 | quiet_cmd_dtc = DTC $@ |
285 | cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ | 285 | cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ |
286 | $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ | ||
286 | $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \ | 287 | $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \ |
287 | -i $(dir $<) $(DTC_FLAGS) \ | 288 | -i $(dir $<) $(DTC_FLAGS) \ |
288 | -d $(depfile).dtc.tmp $(dtc-tmp) ; \ | 289 | -d $(depfile).dtc.tmp $(dtc-tmp) ; \ |
diff --git a/scripts/check_extable.sh b/scripts/check_extable.sh new file mode 100755 index 000000000000..0fb6b1c97c27 --- /dev/null +++ b/scripts/check_extable.sh | |||
@@ -0,0 +1,146 @@ | |||
1 | #! /bin/bash | ||
2 | # (c) 2015, Quentin Casasnovas <quentin.casasnovas@oracle.com> | ||
3 | |||
4 | obj=$1 | ||
5 | |||
6 | file ${obj} | grep -q ELF || (echo "${obj} is not and ELF file." 1>&2 ; exit 0) | ||
7 | |||
8 | # Bail out early if there isn't an __ex_table section in this object file. | ||
9 | objdump -hj __ex_table ${obj} 2> /dev/null > /dev/null | ||
10 | [ $? -ne 0 ] && exit 0 | ||
11 | |||
12 | white_list=.text,.fixup | ||
13 | |||
14 | suspicious_relocs=$(objdump -rj __ex_table ${obj} | tail -n +6 | | ||
15 | grep -v $(eval echo -e{${white_list}}) | awk '{print $3}') | ||
16 | |||
17 | # No suspicious relocs in __ex_table, jobs a good'un | ||
18 | [ -z "${suspicious_relocs}" ] && exit 0 | ||
19 | |||
20 | |||
21 | # After this point, something is seriously wrong since we just found out we | ||
22 | # have some relocations in __ex_table which point to sections which aren't | ||
23 | # white listed. If you're adding a new section in the Linux kernel, and | ||
24 | # you're expecting this section to contain code which can fault (i.e. the | ||
25 | # __ex_table relocation to your new section is expected), simply add your | ||
26 | # new section to the white_list variable above. If not, you're probably | ||
27 | # doing something wrong and the rest of this code is just trying to print | ||
28 | # you more information about it. | ||
29 | |||
30 | function find_section_offset_from_symbol() | ||
31 | { | ||
32 | eval $(objdump -t ${obj} | grep ${1} | sed 's/\([0-9a-f]\+\) .\{7\} \([^ \t]\+\).*/section="\2"; section_offset="0x\1" /') | ||
33 | |||
34 | # addr2line takes addresses in hexadecimal... | ||
35 | section_offset=$(printf "0x%016x" $(( ${section_offset} + $2 )) ) | ||
36 | } | ||
37 | |||
38 | function find_symbol_and_offset_from_reloc() | ||
39 | { | ||
40 | # Extract symbol and offset from the objdump output | ||
41 | eval $(echo $reloc | sed 's/\([^+]\+\)+\?\(0x[0-9a-f]\+\)\?/symbol="\1"; symbol_offset="\2"/') | ||
42 | |||
43 | # When the relocation points to the begining of a symbol or section, it | ||
44 | # won't print the offset since it is zero. | ||
45 | if [ -z "${symbol_offset}" ]; then | ||
46 | symbol_offset=0x0 | ||
47 | fi | ||
48 | } | ||
49 | |||
50 | function find_alt_replacement_target() | ||
51 | { | ||
52 | # The target of the .altinstr_replacement is the relocation just before | ||
53 | # the .altinstr_replacement one. | ||
54 | eval $(objdump -rj .altinstructions ${obj} | grep -B1 "${section}+${section_offset}" | head -n1 | awk '{print $3}' | | ||
55 | sed 's/\([^+]\+\)+\(0x[0-9a-f]\+\)/alt_target_section="\1"; alt_target_offset="\2"/') | ||
56 | } | ||
57 | |||
58 | function handle_alt_replacement_reloc() | ||
59 | { | ||
60 | # This will define alt_target_section and alt_target_section_offset | ||
61 | find_alt_replacement_target ${section} ${section_offset} | ||
62 | |||
63 | echo "Error: found a reference to .altinstr_replacement in __ex_table:" | ||
64 | addr2line -fip -j ${alt_target_section} -e ${obj} ${alt_target_offset} | awk '{print "\t" $0}' | ||
65 | |||
66 | error=true | ||
67 | } | ||
68 | |||
69 | function is_executable_section() | ||
70 | { | ||
71 | objdump -hwj ${section} ${obj} | grep -q CODE | ||
72 | return $? | ||
73 | } | ||
74 | |||
75 | function handle_suspicious_generic_reloc() | ||
76 | { | ||
77 | if is_executable_section ${section}; then | ||
78 | # We've got a relocation to a non white listed _executable_ | ||
79 | # section, print a warning so the developper adds the section to | ||
80 | # the white list or fix his code. We try to pretty-print the file | ||
81 | # and line number where that relocation was added. | ||
82 | echo "Warning: found a reference to section \"${section}\" in __ex_table:" | ||
83 | addr2line -fip -j ${section} -e ${obj} ${section_offset} | awk '{print "\t" $0}' | ||
84 | else | ||
85 | # Something is definitively wrong here since we've got a relocation | ||
86 | # to a non-executable section, there's no way this would ever be | ||
87 | # running in the kernel. | ||
88 | echo "Error: found a reference to non-executable section \"${section}\" in __ex_table at offset ${section_offset}" | ||
89 | error=true | ||
90 | fi | ||
91 | } | ||
92 | |||
93 | function handle_suspicious_reloc() | ||
94 | { | ||
95 | case "${section}" in | ||
96 | ".altinstr_replacement") | ||
97 | handle_alt_replacement_reloc ${section} ${section_offset} | ||
98 | ;; | ||
99 | *) | ||
100 | handle_suspicious_generic_reloc ${section} ${section_offset} | ||
101 | ;; | ||
102 | esac | ||
103 | } | ||
104 | |||
105 | function diagnose() | ||
106 | { | ||
107 | |||
108 | for reloc in ${suspicious_relocs}; do | ||
109 | # Let's find out where the target of the relocation in __ex_table | ||
110 | # is, this will define ${symbol} and ${symbol_offset} | ||
111 | find_symbol_and_offset_from_reloc ${reloc} | ||
112 | |||
113 | # When there's a global symbol at the place of the relocation, | ||
114 | # objdump will use it instead of giving us a section+offset, so | ||
115 | # let's find out which section is this symbol in and the total | ||
116 | # offset withing that section. | ||
117 | find_section_offset_from_symbol ${symbol} ${symbol_offset} | ||
118 | |||
119 | # In this case objdump was presenting us with a reloc to a symbol | ||
120 | # rather than a section. Now that we've got the actual section, | ||
121 | # we can skip it if it's in the white_list. | ||
122 | if [ -z "$( echo $section | grep -v $(eval echo -e{${white_list}}))" ]; then | ||
123 | continue; | ||
124 | fi | ||
125 | |||
126 | # Will either print a warning if the relocation happens to be in a | ||
127 | # section we do not know but has executable bit set, or error out. | ||
128 | handle_suspicious_reloc | ||
129 | done | ||
130 | } | ||
131 | |||
132 | function check_debug_info() { | ||
133 | objdump -hj .debug_info ${obj} 2> /dev/null > /dev/null || | ||
134 | echo -e "${obj} does not contain debug information, the addr2line output will be limited.\n" \ | ||
135 | "Recompile ${obj} with CONFIG_DEBUG_INFO to get a more useful output." | ||
136 | } | ||
137 | |||
138 | check_debug_info | ||
139 | |||
140 | diagnose | ||
141 | |||
142 | if [ "${error}" ]; then | ||
143 | exit 1 | ||
144 | fi | ||
145 | |||
146 | exit 0 | ||
diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py index e9cc689033fe..c89fdcaf06e8 100644..100755 --- a/scripts/checkkconfigsymbols.py +++ b/scripts/checkkconfigsymbols.py | |||
@@ -1,8 +1,8 @@ | |||
1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python2 |
2 | 2 | ||
3 | """Find Kconfig identifiers that are referenced but not defined.""" | 3 | """Find Kconfig symbols that are referenced but not defined.""" |
4 | 4 | ||
5 | # (c) 2014 Valentin Rothberg <valentinrothberg@gmail.com> | 5 | # (c) 2014-2015 Valentin Rothberg <Valentin.Rothberg@lip6.fr> |
6 | # (c) 2014 Stefan Hengelein <stefan.hengelein@fau.de> | 6 | # (c) 2014 Stefan Hengelein <stefan.hengelein@fau.de> |
7 | # | 7 | # |
8 | # Licensed under the terms of the GNU GPL License version 2 | 8 | # Licensed under the terms of the GNU GPL License version 2 |
@@ -10,7 +10,9 @@ | |||
10 | 10 | ||
11 | import os | 11 | import os |
12 | import re | 12 | import re |
13 | import sys | ||
13 | from subprocess import Popen, PIPE, STDOUT | 14 | from subprocess import Popen, PIPE, STDOUT |
15 | from optparse import OptionParser | ||
14 | 16 | ||
15 | 17 | ||
16 | # regex expressions | 18 | # regex expressions |
@@ -32,22 +34,162 @@ REGEX_KCONFIG_HELP = re.compile(r"^\s+(help|---help---)\s*$") | |||
32 | REGEX_FILTER_FEATURES = re.compile(r"[A-Za-z0-9]$") | 34 | REGEX_FILTER_FEATURES = re.compile(r"[A-Za-z0-9]$") |
33 | 35 | ||
34 | 36 | ||
37 | def parse_options(): | ||
38 | """The user interface of this module.""" | ||
39 | usage = "%prog [options]\n\n" \ | ||
40 | "Run this tool to detect Kconfig symbols that are referenced but " \ | ||
41 | "not defined in\nKconfig. The output of this tool has the " \ | ||
42 | "format \'Undefined symbol\\tFile list\'\n\n" \ | ||
43 | "If no option is specified, %prog will default to check your\n" \ | ||
44 | "current tree. Please note that specifying commits will " \ | ||
45 | "\'git reset --hard\'\nyour current tree! You may save " \ | ||
46 | "uncommitted changes to avoid losing data." | ||
47 | |||
48 | parser = OptionParser(usage=usage) | ||
49 | |||
50 | parser.add_option('-c', '--commit', dest='commit', action='store', | ||
51 | default="", | ||
52 | help="Check if the specified commit (hash) introduces " | ||
53 | "undefined Kconfig symbols.") | ||
54 | |||
55 | parser.add_option('-d', '--diff', dest='diff', action='store', | ||
56 | default="", | ||
57 | help="Diff undefined symbols between two commits. The " | ||
58 | "input format bases on Git log's " | ||
59 | "\'commmit1..commit2\'.") | ||
60 | |||
61 | parser.add_option('-i', '--ignore', dest='ignore', action='store', | ||
62 | default="", | ||
63 | help="Ignore files matching this pattern. Note that " | ||
64 | "the pattern needs to be a Python regex. To " | ||
65 | "ignore defconfigs, specify -i '.*defconfig'.") | ||
66 | |||
67 | parser.add_option('', '--force', dest='force', action='store_true', | ||
68 | default=False, | ||
69 | help="Reset current Git tree even when it's dirty.") | ||
70 | |||
71 | (opts, _) = parser.parse_args() | ||
72 | |||
73 | if opts.commit and opts.diff: | ||
74 | sys.exit("Please specify only one option at once.") | ||
75 | |||
76 | if opts.diff and not re.match(r"^[\w\-\.]+\.\.[\w\-\.]+$", opts.diff): | ||
77 | sys.exit("Please specify valid input in the following format: " | ||
78 | "\'commmit1..commit2\'") | ||
79 | |||
80 | if opts.commit or opts.diff: | ||
81 | if not opts.force and tree_is_dirty(): | ||
82 | sys.exit("The current Git tree is dirty (see 'git status'). " | ||
83 | "Running this script may\ndelete important data since it " | ||
84 | "calls 'git reset --hard' for some performance\nreasons. " | ||
85 | " Please run this script in a clean Git tree or pass " | ||
86 | "'--force' if you\nwant to ignore this warning and " | ||
87 | "continue.") | ||
88 | |||
89 | if opts.ignore: | ||
90 | try: | ||
91 | re.match(opts.ignore, "this/is/just/a/test.c") | ||
92 | except: | ||
93 | sys.exit("Please specify a valid Python regex.") | ||
94 | |||
95 | return opts | ||
96 | |||
97 | |||
35 | def main(): | 98 | def main(): |
36 | """Main function of this module.""" | 99 | """Main function of this module.""" |
100 | opts = parse_options() | ||
101 | |||
102 | if opts.commit or opts.diff: | ||
103 | head = get_head() | ||
104 | |||
105 | # get commit range | ||
106 | commit_a = None | ||
107 | commit_b = None | ||
108 | if opts.commit: | ||
109 | commit_a = opts.commit + "~" | ||
110 | commit_b = opts.commit | ||
111 | elif opts.diff: | ||
112 | split = opts.diff.split("..") | ||
113 | commit_a = split[0] | ||
114 | commit_b = split[1] | ||
115 | undefined_a = {} | ||
116 | undefined_b = {} | ||
117 | |||
118 | # get undefined items before the commit | ||
119 | execute("git reset --hard %s" % commit_a) | ||
120 | undefined_a = check_symbols(opts.ignore) | ||
121 | |||
122 | # get undefined items for the commit | ||
123 | execute("git reset --hard %s" % commit_b) | ||
124 | undefined_b = check_symbols(opts.ignore) | ||
125 | |||
126 | # report cases that are present for the commit but not before | ||
127 | for feature in sorted(undefined_b): | ||
128 | # feature has not been undefined before | ||
129 | if not feature in undefined_a: | ||
130 | files = sorted(undefined_b.get(feature)) | ||
131 | print "%s\t%s" % (feature, ", ".join(files)) | ||
132 | # check if there are new files that reference the undefined feature | ||
133 | else: | ||
134 | files = sorted(undefined_b.get(feature) - | ||
135 | undefined_a.get(feature)) | ||
136 | if files: | ||
137 | print "%s\t%s" % (feature, ", ".join(files)) | ||
138 | |||
139 | # reset to head | ||
140 | execute("git reset --hard %s" % head) | ||
141 | |||
142 | # default to check the entire tree | ||
143 | else: | ||
144 | undefined = check_symbols(opts.ignore) | ||
145 | for feature in sorted(undefined): | ||
146 | files = sorted(undefined.get(feature)) | ||
147 | print "%s\t%s" % (feature, ", ".join(files)) | ||
148 | |||
149 | |||
150 | def execute(cmd): | ||
151 | """Execute %cmd and return stdout. Exit in case of error.""" | ||
152 | pop = Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True) | ||
153 | (stdout, _) = pop.communicate() # wait until finished | ||
154 | if pop.returncode != 0: | ||
155 | sys.exit(stdout) | ||
156 | return stdout | ||
157 | |||
158 | |||
159 | def tree_is_dirty(): | ||
160 | """Return true if the current working tree is dirty (i.e., if any file has | ||
161 | been added, deleted, modified, renamed or copied but not committed).""" | ||
162 | stdout = execute("git status --porcelain") | ||
163 | for line in stdout: | ||
164 | if re.findall(r"[URMADC]{1}", line[:2]): | ||
165 | return True | ||
166 | return False | ||
167 | |||
168 | |||
169 | def get_head(): | ||
170 | """Return commit hash of current HEAD.""" | ||
171 | stdout = execute("git rev-parse HEAD") | ||
172 | return stdout.strip('\n') | ||
173 | |||
174 | |||
175 | def check_symbols(ignore): | ||
176 | """Find undefined Kconfig symbols and return a dict with the symbol as key | ||
177 | and a list of referencing files as value. Files matching %ignore are not | ||
178 | checked for undefined symbols.""" | ||
37 | source_files = [] | 179 | source_files = [] |
38 | kconfig_files = [] | 180 | kconfig_files = [] |
39 | defined_features = set() | 181 | defined_features = set() |
40 | referenced_features = dict() # {feature: [files]} | 182 | referenced_features = dict() # {feature: [files]} |
41 | 183 | ||
42 | # use 'git ls-files' to get the worklist | 184 | # use 'git ls-files' to get the worklist |
43 | pop = Popen("git ls-files", stdout=PIPE, stderr=STDOUT, shell=True) | 185 | stdout = execute("git ls-files") |
44 | (stdout, _) = pop.communicate() # wait until finished | ||
45 | if len(stdout) > 0 and stdout[-1] == "\n": | 186 | if len(stdout) > 0 and stdout[-1] == "\n": |
46 | stdout = stdout[:-1] | 187 | stdout = stdout[:-1] |
47 | 188 | ||
48 | for gitfile in stdout.rsplit("\n"): | 189 | for gitfile in stdout.rsplit("\n"): |
49 | if ".git" in gitfile or "ChangeLog" in gitfile or \ | 190 | if ".git" in gitfile or "ChangeLog" in gitfile or \ |
50 | ".log" in gitfile or os.path.isdir(gitfile): | 191 | ".log" in gitfile or os.path.isdir(gitfile) or \ |
192 | gitfile.startswith("tools/"): | ||
51 | continue | 193 | continue |
52 | if REGEX_FILE_KCONFIG.match(gitfile): | 194 | if REGEX_FILE_KCONFIG.match(gitfile): |
53 | kconfig_files.append(gitfile) | 195 | kconfig_files.append(gitfile) |
@@ -56,12 +198,19 @@ def main(): | |||
56 | source_files.append(gitfile) | 198 | source_files.append(gitfile) |
57 | 199 | ||
58 | for sfile in source_files: | 200 | for sfile in source_files: |
201 | if ignore and re.match(ignore, sfile): | ||
202 | # do not check files matching %ignore | ||
203 | continue | ||
59 | parse_source_file(sfile, referenced_features) | 204 | parse_source_file(sfile, referenced_features) |
60 | 205 | ||
61 | for kfile in kconfig_files: | 206 | for kfile in kconfig_files: |
62 | parse_kconfig_file(kfile, defined_features, referenced_features) | 207 | if ignore and re.match(ignore, kfile): |
208 | # do not collect references for files matching %ignore | ||
209 | parse_kconfig_file(kfile, defined_features, dict()) | ||
210 | else: | ||
211 | parse_kconfig_file(kfile, defined_features, referenced_features) | ||
63 | 212 | ||
64 | print "Undefined symbol used\tFile list" | 213 | undefined = {} # {feature: [files]} |
65 | for feature in sorted(referenced_features): | 214 | for feature in sorted(referenced_features): |
66 | # filter some false positives | 215 | # filter some false positives |
67 | if feature == "FOO" or feature == "BAR" or \ | 216 | if feature == "FOO" or feature == "BAR" or \ |
@@ -72,8 +221,8 @@ def main(): | |||
72 | # avoid false positives for kernel modules | 221 | # avoid false positives for kernel modules |
73 | if feature[:-len("_MODULE")] in defined_features: | 222 | if feature[:-len("_MODULE")] in defined_features: |
74 | continue | 223 | continue |
75 | files = referenced_features.get(feature) | 224 | undefined[feature] = referenced_features.get(feature) |
76 | print "%s\t%s" % (feature, ", ".join(files)) | 225 | return undefined |
77 | 226 | ||
78 | 227 | ||
79 | def parse_source_file(sfile, referenced_features): | 228 | def parse_source_file(sfile, referenced_features): |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d12435992dea..90e1edc8dd42 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -9,6 +9,7 @@ use strict; | |||
9 | use POSIX; | 9 | use POSIX; |
10 | use File::Basename; | 10 | use File::Basename; |
11 | use Cwd 'abs_path'; | 11 | use Cwd 'abs_path'; |
12 | use Term::ANSIColor qw(:constants); | ||
12 | 13 | ||
13 | my $P = $0; | 14 | my $P = $0; |
14 | my $D = dirname(abs_path($P)); | 15 | my $D = dirname(abs_path($P)); |
@@ -24,6 +25,7 @@ my $chk_patch = 1; | |||
24 | my $tst_only; | 25 | my $tst_only; |
25 | my $emacs = 0; | 26 | my $emacs = 0; |
26 | my $terse = 0; | 27 | my $terse = 0; |
28 | my $showfile = 0; | ||
27 | my $file = 0; | 29 | my $file = 0; |
28 | my $check = 0; | 30 | my $check = 0; |
29 | my $check_orig = 0; | 31 | my $check_orig = 0; |
@@ -47,6 +49,9 @@ my $ignore_perl_version = 0; | |||
47 | my $minimum_perl_version = 5.10.0; | 49 | my $minimum_perl_version = 5.10.0; |
48 | my $min_conf_desc_length = 4; | 50 | my $min_conf_desc_length = 4; |
49 | my $spelling_file = "$D/spelling.txt"; | 51 | my $spelling_file = "$D/spelling.txt"; |
52 | my $codespell = 0; | ||
53 | my $codespellfile = "/usr/share/codespell/dictionary.txt"; | ||
54 | my $color = 1; | ||
50 | 55 | ||
51 | sub help { | 56 | sub help { |
52 | my ($exitcode) = @_; | 57 | my ($exitcode) = @_; |
@@ -62,6 +67,7 @@ Options: | |||
62 | --patch treat FILE as patchfile (default) | 67 | --patch treat FILE as patchfile (default) |
63 | --emacs emacs compile window format | 68 | --emacs emacs compile window format |
64 | --terse one line per report | 69 | --terse one line per report |
70 | --showfile emit diffed file position, not input file position | ||
65 | -f, --file treat FILE as regular source file | 71 | -f, --file treat FILE as regular source file |
66 | --subjective, --strict enable more subjective tests | 72 | --subjective, --strict enable more subjective tests |
67 | --types TYPE(,TYPE2...) show only these comma separated message types | 73 | --types TYPE(,TYPE2...) show only these comma separated message types |
@@ -88,6 +94,10 @@ Options: | |||
88 | file. It's your fault if there's no backup or git | 94 | file. It's your fault if there's no backup or git |
89 | --ignore-perl-version override checking of perl version. expect | 95 | --ignore-perl-version override checking of perl version. expect |
90 | runtime errors. | 96 | runtime errors. |
97 | --codespell Use the codespell dictionary for spelling/typos | ||
98 | (default:/usr/share/codespell/dictionary.txt) | ||
99 | --codespellfile Use this codespell dictionary | ||
100 | --color Use colors when output is STDOUT (default: on) | ||
91 | -h, --help, --version display this help and exit | 101 | -h, --help, --version display this help and exit |
92 | 102 | ||
93 | When FILE is - read standard input. | 103 | When FILE is - read standard input. |
@@ -129,6 +139,7 @@ GetOptions( | |||
129 | 'patch!' => \$chk_patch, | 139 | 'patch!' => \$chk_patch, |
130 | 'emacs!' => \$emacs, | 140 | 'emacs!' => \$emacs, |
131 | 'terse!' => \$terse, | 141 | 'terse!' => \$terse, |
142 | 'showfile!' => \$showfile, | ||
132 | 'f|file!' => \$file, | 143 | 'f|file!' => \$file, |
133 | 'subjective!' => \$check, | 144 | 'subjective!' => \$check, |
134 | 'strict!' => \$check, | 145 | 'strict!' => \$check, |
@@ -146,6 +157,9 @@ GetOptions( | |||
146 | 'ignore-perl-version!' => \$ignore_perl_version, | 157 | 'ignore-perl-version!' => \$ignore_perl_version, |
147 | 'debug=s' => \%debug, | 158 | 'debug=s' => \%debug, |
148 | 'test-only=s' => \$tst_only, | 159 | 'test-only=s' => \$tst_only, |
160 | 'codespell!' => \$codespell, | ||
161 | 'codespellfile=s' => \$codespellfile, | ||
162 | 'color!' => \$color, | ||
149 | 'h|help' => \$help, | 163 | 'h|help' => \$help, |
150 | 'version' => \$help | 164 | 'version' => \$help |
151 | ) or help(1); | 165 | ) or help(1); |
@@ -189,12 +203,12 @@ sub hash_save_array_words { | |||
189 | sub hash_show_words { | 203 | sub hash_show_words { |
190 | my ($hashRef, $prefix) = @_; | 204 | my ($hashRef, $prefix) = @_; |
191 | 205 | ||
192 | if ($quiet == 0 && keys %$hashRef) { | 206 | if (keys %$hashRef) { |
193 | print "NOTE: $prefix message types:"; | 207 | print "\nNOTE: $prefix message types:"; |
194 | foreach my $word (sort keys %$hashRef) { | 208 | foreach my $word (sort keys %$hashRef) { |
195 | print " $word"; | 209 | print " $word"; |
196 | } | 210 | } |
197 | print "\n\n"; | 211 | print "\n"; |
198 | } | 212 | } |
199 | } | 213 | } |
200 | 214 | ||
@@ -316,6 +330,7 @@ our $Operators = qr{ | |||
316 | 330 | ||
317 | our $c90_Keywords = qr{do|for|while|if|else|return|goto|continue|switch|default|case|break}x; | 331 | our $c90_Keywords = qr{do|for|while|if|else|return|goto|continue|switch|default|case|break}x; |
318 | 332 | ||
333 | our $BasicType; | ||
319 | our $NonptrType; | 334 | our $NonptrType; |
320 | our $NonptrTypeMisordered; | 335 | our $NonptrTypeMisordered; |
321 | our $NonptrTypeWithAttr; | 336 | our $NonptrTypeWithAttr; |
@@ -339,15 +354,20 @@ our $UTF8 = qr{ | |||
339 | | $NON_ASCII_UTF8 | 354 | | $NON_ASCII_UTF8 |
340 | }x; | 355 | }x; |
341 | 356 | ||
357 | our $typeC99Typedefs = qr{(?:__)?(?:[us]_?)?int_?(?:8|16|32|64)_t}; | ||
342 | our $typeOtherOSTypedefs = qr{(?x: | 358 | our $typeOtherOSTypedefs = qr{(?x: |
343 | u_(?:char|short|int|long) | # bsd | 359 | u_(?:char|short|int|long) | # bsd |
344 | u(?:nchar|short|int|long) # sysv | 360 | u(?:nchar|short|int|long) # sysv |
345 | )}; | 361 | )}; |
346 | 362 | our $typeKernelTypedefs = qr{(?x: | |
347 | our $typeTypedefs = qr{(?x: | ||
348 | (?:__)?(?:u|s|be|le)(?:8|16|32|64)| | 363 | (?:__)?(?:u|s|be|le)(?:8|16|32|64)| |
349 | atomic_t | 364 | atomic_t |
350 | )}; | 365 | )}; |
366 | our $typeTypedefs = qr{(?x: | ||
367 | $typeC99Typedefs\b| | ||
368 | $typeOtherOSTypedefs\b| | ||
369 | $typeKernelTypedefs\b | ||
370 | )}; | ||
351 | 371 | ||
352 | our $logFunctions = qr{(?x: | 372 | our $logFunctions = qr{(?x: |
353 | printk(?:_ratelimited|_once|)| | 373 | printk(?:_ratelimited|_once|)| |
@@ -410,6 +430,7 @@ our @typeList = ( | |||
410 | qr{${Ident}_handler_fn}, | 430 | qr{${Ident}_handler_fn}, |
411 | @typeListMisordered, | 431 | @typeListMisordered, |
412 | ); | 432 | ); |
433 | our @typeListFile = (); | ||
413 | our @typeListWithAttr = ( | 434 | our @typeListWithAttr = ( |
414 | @typeList, | 435 | @typeList, |
415 | qr{struct\s+$InitAttribute\s+$Ident}, | 436 | qr{struct\s+$InitAttribute\s+$Ident}, |
@@ -419,6 +440,7 @@ our @typeListWithAttr = ( | |||
419 | our @modifierList = ( | 440 | our @modifierList = ( |
420 | qr{fastcall}, | 441 | qr{fastcall}, |
421 | ); | 442 | ); |
443 | our @modifierListFile = (); | ||
422 | 444 | ||
423 | our @mode_permission_funcs = ( | 445 | our @mode_permission_funcs = ( |
424 | ["module_param", 3], | 446 | ["module_param", 3], |
@@ -436,6 +458,14 @@ foreach my $entry (@mode_permission_funcs) { | |||
436 | $mode_perms_search .= $entry->[0]; | 458 | $mode_perms_search .= $entry->[0]; |
437 | } | 459 | } |
438 | 460 | ||
461 | our $mode_perms_world_writable = qr{ | ||
462 | S_IWUGO | | ||
463 | S_IWOTH | | ||
464 | S_IRWXUGO | | ||
465 | S_IALLUGO | | ||
466 | 0[0-7][0-7][2367] | ||
467 | }x; | ||
468 | |||
439 | our $allowed_asm_includes = qr{(?x: | 469 | our $allowed_asm_includes = qr{(?x: |
440 | irq| | 470 | irq| |
441 | memory| | 471 | memory| |
@@ -449,7 +479,6 @@ my $misspellings; | |||
449 | my %spelling_fix; | 479 | my %spelling_fix; |
450 | 480 | ||
451 | if (open(my $spelling, '<', $spelling_file)) { | 481 | if (open(my $spelling, '<', $spelling_file)) { |
452 | my @spelling_list; | ||
453 | while (<$spelling>) { | 482 | while (<$spelling>) { |
454 | my $line = $_; | 483 | my $line = $_; |
455 | 484 | ||
@@ -461,26 +490,53 @@ if (open(my $spelling, '<', $spelling_file)) { | |||
461 | 490 | ||
462 | my ($suspect, $fix) = split(/\|\|/, $line); | 491 | my ($suspect, $fix) = split(/\|\|/, $line); |
463 | 492 | ||
464 | push(@spelling_list, $suspect); | ||
465 | $spelling_fix{$suspect} = $fix; | 493 | $spelling_fix{$suspect} = $fix; |
466 | } | 494 | } |
467 | close($spelling); | 495 | close($spelling); |
468 | $misspellings = join("|", @spelling_list); | ||
469 | } else { | 496 | } else { |
470 | warn "No typos will be found - file '$spelling_file': $!\n"; | 497 | warn "No typos will be found - file '$spelling_file': $!\n"; |
471 | } | 498 | } |
472 | 499 | ||
500 | if ($codespell) { | ||
501 | if (open(my $spelling, '<', $codespellfile)) { | ||
502 | while (<$spelling>) { | ||
503 | my $line = $_; | ||
504 | |||
505 | $line =~ s/\s*\n?$//g; | ||
506 | $line =~ s/^\s*//g; | ||
507 | |||
508 | next if ($line =~ m/^\s*#/); | ||
509 | next if ($line =~ m/^\s*$/); | ||
510 | next if ($line =~ m/, disabled/i); | ||
511 | |||
512 | $line =~ s/,.*$//; | ||
513 | |||
514 | my ($suspect, $fix) = split(/->/, $line); | ||
515 | |||
516 | $spelling_fix{$suspect} = $fix; | ||
517 | } | ||
518 | close($spelling); | ||
519 | } else { | ||
520 | warn "No codespell typos will be found - file '$codespellfile': $!\n"; | ||
521 | } | ||
522 | } | ||
523 | |||
524 | $misspellings = join("|", sort keys %spelling_fix) if keys %spelling_fix; | ||
525 | |||
473 | sub build_types { | 526 | sub build_types { |
474 | my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)"; | 527 | my $mods = "(?x: \n" . join("|\n ", (@modifierList, @modifierListFile)) . "\n)"; |
475 | my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)"; | 528 | my $all = "(?x: \n" . join("|\n ", (@typeList, @typeListFile)) . "\n)"; |
476 | my $Misordered = "(?x: \n" . join("|\n ", @typeListMisordered) . "\n)"; | 529 | my $Misordered = "(?x: \n" . join("|\n ", @typeListMisordered) . "\n)"; |
477 | my $allWithAttr = "(?x: \n" . join("|\n ", @typeListWithAttr) . "\n)"; | 530 | my $allWithAttr = "(?x: \n" . join("|\n ", @typeListWithAttr) . "\n)"; |
478 | $Modifier = qr{(?:$Attribute|$Sparse|$mods)}; | 531 | $Modifier = qr{(?:$Attribute|$Sparse|$mods)}; |
532 | $BasicType = qr{ | ||
533 | (?:$typeTypedefs\b)| | ||
534 | (?:${all}\b) | ||
535 | }x; | ||
479 | $NonptrType = qr{ | 536 | $NonptrType = qr{ |
480 | (?:$Modifier\s+|const\s+)* | 537 | (?:$Modifier\s+|const\s+)* |
481 | (?: | 538 | (?: |
482 | (?:typeof|__typeof__)\s*\([^\)]*\)| | 539 | (?:typeof|__typeof__)\s*\([^\)]*\)| |
483 | (?:$typeOtherOSTypedefs\b)| | ||
484 | (?:$typeTypedefs\b)| | 540 | (?:$typeTypedefs\b)| |
485 | (?:${all}\b) | 541 | (?:${all}\b) |
486 | ) | 542 | ) |
@@ -498,7 +554,6 @@ sub build_types { | |||
498 | (?: | 554 | (?: |
499 | (?:typeof|__typeof__)\s*\([^\)]*\)| | 555 | (?:typeof|__typeof__)\s*\([^\)]*\)| |
500 | (?:$typeTypedefs\b)| | 556 | (?:$typeTypedefs\b)| |
501 | (?:$typeOtherOSTypedefs\b)| | ||
502 | (?:${allWithAttr}\b) | 557 | (?:${allWithAttr}\b) |
503 | ) | 558 | ) |
504 | (?:\s+$Modifier|\s+const)* | 559 | (?:\s+$Modifier|\s+const)* |
@@ -693,6 +748,13 @@ for my $filename (@ARGV) { | |||
693 | push(@rawlines, $_); | 748 | push(@rawlines, $_); |
694 | } | 749 | } |
695 | close($FILE); | 750 | close($FILE); |
751 | |||
752 | if ($#ARGV > 0 && $quiet == 0) { | ||
753 | print '-' x length($vname) . "\n"; | ||
754 | print "$vname\n"; | ||
755 | print '-' x length($vname) . "\n"; | ||
756 | } | ||
757 | |||
696 | if (!process($filename)) { | 758 | if (!process($filename)) { |
697 | $exit = 1; | 759 | $exit = 1; |
698 | } | 760 | } |
@@ -702,6 +764,29 @@ for my $filename (@ARGV) { | |||
702 | @fixed_inserted = (); | 764 | @fixed_inserted = (); |
703 | @fixed_deleted = (); | 765 | @fixed_deleted = (); |
704 | $fixlinenr = -1; | 766 | $fixlinenr = -1; |
767 | @modifierListFile = (); | ||
768 | @typeListFile = (); | ||
769 | build_types(); | ||
770 | } | ||
771 | |||
772 | if (!$quiet) { | ||
773 | hash_show_words(\%use_type, "Used"); | ||
774 | hash_show_words(\%ignore_type, "Ignored"); | ||
775 | |||
776 | if ($^V lt 5.10.0) { | ||
777 | print << "EOM" | ||
778 | |||
779 | NOTE: perl $^V is not modern enough to detect all possible issues. | ||
780 | An upgrade to at least perl v5.10.0 is suggested. | ||
781 | EOM | ||
782 | } | ||
783 | if ($exit) { | ||
784 | print << "EOM" | ||
785 | |||
786 | NOTE: If any of the errors are false positives, please report | ||
787 | them to the maintainer, see CHECKPATCH in MAINTAINERS. | ||
788 | EOM | ||
789 | } | ||
705 | } | 790 | } |
706 | 791 | ||
707 | exit($exit); | 792 | exit($exit); |
@@ -957,7 +1042,7 @@ sub sanitise_line { | |||
957 | sub get_quoted_string { | 1042 | sub get_quoted_string { |
958 | my ($line, $rawline) = @_; | 1043 | my ($line, $rawline) = @_; |
959 | 1044 | ||
960 | return "" if ($line !~ m/(\"[X\t]+\")/g); | 1045 | return "" if ($line !~ m/($String)/g); |
961 | return substr($rawline, $-[0], $+[0] - $-[0]); | 1046 | return substr($rawline, $-[0], $+[0] - $-[0]); |
962 | } | 1047 | } |
963 | 1048 | ||
@@ -1566,13 +1651,13 @@ sub possible { | |||
1566 | for my $modifier (split(' ', $possible)) { | 1651 | for my $modifier (split(' ', $possible)) { |
1567 | if ($modifier !~ $notPermitted) { | 1652 | if ($modifier !~ $notPermitted) { |
1568 | warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible); | 1653 | warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible); |
1569 | push(@modifierList, $modifier); | 1654 | push(@modifierListFile, $modifier); |
1570 | } | 1655 | } |
1571 | } | 1656 | } |
1572 | 1657 | ||
1573 | } else { | 1658 | } else { |
1574 | warn "POSSIBLE: $possible ($line)\n" if ($dbg_possible); | 1659 | warn "POSSIBLE: $possible ($line)\n" if ($dbg_possible); |
1575 | push(@typeList, $possible); | 1660 | push(@typeListFile, $possible); |
1576 | } | 1661 | } |
1577 | build_types(); | 1662 | build_types(); |
1578 | } else { | 1663 | } else { |
@@ -1597,15 +1682,32 @@ sub report { | |||
1597 | (defined $tst_only && $msg !~ /\Q$tst_only\E/)) { | 1682 | (defined $tst_only && $msg !~ /\Q$tst_only\E/)) { |
1598 | return 0; | 1683 | return 0; |
1599 | } | 1684 | } |
1600 | my $line; | 1685 | my $output = ''; |
1686 | if (-t STDOUT && $color) { | ||
1687 | if ($level eq 'ERROR') { | ||
1688 | $output .= RED; | ||
1689 | } elsif ($level eq 'WARNING') { | ||
1690 | $output .= YELLOW; | ||
1691 | } else { | ||
1692 | $output .= GREEN; | ||
1693 | } | ||
1694 | } | ||
1695 | $output .= $prefix . $level . ':'; | ||
1601 | if ($show_types) { | 1696 | if ($show_types) { |
1602 | $line = "$prefix$level:$type: $msg\n"; | 1697 | $output .= BLUE if (-t STDOUT && $color); |
1603 | } else { | 1698 | $output .= "$type:"; |
1604 | $line = "$prefix$level: $msg\n"; | 1699 | } |
1700 | $output .= RESET if (-t STDOUT && $color); | ||
1701 | $output .= ' ' . $msg . "\n"; | ||
1702 | |||
1703 | if ($showfile) { | ||
1704 | my @lines = split("\n", $output, -1); | ||
1705 | splice(@lines, 1, 1); | ||
1706 | $output = join("\n", @lines); | ||
1605 | } | 1707 | } |
1606 | $line = (split('\n', $line))[0] . "\n" if ($terse); | 1708 | $output = (split('\n', $output))[0] . "\n" if ($terse); |
1607 | 1709 | ||
1608 | push(our @report, $line); | 1710 | push(our @report, $output); |
1609 | 1711 | ||
1610 | return 1; | 1712 | return 1; |
1611 | } | 1713 | } |
@@ -1646,7 +1748,7 @@ sub fix_inserted_deleted_lines { | |||
1646 | foreach my $old_line (@{$linesRef}) { | 1748 | foreach my $old_line (@{$linesRef}) { |
1647 | my $save_line = 1; | 1749 | my $save_line = 1; |
1648 | my $line = $old_line; #don't modify the array | 1750 | my $line = $old_line; #don't modify the array |
1649 | if ($line =~ /^(?:\+\+\+\|\-\-\-)\s+\S+/) { #new filename | 1751 | if ($line =~ /^(?:\+\+\+|\-\-\-)\s+\S+/) { #new filename |
1650 | $delta_offset = 0; | 1752 | $delta_offset = 0; |
1651 | } elsif ($line =~ /^\@\@ -\d+,\d+ \+\d+,\d+ \@\@/) { #new hunk | 1753 | } elsif ($line =~ /^\@\@ -\d+,\d+ \+\d+,\d+ \@\@/) { #new hunk |
1652 | $range_last_linenr = $new_linenr; | 1754 | $range_last_linenr = $new_linenr; |
@@ -1854,6 +1956,8 @@ sub process { | |||
1854 | 1956 | ||
1855 | my $in_header_lines = $file ? 0 : 1; | 1957 | my $in_header_lines = $file ? 0 : 1; |
1856 | my $in_commit_log = 0; #Scanning lines before patch | 1958 | my $in_commit_log = 0; #Scanning lines before patch |
1959 | my $commit_log_long_line = 0; | ||
1960 | my $commit_log_has_diff = 0; | ||
1857 | my $reported_maintainer_file = 0; | 1961 | my $reported_maintainer_file = 0; |
1858 | my $non_utf8_charset = 0; | 1962 | my $non_utf8_charset = 0; |
1859 | 1963 | ||
@@ -1987,7 +2091,8 @@ sub process { | |||
1987 | my $rawline = $rawlines[$linenr - 1]; | 2091 | my $rawline = $rawlines[$linenr - 1]; |
1988 | 2092 | ||
1989 | #extract the line range in the file after the patch is applied | 2093 | #extract the line range in the file after the patch is applied |
1990 | if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) { | 2094 | if (!$in_commit_log && |
2095 | $line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) { | ||
1991 | $is_patch = 1; | 2096 | $is_patch = 1; |
1992 | $first_line = $linenr + 1; | 2097 | $first_line = $linenr + 1; |
1993 | $realline=$1-1; | 2098 | $realline=$1-1; |
@@ -2028,10 +2133,6 @@ sub process { | |||
2028 | 2133 | ||
2029 | my $hunk_line = ($realcnt != 0); | 2134 | my $hunk_line = ($realcnt != 0); |
2030 | 2135 | ||
2031 | #make up the handle for any error we report on this line | ||
2032 | $prefix = "$filename:$realline: " if ($emacs && $file); | ||
2033 | $prefix = "$filename:$linenr: " if ($emacs && !$file); | ||
2034 | |||
2035 | $here = "#$linenr: " if (!$file); | 2136 | $here = "#$linenr: " if (!$file); |
2036 | $here = "#$realline: " if ($file); | 2137 | $here = "#$realline: " if ($file); |
2037 | 2138 | ||
@@ -2061,6 +2162,13 @@ sub process { | |||
2061 | $found_file = 1; | 2162 | $found_file = 1; |
2062 | } | 2163 | } |
2063 | 2164 | ||
2165 | #make up the handle for any error we report on this line | ||
2166 | if ($showfile) { | ||
2167 | $prefix = "$realfile:$realline: " | ||
2168 | } elsif ($emacs) { | ||
2169 | $prefix = "$filename:$linenr: "; | ||
2170 | } | ||
2171 | |||
2064 | if ($found_file) { | 2172 | if ($found_file) { |
2065 | if ($realfile =~ m@^(drivers/net/|net/)@) { | 2173 | if ($realfile =~ m@^(drivers/net/|net/)@) { |
2066 | $check = 1; | 2174 | $check = 1; |
@@ -2078,6 +2186,17 @@ sub process { | |||
2078 | 2186 | ||
2079 | $cnt_lines++ if ($realcnt != 0); | 2187 | $cnt_lines++ if ($realcnt != 0); |
2080 | 2188 | ||
2189 | # Check if the commit log has what seems like a diff which can confuse patch | ||
2190 | if ($in_commit_log && !$commit_log_has_diff && | ||
2191 | (($line =~ m@^\s+diff\b.*a/[\w/]+@ && | ||
2192 | $line =~ m@^\s+diff\b.*a/([\w/]+)\s+b/$1\b@) || | ||
2193 | $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ || | ||
2194 | $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) { | ||
2195 | ERROR("DIFF_IN_COMMIT_MSG", | ||
2196 | "Avoid using diff content in the commit message - patch(1) might not work\n" . $herecurr); | ||
2197 | $commit_log_has_diff = 1; | ||
2198 | } | ||
2199 | |||
2081 | # Check for incorrect file permissions | 2200 | # Check for incorrect file permissions |
2082 | if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) { | 2201 | if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) { |
2083 | my $permhere = $here . "FILE: $realfile\n"; | 2202 | my $permhere = $here . "FILE: $realfile\n"; |
@@ -2189,6 +2308,14 @@ sub process { | |||
2189 | "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr); | 2308 | "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr); |
2190 | } | 2309 | } |
2191 | 2310 | ||
2311 | # Check for line lengths > 75 in commit log, warn once | ||
2312 | if ($in_commit_log && !$commit_log_long_line && | ||
2313 | length($line) > 75) { | ||
2314 | WARN("COMMIT_LOG_LONG_LINE", | ||
2315 | "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr); | ||
2316 | $commit_log_long_line = 1; | ||
2317 | } | ||
2318 | |||
2192 | # Check for git id commit length and improperly formed commit descriptions | 2319 | # Check for git id commit length and improperly formed commit descriptions |
2193 | if ($in_commit_log && $line =~ /\b(c)ommit\s+([0-9a-f]{5,})/i) { | 2320 | if ($in_commit_log && $line =~ /\b(c)ommit\s+([0-9a-f]{5,})/i) { |
2194 | my $init_char = $1; | 2321 | my $init_char = $1; |
@@ -2303,8 +2430,9 @@ sub process { | |||
2303 | } | 2430 | } |
2304 | 2431 | ||
2305 | # Check for various typo / spelling mistakes | 2432 | # Check for various typo / spelling mistakes |
2306 | if (defined($misspellings) && ($in_commit_log || $line =~ /^\+/)) { | 2433 | if (defined($misspellings) && |
2307 | while ($rawline =~ /(?:^|[^a-z@])($misspellings)(?:$|[^a-z@])/gi) { | 2434 | ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) { |
2435 | while ($rawline =~ /(?:^|[^a-z@])($misspellings)(?:\b|$|[^a-z@])/gi) { | ||
2308 | my $typo = $1; | 2436 | my $typo = $1; |
2309 | my $typo_fix = $spelling_fix{lc($typo)}; | 2437 | my $typo_fix = $spelling_fix{lc($typo)}; |
2310 | $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/); | 2438 | $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/); |
@@ -2456,15 +2584,56 @@ sub process { | |||
2456 | # check we are in a valid source file if not then ignore this hunk | 2584 | # check we are in a valid source file if not then ignore this hunk |
2457 | next if ($realfile !~ /\.(h|c|s|S|pl|sh|dtsi|dts)$/); | 2585 | next if ($realfile !~ /\.(h|c|s|S|pl|sh|dtsi|dts)$/); |
2458 | 2586 | ||
2459 | #line length limit | 2587 | # line length limit (with some exclusions) |
2460 | if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && | 2588 | # |
2461 | $rawline !~ /^.\s*\*\s*\@$Ident\s/ && | 2589 | # There are a few types of lines that may extend beyond $max_line_length: |
2462 | !($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(KERN_\S+\s*|[^"]*))?"[X\t]*"\s*(?:|,|\)\s*;)\s*$/ || | 2590 | # logging functions like pr_info that end in a string |
2463 | $line =~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) && | 2591 | # lines with a single string |
2464 | $length > $max_line_length) | 2592 | # #defines that are a single string |
2465 | { | 2593 | # |
2466 | WARN("LONG_LINE", | 2594 | # There are 3 different line length message types: |
2467 | "line over $max_line_length characters\n" . $herecurr); | 2595 | # LONG_LINE_COMMENT a comment starts before but extends beyond $max_linelength |
2596 | # LONG_LINE_STRING a string starts before but extends beyond $max_line_length | ||
2597 | # LONG_LINE all other lines longer than $max_line_length | ||
2598 | # | ||
2599 | # if LONG_LINE is ignored, the other 2 types are also ignored | ||
2600 | # | ||
2601 | |||
2602 | if ($length > $max_line_length) { | ||
2603 | my $msg_type = "LONG_LINE"; | ||
2604 | |||
2605 | # Check the allowed long line types first | ||
2606 | |||
2607 | # logging functions that end in a string that starts | ||
2608 | # before $max_line_length | ||
2609 | if ($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(?:KERN_\S+\s*|[^"]*))?($String\s*(?:|,|\)\s*;)\s*)$/ && | ||
2610 | length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) { | ||
2611 | $msg_type = ""; | ||
2612 | |||
2613 | # lines with only strings (w/ possible termination) | ||
2614 | # #defines with only strings | ||
2615 | } elsif ($line =~ /^\+\s*$String\s*(?:\s*|,|\)\s*;)\s*$/ || | ||
2616 | $line =~ /^\+\s*#\s*define\s+\w+\s+$String$/) { | ||
2617 | $msg_type = ""; | ||
2618 | |||
2619 | # Otherwise set the alternate message types | ||
2620 | |||
2621 | # a comment starts before $max_line_length | ||
2622 | } elsif ($line =~ /($;[\s$;]*)$/ && | ||
2623 | length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) { | ||
2624 | $msg_type = "LONG_LINE_COMMENT" | ||
2625 | |||
2626 | # a quoted string starts before $max_line_length | ||
2627 | } elsif ($sline =~ /\s*($String(?:\s*(?:\\|,\s*|\)\s*;\s*))?)$/ && | ||
2628 | length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) { | ||
2629 | $msg_type = "LONG_LINE_STRING" | ||
2630 | } | ||
2631 | |||
2632 | if ($msg_type ne "" && | ||
2633 | (show_type("LONG_LINE") || show_type($msg_type))) { | ||
2634 | WARN($msg_type, | ||
2635 | "line over $max_line_length characters\n" . $herecurr); | ||
2636 | } | ||
2468 | } | 2637 | } |
2469 | 2638 | ||
2470 | # check for adding lines without a newline. | 2639 | # check for adding lines without a newline. |
@@ -2552,8 +2721,15 @@ sub process { | |||
2552 | } | 2721 | } |
2553 | } | 2722 | } |
2554 | 2723 | ||
2555 | if ($line =~ /^\+.*(\w+\s*)?\(\s*$Type\s*\)[ \t]+(?!$Assignment|$Arithmetic|[,;:\?\(\{\}\[\<\>]|&&|\|\||\\$)/ && | 2724 | # check for space after cast like "(int) foo" or "(struct foo) bar" |
2556 | (!defined($1) || $1 !~ /sizeof\s*/)) { | 2725 | # avoid checking a few false positives: |
2726 | # "sizeof(<type>)" or "__alignof__(<type>)" | ||
2727 | # function pointer declarations like "(*foo)(int) = bar;" | ||
2728 | # structure definitions like "(struct foo) { 0 };" | ||
2729 | # multiline macros that define functions | ||
2730 | # known attributes or the __attribute__ keyword | ||
2731 | if ($line =~ /^\+(.*)\(\s*$Type\s*\)([ \t]++)((?![={]|\\$|$Attribute|__attribute__))/ && | ||
2732 | (!defined($1) || $1 !~ /\b(?:sizeof|__alignof__)\s*$/)) { | ||
2557 | if (CHK("SPACING", | 2733 | if (CHK("SPACING", |
2558 | "No space is necessary after a cast\n" . $herecurr) && | 2734 | "No space is necessary after a cast\n" . $herecurr) && |
2559 | $fix) { | 2735 | $fix) { |
@@ -3107,12 +3283,12 @@ sub process { | |||
3107 | } | 3283 | } |
3108 | 3284 | ||
3109 | # check for global initialisers. | 3285 | # check for global initialisers. |
3110 | if ($line =~ /^\+(\s*$Type\s*$Ident\s*(?:\s+$Modifier))*\s*=\s*(0|NULL|false)\s*;/) { | 3286 | if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*(?:0|NULL|false)\s*;/) { |
3111 | if (ERROR("GLOBAL_INITIALISERS", | 3287 | if (ERROR("GLOBAL_INITIALISERS", |
3112 | "do not initialise globals to 0 or NULL\n" . | 3288 | "do not initialise globals to 0 or NULL\n" . |
3113 | $herecurr) && | 3289 | $herecurr) && |
3114 | $fix) { | 3290 | $fix) { |
3115 | $fixed[$fixlinenr] =~ s/($Type\s*$Ident\s*(?:\s+$Modifier))*\s*=\s*(0|NULL|false)\s*;/$1;/; | 3291 | $fixed[$fixlinenr] =~ s/(^.$Type\s*$Ident(?:\s+$Modifier)*)\s*=\s*(0|NULL|false)\s*;/$1;/; |
3116 | } | 3292 | } |
3117 | } | 3293 | } |
3118 | # check for static initialisers. | 3294 | # check for static initialisers. |
@@ -3146,6 +3322,18 @@ sub process { | |||
3146 | $herecurr); | 3322 | $herecurr); |
3147 | } | 3323 | } |
3148 | 3324 | ||
3325 | # check for const <foo> const where <foo> is not a pointer or array type | ||
3326 | if ($sline =~ /\bconst\s+($BasicType)\s+const\b/) { | ||
3327 | my $found = $1; | ||
3328 | if ($sline =~ /\bconst\s+\Q$found\E\s+const\b\s*\*/) { | ||
3329 | WARN("CONST_CONST", | ||
3330 | "'const $found const *' should probably be 'const $found * const'\n" . $herecurr); | ||
3331 | } elsif ($sline !~ /\bconst\s+\Q$found\E\s+const\s+\w+\s*\[/) { | ||
3332 | WARN("CONST_CONST", | ||
3333 | "'const $found const' should probably be 'const $found'\n" . $herecurr); | ||
3334 | } | ||
3335 | } | ||
3336 | |||
3149 | # check for non-global char *foo[] = {"bar", ...} declarations. | 3337 | # check for non-global char *foo[] = {"bar", ...} declarations. |
3150 | if ($line =~ /^.\s+(?:static\s+|const\s+)?char\s+\*\s*\w+\s*\[\s*\]\s*=\s*\{/) { | 3338 | if ($line =~ /^.\s+(?:static\s+|const\s+)?char\s+\*\s*\w+\s*\[\s*\]\s*=\s*\{/) { |
3151 | WARN("STATIC_CONST_CHAR_ARRAY", | 3339 | WARN("STATIC_CONST_CHAR_ARRAY", |
@@ -3153,6 +3341,19 @@ sub process { | |||
3153 | $herecurr); | 3341 | $herecurr); |
3154 | } | 3342 | } |
3155 | 3343 | ||
3344 | # check for sizeof(foo)/sizeof(foo[0]) that could be ARRAY_SIZE(foo) | ||
3345 | if ($line =~ m@\bsizeof\s*\(\s*($Lval)\s*\)@) { | ||
3346 | my $array = $1; | ||
3347 | if ($line =~ m@\b(sizeof\s*\(\s*\Q$array\E\s*\)\s*/\s*sizeof\s*\(\s*\Q$array\E\s*\[\s*0\s*\]\s*\))@) { | ||
3348 | my $array_div = $1; | ||
3349 | if (WARN("ARRAY_SIZE", | ||
3350 | "Prefer ARRAY_SIZE($array)\n" . $herecurr) && | ||
3351 | $fix) { | ||
3352 | $fixed[$fixlinenr] =~ s/\Q$array_div\E/ARRAY_SIZE($array)/; | ||
3353 | } | ||
3354 | } | ||
3355 | } | ||
3356 | |||
3156 | # check for function declarations without arguments like "int foo()" | 3357 | # check for function declarations without arguments like "int foo()" |
3157 | if ($line =~ /(\b$Type\s+$Ident)\s*\(\s*\)/) { | 3358 | if ($line =~ /(\b$Type\s+$Ident)\s*\(\s*\)/) { |
3158 | if (ERROR("FUNCTION_WITHOUT_ARGS", | 3359 | if (ERROR("FUNCTION_WITHOUT_ARGS", |
@@ -3177,7 +3378,6 @@ sub process { | |||
3177 | $line !~ /\btypedef\s+$Type\s*\(\s*\*?$Ident\s*\)\s*\(/ && | 3378 | $line !~ /\btypedef\s+$Type\s*\(\s*\*?$Ident\s*\)\s*\(/ && |
3178 | $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ && | 3379 | $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ && |
3179 | $line !~ /\b$typeTypedefs\b/ && | 3380 | $line !~ /\b$typeTypedefs\b/ && |
3180 | $line !~ /\b$typeOtherOSTypedefs\b/ && | ||
3181 | $line !~ /\b__bitwise(?:__|)\b/) { | 3381 | $line !~ /\b__bitwise(?:__|)\b/) { |
3182 | WARN("NEW_TYPEDEFS", | 3382 | WARN("NEW_TYPEDEFS", |
3183 | "do not add new typedefs\n" . $herecurr); | 3383 | "do not add new typedefs\n" . $herecurr); |
@@ -3309,6 +3509,14 @@ sub process { | |||
3309 | "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr); | 3509 | "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr); |
3310 | } | 3510 | } |
3311 | 3511 | ||
3512 | # ENOSYS means "bad syscall nr" and nothing else. This will have a small | ||
3513 | # number of false positives, but assembly files are not checked, so at | ||
3514 | # least the arch entry code will not trigger this warning. | ||
3515 | if ($line =~ /\bENOSYS\b/) { | ||
3516 | WARN("ENOSYS", | ||
3517 | "ENOSYS means 'invalid syscall nr' and nothing else\n" . $herecurr); | ||
3518 | } | ||
3519 | |||
3312 | # function brace can't be on same line, except for #defines of do while, | 3520 | # function brace can't be on same line, except for #defines of do while, |
3313 | # or if closed on same line | 3521 | # or if closed on same line |
3314 | if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and | 3522 | if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and |
@@ -3565,7 +3773,7 @@ sub process { | |||
3565 | 3773 | ||
3566 | # Ignore operators passed as parameters. | 3774 | # Ignore operators passed as parameters. |
3567 | if ($op_type ne 'V' && | 3775 | if ($op_type ne 'V' && |
3568 | $ca =~ /\s$/ && $cc =~ /^\s*,/) { | 3776 | $ca =~ /\s$/ && $cc =~ /^\s*[,\)]/) { |
3569 | 3777 | ||
3570 | # # Ignore comments | 3778 | # # Ignore comments |
3571 | # } elsif ($op =~ /^$;+$/) { | 3779 | # } elsif ($op =~ /^$;+$/) { |
@@ -3750,6 +3958,14 @@ sub process { | |||
3750 | $ok = 1; | 3958 | $ok = 1; |
3751 | } | 3959 | } |
3752 | 3960 | ||
3961 | # for asm volatile statements | ||
3962 | # ignore a colon with another | ||
3963 | # colon immediately before or after | ||
3964 | if (($op eq ':') && | ||
3965 | ($ca =~ /:$/ || $cc =~ /^:/)) { | ||
3966 | $ok = 1; | ||
3967 | } | ||
3968 | |||
3753 | # messages are ERROR, but ?: are CHK | 3969 | # messages are ERROR, but ?: are CHK |
3754 | if ($ok == 0) { | 3970 | if ($ok == 0) { |
3755 | my $msg_type = \&ERROR; | 3971 | my $msg_type = \&ERROR; |
@@ -3963,12 +4179,12 @@ sub process { | |||
3963 | } | 4179 | } |
3964 | } | 4180 | } |
3965 | 4181 | ||
3966 | # Return of what appears to be an errno should normally be -'ve | 4182 | # Return of what appears to be an errno should normally be negative |
3967 | if ($line =~ /^.\s*return\s*(E[A-Z]*)\s*;/) { | 4183 | if ($sline =~ /\breturn(?:\s*\(+\s*|\s+)(E[A-Z]+)(?:\s*\)+\s*|\s*)[;:,]/) { |
3968 | my $name = $1; | 4184 | my $name = $1; |
3969 | if ($name ne 'EOF' && $name ne 'ERROR') { | 4185 | if ($name ne 'EOF' && $name ne 'ERROR') { |
3970 | WARN("USE_NEGATIVE_ERRNO", | 4186 | WARN("USE_NEGATIVE_ERRNO", |
3971 | "return of an errno should typically be -ve (return -$1)\n" . $herecurr); | 4187 | "return of an errno should typically be negative (ie: return -$1)\n" . $herecurr); |
3972 | } | 4188 | } |
3973 | } | 4189 | } |
3974 | 4190 | ||
@@ -4178,7 +4394,8 @@ sub process { | |||
4178 | } | 4394 | } |
4179 | } | 4395 | } |
4180 | 4396 | ||
4181 | #warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line) | 4397 | # warn if <asm/foo.h> is #included and <linux/foo.h> is available and includes |
4398 | # itself <asm/foo.h> (uses RAW line) | ||
4182 | if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) { | 4399 | if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) { |
4183 | my $file = "$1.h"; | 4400 | my $file = "$1.h"; |
4184 | my $checkfile = "include/linux/$file"; | 4401 | my $checkfile = "include/linux/$file"; |
@@ -4186,12 +4403,15 @@ sub process { | |||
4186 | $realfile ne $checkfile && | 4403 | $realfile ne $checkfile && |
4187 | $1 !~ /$allowed_asm_includes/) | 4404 | $1 !~ /$allowed_asm_includes/) |
4188 | { | 4405 | { |
4189 | if ($realfile =~ m{^arch/}) { | 4406 | my $asminclude = `grep -Ec "#include\\s+<asm/$file>" $root/$checkfile`; |
4190 | CHK("ARCH_INCLUDE_LINUX", | 4407 | if ($asminclude > 0) { |
4191 | "Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr); | 4408 | if ($realfile =~ m{^arch/}) { |
4192 | } else { | 4409 | CHK("ARCH_INCLUDE_LINUX", |
4193 | WARN("INCLUDE_LINUX", | 4410 | "Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr); |
4194 | "Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr); | 4411 | } else { |
4412 | WARN("INCLUDE_LINUX", | ||
4413 | "Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr); | ||
4414 | } | ||
4195 | } | 4415 | } |
4196 | } | 4416 | } |
4197 | } | 4417 | } |
@@ -4230,8 +4450,8 @@ sub process { | |||
4230 | } | 4450 | } |
4231 | 4451 | ||
4232 | # Flatten any obvious string concatentation. | 4452 | # Flatten any obvious string concatentation. |
4233 | while ($dstat =~ s/("X*")\s*$Ident/$1/ || | 4453 | while ($dstat =~ s/($String)\s*$Ident/$1/ || |
4234 | $dstat =~ s/$Ident\s*("X*")/$1/) | 4454 | $dstat =~ s/$Ident\s*($String)/$1/) |
4235 | { | 4455 | { |
4236 | } | 4456 | } |
4237 | 4457 | ||
@@ -4512,7 +4732,7 @@ sub process { | |||
4512 | # to grep for the string. Make exceptions when the previous string ends in a | 4732 | # to grep for the string. Make exceptions when the previous string ends in a |
4513 | # newline (multiple lines in one string constant) or '\t', '\r', ';', or '{' | 4733 | # newline (multiple lines in one string constant) or '\t', '\r', ';', or '{' |
4514 | # (common in inline assembly) or is a octal \123 or hexadecimal \xaf value | 4734 | # (common in inline assembly) or is a octal \123 or hexadecimal \xaf value |
4515 | if ($line =~ /^\+\s*"[X\t]*"/ && | 4735 | if ($line =~ /^\+\s*$String/ && |
4516 | $prevline =~ /"\s*$/ && | 4736 | $prevline =~ /"\s*$/ && |
4517 | $prevrawline !~ /(?:\\(?:[ntr]|[0-7]{1,3}|x[0-9a-fA-F]{1,2})|;\s*|\{\s*)"\s*$/) { | 4737 | $prevrawline !~ /(?:\\(?:[ntr]|[0-7]{1,3}|x[0-9a-fA-F]{1,2})|;\s*|\{\s*)"\s*$/) { |
4518 | if (WARN("SPLIT_STRING", | 4738 | if (WARN("SPLIT_STRING", |
@@ -4558,13 +4778,13 @@ sub process { | |||
4558 | } | 4778 | } |
4559 | 4779 | ||
4560 | # concatenated string without spaces between elements | 4780 | # concatenated string without spaces between elements |
4561 | if ($line =~ /"X+"[A-Z_]+/ || $line =~ /[A-Z_]+"X+"/) { | 4781 | if ($line =~ /$String[A-Z_]/ || $line =~ /[A-Za-z0-9_]$String/) { |
4562 | CHK("CONCATENATED_STRING", | 4782 | CHK("CONCATENATED_STRING", |
4563 | "Concatenated strings should use spaces between elements\n" . $herecurr); | 4783 | "Concatenated strings should use spaces between elements\n" . $herecurr); |
4564 | } | 4784 | } |
4565 | 4785 | ||
4566 | # uncoalesced string fragments | 4786 | # uncoalesced string fragments |
4567 | if ($line =~ /"X*"\s*"/) { | 4787 | if ($line =~ /$String\s*"/) { |
4568 | WARN("STRING_FRAGMENTS", | 4788 | WARN("STRING_FRAGMENTS", |
4569 | "Consecutive strings are generally better as a single string\n" . $herecurr); | 4789 | "Consecutive strings are generally better as a single string\n" . $herecurr); |
4570 | } | 4790 | } |
@@ -4700,6 +4920,16 @@ sub process { | |||
4700 | } | 4920 | } |
4701 | } | 4921 | } |
4702 | 4922 | ||
4923 | # check for __read_mostly with const non-pointer (should just be const) | ||
4924 | if ($line =~ /\b__read_mostly\b/ && | ||
4925 | $line =~ /($Type)\s*$Ident/ && $1 !~ /\*\s*$/ && $1 =~ /\bconst\b/) { | ||
4926 | if (ERROR("CONST_READ_MOSTLY", | ||
4927 | "Invalid use of __read_mostly with const type\n" . $herecurr) && | ||
4928 | $fix) { | ||
4929 | $fixed[$fixlinenr] =~ s/\s+__read_mostly\b//; | ||
4930 | } | ||
4931 | } | ||
4932 | |||
4703 | # don't use __constant_<foo> functions outside of include/uapi/ | 4933 | # don't use __constant_<foo> functions outside of include/uapi/ |
4704 | if ($realfile !~ m@^include/uapi/@ && | 4934 | if ($realfile !~ m@^include/uapi/@ && |
4705 | $line =~ /(__constant_(?:htons|ntohs|[bl]e(?:16|32|64)_to_cpu|cpu_to_[bl]e(?:16|32|64)))\s*\(/) { | 4935 | $line =~ /(__constant_(?:htons|ntohs|[bl]e(?:16|32|64)_to_cpu|cpu_to_[bl]e(?:16|32|64)))\s*\(/) { |
@@ -4781,6 +5011,13 @@ sub process { | |||
4781 | "memory barrier without comment\n" . $herecurr); | 5011 | "memory barrier without comment\n" . $herecurr); |
4782 | } | 5012 | } |
4783 | } | 5013 | } |
5014 | # check for waitqueue_active without a comment. | ||
5015 | if ($line =~ /\bwaitqueue_active\s*\(/) { | ||
5016 | if (!ctx_has_comment($first_line, $linenr)) { | ||
5017 | WARN("WAITQUEUE_ACTIVE", | ||
5018 | "waitqueue_active without comment\n" . $herecurr); | ||
5019 | } | ||
5020 | } | ||
4784 | # check of hardware specific defines | 5021 | # check of hardware specific defines |
4785 | if ($line =~ m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) { | 5022 | if ($line =~ m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) { |
4786 | CHK("ARCH_DEFINES", | 5023 | CHK("ARCH_DEFINES", |
@@ -4856,6 +5093,24 @@ sub process { | |||
4856 | "Using weak declarations can have unintended link defects\n" . $herecurr); | 5093 | "Using weak declarations can have unintended link defects\n" . $herecurr); |
4857 | } | 5094 | } |
4858 | 5095 | ||
5096 | # check for c99 types like uint8_t used outside of uapi/ | ||
5097 | if ($realfile !~ m@\binclude/uapi/@ && | ||
5098 | $line =~ /\b($Declare)\s*$Ident\s*[=;,\[]/) { | ||
5099 | my $type = $1; | ||
5100 | if ($type =~ /\b($typeC99Typedefs)\b/) { | ||
5101 | $type = $1; | ||
5102 | my $kernel_type = 'u'; | ||
5103 | $kernel_type = 's' if ($type =~ /^_*[si]/); | ||
5104 | $type =~ /(\d+)/; | ||
5105 | $kernel_type .= $1; | ||
5106 | if (CHK("PREFER_KERNEL_TYPES", | ||
5107 | "Prefer kernel type '$kernel_type' over '$type'\n" . $herecurr) && | ||
5108 | $fix) { | ||
5109 | $fixed[$fixlinenr] =~ s/\b$type\b/$kernel_type/; | ||
5110 | } | ||
5111 | } | ||
5112 | } | ||
5113 | |||
4859 | # check for sizeof(&) | 5114 | # check for sizeof(&) |
4860 | if ($line =~ /\bsizeof\s*\(\s*\&/) { | 5115 | if ($line =~ /\bsizeof\s*\(\s*\&/) { |
4861 | WARN("SIZEOF_ADDRESS", | 5116 | WARN("SIZEOF_ADDRESS", |
@@ -4893,7 +5148,7 @@ sub process { | |||
4893 | # Check for misused memsets | 5148 | # Check for misused memsets |
4894 | if ($^V && $^V ge 5.10.0 && | 5149 | if ($^V && $^V ge 5.10.0 && |
4895 | defined $stat && | 5150 | defined $stat && |
4896 | $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/s) { | 5151 | $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/) { |
4897 | 5152 | ||
4898 | my $ms_addr = $2; | 5153 | my $ms_addr = $2; |
4899 | my $ms_val = $7; | 5154 | my $ms_val = $7; |
@@ -4910,14 +5165,46 @@ sub process { | |||
4910 | 5165 | ||
4911 | # Check for memcpy(foo, bar, ETH_ALEN) that could be ether_addr_copy(foo, bar) | 5166 | # Check for memcpy(foo, bar, ETH_ALEN) that could be ether_addr_copy(foo, bar) |
4912 | if ($^V && $^V ge 5.10.0 && | 5167 | if ($^V && $^V ge 5.10.0 && |
4913 | $line =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/s) { | 5168 | defined $stat && |
5169 | $stat =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) { | ||
4914 | if (WARN("PREFER_ETHER_ADDR_COPY", | 5170 | if (WARN("PREFER_ETHER_ADDR_COPY", |
4915 | "Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)\n" . $herecurr) && | 5171 | "Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)\n" . "$here\n$stat\n") && |
4916 | $fix) { | 5172 | $fix) { |
4917 | $fixed[$fixlinenr] =~ s/\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/ether_addr_copy($2, $7)/; | 5173 | $fixed[$fixlinenr] =~ s/\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/ether_addr_copy($2, $7)/; |
4918 | } | 5174 | } |
4919 | } | 5175 | } |
4920 | 5176 | ||
5177 | # Check for memcmp(foo, bar, ETH_ALEN) that could be ether_addr_equal*(foo, bar) | ||
5178 | if ($^V && $^V ge 5.10.0 && | ||
5179 | defined $stat && | ||
5180 | $stat =~ /^\+(?:.*?)\bmemcmp\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) { | ||
5181 | WARN("PREFER_ETHER_ADDR_EQUAL", | ||
5182 | "Prefer ether_addr_equal() or ether_addr_equal_unaligned() over memcmp()\n" . "$here\n$stat\n") | ||
5183 | } | ||
5184 | |||
5185 | # check for memset(foo, 0x0, ETH_ALEN) that could be eth_zero_addr | ||
5186 | # check for memset(foo, 0xFF, ETH_ALEN) that could be eth_broadcast_addr | ||
5187 | if ($^V && $^V ge 5.10.0 && | ||
5188 | defined $stat && | ||
5189 | $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) { | ||
5190 | |||
5191 | my $ms_val = $7; | ||
5192 | |||
5193 | if ($ms_val =~ /^(?:0x|)0+$/i) { | ||
5194 | if (WARN("PREFER_ETH_ZERO_ADDR", | ||
5195 | "Prefer eth_zero_addr over memset()\n" . "$here\n$stat\n") && | ||
5196 | $fix) { | ||
5197 | $fixed[$fixlinenr] =~ s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_zero_addr($2)/; | ||
5198 | } | ||
5199 | } elsif ($ms_val =~ /^(?:0xff|255)$/i) { | ||
5200 | if (WARN("PREFER_ETH_BROADCAST_ADDR", | ||
5201 | "Prefer eth_broadcast_addr() over memset()\n" . "$here\n$stat\n") && | ||
5202 | $fix) { | ||
5203 | $fixed[$fixlinenr] =~ s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_broadcast_addr($2)/; | ||
5204 | } | ||
5205 | } | ||
5206 | } | ||
5207 | |||
4921 | # typecasts on min/max could be min_t/max_t | 5208 | # typecasts on min/max could be min_t/max_t |
4922 | if ($^V && $^V ge 5.10.0 && | 5209 | if ($^V && $^V ge 5.10.0 && |
4923 | defined $stat && | 5210 | defined $stat && |
@@ -5261,6 +5548,7 @@ sub process { | |||
5261 | stacktrace_ops| | 5548 | stacktrace_ops| |
5262 | sysfs_ops| | 5549 | sysfs_ops| |
5263 | tty_operations| | 5550 | tty_operations| |
5551 | uart_ops| | ||
5264 | usb_mon_operations| | 5552 | usb_mon_operations| |
5265 | wd_ops}x; | 5553 | wd_ops}x; |
5266 | if ($line !~ /\bconst\b/ && | 5554 | if ($line !~ /\bconst\b/ && |
@@ -5318,8 +5606,8 @@ sub process { | |||
5318 | } | 5606 | } |
5319 | } | 5607 | } |
5320 | 5608 | ||
5321 | if ($line =~ /debugfs_create_file.*S_IWUGO/ || | 5609 | if ($line =~ /debugfs_create_\w+.*\b$mode_perms_world_writable\b/ || |
5322 | $line =~ /DEVICE_ATTR.*S_IWUGO/ ) { | 5610 | $line =~ /DEVICE_ATTR.*\b$mode_perms_world_writable\b/) { |
5323 | WARN("EXPORTED_WORLD_WRITABLE", | 5611 | WARN("EXPORTED_WORLD_WRITABLE", |
5324 | "Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr); | 5612 | "Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr); |
5325 | } | 5613 | } |
@@ -5354,6 +5642,24 @@ sub process { | |||
5354 | } | 5642 | } |
5355 | } | 5643 | } |
5356 | } | 5644 | } |
5645 | |||
5646 | # validate content of MODULE_LICENSE against list from include/linux/module.h | ||
5647 | if ($line =~ /\bMODULE_LICENSE\s*\(\s*($String)\s*\)/) { | ||
5648 | my $extracted_string = get_quoted_string($line, $rawline); | ||
5649 | my $valid_licenses = qr{ | ||
5650 | GPL| | ||
5651 | GPL\ v2| | ||
5652 | GPL\ and\ additional\ rights| | ||
5653 | Dual\ BSD/GPL| | ||
5654 | Dual\ MIT/GPL| | ||
5655 | Dual\ MPL/GPL| | ||
5656 | Proprietary | ||
5657 | }x; | ||
5658 | if ($extracted_string !~ /^"(?:$valid_licenses)"$/x) { | ||
5659 | WARN("MODULE_LICENSE", | ||
5660 | "unknown module license " . $extracted_string . "\n" . $herecurr); | ||
5661 | } | ||
5662 | } | ||
5357 | } | 5663 | } |
5358 | 5664 | ||
5359 | # If we have no input at all, then there is nothing to report on | 5665 | # If we have no input at all, then there is nothing to report on |
@@ -5374,11 +5680,11 @@ sub process { | |||
5374 | exit(0); | 5680 | exit(0); |
5375 | } | 5681 | } |
5376 | 5682 | ||
5377 | if (!$is_patch) { | 5683 | if (!$is_patch && $file !~ /cover-letter\.patch$/) { |
5378 | ERROR("NOT_UNIFIED_DIFF", | 5684 | ERROR("NOT_UNIFIED_DIFF", |
5379 | "Does not appear to be a unified-diff format patch\n"); | 5685 | "Does not appear to be a unified-diff format patch\n"); |
5380 | } | 5686 | } |
5381 | if ($is_patch && $chk_signoff && $signoff == 0) { | 5687 | if ($is_patch && $filename ne '-' && $chk_signoff && $signoff == 0) { |
5382 | ERROR("MISSING_SIGN_OFF", | 5688 | ERROR("MISSING_SIGN_OFF", |
5383 | "Missing Signed-off-by: line(s)\n"); | 5689 | "Missing Signed-off-by: line(s)\n"); |
5384 | } | 5690 | } |
@@ -5389,28 +5695,21 @@ sub process { | |||
5389 | print "total: $cnt_error errors, $cnt_warn warnings, " . | 5695 | print "total: $cnt_error errors, $cnt_warn warnings, " . |
5390 | (($check)? "$cnt_chk checks, " : "") . | 5696 | (($check)? "$cnt_chk checks, " : "") . |
5391 | "$cnt_lines lines checked\n"; | 5697 | "$cnt_lines lines checked\n"; |
5392 | print "\n" if ($quiet == 0); | ||
5393 | } | 5698 | } |
5394 | 5699 | ||
5395 | if ($quiet == 0) { | 5700 | if ($quiet == 0) { |
5396 | |||
5397 | if ($^V lt 5.10.0) { | ||
5398 | print("NOTE: perl $^V is not modern enough to detect all possible issues.\n"); | ||
5399 | print("An upgrade to at least perl v5.10.0 is suggested.\n\n"); | ||
5400 | } | ||
5401 | |||
5402 | # If there were whitespace errors which cleanpatch can fix | 5701 | # If there were whitespace errors which cleanpatch can fix |
5403 | # then suggest that. | 5702 | # then suggest that. |
5404 | if ($rpt_cleaners) { | 5703 | if ($rpt_cleaners) { |
5405 | print "NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or\n"; | ||
5406 | print " scripts/cleanfile\n\n"; | ||
5407 | $rpt_cleaners = 0; | 5704 | $rpt_cleaners = 0; |
5705 | print << "EOM" | ||
5706 | |||
5707 | NOTE: Whitespace errors detected. | ||
5708 | You may wish to use scripts/cleanpatch or scripts/cleanfile | ||
5709 | EOM | ||
5408 | } | 5710 | } |
5409 | } | 5711 | } |
5410 | 5712 | ||
5411 | hash_show_words(\%use_type, "Used"); | ||
5412 | hash_show_words(\%ignore_type, "Ignored"); | ||
5413 | |||
5414 | if ($clean == 0 && $fix && | 5713 | if ($clean == 0 && $fix && |
5415 | ("@rawlines" ne "@fixed" || | 5714 | ("@rawlines" ne "@fixed" || |
5416 | $#fixed_inserted >= 0 || $#fixed_deleted >= 0)) { | 5715 | $#fixed_inserted >= 0 || $#fixed_deleted >= 0)) { |
@@ -5438,6 +5737,7 @@ sub process { | |||
5438 | 5737 | ||
5439 | if (!$quiet) { | 5738 | if (!$quiet) { |
5440 | print << "EOM"; | 5739 | print << "EOM"; |
5740 | |||
5441 | Wrote EXPERIMENTAL --fix correction(s) to '$newfile' | 5741 | Wrote EXPERIMENTAL --fix correction(s) to '$newfile' |
5442 | 5742 | ||
5443 | Do _NOT_ trust the results written to this file. | 5743 | Do _NOT_ trust the results written to this file. |
@@ -5445,22 +5745,17 @@ Do _NOT_ submit these changes without inspecting them for correctness. | |||
5445 | 5745 | ||
5446 | This EXPERIMENTAL file is simply a convenience to help rewrite patches. | 5746 | This EXPERIMENTAL file is simply a convenience to help rewrite patches. |
5447 | No warranties, expressed or implied... | 5747 | No warranties, expressed or implied... |
5448 | |||
5449 | EOM | 5748 | EOM |
5450 | } | 5749 | } |
5451 | } | 5750 | } |
5452 | 5751 | ||
5453 | if ($clean == 1 && $quiet == 0) { | 5752 | if ($quiet == 0) { |
5454 | print "$vname has no obvious style problems and is ready for submission.\n" | 5753 | print "\n"; |
5455 | } | 5754 | if ($clean == 1) { |
5456 | if ($clean == 0 && $quiet == 0) { | 5755 | print "$vname has no obvious style problems and is ready for submission.\n"; |
5457 | print << "EOM"; | 5756 | } else { |
5458 | $vname has style problems, please review. | 5757 | print "$vname has style problems, please review.\n"; |
5459 | 5758 | } | |
5460 | If any of these errors are false positives, please report | ||
5461 | them to the maintainer, see CHECKPATCH in MAINTAINERS. | ||
5462 | EOM | ||
5463 | } | 5759 | } |
5464 | |||
5465 | return $clean; | 5760 | return $clean; |
5466 | } | 5761 | } |
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh index 5b3add31f9f1..2c9082ba6137 100755 --- a/scripts/checksyscalls.sh +++ b/scripts/checksyscalls.sh | |||
@@ -212,5 +212,5 @@ EOF | |||
212 | ) | 212 | ) |
213 | } | 213 | } |
214 | 214 | ||
215 | (ignore_list && syscall_list $(dirname $0)/../arch/x86/syscalls/syscall_32.tbl) | \ | 215 | (ignore_list && syscall_list $(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl) | \ |
216 | $* -E -x c - > /dev/null | 216 | $* -E -x c - > /dev/null |
diff --git a/scripts/coccinelle/misc/bugon.cocci b/scripts/coccinelle/misc/bugon.cocci index 3b7eec24fb5a..27c97f1f2767 100644 --- a/scripts/coccinelle/misc/bugon.cocci +++ b/scripts/coccinelle/misc/bugon.cocci | |||
@@ -57,6 +57,6 @@ coccilib.org.print_todo(p[0], "WARNING use BUG_ON") | |||
57 | p << r.p; | 57 | p << r.p; |
58 | @@ | 58 | @@ |
59 | 59 | ||
60 | msg="WARNING: Use BUG_ON" | 60 | msg="WARNING: Use BUG_ON instead of if condition followed by BUG.\nPlease make sure the condition has no side effects (see conditional BUG_ON definition in include/asm-generic/bug.h)" |
61 | coccilib.report.print_report(p[0], msg) | 61 | coccilib.report.print_report(p[0], msg) |
62 | 62 | ||
diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci index 6cfde94be0ef..a24a754ae1d7 100644 --- a/scripts/coccinelle/misc/irqf_oneshot.cocci +++ b/scripts/coccinelle/misc/irqf_oneshot.cocci | |||
@@ -12,11 +12,13 @@ virtual org | |||
12 | virtual report | 12 | virtual report |
13 | 13 | ||
14 | @r1@ | 14 | @r1@ |
15 | expression dev; | ||
15 | expression irq; | 16 | expression irq; |
16 | expression thread_fn; | 17 | expression thread_fn; |
17 | expression flags; | 18 | expression flags; |
18 | position p; | 19 | position p; |
19 | @@ | 20 | @@ |
21 | ( | ||
20 | request_threaded_irq@p(irq, NULL, thread_fn, | 22 | request_threaded_irq@p(irq, NULL, thread_fn, |
21 | ( | 23 | ( |
22 | flags | IRQF_ONESHOT | 24 | flags | IRQF_ONESHOT |
@@ -24,13 +26,24 @@ flags | IRQF_ONESHOT | |||
24 | IRQF_ONESHOT | 26 | IRQF_ONESHOT |
25 | ) | 27 | ) |
26 | , ...) | 28 | , ...) |
29 | | | ||
30 | devm_request_threaded_irq@p(dev, irq, NULL, thread_fn, | ||
31 | ( | ||
32 | flags | IRQF_ONESHOT | ||
33 | | | ||
34 | IRQF_ONESHOT | ||
35 | ) | ||
36 | , ...) | ||
37 | ) | ||
27 | 38 | ||
28 | @depends on patch@ | 39 | @depends on patch@ |
40 | expression dev; | ||
29 | expression irq; | 41 | expression irq; |
30 | expression thread_fn; | 42 | expression thread_fn; |
31 | expression flags; | 43 | expression flags; |
32 | position p != r1.p; | 44 | position p != r1.p; |
33 | @@ | 45 | @@ |
46 | ( | ||
34 | request_threaded_irq@p(irq, NULL, thread_fn, | 47 | request_threaded_irq@p(irq, NULL, thread_fn, |
35 | ( | 48 | ( |
36 | -0 | 49 | -0 |
@@ -40,6 +53,17 @@ request_threaded_irq@p(irq, NULL, thread_fn, | |||
40 | +flags | IRQF_ONESHOT | 53 | +flags | IRQF_ONESHOT |
41 | ) | 54 | ) |
42 | , ...) | 55 | , ...) |
56 | | | ||
57 | devm_request_threaded_irq@p(dev, irq, NULL, thread_fn, | ||
58 | ( | ||
59 | -0 | ||
60 | +IRQF_ONESHOT | ||
61 | | | ||
62 | -flags | ||
63 | +flags | IRQF_ONESHOT | ||
64 | ) | ||
65 | , ...) | ||
66 | ) | ||
43 | 67 | ||
44 | @depends on context@ | 68 | @depends on context@ |
45 | position p != r1.p; | 69 | position p != r1.p; |
diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c index ee96a2519eff..e81a8c74b8d2 100644 --- a/scripts/dtc/checks.c +++ b/scripts/dtc/checks.c | |||
@@ -53,7 +53,7 @@ struct check { | |||
53 | void *data; | 53 | void *data; |
54 | bool warn, error; | 54 | bool warn, error; |
55 | enum checkstatus status; | 55 | enum checkstatus status; |
56 | int inprogress; | 56 | bool inprogress; |
57 | int num_prereqs; | 57 | int num_prereqs; |
58 | struct check **prereq; | 58 | struct check **prereq; |
59 | }; | 59 | }; |
@@ -113,6 +113,7 @@ static inline void check_msg(struct check *c, const char *fmt, ...) | |||
113 | vfprintf(stderr, fmt, ap); | 113 | vfprintf(stderr, fmt, ap); |
114 | fprintf(stderr, "\n"); | 114 | fprintf(stderr, "\n"); |
115 | } | 115 | } |
116 | va_end(ap); | ||
116 | } | 117 | } |
117 | 118 | ||
118 | #define FAIL(c, ...) \ | 119 | #define FAIL(c, ...) \ |
@@ -141,9 +142,9 @@ static void check_nodes_props(struct check *c, struct node *dt, struct node *nod | |||
141 | check_nodes_props(c, dt, child); | 142 | check_nodes_props(c, dt, child); |
142 | } | 143 | } |
143 | 144 | ||
144 | static int run_check(struct check *c, struct node *dt) | 145 | static bool run_check(struct check *c, struct node *dt) |
145 | { | 146 | { |
146 | int error = 0; | 147 | bool error = false; |
147 | int i; | 148 | int i; |
148 | 149 | ||
149 | assert(!c->inprogress); | 150 | assert(!c->inprogress); |
@@ -151,11 +152,11 @@ static int run_check(struct check *c, struct node *dt) | |||
151 | if (c->status != UNCHECKED) | 152 | if (c->status != UNCHECKED) |
152 | goto out; | 153 | goto out; |
153 | 154 | ||
154 | c->inprogress = 1; | 155 | c->inprogress = true; |
155 | 156 | ||
156 | for (i = 0; i < c->num_prereqs; i++) { | 157 | for (i = 0; i < c->num_prereqs; i++) { |
157 | struct check *prq = c->prereq[i]; | 158 | struct check *prq = c->prereq[i]; |
158 | error |= run_check(prq, dt); | 159 | error = error || run_check(prq, dt); |
159 | if (prq->status != PASSED) { | 160 | if (prq->status != PASSED) { |
160 | c->status = PREREQ; | 161 | c->status = PREREQ; |
161 | check_msg(c, "Failed prerequisite '%s'", | 162 | check_msg(c, "Failed prerequisite '%s'", |
@@ -177,9 +178,9 @@ static int run_check(struct check *c, struct node *dt) | |||
177 | TRACE(c, "\tCompleted, status %d", c->status); | 178 | TRACE(c, "\tCompleted, status %d", c->status); |
178 | 179 | ||
179 | out: | 180 | out: |
180 | c->inprogress = 0; | 181 | c->inprogress = false; |
181 | if ((c->status != PASSED) && (c->error)) | 182 | if ((c->status != PASSED) && (c->error)) |
182 | error = 1; | 183 | error = true; |
183 | return error; | 184 | return error; |
184 | } | 185 | } |
185 | 186 | ||
@@ -624,11 +625,11 @@ static void check_avoid_default_addr_size(struct check *c, struct node *dt, | |||
624 | if (!reg && !ranges) | 625 | if (!reg && !ranges) |
625 | return; | 626 | return; |
626 | 627 | ||
627 | if ((node->parent->addr_cells == -1)) | 628 | if (node->parent->addr_cells == -1) |
628 | FAIL(c, "Relying on default #address-cells value for %s", | 629 | FAIL(c, "Relying on default #address-cells value for %s", |
629 | node->fullpath); | 630 | node->fullpath); |
630 | 631 | ||
631 | if ((node->parent->size_cells == -1)) | 632 | if (node->parent->size_cells == -1) |
632 | FAIL(c, "Relying on default #size-cells value for %s", | 633 | FAIL(c, "Relying on default #size-cells value for %s", |
633 | node->fullpath); | 634 | node->fullpath); |
634 | } | 635 | } |
@@ -706,15 +707,15 @@ static void disable_warning_error(struct check *c, bool warn, bool error) | |||
706 | c->error = c->error && !error; | 707 | c->error = c->error && !error; |
707 | } | 708 | } |
708 | 709 | ||
709 | void parse_checks_option(bool warn, bool error, const char *optarg) | 710 | void parse_checks_option(bool warn, bool error, const char *arg) |
710 | { | 711 | { |
711 | int i; | 712 | int i; |
712 | const char *name = optarg; | 713 | const char *name = arg; |
713 | bool enable = true; | 714 | bool enable = true; |
714 | 715 | ||
715 | if ((strncmp(optarg, "no-", 3) == 0) | 716 | if ((strncmp(arg, "no-", 3) == 0) |
716 | || (strncmp(optarg, "no_", 3) == 0)) { | 717 | || (strncmp(arg, "no_", 3) == 0)) { |
717 | name = optarg + 3; | 718 | name = arg + 3; |
718 | enable = false; | 719 | enable = false; |
719 | } | 720 | } |
720 | 721 | ||
@@ -733,7 +734,7 @@ void parse_checks_option(bool warn, bool error, const char *optarg) | |||
733 | die("Unrecognized check name \"%s\"\n", name); | 734 | die("Unrecognized check name \"%s\"\n", name); |
734 | } | 735 | } |
735 | 736 | ||
736 | void process_checks(int force, struct boot_info *bi) | 737 | void process_checks(bool force, struct boot_info *bi) |
737 | { | 738 | { |
738 | struct node *dt = bi->dt; | 739 | struct node *dt = bi->dt; |
739 | int i; | 740 | int i; |
diff --git a/scripts/dtc/data.c b/scripts/dtc/data.c index 4a40c5b92474..8cae23746882 100644 --- a/scripts/dtc/data.c +++ b/scripts/dtc/data.c | |||
@@ -74,7 +74,7 @@ struct data data_copy_escape_string(const char *s, int len) | |||
74 | struct data d; | 74 | struct data d; |
75 | char *q; | 75 | char *q; |
76 | 76 | ||
77 | d = data_grow_for(empty_data, strlen(s)+1); | 77 | d = data_grow_for(empty_data, len + 1); |
78 | 78 | ||
79 | q = d.val; | 79 | q = d.val; |
80 | while (i < len) { | 80 | while (i < len) { |
@@ -250,20 +250,20 @@ struct data data_add_marker(struct data d, enum markertype type, char *ref) | |||
250 | return data_append_markers(d, m); | 250 | return data_append_markers(d, m); |
251 | } | 251 | } |
252 | 252 | ||
253 | int data_is_one_string(struct data d) | 253 | bool data_is_one_string(struct data d) |
254 | { | 254 | { |
255 | int i; | 255 | int i; |
256 | int len = d.len; | 256 | int len = d.len; |
257 | 257 | ||
258 | if (len == 0) | 258 | if (len == 0) |
259 | return 0; | 259 | return false; |
260 | 260 | ||
261 | for (i = 0; i < len-1; i++) | 261 | for (i = 0; i < len-1; i++) |
262 | if (d.val[i] == '\0') | 262 | if (d.val[i] == '\0') |
263 | return 0; | 263 | return false; |
264 | 264 | ||
265 | if (d.val[len-1] != '\0') | 265 | if (d.val[len-1] != '\0') |
266 | return 0; | 266 | return false; |
267 | 267 | ||
268 | return 1; | 268 | return true; |
269 | } | 269 | } |
diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l index 3b41bfca636c..0ee1caf03dd0 100644 --- a/scripts/dtc/dtc-lexer.l +++ b/scripts/dtc/dtc-lexer.l | |||
@@ -20,7 +20,6 @@ | |||
20 | 20 | ||
21 | %option noyywrap nounput noinput never-interactive | 21 | %option noyywrap nounput noinput never-interactive |
22 | 22 | ||
23 | %x INCLUDE | ||
24 | %x BYTESTRING | 23 | %x BYTESTRING |
25 | %x PROPNODENAME | 24 | %x PROPNODENAME |
26 | %s V1 | 25 | %s V1 |
@@ -40,6 +39,7 @@ LINECOMMENT "//".*\n | |||
40 | #include "dtc-parser.tab.h" | 39 | #include "dtc-parser.tab.h" |
41 | 40 | ||
42 | YYLTYPE yylloc; | 41 | YYLTYPE yylloc; |
42 | extern bool treesource_error; | ||
43 | 43 | ||
44 | /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ | 44 | /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ |
45 | #define YY_USER_ACTION \ | 45 | #define YY_USER_ACTION \ |
@@ -61,7 +61,8 @@ static int dts_version = 1; | |||
61 | BEGIN(V1); \ | 61 | BEGIN(V1); \ |
62 | 62 | ||
63 | static void push_input_file(const char *filename); | 63 | static void push_input_file(const char *filename); |
64 | static int pop_input_file(void); | 64 | static bool pop_input_file(void); |
65 | static void lexical_error(const char *fmt, ...); | ||
65 | %} | 66 | %} |
66 | 67 | ||
67 | %% | 68 | %% |
@@ -75,11 +76,11 @@ static int pop_input_file(void); | |||
75 | char *line, *tmp, *fn; | 76 | char *line, *tmp, *fn; |
76 | /* skip text before line # */ | 77 | /* skip text before line # */ |
77 | line = yytext; | 78 | line = yytext; |
78 | while (!isdigit(*line)) | 79 | while (!isdigit((unsigned char)*line)) |
79 | line++; | 80 | line++; |
80 | /* skip digits in line # */ | 81 | /* skip digits in line # */ |
81 | tmp = line; | 82 | tmp = line; |
82 | while (!isspace(*tmp)) | 83 | while (!isspace((unsigned char)*tmp)) |
83 | tmp++; | 84 | tmp++; |
84 | /* "NULL"-terminate line # */ | 85 | /* "NULL"-terminate line # */ |
85 | *tmp = '\0'; | 86 | *tmp = '\0'; |
@@ -146,15 +147,42 @@ static int pop_input_file(void); | |||
146 | } | 147 | } |
147 | 148 | ||
148 | <V1>([0-9]+|0[xX][0-9a-fA-F]+)(U|L|UL|LL|ULL)? { | 149 | <V1>([0-9]+|0[xX][0-9a-fA-F]+)(U|L|UL|LL|ULL)? { |
149 | yylval.literal = xstrdup(yytext); | 150 | char *e; |
150 | DPRINT("Literal: '%s'\n", yylval.literal); | 151 | DPRINT("Integer Literal: '%s'\n", yytext); |
152 | |||
153 | errno = 0; | ||
154 | yylval.integer = strtoull(yytext, &e, 0); | ||
155 | |||
156 | assert(!(*e) || !e[strspn(e, "UL")]); | ||
157 | |||
158 | if (errno == ERANGE) | ||
159 | lexical_error("Integer literal '%s' out of range", | ||
160 | yytext); | ||
161 | else | ||
162 | /* ERANGE is the only strtoull error triggerable | ||
163 | * by strings matching the pattern */ | ||
164 | assert(errno == 0); | ||
151 | return DT_LITERAL; | 165 | return DT_LITERAL; |
152 | } | 166 | } |
153 | 167 | ||
154 | <*>{CHAR_LITERAL} { | 168 | <*>{CHAR_LITERAL} { |
155 | yytext[yyleng-1] = '\0'; | 169 | struct data d; |
156 | yylval.literal = xstrdup(yytext+1); | 170 | DPRINT("Character literal: %s\n", yytext); |
157 | DPRINT("Character literal: %s\n", yylval.literal); | 171 | |
172 | d = data_copy_escape_string(yytext+1, yyleng-2); | ||
173 | if (d.len == 1) { | ||
174 | lexical_error("Empty character literal"); | ||
175 | yylval.integer = 0; | ||
176 | return DT_CHAR_LITERAL; | ||
177 | } | ||
178 | |||
179 | yylval.integer = (unsigned char)d.val[0]; | ||
180 | |||
181 | if (d.len > 2) | ||
182 | lexical_error("Character literal has %d" | ||
183 | " characters instead of 1", | ||
184 | d.len - 1); | ||
185 | |||
158 | return DT_CHAR_LITERAL; | 186 | return DT_CHAR_LITERAL; |
159 | } | 187 | } |
160 | 188 | ||
@@ -164,7 +192,7 @@ static int pop_input_file(void); | |||
164 | return DT_REF; | 192 | return DT_REF; |
165 | } | 193 | } |
166 | 194 | ||
167 | <*>"&{/"{PATHCHAR}+\} { /* new-style path reference */ | 195 | <*>"&{/"{PATHCHAR}*\} { /* new-style path reference */ |
168 | yytext[yyleng-1] = '\0'; | 196 | yytext[yyleng-1] = '\0'; |
169 | DPRINT("Ref: %s\n", yytext+2); | 197 | DPRINT("Ref: %s\n", yytext+2); |
170 | yylval.labelref = xstrdup(yytext+2); | 198 | yylval.labelref = xstrdup(yytext+2); |
@@ -238,13 +266,24 @@ static void push_input_file(const char *filename) | |||
238 | } | 266 | } |
239 | 267 | ||
240 | 268 | ||
241 | static int pop_input_file(void) | 269 | static bool pop_input_file(void) |
242 | { | 270 | { |
243 | if (srcfile_pop() == 0) | 271 | if (srcfile_pop() == 0) |
244 | return 0; | 272 | return false; |
245 | 273 | ||
246 | yypop_buffer_state(); | 274 | yypop_buffer_state(); |
247 | yyin = current_srcfile->f; | 275 | yyin = current_srcfile->f; |
248 | 276 | ||
249 | return 1; | 277 | return true; |
278 | } | ||
279 | |||
280 | static void lexical_error(const char *fmt, ...) | ||
281 | { | ||
282 | va_list ap; | ||
283 | |||
284 | va_start(ap, fmt); | ||
285 | srcpos_verror(&yylloc, "Lexical error", fmt, ap); | ||
286 | va_end(ap); | ||
287 | |||
288 | treesource_error = true; | ||
250 | } | 289 | } |
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped index 2d30f41778b7..11cd78e72305 100644 --- a/scripts/dtc/dtc-lexer.lex.c_shipped +++ b/scripts/dtc/dtc-lexer.lex.c_shipped | |||
@@ -9,7 +9,7 @@ | |||
9 | #define FLEX_SCANNER | 9 | #define FLEX_SCANNER |
10 | #define YY_FLEX_MAJOR_VERSION 2 | 10 | #define YY_FLEX_MAJOR_VERSION 2 |
11 | #define YY_FLEX_MINOR_VERSION 5 | 11 | #define YY_FLEX_MINOR_VERSION 5 |
12 | #define YY_FLEX_SUBMINOR_VERSION 35 | 12 | #define YY_FLEX_SUBMINOR_VERSION 39 |
13 | #if YY_FLEX_SUBMINOR_VERSION > 0 | 13 | #if YY_FLEX_SUBMINOR_VERSION > 0 |
14 | #define FLEX_BETA | 14 | #define FLEX_BETA |
15 | #endif | 15 | #endif |
@@ -162,7 +162,12 @@ typedef unsigned int flex_uint32_t; | |||
162 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | 162 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
163 | #endif | 163 | #endif |
164 | 164 | ||
165 | extern int yyleng; | 165 | #ifndef YY_TYPEDEF_YY_SIZE_T |
166 | #define YY_TYPEDEF_YY_SIZE_T | ||
167 | typedef size_t yy_size_t; | ||
168 | #endif | ||
169 | |||
170 | extern yy_size_t yyleng; | ||
166 | 171 | ||
167 | extern FILE *yyin, *yyout; | 172 | extern FILE *yyin, *yyout; |
168 | 173 | ||
@@ -171,6 +176,7 @@ extern FILE *yyin, *yyout; | |||
171 | #define EOB_ACT_LAST_MATCH 2 | 176 | #define EOB_ACT_LAST_MATCH 2 |
172 | 177 | ||
173 | #define YY_LESS_LINENO(n) | 178 | #define YY_LESS_LINENO(n) |
179 | #define YY_LINENO_REWIND_TO(ptr) | ||
174 | 180 | ||
175 | /* Return all but the first "n" matched characters back to the input stream. */ | 181 | /* Return all but the first "n" matched characters back to the input stream. */ |
176 | #define yyless(n) \ | 182 | #define yyless(n) \ |
@@ -188,11 +194,6 @@ extern FILE *yyin, *yyout; | |||
188 | 194 | ||
189 | #define unput(c) yyunput( c, (yytext_ptr) ) | 195 | #define unput(c) yyunput( c, (yytext_ptr) ) |
190 | 196 | ||
191 | #ifndef YY_TYPEDEF_YY_SIZE_T | ||
192 | #define YY_TYPEDEF_YY_SIZE_T | ||
193 | typedef size_t yy_size_t; | ||
194 | #endif | ||
195 | |||
196 | #ifndef YY_STRUCT_YY_BUFFER_STATE | 197 | #ifndef YY_STRUCT_YY_BUFFER_STATE |
197 | #define YY_STRUCT_YY_BUFFER_STATE | 198 | #define YY_STRUCT_YY_BUFFER_STATE |
198 | struct yy_buffer_state | 199 | struct yy_buffer_state |
@@ -210,7 +211,7 @@ struct yy_buffer_state | |||
210 | /* Number of characters read into yy_ch_buf, not including EOB | 211 | /* Number of characters read into yy_ch_buf, not including EOB |
211 | * characters. | 212 | * characters. |
212 | */ | 213 | */ |
213 | int yy_n_chars; | 214 | yy_size_t yy_n_chars; |
214 | 215 | ||
215 | /* Whether we "own" the buffer - i.e., we know we created it, | 216 | /* Whether we "own" the buffer - i.e., we know we created it, |
216 | * and can realloc() it to grow it, and should free() it to | 217 | * and can realloc() it to grow it, and should free() it to |
@@ -280,8 +281,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ | |||
280 | 281 | ||
281 | /* yy_hold_char holds the character lost when yytext is formed. */ | 282 | /* yy_hold_char holds the character lost when yytext is formed. */ |
282 | static char yy_hold_char; | 283 | static char yy_hold_char; |
283 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ | 284 | static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ |
284 | int yyleng; | 285 | yy_size_t yyleng; |
285 | 286 | ||
286 | /* Points to current character in buffer. */ | 287 | /* Points to current character in buffer. */ |
287 | static char *yy_c_buf_p = (char *) 0; | 288 | static char *yy_c_buf_p = (char *) 0; |
@@ -309,7 +310,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); | |||
309 | 310 | ||
310 | YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); | 311 | YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); |
311 | YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); | 312 | YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); |
312 | YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); | 313 | YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); |
313 | 314 | ||
314 | void *yyalloc (yy_size_t ); | 315 | void *yyalloc (yy_size_t ); |
315 | void *yyrealloc (void *,yy_size_t ); | 316 | void *yyrealloc (void *,yy_size_t ); |
@@ -341,7 +342,7 @@ void yyfree (void * ); | |||
341 | 342 | ||
342 | /* Begin user sect3 */ | 343 | /* Begin user sect3 */ |
343 | 344 | ||
344 | #define yywrap(n) 1 | 345 | #define yywrap() 1 |
345 | #define YY_SKIP_YYWRAP | 346 | #define YY_SKIP_YYWRAP |
346 | 347 | ||
347 | typedef unsigned char YY_CHAR; | 348 | typedef unsigned char YY_CHAR; |
@@ -381,25 +382,25 @@ struct yy_trans_info | |||
381 | flex_int32_t yy_verify; | 382 | flex_int32_t yy_verify; |
382 | flex_int32_t yy_nxt; | 383 | flex_int32_t yy_nxt; |
383 | }; | 384 | }; |
384 | static yyconst flex_int16_t yy_accept[161] = | 385 | static yyconst flex_int16_t yy_accept[159] = |
385 | { 0, | 386 | { 0, |
386 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 387 | 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, |
387 | 31, 29, 18, 18, 29, 29, 29, 29, 29, 29, | 388 | 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, |
388 | 29, 29, 29, 29, 29, 29, 29, 29, 15, 16, | 389 | 29, 29, 29, 29, 29, 29, 15, 16, 16, 29, |
389 | 16, 29, 16, 10, 10, 18, 26, 0, 3, 0, | 390 | 16, 10, 10, 18, 26, 0, 3, 0, 27, 12, |
390 | 27, 12, 0, 0, 11, 0, 0, 0, 0, 0, | 391 | 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, |
391 | 0, 0, 21, 23, 25, 24, 22, 0, 9, 28, | 392 | 21, 23, 25, 24, 22, 0, 9, 28, 0, 0, |
392 | 0, 0, 0, 14, 14, 16, 16, 16, 10, 10, | 393 | 0, 14, 14, 16, 16, 16, 10, 10, 10, 0, |
393 | 10, 0, 12, 0, 11, 0, 0, 0, 20, 0, | 394 | 12, 0, 11, 0, 0, 0, 20, 0, 0, 0, |
394 | 0, 0, 0, 0, 0, 0, 0, 16, 10, 10, | 395 | 0, 0, 0, 0, 0, 16, 10, 10, 10, 0, |
395 | 10, 0, 19, 0, 0, 0, 0, 0, 0, 0, | 396 | 13, 19, 0, 0, 0, 0, 0, 0, 0, 0, |
396 | 397 | ||
397 | 0, 0, 16, 13, 0, 0, 0, 0, 0, 0, | 398 | 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, |
398 | 0, 0, 0, 16, 6, 0, 0, 0, 0, 0, | 399 | 0, 16, 6, 0, 0, 0, 0, 0, 0, 2, |
399 | 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, | 400 | 0, 0, 0, 0, 0, 0, 0, 0, 4, 17, |
400 | 4, 17, 0, 0, 2, 0, 0, 0, 0, 0, | 401 | 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, |
401 | 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, | 402 | 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, |
402 | 0, 0, 5, 8, 0, 0, 0, 0, 7, 0 | 403 | 5, 8, 0, 0, 0, 0, 7, 0 |
403 | } ; | 404 | } ; |
404 | 405 | ||
405 | static yyconst flex_int32_t yy_ec[256] = | 406 | static yyconst flex_int32_t yy_ec[256] = |
@@ -440,157 +441,157 @@ static yyconst flex_int32_t yy_meta[47] = | |||
440 | 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, | 441 | 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, |
441 | 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, | 442 | 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, |
442 | 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, | 443 | 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, |
443 | 8, 8, 8, 3, 1, 1 | 444 | 8, 8, 8, 3, 1, 4 |
444 | } ; | 445 | } ; |
445 | 446 | ||
446 | static yyconst flex_int16_t yy_base[175] = | 447 | static yyconst flex_int16_t yy_base[173] = |
447 | { 0, | 448 | { 0, |
448 | 0, 385, 378, 40, 41, 383, 72, 382, 34, 44, | 449 | 0, 383, 34, 382, 65, 381, 37, 105, 387, 391, |
449 | 388, 393, 61, 117, 368, 116, 115, 115, 115, 48, | 450 | 54, 111, 367, 110, 109, 109, 112, 41, 366, 104, |
450 | 367, 107, 368, 339, 127, 120, 0, 147, 393, 0, | 451 | 367, 338, 124, 117, 0, 144, 391, 0, 121, 0, |
451 | 127, 0, 133, 156, 168, 153, 393, 125, 393, 380, | 452 | 135, 155, 140, 179, 391, 160, 391, 379, 391, 0, |
452 | 393, 0, 369, 127, 393, 160, 371, 377, 347, 21, | 453 | 368, 141, 391, 167, 370, 376, 346, 103, 342, 345, |
453 | 343, 346, 393, 393, 393, 393, 393, 359, 393, 393, | 454 | 391, 391, 391, 391, 391, 358, 391, 391, 175, 342, |
454 | 183, 343, 339, 393, 356, 0, 183, 340, 187, 348, | 455 | 338, 391, 355, 0, 185, 339, 184, 347, 346, 0, |
455 | 347, 0, 0, 0, 178, 359, 195, 365, 354, 326, | 456 | 0, 322, 175, 357, 175, 363, 352, 324, 330, 323, |
456 | 332, 325, 334, 328, 204, 326, 331, 324, 393, 335, | 457 | 332, 326, 201, 324, 329, 322, 391, 333, 181, 309, |
457 | 150, 311, 343, 342, 315, 322, 340, 179, 313, 207, | 458 | 391, 341, 340, 313, 320, 338, 178, 311, 146, 317, |
458 | 459 | ||
459 | 319, 316, 317, 393, 337, 333, 305, 302, 311, 301, | 460 | 314, 315, 335, 331, 303, 300, 309, 299, 308, 188, |
460 | 310, 190, 338, 337, 393, 307, 322, 301, 305, 277, | 461 | 336, 335, 391, 305, 320, 281, 283, 271, 203, 288, |
461 | 208, 311, 307, 278, 271, 270, 248, 246, 213, 130, | 462 | 281, 271, 266, 264, 245, 242, 208, 104, 391, 391, |
462 | 393, 393, 263, 235, 207, 221, 218, 229, 213, 213, | 463 | 244, 218, 204, 219, 206, 224, 201, 212, 204, 229, |
463 | 206, 234, 218, 210, 208, 193, 219, 393, 223, 204, | 464 | 215, 208, 207, 200, 219, 391, 233, 221, 200, 181, |
464 | 176, 157, 393, 393, 120, 106, 97, 119, 393, 393, | 465 | 391, 391, 149, 122, 86, 41, 391, 391, 245, 251, |
465 | 245, 251, 259, 263, 267, 273, 280, 284, 292, 300, | 466 | 259, 263, 267, 273, 280, 284, 292, 300, 304, 310, |
466 | 304, 310, 318, 326 | 467 | 318, 326 |
467 | } ; | 468 | } ; |
468 | 469 | ||
469 | static yyconst flex_int16_t yy_def[175] = | 470 | static yyconst flex_int16_t yy_def[173] = |
470 | { 0, | 471 | { 0, |
471 | 160, 1, 1, 1, 1, 5, 160, 7, 1, 1, | 472 | 158, 1, 1, 3, 158, 5, 1, 1, 158, 158, |
472 | 160, 160, 160, 160, 160, 161, 162, 163, 160, 160, | 473 | 158, 158, 158, 159, 160, 161, 158, 158, 158, 158, |
473 | 160, 160, 164, 160, 160, 160, 165, 164, 160, 166, | 474 | 162, 158, 158, 158, 163, 162, 158, 164, 165, 164, |
474 | 167, 166, 166, 160, 160, 160, 160, 161, 160, 161, | 475 | 164, 158, 158, 158, 158, 159, 158, 159, 158, 166, |
475 | 160, 168, 160, 163, 160, 163, 169, 170, 160, 160, | 476 | 158, 161, 158, 161, 167, 168, 158, 158, 158, 158, |
476 | 160, 160, 160, 160, 160, 160, 160, 164, 160, 160, | 477 | 158, 158, 158, 158, 158, 162, 158, 158, 158, 158, |
477 | 160, 160, 160, 160, 164, 166, 167, 166, 160, 160, | 478 | 158, 158, 162, 164, 165, 164, 158, 158, 158, 169, |
478 | 160, 171, 168, 172, 163, 169, 169, 170, 160, 160, | 479 | 166, 170, 161, 167, 167, 168, 158, 158, 158, 158, |
479 | 160, 160, 160, 160, 160, 160, 160, 166, 160, 160, | 480 | 158, 158, 158, 158, 158, 164, 158, 158, 169, 170, |
480 | 171, 172, 160, 160, 160, 160, 160, 160, 160, 160, | 481 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
481 | 482 | ||
482 | 160, 160, 166, 160, 160, 160, 160, 160, 160, 160, | 483 | 158, 164, 158, 158, 158, 158, 158, 158, 158, 171, |
483 | 160, 173, 160, 166, 160, 160, 160, 160, 160, 160, | 484 | 158, 164, 158, 158, 158, 158, 158, 158, 171, 158, |
484 | 173, 160, 173, 160, 160, 160, 160, 160, 160, 160, | 485 | 171, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
485 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 486 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
486 | 160, 160, 174, 160, 160, 160, 174, 160, 174, 160, | 487 | 172, 158, 158, 158, 172, 158, 172, 158, 158, 158, |
487 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 0, | 488 | 158, 158, 158, 158, 158, 158, 158, 0, 158, 158, |
488 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 489 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
489 | 160, 160, 160, 160 | 490 | 158, 158 |
490 | } ; | 491 | } ; |
491 | 492 | ||
492 | static yyconst flex_int16_t yy_nxt[440] = | 493 | static yyconst flex_int16_t yy_nxt[438] = |
493 | { 0, | 494 | { 0, |
494 | 12, 13, 14, 13, 15, 16, 12, 17, 18, 12, | 495 | 10, 11, 12, 11, 13, 14, 10, 15, 16, 10, |
495 | 12, 12, 19, 12, 12, 12, 12, 20, 21, 22, | 496 | 10, 10, 17, 10, 10, 10, 10, 18, 19, 20, |
496 | 23, 23, 23, 23, 23, 12, 12, 23, 23, 23, | 497 | 21, 21, 21, 21, 21, 10, 10, 21, 21, 21, |
497 | 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, | 498 | 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, |
498 | 23, 23, 23, 12, 24, 12, 25, 34, 35, 35, | 499 | 21, 21, 21, 10, 22, 10, 24, 25, 25, 25, |
499 | 25, 81, 26, 26, 27, 27, 27, 34, 35, 35, | 500 | 32, 33, 33, 157, 26, 34, 34, 34, 51, 52, |
500 | 82, 28, 36, 36, 36, 53, 54, 29, 28, 28, | 501 | 27, 26, 26, 26, 26, 10, 11, 12, 11, 13, |
501 | 28, 28, 12, 13, 14, 13, 15, 16, 30, 17, | 502 | 14, 28, 15, 16, 28, 28, 28, 24, 28, 28, |
502 | 18, 30, 30, 30, 26, 30, 30, 30, 12, 20, | 503 | 28, 10, 18, 19, 20, 29, 29, 29, 29, 29, |
503 | 21, 22, 31, 31, 31, 31, 31, 32, 12, 31, | 504 | 30, 10, 29, 29, 29, 29, 29, 29, 29, 29, |
504 | 505 | ||
505 | 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, | 506 | 29, 29, 29, 29, 29, 29, 29, 29, 10, 22, |
506 | 31, 31, 31, 31, 31, 12, 24, 12, 36, 36, | 507 | 10, 23, 34, 34, 34, 37, 39, 43, 32, 33, |
507 | 36, 39, 41, 45, 47, 56, 57, 48, 61, 47, | 508 | 33, 45, 54, 55, 46, 59, 45, 64, 156, 46, |
508 | 39, 159, 48, 66, 61, 45, 66, 66, 66, 158, | 509 | 64, 64, 64, 79, 44, 38, 59, 57, 134, 47, |
509 | 46, 40, 49, 59, 50, 157, 51, 49, 52, 50, | 510 | 135, 48, 80, 49, 47, 50, 48, 99, 61, 43, |
510 | 40, 63, 46, 52, 36, 36, 36, 156, 43, 62, | 511 | 50, 110, 41, 67, 67, 67, 60, 63, 63, 63, |
511 | 65, 65, 65, 59, 136, 68, 137, 65, 75, 69, | 512 | 57, 155, 68, 69, 63, 37, 44, 66, 67, 67, |
512 | 69, 69, 70, 71, 65, 65, 65, 65, 70, 71, | 513 | 67, 63, 63, 63, 63, 73, 59, 68, 69, 70, |
513 | 72, 69, 69, 69, 61, 46, 45, 155, 154, 66, | 514 | 34, 34, 34, 43, 75, 38, 154, 92, 83, 83, |
514 | 70, 71, 66, 66, 66, 122, 85, 85, 85, 59, | 515 | 83, 64, 44, 120, 64, 64, 64, 67, 67, 67, |
515 | 516 | ||
516 | 69, 69, 69, 46, 77, 100, 109, 93, 100, 70, | 517 | 44, 57, 99, 68, 69, 107, 68, 69, 120, 127, |
517 | 71, 110, 112, 122, 129, 123, 153, 85, 85, 85, | 518 | 108, 153, 152, 121, 83, 83, 83, 133, 133, 133, |
518 | 135, 135, 135, 148, 148, 160, 135, 135, 135, 152, | 519 | 146, 133, 133, 133, 146, 140, 140, 140, 121, 141, |
519 | 142, 142, 142, 123, 143, 142, 142, 142, 151, 143, | 520 | 140, 140, 140, 151, 141, 158, 150, 149, 148, 144, |
520 | 150, 146, 145, 149, 149, 38, 38, 38, 38, 38, | 521 | 147, 143, 142, 139, 147, 36, 36, 36, 36, 36, |
521 | 38, 38, 38, 42, 144, 141, 140, 42, 42, 44, | 522 | 36, 36, 36, 40, 138, 137, 136, 40, 40, 42, |
522 | 44, 44, 44, 44, 44, 44, 44, 58, 58, 58, | 523 | 42, 42, 42, 42, 42, 42, 42, 56, 56, 56, |
523 | 58, 64, 139, 64, 66, 138, 134, 66, 133, 66, | 524 | 56, 62, 132, 62, 64, 131, 130, 64, 129, 64, |
524 | 66, 67, 132, 131, 67, 67, 67, 67, 73, 130, | 525 | 64, 65, 128, 158, 65, 65, 65, 65, 71, 127, |
525 | 73, 73, 76, 76, 76, 76, 76, 76, 76, 76, | 526 | 71, 71, 74, 74, 74, 74, 74, 74, 74, 74, |
526 | 527 | ||
527 | 78, 78, 78, 78, 78, 78, 78, 78, 91, 160, | 528 | 76, 76, 76, 76, 76, 76, 76, 76, 89, 126, |
528 | 91, 92, 129, 92, 92, 128, 92, 92, 121, 121, | 529 | 89, 90, 125, 90, 90, 124, 90, 90, 119, 119, |
529 | 121, 121, 121, 121, 121, 121, 147, 147, 147, 147, | 530 | 119, 119, 119, 119, 119, 119, 145, 145, 145, 145, |
530 | 147, 147, 147, 147, 127, 126, 125, 124, 61, 61, | 531 | 145, 145, 145, 145, 123, 122, 59, 59, 118, 117, |
531 | 120, 119, 118, 117, 116, 115, 47, 114, 110, 113, | 532 | 116, 115, 114, 113, 45, 112, 108, 111, 109, 106, |
532 | 111, 108, 107, 106, 48, 105, 104, 89, 103, 102, | 533 | 105, 104, 46, 103, 91, 87, 102, 101, 100, 98, |
533 | 101, 99, 98, 97, 96, 95, 94, 79, 77, 90, | 534 | 97, 96, 95, 94, 93, 77, 75, 91, 88, 87, |
534 | 89, 88, 59, 87, 86, 59, 84, 83, 80, 79, | 535 | 86, 57, 85, 84, 57, 82, 81, 78, 77, 75, |
535 | 77, 74, 160, 60, 59, 55, 37, 160, 33, 25, | 536 | 72, 158, 58, 57, 53, 35, 158, 31, 23, 23, |
536 | 26, 25, 11, 160, 160, 160, 160, 160, 160, 160, | 537 | 9, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
537 | 538 | ||
538 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 539 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
539 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 540 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
540 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 541 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
541 | 160, 160, 160, 160, 160, 160, 160, 160, 160 | 542 | 158, 158, 158, 158, 158, 158, 158 |
542 | } ; | 543 | } ; |
543 | 544 | ||
544 | static yyconst flex_int16_t yy_chk[440] = | 545 | static yyconst flex_int16_t yy_chk[438] = |
545 | { 0, | 546 | { 0, |
546 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 547 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
547 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 548 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
548 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 549 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
549 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 550 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
550 | 1, 1, 1, 1, 1, 1, 4, 9, 9, 9, | 551 | 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, |
551 | 10, 50, 4, 5, 5, 5, 5, 10, 10, 10, | 552 | 7, 7, 7, 156, 3, 11, 11, 11, 18, 18, |
552 | 50, 5, 13, 13, 13, 20, 20, 5, 5, 5, | 553 | 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, |
553 | 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, | 554 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
554 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 555 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
555 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 556 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
556 | 557 | ||
557 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 558 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
558 | 7, 7, 7, 7, 7, 7, 7, 7, 14, 14, | 559 | 5, 8, 12, 12, 12, 14, 15, 16, 8, 8, |
559 | 14, 16, 17, 18, 19, 22, 22, 19, 25, 26, | 560 | 8, 17, 20, 20, 17, 23, 24, 29, 155, 24, |
560 | 38, 158, 26, 31, 33, 44, 31, 31, 31, 157, | 561 | 29, 29, 29, 48, 16, 14, 31, 29, 128, 17, |
561 | 18, 16, 19, 31, 19, 156, 19, 26, 19, 26, | 562 | 128, 17, 48, 17, 24, 17, 24, 99, 24, 42, |
562 | 38, 26, 44, 26, 36, 36, 36, 155, 17, 25, | 563 | 24, 99, 15, 33, 33, 33, 23, 26, 26, 26, |
563 | 28, 28, 28, 28, 130, 33, 130, 28, 46, 34, | 564 | 26, 154, 33, 33, 26, 36, 42, 31, 32, 32, |
564 | 34, 34, 91, 91, 28, 28, 28, 28, 34, 34, | 565 | 32, 26, 26, 26, 26, 44, 59, 32, 32, 32, |
565 | 34, 35, 35, 35, 61, 46, 75, 152, 151, 67, | 566 | 34, 34, 34, 73, 75, 36, 153, 75, 59, 59, |
566 | 35, 35, 67, 67, 67, 112, 61, 61, 61, 67, | 567 | 59, 65, 44, 110, 65, 65, 65, 67, 67, 67, |
567 | 568 | ||
568 | 69, 69, 69, 75, 77, 85, 98, 77, 100, 69, | 569 | 73, 65, 83, 89, 89, 97, 67, 67, 119, 127, |
569 | 69, 98, 100, 121, 129, 112, 150, 85, 85, 85, | 570 | 97, 150, 149, 110, 83, 83, 83, 133, 133, 133, |
570 | 135, 135, 135, 143, 147, 149, 129, 129, 129, 146, | 571 | 141, 127, 127, 127, 145, 136, 136, 136, 119, 136, |
571 | 138, 138, 138, 121, 138, 142, 142, 142, 145, 142, | 572 | 140, 140, 140, 148, 140, 147, 144, 143, 142, 139, |
572 | 144, 141, 140, 143, 147, 161, 161, 161, 161, 161, | 573 | 141, 138, 137, 135, 145, 159, 159, 159, 159, 159, |
573 | 161, 161, 161, 162, 139, 137, 136, 162, 162, 163, | 574 | 159, 159, 159, 160, 134, 132, 131, 160, 160, 161, |
574 | 163, 163, 163, 163, 163, 163, 163, 164, 164, 164, | 575 | 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, |
575 | 164, 165, 134, 165, 166, 133, 128, 166, 127, 166, | 576 | 162, 163, 126, 163, 164, 125, 124, 164, 123, 164, |
576 | 166, 167, 126, 125, 167, 167, 167, 167, 168, 124, | 577 | 164, 165, 122, 121, 165, 165, 165, 165, 166, 120, |
577 | 168, 168, 169, 169, 169, 169, 169, 169, 169, 169, | 578 | 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, |
578 | 579 | ||
579 | 170, 170, 170, 170, 170, 170, 170, 170, 171, 123, | 580 | 168, 168, 168, 168, 168, 168, 168, 168, 169, 118, |
580 | 171, 172, 122, 172, 172, 120, 172, 172, 173, 173, | 581 | 169, 170, 117, 170, 170, 116, 170, 170, 171, 171, |
581 | 173, 173, 173, 173, 173, 173, 174, 174, 174, 174, | 582 | 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, |
582 | 174, 174, 174, 174, 119, 118, 117, 116, 114, 113, | 583 | 172, 172, 172, 172, 115, 114, 112, 111, 109, 108, |
583 | 111, 110, 109, 108, 107, 106, 105, 103, 102, 101, | 584 | 107, 106, 105, 104, 103, 102, 101, 100, 98, 96, |
584 | 99, 97, 96, 95, 94, 93, 92, 90, 88, 87, | 585 | 95, 94, 93, 92, 90, 88, 86, 85, 84, 82, |
585 | 86, 84, 83, 82, 81, 80, 79, 78, 76, 71, | 586 | 81, 80, 79, 78, 77, 76, 74, 72, 69, 68, |
586 | 70, 68, 65, 63, 62, 58, 52, 51, 49, 48, | 587 | 66, 63, 61, 60, 56, 50, 49, 47, 46, 45, |
587 | 47, 43, 40, 24, 23, 21, 15, 11, 8, 6, | 588 | 41, 38, 22, 21, 19, 13, 9, 6, 4, 2, |
588 | 3, 2, 160, 160, 160, 160, 160, 160, 160, 160, | 589 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
589 | 590 | ||
590 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 591 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
591 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 592 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
592 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 593 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
593 | 160, 160, 160, 160, 160, 160, 160, 160, 160 | 594 | 158, 158, 158, 158, 158, 158, 158 |
594 | } ; | 595 | } ; |
595 | 596 | ||
596 | static yy_state_type yy_last_accepting_state; | 597 | static yy_state_type yy_last_accepting_state; |
@@ -631,13 +632,13 @@ char *yytext; | |||
631 | 632 | ||
632 | 633 | ||
633 | 634 | ||
634 | 635 | #line 37 "dtc-lexer.l" | |
635 | #line 38 "dtc-lexer.l" | ||
636 | #include "dtc.h" | 636 | #include "dtc.h" |
637 | #include "srcpos.h" | 637 | #include "srcpos.h" |
638 | #include "dtc-parser.tab.h" | 638 | #include "dtc-parser.tab.h" |
639 | 639 | ||
640 | YYLTYPE yylloc; | 640 | YYLTYPE yylloc; |
641 | extern bool treesource_error; | ||
641 | 642 | ||
642 | /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ | 643 | /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ |
643 | #define YY_USER_ACTION \ | 644 | #define YY_USER_ACTION \ |
@@ -659,14 +660,14 @@ static int dts_version = 1; | |||
659 | BEGIN(V1); \ | 660 | BEGIN(V1); \ |
660 | 661 | ||
661 | static void push_input_file(const char *filename); | 662 | static void push_input_file(const char *filename); |
662 | static int pop_input_file(void); | 663 | static bool pop_input_file(void); |
663 | #line 664 "dtc-lexer.lex.c" | 664 | static void lexical_error(const char *fmt, ...); |
665 | #line 666 "dtc-lexer.lex.c" | ||
664 | 666 | ||
665 | #define INITIAL 0 | 667 | #define INITIAL 0 |
666 | #define INCLUDE 1 | 668 | #define BYTESTRING 1 |
667 | #define BYTESTRING 2 | 669 | #define PROPNODENAME 2 |
668 | #define PROPNODENAME 3 | 670 | #define V1 3 |
669 | #define V1 4 | ||
670 | 671 | ||
671 | #ifndef YY_NO_UNISTD_H | 672 | #ifndef YY_NO_UNISTD_H |
672 | /* Special case for "unistd.h", since it is non-ANSI. We include it way | 673 | /* Special case for "unistd.h", since it is non-ANSI. We include it way |
@@ -703,7 +704,7 @@ FILE *yyget_out (void ); | |||
703 | 704 | ||
704 | void yyset_out (FILE * out_str ); | 705 | void yyset_out (FILE * out_str ); |
705 | 706 | ||
706 | int yyget_leng (void ); | 707 | yy_size_t yyget_leng (void ); |
707 | 708 | ||
708 | char *yyget_text (void ); | 709 | char *yyget_text (void ); |
709 | 710 | ||
@@ -852,10 +853,6 @@ YY_DECL | |||
852 | register char *yy_cp, *yy_bp; | 853 | register char *yy_cp, *yy_bp; |
853 | register int yy_act; | 854 | register int yy_act; |
854 | 855 | ||
855 | #line 67 "dtc-lexer.l" | ||
856 | |||
857 | #line 858 "dtc-lexer.lex.c" | ||
858 | |||
859 | if ( !(yy_init) ) | 856 | if ( !(yy_init) ) |
860 | { | 857 | { |
861 | (yy_init) = 1; | 858 | (yy_init) = 1; |
@@ -882,6 +879,11 @@ YY_DECL | |||
882 | yy_load_buffer_state( ); | 879 | yy_load_buffer_state( ); |
883 | } | 880 | } |
884 | 881 | ||
882 | { | ||
883 | #line 68 "dtc-lexer.l" | ||
884 | |||
885 | #line 886 "dtc-lexer.lex.c" | ||
886 | |||
885 | while ( 1 ) /* loops until end-of-file is reached */ | 887 | while ( 1 ) /* loops until end-of-file is reached */ |
886 | { | 888 | { |
887 | yy_cp = (yy_c_buf_p); | 889 | yy_cp = (yy_c_buf_p); |
@@ -899,7 +901,7 @@ YY_DECL | |||
899 | yy_match: | 901 | yy_match: |
900 | do | 902 | do |
901 | { | 903 | { |
902 | register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; | 904 | register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; |
903 | if ( yy_accept[yy_current_state] ) | 905 | if ( yy_accept[yy_current_state] ) |
904 | { | 906 | { |
905 | (yy_last_accepting_state) = yy_current_state; | 907 | (yy_last_accepting_state) = yy_current_state; |
@@ -908,13 +910,13 @@ yy_match: | |||
908 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 910 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
909 | { | 911 | { |
910 | yy_current_state = (int) yy_def[yy_current_state]; | 912 | yy_current_state = (int) yy_def[yy_current_state]; |
911 | if ( yy_current_state >= 161 ) | 913 | if ( yy_current_state >= 159 ) |
912 | yy_c = yy_meta[(unsigned int) yy_c]; | 914 | yy_c = yy_meta[(unsigned int) yy_c]; |
913 | } | 915 | } |
914 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 916 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
915 | ++yy_cp; | 917 | ++yy_cp; |
916 | } | 918 | } |
917 | while ( yy_current_state != 160 ); | 919 | while ( yy_current_state != 158 ); |
918 | yy_cp = (yy_last_accepting_cpos); | 920 | yy_cp = (yy_last_accepting_cpos); |
919 | yy_current_state = (yy_last_accepting_state); | 921 | yy_current_state = (yy_last_accepting_state); |
920 | 922 | ||
@@ -937,7 +939,7 @@ do_action: /* This label is used only to access EOF actions. */ | |||
937 | case 1: | 939 | case 1: |
938 | /* rule 1 can match eol */ | 940 | /* rule 1 can match eol */ |
939 | YY_RULE_SETUP | 941 | YY_RULE_SETUP |
940 | #line 68 "dtc-lexer.l" | 942 | #line 69 "dtc-lexer.l" |
941 | { | 943 | { |
942 | char *name = strchr(yytext, '\"') + 1; | 944 | char *name = strchr(yytext, '\"') + 1; |
943 | yytext[yyleng-1] = '\0'; | 945 | yytext[yyleng-1] = '\0'; |
@@ -947,16 +949,16 @@ YY_RULE_SETUP | |||
947 | case 2: | 949 | case 2: |
948 | /* rule 2 can match eol */ | 950 | /* rule 2 can match eol */ |
949 | YY_RULE_SETUP | 951 | YY_RULE_SETUP |
950 | #line 74 "dtc-lexer.l" | 952 | #line 75 "dtc-lexer.l" |
951 | { | 953 | { |
952 | char *line, *tmp, *fn; | 954 | char *line, *tmp, *fn; |
953 | /* skip text before line # */ | 955 | /* skip text before line # */ |
954 | line = yytext; | 956 | line = yytext; |
955 | while (!isdigit(*line)) | 957 | while (!isdigit((unsigned char)*line)) |
956 | line++; | 958 | line++; |
957 | /* skip digits in line # */ | 959 | /* skip digits in line # */ |
958 | tmp = line; | 960 | tmp = line; |
959 | while (!isspace(*tmp)) | 961 | while (!isspace((unsigned char)*tmp)) |
960 | tmp++; | 962 | tmp++; |
961 | /* "NULL"-terminate line # */ | 963 | /* "NULL"-terminate line # */ |
962 | *tmp = '\0'; | 964 | *tmp = '\0'; |
@@ -970,11 +972,10 @@ YY_RULE_SETUP | |||
970 | } | 972 | } |
971 | YY_BREAK | 973 | YY_BREAK |
972 | case YY_STATE_EOF(INITIAL): | 974 | case YY_STATE_EOF(INITIAL): |
973 | case YY_STATE_EOF(INCLUDE): | ||
974 | case YY_STATE_EOF(BYTESTRING): | 975 | case YY_STATE_EOF(BYTESTRING): |
975 | case YY_STATE_EOF(PROPNODENAME): | 976 | case YY_STATE_EOF(PROPNODENAME): |
976 | case YY_STATE_EOF(V1): | 977 | case YY_STATE_EOF(V1): |
977 | #line 95 "dtc-lexer.l" | 978 | #line 96 "dtc-lexer.l" |
978 | { | 979 | { |
979 | if (!pop_input_file()) { | 980 | if (!pop_input_file()) { |
980 | yyterminate(); | 981 | yyterminate(); |
@@ -984,7 +985,7 @@ case YY_STATE_EOF(V1): | |||
984 | case 3: | 985 | case 3: |
985 | /* rule 3 can match eol */ | 986 | /* rule 3 can match eol */ |
986 | YY_RULE_SETUP | 987 | YY_RULE_SETUP |
987 | #line 101 "dtc-lexer.l" | 988 | #line 102 "dtc-lexer.l" |
988 | { | 989 | { |
989 | DPRINT("String: %s\n", yytext); | 990 | DPRINT("String: %s\n", yytext); |
990 | yylval.data = data_copy_escape_string(yytext+1, | 991 | yylval.data = data_copy_escape_string(yytext+1, |
@@ -994,7 +995,7 @@ YY_RULE_SETUP | |||
994 | YY_BREAK | 995 | YY_BREAK |
995 | case 4: | 996 | case 4: |
996 | YY_RULE_SETUP | 997 | YY_RULE_SETUP |
997 | #line 108 "dtc-lexer.l" | 998 | #line 109 "dtc-lexer.l" |
998 | { | 999 | { |
999 | DPRINT("Keyword: /dts-v1/\n"); | 1000 | DPRINT("Keyword: /dts-v1/\n"); |
1000 | dts_version = 1; | 1001 | dts_version = 1; |
@@ -1004,7 +1005,7 @@ YY_RULE_SETUP | |||
1004 | YY_BREAK | 1005 | YY_BREAK |
1005 | case 5: | 1006 | case 5: |
1006 | YY_RULE_SETUP | 1007 | YY_RULE_SETUP |
1007 | #line 115 "dtc-lexer.l" | 1008 | #line 116 "dtc-lexer.l" |
1008 | { | 1009 | { |
1009 | DPRINT("Keyword: /memreserve/\n"); | 1010 | DPRINT("Keyword: /memreserve/\n"); |
1010 | BEGIN_DEFAULT(); | 1011 | BEGIN_DEFAULT(); |
@@ -1013,7 +1014,7 @@ YY_RULE_SETUP | |||
1013 | YY_BREAK | 1014 | YY_BREAK |
1014 | case 6: | 1015 | case 6: |
1015 | YY_RULE_SETUP | 1016 | YY_RULE_SETUP |
1016 | #line 121 "dtc-lexer.l" | 1017 | #line 122 "dtc-lexer.l" |
1017 | { | 1018 | { |
1018 | DPRINT("Keyword: /bits/\n"); | 1019 | DPRINT("Keyword: /bits/\n"); |
1019 | BEGIN_DEFAULT(); | 1020 | BEGIN_DEFAULT(); |
@@ -1022,7 +1023,7 @@ YY_RULE_SETUP | |||
1022 | YY_BREAK | 1023 | YY_BREAK |
1023 | case 7: | 1024 | case 7: |
1024 | YY_RULE_SETUP | 1025 | YY_RULE_SETUP |
1025 | #line 127 "dtc-lexer.l" | 1026 | #line 128 "dtc-lexer.l" |
1026 | { | 1027 | { |
1027 | DPRINT("Keyword: /delete-property/\n"); | 1028 | DPRINT("Keyword: /delete-property/\n"); |
1028 | DPRINT("<PROPNODENAME>\n"); | 1029 | DPRINT("<PROPNODENAME>\n"); |
@@ -1032,7 +1033,7 @@ YY_RULE_SETUP | |||
1032 | YY_BREAK | 1033 | YY_BREAK |
1033 | case 8: | 1034 | case 8: |
1034 | YY_RULE_SETUP | 1035 | YY_RULE_SETUP |
1035 | #line 134 "dtc-lexer.l" | 1036 | #line 135 "dtc-lexer.l" |
1036 | { | 1037 | { |
1037 | DPRINT("Keyword: /delete-node/\n"); | 1038 | DPRINT("Keyword: /delete-node/\n"); |
1038 | DPRINT("<PROPNODENAME>\n"); | 1039 | DPRINT("<PROPNODENAME>\n"); |
@@ -1042,7 +1043,7 @@ YY_RULE_SETUP | |||
1042 | YY_BREAK | 1043 | YY_BREAK |
1043 | case 9: | 1044 | case 9: |
1044 | YY_RULE_SETUP | 1045 | YY_RULE_SETUP |
1045 | #line 141 "dtc-lexer.l" | 1046 | #line 142 "dtc-lexer.l" |
1046 | { | 1047 | { |
1047 | DPRINT("Label: %s\n", yytext); | 1048 | DPRINT("Label: %s\n", yytext); |
1048 | yylval.labelref = xstrdup(yytext); | 1049 | yylval.labelref = xstrdup(yytext); |
@@ -1052,27 +1053,54 @@ YY_RULE_SETUP | |||
1052 | YY_BREAK | 1053 | YY_BREAK |
1053 | case 10: | 1054 | case 10: |
1054 | YY_RULE_SETUP | 1055 | YY_RULE_SETUP |
1055 | #line 148 "dtc-lexer.l" | 1056 | #line 149 "dtc-lexer.l" |
1056 | { | 1057 | { |
1057 | yylval.literal = xstrdup(yytext); | 1058 | char *e; |
1058 | DPRINT("Literal: '%s'\n", yylval.literal); | 1059 | DPRINT("Integer Literal: '%s'\n", yytext); |
1060 | |||
1061 | errno = 0; | ||
1062 | yylval.integer = strtoull(yytext, &e, 0); | ||
1063 | |||
1064 | assert(!(*e) || !e[strspn(e, "UL")]); | ||
1065 | |||
1066 | if (errno == ERANGE) | ||
1067 | lexical_error("Integer literal '%s' out of range", | ||
1068 | yytext); | ||
1069 | else | ||
1070 | /* ERANGE is the only strtoull error triggerable | ||
1071 | * by strings matching the pattern */ | ||
1072 | assert(errno == 0); | ||
1059 | return DT_LITERAL; | 1073 | return DT_LITERAL; |
1060 | } | 1074 | } |
1061 | YY_BREAK | 1075 | YY_BREAK |
1062 | case 11: | 1076 | case 11: |
1063 | /* rule 11 can match eol */ | 1077 | /* rule 11 can match eol */ |
1064 | YY_RULE_SETUP | 1078 | YY_RULE_SETUP |
1065 | #line 154 "dtc-lexer.l" | 1079 | #line 168 "dtc-lexer.l" |
1066 | { | 1080 | { |
1067 | yytext[yyleng-1] = '\0'; | 1081 | struct data d; |
1068 | yylval.literal = xstrdup(yytext+1); | 1082 | DPRINT("Character literal: %s\n", yytext); |
1069 | DPRINT("Character literal: %s\n", yylval.literal); | 1083 | |
1084 | d = data_copy_escape_string(yytext+1, yyleng-2); | ||
1085 | if (d.len == 1) { | ||
1086 | lexical_error("Empty character literal"); | ||
1087 | yylval.integer = 0; | ||
1088 | return DT_CHAR_LITERAL; | ||
1089 | } | ||
1090 | |||
1091 | yylval.integer = (unsigned char)d.val[0]; | ||
1092 | |||
1093 | if (d.len > 2) | ||
1094 | lexical_error("Character literal has %d" | ||
1095 | " characters instead of 1", | ||
1096 | d.len - 1); | ||
1097 | |||
1070 | return DT_CHAR_LITERAL; | 1098 | return DT_CHAR_LITERAL; |
1071 | } | 1099 | } |
1072 | YY_BREAK | 1100 | YY_BREAK |
1073 | case 12: | 1101 | case 12: |
1074 | YY_RULE_SETUP | 1102 | YY_RULE_SETUP |
1075 | #line 161 "dtc-lexer.l" | 1103 | #line 189 "dtc-lexer.l" |
1076 | { /* label reference */ | 1104 | { /* label reference */ |
1077 | DPRINT("Ref: %s\n", yytext+1); | 1105 | DPRINT("Ref: %s\n", yytext+1); |
1078 | yylval.labelref = xstrdup(yytext+1); | 1106 | yylval.labelref = xstrdup(yytext+1); |
@@ -1081,7 +1109,7 @@ YY_RULE_SETUP | |||
1081 | YY_BREAK | 1109 | YY_BREAK |
1082 | case 13: | 1110 | case 13: |
1083 | YY_RULE_SETUP | 1111 | YY_RULE_SETUP |
1084 | #line 167 "dtc-lexer.l" | 1112 | #line 195 "dtc-lexer.l" |
1085 | { /* new-style path reference */ | 1113 | { /* new-style path reference */ |
1086 | yytext[yyleng-1] = '\0'; | 1114 | yytext[yyleng-1] = '\0'; |
1087 | DPRINT("Ref: %s\n", yytext+2); | 1115 | DPRINT("Ref: %s\n", yytext+2); |
@@ -1091,7 +1119,7 @@ YY_RULE_SETUP | |||
1091 | YY_BREAK | 1119 | YY_BREAK |
1092 | case 14: | 1120 | case 14: |
1093 | YY_RULE_SETUP | 1121 | YY_RULE_SETUP |
1094 | #line 174 "dtc-lexer.l" | 1122 | #line 202 "dtc-lexer.l" |
1095 | { | 1123 | { |
1096 | yylval.byte = strtol(yytext, NULL, 16); | 1124 | yylval.byte = strtol(yytext, NULL, 16); |
1097 | DPRINT("Byte: %02x\n", (int)yylval.byte); | 1125 | DPRINT("Byte: %02x\n", (int)yylval.byte); |
@@ -1100,7 +1128,7 @@ YY_RULE_SETUP | |||
1100 | YY_BREAK | 1128 | YY_BREAK |
1101 | case 15: | 1129 | case 15: |
1102 | YY_RULE_SETUP | 1130 | YY_RULE_SETUP |
1103 | #line 180 "dtc-lexer.l" | 1131 | #line 208 "dtc-lexer.l" |
1104 | { | 1132 | { |
1105 | DPRINT("/BYTESTRING\n"); | 1133 | DPRINT("/BYTESTRING\n"); |
1106 | BEGIN_DEFAULT(); | 1134 | BEGIN_DEFAULT(); |
@@ -1109,7 +1137,7 @@ YY_RULE_SETUP | |||
1109 | YY_BREAK | 1137 | YY_BREAK |
1110 | case 16: | 1138 | case 16: |
1111 | YY_RULE_SETUP | 1139 | YY_RULE_SETUP |
1112 | #line 186 "dtc-lexer.l" | 1140 | #line 214 "dtc-lexer.l" |
1113 | { | 1141 | { |
1114 | DPRINT("PropNodeName: %s\n", yytext); | 1142 | DPRINT("PropNodeName: %s\n", yytext); |
1115 | yylval.propnodename = xstrdup((yytext[0] == '\\') ? | 1143 | yylval.propnodename = xstrdup((yytext[0] == '\\') ? |
@@ -1120,7 +1148,7 @@ YY_RULE_SETUP | |||
1120 | YY_BREAK | 1148 | YY_BREAK |
1121 | case 17: | 1149 | case 17: |
1122 | YY_RULE_SETUP | 1150 | YY_RULE_SETUP |
1123 | #line 194 "dtc-lexer.l" | 1151 | #line 222 "dtc-lexer.l" |
1124 | { | 1152 | { |
1125 | DPRINT("Binary Include\n"); | 1153 | DPRINT("Binary Include\n"); |
1126 | return DT_INCBIN; | 1154 | return DT_INCBIN; |
@@ -1129,64 +1157,64 @@ YY_RULE_SETUP | |||
1129 | case 18: | 1157 | case 18: |
1130 | /* rule 18 can match eol */ | 1158 | /* rule 18 can match eol */ |
1131 | YY_RULE_SETUP | 1159 | YY_RULE_SETUP |
1132 | #line 199 "dtc-lexer.l" | 1160 | #line 227 "dtc-lexer.l" |
1133 | /* eat whitespace */ | 1161 | /* eat whitespace */ |
1134 | YY_BREAK | 1162 | YY_BREAK |
1135 | case 19: | 1163 | case 19: |
1136 | /* rule 19 can match eol */ | 1164 | /* rule 19 can match eol */ |
1137 | YY_RULE_SETUP | 1165 | YY_RULE_SETUP |
1138 | #line 200 "dtc-lexer.l" | 1166 | #line 228 "dtc-lexer.l" |
1139 | /* eat C-style comments */ | 1167 | /* eat C-style comments */ |
1140 | YY_BREAK | 1168 | YY_BREAK |
1141 | case 20: | 1169 | case 20: |
1142 | /* rule 20 can match eol */ | 1170 | /* rule 20 can match eol */ |
1143 | YY_RULE_SETUP | 1171 | YY_RULE_SETUP |
1144 | #line 201 "dtc-lexer.l" | 1172 | #line 229 "dtc-lexer.l" |
1145 | /* eat C++-style comments */ | 1173 | /* eat C++-style comments */ |
1146 | YY_BREAK | 1174 | YY_BREAK |
1147 | case 21: | 1175 | case 21: |
1148 | YY_RULE_SETUP | 1176 | YY_RULE_SETUP |
1149 | #line 203 "dtc-lexer.l" | 1177 | #line 231 "dtc-lexer.l" |
1150 | { return DT_LSHIFT; }; | 1178 | { return DT_LSHIFT; }; |
1151 | YY_BREAK | 1179 | YY_BREAK |
1152 | case 22: | 1180 | case 22: |
1153 | YY_RULE_SETUP | 1181 | YY_RULE_SETUP |
1154 | #line 204 "dtc-lexer.l" | 1182 | #line 232 "dtc-lexer.l" |
1155 | { return DT_RSHIFT; }; | 1183 | { return DT_RSHIFT; }; |
1156 | YY_BREAK | 1184 | YY_BREAK |
1157 | case 23: | 1185 | case 23: |
1158 | YY_RULE_SETUP | 1186 | YY_RULE_SETUP |
1159 | #line 205 "dtc-lexer.l" | 1187 | #line 233 "dtc-lexer.l" |
1160 | { return DT_LE; }; | 1188 | { return DT_LE; }; |
1161 | YY_BREAK | 1189 | YY_BREAK |
1162 | case 24: | 1190 | case 24: |
1163 | YY_RULE_SETUP | 1191 | YY_RULE_SETUP |
1164 | #line 206 "dtc-lexer.l" | 1192 | #line 234 "dtc-lexer.l" |
1165 | { return DT_GE; }; | 1193 | { return DT_GE; }; |
1166 | YY_BREAK | 1194 | YY_BREAK |
1167 | case 25: | 1195 | case 25: |
1168 | YY_RULE_SETUP | 1196 | YY_RULE_SETUP |
1169 | #line 207 "dtc-lexer.l" | 1197 | #line 235 "dtc-lexer.l" |
1170 | { return DT_EQ; }; | 1198 | { return DT_EQ; }; |
1171 | YY_BREAK | 1199 | YY_BREAK |
1172 | case 26: | 1200 | case 26: |
1173 | YY_RULE_SETUP | 1201 | YY_RULE_SETUP |
1174 | #line 208 "dtc-lexer.l" | 1202 | #line 236 "dtc-lexer.l" |
1175 | { return DT_NE; }; | 1203 | { return DT_NE; }; |
1176 | YY_BREAK | 1204 | YY_BREAK |
1177 | case 27: | 1205 | case 27: |
1178 | YY_RULE_SETUP | 1206 | YY_RULE_SETUP |
1179 | #line 209 "dtc-lexer.l" | 1207 | #line 237 "dtc-lexer.l" |
1180 | { return DT_AND; }; | 1208 | { return DT_AND; }; |
1181 | YY_BREAK | 1209 | YY_BREAK |
1182 | case 28: | 1210 | case 28: |
1183 | YY_RULE_SETUP | 1211 | YY_RULE_SETUP |
1184 | #line 210 "dtc-lexer.l" | 1212 | #line 238 "dtc-lexer.l" |
1185 | { return DT_OR; }; | 1213 | { return DT_OR; }; |
1186 | YY_BREAK | 1214 | YY_BREAK |
1187 | case 29: | 1215 | case 29: |
1188 | YY_RULE_SETUP | 1216 | YY_RULE_SETUP |
1189 | #line 212 "dtc-lexer.l" | 1217 | #line 240 "dtc-lexer.l" |
1190 | { | 1218 | { |
1191 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], | 1219 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], |
1192 | (unsigned)yytext[0]); | 1220 | (unsigned)yytext[0]); |
@@ -1204,10 +1232,10 @@ YY_RULE_SETUP | |||
1204 | YY_BREAK | 1232 | YY_BREAK |
1205 | case 30: | 1233 | case 30: |
1206 | YY_RULE_SETUP | 1234 | YY_RULE_SETUP |
1207 | #line 227 "dtc-lexer.l" | 1235 | #line 255 "dtc-lexer.l" |
1208 | ECHO; | 1236 | ECHO; |
1209 | YY_BREAK | 1237 | YY_BREAK |
1210 | #line 1211 "dtc-lexer.lex.c" | 1238 | #line 1239 "dtc-lexer.lex.c" |
1211 | 1239 | ||
1212 | case YY_END_OF_BUFFER: | 1240 | case YY_END_OF_BUFFER: |
1213 | { | 1241 | { |
@@ -1337,6 +1365,7 @@ ECHO; | |||
1337 | "fatal flex scanner internal error--no action found" ); | 1365 | "fatal flex scanner internal error--no action found" ); |
1338 | } /* end of action switch */ | 1366 | } /* end of action switch */ |
1339 | } /* end of scanning one token */ | 1367 | } /* end of scanning one token */ |
1368 | } /* end of user's declarations */ | ||
1340 | } /* end of yylex */ | 1369 | } /* end of yylex */ |
1341 | 1370 | ||
1342 | /* yy_get_next_buffer - try to read in a new buffer | 1371 | /* yy_get_next_buffer - try to read in a new buffer |
@@ -1392,21 +1421,21 @@ static int yy_get_next_buffer (void) | |||
1392 | 1421 | ||
1393 | else | 1422 | else |
1394 | { | 1423 | { |
1395 | int num_to_read = | 1424 | yy_size_t num_to_read = |
1396 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; | 1425 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
1397 | 1426 | ||
1398 | while ( num_to_read <= 0 ) | 1427 | while ( num_to_read <= 0 ) |
1399 | { /* Not enough room in the buffer - grow it. */ | 1428 | { /* Not enough room in the buffer - grow it. */ |
1400 | 1429 | ||
1401 | /* just a shorter name for the current buffer */ | 1430 | /* just a shorter name for the current buffer */ |
1402 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER; | 1431 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; |
1403 | 1432 | ||
1404 | int yy_c_buf_p_offset = | 1433 | int yy_c_buf_p_offset = |
1405 | (int) ((yy_c_buf_p) - b->yy_ch_buf); | 1434 | (int) ((yy_c_buf_p) - b->yy_ch_buf); |
1406 | 1435 | ||
1407 | if ( b->yy_is_our_buffer ) | 1436 | if ( b->yy_is_our_buffer ) |
1408 | { | 1437 | { |
1409 | int new_size = b->yy_buf_size * 2; | 1438 | yy_size_t new_size = b->yy_buf_size * 2; |
1410 | 1439 | ||
1411 | if ( new_size <= 0 ) | 1440 | if ( new_size <= 0 ) |
1412 | b->yy_buf_size += b->yy_buf_size / 8; | 1441 | b->yy_buf_size += b->yy_buf_size / 8; |
@@ -1437,7 +1466,7 @@ static int yy_get_next_buffer (void) | |||
1437 | 1466 | ||
1438 | /* Read in more data. */ | 1467 | /* Read in more data. */ |
1439 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), | 1468 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), |
1440 | (yy_n_chars), (size_t) num_to_read ); | 1469 | (yy_n_chars), num_to_read ); |
1441 | 1470 | ||
1442 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | 1471 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); |
1443 | } | 1472 | } |
@@ -1499,7 +1528,7 @@ static int yy_get_next_buffer (void) | |||
1499 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 1528 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1500 | { | 1529 | { |
1501 | yy_current_state = (int) yy_def[yy_current_state]; | 1530 | yy_current_state = (int) yy_def[yy_current_state]; |
1502 | if ( yy_current_state >= 161 ) | 1531 | if ( yy_current_state >= 159 ) |
1503 | yy_c = yy_meta[(unsigned int) yy_c]; | 1532 | yy_c = yy_meta[(unsigned int) yy_c]; |
1504 | } | 1533 | } |
1505 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 1534 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
@@ -1527,13 +1556,13 @@ static int yy_get_next_buffer (void) | |||
1527 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 1556 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1528 | { | 1557 | { |
1529 | yy_current_state = (int) yy_def[yy_current_state]; | 1558 | yy_current_state = (int) yy_def[yy_current_state]; |
1530 | if ( yy_current_state >= 161 ) | 1559 | if ( yy_current_state >= 159 ) |
1531 | yy_c = yy_meta[(unsigned int) yy_c]; | 1560 | yy_c = yy_meta[(unsigned int) yy_c]; |
1532 | } | 1561 | } |
1533 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 1562 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
1534 | yy_is_jam = (yy_current_state == 160); | 1563 | yy_is_jam = (yy_current_state == 158); |
1535 | 1564 | ||
1536 | return yy_is_jam ? 0 : yy_current_state; | 1565 | return yy_is_jam ? 0 : yy_current_state; |
1537 | } | 1566 | } |
1538 | 1567 | ||
1539 | #ifndef YY_NO_INPUT | 1568 | #ifndef YY_NO_INPUT |
@@ -1560,7 +1589,7 @@ static int yy_get_next_buffer (void) | |||
1560 | 1589 | ||
1561 | else | 1590 | else |
1562 | { /* need more input */ | 1591 | { /* need more input */ |
1563 | int offset = (yy_c_buf_p) - (yytext_ptr); | 1592 | yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); |
1564 | ++(yy_c_buf_p); | 1593 | ++(yy_c_buf_p); |
1565 | 1594 | ||
1566 | switch ( yy_get_next_buffer( ) ) | 1595 | switch ( yy_get_next_buffer( ) ) |
@@ -1834,7 +1863,7 @@ void yypop_buffer_state (void) | |||
1834 | */ | 1863 | */ |
1835 | static void yyensure_buffer_stack (void) | 1864 | static void yyensure_buffer_stack (void) |
1836 | { | 1865 | { |
1837 | int num_to_alloc; | 1866 | yy_size_t num_to_alloc; |
1838 | 1867 | ||
1839 | if (!(yy_buffer_stack)) { | 1868 | if (!(yy_buffer_stack)) { |
1840 | 1869 | ||
@@ -1931,12 +1960,12 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) | |||
1931 | * | 1960 | * |
1932 | * @return the newly allocated buffer state object. | 1961 | * @return the newly allocated buffer state object. |
1933 | */ | 1962 | */ |
1934 | YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) | 1963 | YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) |
1935 | { | 1964 | { |
1936 | YY_BUFFER_STATE b; | 1965 | YY_BUFFER_STATE b; |
1937 | char *buf; | 1966 | char *buf; |
1938 | yy_size_t n; | 1967 | yy_size_t n; |
1939 | int i; | 1968 | yy_size_t i; |
1940 | 1969 | ||
1941 | /* Get memory for full buffer, including space for trailing EOB's. */ | 1970 | /* Get memory for full buffer, including space for trailing EOB's. */ |
1942 | n = _yybytes_len + 2; | 1971 | n = _yybytes_len + 2; |
@@ -2018,7 +2047,7 @@ FILE *yyget_out (void) | |||
2018 | /** Get the length of the current token. | 2047 | /** Get the length of the current token. |
2019 | * | 2048 | * |
2020 | */ | 2049 | */ |
2021 | int yyget_leng (void) | 2050 | yy_size_t yyget_leng (void) |
2022 | { | 2051 | { |
2023 | return yyleng; | 2052 | return yyleng; |
2024 | } | 2053 | } |
@@ -2166,7 +2195,7 @@ void yyfree (void * ptr ) | |||
2166 | 2195 | ||
2167 | #define YYTABLES_NAME "yytables" | 2196 | #define YYTABLES_NAME "yytables" |
2168 | 2197 | ||
2169 | #line 227 "dtc-lexer.l" | 2198 | #line 254 "dtc-lexer.l" |
2170 | 2199 | ||
2171 | 2200 | ||
2172 | 2201 | ||
@@ -2182,14 +2211,25 @@ static void push_input_file(const char *filename) | |||
2182 | } | 2211 | } |
2183 | 2212 | ||
2184 | 2213 | ||
2185 | static int pop_input_file(void) | 2214 | static bool pop_input_file(void) |
2186 | { | 2215 | { |
2187 | if (srcfile_pop() == 0) | 2216 | if (srcfile_pop() == 0) |
2188 | return 0; | 2217 | return false; |
2189 | 2218 | ||
2190 | yypop_buffer_state(); | 2219 | yypop_buffer_state(); |
2191 | yyin = current_srcfile->f; | 2220 | yyin = current_srcfile->f; |
2192 | 2221 | ||
2193 | return 1; | 2222 | return true; |
2223 | } | ||
2224 | |||
2225 | static void lexical_error(const char *fmt, ...) | ||
2226 | { | ||
2227 | va_list ap; | ||
2228 | |||
2229 | va_start(ap, fmt); | ||
2230 | srcpos_verror(&yylloc, "Lexical error", fmt, ap); | ||
2231 | va_end(ap); | ||
2232 | |||
2233 | treesource_error = true; | ||
2194 | } | 2234 | } |
2195 | 2235 | ||
diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped index c8769d550cfb..116458c8dfc4 100644 --- a/scripts/dtc/dtc-parser.tab.c_shipped +++ b/scripts/dtc/dtc-parser.tab.c_shipped | |||
@@ -1,19 +1,19 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.7.12-4996. */ | 1 | /* A Bison parser, made by GNU Bison 3.0.2. */ |
2 | 2 | ||
3 | /* Bison implementation for Yacc-like parsers in C | 3 | /* Bison implementation for Yacc-like parsers in C |
4 | 4 | ||
5 | Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. | 5 | Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. |
6 | 6 | ||
7 | This program is free software: you can redistribute it and/or modify | 7 | This program is free software: you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation, either version 3 of the License, or | 9 | the Free Software Foundation, either version 3 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
19 | 19 | ||
@@ -26,7 +26,7 @@ | |||
26 | special exception, which will cause the skeleton and the resulting | 26 | special exception, which will cause the skeleton and the resulting |
27 | Bison output files to be licensed under the GNU General Public | 27 | Bison output files to be licensed under the GNU General Public |
28 | License without this special exception. | 28 | License without this special exception. |
29 | 29 | ||
30 | This special exception was added by the Free Software Foundation in | 30 | This special exception was added by the Free Software Foundation in |
31 | version 2.2 of Bison. */ | 31 | version 2.2 of Bison. */ |
32 | 32 | ||
@@ -44,7 +44,7 @@ | |||
44 | #define YYBISON 1 | 44 | #define YYBISON 1 |
45 | 45 | ||
46 | /* Bison version. */ | 46 | /* Bison version. */ |
47 | #define YYBISON_VERSION "2.7.12-4996" | 47 | #define YYBISON_VERSION "3.0.2" |
48 | 48 | ||
49 | /* Skeleton name. */ | 49 | /* Skeleton name. */ |
50 | #define YYSKELETON_NAME "yacc.c" | 50 | #define YYSKELETON_NAME "yacc.c" |
@@ -62,34 +62,31 @@ | |||
62 | 62 | ||
63 | 63 | ||
64 | /* Copy the first part of user declarations. */ | 64 | /* Copy the first part of user declarations. */ |
65 | /* Line 371 of yacc.c */ | 65 | #line 20 "dtc-parser.y" /* yacc.c:339 */ |
66 | #line 21 "dtc-parser.y" | ||
67 | 66 | ||
68 | #include <stdio.h> | 67 | #include <stdio.h> |
69 | 68 | ||
70 | #include "dtc.h" | 69 | #include "dtc.h" |
71 | #include "srcpos.h" | 70 | #include "srcpos.h" |
72 | 71 | ||
73 | YYLTYPE yylloc; | ||
74 | |||
75 | extern int yylex(void); | 72 | extern int yylex(void); |
76 | extern void print_error(char const *fmt, ...); | ||
77 | extern void yyerror(char const *s); | 73 | extern void yyerror(char const *s); |
74 | #define ERROR(loc, ...) \ | ||
75 | do { \ | ||
76 | srcpos_error((loc), "Error", __VA_ARGS__); \ | ||
77 | treesource_error = true; \ | ||
78 | } while (0) | ||
78 | 79 | ||
79 | extern struct boot_info *the_boot_info; | 80 | extern struct boot_info *the_boot_info; |
80 | extern int treesource_error; | 81 | extern bool treesource_error; |
81 | 82 | ||
82 | static unsigned long long eval_literal(const char *s, int base, int bits); | 83 | #line 84 "dtc-parser.tab.c" /* yacc.c:339 */ |
83 | static unsigned char eval_char_literal(const char *s); | ||
84 | 84 | ||
85 | /* Line 371 of yacc.c */ | 85 | # ifndef YY_NULLPTR |
86 | #line 87 "dtc-parser.tab.c" | ||
87 | |||
88 | # ifndef YY_NULL | ||
89 | # if defined __cplusplus && 201103L <= __cplusplus | 86 | # if defined __cplusplus && 201103L <= __cplusplus |
90 | # define YY_NULL nullptr | 87 | # define YY_NULLPTR nullptr |
91 | # else | 88 | # else |
92 | # define YY_NULL 0 | 89 | # define YY_NULLPTR 0 |
93 | # endif | 90 | # endif |
94 | # endif | 91 | # endif |
95 | 92 | ||
@@ -105,7 +102,7 @@ static unsigned char eval_char_literal(const char *s); | |||
105 | by #include "dtc-parser.tab.h". */ | 102 | by #include "dtc-parser.tab.h". */ |
106 | #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED | 103 | #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED |
107 | # define YY_YY_DTC_PARSER_TAB_H_INCLUDED | 104 | # define YY_YY_DTC_PARSER_TAB_H_INCLUDED |
108 | /* Enabling traces. */ | 105 | /* Debug traces. */ |
109 | #ifndef YYDEBUG | 106 | #ifndef YYDEBUG |
110 | # define YYDEBUG 0 | 107 | # define YYDEBUG 0 |
111 | #endif | 108 | #endif |
@@ -113,48 +110,44 @@ static unsigned char eval_char_literal(const char *s); | |||
113 | extern int yydebug; | 110 | extern int yydebug; |
114 | #endif | 111 | #endif |
115 | 112 | ||
116 | /* Tokens. */ | 113 | /* Token type. */ |
117 | #ifndef YYTOKENTYPE | 114 | #ifndef YYTOKENTYPE |
118 | # define YYTOKENTYPE | 115 | # define YYTOKENTYPE |
119 | /* Put the tokens into the symbol table, so that GDB and other debuggers | 116 | enum yytokentype |
120 | know about them. */ | 117 | { |
121 | enum yytokentype { | 118 | DT_V1 = 258, |
122 | DT_V1 = 258, | 119 | DT_MEMRESERVE = 259, |
123 | DT_MEMRESERVE = 259, | 120 | DT_LSHIFT = 260, |
124 | DT_LSHIFT = 260, | 121 | DT_RSHIFT = 261, |
125 | DT_RSHIFT = 261, | 122 | DT_LE = 262, |
126 | DT_LE = 262, | 123 | DT_GE = 263, |
127 | DT_GE = 263, | 124 | DT_EQ = 264, |
128 | DT_EQ = 264, | 125 | DT_NE = 265, |
129 | DT_NE = 265, | 126 | DT_AND = 266, |
130 | DT_AND = 266, | 127 | DT_OR = 267, |
131 | DT_OR = 267, | 128 | DT_BITS = 268, |
132 | DT_BITS = 268, | 129 | DT_DEL_PROP = 269, |
133 | DT_DEL_PROP = 269, | 130 | DT_DEL_NODE = 270, |
134 | DT_DEL_NODE = 270, | 131 | DT_PROPNODENAME = 271, |
135 | DT_PROPNODENAME = 271, | 132 | DT_LITERAL = 272, |
136 | DT_LITERAL = 272, | 133 | DT_CHAR_LITERAL = 273, |
137 | DT_CHAR_LITERAL = 273, | 134 | DT_BYTE = 274, |
138 | DT_BASE = 274, | 135 | DT_STRING = 275, |
139 | DT_BYTE = 275, | 136 | DT_LABEL = 276, |
140 | DT_STRING = 276, | 137 | DT_REF = 277, |
141 | DT_LABEL = 277, | 138 | DT_INCBIN = 278 |
142 | DT_REF = 278, | 139 | }; |
143 | DT_INCBIN = 279 | ||
144 | }; | ||
145 | #endif | 140 | #endif |
146 | 141 | ||
147 | 142 | /* Value type. */ | |
148 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | 143 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
149 | typedef union YYSTYPE | 144 | typedef union YYSTYPE YYSTYPE; |
145 | union YYSTYPE | ||
150 | { | 146 | { |
151 | /* Line 387 of yacc.c */ | 147 | #line 38 "dtc-parser.y" /* yacc.c:355 */ |
152 | #line 40 "dtc-parser.y" | ||
153 | 148 | ||
154 | char *propnodename; | 149 | char *propnodename; |
155 | char *literal; | ||
156 | char *labelref; | 150 | char *labelref; |
157 | unsigned int cbase; | ||
158 | uint8_t byte; | 151 | uint8_t byte; |
159 | struct data data; | 152 | struct data data; |
160 | 153 | ||
@@ -170,37 +163,36 @@ typedef union YYSTYPE | |||
170 | struct reserve_info *re; | 163 | struct reserve_info *re; |
171 | uint64_t integer; | 164 | uint64_t integer; |
172 | 165 | ||
173 | 166 | #line 167 "dtc-parser.tab.c" /* yacc.c:355 */ | |
174 | /* Line 387 of yacc.c */ | 167 | }; |
175 | #line 176 "dtc-parser.tab.c" | ||
176 | } YYSTYPE; | ||
177 | # define YYSTYPE_IS_TRIVIAL 1 | 168 | # define YYSTYPE_IS_TRIVIAL 1 |
178 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||
179 | # define YYSTYPE_IS_DECLARED 1 | 169 | # define YYSTYPE_IS_DECLARED 1 |
180 | #endif | 170 | #endif |
181 | 171 | ||
182 | extern YYSTYPE yylval; | 172 | /* Location type. */ |
183 | 173 | #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED | |
184 | #ifdef YYPARSE_PARAM | 174 | typedef struct YYLTYPE YYLTYPE; |
185 | #if defined __STDC__ || defined __cplusplus | 175 | struct YYLTYPE |
186 | int yyparse (void *YYPARSE_PARAM); | 176 | { |
187 | #else | 177 | int first_line; |
188 | int yyparse (); | 178 | int first_column; |
179 | int last_line; | ||
180 | int last_column; | ||
181 | }; | ||
182 | # define YYLTYPE_IS_DECLARED 1 | ||
183 | # define YYLTYPE_IS_TRIVIAL 1 | ||
189 | #endif | 184 | #endif |
190 | #else /* ! YYPARSE_PARAM */ | 185 | |
191 | #if defined __STDC__ || defined __cplusplus | 186 | |
187 | extern YYSTYPE yylval; | ||
188 | extern YYLTYPE yylloc; | ||
192 | int yyparse (void); | 189 | int yyparse (void); |
193 | #else | ||
194 | int yyparse (); | ||
195 | #endif | ||
196 | #endif /* ! YYPARSE_PARAM */ | ||
197 | 190 | ||
198 | #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ | 191 | #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ |
199 | 192 | ||
200 | /* Copy the second part of user declarations. */ | 193 | /* Copy the second part of user declarations. */ |
201 | 194 | ||
202 | /* Line 390 of yacc.c */ | 195 | #line 196 "dtc-parser.tab.c" /* yacc.c:358 */ |
203 | #line 204 "dtc-parser.tab.c" | ||
204 | 196 | ||
205 | #ifdef short | 197 | #ifdef short |
206 | # undef short | 198 | # undef short |
@@ -214,11 +206,8 @@ typedef unsigned char yytype_uint8; | |||
214 | 206 | ||
215 | #ifdef YYTYPE_INT8 | 207 | #ifdef YYTYPE_INT8 |
216 | typedef YYTYPE_INT8 yytype_int8; | 208 | typedef YYTYPE_INT8 yytype_int8; |
217 | #elif (defined __STDC__ || defined __C99__FUNC__ \ | ||
218 | || defined __cplusplus || defined _MSC_VER) | ||
219 | typedef signed char yytype_int8; | ||
220 | #else | 209 | #else |
221 | typedef short int yytype_int8; | 210 | typedef signed char yytype_int8; |
222 | #endif | 211 | #endif |
223 | 212 | ||
224 | #ifdef YYTYPE_UINT16 | 213 | #ifdef YYTYPE_UINT16 |
@@ -238,8 +227,7 @@ typedef short int yytype_int16; | |||
238 | # define YYSIZE_T __SIZE_TYPE__ | 227 | # define YYSIZE_T __SIZE_TYPE__ |
239 | # elif defined size_t | 228 | # elif defined size_t |
240 | # define YYSIZE_T size_t | 229 | # define YYSIZE_T size_t |
241 | # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ | 230 | # elif ! defined YYSIZE_T |
242 | || defined __cplusplus || defined _MSC_VER) | ||
243 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | 231 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
244 | # define YYSIZE_T size_t | 232 | # define YYSIZE_T size_t |
245 | # else | 233 | # else |
@@ -261,11 +249,30 @@ typedef short int yytype_int16; | |||
261 | # endif | 249 | # endif |
262 | #endif | 250 | #endif |
263 | 251 | ||
264 | #ifndef __attribute__ | 252 | #ifndef YY_ATTRIBUTE |
265 | /* This feature is available in gcc versions 2.5 and later. */ | 253 | # if (defined __GNUC__ \ |
266 | # if (! defined __GNUC__ || __GNUC__ < 2 \ | 254 | && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ |
267 | || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) | 255 | || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C |
268 | # define __attribute__(Spec) /* empty */ | 256 | # define YY_ATTRIBUTE(Spec) __attribute__(Spec) |
257 | # else | ||
258 | # define YY_ATTRIBUTE(Spec) /* empty */ | ||
259 | # endif | ||
260 | #endif | ||
261 | |||
262 | #ifndef YY_ATTRIBUTE_PURE | ||
263 | # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) | ||
264 | #endif | ||
265 | |||
266 | #ifndef YY_ATTRIBUTE_UNUSED | ||
267 | # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) | ||
268 | #endif | ||
269 | |||
270 | #if !defined _Noreturn \ | ||
271 | && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) | ||
272 | # if defined _MSC_VER && 1200 <= _MSC_VER | ||
273 | # define _Noreturn __declspec (noreturn) | ||
274 | # else | ||
275 | # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) | ||
269 | # endif | 276 | # endif |
270 | #endif | 277 | #endif |
271 | 278 | ||
@@ -276,25 +283,26 @@ typedef short int yytype_int16; | |||
276 | # define YYUSE(E) /* empty */ | 283 | # define YYUSE(E) /* empty */ |
277 | #endif | 284 | #endif |
278 | 285 | ||
279 | 286 | #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ | |
280 | /* Identity function, used to suppress warnings about constant conditions. */ | 287 | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
281 | #ifndef lint | 288 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
282 | # define YYID(N) (N) | 289 | _Pragma ("GCC diagnostic push") \ |
283 | #else | 290 | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ |
284 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 291 | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
285 | || defined __cplusplus || defined _MSC_VER) | 292 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ |
286 | static int | 293 | _Pragma ("GCC diagnostic pop") |
287 | YYID (int yyi) | ||
288 | #else | 294 | #else |
289 | static int | 295 | # define YY_INITIAL_VALUE(Value) Value |
290 | YYID (yyi) | ||
291 | int yyi; | ||
292 | #endif | 296 | #endif |
293 | { | 297 | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
294 | return yyi; | 298 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
295 | } | 299 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END |
300 | #endif | ||
301 | #ifndef YY_INITIAL_VALUE | ||
302 | # define YY_INITIAL_VALUE(Value) /* Nothing. */ | ||
296 | #endif | 303 | #endif |
297 | 304 | ||
305 | |||
298 | #if ! defined yyoverflow || YYERROR_VERBOSE | 306 | #if ! defined yyoverflow || YYERROR_VERBOSE |
299 | 307 | ||
300 | /* The parser invokes alloca or malloc; define the necessary symbols. */ | 308 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
@@ -312,8 +320,7 @@ YYID (yyi) | |||
312 | # define alloca _alloca | 320 | # define alloca _alloca |
313 | # else | 321 | # else |
314 | # define YYSTACK_ALLOC alloca | 322 | # define YYSTACK_ALLOC alloca |
315 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ | 323 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS |
316 | || defined __cplusplus || defined _MSC_VER) | ||
317 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | 324 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
318 | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ | 325 | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
319 | # ifndef EXIT_SUCCESS | 326 | # ifndef EXIT_SUCCESS |
@@ -325,8 +332,8 @@ YYID (yyi) | |||
325 | # endif | 332 | # endif |
326 | 333 | ||
327 | # ifdef YYSTACK_ALLOC | 334 | # ifdef YYSTACK_ALLOC |
328 | /* Pacify GCC's `empty if-body' warning. */ | 335 | /* Pacify GCC's 'empty if-body' warning. */ |
329 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) | 336 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
330 | # ifndef YYSTACK_ALLOC_MAXIMUM | 337 | # ifndef YYSTACK_ALLOC_MAXIMUM |
331 | /* The OS might guarantee only one guard page at the bottom of the stack, | 338 | /* The OS might guarantee only one guard page at the bottom of the stack, |
332 | and a page size can be as small as 4096 bytes. So we cannot safely | 339 | and a page size can be as small as 4096 bytes. So we cannot safely |
@@ -342,7 +349,7 @@ YYID (yyi) | |||
342 | # endif | 349 | # endif |
343 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ | 350 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
344 | && ! ((defined YYMALLOC || defined malloc) \ | 351 | && ! ((defined YYMALLOC || defined malloc) \ |
345 | && (defined YYFREE || defined free))) | 352 | && (defined YYFREE || defined free))) |
346 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | 353 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
347 | # ifndef EXIT_SUCCESS | 354 | # ifndef EXIT_SUCCESS |
348 | # define EXIT_SUCCESS 0 | 355 | # define EXIT_SUCCESS 0 |
@@ -350,15 +357,13 @@ YYID (yyi) | |||
350 | # endif | 357 | # endif |
351 | # ifndef YYMALLOC | 358 | # ifndef YYMALLOC |
352 | # define YYMALLOC malloc | 359 | # define YYMALLOC malloc |
353 | # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ | 360 | # if ! defined malloc && ! defined EXIT_SUCCESS |
354 | || defined __cplusplus || defined _MSC_VER) | ||
355 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ | 361 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
356 | # endif | 362 | # endif |
357 | # endif | 363 | # endif |
358 | # ifndef YYFREE | 364 | # ifndef YYFREE |
359 | # define YYFREE free | 365 | # define YYFREE free |
360 | # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ | 366 | # if ! defined free && ! defined EXIT_SUCCESS |
361 | || defined __cplusplus || defined _MSC_VER) | ||
362 | void free (void *); /* INFRINGES ON USER NAME SPACE */ | 367 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
363 | # endif | 368 | # endif |
364 | # endif | 369 | # endif |
@@ -368,13 +373,15 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ | |||
368 | 373 | ||
369 | #if (! defined yyoverflow \ | 374 | #if (! defined yyoverflow \ |
370 | && (! defined __cplusplus \ | 375 | && (! defined __cplusplus \ |
371 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) | 376 | || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ |
377 | && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) | ||
372 | 378 | ||
373 | /* A type that is properly aligned for any stack member. */ | 379 | /* A type that is properly aligned for any stack member. */ |
374 | union yyalloc | 380 | union yyalloc |
375 | { | 381 | { |
376 | yytype_int16 yyss_alloc; | 382 | yytype_int16 yyss_alloc; |
377 | YYSTYPE yyvs_alloc; | 383 | YYSTYPE yyvs_alloc; |
384 | YYLTYPE yyls_alloc; | ||
378 | }; | 385 | }; |
379 | 386 | ||
380 | /* The size of the maximum gap between one aligned stack and the next. */ | 387 | /* The size of the maximum gap between one aligned stack and the next. */ |
@@ -383,8 +390,8 @@ union yyalloc | |||
383 | /* The size of an array large to enough to hold all stacks, each with | 390 | /* The size of an array large to enough to hold all stacks, each with |
384 | N elements. */ | 391 | N elements. */ |
385 | # define YYSTACK_BYTES(N) \ | 392 | # define YYSTACK_BYTES(N) \ |
386 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ | 393 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ |
387 | + YYSTACK_GAP_MAXIMUM) | 394 | + 2 * YYSTACK_GAP_MAXIMUM) |
388 | 395 | ||
389 | # define YYCOPY_NEEDED 1 | 396 | # define YYCOPY_NEEDED 1 |
390 | 397 | ||
@@ -393,16 +400,16 @@ union yyalloc | |||
393 | elements in the stack, and YYPTR gives the new location of the | 400 | elements in the stack, and YYPTR gives the new location of the |
394 | stack. Advance YYPTR to a properly aligned location for the next | 401 | stack. Advance YYPTR to a properly aligned location for the next |
395 | stack. */ | 402 | stack. */ |
396 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ | 403 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
397 | do \ | 404 | do \ |
398 | { \ | 405 | { \ |
399 | YYSIZE_T yynewbytes; \ | 406 | YYSIZE_T yynewbytes; \ |
400 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ | 407 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
401 | Stack = &yyptr->Stack_alloc; \ | 408 | Stack = &yyptr->Stack_alloc; \ |
402 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | 409 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
403 | yyptr += yynewbytes / sizeof (*yyptr); \ | 410 | yyptr += yynewbytes / sizeof (*yyptr); \ |
404 | } \ | 411 | } \ |
405 | while (YYID (0)) | 412 | while (0) |
406 | 413 | ||
407 | #endif | 414 | #endif |
408 | 415 | ||
@@ -421,7 +428,7 @@ union yyalloc | |||
421 | for (yyi = 0; yyi < (Count); yyi++) \ | 428 | for (yyi = 0; yyi < (Count); yyi++) \ |
422 | (Dst)[yyi] = (Src)[yyi]; \ | 429 | (Dst)[yyi] = (Src)[yyi]; \ |
423 | } \ | 430 | } \ |
424 | while (YYID (0)) | 431 | while (0) |
425 | # endif | 432 | # endif |
426 | # endif | 433 | # endif |
427 | #endif /* !YYCOPY_NEEDED */ | 434 | #endif /* !YYCOPY_NEEDED */ |
@@ -429,40 +436,42 @@ union yyalloc | |||
429 | /* YYFINAL -- State number of the termination state. */ | 436 | /* YYFINAL -- State number of the termination state. */ |
430 | #define YYFINAL 4 | 437 | #define YYFINAL 4 |
431 | /* YYLAST -- Last index in YYTABLE. */ | 438 | /* YYLAST -- Last index in YYTABLE. */ |
432 | #define YYLAST 133 | 439 | #define YYLAST 136 |
433 | 440 | ||
434 | /* YYNTOKENS -- Number of terminals. */ | 441 | /* YYNTOKENS -- Number of terminals. */ |
435 | #define YYNTOKENS 48 | 442 | #define YYNTOKENS 47 |
436 | /* YYNNTS -- Number of nonterminals. */ | 443 | /* YYNNTS -- Number of nonterminals. */ |
437 | #define YYNNTS 28 | 444 | #define YYNNTS 28 |
438 | /* YYNRULES -- Number of rules. */ | 445 | /* YYNRULES -- Number of rules. */ |
439 | #define YYNRULES 79 | 446 | #define YYNRULES 80 |
440 | /* YYNRULES -- Number of states. */ | 447 | /* YYNSTATES -- Number of states. */ |
441 | #define YYNSTATES 141 | 448 | #define YYNSTATES 144 |
442 | 449 | ||
443 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | 450 | /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned |
451 | by yylex, with out-of-bounds checking. */ | ||
444 | #define YYUNDEFTOK 2 | 452 | #define YYUNDEFTOK 2 |
445 | #define YYMAXUTOK 279 | 453 | #define YYMAXUTOK 278 |
446 | 454 | ||
447 | #define YYTRANSLATE(YYX) \ | 455 | #define YYTRANSLATE(YYX) \ |
448 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | 456 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
449 | 457 | ||
450 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ | 458 | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
459 | as returned by yylex, without out-of-bounds checking. */ | ||
451 | static const yytype_uint8 yytranslate[] = | 460 | static const yytype_uint8 yytranslate[] = |
452 | { | 461 | { |
453 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 462 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
454 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 463 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
455 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 464 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
456 | 2, 2, 2, 47, 2, 2, 2, 45, 41, 2, | 465 | 2, 2, 2, 46, 2, 2, 2, 44, 40, 2, |
457 | 33, 35, 44, 42, 34, 43, 2, 26, 2, 2, | 466 | 32, 34, 43, 41, 33, 42, 2, 25, 2, 2, |
458 | 2, 2, 2, 2, 2, 2, 2, 2, 38, 25, | 467 | 2, 2, 2, 2, 2, 2, 2, 2, 37, 24, |
459 | 36, 29, 30, 37, 2, 2, 2, 2, 2, 2, | 468 | 35, 28, 29, 36, 2, 2, 2, 2, 2, 2, |
460 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 469 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
461 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 470 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
462 | 2, 31, 2, 32, 40, 2, 2, 2, 2, 2, | 471 | 2, 30, 2, 31, 39, 2, 2, 2, 2, 2, |
463 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 472 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
464 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 473 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
465 | 2, 2, 2, 27, 39, 28, 46, 2, 2, 2, | 474 | 2, 2, 2, 26, 38, 27, 45, 2, 2, 2, |
466 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 475 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
467 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 476 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
468 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 477 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
@@ -477,67 +486,22 @@ static const yytype_uint8 yytranslate[] = | |||
477 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 486 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
478 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | 487 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
479 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | 488 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
480 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 | 489 | 15, 16, 17, 18, 19, 20, 21, 22, 23 |
481 | }; | 490 | }; |
482 | 491 | ||
483 | #if YYDEBUG | 492 | #if YYDEBUG |
484 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in | 493 | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
485 | YYRHS. */ | ||
486 | static const yytype_uint16 yyprhs[] = | ||
487 | { | ||
488 | 0, 0, 3, 8, 9, 12, 17, 20, 23, 27, | ||
489 | 31, 36, 42, 43, 46, 51, 54, 58, 61, 64, | ||
490 | 68, 73, 76, 86, 92, 95, 96, 99, 102, 106, | ||
491 | 108, 111, 114, 117, 119, 121, 125, 127, 129, 135, | ||
492 | 137, 141, 143, 147, 149, 153, 155, 159, 161, 165, | ||
493 | 167, 171, 175, 177, 181, 185, 189, 193, 197, 201, | ||
494 | 203, 207, 211, 213, 217, 221, 225, 227, 229, 232, | ||
495 | 235, 238, 239, 242, 245, 246, 249, 252, 255, 259 | ||
496 | }; | ||
497 | |||
498 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | ||
499 | static const yytype_int8 yyrhs[] = | ||
500 | { | ||
501 | 49, 0, -1, 3, 25, 50, 52, -1, -1, 51, | ||
502 | 50, -1, 4, 59, 59, 25, -1, 22, 51, -1, | ||
503 | 26, 53, -1, 52, 26, 53, -1, 52, 23, 53, | ||
504 | -1, 52, 15, 23, 25, -1, 27, 54, 74, 28, | ||
505 | 25, -1, -1, 54, 55, -1, 16, 29, 56, 25, | ||
506 | -1, 16, 25, -1, 14, 16, 25, -1, 22, 55, | ||
507 | -1, 57, 21, -1, 57, 58, 30, -1, 57, 31, | ||
508 | 73, 32, -1, 57, 23, -1, 57, 24, 33, 21, | ||
509 | 34, 59, 34, 59, 35, -1, 57, 24, 33, 21, | ||
510 | 35, -1, 56, 22, -1, -1, 56, 34, -1, 57, | ||
511 | 22, -1, 13, 17, 36, -1, 36, -1, 58, 59, | ||
512 | -1, 58, 23, -1, 58, 22, -1, 17, -1, 18, | ||
513 | -1, 33, 60, 35, -1, 61, -1, 62, -1, 62, | ||
514 | 37, 60, 38, 61, -1, 63, -1, 62, 12, 63, | ||
515 | -1, 64, -1, 63, 11, 64, -1, 65, -1, 64, | ||
516 | 39, 65, -1, 66, -1, 65, 40, 66, -1, 67, | ||
517 | -1, 66, 41, 67, -1, 68, -1, 67, 9, 68, | ||
518 | -1, 67, 10, 68, -1, 69, -1, 68, 36, 69, | ||
519 | -1, 68, 30, 69, -1, 68, 7, 69, -1, 68, | ||
520 | 8, 69, -1, 69, 5, 70, -1, 69, 6, 70, | ||
521 | -1, 70, -1, 70, 42, 71, -1, 70, 43, 71, | ||
522 | -1, 71, -1, 71, 44, 72, -1, 71, 26, 72, | ||
523 | -1, 71, 45, 72, -1, 72, -1, 59, -1, 43, | ||
524 | 72, -1, 46, 72, -1, 47, 72, -1, -1, 73, | ||
525 | 20, -1, 73, 22, -1, -1, 75, 74, -1, 75, | ||
526 | 55, -1, 16, 53, -1, 15, 16, 25, -1, 22, | ||
527 | 75, -1 | ||
528 | }; | ||
529 | |||
530 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | ||
531 | static const yytype_uint16 yyrline[] = | 494 | static const yytype_uint16 yyrline[] = |
532 | { | 495 | { |
533 | 0, 109, 109, 118, 121, 128, 132, 140, 144, 148, | 496 | 0, 104, 104, 113, 116, 123, 127, 135, 139, 144, |
534 | 158, 172, 180, 183, 190, 194, 198, 202, 210, 214, | 497 | 155, 165, 180, 188, 191, 198, 202, 206, 210, 218, |
535 | 218, 222, 226, 243, 253, 261, 264, 268, 275, 290, | 498 | 222, 226, 230, 234, 250, 260, 268, 271, 275, 282, |
536 | 295, 315, 329, 336, 340, 344, 351, 355, 356, 360, | 499 | 298, 303, 322, 336, 343, 344, 345, 352, 356, 357, |
537 | 361, 365, 366, 370, 371, 375, 376, 380, 381, 385, | 500 | 361, 362, 366, 367, 371, 372, 376, 377, 381, 382, |
538 | 386, 387, 391, 392, 393, 394, 395, 399, 400, 401, | 501 | 386, 387, 388, 392, 393, 394, 395, 396, 400, 401, |
539 | 405, 406, 407, 411, 412, 413, 414, 418, 419, 420, | 502 | 402, 406, 407, 408, 412, 413, 414, 415, 419, 420, |
540 | 421, 426, 429, 433, 441, 444, 448, 456, 460, 464 | 503 | 421, 422, 427, 430, 434, 442, 445, 449, 457, 461, |
504 | 465 | ||
541 | }; | 505 | }; |
542 | #endif | 506 | #endif |
543 | 507 | ||
@@ -549,209 +513,199 @@ static const char *const yytname[] = | |||
549 | "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT", | 513 | "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT", |
550 | "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR", | 514 | "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR", |
551 | "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL", | 515 | "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL", |
552 | "DT_CHAR_LITERAL", "DT_BASE", "DT_BYTE", "DT_STRING", "DT_LABEL", | 516 | "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", |
553 | "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", | 517 | "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", "']'", |
554 | "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", | 518 | "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", "'+'", |
555 | "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", | 519 | "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", |
556 | "memreserves", "memreserve", "devicetree", "nodedef", "proplist", | 520 | "memreserves", "memreserve", "devicetree", "nodedef", "proplist", |
557 | "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim", | 521 | "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim", |
558 | "integer_expr", "integer_trinary", "integer_or", "integer_and", | 522 | "integer_expr", "integer_trinary", "integer_or", "integer_and", |
559 | "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq", | 523 | "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq", |
560 | "integer_rela", "integer_shift", "integer_add", "integer_mul", | 524 | "integer_rela", "integer_shift", "integer_add", "integer_mul", |
561 | "integer_unary", "bytestring", "subnodes", "subnode", YY_NULL | 525 | "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR |
562 | }; | 526 | }; |
563 | #endif | 527 | #endif |
564 | 528 | ||
565 | # ifdef YYPRINT | 529 | # ifdef YYPRINT |
566 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to | 530 | /* YYTOKNUM[NUM] -- (External) token number corresponding to the |
567 | token YYLEX-NUM. */ | 531 | (internal) symbol number NUM (which must be that of a token). */ |
568 | static const yytype_uint16 yytoknum[] = | 532 | static const yytype_uint16 yytoknum[] = |
569 | { | 533 | { |
570 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | 534 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
571 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | 535 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
572 | 275, 276, 277, 278, 279, 59, 47, 123, 125, 61, | 536 | 275, 276, 277, 278, 59, 47, 123, 125, 61, 62, |
573 | 62, 91, 93, 40, 44, 41, 60, 63, 58, 124, | 537 | 91, 93, 40, 44, 41, 60, 63, 58, 124, 94, |
574 | 94, 38, 43, 45, 42, 37, 126, 33 | 538 | 38, 43, 45, 42, 37, 126, 33 |
575 | }; | 539 | }; |
576 | # endif | 540 | # endif |
577 | 541 | ||
578 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | 542 | #define YYPACT_NINF -81 |
579 | static const yytype_uint8 yyr1[] = | ||
580 | { | ||
581 | 0, 48, 49, 50, 50, 51, 51, 52, 52, 52, | ||
582 | 52, 53, 54, 54, 55, 55, 55, 55, 56, 56, | ||
583 | 56, 56, 56, 56, 56, 57, 57, 57, 58, 58, | ||
584 | 58, 58, 58, 59, 59, 59, 60, 61, 61, 62, | ||
585 | 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, | ||
586 | 67, 67, 68, 68, 68, 68, 68, 69, 69, 69, | ||
587 | 70, 70, 70, 71, 71, 71, 71, 72, 72, 72, | ||
588 | 72, 73, 73, 73, 74, 74, 74, 75, 75, 75 | ||
589 | }; | ||
590 | 543 | ||
591 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | 544 | #define yypact_value_is_default(Yystate) \ |
592 | static const yytype_uint8 yyr2[] = | 545 | (!!((Yystate) == (-81))) |
546 | |||
547 | #define YYTABLE_NINF -1 | ||
548 | |||
549 | #define yytable_value_is_error(Yytable_value) \ | ||
550 | 0 | ||
551 | |||
552 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | ||
553 | STATE-NUM. */ | ||
554 | static const yytype_int8 yypact[] = | ||
593 | { | 555 | { |
594 | 0, 2, 4, 0, 2, 4, 2, 2, 3, 3, | 556 | 16, -11, 21, 10, -81, 25, 10, 19, 10, -81, |
595 | 4, 5, 0, 2, 4, 2, 3, 2, 2, 3, | 557 | -81, -9, 25, -81, 2, 51, -81, -9, -9, -9, |
596 | 4, 2, 9, 5, 2, 0, 2, 2, 3, 1, | 558 | -81, 1, -81, -6, 50, 14, 28, 29, 36, 3, |
597 | 2, 2, 2, 1, 1, 3, 1, 1, 5, 1, | 559 | 58, 44, -3, -81, 47, -81, -81, 65, 68, 2, |
598 | 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, | 560 | 2, -81, -81, -81, -81, -9, -9, -9, -9, -9, |
599 | 3, 3, 1, 3, 3, 3, 3, 3, 3, 1, | 561 | -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, |
600 | 3, 3, 1, 3, 3, 3, 1, 1, 2, 2, | 562 | -9, -9, -9, -9, -81, 63, 69, 2, -81, -81, |
601 | 2, 0, 2, 2, 0, 2, 2, 2, 3, 2 | 563 | 50, 57, 14, 28, 29, 36, 3, 3, 58, 58, |
564 | 58, 58, 44, 44, -3, -3, -81, -81, -81, 79, | ||
565 | 80, -8, 63, -81, 72, 63, -81, -81, -9, 76, | ||
566 | 77, -81, -81, -81, -81, -81, 78, -81, -81, -81, | ||
567 | -81, -81, 35, 4, -81, -81, -81, -81, 86, -81, | ||
568 | -81, -81, 73, -81, -81, 33, 71, 84, 39, -81, | ||
569 | -81, -81, -81, -81, 41, -81, -81, -81, 25, -81, | ||
570 | 74, 25, 75, -81 | ||
602 | }; | 571 | }; |
603 | 572 | ||
604 | /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. | 573 | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
605 | Performed when YYTABLE doesn't specify something else to do. Zero | 574 | Performed when YYTABLE does not specify something else to do. Zero |
606 | means the default is an error. */ | 575 | means the default is an error. */ |
607 | static const yytype_uint8 yydefact[] = | 576 | static const yytype_uint8 yydefact[] = |
608 | { | 577 | { |
609 | 0, 0, 0, 3, 1, 0, 0, 0, 3, 33, | 578 | 0, 0, 0, 3, 1, 0, 0, 0, 3, 34, |
610 | 34, 0, 0, 6, 0, 2, 4, 0, 0, 0, | 579 | 35, 0, 0, 6, 0, 2, 4, 0, 0, 0, |
611 | 67, 0, 36, 37, 39, 41, 43, 45, 47, 49, | 580 | 68, 0, 37, 38, 40, 42, 44, 46, 48, 50, |
612 | 52, 59, 62, 66, 0, 12, 7, 0, 0, 0, | 581 | 53, 60, 63, 67, 0, 13, 7, 0, 0, 0, |
613 | 68, 69, 70, 35, 0, 0, 0, 0, 0, 0, | 582 | 0, 69, 70, 71, 36, 0, 0, 0, 0, 0, |
614 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 583 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
615 | 0, 0, 0, 5, 74, 0, 9, 8, 40, 0, | 584 | 0, 0, 0, 0, 5, 75, 0, 0, 10, 8, |
616 | 42, 44, 46, 48, 50, 51, 55, 56, 54, 53, | 585 | 41, 0, 43, 45, 47, 49, 51, 52, 56, 57, |
617 | 57, 58, 60, 61, 64, 63, 65, 0, 0, 0, | 586 | 55, 54, 58, 59, 61, 62, 65, 64, 66, 0, |
618 | 0, 13, 0, 74, 10, 0, 0, 0, 15, 25, | 587 | 0, 0, 0, 14, 0, 75, 11, 9, 0, 0, |
619 | 77, 17, 79, 0, 76, 75, 38, 16, 78, 0, | 588 | 0, 16, 26, 78, 18, 80, 0, 77, 76, 39, |
620 | 0, 11, 24, 14, 26, 0, 18, 27, 21, 0, | 589 | 17, 79, 0, 0, 12, 25, 15, 27, 0, 19, |
621 | 71, 29, 0, 0, 0, 0, 32, 31, 19, 30, | 590 | 28, 22, 0, 72, 30, 0, 0, 0, 0, 33, |
622 | 28, 0, 72, 73, 20, 0, 23, 0, 0, 0, | 591 | 32, 20, 31, 29, 0, 73, 74, 21, 0, 24, |
623 | 22 | 592 | 0, 0, 0, 23 |
624 | }; | 593 | }; |
625 | 594 | ||
626 | /* YYDEFGOTO[NTERM-NUM]. */ | 595 | /* YYPGOTO[NTERM-NUM]. */ |
627 | static const yytype_int8 yydefgoto[] = | 596 | static const yytype_int8 yypgoto[] = |
628 | { | 597 | { |
629 | -1, 2, 7, 8, 15, 36, 64, 91, 109, 110, | 598 | -81, -81, 100, 104, -81, -38, -81, -80, -81, -81, |
630 | 122, 20, 21, 22, 23, 24, 25, 26, 27, 28, | 599 | -81, -5, 66, 13, -81, 70, 67, 81, 64, 82, |
631 | 29, 30, 31, 32, 33, 125, 92, 93 | 600 | 37, 27, 34, 38, -14, -81, 22, 24 |
632 | }; | 601 | }; |
633 | 602 | ||
634 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | 603 | /* YYDEFGOTO[NTERM-NUM]. */ |
635 | STATE-NUM. */ | 604 | static const yytype_int16 yydefgoto[] = |
636 | #define YYPACT_NINF -78 | ||
637 | static const yytype_int8 yypact[] = | ||
638 | { | 605 | { |
639 | 22, 11, 51, 10, -78, 23, 10, 2, 10, -78, | 606 | -1, 2, 7, 8, 15, 36, 65, 93, 112, 113, |
640 | -78, -9, 23, -78, 30, 38, -78, -9, -9, -9, | 607 | 125, 20, 21, 22, 23, 24, 25, 26, 27, 28, |
641 | -78, 35, -78, -6, 52, 29, 48, 49, 33, 3, | 608 | 29, 30, 31, 32, 33, 128, 94, 95 |
642 | 71, 36, 0, -78, 64, -78, -78, 68, 30, 30, | ||
643 | -78, -78, -78, -78, -9, -9, -9, -9, -9, -9, | ||
644 | -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, | ||
645 | -9, -9, -9, -78, 44, 67, -78, -78, 52, 55, | ||
646 | 29, 48, 49, 33, 3, 3, 71, 71, 71, 71, | ||
647 | 36, 36, 0, 0, -78, -78, -78, 78, 79, 42, | ||
648 | 44, -78, 69, 44, -78, -9, 73, 74, -78, -78, | ||
649 | -78, -78, -78, 75, -78, -78, -78, -78, -78, -7, | ||
650 | -1, -78, -78, -78, -78, 84, -78, -78, -78, 63, | ||
651 | -78, -78, 32, 66, 82, -3, -78, -78, -78, -78, | ||
652 | -78, 46, -78, -78, -78, 23, -78, 70, 23, 72, | ||
653 | -78 | ||
654 | }; | 609 | }; |
655 | 610 | ||
656 | /* YYPGOTO[NTERM-NUM]. */ | 611 | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
657 | static const yytype_int8 yypgoto[] = | 612 | positive, shift that token. If negative, reduce the rule whose |
613 | number is the opposite. If YYTABLE_NINF, syntax error. */ | ||
614 | static const yytype_uint8 yytable[] = | ||
658 | { | 615 | { |
659 | -78, -78, 97, 100, -78, -37, -78, -77, -78, -78, | 616 | 12, 68, 69, 41, 42, 43, 45, 34, 9, 10, |
660 | -78, -5, 65, 13, -78, 76, 77, 62, 80, 83, | 617 | 53, 54, 104, 3, 5, 107, 101, 118, 35, 1, |
661 | 34, 20, 26, 28, -14, -78, 18, 24 | 618 | 102, 4, 61, 11, 119, 120, 121, 122, 35, 97, |
619 | 46, 6, 55, 17, 123, 44, 18, 19, 56, 124, | ||
620 | 62, 63, 9, 10, 14, 51, 52, 86, 87, 88, | ||
621 | 9, 10, 48, 103, 129, 130, 115, 11, 135, 116, | ||
622 | 136, 47, 131, 57, 58, 11, 37, 49, 117, 50, | ||
623 | 137, 64, 38, 39, 138, 139, 40, 89, 90, 91, | ||
624 | 78, 79, 80, 81, 92, 59, 60, 66, 76, 77, | ||
625 | 67, 82, 83, 96, 98, 99, 100, 84, 85, 106, | ||
626 | 110, 111, 114, 126, 134, 127, 133, 141, 16, 143, | ||
627 | 13, 109, 71, 74, 72, 70, 105, 108, 0, 0, | ||
628 | 132, 0, 0, 0, 0, 0, 0, 0, 0, 73, | ||
629 | 0, 0, 75, 140, 0, 0, 142 | ||
662 | }; | 630 | }; |
663 | 631 | ||
664 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | 632 | static const yytype_int16 yycheck[] = |
665 | positive, shift that token. If negative, reduce the rule which | ||
666 | number is the opposite. If YYTABLE_NINF, syntax error. */ | ||
667 | #define YYTABLE_NINF -1 | ||
668 | static const yytype_uint8 yytable[] = | ||
669 | { | 633 | { |
670 | 12, 66, 67, 40, 41, 42, 44, 34, 9, 10, | 634 | 5, 39, 40, 17, 18, 19, 12, 12, 17, 18, |
671 | 52, 53, 115, 101, 5, 112, 104, 132, 113, 133, | 635 | 7, 8, 92, 24, 4, 95, 24, 13, 26, 3, |
672 | 116, 117, 118, 119, 11, 1, 60, 114, 14, 134, | 636 | 28, 0, 25, 32, 20, 21, 22, 23, 26, 67, |
673 | 120, 45, 6, 54, 17, 121, 3, 18, 19, 55, | 637 | 36, 21, 29, 42, 30, 34, 45, 46, 35, 35, |
674 | 9, 10, 50, 51, 61, 62, 84, 85, 86, 9, | 638 | 43, 44, 17, 18, 25, 9, 10, 61, 62, 63, |
675 | 10, 4, 100, 37, 126, 127, 11, 35, 87, 88, | 639 | 17, 18, 38, 91, 21, 22, 21, 32, 19, 24, |
676 | 89, 38, 128, 46, 39, 11, 90, 98, 47, 35, | 640 | 21, 11, 29, 5, 6, 32, 15, 39, 33, 40, |
677 | 43, 99, 76, 77, 78, 79, 56, 57, 58, 59, | 641 | 31, 24, 21, 22, 33, 34, 25, 14, 15, 16, |
678 | 135, 136, 80, 81, 74, 75, 82, 83, 48, 63, | 642 | 53, 54, 55, 56, 21, 41, 42, 22, 51, 52, |
679 | 49, 65, 94, 95, 96, 97, 124, 103, 107, 108, | 643 | 22, 57, 58, 24, 37, 16, 16, 59, 60, 27, |
680 | 111, 123, 130, 131, 138, 16, 13, 140, 106, 71, | 644 | 24, 24, 24, 17, 20, 32, 35, 33, 8, 34, |
681 | 69, 105, 0, 0, 102, 0, 0, 129, 0, 0, | 645 | 6, 98, 46, 49, 47, 45, 92, 95, -1, -1, |
682 | 68, 0, 0, 70, 0, 0, 0, 0, 72, 0, | 646 | 125, -1, -1, -1, -1, -1, -1, -1, -1, 48, |
683 | 137, 0, 73, 139 | 647 | -1, -1, 50, 138, -1, -1, 141 |
684 | }; | 648 | }; |
685 | 649 | ||
686 | #define yypact_value_is_default(Yystate) \ | 650 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
687 | (!!((Yystate) == (-78))) | 651 | symbol of state STATE-NUM. */ |
688 | 652 | static const yytype_uint8 yystos[] = | |
689 | #define yytable_value_is_error(Yytable_value) \ | 653 | { |
690 | YYID (0) | 654 | 0, 3, 48, 24, 0, 4, 21, 49, 50, 17, |
655 | 18, 32, 58, 50, 25, 51, 49, 42, 45, 46, | ||
656 | 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, | ||
657 | 68, 69, 70, 71, 58, 26, 52, 15, 21, 22, | ||
658 | 25, 71, 71, 71, 34, 12, 36, 11, 38, 39, | ||
659 | 40, 9, 10, 7, 8, 29, 35, 5, 6, 41, | ||
660 | 42, 25, 43, 44, 24, 53, 22, 22, 52, 52, | ||
661 | 62, 59, 63, 64, 65, 66, 67, 67, 68, 68, | ||
662 | 68, 68, 69, 69, 70, 70, 71, 71, 71, 14, | ||
663 | 15, 16, 21, 54, 73, 74, 24, 52, 37, 16, | ||
664 | 16, 24, 28, 52, 54, 74, 27, 54, 73, 60, | ||
665 | 24, 24, 55, 56, 24, 21, 24, 33, 13, 20, | ||
666 | 21, 22, 23, 30, 35, 57, 17, 32, 72, 21, | ||
667 | 22, 29, 58, 35, 20, 19, 21, 31, 33, 34, | ||
668 | 58, 33, 58, 34 | ||
669 | }; | ||
691 | 670 | ||
692 | static const yytype_int16 yycheck[] = | 671 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
672 | static const yytype_uint8 yyr1[] = | ||
693 | { | 673 | { |
694 | 5, 38, 39, 17, 18, 19, 12, 12, 17, 18, | 674 | 0, 47, 48, 49, 49, 50, 50, 51, 51, 51, |
695 | 7, 8, 13, 90, 4, 22, 93, 20, 25, 22, | 675 | 51, 51, 52, 53, 53, 54, 54, 54, 54, 55, |
696 | 21, 22, 23, 24, 33, 3, 26, 34, 26, 32, | 676 | 55, 55, 55, 55, 55, 55, 56, 56, 56, 57, |
697 | 31, 37, 22, 30, 43, 36, 25, 46, 47, 36, | 677 | 57, 57, 57, 57, 58, 58, 58, 59, 60, 60, |
698 | 17, 18, 9, 10, 44, 45, 60, 61, 62, 17, | 678 | 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, |
699 | 18, 0, 89, 15, 22, 23, 33, 27, 14, 15, | 679 | 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, |
700 | 16, 23, 30, 11, 26, 33, 22, 25, 39, 27, | 680 | 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, |
701 | 35, 29, 52, 53, 54, 55, 5, 6, 42, 43, | 681 | 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, |
702 | 34, 35, 56, 57, 50, 51, 58, 59, 40, 25, | 682 | 74 |
703 | 41, 23, 25, 38, 16, 16, 33, 28, 25, 25, | ||
704 | 25, 17, 36, 21, 34, 8, 6, 35, 95, 47, | ||
705 | 45, 93, -1, -1, 90, -1, -1, 122, -1, -1, | ||
706 | 44, -1, -1, 46, -1, -1, -1, -1, 48, -1, | ||
707 | 135, -1, 49, 138 | ||
708 | }; | 683 | }; |
709 | 684 | ||
710 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | 685 | /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ |
711 | symbol of state STATE-NUM. */ | 686 | static const yytype_uint8 yyr2[] = |
712 | static const yytype_uint8 yystos[] = | ||
713 | { | 687 | { |
714 | 0, 3, 49, 25, 0, 4, 22, 50, 51, 17, | 688 | 0, 2, 4, 0, 2, 4, 2, 2, 3, 4, |
715 | 18, 33, 59, 51, 26, 52, 50, 43, 46, 47, | 689 | 3, 4, 5, 0, 2, 4, 2, 3, 2, 2, |
716 | 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, | 690 | 3, 4, 2, 9, 5, 2, 0, 2, 2, 3, |
717 | 69, 70, 71, 72, 59, 27, 53, 15, 23, 26, | 691 | 1, 2, 2, 2, 1, 1, 3, 1, 1, 5, |
718 | 72, 72, 72, 35, 12, 37, 11, 39, 40, 41, | 692 | 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, |
719 | 9, 10, 7, 8, 30, 36, 5, 6, 42, 43, | 693 | 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, |
720 | 26, 44, 45, 25, 54, 23, 53, 53, 63, 60, | 694 | 1, 3, 3, 1, 3, 3, 3, 1, 1, 2, |
721 | 64, 65, 66, 67, 68, 68, 69, 69, 69, 69, | 695 | 2, 2, 0, 2, 2, 0, 2, 2, 2, 3, |
722 | 70, 70, 71, 71, 72, 72, 72, 14, 15, 16, | 696 | 2 |
723 | 22, 55, 74, 75, 25, 38, 16, 16, 25, 29, | ||
724 | 53, 55, 75, 28, 55, 74, 61, 25, 25, 56, | ||
725 | 57, 25, 22, 25, 34, 13, 21, 22, 23, 24, | ||
726 | 31, 36, 58, 17, 33, 73, 22, 23, 30, 59, | ||
727 | 36, 21, 20, 22, 32, 34, 35, 59, 34, 59, | ||
728 | 35 | ||
729 | }; | 697 | }; |
730 | 698 | ||
731 | #define yyerrok (yyerrstatus = 0) | 699 | |
732 | #define yyclearin (yychar = YYEMPTY) | 700 | #define yyerrok (yyerrstatus = 0) |
733 | #define YYEMPTY (-2) | 701 | #define yyclearin (yychar = YYEMPTY) |
734 | #define YYEOF 0 | 702 | #define YYEMPTY (-2) |
735 | 703 | #define YYEOF 0 | |
736 | #define YYACCEPT goto yyacceptlab | 704 | |
737 | #define YYABORT goto yyabortlab | 705 | #define YYACCEPT goto yyacceptlab |
738 | #define YYERROR goto yyerrorlab | 706 | #define YYABORT goto yyabortlab |
739 | 707 | #define YYERROR goto yyerrorlab | |
740 | 708 | ||
741 | /* Like YYERROR except do call yyerror. This remains here temporarily | ||
742 | to ease the transition to the new meaning of YYERROR, for GCC. | ||
743 | Once GCC version 2 has supplanted version 1, this can go. However, | ||
744 | YYFAIL appears to be in use. Nevertheless, it is formally deprecated | ||
745 | in Bison 2.4.2's NEWS entry, where a plan to phase it out is | ||
746 | discussed. */ | ||
747 | |||
748 | #define YYFAIL goto yyerrlab | ||
749 | #if defined YYFAIL | ||
750 | /* This is here to suppress warnings from the GCC cpp's | ||
751 | -Wunused-macros. Normally we don't worry about that warning, but | ||
752 | some users do, and we want to make it easy for users to remove | ||
753 | YYFAIL uses, which will produce warnings from Bison 2.5. */ | ||
754 | #endif | ||
755 | 709 | ||
756 | #define YYRECOVERING() (!!yyerrstatus) | 710 | #define YYRECOVERING() (!!yyerrstatus) |
757 | 711 | ||
@@ -768,27 +722,41 @@ do \ | |||
768 | else \ | 722 | else \ |
769 | { \ | 723 | { \ |
770 | yyerror (YY_("syntax error: cannot back up")); \ | 724 | yyerror (YY_("syntax error: cannot back up")); \ |
771 | YYERROR; \ | 725 | YYERROR; \ |
772 | } \ | 726 | } \ |
773 | while (YYID (0)) | 727 | while (0) |
774 | 728 | ||
775 | /* Error token number */ | 729 | /* Error token number */ |
776 | #define YYTERROR 1 | 730 | #define YYTERROR 1 |
777 | #define YYERRCODE 256 | 731 | #define YYERRCODE 256 |
778 | 732 | ||
779 | 733 | ||
780 | /* This macro is provided for backward compatibility. */ | 734 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
781 | #ifndef YY_LOCATION_PRINT | 735 | If N is 0, then set CURRENT to the empty location which ends |
782 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | 736 | the previous symbol: RHS[0] (always defined). */ |
737 | |||
738 | #ifndef YYLLOC_DEFAULT | ||
739 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ | ||
740 | do \ | ||
741 | if (N) \ | ||
742 | { \ | ||
743 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ | ||
744 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ | ||
745 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ | ||
746 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ | ||
747 | } \ | ||
748 | else \ | ||
749 | { \ | ||
750 | (Current).first_line = (Current).last_line = \ | ||
751 | YYRHSLOC (Rhs, 0).last_line; \ | ||
752 | (Current).first_column = (Current).last_column = \ | ||
753 | YYRHSLOC (Rhs, 0).last_column; \ | ||
754 | } \ | ||
755 | while (0) | ||
783 | #endif | 756 | #endif |
784 | 757 | ||
758 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) | ||
785 | 759 | ||
786 | /* YYLEX -- calling `yylex' with the right arguments. */ | ||
787 | #ifdef YYLEX_PARAM | ||
788 | # define YYLEX yylex (YYLEX_PARAM) | ||
789 | #else | ||
790 | # define YYLEX yylex () | ||
791 | #endif | ||
792 | 760 | ||
793 | /* Enable debugging if requested. */ | 761 | /* Enable debugging if requested. */ |
794 | #if YYDEBUG | 762 | #if YYDEBUG |
@@ -798,50 +766,84 @@ while (YYID (0)) | |||
798 | # define YYFPRINTF fprintf | 766 | # define YYFPRINTF fprintf |
799 | # endif | 767 | # endif |
800 | 768 | ||
801 | # define YYDPRINTF(Args) \ | 769 | # define YYDPRINTF(Args) \ |
802 | do { \ | 770 | do { \ |
803 | if (yydebug) \ | 771 | if (yydebug) \ |
804 | YYFPRINTF Args; \ | 772 | YYFPRINTF Args; \ |
805 | } while (YYID (0)) | 773 | } while (0) |
806 | 774 | ||
807 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ | ||
808 | do { \ | ||
809 | if (yydebug) \ | ||
810 | { \ | ||
811 | YYFPRINTF (stderr, "%s ", Title); \ | ||
812 | yy_symbol_print (stderr, \ | ||
813 | Type, Value); \ | ||
814 | YYFPRINTF (stderr, "\n"); \ | ||
815 | } \ | ||
816 | } while (YYID (0)) | ||
817 | 775 | ||
776 | /* YY_LOCATION_PRINT -- Print the location on the stream. | ||
777 | This macro was not mandated originally: define only if we know | ||
778 | we won't break user code: when these are the locations we know. */ | ||
818 | 779 | ||
819 | /*--------------------------------. | 780 | #ifndef YY_LOCATION_PRINT |
820 | | Print this symbol on YYOUTPUT. | | 781 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL |
821 | `--------------------------------*/ | ||
822 | 782 | ||
823 | /*ARGSUSED*/ | 783 | /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ |
824 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 784 | |
825 | || defined __cplusplus || defined _MSC_VER) | 785 | YY_ATTRIBUTE_UNUSED |
826 | static void | 786 | static unsigned |
827 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) | 787 | yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) |
828 | #else | 788 | { |
829 | static void | 789 | unsigned res = 0; |
830 | yy_symbol_value_print (yyoutput, yytype, yyvaluep) | 790 | int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; |
831 | FILE *yyoutput; | 791 | if (0 <= yylocp->first_line) |
832 | int yytype; | 792 | { |
833 | YYSTYPE const * const yyvaluep; | 793 | res += YYFPRINTF (yyo, "%d", yylocp->first_line); |
794 | if (0 <= yylocp->first_column) | ||
795 | res += YYFPRINTF (yyo, ".%d", yylocp->first_column); | ||
796 | } | ||
797 | if (0 <= yylocp->last_line) | ||
798 | { | ||
799 | if (yylocp->first_line < yylocp->last_line) | ||
800 | { | ||
801 | res += YYFPRINTF (yyo, "-%d", yylocp->last_line); | ||
802 | if (0 <= end_col) | ||
803 | res += YYFPRINTF (yyo, ".%d", end_col); | ||
804 | } | ||
805 | else if (0 <= end_col && yylocp->first_column < end_col) | ||
806 | res += YYFPRINTF (yyo, "-%d", end_col); | ||
807 | } | ||
808 | return res; | ||
809 | } | ||
810 | |||
811 | # define YY_LOCATION_PRINT(File, Loc) \ | ||
812 | yy_location_print_ (File, &(Loc)) | ||
813 | |||
814 | # else | ||
815 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | ||
816 | # endif | ||
834 | #endif | 817 | #endif |
818 | |||
819 | |||
820 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ | ||
821 | do { \ | ||
822 | if (yydebug) \ | ||
823 | { \ | ||
824 | YYFPRINTF (stderr, "%s ", Title); \ | ||
825 | yy_symbol_print (stderr, \ | ||
826 | Type, Value, Location); \ | ||
827 | YYFPRINTF (stderr, "\n"); \ | ||
828 | } \ | ||
829 | } while (0) | ||
830 | |||
831 | |||
832 | /*----------------------------------------. | ||
833 | | Print this symbol's value on YYOUTPUT. | | ||
834 | `----------------------------------------*/ | ||
835 | |||
836 | static void | ||
837 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) | ||
835 | { | 838 | { |
836 | FILE *yyo = yyoutput; | 839 | FILE *yyo = yyoutput; |
837 | YYUSE (yyo); | 840 | YYUSE (yyo); |
841 | YYUSE (yylocationp); | ||
838 | if (!yyvaluep) | 842 | if (!yyvaluep) |
839 | return; | 843 | return; |
840 | # ifdef YYPRINT | 844 | # ifdef YYPRINT |
841 | if (yytype < YYNTOKENS) | 845 | if (yytype < YYNTOKENS) |
842 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | 846 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
843 | # else | ||
844 | YYUSE (yyoutput); | ||
845 | # endif | 847 | # endif |
846 | YYUSE (yytype); | 848 | YYUSE (yytype); |
847 | } | 849 | } |
@@ -851,24 +853,15 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) | |||
851 | | Print this symbol on YYOUTPUT. | | 853 | | Print this symbol on YYOUTPUT. | |
852 | `--------------------------------*/ | 854 | `--------------------------------*/ |
853 | 855 | ||
854 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
855 | || defined __cplusplus || defined _MSC_VER) | ||
856 | static void | ||
857 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) | ||
858 | #else | ||
859 | static void | 856 | static void |
860 | yy_symbol_print (yyoutput, yytype, yyvaluep) | 857 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) |
861 | FILE *yyoutput; | ||
862 | int yytype; | ||
863 | YYSTYPE const * const yyvaluep; | ||
864 | #endif | ||
865 | { | 858 | { |
866 | if (yytype < YYNTOKENS) | 859 | YYFPRINTF (yyoutput, "%s %s (", |
867 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); | 860 | yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); |
868 | else | ||
869 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); | ||
870 | 861 | ||
871 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); | 862 | YY_LOCATION_PRINT (yyoutput, *yylocationp); |
863 | YYFPRINTF (yyoutput, ": "); | ||
864 | yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); | ||
872 | YYFPRINTF (yyoutput, ")"); | 865 | YYFPRINTF (yyoutput, ")"); |
873 | } | 866 | } |
874 | 867 | ||
@@ -877,16 +870,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) | |||
877 | | TOP (included). | | 870 | | TOP (included). | |
878 | `------------------------------------------------------------------*/ | 871 | `------------------------------------------------------------------*/ |
879 | 872 | ||
880 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
881 | || defined __cplusplus || defined _MSC_VER) | ||
882 | static void | 873 | static void |
883 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) | 874 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) |
884 | #else | ||
885 | static void | ||
886 | yy_stack_print (yybottom, yytop) | ||
887 | yytype_int16 *yybottom; | ||
888 | yytype_int16 *yytop; | ||
889 | #endif | ||
890 | { | 875 | { |
891 | YYFPRINTF (stderr, "Stack now"); | 876 | YYFPRINTF (stderr, "Stack now"); |
892 | for (; yybottom <= yytop; yybottom++) | 877 | for (; yybottom <= yytop; yybottom++) |
@@ -897,49 +882,42 @@ yy_stack_print (yybottom, yytop) | |||
897 | YYFPRINTF (stderr, "\n"); | 882 | YYFPRINTF (stderr, "\n"); |
898 | } | 883 | } |
899 | 884 | ||
900 | # define YY_STACK_PRINT(Bottom, Top) \ | 885 | # define YY_STACK_PRINT(Bottom, Top) \ |
901 | do { \ | 886 | do { \ |
902 | if (yydebug) \ | 887 | if (yydebug) \ |
903 | yy_stack_print ((Bottom), (Top)); \ | 888 | yy_stack_print ((Bottom), (Top)); \ |
904 | } while (YYID (0)) | 889 | } while (0) |
905 | 890 | ||
906 | 891 | ||
907 | /*------------------------------------------------. | 892 | /*------------------------------------------------. |
908 | | Report that the YYRULE is going to be reduced. | | 893 | | Report that the YYRULE is going to be reduced. | |
909 | `------------------------------------------------*/ | 894 | `------------------------------------------------*/ |
910 | 895 | ||
911 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
912 | || defined __cplusplus || defined _MSC_VER) | ||
913 | static void | ||
914 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule) | ||
915 | #else | ||
916 | static void | 896 | static void |
917 | yy_reduce_print (yyvsp, yyrule) | 897 | yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) |
918 | YYSTYPE *yyvsp; | ||
919 | int yyrule; | ||
920 | #endif | ||
921 | { | 898 | { |
899 | unsigned long int yylno = yyrline[yyrule]; | ||
922 | int yynrhs = yyr2[yyrule]; | 900 | int yynrhs = yyr2[yyrule]; |
923 | int yyi; | 901 | int yyi; |
924 | unsigned long int yylno = yyrline[yyrule]; | ||
925 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", | 902 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", |
926 | yyrule - 1, yylno); | 903 | yyrule - 1, yylno); |
927 | /* The symbols being reduced. */ | 904 | /* The symbols being reduced. */ |
928 | for (yyi = 0; yyi < yynrhs; yyi++) | 905 | for (yyi = 0; yyi < yynrhs; yyi++) |
929 | { | 906 | { |
930 | YYFPRINTF (stderr, " $%d = ", yyi + 1); | 907 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
931 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], | 908 | yy_symbol_print (stderr, |
932 | &(yyvsp[(yyi + 1) - (yynrhs)]) | 909 | yystos[yyssp[yyi + 1 - yynrhs]], |
933 | ); | 910 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
911 | , &(yylsp[(yyi + 1) - (yynrhs)]) ); | ||
934 | YYFPRINTF (stderr, "\n"); | 912 | YYFPRINTF (stderr, "\n"); |
935 | } | 913 | } |
936 | } | 914 | } |
937 | 915 | ||
938 | # define YY_REDUCE_PRINT(Rule) \ | 916 | # define YY_REDUCE_PRINT(Rule) \ |
939 | do { \ | 917 | do { \ |
940 | if (yydebug) \ | 918 | if (yydebug) \ |
941 | yy_reduce_print (yyvsp, Rule); \ | 919 | yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \ |
942 | } while (YYID (0)) | 920 | } while (0) |
943 | 921 | ||
944 | /* Nonzero means print parse trace. It is left uninitialized so that | 922 | /* Nonzero means print parse trace. It is left uninitialized so that |
945 | multiple parsers can coexist. */ | 923 | multiple parsers can coexist. */ |
@@ -953,7 +931,7 @@ int yydebug; | |||
953 | 931 | ||
954 | 932 | ||
955 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | 933 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
956 | #ifndef YYINITDEPTH | 934 | #ifndef YYINITDEPTH |
957 | # define YYINITDEPTH 200 | 935 | # define YYINITDEPTH 200 |
958 | #endif | 936 | #endif |
959 | 937 | ||
@@ -976,15 +954,8 @@ int yydebug; | |||
976 | # define yystrlen strlen | 954 | # define yystrlen strlen |
977 | # else | 955 | # else |
978 | /* Return the length of YYSTR. */ | 956 | /* Return the length of YYSTR. */ |
979 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
980 | || defined __cplusplus || defined _MSC_VER) | ||
981 | static YYSIZE_T | 957 | static YYSIZE_T |
982 | yystrlen (const char *yystr) | 958 | yystrlen (const char *yystr) |
983 | #else | ||
984 | static YYSIZE_T | ||
985 | yystrlen (yystr) | ||
986 | const char *yystr; | ||
987 | #endif | ||
988 | { | 959 | { |
989 | YYSIZE_T yylen; | 960 | YYSIZE_T yylen; |
990 | for (yylen = 0; yystr[yylen]; yylen++) | 961 | for (yylen = 0; yystr[yylen]; yylen++) |
@@ -1000,16 +971,8 @@ yystrlen (yystr) | |||
1000 | # else | 971 | # else |
1001 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | 972 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
1002 | YYDEST. */ | 973 | YYDEST. */ |
1003 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
1004 | || defined __cplusplus || defined _MSC_VER) | ||
1005 | static char * | 974 | static char * |
1006 | yystpcpy (char *yydest, const char *yysrc) | 975 | yystpcpy (char *yydest, const char *yysrc) |
1007 | #else | ||
1008 | static char * | ||
1009 | yystpcpy (yydest, yysrc) | ||
1010 | char *yydest; | ||
1011 | const char *yysrc; | ||
1012 | #endif | ||
1013 | { | 976 | { |
1014 | char *yyd = yydest; | 977 | char *yyd = yydest; |
1015 | const char *yys = yysrc; | 978 | const char *yys = yysrc; |
@@ -1039,27 +1002,27 @@ yytnamerr (char *yyres, const char *yystr) | |||
1039 | char const *yyp = yystr; | 1002 | char const *yyp = yystr; |
1040 | 1003 | ||
1041 | for (;;) | 1004 | for (;;) |
1042 | switch (*++yyp) | 1005 | switch (*++yyp) |
1043 | { | 1006 | { |
1044 | case '\'': | 1007 | case '\'': |
1045 | case ',': | 1008 | case ',': |
1046 | goto do_not_strip_quotes; | 1009 | goto do_not_strip_quotes; |
1047 | 1010 | ||
1048 | case '\\': | 1011 | case '\\': |
1049 | if (*++yyp != '\\') | 1012 | if (*++yyp != '\\') |
1050 | goto do_not_strip_quotes; | 1013 | goto do_not_strip_quotes; |
1051 | /* Fall through. */ | 1014 | /* Fall through. */ |
1052 | default: | 1015 | default: |
1053 | if (yyres) | 1016 | if (yyres) |
1054 | yyres[yyn] = *yyp; | 1017 | yyres[yyn] = *yyp; |
1055 | yyn++; | 1018 | yyn++; |
1056 | break; | 1019 | break; |
1057 | 1020 | ||
1058 | case '"': | 1021 | case '"': |
1059 | if (yyres) | 1022 | if (yyres) |
1060 | yyres[yyn] = '\0'; | 1023 | yyres[yyn] = '\0'; |
1061 | return yyn; | 1024 | return yyn; |
1062 | } | 1025 | } |
1063 | do_not_strip_quotes: ; | 1026 | do_not_strip_quotes: ; |
1064 | } | 1027 | } |
1065 | 1028 | ||
@@ -1082,11 +1045,11 @@ static int | |||
1082 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | 1045 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, |
1083 | yytype_int16 *yyssp, int yytoken) | 1046 | yytype_int16 *yyssp, int yytoken) |
1084 | { | 1047 | { |
1085 | YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); | 1048 | YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); |
1086 | YYSIZE_T yysize = yysize0; | 1049 | YYSIZE_T yysize = yysize0; |
1087 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; | 1050 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
1088 | /* Internationalized format string. */ | 1051 | /* Internationalized format string. */ |
1089 | const char *yyformat = YY_NULL; | 1052 | const char *yyformat = YY_NULLPTR; |
1090 | /* Arguments of yyformat. */ | 1053 | /* Arguments of yyformat. */ |
1091 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | 1054 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
1092 | /* Number of reported tokens (one for the "unexpected", one per | 1055 | /* Number of reported tokens (one for the "unexpected", one per |
@@ -1094,10 +1057,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | |||
1094 | int yycount = 0; | 1057 | int yycount = 0; |
1095 | 1058 | ||
1096 | /* There are many possibilities here to consider: | 1059 | /* There are many possibilities here to consider: |
1097 | - Assume YYFAIL is not used. It's too flawed to consider. See | ||
1098 | <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> | ||
1099 | for details. YYERROR is fine as it does not invoke this | ||
1100 | function. | ||
1101 | - If this state is a consistent state with a default action, then | 1060 | - If this state is a consistent state with a default action, then |
1102 | the only way this function was invoked is if the default action | 1061 | the only way this function was invoked is if the default action |
1103 | is an error action. In that case, don't check for expected | 1062 | is an error action. In that case, don't check for expected |
@@ -1147,7 +1106,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | |||
1147 | } | 1106 | } |
1148 | yyarg[yycount++] = yytname[yyx]; | 1107 | yyarg[yycount++] = yytname[yyx]; |
1149 | { | 1108 | { |
1150 | YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); | 1109 | YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); |
1151 | if (! (yysize <= yysize1 | 1110 | if (! (yysize <= yysize1 |
1152 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) | 1111 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
1153 | return 2; | 1112 | return 2; |
@@ -1214,26 +1173,18 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | |||
1214 | | Release the memory associated to this symbol. | | 1173 | | Release the memory associated to this symbol. | |
1215 | `-----------------------------------------------*/ | 1174 | `-----------------------------------------------*/ |
1216 | 1175 | ||
1217 | /*ARGSUSED*/ | ||
1218 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
1219 | || defined __cplusplus || defined _MSC_VER) | ||
1220 | static void | ||
1221 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) | ||
1222 | #else | ||
1223 | static void | 1176 | static void |
1224 | yydestruct (yymsg, yytype, yyvaluep) | 1177 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) |
1225 | const char *yymsg; | ||
1226 | int yytype; | ||
1227 | YYSTYPE *yyvaluep; | ||
1228 | #endif | ||
1229 | { | 1178 | { |
1230 | YYUSE (yyvaluep); | 1179 | YYUSE (yyvaluep); |
1231 | 1180 | YYUSE (yylocationp); | |
1232 | if (!yymsg) | 1181 | if (!yymsg) |
1233 | yymsg = "Deleting"; | 1182 | yymsg = "Deleting"; |
1234 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); | 1183 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
1235 | 1184 | ||
1185 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN | ||
1236 | YYUSE (yytype); | 1186 | YYUSE (yytype); |
1187 | YY_IGNORE_MAYBE_UNINITIALIZED_END | ||
1237 | } | 1188 | } |
1238 | 1189 | ||
1239 | 1190 | ||
@@ -1242,18 +1193,14 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1242 | /* The lookahead symbol. */ | 1193 | /* The lookahead symbol. */ |
1243 | int yychar; | 1194 | int yychar; |
1244 | 1195 | ||
1245 | |||
1246 | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN | ||
1247 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN | ||
1248 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END | ||
1249 | #endif | ||
1250 | #ifndef YY_INITIAL_VALUE | ||
1251 | # define YY_INITIAL_VALUE(Value) /* Nothing. */ | ||
1252 | #endif | ||
1253 | |||
1254 | /* The semantic value of the lookahead symbol. */ | 1196 | /* The semantic value of the lookahead symbol. */ |
1255 | YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); | 1197 | YYSTYPE yylval; |
1256 | 1198 | /* Location data for the lookahead symbol. */ | |
1199 | YYLTYPE yylloc | ||
1200 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL | ||
1201 | = { 1, 1, 1, 1 } | ||
1202 | # endif | ||
1203 | ; | ||
1257 | /* Number of syntax errors so far. */ | 1204 | /* Number of syntax errors so far. */ |
1258 | int yynerrs; | 1205 | int yynerrs; |
1259 | 1206 | ||
@@ -1262,35 +1209,17 @@ int yynerrs; | |||
1262 | | yyparse. | | 1209 | | yyparse. | |
1263 | `----------*/ | 1210 | `----------*/ |
1264 | 1211 | ||
1265 | #ifdef YYPARSE_PARAM | ||
1266 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
1267 | || defined __cplusplus || defined _MSC_VER) | ||
1268 | int | ||
1269 | yyparse (void *YYPARSE_PARAM) | ||
1270 | #else | ||
1271 | int | ||
1272 | yyparse (YYPARSE_PARAM) | ||
1273 | void *YYPARSE_PARAM; | ||
1274 | #endif | ||
1275 | #else /* ! YYPARSE_PARAM */ | ||
1276 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
1277 | || defined __cplusplus || defined _MSC_VER) | ||
1278 | int | 1212 | int |
1279 | yyparse (void) | 1213 | yyparse (void) |
1280 | #else | ||
1281 | int | ||
1282 | yyparse () | ||
1283 | |||
1284 | #endif | ||
1285 | #endif | ||
1286 | { | 1214 | { |
1287 | int yystate; | 1215 | int yystate; |
1288 | /* Number of tokens to shift before error messages enabled. */ | 1216 | /* Number of tokens to shift before error messages enabled. */ |
1289 | int yyerrstatus; | 1217 | int yyerrstatus; |
1290 | 1218 | ||
1291 | /* The stacks and their tools: | 1219 | /* The stacks and their tools: |
1292 | `yyss': related to states. | 1220 | 'yyss': related to states. |
1293 | `yyvs': related to semantic values. | 1221 | 'yyvs': related to semantic values. |
1222 | 'yyls': related to locations. | ||
1294 | 1223 | ||
1295 | Refer to the stacks through separate pointers, to allow yyoverflow | 1224 | Refer to the stacks through separate pointers, to allow yyoverflow |
1296 | to reallocate them elsewhere. */ | 1225 | to reallocate them elsewhere. */ |
@@ -1305,6 +1234,14 @@ yyparse () | |||
1305 | YYSTYPE *yyvs; | 1234 | YYSTYPE *yyvs; |
1306 | YYSTYPE *yyvsp; | 1235 | YYSTYPE *yyvsp; |
1307 | 1236 | ||
1237 | /* The location stack. */ | ||
1238 | YYLTYPE yylsa[YYINITDEPTH]; | ||
1239 | YYLTYPE *yyls; | ||
1240 | YYLTYPE *yylsp; | ||
1241 | |||
1242 | /* The locations where the error started and ended. */ | ||
1243 | YYLTYPE yyerror_range[3]; | ||
1244 | |||
1308 | YYSIZE_T yystacksize; | 1245 | YYSIZE_T yystacksize; |
1309 | 1246 | ||
1310 | int yyn; | 1247 | int yyn; |
@@ -1314,6 +1251,7 @@ yyparse () | |||
1314 | /* The variables used to return semantic value and location from the | 1251 | /* The variables used to return semantic value and location from the |
1315 | action routines. */ | 1252 | action routines. */ |
1316 | YYSTYPE yyval; | 1253 | YYSTYPE yyval; |
1254 | YYLTYPE yyloc; | ||
1317 | 1255 | ||
1318 | #if YYERROR_VERBOSE | 1256 | #if YYERROR_VERBOSE |
1319 | /* Buffer for error messages, and its allocated size. */ | 1257 | /* Buffer for error messages, and its allocated size. */ |
@@ -1322,7 +1260,7 @@ yyparse () | |||
1322 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | 1260 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
1323 | #endif | 1261 | #endif |
1324 | 1262 | ||
1325 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) | 1263 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) |
1326 | 1264 | ||
1327 | /* The number of symbols on the RHS of the reduced rule. | 1265 | /* The number of symbols on the RHS of the reduced rule. |
1328 | Keep to zero when no symbol should be popped. */ | 1266 | Keep to zero when no symbol should be popped. */ |
@@ -1330,6 +1268,7 @@ yyparse () | |||
1330 | 1268 | ||
1331 | yyssp = yyss = yyssa; | 1269 | yyssp = yyss = yyssa; |
1332 | yyvsp = yyvs = yyvsa; | 1270 | yyvsp = yyvs = yyvsa; |
1271 | yylsp = yyls = yylsa; | ||
1333 | yystacksize = YYINITDEPTH; | 1272 | yystacksize = YYINITDEPTH; |
1334 | 1273 | ||
1335 | YYDPRINTF ((stderr, "Starting parse\n")); | 1274 | YYDPRINTF ((stderr, "Starting parse\n")); |
@@ -1338,6 +1277,7 @@ yyparse () | |||
1338 | yyerrstatus = 0; | 1277 | yyerrstatus = 0; |
1339 | yynerrs = 0; | 1278 | yynerrs = 0; |
1340 | yychar = YYEMPTY; /* Cause a token to be read. */ | 1279 | yychar = YYEMPTY; /* Cause a token to be read. */ |
1280 | yylsp[0] = yylloc; | ||
1341 | goto yysetstate; | 1281 | goto yysetstate; |
1342 | 1282 | ||
1343 | /*------------------------------------------------------------. | 1283 | /*------------------------------------------------------------. |
@@ -1358,23 +1298,26 @@ yyparse () | |||
1358 | 1298 | ||
1359 | #ifdef yyoverflow | 1299 | #ifdef yyoverflow |
1360 | { | 1300 | { |
1361 | /* Give user a chance to reallocate the stack. Use copies of | 1301 | /* Give user a chance to reallocate the stack. Use copies of |
1362 | these so that the &'s don't force the real ones into | 1302 | these so that the &'s don't force the real ones into |
1363 | memory. */ | 1303 | memory. */ |
1364 | YYSTYPE *yyvs1 = yyvs; | 1304 | YYSTYPE *yyvs1 = yyvs; |
1365 | yytype_int16 *yyss1 = yyss; | 1305 | yytype_int16 *yyss1 = yyss; |
1366 | 1306 | YYLTYPE *yyls1 = yyls; | |
1367 | /* Each stack pointer address is followed by the size of the | 1307 | |
1368 | data in use in that stack, in bytes. This used to be a | 1308 | /* Each stack pointer address is followed by the size of the |
1369 | conditional around just the two extra args, but that might | 1309 | data in use in that stack, in bytes. This used to be a |
1370 | be undefined if yyoverflow is a macro. */ | 1310 | conditional around just the two extra args, but that might |
1371 | yyoverflow (YY_("memory exhausted"), | 1311 | be undefined if yyoverflow is a macro. */ |
1372 | &yyss1, yysize * sizeof (*yyssp), | 1312 | yyoverflow (YY_("memory exhausted"), |
1373 | &yyvs1, yysize * sizeof (*yyvsp), | 1313 | &yyss1, yysize * sizeof (*yyssp), |
1374 | &yystacksize); | 1314 | &yyvs1, yysize * sizeof (*yyvsp), |
1375 | 1315 | &yyls1, yysize * sizeof (*yylsp), | |
1376 | yyss = yyss1; | 1316 | &yystacksize); |
1377 | yyvs = yyvs1; | 1317 | |
1318 | yyls = yyls1; | ||
1319 | yyss = yyss1; | ||
1320 | yyvs = yyvs1; | ||
1378 | } | 1321 | } |
1379 | #else /* no yyoverflow */ | 1322 | #else /* no yyoverflow */ |
1380 | # ifndef YYSTACK_RELOCATE | 1323 | # ifndef YYSTACK_RELOCATE |
@@ -1382,34 +1325,36 @@ yyparse () | |||
1382 | # else | 1325 | # else |
1383 | /* Extend the stack our own way. */ | 1326 | /* Extend the stack our own way. */ |
1384 | if (YYMAXDEPTH <= yystacksize) | 1327 | if (YYMAXDEPTH <= yystacksize) |
1385 | goto yyexhaustedlab; | 1328 | goto yyexhaustedlab; |
1386 | yystacksize *= 2; | 1329 | yystacksize *= 2; |
1387 | if (YYMAXDEPTH < yystacksize) | 1330 | if (YYMAXDEPTH < yystacksize) |
1388 | yystacksize = YYMAXDEPTH; | 1331 | yystacksize = YYMAXDEPTH; |
1389 | 1332 | ||
1390 | { | 1333 | { |
1391 | yytype_int16 *yyss1 = yyss; | 1334 | yytype_int16 *yyss1 = yyss; |
1392 | union yyalloc *yyptr = | 1335 | union yyalloc *yyptr = |
1393 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | 1336 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
1394 | if (! yyptr) | 1337 | if (! yyptr) |
1395 | goto yyexhaustedlab; | 1338 | goto yyexhaustedlab; |
1396 | YYSTACK_RELOCATE (yyss_alloc, yyss); | 1339 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
1397 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); | 1340 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
1341 | YYSTACK_RELOCATE (yyls_alloc, yyls); | ||
1398 | # undef YYSTACK_RELOCATE | 1342 | # undef YYSTACK_RELOCATE |
1399 | if (yyss1 != yyssa) | 1343 | if (yyss1 != yyssa) |
1400 | YYSTACK_FREE (yyss1); | 1344 | YYSTACK_FREE (yyss1); |
1401 | } | 1345 | } |
1402 | # endif | 1346 | # endif |
1403 | #endif /* no yyoverflow */ | 1347 | #endif /* no yyoverflow */ |
1404 | 1348 | ||
1405 | yyssp = yyss + yysize - 1; | 1349 | yyssp = yyss + yysize - 1; |
1406 | yyvsp = yyvs + yysize - 1; | 1350 | yyvsp = yyvs + yysize - 1; |
1351 | yylsp = yyls + yysize - 1; | ||
1407 | 1352 | ||
1408 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | 1353 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
1409 | (unsigned long int) yystacksize)); | 1354 | (unsigned long int) yystacksize)); |
1410 | 1355 | ||
1411 | if (yyss + yystacksize - 1 <= yyssp) | 1356 | if (yyss + yystacksize - 1 <= yyssp) |
1412 | YYABORT; | 1357 | YYABORT; |
1413 | } | 1358 | } |
1414 | 1359 | ||
1415 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | 1360 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
@@ -1438,7 +1383,7 @@ yybackup: | |||
1438 | if (yychar == YYEMPTY) | 1383 | if (yychar == YYEMPTY) |
1439 | { | 1384 | { |
1440 | YYDPRINTF ((stderr, "Reading a token: ")); | 1385 | YYDPRINTF ((stderr, "Reading a token: ")); |
1441 | yychar = YYLEX; | 1386 | yychar = yylex (); |
1442 | } | 1387 | } |
1443 | 1388 | ||
1444 | if (yychar <= YYEOF) | 1389 | if (yychar <= YYEOF) |
@@ -1481,7 +1426,7 @@ yybackup: | |||
1481 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN | 1426 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1482 | *++yyvsp = yylval; | 1427 | *++yyvsp = yylval; |
1483 | YY_IGNORE_MAYBE_UNINITIALIZED_END | 1428 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1484 | 1429 | *++yylsp = yylloc; | |
1485 | goto yynewstate; | 1430 | goto yynewstate; |
1486 | 1431 | ||
1487 | 1432 | ||
@@ -1503,7 +1448,7 @@ yyreduce: | |||
1503 | yylen = yyr2[yyn]; | 1448 | yylen = yyr2[yyn]; |
1504 | 1449 | ||
1505 | /* If YYLEN is nonzero, implement the default value of the action: | 1450 | /* If YYLEN is nonzero, implement the default value of the action: |
1506 | `$$ = $1'. | 1451 | '$$ = $1'. |
1507 | 1452 | ||
1508 | Otherwise, the following line sets YYVAL to garbage. | 1453 | Otherwise, the following line sets YYVAL to garbage. |
1509 | This behavior is undocumented and Bison | 1454 | This behavior is undocumented and Bison |
@@ -1512,287 +1457,303 @@ yyreduce: | |||
1512 | GCC warning that YYVAL may be used uninitialized. */ | 1457 | GCC warning that YYVAL may be used uninitialized. */ |
1513 | yyval = yyvsp[1-yylen]; | 1458 | yyval = yyvsp[1-yylen]; |
1514 | 1459 | ||
1515 | 1460 | /* Default location. */ | |
1461 | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); | ||
1516 | YY_REDUCE_PRINT (yyn); | 1462 | YY_REDUCE_PRINT (yyn); |
1517 | switch (yyn) | 1463 | switch (yyn) |
1518 | { | 1464 | { |
1519 | case 2: | 1465 | case 2: |
1520 | /* Line 1787 of yacc.c */ | 1466 | #line 105 "dtc-parser.y" /* yacc.c:1646 */ |
1521 | #line 110 "dtc-parser.y" | ||
1522 | { | 1467 | { |
1523 | the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), | 1468 | the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node), |
1524 | guess_boot_cpuid((yyvsp[(4) - (4)].node))); | 1469 | guess_boot_cpuid((yyvsp[0].node))); |
1525 | } | 1470 | } |
1471 | #line 1472 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1526 | break; | 1472 | break; |
1527 | 1473 | ||
1528 | case 3: | 1474 | case 3: |
1529 | /* Line 1787 of yacc.c */ | 1475 | #line 113 "dtc-parser.y" /* yacc.c:1646 */ |
1530 | #line 118 "dtc-parser.y" | ||
1531 | { | 1476 | { |
1532 | (yyval.re) = NULL; | 1477 | (yyval.re) = NULL; |
1533 | } | 1478 | } |
1479 | #line 1480 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1534 | break; | 1480 | break; |
1535 | 1481 | ||
1536 | case 4: | 1482 | case 4: |
1537 | /* Line 1787 of yacc.c */ | 1483 | #line 117 "dtc-parser.y" /* yacc.c:1646 */ |
1538 | #line 122 "dtc-parser.y" | ||
1539 | { | 1484 | { |
1540 | (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); | 1485 | (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); |
1541 | } | 1486 | } |
1487 | #line 1488 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1542 | break; | 1488 | break; |
1543 | 1489 | ||
1544 | case 5: | 1490 | case 5: |
1545 | /* Line 1787 of yacc.c */ | 1491 | #line 124 "dtc-parser.y" /* yacc.c:1646 */ |
1546 | #line 129 "dtc-parser.y" | ||
1547 | { | 1492 | { |
1548 | (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer)); | 1493 | (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); |
1549 | } | 1494 | } |
1495 | #line 1496 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1550 | break; | 1496 | break; |
1551 | 1497 | ||
1552 | case 6: | 1498 | case 6: |
1553 | /* Line 1787 of yacc.c */ | 1499 | #line 128 "dtc-parser.y" /* yacc.c:1646 */ |
1554 | #line 133 "dtc-parser.y" | ||
1555 | { | 1500 | { |
1556 | add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref)); | 1501 | add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref)); |
1557 | (yyval.re) = (yyvsp[(2) - (2)].re); | 1502 | (yyval.re) = (yyvsp[0].re); |
1558 | } | 1503 | } |
1504 | #line 1505 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1559 | break; | 1505 | break; |
1560 | 1506 | ||
1561 | case 7: | 1507 | case 7: |
1562 | /* Line 1787 of yacc.c */ | 1508 | #line 136 "dtc-parser.y" /* yacc.c:1646 */ |
1563 | #line 141 "dtc-parser.y" | ||
1564 | { | 1509 | { |
1565 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), ""); | 1510 | (yyval.node) = name_node((yyvsp[0].node), ""); |
1566 | } | 1511 | } |
1512 | #line 1513 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1567 | break; | 1513 | break; |
1568 | 1514 | ||
1569 | case 8: | 1515 | case 8: |
1570 | /* Line 1787 of yacc.c */ | 1516 | #line 140 "dtc-parser.y" /* yacc.c:1646 */ |
1571 | #line 145 "dtc-parser.y" | ||
1572 | { | 1517 | { |
1573 | (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); | 1518 | (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node)); |
1574 | } | 1519 | } |
1520 | #line 1521 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1575 | break; | 1521 | break; |
1576 | 1522 | ||
1577 | case 9: | 1523 | case 9: |
1578 | /* Line 1787 of yacc.c */ | 1524 | #line 145 "dtc-parser.y" /* yacc.c:1646 */ |
1579 | #line 149 "dtc-parser.y" | ||
1580 | { | 1525 | { |
1581 | struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref)); | 1526 | struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); |
1582 | 1527 | ||
1528 | add_label(&target->labels, (yyvsp[-2].labelref)); | ||
1583 | if (target) | 1529 | if (target) |
1584 | merge_nodes(target, (yyvsp[(3) - (3)].node)); | 1530 | merge_nodes(target, (yyvsp[0].node)); |
1585 | else | 1531 | else |
1586 | print_error("label or path, '%s', not found", (yyvsp[(2) - (3)].labelref)); | 1532 | ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); |
1587 | (yyval.node) = (yyvsp[(1) - (3)].node); | 1533 | (yyval.node) = (yyvsp[-3].node); |
1588 | } | 1534 | } |
1535 | #line 1536 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1589 | break; | 1536 | break; |
1590 | 1537 | ||
1591 | case 10: | 1538 | case 10: |
1592 | /* Line 1787 of yacc.c */ | 1539 | #line 156 "dtc-parser.y" /* yacc.c:1646 */ |
1593 | #line 159 "dtc-parser.y" | ||
1594 | { | 1540 | { |
1595 | struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref)); | 1541 | struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref)); |
1596 | 1542 | ||
1597 | if (!target) | 1543 | if (target) |
1598 | print_error("label or path, '%s', not found", (yyvsp[(3) - (4)].labelref)); | 1544 | merge_nodes(target, (yyvsp[0].node)); |
1599 | else | 1545 | else |
1600 | delete_node(target); | 1546 | ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); |
1601 | 1547 | (yyval.node) = (yyvsp[-2].node); | |
1602 | (yyval.node) = (yyvsp[(1) - (4)].node); | ||
1603 | } | 1548 | } |
1549 | #line 1550 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1604 | break; | 1550 | break; |
1605 | 1551 | ||
1606 | case 11: | 1552 | case 11: |
1607 | /* Line 1787 of yacc.c */ | 1553 | #line 166 "dtc-parser.y" /* yacc.c:1646 */ |
1608 | #line 173 "dtc-parser.y" | ||
1609 | { | 1554 | { |
1610 | (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); | 1555 | struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); |
1556 | |||
1557 | if (target) | ||
1558 | delete_node(target); | ||
1559 | else | ||
1560 | ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); | ||
1561 | |||
1562 | |||
1563 | (yyval.node) = (yyvsp[-3].node); | ||
1611 | } | 1564 | } |
1565 | #line 1566 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1612 | break; | 1566 | break; |
1613 | 1567 | ||
1614 | case 12: | 1568 | case 12: |
1615 | /* Line 1787 of yacc.c */ | 1569 | #line 181 "dtc-parser.y" /* yacc.c:1646 */ |
1616 | #line 180 "dtc-parser.y" | ||
1617 | { | 1570 | { |
1618 | (yyval.proplist) = NULL; | 1571 | (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist)); |
1619 | } | 1572 | } |
1573 | #line 1574 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1620 | break; | 1574 | break; |
1621 | 1575 | ||
1622 | case 13: | 1576 | case 13: |
1623 | /* Line 1787 of yacc.c */ | 1577 | #line 188 "dtc-parser.y" /* yacc.c:1646 */ |
1624 | #line 184 "dtc-parser.y" | ||
1625 | { | 1578 | { |
1626 | (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); | 1579 | (yyval.proplist) = NULL; |
1627 | } | 1580 | } |
1581 | #line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1628 | break; | 1582 | break; |
1629 | 1583 | ||
1630 | case 14: | 1584 | case 14: |
1631 | /* Line 1787 of yacc.c */ | 1585 | #line 192 "dtc-parser.y" /* yacc.c:1646 */ |
1632 | #line 191 "dtc-parser.y" | ||
1633 | { | 1586 | { |
1634 | (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data)); | 1587 | (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist)); |
1635 | } | 1588 | } |
1589 | #line 1590 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1636 | break; | 1590 | break; |
1637 | 1591 | ||
1638 | case 15: | 1592 | case 15: |
1639 | /* Line 1787 of yacc.c */ | 1593 | #line 199 "dtc-parser.y" /* yacc.c:1646 */ |
1640 | #line 195 "dtc-parser.y" | ||
1641 | { | 1594 | { |
1642 | (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data); | 1595 | (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data)); |
1643 | } | 1596 | } |
1597 | #line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1644 | break; | 1598 | break; |
1645 | 1599 | ||
1646 | case 16: | 1600 | case 16: |
1647 | /* Line 1787 of yacc.c */ | 1601 | #line 203 "dtc-parser.y" /* yacc.c:1646 */ |
1648 | #line 199 "dtc-parser.y" | ||
1649 | { | 1602 | { |
1650 | (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename)); | 1603 | (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data); |
1651 | } | 1604 | } |
1605 | #line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1652 | break; | 1606 | break; |
1653 | 1607 | ||
1654 | case 17: | 1608 | case 17: |
1655 | /* Line 1787 of yacc.c */ | 1609 | #line 207 "dtc-parser.y" /* yacc.c:1646 */ |
1656 | #line 203 "dtc-parser.y" | ||
1657 | { | 1610 | { |
1658 | add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref)); | 1611 | (yyval.prop) = build_property_delete((yyvsp[-1].propnodename)); |
1659 | (yyval.prop) = (yyvsp[(2) - (2)].prop); | ||
1660 | } | 1612 | } |
1613 | #line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1661 | break; | 1614 | break; |
1662 | 1615 | ||
1663 | case 18: | 1616 | case 18: |
1664 | /* Line 1787 of yacc.c */ | 1617 | #line 211 "dtc-parser.y" /* yacc.c:1646 */ |
1665 | #line 211 "dtc-parser.y" | ||
1666 | { | 1618 | { |
1667 | (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); | 1619 | add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref)); |
1620 | (yyval.prop) = (yyvsp[0].prop); | ||
1668 | } | 1621 | } |
1622 | #line 1623 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1669 | break; | 1623 | break; |
1670 | 1624 | ||
1671 | case 19: | 1625 | case 19: |
1672 | /* Line 1787 of yacc.c */ | 1626 | #line 219 "dtc-parser.y" /* yacc.c:1646 */ |
1673 | #line 215 "dtc-parser.y" | ||
1674 | { | 1627 | { |
1675 | (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data); | 1628 | (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data)); |
1676 | } | 1629 | } |
1630 | #line 1631 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1677 | break; | 1631 | break; |
1678 | 1632 | ||
1679 | case 20: | 1633 | case 20: |
1680 | /* Line 1787 of yacc.c */ | 1634 | #line 223 "dtc-parser.y" /* yacc.c:1646 */ |
1681 | #line 219 "dtc-parser.y" | ||
1682 | { | 1635 | { |
1683 | (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); | 1636 | (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data); |
1684 | } | 1637 | } |
1638 | #line 1639 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1685 | break; | 1639 | break; |
1686 | 1640 | ||
1687 | case 21: | 1641 | case 21: |
1688 | /* Line 1787 of yacc.c */ | 1642 | #line 227 "dtc-parser.y" /* yacc.c:1646 */ |
1689 | #line 223 "dtc-parser.y" | ||
1690 | { | 1643 | { |
1691 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); | 1644 | (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data)); |
1692 | } | 1645 | } |
1646 | #line 1647 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1693 | break; | 1647 | break; |
1694 | 1648 | ||
1695 | case 22: | 1649 | case 22: |
1696 | /* Line 1787 of yacc.c */ | 1650 | #line 231 "dtc-parser.y" /* yacc.c:1646 */ |
1697 | #line 227 "dtc-parser.y" | ||
1698 | { | 1651 | { |
1699 | FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL); | 1652 | (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref)); |
1653 | } | ||
1654 | #line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1655 | break; | ||
1656 | |||
1657 | case 23: | ||
1658 | #line 235 "dtc-parser.y" /* yacc.c:1646 */ | ||
1659 | { | ||
1660 | FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL); | ||
1700 | struct data d; | 1661 | struct data d; |
1701 | 1662 | ||
1702 | if ((yyvsp[(6) - (9)].integer) != 0) | 1663 | if ((yyvsp[-3].integer) != 0) |
1703 | if (fseek(f, (yyvsp[(6) - (9)].integer), SEEK_SET) != 0) | 1664 | if (fseek(f, (yyvsp[-3].integer), SEEK_SET) != 0) |
1704 | print_error("Couldn't seek to offset %llu in \"%s\": %s", | 1665 | die("Couldn't seek to offset %llu in \"%s\": %s", |
1705 | (unsigned long long)(yyvsp[(6) - (9)].integer), | 1666 | (unsigned long long)(yyvsp[-3].integer), (yyvsp[-5].data).val, |
1706 | (yyvsp[(4) - (9)].data).val, | 1667 | strerror(errno)); |
1707 | strerror(errno)); | ||
1708 | 1668 | ||
1709 | d = data_copy_file(f, (yyvsp[(8) - (9)].integer)); | 1669 | d = data_copy_file(f, (yyvsp[-1].integer)); |
1710 | 1670 | ||
1711 | (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d); | 1671 | (yyval.data) = data_merge((yyvsp[-8].data), d); |
1712 | fclose(f); | 1672 | fclose(f); |
1713 | } | 1673 | } |
1674 | #line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1714 | break; | 1675 | break; |
1715 | 1676 | ||
1716 | case 23: | 1677 | case 24: |
1717 | /* Line 1787 of yacc.c */ | 1678 | #line 251 "dtc-parser.y" /* yacc.c:1646 */ |
1718 | #line 244 "dtc-parser.y" | ||
1719 | { | 1679 | { |
1720 | FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL); | 1680 | FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL); |
1721 | struct data d = empty_data; | 1681 | struct data d = empty_data; |
1722 | 1682 | ||
1723 | d = data_copy_file(f, -1); | 1683 | d = data_copy_file(f, -1); |
1724 | 1684 | ||
1725 | (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d); | 1685 | (yyval.data) = data_merge((yyvsp[-4].data), d); |
1726 | fclose(f); | 1686 | fclose(f); |
1727 | } | 1687 | } |
1688 | #line 1689 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1728 | break; | 1689 | break; |
1729 | 1690 | ||
1730 | case 24: | 1691 | case 25: |
1731 | /* Line 1787 of yacc.c */ | 1692 | #line 261 "dtc-parser.y" /* yacc.c:1646 */ |
1732 | #line 254 "dtc-parser.y" | ||
1733 | { | 1693 | { |
1734 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1694 | (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); |
1735 | } | 1695 | } |
1696 | #line 1697 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1736 | break; | 1697 | break; |
1737 | 1698 | ||
1738 | case 25: | 1699 | case 26: |
1739 | /* Line 1787 of yacc.c */ | 1700 | #line 268 "dtc-parser.y" /* yacc.c:1646 */ |
1740 | #line 261 "dtc-parser.y" | ||
1741 | { | 1701 | { |
1742 | (yyval.data) = empty_data; | 1702 | (yyval.data) = empty_data; |
1743 | } | 1703 | } |
1704 | #line 1705 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1744 | break; | 1705 | break; |
1745 | 1706 | ||
1746 | case 26: | 1707 | case 27: |
1747 | /* Line 1787 of yacc.c */ | 1708 | #line 272 "dtc-parser.y" /* yacc.c:1646 */ |
1748 | #line 265 "dtc-parser.y" | ||
1749 | { | 1709 | { |
1750 | (yyval.data) = (yyvsp[(1) - (2)].data); | 1710 | (yyval.data) = (yyvsp[-1].data); |
1751 | } | 1711 | } |
1712 | #line 1713 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1752 | break; | 1713 | break; |
1753 | 1714 | ||
1754 | case 27: | 1715 | case 28: |
1755 | /* Line 1787 of yacc.c */ | 1716 | #line 276 "dtc-parser.y" /* yacc.c:1646 */ |
1756 | #line 269 "dtc-parser.y" | ||
1757 | { | 1717 | { |
1758 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1718 | (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); |
1759 | } | 1719 | } |
1720 | #line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1760 | break; | 1721 | break; |
1761 | 1722 | ||
1762 | case 28: | 1723 | case 29: |
1763 | /* Line 1787 of yacc.c */ | 1724 | #line 283 "dtc-parser.y" /* yacc.c:1646 */ |
1764 | #line 276 "dtc-parser.y" | ||
1765 | { | 1725 | { |
1766 | (yyval.array).data = empty_data; | 1726 | unsigned long long bits; |
1767 | (yyval.array).bits = eval_literal((yyvsp[(2) - (3)].literal), 0, 7); | 1727 | |
1768 | 1728 | bits = (yyvsp[-1].integer); | |
1769 | if (((yyval.array).bits != 8) && | 1729 | |
1770 | ((yyval.array).bits != 16) && | 1730 | if ((bits != 8) && (bits != 16) && |
1771 | ((yyval.array).bits != 32) && | 1731 | (bits != 32) && (bits != 64)) { |
1772 | ((yyval.array).bits != 64)) | 1732 | ERROR(&(yylsp[-1]), "Array elements must be" |
1773 | { | 1733 | " 8, 16, 32 or 64-bits"); |
1774 | print_error("Only 8, 16, 32 and 64-bit elements" | 1734 | bits = 32; |
1775 | " are currently supported"); | ||
1776 | (yyval.array).bits = 32; | ||
1777 | } | 1735 | } |
1736 | |||
1737 | (yyval.array).data = empty_data; | ||
1738 | (yyval.array).bits = bits; | ||
1778 | } | 1739 | } |
1740 | #line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1779 | break; | 1741 | break; |
1780 | 1742 | ||
1781 | case 29: | 1743 | case 30: |
1782 | /* Line 1787 of yacc.c */ | 1744 | #line 299 "dtc-parser.y" /* yacc.c:1646 */ |
1783 | #line 291 "dtc-parser.y" | ||
1784 | { | 1745 | { |
1785 | (yyval.array).data = empty_data; | 1746 | (yyval.array).data = empty_data; |
1786 | (yyval.array).bits = 32; | 1747 | (yyval.array).bits = 32; |
1787 | } | 1748 | } |
1749 | #line 1750 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1788 | break; | 1750 | break; |
1789 | 1751 | ||
1790 | case 30: | 1752 | case 31: |
1791 | /* Line 1787 of yacc.c */ | 1753 | #line 304 "dtc-parser.y" /* yacc.c:1646 */ |
1792 | #line 296 "dtc-parser.y" | ||
1793 | { | 1754 | { |
1794 | if ((yyvsp[(1) - (2)].array).bits < 64) { | 1755 | if ((yyvsp[-1].array).bits < 64) { |
1795 | uint64_t mask = (1ULL << (yyvsp[(1) - (2)].array).bits) - 1; | 1756 | uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1; |
1796 | /* | 1757 | /* |
1797 | * Bits above mask must either be all zero | 1758 | * Bits above mask must either be all zero |
1798 | * (positive within range of mask) or all one | 1759 | * (positive within range of mask) or all one |
@@ -1801,275 +1762,258 @@ yyreduce: | |||
1801 | * within the mask to one (i.e. | in the | 1762 | * within the mask to one (i.e. | in the |
1802 | * mask), all bits are one. | 1763 | * mask), all bits are one. |
1803 | */ | 1764 | */ |
1804 | if (((yyvsp[(2) - (2)].integer) > mask) && (((yyvsp[(2) - (2)].integer) | mask) != -1ULL)) | 1765 | if (((yyvsp[0].integer) > mask) && (((yyvsp[0].integer) | mask) != -1ULL)) |
1805 | print_error( | 1766 | ERROR(&(yylsp[0]), "Value out of range for" |
1806 | "integer value out of range " | 1767 | " %d-bit array element", (yyvsp[-1].array).bits); |
1807 | "%016lx (%d bits)", (yyvsp[(1) - (2)].array).bits); | ||
1808 | } | 1768 | } |
1809 | 1769 | ||
1810 | (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits); | 1770 | (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits); |
1811 | } | 1771 | } |
1772 | #line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1812 | break; | 1773 | break; |
1813 | 1774 | ||
1814 | case 31: | 1775 | case 32: |
1815 | /* Line 1787 of yacc.c */ | 1776 | #line 323 "dtc-parser.y" /* yacc.c:1646 */ |
1816 | #line 316 "dtc-parser.y" | ||
1817 | { | 1777 | { |
1818 | uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits); | 1778 | uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits); |
1819 | 1779 | ||
1820 | if ((yyvsp[(1) - (2)].array).bits == 32) | 1780 | if ((yyvsp[-1].array).bits == 32) |
1821 | (yyvsp[(1) - (2)].array).data = data_add_marker((yyvsp[(1) - (2)].array).data, | 1781 | (yyvsp[-1].array).data = data_add_marker((yyvsp[-1].array).data, |
1822 | REF_PHANDLE, | 1782 | REF_PHANDLE, |
1823 | (yyvsp[(2) - (2)].labelref)); | 1783 | (yyvsp[0].labelref)); |
1824 | else | 1784 | else |
1825 | print_error("References are only allowed in " | 1785 | ERROR(&(yylsp[0]), "References are only allowed in " |
1826 | "arrays with 32-bit elements."); | 1786 | "arrays with 32-bit elements."); |
1827 | 1787 | ||
1828 | (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits); | 1788 | (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits); |
1829 | } | ||
1830 | break; | ||
1831 | |||
1832 | case 32: | ||
1833 | /* Line 1787 of yacc.c */ | ||
1834 | #line 330 "dtc-parser.y" | ||
1835 | { | ||
1836 | (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref)); | ||
1837 | } | 1789 | } |
1790 | #line 1791 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1838 | break; | 1791 | break; |
1839 | 1792 | ||
1840 | case 33: | 1793 | case 33: |
1841 | /* Line 1787 of yacc.c */ | 1794 | #line 337 "dtc-parser.y" /* yacc.c:1646 */ |
1842 | #line 337 "dtc-parser.y" | ||
1843 | { | ||
1844 | (yyval.integer) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64); | ||
1845 | } | ||
1846 | break; | ||
1847 | |||
1848 | case 34: | ||
1849 | /* Line 1787 of yacc.c */ | ||
1850 | #line 341 "dtc-parser.y" | ||
1851 | { | 1795 | { |
1852 | (yyval.integer) = eval_char_literal((yyvsp[(1) - (1)].literal)); | 1796 | (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref)); |
1853 | } | 1797 | } |
1798 | #line 1799 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1854 | break; | 1799 | break; |
1855 | 1800 | ||
1856 | case 35: | 1801 | case 36: |
1857 | /* Line 1787 of yacc.c */ | 1802 | #line 346 "dtc-parser.y" /* yacc.c:1646 */ |
1858 | #line 345 "dtc-parser.y" | ||
1859 | { | 1803 | { |
1860 | (yyval.integer) = (yyvsp[(2) - (3)].integer); | 1804 | (yyval.integer) = (yyvsp[-1].integer); |
1861 | } | 1805 | } |
1806 | #line 1807 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1862 | break; | 1807 | break; |
1863 | 1808 | ||
1864 | case 38: | 1809 | case 39: |
1865 | /* Line 1787 of yacc.c */ | 1810 | #line 357 "dtc-parser.y" /* yacc.c:1646 */ |
1866 | #line 356 "dtc-parser.y" | 1811 | { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); } |
1867 | { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); } | 1812 | #line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1868 | break; | ||
1869 | |||
1870 | case 40: | ||
1871 | /* Line 1787 of yacc.c */ | ||
1872 | #line 361 "dtc-parser.y" | ||
1873 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); } | ||
1874 | break; | 1813 | break; |
1875 | 1814 | ||
1876 | case 42: | 1815 | case 41: |
1877 | /* Line 1787 of yacc.c */ | 1816 | #line 362 "dtc-parser.y" /* yacc.c:1646 */ |
1878 | #line 366 "dtc-parser.y" | 1817 | { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); } |
1879 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); } | 1818 | #line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1880 | break; | 1819 | break; |
1881 | 1820 | ||
1882 | case 44: | 1821 | case 43: |
1883 | /* Line 1787 of yacc.c */ | 1822 | #line 367 "dtc-parser.y" /* yacc.c:1646 */ |
1884 | #line 371 "dtc-parser.y" | 1823 | { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); } |
1885 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); } | 1824 | #line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1886 | break; | 1825 | break; |
1887 | 1826 | ||
1888 | case 46: | 1827 | case 45: |
1889 | /* Line 1787 of yacc.c */ | 1828 | #line 372 "dtc-parser.y" /* yacc.c:1646 */ |
1890 | #line 376 "dtc-parser.y" | 1829 | { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); } |
1891 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); } | 1830 | #line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1892 | break; | 1831 | break; |
1893 | 1832 | ||
1894 | case 48: | 1833 | case 47: |
1895 | /* Line 1787 of yacc.c */ | 1834 | #line 377 "dtc-parser.y" /* yacc.c:1646 */ |
1896 | #line 381 "dtc-parser.y" | 1835 | { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); } |
1897 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); } | 1836 | #line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1898 | break; | 1837 | break; |
1899 | 1838 | ||
1900 | case 50: | 1839 | case 49: |
1901 | /* Line 1787 of yacc.c */ | 1840 | #line 382 "dtc-parser.y" /* yacc.c:1646 */ |
1902 | #line 386 "dtc-parser.y" | 1841 | { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); } |
1903 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); } | 1842 | #line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1904 | break; | 1843 | break; |
1905 | 1844 | ||
1906 | case 51: | 1845 | case 51: |
1907 | /* Line 1787 of yacc.c */ | 1846 | #line 387 "dtc-parser.y" /* yacc.c:1646 */ |
1908 | #line 387 "dtc-parser.y" | 1847 | { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); } |
1909 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); } | 1848 | #line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1910 | break; | 1849 | break; |
1911 | 1850 | ||
1912 | case 53: | 1851 | case 52: |
1913 | /* Line 1787 of yacc.c */ | 1852 | #line 388 "dtc-parser.y" /* yacc.c:1646 */ |
1914 | #line 392 "dtc-parser.y" | 1853 | { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); } |
1915 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); } | 1854 | #line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1916 | break; | 1855 | break; |
1917 | 1856 | ||
1918 | case 54: | 1857 | case 54: |
1919 | /* Line 1787 of yacc.c */ | 1858 | #line 393 "dtc-parser.y" /* yacc.c:1646 */ |
1920 | #line 393 "dtc-parser.y" | 1859 | { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); } |
1921 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); } | 1860 | #line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1922 | break; | 1861 | break; |
1923 | 1862 | ||
1924 | case 55: | 1863 | case 55: |
1925 | /* Line 1787 of yacc.c */ | 1864 | #line 394 "dtc-parser.y" /* yacc.c:1646 */ |
1926 | #line 394 "dtc-parser.y" | 1865 | { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); } |
1927 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); } | 1866 | #line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1928 | break; | 1867 | break; |
1929 | 1868 | ||
1930 | case 56: | 1869 | case 56: |
1931 | /* Line 1787 of yacc.c */ | 1870 | #line 395 "dtc-parser.y" /* yacc.c:1646 */ |
1932 | #line 395 "dtc-parser.y" | 1871 | { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); } |
1933 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); } | 1872 | #line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1934 | break; | 1873 | break; |
1935 | 1874 | ||
1936 | case 57: | 1875 | case 57: |
1937 | /* Line 1787 of yacc.c */ | 1876 | #line 396 "dtc-parser.y" /* yacc.c:1646 */ |
1938 | #line 399 "dtc-parser.y" | 1877 | { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); } |
1939 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); } | 1878 | #line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1940 | break; | 1879 | break; |
1941 | 1880 | ||
1942 | case 58: | 1881 | case 58: |
1943 | /* Line 1787 of yacc.c */ | 1882 | #line 400 "dtc-parser.y" /* yacc.c:1646 */ |
1944 | #line 400 "dtc-parser.y" | 1883 | { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); } |
1945 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); } | 1884 | #line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1946 | break; | 1885 | break; |
1947 | 1886 | ||
1948 | case 60: | 1887 | case 59: |
1949 | /* Line 1787 of yacc.c */ | 1888 | #line 401 "dtc-parser.y" /* yacc.c:1646 */ |
1950 | #line 405 "dtc-parser.y" | 1889 | { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); } |
1951 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); } | 1890 | #line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1952 | break; | 1891 | break; |
1953 | 1892 | ||
1954 | case 61: | 1893 | case 61: |
1955 | /* Line 1787 of yacc.c */ | 1894 | #line 406 "dtc-parser.y" /* yacc.c:1646 */ |
1956 | #line 406 "dtc-parser.y" | 1895 | { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); } |
1957 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); } | 1896 | #line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1958 | break; | 1897 | break; |
1959 | 1898 | ||
1960 | case 63: | 1899 | case 62: |
1961 | /* Line 1787 of yacc.c */ | 1900 | #line 407 "dtc-parser.y" /* yacc.c:1646 */ |
1962 | #line 411 "dtc-parser.y" | 1901 | { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); } |
1963 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); } | 1902 | #line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1964 | break; | 1903 | break; |
1965 | 1904 | ||
1966 | case 64: | 1905 | case 64: |
1967 | /* Line 1787 of yacc.c */ | 1906 | #line 412 "dtc-parser.y" /* yacc.c:1646 */ |
1968 | #line 412 "dtc-parser.y" | 1907 | { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); } |
1969 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); } | 1908 | #line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1970 | break; | 1909 | break; |
1971 | 1910 | ||
1972 | case 65: | 1911 | case 65: |
1973 | /* Line 1787 of yacc.c */ | 1912 | #line 413 "dtc-parser.y" /* yacc.c:1646 */ |
1974 | #line 413 "dtc-parser.y" | 1913 | { (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); } |
1975 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); } | 1914 | #line 1915 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1976 | break; | 1915 | break; |
1977 | 1916 | ||
1978 | case 68: | 1917 | case 66: |
1979 | /* Line 1787 of yacc.c */ | 1918 | #line 414 "dtc-parser.y" /* yacc.c:1646 */ |
1980 | #line 419 "dtc-parser.y" | 1919 | { (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); } |
1981 | { (yyval.integer) = -(yyvsp[(2) - (2)].integer); } | 1920 | #line 1921 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1982 | break; | 1921 | break; |
1983 | 1922 | ||
1984 | case 69: | 1923 | case 69: |
1985 | /* Line 1787 of yacc.c */ | 1924 | #line 420 "dtc-parser.y" /* yacc.c:1646 */ |
1986 | #line 420 "dtc-parser.y" | 1925 | { (yyval.integer) = -(yyvsp[0].integer); } |
1987 | { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); } | 1926 | #line 1927 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1988 | break; | 1927 | break; |
1989 | 1928 | ||
1990 | case 70: | 1929 | case 70: |
1991 | /* Line 1787 of yacc.c */ | 1930 | #line 421 "dtc-parser.y" /* yacc.c:1646 */ |
1992 | #line 421 "dtc-parser.y" | 1931 | { (yyval.integer) = ~(yyvsp[0].integer); } |
1993 | { (yyval.integer) = !(yyvsp[(2) - (2)].integer); } | 1932 | #line 1933 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1994 | break; | 1933 | break; |
1995 | 1934 | ||
1996 | case 71: | 1935 | case 71: |
1997 | /* Line 1787 of yacc.c */ | 1936 | #line 422 "dtc-parser.y" /* yacc.c:1646 */ |
1998 | #line 426 "dtc-parser.y" | 1937 | { (yyval.integer) = !(yyvsp[0].integer); } |
1999 | { | 1938 | #line 1939 "dtc-parser.tab.c" /* yacc.c:1646 */ |
2000 | (yyval.data) = empty_data; | ||
2001 | } | ||
2002 | break; | 1939 | break; |
2003 | 1940 | ||
2004 | case 72: | 1941 | case 72: |
2005 | /* Line 1787 of yacc.c */ | 1942 | #line 427 "dtc-parser.y" /* yacc.c:1646 */ |
2006 | #line 430 "dtc-parser.y" | ||
2007 | { | 1943 | { |
2008 | (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); | 1944 | (yyval.data) = empty_data; |
2009 | } | 1945 | } |
1946 | #line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2010 | break; | 1947 | break; |
2011 | 1948 | ||
2012 | case 73: | 1949 | case 73: |
2013 | /* Line 1787 of yacc.c */ | 1950 | #line 431 "dtc-parser.y" /* yacc.c:1646 */ |
2014 | #line 434 "dtc-parser.y" | ||
2015 | { | 1951 | { |
2016 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1952 | (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte)); |
2017 | } | 1953 | } |
1954 | #line 1955 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2018 | break; | 1955 | break; |
2019 | 1956 | ||
2020 | case 74: | 1957 | case 74: |
2021 | /* Line 1787 of yacc.c */ | 1958 | #line 435 "dtc-parser.y" /* yacc.c:1646 */ |
2022 | #line 441 "dtc-parser.y" | ||
2023 | { | 1959 | { |
2024 | (yyval.nodelist) = NULL; | 1960 | (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); |
2025 | } | 1961 | } |
1962 | #line 1963 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2026 | break; | 1963 | break; |
2027 | 1964 | ||
2028 | case 75: | 1965 | case 75: |
2029 | /* Line 1787 of yacc.c */ | 1966 | #line 442 "dtc-parser.y" /* yacc.c:1646 */ |
2030 | #line 445 "dtc-parser.y" | ||
2031 | { | 1967 | { |
2032 | (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); | 1968 | (yyval.nodelist) = NULL; |
2033 | } | 1969 | } |
1970 | #line 1971 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2034 | break; | 1971 | break; |
2035 | 1972 | ||
2036 | case 76: | 1973 | case 76: |
2037 | /* Line 1787 of yacc.c */ | 1974 | #line 446 "dtc-parser.y" /* yacc.c:1646 */ |
2038 | #line 449 "dtc-parser.y" | ||
2039 | { | 1975 | { |
2040 | print_error("syntax error: properties must precede subnodes"); | 1976 | (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist)); |
2041 | YYERROR; | ||
2042 | } | 1977 | } |
1978 | #line 1979 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2043 | break; | 1979 | break; |
2044 | 1980 | ||
2045 | case 77: | 1981 | case 77: |
2046 | /* Line 1787 of yacc.c */ | 1982 | #line 450 "dtc-parser.y" /* yacc.c:1646 */ |
2047 | #line 457 "dtc-parser.y" | ||
2048 | { | 1983 | { |
2049 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename)); | 1984 | ERROR(&(yylsp[0]), "Properties must precede subnodes"); |
1985 | YYERROR; | ||
2050 | } | 1986 | } |
1987 | #line 1988 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2051 | break; | 1988 | break; |
2052 | 1989 | ||
2053 | case 78: | 1990 | case 78: |
2054 | /* Line 1787 of yacc.c */ | 1991 | #line 458 "dtc-parser.y" /* yacc.c:1646 */ |
2055 | #line 461 "dtc-parser.y" | ||
2056 | { | 1992 | { |
2057 | (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename)); | 1993 | (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename)); |
2058 | } | 1994 | } |
1995 | #line 1996 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2059 | break; | 1996 | break; |
2060 | 1997 | ||
2061 | case 79: | 1998 | case 79: |
2062 | /* Line 1787 of yacc.c */ | 1999 | #line 462 "dtc-parser.y" /* yacc.c:1646 */ |
2063 | #line 465 "dtc-parser.y" | 2000 | { |
2001 | (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename)); | ||
2002 | } | ||
2003 | #line 2004 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2004 | break; | ||
2005 | |||
2006 | case 80: | ||
2007 | #line 466 "dtc-parser.y" /* yacc.c:1646 */ | ||
2064 | { | 2008 | { |
2065 | add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref)); | 2009 | add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref)); |
2066 | (yyval.node) = (yyvsp[(2) - (2)].node); | 2010 | (yyval.node) = (yyvsp[0].node); |
2067 | } | 2011 | } |
2012 | #line 2013 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2068 | break; | 2013 | break; |
2069 | 2014 | ||
2070 | 2015 | ||
2071 | /* Line 1787 of yacc.c */ | 2016 | #line 2017 "dtc-parser.tab.c" /* yacc.c:1646 */ |
2072 | #line 2073 "dtc-parser.tab.c" | ||
2073 | default: break; | 2017 | default: break; |
2074 | } | 2018 | } |
2075 | /* User semantic actions sometimes alter yychar, and that requires | 2019 | /* User semantic actions sometimes alter yychar, and that requires |
@@ -2090,8 +2034,9 @@ yyreduce: | |||
2090 | YY_STACK_PRINT (yyss, yyssp); | 2034 | YY_STACK_PRINT (yyss, yyssp); |
2091 | 2035 | ||
2092 | *++yyvsp = yyval; | 2036 | *++yyvsp = yyval; |
2037 | *++yylsp = yyloc; | ||
2093 | 2038 | ||
2094 | /* Now `shift' the result of the reduction. Determine what state | 2039 | /* Now 'shift' the result of the reduction. Determine what state |
2095 | that goes to, based on the state we popped back to and the rule | 2040 | that goes to, based on the state we popped back to and the rule |
2096 | number reduced by. */ | 2041 | number reduced by. */ |
2097 | 2042 | ||
@@ -2106,9 +2051,9 @@ yyreduce: | |||
2106 | goto yynewstate; | 2051 | goto yynewstate; |
2107 | 2052 | ||
2108 | 2053 | ||
2109 | /*------------------------------------. | 2054 | /*--------------------------------------. |
2110 | | yyerrlab -- here on detecting error | | 2055 | | yyerrlab -- here on detecting error. | |
2111 | `------------------------------------*/ | 2056 | `--------------------------------------*/ |
2112 | yyerrlab: | 2057 | yyerrlab: |
2113 | /* Make sure we have latest lookahead translation. See comments at | 2058 | /* Make sure we have latest lookahead translation. See comments at |
2114 | user semantic actions for why this is necessary. */ | 2059 | user semantic actions for why this is necessary. */ |
@@ -2154,25 +2099,25 @@ yyerrlab: | |||
2154 | #endif | 2099 | #endif |
2155 | } | 2100 | } |
2156 | 2101 | ||
2157 | 2102 | yyerror_range[1] = yylloc; | |
2158 | 2103 | ||
2159 | if (yyerrstatus == 3) | 2104 | if (yyerrstatus == 3) |
2160 | { | 2105 | { |
2161 | /* If just tried and failed to reuse lookahead token after an | 2106 | /* If just tried and failed to reuse lookahead token after an |
2162 | error, discard it. */ | 2107 | error, discard it. */ |
2163 | 2108 | ||
2164 | if (yychar <= YYEOF) | 2109 | if (yychar <= YYEOF) |
2165 | { | 2110 | { |
2166 | /* Return failure if at end of input. */ | 2111 | /* Return failure if at end of input. */ |
2167 | if (yychar == YYEOF) | 2112 | if (yychar == YYEOF) |
2168 | YYABORT; | 2113 | YYABORT; |
2169 | } | 2114 | } |
2170 | else | 2115 | else |
2171 | { | 2116 | { |
2172 | yydestruct ("Error: discarding", | 2117 | yydestruct ("Error: discarding", |
2173 | yytoken, &yylval); | 2118 | yytoken, &yylval, &yylloc); |
2174 | yychar = YYEMPTY; | 2119 | yychar = YYEMPTY; |
2175 | } | 2120 | } |
2176 | } | 2121 | } |
2177 | 2122 | ||
2178 | /* Else will try to reuse lookahead token after shifting the error | 2123 | /* Else will try to reuse lookahead token after shifting the error |
@@ -2191,7 +2136,8 @@ yyerrorlab: | |||
2191 | if (/*CONSTCOND*/ 0) | 2136 | if (/*CONSTCOND*/ 0) |
2192 | goto yyerrorlab; | 2137 | goto yyerrorlab; |
2193 | 2138 | ||
2194 | /* Do not reclaim the symbols of the rule which action triggered | 2139 | yyerror_range[1] = yylsp[1-yylen]; |
2140 | /* Do not reclaim the symbols of the rule whose action triggered | ||
2195 | this YYERROR. */ | 2141 | this YYERROR. */ |
2196 | YYPOPSTACK (yylen); | 2142 | YYPOPSTACK (yylen); |
2197 | yylen = 0; | 2143 | yylen = 0; |
@@ -2204,29 +2150,29 @@ yyerrorlab: | |||
2204 | | yyerrlab1 -- common code for both syntax error and YYERROR. | | 2150 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
2205 | `-------------------------------------------------------------*/ | 2151 | `-------------------------------------------------------------*/ |
2206 | yyerrlab1: | 2152 | yyerrlab1: |
2207 | yyerrstatus = 3; /* Each real token shifted decrements this. */ | 2153 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
2208 | 2154 | ||
2209 | for (;;) | 2155 | for (;;) |
2210 | { | 2156 | { |
2211 | yyn = yypact[yystate]; | 2157 | yyn = yypact[yystate]; |
2212 | if (!yypact_value_is_default (yyn)) | 2158 | if (!yypact_value_is_default (yyn)) |
2213 | { | 2159 | { |
2214 | yyn += YYTERROR; | 2160 | yyn += YYTERROR; |
2215 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | 2161 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
2216 | { | 2162 | { |
2217 | yyn = yytable[yyn]; | 2163 | yyn = yytable[yyn]; |
2218 | if (0 < yyn) | 2164 | if (0 < yyn) |
2219 | break; | 2165 | break; |
2220 | } | 2166 | } |
2221 | } | 2167 | } |
2222 | 2168 | ||
2223 | /* Pop the current state because it cannot handle the error token. */ | 2169 | /* Pop the current state because it cannot handle the error token. */ |
2224 | if (yyssp == yyss) | 2170 | if (yyssp == yyss) |
2225 | YYABORT; | 2171 | YYABORT; |
2226 | |||
2227 | 2172 | ||
2173 | yyerror_range[1] = *yylsp; | ||
2228 | yydestruct ("Error: popping", | 2174 | yydestruct ("Error: popping", |
2229 | yystos[yystate], yyvsp); | 2175 | yystos[yystate], yyvsp, yylsp); |
2230 | YYPOPSTACK (1); | 2176 | YYPOPSTACK (1); |
2231 | yystate = *yyssp; | 2177 | yystate = *yyssp; |
2232 | YY_STACK_PRINT (yyss, yyssp); | 2178 | YY_STACK_PRINT (yyss, yyssp); |
@@ -2236,6 +2182,11 @@ yyerrlab1: | |||
2236 | *++yyvsp = yylval; | 2182 | *++yyvsp = yylval; |
2237 | YY_IGNORE_MAYBE_UNINITIALIZED_END | 2183 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
2238 | 2184 | ||
2185 | yyerror_range[2] = yylloc; | ||
2186 | /* Using YYLLOC is tempting, but would change the location of | ||
2187 | the lookahead. YYLOC is available though. */ | ||
2188 | YYLLOC_DEFAULT (yyloc, yyerror_range, 2); | ||
2189 | *++yylsp = yyloc; | ||
2239 | 2190 | ||
2240 | /* Shift the error token. */ | 2191 | /* Shift the error token. */ |
2241 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); | 2192 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
@@ -2275,16 +2226,16 @@ yyreturn: | |||
2275 | user semantic actions for why this is necessary. */ | 2226 | user semantic actions for why this is necessary. */ |
2276 | yytoken = YYTRANSLATE (yychar); | 2227 | yytoken = YYTRANSLATE (yychar); |
2277 | yydestruct ("Cleanup: discarding lookahead", | 2228 | yydestruct ("Cleanup: discarding lookahead", |
2278 | yytoken, &yylval); | 2229 | yytoken, &yylval, &yylloc); |
2279 | } | 2230 | } |
2280 | /* Do not reclaim the symbols of the rule which action triggered | 2231 | /* Do not reclaim the symbols of the rule whose action triggered |
2281 | this YYABORT or YYACCEPT. */ | 2232 | this YYABORT or YYACCEPT. */ |
2282 | YYPOPSTACK (yylen); | 2233 | YYPOPSTACK (yylen); |
2283 | YY_STACK_PRINT (yyss, yyssp); | 2234 | YY_STACK_PRINT (yyss, yyssp); |
2284 | while (yyssp != yyss) | 2235 | while (yyssp != yyss) |
2285 | { | 2236 | { |
2286 | yydestruct ("Cleanup: popping", | 2237 | yydestruct ("Cleanup: popping", |
2287 | yystos[*yyssp], yyvsp); | 2238 | yystos[*yyssp], yyvsp, yylsp); |
2288 | YYPOPSTACK (1); | 2239 | YYPOPSTACK (1); |
2289 | } | 2240 | } |
2290 | #ifndef yyoverflow | 2241 | #ifndef yyoverflow |
@@ -2295,72 +2246,12 @@ yyreturn: | |||
2295 | if (yymsg != yymsgbuf) | 2246 | if (yymsg != yymsgbuf) |
2296 | YYSTACK_FREE (yymsg); | 2247 | YYSTACK_FREE (yymsg); |
2297 | #endif | 2248 | #endif |
2298 | /* Make sure YYID is used. */ | 2249 | return yyresult; |
2299 | return YYID (yyresult); | ||
2300 | } | 2250 | } |
2251 | #line 472 "dtc-parser.y" /* yacc.c:1906 */ | ||
2301 | 2252 | ||
2302 | 2253 | ||
2303 | /* Line 2050 of yacc.c */ | 2254 | void yyerror(char const *s) |
2304 | #line 471 "dtc-parser.y" | ||
2305 | |||
2306 | |||
2307 | void print_error(char const *fmt, ...) | ||
2308 | { | ||
2309 | va_list va; | ||
2310 | |||
2311 | va_start(va, fmt); | ||
2312 | srcpos_verror(&yylloc, fmt, va); | ||
2313 | va_end(va); | ||
2314 | |||
2315 | treesource_error = 1; | ||
2316 | } | ||
2317 | |||
2318 | void yyerror(char const *s) { | ||
2319 | print_error("%s", s); | ||
2320 | } | ||
2321 | |||
2322 | static unsigned long long eval_literal(const char *s, int base, int bits) | ||
2323 | { | ||
2324 | unsigned long long val; | ||
2325 | char *e; | ||
2326 | |||
2327 | errno = 0; | ||
2328 | val = strtoull(s, &e, base); | ||
2329 | if (*e) { | ||
2330 | size_t uls = strspn(e, "UL"); | ||
2331 | if (e[uls]) | ||
2332 | print_error("bad characters in literal"); | ||
2333 | } | ||
2334 | if ((errno == ERANGE) | ||
2335 | || ((bits < 64) && (val >= (1ULL << bits)))) | ||
2336 | print_error("literal out of range"); | ||
2337 | else if (errno != 0) | ||
2338 | print_error("bad literal"); | ||
2339 | return val; | ||
2340 | } | ||
2341 | |||
2342 | static unsigned char eval_char_literal(const char *s) | ||
2343 | { | 2255 | { |
2344 | int i = 1; | 2256 | ERROR(&yylloc, "%s", s); |
2345 | char c = s[0]; | ||
2346 | |||
2347 | if (c == '\0') | ||
2348 | { | ||
2349 | print_error("empty character literal"); | ||
2350 | return 0; | ||
2351 | } | ||
2352 | |||
2353 | /* | ||
2354 | * If the first character in the character literal is a \ then process | ||
2355 | * the remaining characters as an escape encoding. If the first | ||
2356 | * character is neither an escape or a terminator it should be the only | ||
2357 | * character in the literal and will be returned. | ||
2358 | */ | ||
2359 | if (c == '\\') | ||
2360 | c = get_escape_char(s, &i); | ||
2361 | |||
2362 | if (s[i] != '\0') | ||
2363 | print_error("malformed character literal"); | ||
2364 | |||
2365 | return c; | ||
2366 | } | 2257 | } |
diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped index b2e7a86cd85e..30867c688300 100644 --- a/scripts/dtc/dtc-parser.tab.h_shipped +++ b/scripts/dtc/dtc-parser.tab.h_shipped | |||
@@ -1,19 +1,19 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.7.12-4996. */ | 1 | /* A Bison parser, made by GNU Bison 3.0.2. */ |
2 | 2 | ||
3 | /* Bison interface for Yacc-like parsers in C | 3 | /* Bison interface for Yacc-like parsers in C |
4 | 4 | ||
5 | Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. | 5 | Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. |
6 | 6 | ||
7 | This program is free software: you can redistribute it and/or modify | 7 | This program is free software: you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation, either version 3 of the License, or | 9 | the Free Software Foundation, either version 3 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
19 | 19 | ||
@@ -26,13 +26,13 @@ | |||
26 | special exception, which will cause the skeleton and the resulting | 26 | special exception, which will cause the skeleton and the resulting |
27 | Bison output files to be licensed under the GNU General Public | 27 | Bison output files to be licensed under the GNU General Public |
28 | License without this special exception. | 28 | License without this special exception. |
29 | 29 | ||
30 | This special exception was added by the Free Software Foundation in | 30 | This special exception was added by the Free Software Foundation in |
31 | version 2.2 of Bison. */ | 31 | version 2.2 of Bison. */ |
32 | 32 | ||
33 | #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED | 33 | #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED |
34 | # define YY_YY_DTC_PARSER_TAB_H_INCLUDED | 34 | # define YY_YY_DTC_PARSER_TAB_H_INCLUDED |
35 | /* Enabling traces. */ | 35 | /* Debug traces. */ |
36 | #ifndef YYDEBUG | 36 | #ifndef YYDEBUG |
37 | # define YYDEBUG 0 | 37 | # define YYDEBUG 0 |
38 | #endif | 38 | #endif |
@@ -40,48 +40,44 @@ | |||
40 | extern int yydebug; | 40 | extern int yydebug; |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | /* Tokens. */ | 43 | /* Token type. */ |
44 | #ifndef YYTOKENTYPE | 44 | #ifndef YYTOKENTYPE |
45 | # define YYTOKENTYPE | 45 | # define YYTOKENTYPE |
46 | /* Put the tokens into the symbol table, so that GDB and other debuggers | 46 | enum yytokentype |
47 | know about them. */ | 47 | { |
48 | enum yytokentype { | 48 | DT_V1 = 258, |
49 | DT_V1 = 258, | 49 | DT_MEMRESERVE = 259, |
50 | DT_MEMRESERVE = 259, | 50 | DT_LSHIFT = 260, |
51 | DT_LSHIFT = 260, | 51 | DT_RSHIFT = 261, |
52 | DT_RSHIFT = 261, | 52 | DT_LE = 262, |
53 | DT_LE = 262, | 53 | DT_GE = 263, |
54 | DT_GE = 263, | 54 | DT_EQ = 264, |
55 | DT_EQ = 264, | 55 | DT_NE = 265, |
56 | DT_NE = 265, | 56 | DT_AND = 266, |
57 | DT_AND = 266, | 57 | DT_OR = 267, |
58 | DT_OR = 267, | 58 | DT_BITS = 268, |
59 | DT_BITS = 268, | 59 | DT_DEL_PROP = 269, |
60 | DT_DEL_PROP = 269, | 60 | DT_DEL_NODE = 270, |
61 | DT_DEL_NODE = 270, | 61 | DT_PROPNODENAME = 271, |
62 | DT_PROPNODENAME = 271, | 62 | DT_LITERAL = 272, |
63 | DT_LITERAL = 272, | 63 | DT_CHAR_LITERAL = 273, |
64 | DT_CHAR_LITERAL = 273, | 64 | DT_BYTE = 274, |
65 | DT_BASE = 274, | 65 | DT_STRING = 275, |
66 | DT_BYTE = 275, | 66 | DT_LABEL = 276, |
67 | DT_STRING = 276, | 67 | DT_REF = 277, |
68 | DT_LABEL = 277, | 68 | DT_INCBIN = 278 |
69 | DT_REF = 278, | 69 | }; |
70 | DT_INCBIN = 279 | ||
71 | }; | ||
72 | #endif | 70 | #endif |
73 | 71 | ||
74 | 72 | /* Value type. */ | |
75 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | 73 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
76 | typedef union YYSTYPE | 74 | typedef union YYSTYPE YYSTYPE; |
75 | union YYSTYPE | ||
77 | { | 76 | { |
78 | /* Line 2053 of yacc.c */ | 77 | #line 38 "dtc-parser.y" /* yacc.c:1909 */ |
79 | #line 40 "dtc-parser.y" | ||
80 | 78 | ||
81 | char *propnodename; | 79 | char *propnodename; |
82 | char *literal; | ||
83 | char *labelref; | 80 | char *labelref; |
84 | unsigned int cbase; | ||
85 | uint8_t byte; | 81 | uint8_t byte; |
86 | struct data data; | 82 | struct data data; |
87 | 83 | ||
@@ -97,29 +93,29 @@ typedef union YYSTYPE | |||
97 | struct reserve_info *re; | 93 | struct reserve_info *re; |
98 | uint64_t integer; | 94 | uint64_t integer; |
99 | 95 | ||
100 | 96 | #line 97 "dtc-parser.tab.h" /* yacc.c:1909 */ | |
101 | /* Line 2053 of yacc.c */ | 97 | }; |
102 | #line 103 "dtc-parser.tab.h" | ||
103 | } YYSTYPE; | ||
104 | # define YYSTYPE_IS_TRIVIAL 1 | 98 | # define YYSTYPE_IS_TRIVIAL 1 |
105 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||
106 | # define YYSTYPE_IS_DECLARED 1 | 99 | # define YYSTYPE_IS_DECLARED 1 |
107 | #endif | 100 | #endif |
108 | 101 | ||
109 | extern YYSTYPE yylval; | 102 | /* Location type. */ |
110 | 103 | #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED | |
111 | #ifdef YYPARSE_PARAM | 104 | typedef struct YYLTYPE YYLTYPE; |
112 | #if defined __STDC__ || defined __cplusplus | 105 | struct YYLTYPE |
113 | int yyparse (void *YYPARSE_PARAM); | 106 | { |
114 | #else | 107 | int first_line; |
115 | int yyparse (); | 108 | int first_column; |
109 | int last_line; | ||
110 | int last_column; | ||
111 | }; | ||
112 | # define YYLTYPE_IS_DECLARED 1 | ||
113 | # define YYLTYPE_IS_TRIVIAL 1 | ||
116 | #endif | 114 | #endif |
117 | #else /* ! YYPARSE_PARAM */ | 115 | |
118 | #if defined __STDC__ || defined __cplusplus | 116 | |
117 | extern YYSTYPE yylval; | ||
118 | extern YYLTYPE yylloc; | ||
119 | int yyparse (void); | 119 | int yyparse (void); |
120 | #else | ||
121 | int yyparse (); | ||
122 | #endif | ||
123 | #endif /* ! YYPARSE_PARAM */ | ||
124 | 120 | ||
125 | #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ | 121 | #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ |
diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y index f412460f94d7..5a897e36562d 100644 --- a/scripts/dtc/dtc-parser.y +++ b/scripts/dtc/dtc-parser.y | |||
@@ -17,31 +17,27 @@ | |||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
18 | * USA | 18 | * USA |
19 | */ | 19 | */ |
20 | |||
21 | %{ | 20 | %{ |
22 | #include <stdio.h> | 21 | #include <stdio.h> |
23 | 22 | ||
24 | #include "dtc.h" | 23 | #include "dtc.h" |
25 | #include "srcpos.h" | 24 | #include "srcpos.h" |
26 | 25 | ||
27 | YYLTYPE yylloc; | ||
28 | |||
29 | extern int yylex(void); | 26 | extern int yylex(void); |
30 | extern void print_error(char const *fmt, ...); | ||
31 | extern void yyerror(char const *s); | 27 | extern void yyerror(char const *s); |
28 | #define ERROR(loc, ...) \ | ||
29 | do { \ | ||
30 | srcpos_error((loc), "Error", __VA_ARGS__); \ | ||
31 | treesource_error = true; \ | ||
32 | } while (0) | ||
32 | 33 | ||
33 | extern struct boot_info *the_boot_info; | 34 | extern struct boot_info *the_boot_info; |
34 | extern int treesource_error; | 35 | extern bool treesource_error; |
35 | |||
36 | static unsigned long long eval_literal(const char *s, int base, int bits); | ||
37 | static unsigned char eval_char_literal(const char *s); | ||
38 | %} | 36 | %} |
39 | 37 | ||
40 | %union { | 38 | %union { |
41 | char *propnodename; | 39 | char *propnodename; |
42 | char *literal; | ||
43 | char *labelref; | 40 | char *labelref; |
44 | unsigned int cbase; | ||
45 | uint8_t byte; | 41 | uint8_t byte; |
46 | struct data data; | 42 | struct data data; |
47 | 43 | ||
@@ -65,9 +61,8 @@ static unsigned char eval_char_literal(const char *s); | |||
65 | %token DT_DEL_PROP | 61 | %token DT_DEL_PROP |
66 | %token DT_DEL_NODE | 62 | %token DT_DEL_NODE |
67 | %token <propnodename> DT_PROPNODENAME | 63 | %token <propnodename> DT_PROPNODENAME |
68 | %token <literal> DT_LITERAL | 64 | %token <integer> DT_LITERAL |
69 | %token <literal> DT_CHAR_LITERAL | 65 | %token <integer> DT_CHAR_LITERAL |
70 | %token <cbase> DT_BASE | ||
71 | %token <byte> DT_BYTE | 66 | %token <byte> DT_BYTE |
72 | %token <data> DT_STRING | 67 | %token <data> DT_STRING |
73 | %token <labelref> DT_LABEL | 68 | %token <labelref> DT_LABEL |
@@ -145,6 +140,18 @@ devicetree: | |||
145 | { | 140 | { |
146 | $$ = merge_nodes($1, $3); | 141 | $$ = merge_nodes($1, $3); |
147 | } | 142 | } |
143 | |||
144 | | devicetree DT_LABEL DT_REF nodedef | ||
145 | { | ||
146 | struct node *target = get_node_by_ref($1, $3); | ||
147 | |||
148 | add_label(&target->labels, $2); | ||
149 | if (target) | ||
150 | merge_nodes(target, $4); | ||
151 | else | ||
152 | ERROR(&@3, "Label or path %s not found", $3); | ||
153 | $$ = $1; | ||
154 | } | ||
148 | | devicetree DT_REF nodedef | 155 | | devicetree DT_REF nodedef |
149 | { | 156 | { |
150 | struct node *target = get_node_by_ref($1, $2); | 157 | struct node *target = get_node_by_ref($1, $2); |
@@ -152,17 +159,18 @@ devicetree: | |||
152 | if (target) | 159 | if (target) |
153 | merge_nodes(target, $3); | 160 | merge_nodes(target, $3); |
154 | else | 161 | else |
155 | print_error("label or path, '%s', not found", $2); | 162 | ERROR(&@2, "Label or path %s not found", $2); |
156 | $$ = $1; | 163 | $$ = $1; |
157 | } | 164 | } |
158 | | devicetree DT_DEL_NODE DT_REF ';' | 165 | | devicetree DT_DEL_NODE DT_REF ';' |
159 | { | 166 | { |
160 | struct node *target = get_node_by_ref($1, $3); | 167 | struct node *target = get_node_by_ref($1, $3); |
161 | 168 | ||
162 | if (!target) | 169 | if (target) |
163 | print_error("label or path, '%s', not found", $3); | ||
164 | else | ||
165 | delete_node(target); | 170 | delete_node(target); |
171 | else | ||
172 | ERROR(&@3, "Label or path %s not found", $3); | ||
173 | |||
166 | 174 | ||
167 | $$ = $1; | 175 | $$ = $1; |
168 | } | 176 | } |
@@ -230,10 +238,9 @@ propdata: | |||
230 | 238 | ||
231 | if ($6 != 0) | 239 | if ($6 != 0) |
232 | if (fseek(f, $6, SEEK_SET) != 0) | 240 | if (fseek(f, $6, SEEK_SET) != 0) |
233 | print_error("Couldn't seek to offset %llu in \"%s\": %s", | 241 | die("Couldn't seek to offset %llu in \"%s\": %s", |
234 | (unsigned long long)$6, | 242 | (unsigned long long)$6, $4.val, |
235 | $4.val, | 243 | strerror(errno)); |
236 | strerror(errno)); | ||
237 | 244 | ||
238 | d = data_copy_file(f, $8); | 245 | d = data_copy_file(f, $8); |
239 | 246 | ||
@@ -274,18 +281,19 @@ propdataprefix: | |||
274 | arrayprefix: | 281 | arrayprefix: |
275 | DT_BITS DT_LITERAL '<' | 282 | DT_BITS DT_LITERAL '<' |
276 | { | 283 | { |
277 | $$.data = empty_data; | 284 | unsigned long long bits; |
278 | $$.bits = eval_literal($2, 0, 7); | 285 | |
279 | 286 | bits = $2; | |
280 | if (($$.bits != 8) && | 287 | |
281 | ($$.bits != 16) && | 288 | if ((bits != 8) && (bits != 16) && |
282 | ($$.bits != 32) && | 289 | (bits != 32) && (bits != 64)) { |
283 | ($$.bits != 64)) | 290 | ERROR(&@2, "Array elements must be" |
284 | { | 291 | " 8, 16, 32 or 64-bits"); |
285 | print_error("Only 8, 16, 32 and 64-bit elements" | 292 | bits = 32; |
286 | " are currently supported"); | ||
287 | $$.bits = 32; | ||
288 | } | 293 | } |
294 | |||
295 | $$.data = empty_data; | ||
296 | $$.bits = bits; | ||
289 | } | 297 | } |
290 | | '<' | 298 | | '<' |
291 | { | 299 | { |
@@ -305,9 +313,8 @@ arrayprefix: | |||
305 | * mask), all bits are one. | 313 | * mask), all bits are one. |
306 | */ | 314 | */ |
307 | if (($2 > mask) && (($2 | mask) != -1ULL)) | 315 | if (($2 > mask) && (($2 | mask) != -1ULL)) |
308 | print_error( | 316 | ERROR(&@2, "Value out of range for" |
309 | "integer value out of range " | 317 | " %d-bit array element", $1.bits); |
310 | "%016lx (%d bits)", $1.bits); | ||
311 | } | 318 | } |
312 | 319 | ||
313 | $$.data = data_append_integer($1.data, $2, $1.bits); | 320 | $$.data = data_append_integer($1.data, $2, $1.bits); |
@@ -321,7 +328,7 @@ arrayprefix: | |||
321 | REF_PHANDLE, | 328 | REF_PHANDLE, |
322 | $2); | 329 | $2); |
323 | else | 330 | else |
324 | print_error("References are only allowed in " | 331 | ERROR(&@2, "References are only allowed in " |
325 | "arrays with 32-bit elements."); | 332 | "arrays with 32-bit elements."); |
326 | 333 | ||
327 | $$.data = data_append_integer($1.data, val, $1.bits); | 334 | $$.data = data_append_integer($1.data, val, $1.bits); |
@@ -334,13 +341,7 @@ arrayprefix: | |||
334 | 341 | ||
335 | integer_prim: | 342 | integer_prim: |
336 | DT_LITERAL | 343 | DT_LITERAL |
337 | { | ||
338 | $$ = eval_literal($1, 0, 64); | ||
339 | } | ||
340 | | DT_CHAR_LITERAL | 344 | | DT_CHAR_LITERAL |
341 | { | ||
342 | $$ = eval_char_literal($1); | ||
343 | } | ||
344 | | '(' integer_expr ')' | 345 | | '(' integer_expr ')' |
345 | { | 346 | { |
346 | $$ = $2; | 347 | $$ = $2; |
@@ -447,7 +448,7 @@ subnodes: | |||
447 | } | 448 | } |
448 | | subnode propdef | 449 | | subnode propdef |
449 | { | 450 | { |
450 | print_error("syntax error: properties must precede subnodes"); | 451 | ERROR(&@2, "Properties must precede subnodes"); |
451 | YYERROR; | 452 | YYERROR; |
452 | } | 453 | } |
453 | ; | 454 | ; |
@@ -470,63 +471,7 @@ subnode: | |||
470 | 471 | ||
471 | %% | 472 | %% |
472 | 473 | ||
473 | void print_error(char const *fmt, ...) | 474 | void yyerror(char const *s) |
474 | { | ||
475 | va_list va; | ||
476 | |||
477 | va_start(va, fmt); | ||
478 | srcpos_verror(&yylloc, fmt, va); | ||
479 | va_end(va); | ||
480 | |||
481 | treesource_error = 1; | ||
482 | } | ||
483 | |||
484 | void yyerror(char const *s) { | ||
485 | print_error("%s", s); | ||
486 | } | ||
487 | |||
488 | static unsigned long long eval_literal(const char *s, int base, int bits) | ||
489 | { | ||
490 | unsigned long long val; | ||
491 | char *e; | ||
492 | |||
493 | errno = 0; | ||
494 | val = strtoull(s, &e, base); | ||
495 | if (*e) { | ||
496 | size_t uls = strspn(e, "UL"); | ||
497 | if (e[uls]) | ||
498 | print_error("bad characters in literal"); | ||
499 | } | ||
500 | if ((errno == ERANGE) | ||
501 | || ((bits < 64) && (val >= (1ULL << bits)))) | ||
502 | print_error("literal out of range"); | ||
503 | else if (errno != 0) | ||
504 | print_error("bad literal"); | ||
505 | return val; | ||
506 | } | ||
507 | |||
508 | static unsigned char eval_char_literal(const char *s) | ||
509 | { | 475 | { |
510 | int i = 1; | 476 | ERROR(&yylloc, "%s", s); |
511 | char c = s[0]; | ||
512 | |||
513 | if (c == '\0') | ||
514 | { | ||
515 | print_error("empty character literal"); | ||
516 | return 0; | ||
517 | } | ||
518 | |||
519 | /* | ||
520 | * If the first character in the character literal is a \ then process | ||
521 | * the remaining characters as an escape encoding. If the first | ||
522 | * character is neither an escape or a terminator it should be the only | ||
523 | * character in the literal and will be returned. | ||
524 | */ | ||
525 | if (c == '\\') | ||
526 | c = get_escape_char(s, &i); | ||
527 | |||
528 | if (s[i] != '\0') | ||
529 | print_error("malformed character literal"); | ||
530 | |||
531 | return c; | ||
532 | } | 477 | } |
diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c index e3c96536fd9d..8c4add69a765 100644 --- a/scripts/dtc/dtc.c +++ b/scripts/dtc/dtc.c | |||
@@ -48,6 +48,8 @@ static void fill_fullpaths(struct node *tree, const char *prefix) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | /* Usage related data. */ | 50 | /* Usage related data. */ |
51 | #define FDT_VERSION(version) _FDT_VERSION(version) | ||
52 | #define _FDT_VERSION(version) #version | ||
51 | static const char usage_synopsis[] = "dtc [options] <input file>"; | 53 | static const char usage_synopsis[] = "dtc [options] <input file>"; |
52 | static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv"; | 54 | static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv"; |
53 | static struct option const usage_long_opts[] = { | 55 | static struct option const usage_long_opts[] = { |
@@ -82,9 +84,9 @@ static const char * const usage_opts_help[] = { | |||
82 | "\t\tdts - device tree source text\n" | 84 | "\t\tdts - device tree source text\n" |
83 | "\t\tdtb - device tree blob\n" | 85 | "\t\tdtb - device tree blob\n" |
84 | "\t\tasm - assembler source", | 86 | "\t\tasm - assembler source", |
85 | "\n\tBlob version to produce, defaults to %d (for dtb and asm output)", //, DEFAULT_FDT_VERSION); | 87 | "\n\tBlob version to produce, defaults to "FDT_VERSION(DEFAULT_FDT_VERSION)" (for dtb and asm output)", |
86 | "\n\tOutput dependency file", | 88 | "\n\tOutput dependency file", |
87 | "\n\ttMake space for <number> reserve map entries (for dtb and asm output)", | 89 | "\n\tMake space for <number> reserve map entries (for dtb and asm output)", |
88 | "\n\tMake the blob at least <bytes> long (extra space)", | 90 | "\n\tMake the blob at least <bytes> long (extra space)", |
89 | "\n\tAdd padding to the blob of <bytes> long (extra space)", | 91 | "\n\tAdd padding to the blob of <bytes> long (extra space)", |
90 | "\n\tSet the physical boot cpu", | 92 | "\n\tSet the physical boot cpu", |
@@ -109,7 +111,7 @@ int main(int argc, char *argv[]) | |||
109 | const char *outform = "dts"; | 111 | const char *outform = "dts"; |
110 | const char *outname = "-"; | 112 | const char *outname = "-"; |
111 | const char *depname = NULL; | 113 | const char *depname = NULL; |
112 | int force = 0, sort = 0; | 114 | bool force = false, sort = false; |
113 | const char *arg; | 115 | const char *arg; |
114 | int opt; | 116 | int opt; |
115 | FILE *outf = NULL; | 117 | FILE *outf = NULL; |
@@ -148,7 +150,7 @@ int main(int argc, char *argv[]) | |||
148 | padsize = strtol(optarg, NULL, 0); | 150 | padsize = strtol(optarg, NULL, 0); |
149 | break; | 151 | break; |
150 | case 'f': | 152 | case 'f': |
151 | force = 1; | 153 | force = true; |
152 | break; | 154 | break; |
153 | case 'q': | 155 | case 'q': |
154 | quiet++; | 156 | quiet++; |
@@ -174,7 +176,7 @@ int main(int argc, char *argv[]) | |||
174 | break; | 176 | break; |
175 | 177 | ||
176 | case 's': | 178 | case 's': |
177 | sort = 1; | 179 | sort = true; |
178 | break; | 180 | break; |
179 | 181 | ||
180 | case 'W': | 182 | case 'W': |
@@ -237,7 +239,7 @@ int main(int argc, char *argv[]) | |||
237 | if (streq(outname, "-")) { | 239 | if (streq(outname, "-")) { |
238 | outf = stdout; | 240 | outf = stdout; |
239 | } else { | 241 | } else { |
240 | outf = fopen(outname, "w"); | 242 | outf = fopen(outname, "wb"); |
241 | if (! outf) | 243 | if (! outf) |
242 | die("Couldn't open output file %s: %s\n", | 244 | die("Couldn't open output file %s: %s\n", |
243 | outname, strerror(errno)); | 245 | outname, strerror(errno)); |
diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h index 264a20cf66a8..56212c8df660 100644 --- a/scripts/dtc/dtc.h +++ b/scripts/dtc/dtc.h | |||
@@ -38,9 +38,9 @@ | |||
38 | #include "util.h" | 38 | #include "util.h" |
39 | 39 | ||
40 | #ifdef DEBUG | 40 | #ifdef DEBUG |
41 | #define debug(fmt,args...) printf(fmt, ##args) | 41 | #define debug(...) printf(__VA_ARGS__) |
42 | #else | 42 | #else |
43 | #define debug(fmt,args...) | 43 | #define debug(...) |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | 46 | ||
@@ -88,7 +88,7 @@ struct data { | |||
88 | }; | 88 | }; |
89 | 89 | ||
90 | 90 | ||
91 | #define empty_data ((struct data){ /* all .members = 0 or NULL */ }) | 91 | #define empty_data ((struct data){ 0 /* all .members = 0 or NULL */ }) |
92 | 92 | ||
93 | #define for_each_marker(m) \ | 93 | #define for_each_marker(m) \ |
94 | for (; (m); (m) = (m)->next) | 94 | for (; (m); (m) = (m)->next) |
@@ -118,7 +118,7 @@ struct data data_append_align(struct data d, int align); | |||
118 | 118 | ||
119 | struct data data_add_marker(struct data d, enum markertype type, char *ref); | 119 | struct data data_add_marker(struct data d, enum markertype type, char *ref); |
120 | 120 | ||
121 | int data_is_one_string(struct data d); | 121 | bool data_is_one_string(struct data d); |
122 | 122 | ||
123 | /* DT constraints */ | 123 | /* DT constraints */ |
124 | 124 | ||
@@ -127,13 +127,13 @@ int data_is_one_string(struct data d); | |||
127 | 127 | ||
128 | /* Live trees */ | 128 | /* Live trees */ |
129 | struct label { | 129 | struct label { |
130 | int deleted; | 130 | bool deleted; |
131 | char *label; | 131 | char *label; |
132 | struct label *next; | 132 | struct label *next; |
133 | }; | 133 | }; |
134 | 134 | ||
135 | struct property { | 135 | struct property { |
136 | int deleted; | 136 | bool deleted; |
137 | char *name; | 137 | char *name; |
138 | struct data val; | 138 | struct data val; |
139 | 139 | ||
@@ -143,7 +143,7 @@ struct property { | |||
143 | }; | 143 | }; |
144 | 144 | ||
145 | struct node { | 145 | struct node { |
146 | int deleted; | 146 | bool deleted; |
147 | char *name; | 147 | char *name; |
148 | struct property *proplist; | 148 | struct property *proplist; |
149 | struct node *children; | 149 | struct node *children; |
@@ -247,8 +247,8 @@ void sort_tree(struct boot_info *bi); | |||
247 | 247 | ||
248 | /* Checks */ | 248 | /* Checks */ |
249 | 249 | ||
250 | void parse_checks_option(bool warn, bool error, const char *optarg); | 250 | void parse_checks_option(bool warn, bool error, const char *arg); |
251 | void process_checks(int force, struct boot_info *bi); | 251 | void process_checks(bool force, struct boot_info *bi); |
252 | 252 | ||
253 | /* Flattened trees */ | 253 | /* Flattened trees */ |
254 | 254 | ||
diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c index 665dad7bb465..bd99fa2d33b8 100644 --- a/scripts/dtc/flattree.c +++ b/scripts/dtc/flattree.c | |||
@@ -261,7 +261,7 @@ static void flatten_tree(struct node *tree, struct emitter *emit, | |||
261 | { | 261 | { |
262 | struct property *prop; | 262 | struct property *prop; |
263 | struct node *child; | 263 | struct node *child; |
264 | int seen_name_prop = 0; | 264 | bool seen_name_prop = false; |
265 | 265 | ||
266 | if (tree->deleted) | 266 | if (tree->deleted) |
267 | return; | 267 | return; |
@@ -279,7 +279,7 @@ static void flatten_tree(struct node *tree, struct emitter *emit, | |||
279 | int nameoff; | 279 | int nameoff; |
280 | 280 | ||
281 | if (streq(prop->name, "name")) | 281 | if (streq(prop->name, "name")) |
282 | seen_name_prop = 1; | 282 | seen_name_prop = true; |
283 | 283 | ||
284 | nameoff = stringtable_insert(strbuf, prop->name); | 284 | nameoff = stringtable_insert(strbuf, prop->name); |
285 | 285 | ||
diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c index e464727c8808..6d1beec9581d 100644 --- a/scripts/dtc/fstree.c +++ b/scripts/dtc/fstree.c | |||
@@ -37,26 +37,26 @@ static struct node *read_fstree(const char *dirname) | |||
37 | tree = build_node(NULL, NULL); | 37 | tree = build_node(NULL, NULL); |
38 | 38 | ||
39 | while ((de = readdir(d)) != NULL) { | 39 | while ((de = readdir(d)) != NULL) { |
40 | char *tmpnam; | 40 | char *tmpname; |
41 | 41 | ||
42 | if (streq(de->d_name, ".") | 42 | if (streq(de->d_name, ".") |
43 | || streq(de->d_name, "..")) | 43 | || streq(de->d_name, "..")) |
44 | continue; | 44 | continue; |
45 | 45 | ||
46 | tmpnam = join_path(dirname, de->d_name); | 46 | tmpname = join_path(dirname, de->d_name); |
47 | 47 | ||
48 | if (lstat(tmpnam, &st) < 0) | 48 | if (lstat(tmpname, &st) < 0) |
49 | die("stat(%s): %s\n", tmpnam, strerror(errno)); | 49 | die("stat(%s): %s\n", tmpname, strerror(errno)); |
50 | 50 | ||
51 | if (S_ISREG(st.st_mode)) { | 51 | if (S_ISREG(st.st_mode)) { |
52 | struct property *prop; | 52 | struct property *prop; |
53 | FILE *pfile; | 53 | FILE *pfile; |
54 | 54 | ||
55 | pfile = fopen(tmpnam, "r"); | 55 | pfile = fopen(tmpname, "rb"); |
56 | if (! pfile) { | 56 | if (! pfile) { |
57 | fprintf(stderr, | 57 | fprintf(stderr, |
58 | "WARNING: Cannot open %s: %s\n", | 58 | "WARNING: Cannot open %s: %s\n", |
59 | tmpnam, strerror(errno)); | 59 | tmpname, strerror(errno)); |
60 | } else { | 60 | } else { |
61 | prop = build_property(xstrdup(de->d_name), | 61 | prop = build_property(xstrdup(de->d_name), |
62 | data_copy_file(pfile, | 62 | data_copy_file(pfile, |
@@ -67,12 +67,12 @@ static struct node *read_fstree(const char *dirname) | |||
67 | } else if (S_ISDIR(st.st_mode)) { | 67 | } else if (S_ISDIR(st.st_mode)) { |
68 | struct node *newchild; | 68 | struct node *newchild; |
69 | 69 | ||
70 | newchild = read_fstree(tmpnam); | 70 | newchild = read_fstree(tmpname); |
71 | newchild = name_node(newchild, xstrdup(de->d_name)); | 71 | newchild = name_node(newchild, xstrdup(de->d_name)); |
72 | add_child(tree, newchild); | 72 | add_child(tree, newchild); |
73 | } | 73 | } |
74 | 74 | ||
75 | free(tmpnam); | 75 | free(tmpname); |
76 | } | 76 | } |
77 | 77 | ||
78 | closedir(d); | 78 | closedir(d); |
@@ -88,3 +88,4 @@ struct boot_info *dt_from_fs(const char *dirname) | |||
88 | 88 | ||
89 | return build_boot_info(NULL, tree, guess_boot_cpuid(tree)); | 89 | return build_boot_info(NULL, tree, guess_boot_cpuid(tree)); |
90 | } | 90 | } |
91 | |||
diff --git a/scripts/dtc/libfdt/Makefile.libfdt b/scripts/dtc/libfdt/Makefile.libfdt index 91126c000a1e..09c322ed82ba 100644 --- a/scripts/dtc/libfdt/Makefile.libfdt +++ b/scripts/dtc/libfdt/Makefile.libfdt | |||
@@ -6,5 +6,6 @@ | |||
6 | LIBFDT_soname = libfdt.$(SHAREDLIB_EXT).1 | 6 | LIBFDT_soname = libfdt.$(SHAREDLIB_EXT).1 |
7 | LIBFDT_INCLUDES = fdt.h libfdt.h libfdt_env.h | 7 | LIBFDT_INCLUDES = fdt.h libfdt.h libfdt_env.h |
8 | LIBFDT_VERSION = version.lds | 8 | LIBFDT_VERSION = version.lds |
9 | LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c fdt_empty_tree.c | 9 | LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c fdt_empty_tree.c \ |
10 | fdt_addresses.c | ||
10 | LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o) | 11 | LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o) |
diff --git a/scripts/dtc/libfdt/fdt.c b/scripts/dtc/libfdt/fdt.c index e56833ae9b6f..2ce6a44179de 100644 --- a/scripts/dtc/libfdt/fdt.c +++ b/scripts/dtc/libfdt/fdt.c | |||
@@ -92,7 +92,7 @@ const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int len) | |||
92 | 92 | ||
93 | uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset) | 93 | uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset) |
94 | { | 94 | { |
95 | const uint32_t *tagp, *lenp; | 95 | const fdt32_t *tagp, *lenp; |
96 | uint32_t tag; | 96 | uint32_t tag; |
97 | int offset = startoffset; | 97 | int offset = startoffset; |
98 | const char *p; | 98 | const char *p; |
@@ -198,6 +198,34 @@ int fdt_next_node(const void *fdt, int offset, int *depth) | |||
198 | return offset; | 198 | return offset; |
199 | } | 199 | } |
200 | 200 | ||
201 | int fdt_first_subnode(const void *fdt, int offset) | ||
202 | { | ||
203 | int depth = 0; | ||
204 | |||
205 | offset = fdt_next_node(fdt, offset, &depth); | ||
206 | if (offset < 0 || depth != 1) | ||
207 | return -FDT_ERR_NOTFOUND; | ||
208 | |||
209 | return offset; | ||
210 | } | ||
211 | |||
212 | int fdt_next_subnode(const void *fdt, int offset) | ||
213 | { | ||
214 | int depth = 1; | ||
215 | |||
216 | /* | ||
217 | * With respect to the parent, the depth of the next subnode will be | ||
218 | * the same as the last. | ||
219 | */ | ||
220 | do { | ||
221 | offset = fdt_next_node(fdt, offset, &depth); | ||
222 | if (offset < 0 || depth < 1) | ||
223 | return -FDT_ERR_NOTFOUND; | ||
224 | } while (depth > 1); | ||
225 | |||
226 | return offset; | ||
227 | } | ||
228 | |||
201 | const char *_fdt_find_string(const char *strtab, int tabsize, const char *s) | 229 | const char *_fdt_find_string(const char *strtab, int tabsize, const char *s) |
202 | { | 230 | { |
203 | int len = strlen(s) + 1; | 231 | int len = strlen(s) + 1; |
diff --git a/scripts/dtc/libfdt/fdt.h b/scripts/dtc/libfdt/fdt.h index 48ccfd910000..526aedb51556 100644 --- a/scripts/dtc/libfdt/fdt.h +++ b/scripts/dtc/libfdt/fdt.h | |||
@@ -1,48 +1,99 @@ | |||
1 | #ifndef _FDT_H | 1 | #ifndef _FDT_H |
2 | #define _FDT_H | 2 | #define _FDT_H |
3 | /* | ||
4 | * libfdt - Flat Device Tree manipulation | ||
5 | * Copyright (C) 2006 David Gibson, IBM Corporation. | ||
6 | * Copyright 2012 Kim Phillips, Freescale Semiconductor. | ||
7 | * | ||
8 | * libfdt is dual licensed: you can use it either under the terms of | ||
9 | * the GPL, or the BSD license, at your option. | ||
10 | * | ||
11 | * a) This library is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License as | ||
13 | * published by the Free Software Foundation; either version 2 of the | ||
14 | * License, or (at your option) any later version. | ||
15 | * | ||
16 | * This library is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public | ||
22 | * License along with this library; if not, write to the Free | ||
23 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, | ||
24 | * MA 02110-1301 USA | ||
25 | * | ||
26 | * Alternatively, | ||
27 | * | ||
28 | * b) Redistribution and use in source and binary forms, with or | ||
29 | * without modification, are permitted provided that the following | ||
30 | * conditions are met: | ||
31 | * | ||
32 | * 1. Redistributions of source code must retain the above | ||
33 | * copyright notice, this list of conditions and the following | ||
34 | * disclaimer. | ||
35 | * 2. Redistributions in binary form must reproduce the above | ||
36 | * copyright notice, this list of conditions and the following | ||
37 | * disclaimer in the documentation and/or other materials | ||
38 | * provided with the distribution. | ||
39 | * | ||
40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
44 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
45 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
46 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
47 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
48 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
49 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
50 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
51 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
52 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
53 | */ | ||
3 | 54 | ||
4 | #ifndef __ASSEMBLY__ | 55 | #ifndef __ASSEMBLY__ |
5 | 56 | ||
6 | struct fdt_header { | 57 | struct fdt_header { |
7 | uint32_t magic; /* magic word FDT_MAGIC */ | 58 | fdt32_t magic; /* magic word FDT_MAGIC */ |
8 | uint32_t totalsize; /* total size of DT block */ | 59 | fdt32_t totalsize; /* total size of DT block */ |
9 | uint32_t off_dt_struct; /* offset to structure */ | 60 | fdt32_t off_dt_struct; /* offset to structure */ |
10 | uint32_t off_dt_strings; /* offset to strings */ | 61 | fdt32_t off_dt_strings; /* offset to strings */ |
11 | uint32_t off_mem_rsvmap; /* offset to memory reserve map */ | 62 | fdt32_t off_mem_rsvmap; /* offset to memory reserve map */ |
12 | uint32_t version; /* format version */ | 63 | fdt32_t version; /* format version */ |
13 | uint32_t last_comp_version; /* last compatible version */ | 64 | fdt32_t last_comp_version; /* last compatible version */ |
14 | 65 | ||
15 | /* version 2 fields below */ | 66 | /* version 2 fields below */ |
16 | uint32_t boot_cpuid_phys; /* Which physical CPU id we're | 67 | fdt32_t boot_cpuid_phys; /* Which physical CPU id we're |
17 | booting on */ | 68 | booting on */ |
18 | /* version 3 fields below */ | 69 | /* version 3 fields below */ |
19 | uint32_t size_dt_strings; /* size of the strings block */ | 70 | fdt32_t size_dt_strings; /* size of the strings block */ |
20 | 71 | ||
21 | /* version 17 fields below */ | 72 | /* version 17 fields below */ |
22 | uint32_t size_dt_struct; /* size of the structure block */ | 73 | fdt32_t size_dt_struct; /* size of the structure block */ |
23 | }; | 74 | }; |
24 | 75 | ||
25 | struct fdt_reserve_entry { | 76 | struct fdt_reserve_entry { |
26 | uint64_t address; | 77 | fdt64_t address; |
27 | uint64_t size; | 78 | fdt64_t size; |
28 | }; | 79 | }; |
29 | 80 | ||
30 | struct fdt_node_header { | 81 | struct fdt_node_header { |
31 | uint32_t tag; | 82 | fdt32_t tag; |
32 | char name[0]; | 83 | char name[0]; |
33 | }; | 84 | }; |
34 | 85 | ||
35 | struct fdt_property { | 86 | struct fdt_property { |
36 | uint32_t tag; | 87 | fdt32_t tag; |
37 | uint32_t len; | 88 | fdt32_t len; |
38 | uint32_t nameoff; | 89 | fdt32_t nameoff; |
39 | char data[0]; | 90 | char data[0]; |
40 | }; | 91 | }; |
41 | 92 | ||
42 | #endif /* !__ASSEMBLY */ | 93 | #endif /* !__ASSEMBLY */ |
43 | 94 | ||
44 | #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ | 95 | #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ |
45 | #define FDT_TAGSIZE sizeof(uint32_t) | 96 | #define FDT_TAGSIZE sizeof(fdt32_t) |
46 | 97 | ||
47 | #define FDT_BEGIN_NODE 0x1 /* Start node: full name */ | 98 | #define FDT_BEGIN_NODE 0x1 /* Start node: full name */ |
48 | #define FDT_END_NODE 0x2 /* End node */ | 99 | #define FDT_END_NODE 0x2 /* End node */ |
@@ -51,10 +102,10 @@ struct fdt_property { | |||
51 | #define FDT_NOP 0x4 /* nop */ | 102 | #define FDT_NOP 0x4 /* nop */ |
52 | #define FDT_END 0x9 | 103 | #define FDT_END 0x9 |
53 | 104 | ||
54 | #define FDT_V1_SIZE (7*sizeof(uint32_t)) | 105 | #define FDT_V1_SIZE (7*sizeof(fdt32_t)) |
55 | #define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(uint32_t)) | 106 | #define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(fdt32_t)) |
56 | #define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(uint32_t)) | 107 | #define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(fdt32_t)) |
57 | #define FDT_V16_SIZE FDT_V3_SIZE | 108 | #define FDT_V16_SIZE FDT_V3_SIZE |
58 | #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(uint32_t)) | 109 | #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(fdt32_t)) |
59 | 110 | ||
60 | #endif /* _FDT_H */ | 111 | #endif /* _FDT_H */ |
diff --git a/scripts/dtc/libfdt/fdt_empty_tree.c b/scripts/dtc/libfdt/fdt_empty_tree.c index f2ae9b77c285..f72d13b1d19c 100644 --- a/scripts/dtc/libfdt/fdt_empty_tree.c +++ b/scripts/dtc/libfdt/fdt_empty_tree.c | |||
@@ -81,3 +81,4 @@ int fdt_create_empty_tree(void *buf, int bufsize) | |||
81 | 81 | ||
82 | return fdt_open_into(buf, buf, bufsize); | 82 | return fdt_open_into(buf, buf, bufsize); |
83 | } | 83 | } |
84 | |||
diff --git a/scripts/dtc/libfdt/fdt_ro.c b/scripts/dtc/libfdt/fdt_ro.c index 02b6d687537f..a65e4b5b72b6 100644 --- a/scripts/dtc/libfdt/fdt_ro.c +++ b/scripts/dtc/libfdt/fdt_ro.c | |||
@@ -154,9 +154,9 @@ int fdt_subnode_offset(const void *fdt, int parentoffset, | |||
154 | return fdt_subnode_offset_namelen(fdt, parentoffset, name, strlen(name)); | 154 | return fdt_subnode_offset_namelen(fdt, parentoffset, name, strlen(name)); |
155 | } | 155 | } |
156 | 156 | ||
157 | int fdt_path_offset(const void *fdt, const char *path) | 157 | int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen) |
158 | { | 158 | { |
159 | const char *end = path + strlen(path); | 159 | const char *end = path + namelen; |
160 | const char *p = path; | 160 | const char *p = path; |
161 | int offset = 0; | 161 | int offset = 0; |
162 | 162 | ||
@@ -164,7 +164,7 @@ int fdt_path_offset(const void *fdt, const char *path) | |||
164 | 164 | ||
165 | /* see if we have an alias */ | 165 | /* see if we have an alias */ |
166 | if (*path != '/') { | 166 | if (*path != '/') { |
167 | const char *q = strchr(path, '/'); | 167 | const char *q = memchr(path, '/', end - p); |
168 | 168 | ||
169 | if (!q) | 169 | if (!q) |
170 | q = end; | 170 | q = end; |
@@ -177,14 +177,15 @@ int fdt_path_offset(const void *fdt, const char *path) | |||
177 | p = q; | 177 | p = q; |
178 | } | 178 | } |
179 | 179 | ||
180 | while (*p) { | 180 | while (p < end) { |
181 | const char *q; | 181 | const char *q; |
182 | 182 | ||
183 | while (*p == '/') | 183 | while (*p == '/') { |
184 | p++; | 184 | p++; |
185 | if (! *p) | 185 | if (p == end) |
186 | return offset; | 186 | return offset; |
187 | q = strchr(p, '/'); | 187 | } |
188 | q = memchr(p, '/', end - p); | ||
188 | if (! q) | 189 | if (! q) |
189 | q = end; | 190 | q = end; |
190 | 191 | ||
@@ -198,6 +199,11 @@ int fdt_path_offset(const void *fdt, const char *path) | |||
198 | return offset; | 199 | return offset; |
199 | } | 200 | } |
200 | 201 | ||
202 | int fdt_path_offset(const void *fdt, const char *path) | ||
203 | { | ||
204 | return fdt_path_offset_namelen(fdt, path, strlen(path)); | ||
205 | } | ||
206 | |||
201 | const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) | 207 | const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) |
202 | { | 208 | { |
203 | const struct fdt_node_header *nh = _fdt_offset_ptr(fdt, nodeoffset); | 209 | const struct fdt_node_header *nh = _fdt_offset_ptr(fdt, nodeoffset); |
@@ -322,7 +328,7 @@ const void *fdt_getprop(const void *fdt, int nodeoffset, | |||
322 | 328 | ||
323 | uint32_t fdt_get_phandle(const void *fdt, int nodeoffset) | 329 | uint32_t fdt_get_phandle(const void *fdt, int nodeoffset) |
324 | { | 330 | { |
325 | const uint32_t *php; | 331 | const fdt32_t *php; |
326 | int len; | 332 | int len; |
327 | 333 | ||
328 | /* FIXME: This is a bit sub-optimal, since we potentially scan | 334 | /* FIXME: This is a bit sub-optimal, since we potentially scan |
@@ -515,8 +521,7 @@ int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle) | |||
515 | return offset; /* error from fdt_next_node() */ | 521 | return offset; /* error from fdt_next_node() */ |
516 | } | 522 | } |
517 | 523 | ||
518 | static int _fdt_stringlist_contains(const char *strlist, int listlen, | 524 | int fdt_stringlist_contains(const char *strlist, int listlen, const char *str) |
519 | const char *str) | ||
520 | { | 525 | { |
521 | int len = strlen(str); | 526 | int len = strlen(str); |
522 | const char *p; | 527 | const char *p; |
@@ -542,7 +547,7 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset, | |||
542 | prop = fdt_getprop(fdt, nodeoffset, "compatible", &len); | 547 | prop = fdt_getprop(fdt, nodeoffset, "compatible", &len); |
543 | if (!prop) | 548 | if (!prop) |
544 | return len; | 549 | return len; |
545 | if (_fdt_stringlist_contains(prop, len, compatible)) | 550 | if (fdt_stringlist_contains(prop, len, compatible)) |
546 | return 0; | 551 | return 0; |
547 | else | 552 | else |
548 | return 1; | 553 | return 1; |
diff --git a/scripts/dtc/libfdt/fdt_rw.c b/scripts/dtc/libfdt/fdt_rw.c index 24437dfc32b8..70adec6c371b 100644 --- a/scripts/dtc/libfdt/fdt_rw.c +++ b/scripts/dtc/libfdt/fdt_rw.c | |||
@@ -84,9 +84,9 @@ static int _fdt_rw_check_header(void *fdt) | |||
84 | 84 | ||
85 | #define FDT_RW_CHECK_HEADER(fdt) \ | 85 | #define FDT_RW_CHECK_HEADER(fdt) \ |
86 | { \ | 86 | { \ |
87 | int err; \ | 87 | int __err; \ |
88 | if ((err = _fdt_rw_check_header(fdt)) != 0) \ | 88 | if ((__err = _fdt_rw_check_header(fdt)) != 0) \ |
89 | return err; \ | 89 | return __err; \ |
90 | } | 90 | } |
91 | 91 | ||
92 | static inline int _fdt_data_size(void *fdt) | 92 | static inline int _fdt_data_size(void *fdt) |
@@ -339,7 +339,7 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset, | |||
339 | int nodelen; | 339 | int nodelen; |
340 | int err; | 340 | int err; |
341 | uint32_t tag; | 341 | uint32_t tag; |
342 | uint32_t *endtag; | 342 | fdt32_t *endtag; |
343 | 343 | ||
344 | FDT_RW_CHECK_HEADER(fdt); | 344 | FDT_RW_CHECK_HEADER(fdt); |
345 | 345 | ||
@@ -366,7 +366,7 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset, | |||
366 | nh->tag = cpu_to_fdt32(FDT_BEGIN_NODE); | 366 | nh->tag = cpu_to_fdt32(FDT_BEGIN_NODE); |
367 | memset(nh->name, 0, FDT_TAGALIGN(namelen+1)); | 367 | memset(nh->name, 0, FDT_TAGALIGN(namelen+1)); |
368 | memcpy(nh->name, name, namelen); | 368 | memcpy(nh->name, name, namelen); |
369 | endtag = (uint32_t *)((char *)nh + nodelen - FDT_TAGSIZE); | 369 | endtag = (fdt32_t *)((char *)nh + nodelen - FDT_TAGSIZE); |
370 | *endtag = cpu_to_fdt32(FDT_END_NODE); | 370 | *endtag = cpu_to_fdt32(FDT_END_NODE); |
371 | 371 | ||
372 | return offset; | 372 | return offset; |
diff --git a/scripts/dtc/libfdt/fdt_sw.c b/scripts/dtc/libfdt/fdt_sw.c index 55ebebf1eb20..6a804859fd0c 100644 --- a/scripts/dtc/libfdt/fdt_sw.c +++ b/scripts/dtc/libfdt/fdt_sw.c | |||
@@ -107,6 +107,38 @@ int fdt_create(void *buf, int bufsize) | |||
107 | return 0; | 107 | return 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | int fdt_resize(void *fdt, void *buf, int bufsize) | ||
111 | { | ||
112 | size_t headsize, tailsize; | ||
113 | char *oldtail, *newtail; | ||
114 | |||
115 | FDT_SW_CHECK_HEADER(fdt); | ||
116 | |||
117 | headsize = fdt_off_dt_struct(fdt); | ||
118 | tailsize = fdt_size_dt_strings(fdt); | ||
119 | |||
120 | if ((headsize + tailsize) > bufsize) | ||
121 | return -FDT_ERR_NOSPACE; | ||
122 | |||
123 | oldtail = (char *)fdt + fdt_totalsize(fdt) - tailsize; | ||
124 | newtail = (char *)buf + bufsize - tailsize; | ||
125 | |||
126 | /* Two cases to avoid clobbering data if the old and new | ||
127 | * buffers partially overlap */ | ||
128 | if (buf <= fdt) { | ||
129 | memmove(buf, fdt, headsize); | ||
130 | memmove(newtail, oldtail, tailsize); | ||
131 | } else { | ||
132 | memmove(newtail, oldtail, tailsize); | ||
133 | memmove(buf, fdt, headsize); | ||
134 | } | ||
135 | |||
136 | fdt_set_off_dt_strings(buf, bufsize); | ||
137 | fdt_set_totalsize(buf, bufsize); | ||
138 | |||
139 | return 0; | ||
140 | } | ||
141 | |||
110 | int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size) | 142 | int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size) |
111 | { | 143 | { |
112 | struct fdt_reserve_entry *re; | 144 | struct fdt_reserve_entry *re; |
@@ -153,7 +185,7 @@ int fdt_begin_node(void *fdt, const char *name) | |||
153 | 185 | ||
154 | int fdt_end_node(void *fdt) | 186 | int fdt_end_node(void *fdt) |
155 | { | 187 | { |
156 | uint32_t *en; | 188 | fdt32_t *en; |
157 | 189 | ||
158 | FDT_SW_CHECK_HEADER(fdt); | 190 | FDT_SW_CHECK_HEADER(fdt); |
159 | 191 | ||
@@ -213,7 +245,7 @@ int fdt_property(void *fdt, const char *name, const void *val, int len) | |||
213 | int fdt_finish(void *fdt) | 245 | int fdt_finish(void *fdt) |
214 | { | 246 | { |
215 | char *p = (char *)fdt; | 247 | char *p = (char *)fdt; |
216 | uint32_t *end; | 248 | fdt32_t *end; |
217 | int oldstroffset, newstroffset; | 249 | int oldstroffset, newstroffset; |
218 | uint32_t tag; | 250 | uint32_t tag; |
219 | int offset, nextoffset; | 251 | int offset, nextoffset; |
diff --git a/scripts/dtc/libfdt/fdt_wip.c b/scripts/dtc/libfdt/fdt_wip.c index 6025fa1fe8fe..c5bbb68d3273 100644 --- a/scripts/dtc/libfdt/fdt_wip.c +++ b/scripts/dtc/libfdt/fdt_wip.c | |||
@@ -74,7 +74,7 @@ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, | |||
74 | 74 | ||
75 | static void _fdt_nop_region(void *start, int len) | 75 | static void _fdt_nop_region(void *start, int len) |
76 | { | 76 | { |
77 | uint32_t *p; | 77 | fdt32_t *p; |
78 | 78 | ||
79 | for (p = start; (char *)p < ((char *)start + len); p++) | 79 | for (p = start; (char *)p < ((char *)start + len); p++) |
80 | *p = cpu_to_fdt32(FDT_NOP); | 80 | *p = cpu_to_fdt32(FDT_NOP); |
diff --git a/scripts/dtc/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h index 73f49759a5e7..ea35ac3c9be4 100644 --- a/scripts/dtc/libfdt/libfdt.h +++ b/scripts/dtc/libfdt/libfdt.h | |||
@@ -51,8 +51,8 @@ | |||
51 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
52 | */ | 52 | */ |
53 | 53 | ||
54 | #include <libfdt_env.h> | 54 | #include "libfdt_env.h" |
55 | #include <fdt.h> | 55 | #include "fdt.h" |
56 | 56 | ||
57 | #define FDT_FIRST_SUPPORTED_VERSION 0x10 | 57 | #define FDT_FIRST_SUPPORTED_VERSION 0x10 |
58 | #define FDT_LAST_SUPPORTED_VERSION 0x11 | 58 | #define FDT_LAST_SUPPORTED_VERSION 0x11 |
@@ -116,7 +116,12 @@ | |||
116 | * Should never be returned, if it is, it indicates a bug in | 116 | * Should never be returned, if it is, it indicates a bug in |
117 | * libfdt itself. */ | 117 | * libfdt itself. */ |
118 | 118 | ||
119 | #define FDT_ERR_MAX 13 | 119 | /* Errors in device tree content */ |
120 | #define FDT_ERR_BADNCELLS 14 | ||
121 | /* FDT_ERR_BADNCELLS: Device tree has a #address-cells, #size-cells | ||
122 | * or similar property with a bad format or value */ | ||
123 | |||
124 | #define FDT_ERR_MAX 14 | ||
120 | 125 | ||
121 | /**********************************************************************/ | 126 | /**********************************************************************/ |
122 | /* Low-level functions (you probably don't need these) */ | 127 | /* Low-level functions (you probably don't need these) */ |
@@ -136,6 +141,28 @@ uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset); | |||
136 | 141 | ||
137 | int fdt_next_node(const void *fdt, int offset, int *depth); | 142 | int fdt_next_node(const void *fdt, int offset, int *depth); |
138 | 143 | ||
144 | /** | ||
145 | * fdt_first_subnode() - get offset of first direct subnode | ||
146 | * | ||
147 | * @fdt: FDT blob | ||
148 | * @offset: Offset of node to check | ||
149 | * @return offset of first subnode, or -FDT_ERR_NOTFOUND if there is none | ||
150 | */ | ||
151 | int fdt_first_subnode(const void *fdt, int offset); | ||
152 | |||
153 | /** | ||
154 | * fdt_next_subnode() - get offset of next direct subnode | ||
155 | * | ||
156 | * After first calling fdt_first_subnode(), call this function repeatedly to | ||
157 | * get direct subnodes of a parent node. | ||
158 | * | ||
159 | * @fdt: FDT blob | ||
160 | * @offset: Offset of previous subnode | ||
161 | * @return offset of next subnode, or -FDT_ERR_NOTFOUND if there are no more | ||
162 | * subnodes | ||
163 | */ | ||
164 | int fdt_next_subnode(const void *fdt, int offset); | ||
165 | |||
139 | /**********************************************************************/ | 166 | /**********************************************************************/ |
140 | /* General functions */ | 167 | /* General functions */ |
141 | /**********************************************************************/ | 168 | /**********************************************************************/ |
@@ -296,6 +323,17 @@ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, | |||
296 | int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name); | 323 | int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name); |
297 | 324 | ||
298 | /** | 325 | /** |
326 | * fdt_path_offset_namelen - find a tree node by its full path | ||
327 | * @fdt: pointer to the device tree blob | ||
328 | * @path: full path of the node to locate | ||
329 | * @namelen: number of characters of path to consider | ||
330 | * | ||
331 | * Identical to fdt_path_offset(), but only consider the first namelen | ||
332 | * characters of path as the path name. | ||
333 | */ | ||
334 | int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen); | ||
335 | |||
336 | /** | ||
299 | * fdt_path_offset - find a tree node by its full path | 337 | * fdt_path_offset - find a tree node by its full path |
300 | * @fdt: pointer to the device tree blob | 338 | * @fdt: pointer to the device tree blob |
301 | * @path: full path of the node to locate | 339 | * @path: full path of the node to locate |
@@ -582,7 +620,7 @@ const char *fdt_get_alias_namelen(const void *fdt, | |||
582 | * value of the property named 'name' in the node /aliases. | 620 | * value of the property named 'name' in the node /aliases. |
583 | * | 621 | * |
584 | * returns: | 622 | * returns: |
585 | * a pointer to the expansion of the alias named 'name', of it exists | 623 | * a pointer to the expansion of the alias named 'name', if it exists |
586 | * NULL, if the given alias or the /aliases node does not exist | 624 | * NULL, if the given alias or the /aliases node does not exist |
587 | */ | 625 | */ |
588 | const char *fdt_get_alias(const void *fdt, const char *name); | 626 | const char *fdt_get_alias(const void *fdt, const char *name); |
@@ -816,6 +854,75 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset, | |||
816 | int fdt_node_offset_by_compatible(const void *fdt, int startoffset, | 854 | int fdt_node_offset_by_compatible(const void *fdt, int startoffset, |
817 | const char *compatible); | 855 | const char *compatible); |
818 | 856 | ||
857 | /** | ||
858 | * fdt_stringlist_contains - check a string list property for a string | ||
859 | * @strlist: Property containing a list of strings to check | ||
860 | * @listlen: Length of property | ||
861 | * @str: String to search for | ||
862 | * | ||
863 | * This is a utility function provided for convenience. The list contains | ||
864 | * one or more strings, each terminated by \0, as is found in a device tree | ||
865 | * "compatible" property. | ||
866 | * | ||
867 | * @return: 1 if the string is found in the list, 0 not found, or invalid list | ||
868 | */ | ||
869 | int fdt_stringlist_contains(const char *strlist, int listlen, const char *str); | ||
870 | |||
871 | /**********************************************************************/ | ||
872 | /* Read-only functions (addressing related) */ | ||
873 | /**********************************************************************/ | ||
874 | |||
875 | /** | ||
876 | * FDT_MAX_NCELLS - maximum value for #address-cells and #size-cells | ||
877 | * | ||
878 | * This is the maximum value for #address-cells, #size-cells and | ||
879 | * similar properties that will be processed by libfdt. IEE1275 | ||
880 | * requires that OF implementations handle values up to 4. | ||
881 | * Implementations may support larger values, but in practice higher | ||
882 | * values aren't used. | ||
883 | */ | ||
884 | #define FDT_MAX_NCELLS 4 | ||
885 | |||
886 | /** | ||
887 | * fdt_address_cells - retrieve address size for a bus represented in the tree | ||
888 | * @fdt: pointer to the device tree blob | ||
889 | * @nodeoffset: offset of the node to find the address size for | ||
890 | * | ||
891 | * When the node has a valid #address-cells property, returns its value. | ||
892 | * | ||
893 | * returns: | ||
894 | * 0 <= n < FDT_MAX_NCELLS, on success | ||
895 | * 2, if the node has no #address-cells property | ||
896 | * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid #address-cells property | ||
897 | * -FDT_ERR_BADMAGIC, | ||
898 | * -FDT_ERR_BADVERSION, | ||
899 | * -FDT_ERR_BADSTATE, | ||
900 | * -FDT_ERR_BADSTRUCTURE, | ||
901 | * -FDT_ERR_TRUNCATED, standard meanings | ||
902 | */ | ||
903 | int fdt_address_cells(const void *fdt, int nodeoffset); | ||
904 | |||
905 | /** | ||
906 | * fdt_size_cells - retrieve address range size for a bus represented in the | ||
907 | * tree | ||
908 | * @fdt: pointer to the device tree blob | ||
909 | * @nodeoffset: offset of the node to find the address range size for | ||
910 | * | ||
911 | * When the node has a valid #size-cells property, returns its value. | ||
912 | * | ||
913 | * returns: | ||
914 | * 0 <= n < FDT_MAX_NCELLS, on success | ||
915 | * 2, if the node has no #address-cells property | ||
916 | * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid #size-cells property | ||
917 | * -FDT_ERR_BADMAGIC, | ||
918 | * -FDT_ERR_BADVERSION, | ||
919 | * -FDT_ERR_BADSTATE, | ||
920 | * -FDT_ERR_BADSTRUCTURE, | ||
921 | * -FDT_ERR_TRUNCATED, standard meanings | ||
922 | */ | ||
923 | int fdt_size_cells(const void *fdt, int nodeoffset); | ||
924 | |||
925 | |||
819 | /**********************************************************************/ | 926 | /**********************************************************************/ |
820 | /* Write-in-place functions */ | 927 | /* Write-in-place functions */ |
821 | /**********************************************************************/ | 928 | /**********************************************************************/ |
@@ -882,8 +989,8 @@ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, | |||
882 | static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, | 989 | static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, |
883 | const char *name, uint32_t val) | 990 | const char *name, uint32_t val) |
884 | { | 991 | { |
885 | val = cpu_to_fdt32(val); | 992 | fdt32_t tmp = cpu_to_fdt32(val); |
886 | return fdt_setprop_inplace(fdt, nodeoffset, name, &val, sizeof(val)); | 993 | return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp)); |
887 | } | 994 | } |
888 | 995 | ||
889 | /** | 996 | /** |
@@ -917,8 +1024,8 @@ static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, | |||
917 | static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, | 1024 | static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, |
918 | const char *name, uint64_t val) | 1025 | const char *name, uint64_t val) |
919 | { | 1026 | { |
920 | val = cpu_to_fdt64(val); | 1027 | fdt64_t tmp = cpu_to_fdt64(val); |
921 | return fdt_setprop_inplace(fdt, nodeoffset, name, &val, sizeof(val)); | 1028 | return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp)); |
922 | } | 1029 | } |
923 | 1030 | ||
924 | /** | 1031 | /** |
@@ -987,19 +1094,20 @@ int fdt_nop_node(void *fdt, int nodeoffset); | |||
987 | /**********************************************************************/ | 1094 | /**********************************************************************/ |
988 | 1095 | ||
989 | int fdt_create(void *buf, int bufsize); | 1096 | int fdt_create(void *buf, int bufsize); |
1097 | int fdt_resize(void *fdt, void *buf, int bufsize); | ||
990 | int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size); | 1098 | int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size); |
991 | int fdt_finish_reservemap(void *fdt); | 1099 | int fdt_finish_reservemap(void *fdt); |
992 | int fdt_begin_node(void *fdt, const char *name); | 1100 | int fdt_begin_node(void *fdt, const char *name); |
993 | int fdt_property(void *fdt, const char *name, const void *val, int len); | 1101 | int fdt_property(void *fdt, const char *name, const void *val, int len); |
994 | static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val) | 1102 | static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val) |
995 | { | 1103 | { |
996 | val = cpu_to_fdt32(val); | 1104 | fdt32_t tmp = cpu_to_fdt32(val); |
997 | return fdt_property(fdt, name, &val, sizeof(val)); | 1105 | return fdt_property(fdt, name, &tmp, sizeof(tmp)); |
998 | } | 1106 | } |
999 | static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val) | 1107 | static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val) |
1000 | { | 1108 | { |
1001 | val = cpu_to_fdt64(val); | 1109 | fdt64_t tmp = cpu_to_fdt64(val); |
1002 | return fdt_property(fdt, name, &val, sizeof(val)); | 1110 | return fdt_property(fdt, name, &tmp, sizeof(tmp)); |
1003 | } | 1111 | } |
1004 | static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) | 1112 | static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) |
1005 | { | 1113 | { |
@@ -1154,8 +1262,8 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name, | |||
1154 | static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, | 1262 | static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, |
1155 | uint32_t val) | 1263 | uint32_t val) |
1156 | { | 1264 | { |
1157 | val = cpu_to_fdt32(val); | 1265 | fdt32_t tmp = cpu_to_fdt32(val); |
1158 | return fdt_setprop(fdt, nodeoffset, name, &val, sizeof(val)); | 1266 | return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp)); |
1159 | } | 1267 | } |
1160 | 1268 | ||
1161 | /** | 1269 | /** |
@@ -1189,8 +1297,8 @@ static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, | |||
1189 | static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, | 1297 | static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, |
1190 | uint64_t val) | 1298 | uint64_t val) |
1191 | { | 1299 | { |
1192 | val = cpu_to_fdt64(val); | 1300 | fdt64_t tmp = cpu_to_fdt64(val); |
1193 | return fdt_setprop(fdt, nodeoffset, name, &val, sizeof(val)); | 1301 | return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp)); |
1194 | } | 1302 | } |
1195 | 1303 | ||
1196 | /** | 1304 | /** |
@@ -1296,8 +1404,8 @@ int fdt_appendprop(void *fdt, int nodeoffset, const char *name, | |||
1296 | static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, | 1404 | static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, |
1297 | const char *name, uint32_t val) | 1405 | const char *name, uint32_t val) |
1298 | { | 1406 | { |
1299 | val = cpu_to_fdt32(val); | 1407 | fdt32_t tmp = cpu_to_fdt32(val); |
1300 | return fdt_appendprop(fdt, nodeoffset, name, &val, sizeof(val)); | 1408 | return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp)); |
1301 | } | 1409 | } |
1302 | 1410 | ||
1303 | /** | 1411 | /** |
@@ -1331,8 +1439,8 @@ static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, | |||
1331 | static inline int fdt_appendprop_u64(void *fdt, int nodeoffset, | 1439 | static inline int fdt_appendprop_u64(void *fdt, int nodeoffset, |
1332 | const char *name, uint64_t val) | 1440 | const char *name, uint64_t val) |
1333 | { | 1441 | { |
1334 | val = cpu_to_fdt64(val); | 1442 | fdt64_t tmp = cpu_to_fdt64(val); |
1335 | return fdt_appendprop(fdt, nodeoffset, name, &val, sizeof(val)); | 1443 | return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp)); |
1336 | } | 1444 | } |
1337 | 1445 | ||
1338 | /** | 1446 | /** |
diff --git a/scripts/dtc/libfdt/libfdt_env.h b/scripts/dtc/libfdt/libfdt_env.h index 213d7fb81c42..9dea97dfff81 100644 --- a/scripts/dtc/libfdt/libfdt_env.h +++ b/scripts/dtc/libfdt/libfdt_env.h | |||
@@ -1,29 +1,111 @@ | |||
1 | #ifndef _LIBFDT_ENV_H | 1 | #ifndef _LIBFDT_ENV_H |
2 | #define _LIBFDT_ENV_H | 2 | #define _LIBFDT_ENV_H |
3 | /* | ||
4 | * libfdt - Flat Device Tree manipulation | ||
5 | * Copyright (C) 2006 David Gibson, IBM Corporation. | ||
6 | * Copyright 2012 Kim Phillips, Freescale Semiconductor. | ||
7 | * | ||
8 | * libfdt is dual licensed: you can use it either under the terms of | ||
9 | * the GPL, or the BSD license, at your option. | ||
10 | * | ||
11 | * a) This library is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License as | ||
13 | * published by the Free Software Foundation; either version 2 of the | ||
14 | * License, or (at your option) any later version. | ||
15 | * | ||
16 | * This library is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public | ||
22 | * License along with this library; if not, write to the Free | ||
23 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, | ||
24 | * MA 02110-1301 USA | ||
25 | * | ||
26 | * Alternatively, | ||
27 | * | ||
28 | * b) Redistribution and use in source and binary forms, with or | ||
29 | * without modification, are permitted provided that the following | ||
30 | * conditions are met: | ||
31 | * | ||
32 | * 1. Redistributions of source code must retain the above | ||
33 | * copyright notice, this list of conditions and the following | ||
34 | * disclaimer. | ||
35 | * 2. Redistributions in binary form must reproduce the above | ||
36 | * copyright notice, this list of conditions and the following | ||
37 | * disclaimer in the documentation and/or other materials | ||
38 | * provided with the distribution. | ||
39 | * | ||
40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
44 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
45 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
46 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
47 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
48 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
49 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
50 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
51 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
52 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
53 | */ | ||
3 | 54 | ||
4 | #include <stddef.h> | 55 | #include <stddef.h> |
5 | #include <stdint.h> | 56 | #include <stdint.h> |
6 | #include <string.h> | 57 | #include <string.h> |
7 | 58 | ||
8 | #define EXTRACT_BYTE(n) ((unsigned long long)((uint8_t *)&x)[n]) | 59 | #ifdef __CHECKER__ |
9 | static inline uint16_t fdt16_to_cpu(uint16_t x) | 60 | #define __force __attribute__((force)) |
61 | #define __bitwise __attribute__((bitwise)) | ||
62 | #else | ||
63 | #define __force | ||
64 | #define __bitwise | ||
65 | #endif | ||
66 | |||
67 | typedef uint16_t __bitwise fdt16_t; | ||
68 | typedef uint32_t __bitwise fdt32_t; | ||
69 | typedef uint64_t __bitwise fdt64_t; | ||
70 | |||
71 | #define EXTRACT_BYTE(x, n) ((unsigned long long)((uint8_t *)&x)[n]) | ||
72 | #define CPU_TO_FDT16(x) ((EXTRACT_BYTE(x, 0) << 8) | EXTRACT_BYTE(x, 1)) | ||
73 | #define CPU_TO_FDT32(x) ((EXTRACT_BYTE(x, 0) << 24) | (EXTRACT_BYTE(x, 1) << 16) | \ | ||
74 | (EXTRACT_BYTE(x, 2) << 8) | EXTRACT_BYTE(x, 3)) | ||
75 | #define CPU_TO_FDT64(x) ((EXTRACT_BYTE(x, 0) << 56) | (EXTRACT_BYTE(x, 1) << 48) | \ | ||
76 | (EXTRACT_BYTE(x, 2) << 40) | (EXTRACT_BYTE(x, 3) << 32) | \ | ||
77 | (EXTRACT_BYTE(x, 4) << 24) | (EXTRACT_BYTE(x, 5) << 16) | \ | ||
78 | (EXTRACT_BYTE(x, 6) << 8) | EXTRACT_BYTE(x, 7)) | ||
79 | |||
80 | static inline uint16_t fdt16_to_cpu(fdt16_t x) | ||
81 | { | ||
82 | return (__force uint16_t)CPU_TO_FDT16(x); | ||
83 | } | ||
84 | static inline fdt16_t cpu_to_fdt16(uint16_t x) | ||
10 | { | 85 | { |
11 | return (EXTRACT_BYTE(0) << 8) | EXTRACT_BYTE(1); | 86 | return (__force fdt16_t)CPU_TO_FDT16(x); |
12 | } | 87 | } |
13 | #define cpu_to_fdt16(x) fdt16_to_cpu(x) | ||
14 | 88 | ||
15 | static inline uint32_t fdt32_to_cpu(uint32_t x) | 89 | static inline uint32_t fdt32_to_cpu(fdt32_t x) |
16 | { | 90 | { |
17 | return (EXTRACT_BYTE(0) << 24) | (EXTRACT_BYTE(1) << 16) | (EXTRACT_BYTE(2) << 8) | EXTRACT_BYTE(3); | 91 | return (__force uint32_t)CPU_TO_FDT32(x); |
92 | } | ||
93 | static inline fdt32_t cpu_to_fdt32(uint32_t x) | ||
94 | { | ||
95 | return (__force fdt32_t)CPU_TO_FDT32(x); | ||
18 | } | 96 | } |
19 | #define cpu_to_fdt32(x) fdt32_to_cpu(x) | ||
20 | 97 | ||
21 | static inline uint64_t fdt64_to_cpu(uint64_t x) | 98 | static inline uint64_t fdt64_to_cpu(fdt64_t x) |
99 | { | ||
100 | return (__force uint64_t)CPU_TO_FDT64(x); | ||
101 | } | ||
102 | static inline fdt64_t cpu_to_fdt64(uint64_t x) | ||
22 | { | 103 | { |
23 | return (EXTRACT_BYTE(0) << 56) | (EXTRACT_BYTE(1) << 48) | (EXTRACT_BYTE(2) << 40) | (EXTRACT_BYTE(3) << 32) | 104 | return (__force fdt64_t)CPU_TO_FDT64(x); |
24 | | (EXTRACT_BYTE(4) << 24) | (EXTRACT_BYTE(5) << 16) | (EXTRACT_BYTE(6) << 8) | EXTRACT_BYTE(7); | ||
25 | } | 105 | } |
26 | #define cpu_to_fdt64(x) fdt64_to_cpu(x) | 106 | #undef CPU_TO_FDT64 |
107 | #undef CPU_TO_FDT32 | ||
108 | #undef CPU_TO_FDT16 | ||
27 | #undef EXTRACT_BYTE | 109 | #undef EXTRACT_BYTE |
28 | 110 | ||
29 | #endif /* _LIBFDT_ENV_H */ | 111 | #endif /* _LIBFDT_ENV_H */ |
diff --git a/scripts/dtc/libfdt/libfdt_internal.h b/scripts/dtc/libfdt/libfdt_internal.h index 381133ba81df..02cfa6fb612d 100644 --- a/scripts/dtc/libfdt/libfdt_internal.h +++ b/scripts/dtc/libfdt/libfdt_internal.h | |||
@@ -57,9 +57,9 @@ | |||
57 | 57 | ||
58 | #define FDT_CHECK_HEADER(fdt) \ | 58 | #define FDT_CHECK_HEADER(fdt) \ |
59 | { \ | 59 | { \ |
60 | int err; \ | 60 | int __err; \ |
61 | if ((err = fdt_check_header(fdt)) != 0) \ | 61 | if ((__err = fdt_check_header(fdt)) != 0) \ |
62 | return err; \ | 62 | return __err; \ |
63 | } | 63 | } |
64 | 64 | ||
65 | int _fdt_check_node_offset(const void *fdt, int offset); | 65 | int _fdt_check_node_offset(const void *fdt, int offset); |
diff --git a/scripts/dtc/livetree.c b/scripts/dtc/livetree.c index b61465fb2f33..e229b84432f9 100644 --- a/scripts/dtc/livetree.c +++ b/scripts/dtc/livetree.c | |||
@@ -511,7 +511,9 @@ struct node *get_node_by_phandle(struct node *tree, cell_t phandle) | |||
511 | 511 | ||
512 | struct node *get_node_by_ref(struct node *tree, const char *ref) | 512 | struct node *get_node_by_ref(struct node *tree, const char *ref) |
513 | { | 513 | { |
514 | if (ref[0] == '/') | 514 | if (streq(ref, "/")) |
515 | return tree; | ||
516 | else if (ref[0] == '/') | ||
515 | return get_node_by_path(tree, ref); | 517 | return get_node_by_path(tree, ref); |
516 | else | 518 | else |
517 | return get_node_by_label(tree, ref); | 519 | return get_node_by_label(tree, ref); |
diff --git a/scripts/dtc/srcpos.c b/scripts/dtc/srcpos.c index c20bc5315bc1..f534c22a888d 100644 --- a/scripts/dtc/srcpos.c +++ b/scripts/dtc/srcpos.c | |||
@@ -34,7 +34,7 @@ struct search_path { | |||
34 | static struct search_path *search_path_head, **search_path_tail; | 34 | static struct search_path *search_path_head, **search_path_tail; |
35 | 35 | ||
36 | 36 | ||
37 | static char *dirname(const char *path) | 37 | static char *get_dirname(const char *path) |
38 | { | 38 | { |
39 | const char *slash = strrchr(path, '/'); | 39 | const char *slash = strrchr(path, '/'); |
40 | 40 | ||
@@ -77,7 +77,7 @@ static char *try_open(const char *dirname, const char *fname, FILE **fp) | |||
77 | else | 77 | else |
78 | fullname = join_path(dirname, fname); | 78 | fullname = join_path(dirname, fname); |
79 | 79 | ||
80 | *fp = fopen(fullname, "r"); | 80 | *fp = fopen(fullname, "rb"); |
81 | if (!*fp) { | 81 | if (!*fp) { |
82 | free(fullname); | 82 | free(fullname); |
83 | fullname = NULL; | 83 | fullname = NULL; |
@@ -150,7 +150,7 @@ void srcfile_push(const char *fname) | |||
150 | srcfile = xmalloc(sizeof(*srcfile)); | 150 | srcfile = xmalloc(sizeof(*srcfile)); |
151 | 151 | ||
152 | srcfile->f = srcfile_relative_open(fname, &srcfile->name); | 152 | srcfile->f = srcfile_relative_open(fname, &srcfile->name); |
153 | srcfile->dir = dirname(srcfile->name); | 153 | srcfile->dir = get_dirname(srcfile->name); |
154 | srcfile->prev = current_srcfile; | 154 | srcfile->prev = current_srcfile; |
155 | 155 | ||
156 | srcfile->lineno = 1; | 156 | srcfile->lineno = 1; |
@@ -159,7 +159,7 @@ void srcfile_push(const char *fname) | |||
159 | current_srcfile = srcfile; | 159 | current_srcfile = srcfile; |
160 | } | 160 | } |
161 | 161 | ||
162 | int srcfile_pop(void) | 162 | bool srcfile_pop(void) |
163 | { | 163 | { |
164 | struct srcfile_state *srcfile = current_srcfile; | 164 | struct srcfile_state *srcfile = current_srcfile; |
165 | 165 | ||
@@ -177,7 +177,7 @@ int srcfile_pop(void) | |||
177 | * fix this we could either allocate all the files from a | 177 | * fix this we could either allocate all the files from a |
178 | * table, or use a pool allocator. */ | 178 | * table, or use a pool allocator. */ |
179 | 179 | ||
180 | return current_srcfile ? 1 : 0; | 180 | return current_srcfile ? true : false; |
181 | } | 181 | } |
182 | 182 | ||
183 | void srcfile_add_search_path(const char *dirname) | 183 | void srcfile_add_search_path(const char *dirname) |
@@ -290,42 +290,27 @@ srcpos_string(struct srcpos *pos) | |||
290 | return pos_str; | 290 | return pos_str; |
291 | } | 291 | } |
292 | 292 | ||
293 | void | 293 | void srcpos_verror(struct srcpos *pos, const char *prefix, |
294 | srcpos_verror(struct srcpos *pos, char const *fmt, va_list va) | 294 | const char *fmt, va_list va) |
295 | { | 295 | { |
296 | const char *srcstr; | 296 | char *srcstr; |
297 | |||
298 | srcstr = srcpos_string(pos); | ||
299 | 297 | ||
300 | fprintf(stderr, "Error: %s ", srcstr); | 298 | srcstr = srcpos_string(pos); |
301 | vfprintf(stderr, fmt, va); | ||
302 | fprintf(stderr, "\n"); | ||
303 | } | ||
304 | 299 | ||
305 | void | 300 | fprintf(stderr, "%s: %s ", prefix, srcstr); |
306 | srcpos_error(struct srcpos *pos, char const *fmt, ...) | 301 | vfprintf(stderr, fmt, va); |
307 | { | 302 | fprintf(stderr, "\n"); |
308 | va_list va; | ||
309 | 303 | ||
310 | va_start(va, fmt); | 304 | free(srcstr); |
311 | srcpos_verror(pos, fmt, va); | ||
312 | va_end(va); | ||
313 | } | 305 | } |
314 | 306 | ||
315 | 307 | void srcpos_error(struct srcpos *pos, const char *prefix, | |
316 | void | 308 | const char *fmt, ...) |
317 | srcpos_warn(struct srcpos *pos, char const *fmt, ...) | ||
318 | { | 309 | { |
319 | const char *srcstr; | ||
320 | va_list va; | 310 | va_list va; |
321 | va_start(va, fmt); | ||
322 | |||
323 | srcstr = srcpos_string(pos); | ||
324 | |||
325 | fprintf(stderr, "Warning: %s ", srcstr); | ||
326 | vfprintf(stderr, fmt, va); | ||
327 | fprintf(stderr, "\n"); | ||
328 | 311 | ||
312 | va_start(va, fmt); | ||
313 | srcpos_verror(pos, prefix, fmt, va); | ||
329 | va_end(va); | 314 | va_end(va); |
330 | } | 315 | } |
331 | 316 | ||
diff --git a/scripts/dtc/srcpos.h b/scripts/dtc/srcpos.h index 93a27123c2e9..f81827bd684a 100644 --- a/scripts/dtc/srcpos.h +++ b/scripts/dtc/srcpos.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define _SRCPOS_H_ | 21 | #define _SRCPOS_H_ |
22 | 22 | ||
23 | #include <stdio.h> | 23 | #include <stdio.h> |
24 | #include <stdbool.h> | ||
24 | 25 | ||
25 | struct srcfile_state { | 26 | struct srcfile_state { |
26 | FILE *f; | 27 | FILE *f; |
@@ -55,7 +56,7 @@ extern struct srcfile_state *current_srcfile; /* = NULL */ | |||
55 | FILE *srcfile_relative_open(const char *fname, char **fullnamep); | 56 | FILE *srcfile_relative_open(const char *fname, char **fullnamep); |
56 | 57 | ||
57 | void srcfile_push(const char *fname); | 58 | void srcfile_push(const char *fname); |
58 | int srcfile_pop(void); | 59 | bool srcfile_pop(void); |
59 | 60 | ||
60 | /** | 61 | /** |
61 | * Add a new directory to the search path for input files | 62 | * Add a new directory to the search path for input files |
@@ -106,12 +107,12 @@ extern struct srcpos *srcpos_copy(struct srcpos *pos); | |||
106 | extern char *srcpos_string(struct srcpos *pos); | 107 | extern char *srcpos_string(struct srcpos *pos); |
107 | extern void srcpos_dump(struct srcpos *pos); | 108 | extern void srcpos_dump(struct srcpos *pos); |
108 | 109 | ||
109 | extern void srcpos_verror(struct srcpos *pos, char const *, va_list va) | 110 | extern void srcpos_verror(struct srcpos *pos, const char *prefix, |
110 | __attribute__((format(printf, 2, 0))); | 111 | const char *fmt, va_list va) |
111 | extern void srcpos_error(struct srcpos *pos, char const *, ...) | 112 | __attribute__((format(printf, 3, 0))); |
112 | __attribute__((format(printf, 2, 3))); | 113 | extern void srcpos_error(struct srcpos *pos, const char *prefix, |
113 | extern void srcpos_warn(struct srcpos *pos, char const *, ...) | 114 | const char *fmt, ...) |
114 | __attribute__((format(printf, 2, 3))); | 115 | __attribute__((format(printf, 3, 4))); |
115 | 116 | ||
116 | extern void srcpos_set_line(char *f, int l); | 117 | extern void srcpos_set_line(char *f, int l); |
117 | 118 | ||
diff --git a/scripts/dtc/treesource.c b/scripts/dtc/treesource.c index 5740e6992d37..a55d1d128cce 100644 --- a/scripts/dtc/treesource.c +++ b/scripts/dtc/treesource.c | |||
@@ -26,12 +26,12 @@ extern int yyparse(void); | |||
26 | extern YYLTYPE yylloc; | 26 | extern YYLTYPE yylloc; |
27 | 27 | ||
28 | struct boot_info *the_boot_info; | 28 | struct boot_info *the_boot_info; |
29 | int treesource_error; | 29 | bool treesource_error; |
30 | 30 | ||
31 | struct boot_info *dt_from_source(const char *fname) | 31 | struct boot_info *dt_from_source(const char *fname) |
32 | { | 32 | { |
33 | the_boot_info = NULL; | 33 | the_boot_info = NULL; |
34 | treesource_error = 0; | 34 | treesource_error = false; |
35 | 35 | ||
36 | srcfile_push(fname); | 36 | srcfile_push(fname); |
37 | yyin = current_srcfile->f; | 37 | yyin = current_srcfile->f; |
@@ -54,9 +54,9 @@ static void write_prefix(FILE *f, int level) | |||
54 | fputc('\t', f); | 54 | fputc('\t', f); |
55 | } | 55 | } |
56 | 56 | ||
57 | static int isstring(char c) | 57 | static bool isstring(char c) |
58 | { | 58 | { |
59 | return (isprint(c) | 59 | return (isprint((unsigned char)c) |
60 | || (c == '\0') | 60 | || (c == '\0') |
61 | || strchr("\a\b\t\n\v\f\r", c)); | 61 | || strchr("\a\b\t\n\v\f\r", c)); |
62 | } | 62 | } |
@@ -109,7 +109,7 @@ static void write_propval_string(FILE *f, struct data val) | |||
109 | break; | 109 | break; |
110 | case '\0': | 110 | case '\0': |
111 | fprintf(f, "\", "); | 111 | fprintf(f, "\", "); |
112 | while (m && (m->offset < i)) { | 112 | while (m && (m->offset <= (i + 1))) { |
113 | if (m->type == LABEL) { | 113 | if (m->type == LABEL) { |
114 | assert(m->offset == (i+1)); | 114 | assert(m->offset == (i+1)); |
115 | fprintf(f, "%s: ", m->ref); | 115 | fprintf(f, "%s: ", m->ref); |
@@ -119,7 +119,7 @@ static void write_propval_string(FILE *f, struct data val) | |||
119 | fprintf(f, "\""); | 119 | fprintf(f, "\""); |
120 | break; | 120 | break; |
121 | default: | 121 | default: |
122 | if (isprint(c)) | 122 | if (isprint((unsigned char)c)) |
123 | fprintf(f, "%c", c); | 123 | fprintf(f, "%c", c); |
124 | else | 124 | else |
125 | fprintf(f, "\\x%02hhx", c); | 125 | fprintf(f, "\\x%02hhx", c); |
@@ -178,7 +178,7 @@ static void write_propval_bytes(FILE *f, struct data val) | |||
178 | m = m->next; | 178 | m = m->next; |
179 | } | 179 | } |
180 | 180 | ||
181 | fprintf(f, "%02hhx", *bp++); | 181 | fprintf(f, "%02hhx", (unsigned char)(*bp++)); |
182 | if ((const void *)bp >= propend) | 182 | if ((const void *)bp >= propend) |
183 | break; | 183 | break; |
184 | fprintf(f, " "); | 184 | fprintf(f, " "); |
@@ -281,3 +281,4 @@ void dt_to_source(FILE *f, struct boot_info *bi) | |||
281 | 281 | ||
282 | write_tree_source_node(f, bi->dt, 0); | 282 | write_tree_source_node(f, bi->dt, 0); |
283 | } | 283 | } |
284 | |||
diff --git a/scripts/dtc/update-dtc-source.sh b/scripts/dtc/update-dtc-source.sh index feb01ef26be4..f5cde799db03 100755 --- a/scripts/dtc/update-dtc-source.sh +++ b/scripts/dtc/update-dtc-source.sh | |||
@@ -34,6 +34,7 @@ DTC_SOURCE="checks.c data.c dtc.c dtc.h flattree.c fstree.c livetree.c srcpos.c | |||
34 | srcpos.h treesource.c util.c util.h version_gen.h Makefile.dtc \ | 34 | srcpos.h treesource.c util.c util.h version_gen.h Makefile.dtc \ |
35 | dtc-lexer.l dtc-parser.y" | 35 | dtc-lexer.l dtc-parser.y" |
36 | DTC_GENERATED="dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h" | 36 | DTC_GENERATED="dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h" |
37 | LIBFDT_SOURCE="Makefile.libfdt fdt.c fdt.h fdt_empty_tree.c fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c fdt_wip.c libfdt.h libfdt_env.h libfdt_internal.h" | ||
37 | 38 | ||
38 | # Build DTC | 39 | # Build DTC |
39 | cd $DTC_UPSTREAM_PATH | 40 | cd $DTC_UPSTREAM_PATH |
@@ -50,5 +51,13 @@ for f in $DTC_GENERATED; do | |||
50 | cp ${DTC_UPSTREAM_PATH}/$f ${f}_shipped | 51 | cp ${DTC_UPSTREAM_PATH}/$f ${f}_shipped |
51 | git add ${f}_shipped | 52 | git add ${f}_shipped |
52 | done | 53 | done |
54 | for f in $LIBFDT_SOURCE; do | ||
55 | cp ${DTC_UPSTREAM_PATH}/libfdt/${f} libfdt/${f} | ||
56 | git add libfdt/${f} | ||
57 | done | ||
58 | |||
59 | sed -i -- 's/#include <libfdt_env.h>/#include "libfdt_env.h"/g' ./libfdt/libfdt.h | ||
60 | sed -i -- 's/#include <fdt.h>/#include "fdt.h"/g' ./libfdt/libfdt.h | ||
61 | git add ./libfdt/libfdt.h | ||
53 | 62 | ||
54 | git commit -e -v -m "scripts/dtc: Update to upstream version [CHANGEME]" | 63 | 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 3055c16e980d..9d65226df9e4 100644 --- a/scripts/dtc/util.c +++ b/scripts/dtc/util.c | |||
@@ -39,11 +39,11 @@ | |||
39 | char *xstrdup(const char *s) | 39 | char *xstrdup(const char *s) |
40 | { | 40 | { |
41 | int len = strlen(s) + 1; | 41 | int len = strlen(s) + 1; |
42 | char *dup = xmalloc(len); | 42 | char *d = xmalloc(len); |
43 | 43 | ||
44 | memcpy(dup, s, len); | 44 | memcpy(d, s, len); |
45 | 45 | ||
46 | return dup; | 46 | return d; |
47 | } | 47 | } |
48 | 48 | ||
49 | char *join_path(const char *path, const char *name) | 49 | char *join_path(const char *path, const char *name) |
@@ -70,7 +70,7 @@ char *join_path(const char *path, const char *name) | |||
70 | return str; | 70 | return str; |
71 | } | 71 | } |
72 | 72 | ||
73 | int util_is_printable_string(const void *data, int len) | 73 | bool util_is_printable_string(const void *data, int len) |
74 | { | 74 | { |
75 | const char *s = data; | 75 | const char *s = data; |
76 | const char *ss, *se; | 76 | const char *ss, *se; |
@@ -87,7 +87,7 @@ int util_is_printable_string(const void *data, int len) | |||
87 | 87 | ||
88 | while (s < se) { | 88 | while (s < se) { |
89 | ss = s; | 89 | ss = s; |
90 | while (s < se && *s && isprint(*s)) | 90 | while (s < se && *s && isprint((unsigned char)*s)) |
91 | s++; | 91 | s++; |
92 | 92 | ||
93 | /* not zero, or not done yet */ | 93 | /* not zero, or not done yet */ |
@@ -219,10 +219,6 @@ int utilfdt_read_err_len(const char *filename, char **buffp, off_t *len) | |||
219 | if (offset == bufsize) { | 219 | if (offset == bufsize) { |
220 | bufsize *= 2; | 220 | bufsize *= 2; |
221 | buf = xrealloc(buf, bufsize); | 221 | buf = xrealloc(buf, bufsize); |
222 | if (!buf) { | ||
223 | ret = ENOMEM; | ||
224 | break; | ||
225 | } | ||
226 | } | 222 | } |
227 | 223 | ||
228 | ret = read(fd, &buf[offset], bufsize - offset); | 224 | ret = read(fd, &buf[offset], bufsize - offset); |
@@ -375,9 +371,9 @@ void utilfdt_print_data(const char *data, int len) | |||
375 | const uint32_t *cell = (const uint32_t *)data; | 371 | const uint32_t *cell = (const uint32_t *)data; |
376 | 372 | ||
377 | printf(" = <"); | 373 | printf(" = <"); |
378 | for (i = 0; i < len; i += 4) | 374 | for (i = 0, len /= 4; i < len; i++) |
379 | printf("0x%08x%s", fdt32_to_cpu(cell[i]), | 375 | printf("0x%08x%s", fdt32_to_cpu(cell[i]), |
380 | i < (len - 4) ? " " : ""); | 376 | i < (len - 1) ? " " : ""); |
381 | printf(">"); | 377 | printf(">"); |
382 | } else { | 378 | } else { |
383 | printf(" = ["); | 379 | printf(" = ["); |
diff --git a/scripts/dtc/util.h b/scripts/dtc/util.h index 8f40b4499359..f800b6011fb1 100644 --- a/scripts/dtc/util.h +++ b/scripts/dtc/util.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _UTIL_H | 2 | #define _UTIL_H |
3 | 3 | ||
4 | #include <stdarg.h> | 4 | #include <stdarg.h> |
5 | #include <stdbool.h> | ||
5 | #include <getopt.h> | 6 | #include <getopt.h> |
6 | 7 | ||
7 | /* | 8 | /* |
@@ -33,6 +34,7 @@ static inline void __attribute__((noreturn)) die(const char *str, ...) | |||
33 | va_start(ap, str); | 34 | va_start(ap, str); |
34 | fprintf(stderr, "FATAL ERROR: "); | 35 | fprintf(stderr, "FATAL ERROR: "); |
35 | vfprintf(stderr, str, ap); | 36 | vfprintf(stderr, str, ap); |
37 | va_end(ap); | ||
36 | exit(1); | 38 | exit(1); |
37 | } | 39 | } |
38 | 40 | ||
@@ -68,7 +70,7 @@ extern char *join_path(const char *path, const char *name); | |||
68 | * @param len The string length including terminator | 70 | * @param len The string length including terminator |
69 | * @return 1 if a valid printable string, 0 if not | 71 | * @return 1 if a valid printable string, 0 if not |
70 | */ | 72 | */ |
71 | int util_is_printable_string(const void *data, int len); | 73 | bool util_is_printable_string(const void *data, int len); |
72 | 74 | ||
73 | /* | 75 | /* |
74 | * Parse an escaped character starting at index i in string s. The resulting | 76 | * Parse an escaped character starting at index i in string s. The resulting |
diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h index 54d4e904433a..5b8c7d53d608 100644 --- a/scripts/dtc/version_gen.h +++ b/scripts/dtc/version_gen.h | |||
@@ -1 +1 @@ | |||
#define DTC_VERSION "DTC 1.4.0-dirty" | #define DTC_VERSION "DTC 1.4.1-g9d3649bd" | ||
diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig index e1862429ccda..3b42f255e2ba 100755 --- a/scripts/extract-ikconfig +++ b/scripts/extract-ikconfig | |||
@@ -61,6 +61,7 @@ try_decompress '\3757zXZ\000' abcde unxz | |||
61 | try_decompress 'BZh' xy bunzip2 | 61 | try_decompress 'BZh' xy bunzip2 |
62 | try_decompress '\135\0\0\0' xxx unlzma | 62 | try_decompress '\135\0\0\0' xxx unlzma |
63 | try_decompress '\211\114\132' xy 'lzop -d' | 63 | try_decompress '\211\114\132' xy 'lzop -d' |
64 | try_decompress '\002\041\114\030' xyy 'lz4 -d -l' | ||
64 | 65 | ||
65 | # Bail out: | 66 | # Bail out: |
66 | echo "$me: Cannot find kernel config." >&2 | 67 | echo "$me: Cannot find kernel config." >&2 |
diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py index 3c947f0c5dad..927d0d2a3145 100644 --- a/scripts/gdb/linux/dmesg.py +++ b/scripts/gdb/linux/dmesg.py | |||
@@ -12,7 +12,6 @@ | |||
12 | # | 12 | # |
13 | 13 | ||
14 | import gdb | 14 | import gdb |
15 | import string | ||
16 | 15 | ||
17 | from linux import utils | 16 | from linux import utils |
18 | 17 | ||
diff --git a/scripts/gdb/linux/lists.py b/scripts/gdb/linux/lists.py new file mode 100644 index 000000000000..3a3775bc162b --- /dev/null +++ b/scripts/gdb/linux/lists.py | |||
@@ -0,0 +1,92 @@ | |||
1 | # | ||
2 | # gdb helper commands and functions for Linux kernel debugging | ||
3 | # | ||
4 | # list tools | ||
5 | # | ||
6 | # Copyright (c) Thiebaud Weksteen, 2015 | ||
7 | # | ||
8 | # Authors: | ||
9 | # Thiebaud Weksteen <thiebaud@weksteen.fr> | ||
10 | # | ||
11 | # This work is licensed under the terms of the GNU GPL version 2. | ||
12 | # | ||
13 | |||
14 | import gdb | ||
15 | |||
16 | from linux import utils | ||
17 | |||
18 | list_head = utils.CachedType("struct list_head") | ||
19 | |||
20 | |||
21 | def list_check(head): | ||
22 | nb = 0 | ||
23 | if (head.type == list_head.get_type().pointer()): | ||
24 | head = head.dereference() | ||
25 | elif (head.type != list_head.get_type()): | ||
26 | raise gdb.GdbError('argument must be of type (struct list_head [*])') | ||
27 | c = head | ||
28 | try: | ||
29 | gdb.write("Starting with: {}\n".format(c)) | ||
30 | except gdb.MemoryError: | ||
31 | gdb.write('head is not accessible\n') | ||
32 | return | ||
33 | while True: | ||
34 | p = c['prev'].dereference() | ||
35 | n = c['next'].dereference() | ||
36 | try: | ||
37 | if p['next'] != c.address: | ||
38 | gdb.write('prev.next != current: ' | ||
39 | 'current@{current_addr}={current} ' | ||
40 | 'prev@{p_addr}={p}\n'.format( | ||
41 | current_addr=c.address, | ||
42 | current=c, | ||
43 | p_addr=p.address, | ||
44 | p=p, | ||
45 | )) | ||
46 | return | ||
47 | except gdb.MemoryError: | ||
48 | gdb.write('prev is not accessible: ' | ||
49 | 'current@{current_addr}={current}\n'.format( | ||
50 | current_addr=c.address, | ||
51 | current=c | ||
52 | )) | ||
53 | return | ||
54 | try: | ||
55 | if n['prev'] != c.address: | ||
56 | gdb.write('next.prev != current: ' | ||
57 | 'current@{current_addr}={current} ' | ||
58 | 'next@{n_addr}={n}\n'.format( | ||
59 | current_addr=c.address, | ||
60 | current=c, | ||
61 | n_addr=n.address, | ||
62 | n=n, | ||
63 | )) | ||
64 | return | ||
65 | except gdb.MemoryError: | ||
66 | gdb.write('next is not accessible: ' | ||
67 | 'current@{current_addr}={current}\n'.format( | ||
68 | current_addr=c.address, | ||
69 | current=c | ||
70 | )) | ||
71 | return | ||
72 | c = n | ||
73 | nb += 1 | ||
74 | if c == head: | ||
75 | gdb.write("list is consistent: {} node(s)\n".format(nb)) | ||
76 | return | ||
77 | |||
78 | |||
79 | class LxListChk(gdb.Command): | ||
80 | """Verify a list consistency""" | ||
81 | |||
82 | def __init__(self): | ||
83 | super(LxListChk, self).__init__("lx-list-check", gdb.COMMAND_DATA, | ||
84 | gdb.COMPLETE_EXPRESSION) | ||
85 | |||
86 | def invoke(self, arg, from_tty): | ||
87 | argv = gdb.string_to_argv(arg) | ||
88 | if len(argv) != 1: | ||
89 | raise gdb.GdbError("lx-list-check takes one argument") | ||
90 | list_check(gdb.parse_and_eval(argv[0])) | ||
91 | |||
92 | LxListChk() | ||
diff --git a/scripts/gdb/linux/modules.py b/scripts/gdb/linux/modules.py index a1504c4f1900..25db8cff44a2 100644 --- a/scripts/gdb/linux/modules.py +++ b/scripts/gdb/linux/modules.py | |||
@@ -73,18 +73,11 @@ class LxLsmod(gdb.Command): | |||
73 | " " if utils.get_long_type().sizeof == 8 else "")) | 73 | " " if utils.get_long_type().sizeof == 8 else "")) |
74 | 74 | ||
75 | for module in module_list(): | 75 | for module in module_list(): |
76 | ref = 0 | ||
77 | module_refptr = module['refptr'] | ||
78 | for cpu in cpus.cpu_list("cpu_possible_mask"): | ||
79 | refptr = cpus.per_cpu(module_refptr, cpu) | ||
80 | ref += refptr['incs'] | ||
81 | ref -= refptr['decs'] | ||
82 | |||
83 | gdb.write("{address} {name:<19} {size:>8} {ref}".format( | 76 | gdb.write("{address} {name:<19} {size:>8} {ref}".format( |
84 | address=str(module['module_core']).split()[0], | 77 | address=str(module['module_core']).split()[0], |
85 | name=module['name'].string(), | 78 | name=module['name'].string(), |
86 | size=str(module['core_size']), | 79 | size=str(module['core_size']), |
87 | ref=str(ref))) | 80 | ref=str(module['refcnt']['counter']))) |
88 | 81 | ||
89 | source_list = module['source_list'] | 82 | source_list = module['source_list'] |
90 | t = self._module_use_type.get_type().pointer() | 83 | t = self._module_use_type.get_type().pointer() |
diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py index cd5bea965d4e..627750cb420d 100644 --- a/scripts/gdb/linux/symbols.py +++ b/scripts/gdb/linux/symbols.py | |||
@@ -14,9 +14,8 @@ | |||
14 | import gdb | 14 | import gdb |
15 | import os | 15 | import os |
16 | import re | 16 | import re |
17 | import string | ||
18 | 17 | ||
19 | from linux import modules, utils | 18 | from linux import modules |
20 | 19 | ||
21 | 20 | ||
22 | if hasattr(gdb, 'Breakpoint'): | 21 | if hasattr(gdb, 'Breakpoint'): |
@@ -97,7 +96,7 @@ lx-symbols command.""" | |||
97 | return "" | 96 | return "" |
98 | attrs = sect_attrs['attrs'] | 97 | attrs = sect_attrs['attrs'] |
99 | section_name_to_address = { | 98 | section_name_to_address = { |
100 | attrs[n]['name'].string() : attrs[n]['address'] | 99 | attrs[n]['name'].string(): attrs[n]['address'] |
101 | for n in range(int(sect_attrs['nsections']))} | 100 | for n in range(int(sect_attrs['nsections']))} |
102 | args = [] | 101 | args = [] |
103 | for section_name in [".data", ".data..read_mostly", ".rodata", ".bss"]: | 102 | for section_name in [".data", ".data..read_mostly", ".rodata", ".bss"]: |
@@ -124,7 +123,7 @@ lx-symbols command.""" | |||
124 | addr=module_addr, | 123 | addr=module_addr, |
125 | sections=self._section_arguments(module)) | 124 | sections=self._section_arguments(module)) |
126 | gdb.execute(cmdline, to_string=True) | 125 | gdb.execute(cmdline, to_string=True) |
127 | if not module_name in self.loaded_modules: | 126 | if module_name not in self.loaded_modules: |
128 | self.loaded_modules.append(module_name) | 127 | self.loaded_modules.append(module_name) |
129 | else: | 128 | else: |
130 | gdb.write("no module object found for '{0}'\n".format(module_name)) | 129 | gdb.write("no module object found for '{0}'\n".format(module_name)) |
@@ -164,7 +163,7 @@ lx-symbols command.""" | |||
164 | self.load_all_symbols() | 163 | self.load_all_symbols() |
165 | 164 | ||
166 | if hasattr(gdb, 'Breakpoint'): | 165 | if hasattr(gdb, 'Breakpoint'): |
167 | if not self.breakpoint is None: | 166 | if self.breakpoint is not None: |
168 | self.breakpoint.delete() | 167 | self.breakpoint.delete() |
169 | self.breakpoint = None | 168 | self.breakpoint = None |
170 | self.breakpoint = LoadModuleBreakpoint( | 169 | self.breakpoint = LoadModuleBreakpoint( |
diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py index e2037d9bb7eb..862a4ae24d49 100644 --- a/scripts/gdb/linux/tasks.py +++ b/scripts/gdb/linux/tasks.py | |||
@@ -18,8 +18,8 @@ from linux import utils | |||
18 | 18 | ||
19 | task_type = utils.CachedType("struct task_struct") | 19 | task_type = utils.CachedType("struct task_struct") |
20 | 20 | ||
21 | |||
21 | def task_lists(): | 22 | def task_lists(): |
22 | global task_type | ||
23 | task_ptr_type = task_type.get_type().pointer() | 23 | task_ptr_type = task_type.get_type().pointer() |
24 | init_task = gdb.parse_and_eval("init_task").address | 24 | init_task = gdb.parse_and_eval("init_task").address |
25 | t = g = init_task | 25 | t = g = init_task |
@@ -38,6 +38,7 @@ def task_lists(): | |||
38 | if t == init_task: | 38 | if t == init_task: |
39 | return | 39 | return |
40 | 40 | ||
41 | |||
41 | def get_task_by_pid(pid): | 42 | def get_task_by_pid(pid): |
42 | for task in task_lists(): | 43 | for task in task_lists(): |
43 | if int(task['pid']) == pid: | 44 | if int(task['pid']) == pid: |
@@ -65,13 +66,28 @@ return that task_struct variable which PID matches.""" | |||
65 | LxTaskByPidFunc() | 66 | LxTaskByPidFunc() |
66 | 67 | ||
67 | 68 | ||
69 | class LxPs(gdb.Command): | ||
70 | """Dump Linux tasks.""" | ||
71 | |||
72 | def __init__(self): | ||
73 | super(LxPs, self).__init__("lx-ps", gdb.COMMAND_DATA) | ||
74 | |||
75 | def invoke(self, arg, from_tty): | ||
76 | for task in task_lists(): | ||
77 | gdb.write("{address} {pid} {comm}\n".format( | ||
78 | address=task, | ||
79 | pid=task["pid"], | ||
80 | comm=task["comm"].string())) | ||
81 | |||
82 | LxPs() | ||
83 | |||
84 | |||
68 | thread_info_type = utils.CachedType("struct thread_info") | 85 | thread_info_type = utils.CachedType("struct thread_info") |
69 | 86 | ||
70 | ia64_task_size = None | 87 | ia64_task_size = None |
71 | 88 | ||
72 | 89 | ||
73 | def get_thread_info(task): | 90 | def get_thread_info(task): |
74 | global thread_info_type | ||
75 | thread_info_ptr_type = thread_info_type.get_type().pointer() | 91 | thread_info_ptr_type = thread_info_type.get_type().pointer() |
76 | if utils.is_target_arch("ia64"): | 92 | if utils.is_target_arch("ia64"): |
77 | global ia64_task_size | 93 | global ia64_task_size |
diff --git a/scripts/gdb/linux/utils.py b/scripts/gdb/linux/utils.py index 128c306db3ee..0893b326a28b 100644 --- a/scripts/gdb/linux/utils.py +++ b/scripts/gdb/linux/utils.py | |||
@@ -83,7 +83,7 @@ def get_target_endianness(): | |||
83 | elif "big endian" in endian: | 83 | elif "big endian" in endian: |
84 | target_endianness = BIG_ENDIAN | 84 | target_endianness = BIG_ENDIAN |
85 | else: | 85 | else: |
86 | raise gdb.GdgError("unknown endianness '{0}'".format(str(endian))) | 86 | raise gdb.GdbError("unknown endianness '{0}'".format(str(endian))) |
87 | return target_endianness | 87 | return target_endianness |
88 | 88 | ||
89 | 89 | ||
@@ -151,6 +151,6 @@ def get_gdbserver_type(): | |||
151 | gdbserver_type = GDBSERVER_QEMU | 151 | gdbserver_type = GDBSERVER_QEMU |
152 | elif probe_kgdb(): | 152 | elif probe_kgdb(): |
153 | gdbserver_type = GDBSERVER_KGDB | 153 | gdbserver_type = GDBSERVER_KGDB |
154 | if not gdbserver_type is None and hasattr(gdb, 'events'): | 154 | if gdbserver_type is not None and hasattr(gdb, 'events'): |
155 | gdb.events.exited.connect(exit_handler) | 155 | gdb.events.exited.connect(exit_handler) |
156 | return gdbserver_type | 156 | return gdbserver_type |
diff --git a/scripts/gdb/vmlinux-gdb.py b/scripts/gdb/vmlinux-gdb.py index 48489285f119..ce82bf5c3943 100644 --- a/scripts/gdb/vmlinux-gdb.py +++ b/scripts/gdb/vmlinux-gdb.py | |||
@@ -28,3 +28,4 @@ else: | |||
28 | import linux.dmesg | 28 | import linux.dmesg |
29 | import linux.tasks | 29 | import linux.tasks |
30 | import linux.cpus | 30 | import linux.cpus |
31 | import linux.lists | ||
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index d7016279ec2b..98bae869f6d0 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
@@ -42,6 +42,7 @@ my $output_multiline = 1; | |||
42 | my $output_separator = ", "; | 42 | my $output_separator = ", "; |
43 | my $output_roles = 0; | 43 | my $output_roles = 0; |
44 | my $output_rolestats = 1; | 44 | my $output_rolestats = 1; |
45 | my $output_section_maxlen = 50; | ||
45 | my $scm = 0; | 46 | my $scm = 0; |
46 | my $web = 0; | 47 | my $web = 0; |
47 | my $subsystem = 0; | 48 | my $subsystem = 0; |
@@ -186,6 +187,27 @@ if (-f $conf) { | |||
186 | unshift(@ARGV, @conf_args) if @conf_args; | 187 | unshift(@ARGV, @conf_args) if @conf_args; |
187 | } | 188 | } |
188 | 189 | ||
190 | my @ignore_emails = (); | ||
191 | my $ignore_file = which_conf(".get_maintainer.ignore"); | ||
192 | if (-f $ignore_file) { | ||
193 | open(my $ignore, '<', "$ignore_file") | ||
194 | or warn "$P: Can't find a readable .get_maintainer.ignore file $!\n"; | ||
195 | while (<$ignore>) { | ||
196 | my $line = $_; | ||
197 | |||
198 | $line =~ s/\s*\n?$//; | ||
199 | $line =~ s/^\s*//; | ||
200 | $line =~ s/\s+$//; | ||
201 | $line =~ s/#.*$//; | ||
202 | |||
203 | next if ($line =~ m/^\s*$/); | ||
204 | if (rfc822_valid($line)) { | ||
205 | push(@ignore_emails, $line); | ||
206 | } | ||
207 | } | ||
208 | close($ignore); | ||
209 | } | ||
210 | |||
189 | if (!GetOptions( | 211 | if (!GetOptions( |
190 | 'email!' => \$email, | 212 | 'email!' => \$email, |
191 | 'git!' => \$email_git, | 213 | 'git!' => \$email_git, |
@@ -283,7 +305,7 @@ open (my $maint, '<', "${lk_path}MAINTAINERS") | |||
283 | while (<$maint>) { | 305 | while (<$maint>) { |
284 | my $line = $_; | 306 | my $line = $_; |
285 | 307 | ||
286 | if ($line =~ m/^(\C):\s*(.*)/) { | 308 | if ($line =~ m/^([A-Z]):\s*(.*)/) { |
287 | my $type = $1; | 309 | my $type = $1; |
288 | my $value = $2; | 310 | my $value = $2; |
289 | 311 | ||
@@ -513,12 +535,22 @@ if ($web) { | |||
513 | 535 | ||
514 | exit($exit); | 536 | exit($exit); |
515 | 537 | ||
538 | sub ignore_email_address { | ||
539 | my ($address) = @_; | ||
540 | |||
541 | foreach my $ignore (@ignore_emails) { | ||
542 | return 1 if ($ignore eq $address); | ||
543 | } | ||
544 | |||
545 | return 0; | ||
546 | } | ||
547 | |||
516 | sub range_is_maintained { | 548 | sub range_is_maintained { |
517 | my ($start, $end) = @_; | 549 | my ($start, $end) = @_; |
518 | 550 | ||
519 | for (my $i = $start; $i < $end; $i++) { | 551 | for (my $i = $start; $i < $end; $i++) { |
520 | my $line = $typevalue[$i]; | 552 | my $line = $typevalue[$i]; |
521 | if ($line =~ m/^(\C):\s*(.*)/) { | 553 | if ($line =~ m/^([A-Z]):\s*(.*)/) { |
522 | my $type = $1; | 554 | my $type = $1; |
523 | my $value = $2; | 555 | my $value = $2; |
524 | if ($type eq 'S') { | 556 | if ($type eq 'S') { |
@@ -536,7 +568,7 @@ sub range_has_maintainer { | |||
536 | 568 | ||
537 | for (my $i = $start; $i < $end; $i++) { | 569 | for (my $i = $start; $i < $end; $i++) { |
538 | my $line = $typevalue[$i]; | 570 | my $line = $typevalue[$i]; |
539 | if ($line =~ m/^(\C):\s*(.*)/) { | 571 | if ($line =~ m/^([A-Z]):\s*(.*)/) { |
540 | my $type = $1; | 572 | my $type = $1; |
541 | my $value = $2; | 573 | my $value = $2; |
542 | if ($type eq 'M') { | 574 | if ($type eq 'M') { |
@@ -585,7 +617,7 @@ sub get_maintainers { | |||
585 | 617 | ||
586 | for ($i = $start; $i < $end; $i++) { | 618 | for ($i = $start; $i < $end; $i++) { |
587 | my $line = $typevalue[$i]; | 619 | my $line = $typevalue[$i]; |
588 | if ($line =~ m/^(\C):\s*(.*)/) { | 620 | if ($line =~ m/^([A-Z]):\s*(.*)/) { |
589 | my $type = $1; | 621 | my $type = $1; |
590 | my $value = $2; | 622 | my $value = $2; |
591 | if ($type eq 'X') { | 623 | if ($type eq 'X') { |
@@ -600,7 +632,7 @@ sub get_maintainers { | |||
600 | if (!$exclude) { | 632 | if (!$exclude) { |
601 | for ($i = $start; $i < $end; $i++) { | 633 | for ($i = $start; $i < $end; $i++) { |
602 | my $line = $typevalue[$i]; | 634 | my $line = $typevalue[$i]; |
603 | if ($line =~ m/^(\C):\s*(.*)/) { | 635 | if ($line =~ m/^([A-Z]):\s*(.*)/) { |
604 | my $type = $1; | 636 | my $type = $1; |
605 | my $value = $2; | 637 | my $value = $2; |
606 | if ($type eq 'F') { | 638 | if ($type eq 'F') { |
@@ -901,7 +933,7 @@ sub find_first_section { | |||
901 | 933 | ||
902 | while ($index < @typevalue) { | 934 | while ($index < @typevalue) { |
903 | my $tv = $typevalue[$index]; | 935 | my $tv = $typevalue[$index]; |
904 | if (($tv =~ m/^(\C):\s*(.*)/)) { | 936 | if (($tv =~ m/^([A-Z]):\s*(.*)/)) { |
905 | last; | 937 | last; |
906 | } | 938 | } |
907 | $index++; | 939 | $index++; |
@@ -915,7 +947,7 @@ sub find_starting_index { | |||
915 | 947 | ||
916 | while ($index > 0) { | 948 | while ($index > 0) { |
917 | my $tv = $typevalue[$index]; | 949 | my $tv = $typevalue[$index]; |
918 | if (!($tv =~ m/^(\C):\s*(.*)/)) { | 950 | if (!($tv =~ m/^([A-Z]):\s*(.*)/)) { |
919 | last; | 951 | last; |
920 | } | 952 | } |
921 | $index--; | 953 | $index--; |
@@ -929,7 +961,7 @@ sub find_ending_index { | |||
929 | 961 | ||
930 | while ($index < @typevalue) { | 962 | while ($index < @typevalue) { |
931 | my $tv = $typevalue[$index]; | 963 | my $tv = $typevalue[$index]; |
932 | if (!($tv =~ m/^(\C):\s*(.*)/)) { | 964 | if (!($tv =~ m/^([A-Z]):\s*(.*)/)) { |
933 | last; | 965 | last; |
934 | } | 966 | } |
935 | $index++; | 967 | $index++; |
@@ -947,15 +979,15 @@ sub get_maintainer_role { | |||
947 | 979 | ||
948 | my $role = "unknown"; | 980 | my $role = "unknown"; |
949 | my $subsystem = $typevalue[$start]; | 981 | my $subsystem = $typevalue[$start]; |
950 | if (length($subsystem) > 20) { | 982 | if ($output_section_maxlen && length($subsystem) > $output_section_maxlen) { |
951 | $subsystem = substr($subsystem, 0, 17); | 983 | $subsystem = substr($subsystem, 0, $output_section_maxlen - 3); |
952 | $subsystem =~ s/\s*$//; | 984 | $subsystem =~ s/\s*$//; |
953 | $subsystem = $subsystem . "..."; | 985 | $subsystem = $subsystem . "..."; |
954 | } | 986 | } |
955 | 987 | ||
956 | for ($i = $start + 1; $i < $end; $i++) { | 988 | for ($i = $start + 1; $i < $end; $i++) { |
957 | my $tv = $typevalue[$i]; | 989 | my $tv = $typevalue[$i]; |
958 | if ($tv =~ m/^(\C):\s*(.*)/) { | 990 | if ($tv =~ m/^([A-Z]):\s*(.*)/) { |
959 | my $ptype = $1; | 991 | my $ptype = $1; |
960 | my $pvalue = $2; | 992 | my $pvalue = $2; |
961 | if ($ptype eq "S") { | 993 | if ($ptype eq "S") { |
@@ -990,8 +1022,8 @@ sub get_list_role { | |||
990 | my $end = find_ending_index($index); | 1022 | my $end = find_ending_index($index); |
991 | 1023 | ||
992 | my $subsystem = $typevalue[$start]; | 1024 | my $subsystem = $typevalue[$start]; |
993 | if (length($subsystem) > 20) { | 1025 | if ($output_section_maxlen && length($subsystem) > $output_section_maxlen) { |
994 | $subsystem = substr($subsystem, 0, 17); | 1026 | $subsystem = substr($subsystem, 0, $output_section_maxlen - 3); |
995 | $subsystem =~ s/\s*$//; | 1027 | $subsystem =~ s/\s*$//; |
996 | $subsystem = $subsystem . "..."; | 1028 | $subsystem = $subsystem . "..."; |
997 | } | 1029 | } |
@@ -1014,7 +1046,7 @@ sub add_categories { | |||
1014 | 1046 | ||
1015 | for ($i = $start + 1; $i < $end; $i++) { | 1047 | for ($i = $start + 1; $i < $end; $i++) { |
1016 | my $tv = $typevalue[$i]; | 1048 | my $tv = $typevalue[$i]; |
1017 | if ($tv =~ m/^(\C):\s*(.*)/) { | 1049 | if ($tv =~ m/^([A-Z]):\s*(.*)/) { |
1018 | my $ptype = $1; | 1050 | my $ptype = $1; |
1019 | my $pvalue = $2; | 1051 | my $pvalue = $2; |
1020 | if ($ptype eq "L") { | 1052 | if ($ptype eq "L") { |
@@ -1056,7 +1088,7 @@ sub add_categories { | |||
1056 | if ($name eq "") { | 1088 | if ($name eq "") { |
1057 | if ($i > 0) { | 1089 | if ($i > 0) { |
1058 | my $tv = $typevalue[$i - 1]; | 1090 | my $tv = $typevalue[$i - 1]; |
1059 | if ($tv =~ m/^(\C):\s*(.*)/) { | 1091 | if ($tv =~ m/^([A-Z]):\s*(.*)/) { |
1060 | if ($1 eq "P") { | 1092 | if ($1 eq "P") { |
1061 | $name = $2; | 1093 | $name = $2; |
1062 | $pvalue = format_email($name, $address, $email_usename); | 1094 | $pvalue = format_email($name, $address, $email_usename); |
@@ -1073,7 +1105,7 @@ sub add_categories { | |||
1073 | if ($name eq "") { | 1105 | if ($name eq "") { |
1074 | if ($i > 0) { | 1106 | if ($i > 0) { |
1075 | my $tv = $typevalue[$i - 1]; | 1107 | my $tv = $typevalue[$i - 1]; |
1076 | if ($tv =~ m/^(\C):\s*(.*)/) { | 1108 | if ($tv =~ m/^([A-Z]):\s*(.*)/) { |
1077 | if ($1 eq "P") { | 1109 | if ($1 eq "P") { |
1078 | $name = $2; | 1110 | $name = $2; |
1079 | $pvalue = format_email($name, $address, $email_usename); | 1111 | $pvalue = format_email($name, $address, $email_usename); |
@@ -1868,6 +1900,7 @@ sub vcs_assign { | |||
1868 | my $percent = $sign_offs * 100 / $divisor; | 1900 | my $percent = $sign_offs * 100 / $divisor; |
1869 | 1901 | ||
1870 | $percent = 100 if ($percent > 100); | 1902 | $percent = 100 if ($percent > 100); |
1903 | next if (ignore_email_address($line)); | ||
1871 | $count++; | 1904 | $count++; |
1872 | last if ($sign_offs < $email_git_min_signatures || | 1905 | last if ($sign_offs < $email_git_min_signatures || |
1873 | $count > $email_git_max_maintainers || | 1906 | $count > $email_git_max_maintainers || |
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index c6d33bd15b04..8fa81e84e295 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
@@ -212,15 +212,22 @@ static int symbol_valid(struct sym_entry *s) | |||
212 | "_SDA_BASE_", /* ppc */ | 212 | "_SDA_BASE_", /* ppc */ |
213 | "_SDA2_BASE_", /* ppc */ | 213 | "_SDA2_BASE_", /* ppc */ |
214 | NULL }; | 214 | NULL }; |
215 | |||
216 | static char *special_suffixes[] = { | ||
217 | "_veneer", /* arm */ | ||
218 | NULL }; | ||
219 | |||
215 | int i; | 220 | int i; |
216 | int offset = 1; | 221 | char *sym_name = (char *)s->sym + 1; |
222 | |||
217 | 223 | ||
218 | if (s->addr < kernel_start_addr) | 224 | if (s->addr < kernel_start_addr) |
219 | return 0; | 225 | return 0; |
220 | 226 | ||
221 | /* skip prefix char */ | 227 | /* skip prefix char */ |
222 | if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char) | 228 | if (symbol_prefix_char && *sym_name == symbol_prefix_char) |
223 | offset++; | 229 | sym_name++; |
230 | |||
224 | 231 | ||
225 | /* if --all-symbols is not specified, then symbols outside the text | 232 | /* if --all-symbols is not specified, then symbols outside the text |
226 | * and inittext sections are discarded */ | 233 | * and inittext sections are discarded */ |
@@ -235,22 +242,26 @@ static int symbol_valid(struct sym_entry *s) | |||
235 | * rules. | 242 | * rules. |
236 | */ | 243 | */ |
237 | if ((s->addr == text_range_text->end && | 244 | if ((s->addr == text_range_text->end && |
238 | strcmp((char *)s->sym + offset, | 245 | strcmp(sym_name, |
239 | text_range_text->end_sym)) || | 246 | text_range_text->end_sym)) || |
240 | (s->addr == text_range_inittext->end && | 247 | (s->addr == text_range_inittext->end && |
241 | strcmp((char *)s->sym + offset, | 248 | strcmp(sym_name, |
242 | text_range_inittext->end_sym))) | 249 | text_range_inittext->end_sym))) |
243 | return 0; | 250 | return 0; |
244 | } | 251 | } |
245 | 252 | ||
246 | /* Exclude symbols which vary between passes. */ | 253 | /* Exclude symbols which vary between passes. */ |
247 | if (strstr((char *)s->sym + offset, "_compiled.")) | ||
248 | return 0; | ||
249 | |||
250 | for (i = 0; special_symbols[i]; i++) | 254 | for (i = 0; special_symbols[i]; i++) |
251 | if( strcmp((char *)s->sym + offset, special_symbols[i]) == 0 ) | 255 | if (strcmp(sym_name, special_symbols[i]) == 0) |
252 | return 0; | 256 | return 0; |
253 | 257 | ||
258 | for (i = 0; special_suffixes[i]; i++) { | ||
259 | int l = strlen(sym_name) - strlen(special_suffixes[i]); | ||
260 | |||
261 | if (l >= 0 && strcmp(sym_name + l, special_suffixes[i]) == 0) | ||
262 | return 0; | ||
263 | } | ||
264 | |||
254 | return 1; | 265 | return 1; |
255 | } | 266 | } |
256 | 267 | ||
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 9645c0739386..aceaaed09811 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Kernel configuration targets | 2 | # Kernel configuration targets |
3 | # These targets are used from top-level makefile | 3 | # These targets are used from top-level makefile |
4 | 4 | ||
5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \ | 5 | PHONY += xconfig gconfig menuconfig config silentoldconfig update-po-config \ |
6 | localmodconfig localyesconfig | 6 | localmodconfig localyesconfig |
7 | 7 | ||
8 | ifdef KBUILD_KCONFIG | 8 | ifdef KBUILD_KCONFIG |
@@ -11,30 +11,31 @@ else | |||
11 | Kconfig := Kconfig | 11 | Kconfig := Kconfig |
12 | endif | 12 | endif |
13 | 13 | ||
14 | ifeq ($(quiet),silent_) | ||
15 | silent := -s | ||
16 | endif | ||
17 | |||
14 | # We need this, in case the user has it in its environment | 18 | # We need this, in case the user has it in its environment |
15 | unexport CONFIG_ | 19 | unexport CONFIG_ |
16 | 20 | ||
17 | xconfig: $(obj)/qconf | 21 | xconfig: $(obj)/qconf |
18 | $< $(Kconfig) | 22 | $< $(silent) $(Kconfig) |
19 | 23 | ||
20 | gconfig: $(obj)/gconf | 24 | gconfig: $(obj)/gconf |
21 | $< $(Kconfig) | 25 | $< $(silent) $(Kconfig) |
22 | 26 | ||
23 | menuconfig: $(obj)/mconf | 27 | menuconfig: $(obj)/mconf |
24 | $< $(Kconfig) | 28 | $< $(silent) $(Kconfig) |
25 | 29 | ||
26 | config: $(obj)/conf | 30 | config: $(obj)/conf |
27 | $< --oldaskconfig $(Kconfig) | 31 | $< $(silent) --oldaskconfig $(Kconfig) |
28 | 32 | ||
29 | nconfig: $(obj)/nconf | 33 | nconfig: $(obj)/nconf |
30 | $< $(Kconfig) | 34 | $< $(silent) $(Kconfig) |
31 | |||
32 | oldconfig: $(obj)/conf | ||
33 | $< --$@ $(Kconfig) | ||
34 | 35 | ||
35 | silentoldconfig: $(obj)/conf | 36 | silentoldconfig: $(obj)/conf |
36 | $(Q)mkdir -p include/config include/generated | 37 | $(Q)mkdir -p include/config include/generated |
37 | $< --$@ $(Kconfig) | 38 | $< $(silent) --$@ $(Kconfig) |
38 | 39 | ||
39 | localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | 40 | localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf |
40 | $(Q)mkdir -p include/config include/generated | 41 | $(Q)mkdir -p include/config include/generated |
@@ -43,18 +44,18 @@ localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | |||
43 | cmp -s .tmp.config .config || \ | 44 | cmp -s .tmp.config .config || \ |
44 | (mv -f .config .config.old.1; \ | 45 | (mv -f .config .config.old.1; \ |
45 | mv -f .tmp.config .config; \ | 46 | mv -f .tmp.config .config; \ |
46 | $(obj)/conf --silentoldconfig $(Kconfig); \ | 47 | $(obj)/conf $(silent) --silentoldconfig $(Kconfig); \ |
47 | mv -f .config.old.1 .config.old) \ | 48 | mv -f .config.old.1 .config.old) \ |
48 | else \ | 49 | else \ |
49 | mv -f .tmp.config .config; \ | 50 | mv -f .tmp.config .config; \ |
50 | $(obj)/conf --silentoldconfig $(Kconfig); \ | 51 | $(obj)/conf $(silent) --silentoldconfig $(Kconfig); \ |
51 | fi | 52 | fi |
52 | $(Q)rm -f .tmp.config | 53 | $(Q)rm -f .tmp.config |
53 | 54 | ||
54 | # Create new linux.pot file | 55 | # Create new linux.pot file |
55 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files | 56 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files |
56 | update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h | 57 | update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h |
57 | $(Q)echo " GEN config.pot" | 58 | $(Q)$(kecho) " GEN config.pot" |
58 | $(Q)xgettext --default-domain=linux \ | 59 | $(Q)xgettext --default-domain=linux \ |
59 | --add-comments --keyword=_ --keyword=N_ \ | 60 | --add-comments --keyword=_ --keyword=N_ \ |
60 | --from-code=UTF-8 \ | 61 | --from-code=UTF-8 \ |
@@ -65,69 +66,71 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h | |||
65 | $(Q)(for i in `ls $(srctree)/arch/*/Kconfig \ | 66 | $(Q)(for i in `ls $(srctree)/arch/*/Kconfig \ |
66 | $(srctree)/arch/*/um/Kconfig`; \ | 67 | $(srctree)/arch/*/um/Kconfig`; \ |
67 | do \ | 68 | do \ |
68 | echo " GEN $$i"; \ | 69 | $(kecho) " GEN $$i"; \ |
69 | $(obj)/kxgettext $$i \ | 70 | $(obj)/kxgettext $$i \ |
70 | >> $(obj)/config.pot; \ | 71 | >> $(obj)/config.pot; \ |
71 | done ) | 72 | done ) |
72 | $(Q)echo " GEN linux.pot" | 73 | $(Q)$(kecho) " GEN linux.pot" |
73 | $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ | 74 | $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ |
74 | --output $(obj)/linux.pot | 75 | --output $(obj)/linux.pot |
75 | $(Q)rm -f $(obj)/config.pot | 76 | $(Q)rm -f $(obj)/config.pot |
76 | 77 | ||
77 | PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig | 78 | # These targets map 1:1 to the commandline options of 'conf' |
79 | simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \ | ||
80 | alldefconfig randconfig listnewconfig olddefconfig | ||
81 | PHONY += $(simple-targets) | ||
78 | 82 | ||
79 | allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf | 83 | $(simple-targets): $(obj)/conf |
80 | $< --$@ $(Kconfig) | 84 | $< $(silent) --$@ $(Kconfig) |
81 | 85 | ||
82 | PHONY += listnewconfig olddefconfig oldnoconfig savedefconfig defconfig | 86 | PHONY += oldnoconfig savedefconfig defconfig |
83 | |||
84 | listnewconfig olddefconfig: $(obj)/conf | ||
85 | $< --$@ $(Kconfig) | ||
86 | 87 | ||
87 | # oldnoconfig is an alias of olddefconfig, because people already are dependent | 88 | # oldnoconfig is an alias of olddefconfig, because people already are dependent |
88 | # on its behavior(sets new symbols to their default value but not 'n') with the | 89 | # on its behavior (sets new symbols to their default value but not 'n') with the |
89 | # counter-intuitive name. | 90 | # counter-intuitive name. |
90 | oldnoconfig: $(obj)/conf | 91 | oldnoconfig: olddefconfig |
91 | $< --olddefconfig $(Kconfig) | ||
92 | 92 | ||
93 | savedefconfig: $(obj)/conf | 93 | savedefconfig: $(obj)/conf |
94 | $< --$@=defconfig $(Kconfig) | 94 | $< $(silent) --$@=defconfig $(Kconfig) |
95 | 95 | ||
96 | defconfig: $(obj)/conf | 96 | defconfig: $(obj)/conf |
97 | ifeq ($(KBUILD_DEFCONFIG),) | 97 | ifeq ($(KBUILD_DEFCONFIG),) |
98 | $< --defconfig $(Kconfig) | 98 | $< $(silent) --defconfig $(Kconfig) |
99 | else | 99 | else |
100 | @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" | 100 | @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" |
101 | $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) | 101 | $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) |
102 | endif | 102 | endif |
103 | 103 | ||
104 | %_defconfig: $(obj)/conf | 104 | %_defconfig: $(obj)/conf |
105 | $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) | 105 | $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) |
106 | 106 | ||
107 | configfiles=$(wildcard $(srctree)/kernel/configs/$(1).config $(srctree)/arch/$(SRCARCH)/configs/$(1).config) | 107 | configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@) |
108 | 108 | ||
109 | define mergeconfig | 109 | %.config: $(obj)/conf |
110 | $(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for this target)) | 110 | $(if $(call configfiles),, $(error No configuration exists for this target on this architecture)) |
111 | $(if $(call configfiles,$(1)),, $(error No configuration exists for this target on this architecture)) | 111 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(configfiles) |
112 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O $(objtree) $(objtree)/.config $(call configfiles,$(1)) | 112 | +$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig |
113 | $(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig | ||
114 | endef | ||
115 | 113 | ||
116 | PHONY += kvmconfig | 114 | PHONY += kvmconfig |
117 | kvmconfig: | 115 | kvmconfig: kvm_guest.config |
118 | $(call mergeconfig,kvm_guest) | 116 | @: |
117 | |||
118 | PHONY += xenconfig | ||
119 | xenconfig: xen.config | ||
120 | @: | ||
119 | 121 | ||
120 | PHONY += tinyconfig | 122 | PHONY += tinyconfig |
121 | tinyconfig: allnoconfig | 123 | tinyconfig: |
122 | $(call mergeconfig,tiny) | 124 | $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config |
123 | 125 | ||
124 | # Help text used by make help | 126 | # Help text used by make help |
125 | help: | 127 | help: |
126 | @echo ' config - Update current config utilising a line-oriented program' | 128 | @echo ' config - Update current config utilising a line-oriented program' |
127 | @echo ' nconfig - Update current config utilising a ncurses menu based program' | 129 | @echo ' nconfig - Update current config utilising a ncurses menu based' |
130 | @echo ' program' | ||
128 | @echo ' menuconfig - Update current config utilising a menu based program' | 131 | @echo ' menuconfig - Update current config utilising a menu based program' |
129 | @echo ' xconfig - Update current config utilising a QT based front-end' | 132 | @echo ' xconfig - Update current config utilising a Qt based front-end' |
130 | @echo ' gconfig - Update current config utilising a GTK based front-end' | 133 | @echo ' gconfig - Update current config utilising a GTK+ based front-end' |
131 | @echo ' oldconfig - Update current config utilising a provided .config as base' | 134 | @echo ' oldconfig - Update current config utilising a provided .config as base' |
132 | @echo ' localmodconfig - Update current config disabling modules not loaded' | 135 | @echo ' localmodconfig - Update current config disabling modules not loaded' |
133 | @echo ' localyesconfig - Update current config converting local mods to core' | 136 | @echo ' localyesconfig - Update current config converting local mods to core' |
@@ -140,8 +143,10 @@ help: | |||
140 | @echo ' alldefconfig - New config with all symbols set to default' | 143 | @echo ' alldefconfig - New config with all symbols set to default' |
141 | @echo ' randconfig - New config with random answer to all options' | 144 | @echo ' randconfig - New config with random answer to all options' |
142 | @echo ' listnewconfig - List new options' | 145 | @echo ' listnewconfig - List new options' |
143 | @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value' | 146 | @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their' |
144 | @echo ' kvmconfig - Enable additional options for guest kernel support' | 147 | @echo ' default value' |
148 | @echo ' kvmconfig - Enable additional options for kvm guest kernel support' | ||
149 | @echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support' | ||
145 | @echo ' tinyconfig - Configure the tiniest possible kernel' | 150 | @echo ' tinyconfig - Configure the tiniest possible kernel' |
146 | 151 | ||
147 | # lxdialog stuff | 152 | # lxdialog stuff |
@@ -160,9 +165,9 @@ HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \ | |||
160 | # mconf: Used for the menuconfig target | 165 | # mconf: Used for the menuconfig target |
161 | # Utilizes the lxdialog package | 166 | # Utilizes the lxdialog package |
162 | # qconf: Used for the xconfig target | 167 | # qconf: Used for the xconfig target |
163 | # Based on QT which needs to be installed to compile it | 168 | # Based on Qt which needs to be installed to compile it |
164 | # gconf: Used for the gconfig target | 169 | # gconf: Used for the gconfig target |
165 | # Based on GTK which needs to be installed to compile it | 170 | # Based on GTK+ which needs to be installed to compile it |
166 | # object files used by all kconfig flavours | 171 | # object files used by all kconfig flavours |
167 | 172 | ||
168 | lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o | 173 | lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o |
@@ -219,11 +224,11 @@ ifeq ($(MAKECMDGOALS),xconfig) | |||
219 | $(obj)/.tmp_qtcheck: $(src)/Makefile | 224 | $(obj)/.tmp_qtcheck: $(src)/Makefile |
220 | -include $(obj)/.tmp_qtcheck | 225 | -include $(obj)/.tmp_qtcheck |
221 | 226 | ||
222 | # QT needs some extra effort... | 227 | # Qt needs some extra effort... |
223 | $(obj)/.tmp_qtcheck: | 228 | $(obj)/.tmp_qtcheck: |
224 | @set -e; echo " CHECK qt"; dir=""; pkg=""; \ | 229 | @set -e; $(kecho) " CHECK qt"; dir=""; pkg=""; \ |
225 | if ! pkg-config --exists QtCore 2> /dev/null; then \ | 230 | if ! pkg-config --exists QtCore 2> /dev/null; then \ |
226 | echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \ | 231 | echo "* Unable to find the Qt4 tool qmake. Trying to use Qt3"; \ |
227 | pkg-config --exists qt 2> /dev/null && pkg=qt; \ | 232 | pkg-config --exists qt 2> /dev/null && pkg=qt; \ |
228 | pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ | 233 | pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ |
229 | if [ -n "$$pkg" ]; then \ | 234 | if [ -n "$$pkg" ]; then \ |
@@ -237,8 +242,8 @@ $(obj)/.tmp_qtcheck: | |||
237 | done; \ | 242 | done; \ |
238 | if [ -z "$$dir" ]; then \ | 243 | if [ -z "$$dir" ]; then \ |
239 | echo >&2 "*"; \ | 244 | echo >&2 "*"; \ |
240 | echo >&2 "* Unable to find any QT installation. Please make sure that"; \ | 245 | echo >&2 "* Unable to find any Qt installation. Please make sure that"; \ |
241 | echo >&2 "* the QT4 or QT3 development package is correctly installed and"; \ | 246 | echo >&2 "* the Qt4 or Qt3 development package is correctly installed and"; \ |
242 | echo >&2 "* either qmake can be found or install pkg-config or set"; \ | 247 | echo >&2 "* either qmake can be found or install pkg-config or set"; \ |
243 | echo >&2 "* the QTDIR environment variable to the correct location."; \ | 248 | echo >&2 "* the QTDIR environment variable to the correct location."; \ |
244 | echo >&2 "*"; \ | 249 | echo >&2 "*"; \ |
@@ -275,7 +280,7 @@ $(obj)/gconf.o: $(obj)/.tmp_gtkcheck | |||
275 | ifeq ($(MAKECMDGOALS),gconfig) | 280 | ifeq ($(MAKECMDGOALS),gconfig) |
276 | -include $(obj)/.tmp_gtkcheck | 281 | -include $(obj)/.tmp_gtkcheck |
277 | 282 | ||
278 | # GTK needs some extra effort, too... | 283 | # GTK+ needs some extra effort, too... |
279 | $(obj)/.tmp_gtkcheck: | 284 | $(obj)/.tmp_gtkcheck: |
280 | @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \ | 285 | @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \ |
281 | if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \ | 286 | if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \ |
@@ -306,7 +311,7 @@ quiet_cmd_moc = MOC $@ | |||
306 | $(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck | 311 | $(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck |
307 | $(call cmd,moc) | 312 | $(call cmd,moc) |
308 | 313 | ||
309 | # Extract gconf menu items for I18N support | 314 | # Extract gconf menu items for i18n support |
310 | $(obj)/gconf.glade.h: $(obj)/gconf.glade | 315 | $(obj)/gconf.glade.h: $(obj)/gconf.glade |
311 | $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \ | 316 | $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \ |
312 | $(obj)/gconf.glade | 317 | $(obj)/gconf.glade |
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index fef75fc756f4..6c204318bc94 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -471,7 +471,7 @@ static struct option long_opts[] = { | |||
471 | static void conf_usage(const char *progname) | 471 | static void conf_usage(const char *progname) |
472 | { | 472 | { |
473 | 473 | ||
474 | printf("Usage: %s [option] <kconfig-file>\n", progname); | 474 | printf("Usage: %s [-s] [option] <kconfig-file>\n", progname); |
475 | printf("[option] is _one_ of the following:\n"); | 475 | printf("[option] is _one_ of the following:\n"); |
476 | printf(" --listnewconfig List new options\n"); | 476 | printf(" --listnewconfig List new options\n"); |
477 | printf(" --oldaskconfig Start a new configuration using a line-oriented program\n"); | 477 | printf(" --oldaskconfig Start a new configuration using a line-oriented program\n"); |
@@ -501,7 +501,11 @@ int main(int ac, char **av) | |||
501 | 501 | ||
502 | tty_stdio = isatty(0) && isatty(1) && isatty(2); | 502 | tty_stdio = isatty(0) && isatty(1) && isatty(2); |
503 | 503 | ||
504 | while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) { | 504 | while ((opt = getopt_long(ac, av, "s", long_opts, NULL)) != -1) { |
505 | if (opt == 's') { | ||
506 | conf_set_message_callback(NULL); | ||
507 | continue; | ||
508 | } | ||
505 | input_mode = (enum input_mode)opt; | 509 | input_mode = (enum input_mode)opt; |
506 | switch (opt) { | 510 | switch (opt) { |
507 | case silentoldconfig: | 511 | case silentoldconfig: |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 28df18dd1147..c814f57672fc 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -16,6 +16,11 @@ | |||
16 | 16 | ||
17 | #include "lkc.h" | 17 | #include "lkc.h" |
18 | 18 | ||
19 | struct conf_printer { | ||
20 | void (*print_symbol)(FILE *, struct symbol *, const char *, void *); | ||
21 | void (*print_comment)(FILE *, const char *, void *); | ||
22 | }; | ||
23 | |||
19 | static void conf_warning(const char *fmt, ...) | 24 | static void conf_warning(const char *fmt, ...) |
20 | __attribute__ ((format (printf, 1, 2))); | 25 | __attribute__ ((format (printf, 1, 2))); |
21 | 26 | ||
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index d6626521f9b9..667d1aa23711 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c | |||
@@ -11,6 +11,9 @@ | |||
11 | 11 | ||
12 | #define DEBUG_EXPR 0 | 12 | #define DEBUG_EXPR 0 |
13 | 13 | ||
14 | static int expr_eq(struct expr *e1, struct expr *e2); | ||
15 | static struct expr *expr_eliminate_yn(struct expr *e); | ||
16 | |||
14 | struct expr *expr_alloc_symbol(struct symbol *sym) | 17 | struct expr *expr_alloc_symbol(struct symbol *sym) |
15 | { | 18 | { |
16 | struct expr *e = xcalloc(1, sizeof(*e)); | 19 | struct expr *e = xcalloc(1, sizeof(*e)); |
@@ -76,6 +79,10 @@ struct expr *expr_copy(const struct expr *org) | |||
76 | e->left.expr = expr_copy(org->left.expr); | 79 | e->left.expr = expr_copy(org->left.expr); |
77 | break; | 80 | break; |
78 | case E_EQUAL: | 81 | case E_EQUAL: |
82 | case E_GEQ: | ||
83 | case E_GTH: | ||
84 | case E_LEQ: | ||
85 | case E_LTH: | ||
79 | case E_UNEQUAL: | 86 | case E_UNEQUAL: |
80 | e->left.sym = org->left.sym; | 87 | e->left.sym = org->left.sym; |
81 | e->right.sym = org->right.sym; | 88 | e->right.sym = org->right.sym; |
@@ -108,6 +115,10 @@ void expr_free(struct expr *e) | |||
108 | expr_free(e->left.expr); | 115 | expr_free(e->left.expr); |
109 | return; | 116 | return; |
110 | case E_EQUAL: | 117 | case E_EQUAL: |
118 | case E_GEQ: | ||
119 | case E_GTH: | ||
120 | case E_LEQ: | ||
121 | case E_LTH: | ||
111 | case E_UNEQUAL: | 122 | case E_UNEQUAL: |
112 | break; | 123 | break; |
113 | case E_OR: | 124 | case E_OR: |
@@ -186,7 +197,7 @@ void expr_eliminate_eq(struct expr **ep1, struct expr **ep2) | |||
186 | #undef e1 | 197 | #undef e1 |
187 | #undef e2 | 198 | #undef e2 |
188 | 199 | ||
189 | int expr_eq(struct expr *e1, struct expr *e2) | 200 | static int expr_eq(struct expr *e1, struct expr *e2) |
190 | { | 201 | { |
191 | int res, old_count; | 202 | int res, old_count; |
192 | 203 | ||
@@ -194,6 +205,10 @@ int expr_eq(struct expr *e1, struct expr *e2) | |||
194 | return 0; | 205 | return 0; |
195 | switch (e1->type) { | 206 | switch (e1->type) { |
196 | case E_EQUAL: | 207 | case E_EQUAL: |
208 | case E_GEQ: | ||
209 | case E_GTH: | ||
210 | case E_LEQ: | ||
211 | case E_LTH: | ||
197 | case E_UNEQUAL: | 212 | case E_UNEQUAL: |
198 | return e1->left.sym == e2->left.sym && e1->right.sym == e2->right.sym; | 213 | return e1->left.sym == e2->left.sym && e1->right.sym == e2->right.sym; |
199 | case E_SYMBOL: | 214 | case E_SYMBOL: |
@@ -228,7 +243,7 @@ int expr_eq(struct expr *e1, struct expr *e2) | |||
228 | return 0; | 243 | return 0; |
229 | } | 244 | } |
230 | 245 | ||
231 | struct expr *expr_eliminate_yn(struct expr *e) | 246 | static struct expr *expr_eliminate_yn(struct expr *e) |
232 | { | 247 | { |
233 | struct expr *tmp; | 248 | struct expr *tmp; |
234 | 249 | ||
@@ -553,62 +568,6 @@ static void expr_eliminate_dups1(enum expr_type type, struct expr **ep1, struct | |||
553 | #undef e2 | 568 | #undef e2 |
554 | } | 569 | } |
555 | 570 | ||
556 | static void expr_eliminate_dups2(enum expr_type type, struct expr **ep1, struct expr **ep2) | ||
557 | { | ||
558 | #define e1 (*ep1) | ||
559 | #define e2 (*ep2) | ||
560 | struct expr *tmp, *tmp1, *tmp2; | ||
561 | |||
562 | if (e1->type == type) { | ||
563 | expr_eliminate_dups2(type, &e1->left.expr, &e2); | ||
564 | expr_eliminate_dups2(type, &e1->right.expr, &e2); | ||
565 | return; | ||
566 | } | ||
567 | if (e2->type == type) { | ||
568 | expr_eliminate_dups2(type, &e1, &e2->left.expr); | ||
569 | expr_eliminate_dups2(type, &e1, &e2->right.expr); | ||
570 | } | ||
571 | if (e1 == e2) | ||
572 | return; | ||
573 | |||
574 | switch (e1->type) { | ||
575 | case E_OR: | ||
576 | expr_eliminate_dups2(e1->type, &e1, &e1); | ||
577 | // (FOO || BAR) && (!FOO && !BAR) -> n | ||
578 | tmp1 = expr_transform(expr_alloc_one(E_NOT, expr_copy(e1))); | ||
579 | tmp2 = expr_copy(e2); | ||
580 | tmp = expr_extract_eq_and(&tmp1, &tmp2); | ||
581 | if (expr_is_yes(tmp1)) { | ||
582 | expr_free(e1); | ||
583 | e1 = expr_alloc_symbol(&symbol_no); | ||
584 | trans_count++; | ||
585 | } | ||
586 | expr_free(tmp2); | ||
587 | expr_free(tmp1); | ||
588 | expr_free(tmp); | ||
589 | break; | ||
590 | case E_AND: | ||
591 | expr_eliminate_dups2(e1->type, &e1, &e1); | ||
592 | // (FOO && BAR) || (!FOO || !BAR) -> y | ||
593 | tmp1 = expr_transform(expr_alloc_one(E_NOT, expr_copy(e1))); | ||
594 | tmp2 = expr_copy(e2); | ||
595 | tmp = expr_extract_eq_or(&tmp1, &tmp2); | ||
596 | if (expr_is_no(tmp1)) { | ||
597 | expr_free(e1); | ||
598 | e1 = expr_alloc_symbol(&symbol_yes); | ||
599 | trans_count++; | ||
600 | } | ||
601 | expr_free(tmp2); | ||
602 | expr_free(tmp1); | ||
603 | expr_free(tmp); | ||
604 | break; | ||
605 | default: | ||
606 | ; | ||
607 | } | ||
608 | #undef e1 | ||
609 | #undef e2 | ||
610 | } | ||
611 | |||
612 | struct expr *expr_eliminate_dups(struct expr *e) | 571 | struct expr *expr_eliminate_dups(struct expr *e) |
613 | { | 572 | { |
614 | int oldcount; | 573 | int oldcount; |
@@ -621,7 +580,6 @@ struct expr *expr_eliminate_dups(struct expr *e) | |||
621 | switch (e->type) { | 580 | switch (e->type) { |
622 | case E_OR: case E_AND: | 581 | case E_OR: case E_AND: |
623 | expr_eliminate_dups1(e->type, &e, &e); | 582 | expr_eliminate_dups1(e->type, &e, &e); |
624 | expr_eliminate_dups2(e->type, &e, &e); | ||
625 | default: | 583 | default: |
626 | ; | 584 | ; |
627 | } | 585 | } |
@@ -641,6 +599,10 @@ struct expr *expr_transform(struct expr *e) | |||
641 | return NULL; | 599 | return NULL; |
642 | switch (e->type) { | 600 | switch (e->type) { |
643 | case E_EQUAL: | 601 | case E_EQUAL: |
602 | case E_GEQ: | ||
603 | case E_GTH: | ||
604 | case E_LEQ: | ||
605 | case E_LTH: | ||
644 | case E_UNEQUAL: | 606 | case E_UNEQUAL: |
645 | case E_SYMBOL: | 607 | case E_SYMBOL: |
646 | case E_LIST: | 608 | case E_LIST: |
@@ -713,6 +675,22 @@ struct expr *expr_transform(struct expr *e) | |||
713 | e = tmp; | 675 | e = tmp; |
714 | e->type = e->type == E_EQUAL ? E_UNEQUAL : E_EQUAL; | 676 | e->type = e->type == E_EQUAL ? E_UNEQUAL : E_EQUAL; |
715 | break; | 677 | break; |
678 | case E_LEQ: | ||
679 | case E_GEQ: | ||
680 | // !a<='x' -> a>'x' | ||
681 | tmp = e->left.expr; | ||
682 | free(e); | ||
683 | e = tmp; | ||
684 | e->type = e->type == E_LEQ ? E_GTH : E_LTH; | ||
685 | break; | ||
686 | case E_LTH: | ||
687 | case E_GTH: | ||
688 | // !a<'x' -> a>='x' | ||
689 | tmp = e->left.expr; | ||
690 | free(e); | ||
691 | e = tmp; | ||
692 | e->type = e->type == E_LTH ? E_GEQ : E_LEQ; | ||
693 | break; | ||
716 | case E_OR: | 694 | case E_OR: |
717 | // !(a || b) -> !a && !b | 695 | // !(a || b) -> !a && !b |
718 | tmp = e->left.expr; | 696 | tmp = e->left.expr; |
@@ -783,6 +761,10 @@ int expr_contains_symbol(struct expr *dep, struct symbol *sym) | |||
783 | case E_SYMBOL: | 761 | case E_SYMBOL: |
784 | return dep->left.sym == sym; | 762 | return dep->left.sym == sym; |
785 | case E_EQUAL: | 763 | case E_EQUAL: |
764 | case E_GEQ: | ||
765 | case E_GTH: | ||
766 | case E_LEQ: | ||
767 | case E_LTH: | ||
786 | case E_UNEQUAL: | 768 | case E_UNEQUAL: |
787 | return dep->left.sym == sym || | 769 | return dep->left.sym == sym || |
788 | dep->right.sym == sym; | 770 | dep->right.sym == sym; |
@@ -823,57 +805,6 @@ bool expr_depends_symbol(struct expr *dep, struct symbol *sym) | |||
823 | return false; | 805 | return false; |
824 | } | 806 | } |
825 | 807 | ||
826 | struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2) | ||
827 | { | ||
828 | struct expr *tmp = NULL; | ||
829 | expr_extract_eq(E_AND, &tmp, ep1, ep2); | ||
830 | if (tmp) { | ||
831 | *ep1 = expr_eliminate_yn(*ep1); | ||
832 | *ep2 = expr_eliminate_yn(*ep2); | ||
833 | } | ||
834 | return tmp; | ||
835 | } | ||
836 | |||
837 | struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2) | ||
838 | { | ||
839 | struct expr *tmp = NULL; | ||
840 | expr_extract_eq(E_OR, &tmp, ep1, ep2); | ||
841 | if (tmp) { | ||
842 | *ep1 = expr_eliminate_yn(*ep1); | ||
843 | *ep2 = expr_eliminate_yn(*ep2); | ||
844 | } | ||
845 | return tmp; | ||
846 | } | ||
847 | |||
848 | void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2) | ||
849 | { | ||
850 | #define e1 (*ep1) | ||
851 | #define e2 (*ep2) | ||
852 | if (e1->type == type) { | ||
853 | expr_extract_eq(type, ep, &e1->left.expr, &e2); | ||
854 | expr_extract_eq(type, ep, &e1->right.expr, &e2); | ||
855 | return; | ||
856 | } | ||
857 | if (e2->type == type) { | ||
858 | expr_extract_eq(type, ep, ep1, &e2->left.expr); | ||
859 | expr_extract_eq(type, ep, ep1, &e2->right.expr); | ||
860 | return; | ||
861 | } | ||
862 | if (expr_eq(e1, e2)) { | ||
863 | *ep = *ep ? expr_alloc_two(type, *ep, e1) : e1; | ||
864 | expr_free(e2); | ||
865 | if (type == E_AND) { | ||
866 | e1 = expr_alloc_symbol(&symbol_yes); | ||
867 | e2 = expr_alloc_symbol(&symbol_yes); | ||
868 | } else if (type == E_OR) { | ||
869 | e1 = expr_alloc_symbol(&symbol_no); | ||
870 | e2 = expr_alloc_symbol(&symbol_no); | ||
871 | } | ||
872 | } | ||
873 | #undef e1 | ||
874 | #undef e2 | ||
875 | } | ||
876 | |||
877 | struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym) | 808 | struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym) |
878 | { | 809 | { |
879 | struct expr *e1, *e2; | 810 | struct expr *e1, *e2; |
@@ -908,6 +839,10 @@ struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symb | |||
908 | case E_NOT: | 839 | case E_NOT: |
909 | return expr_trans_compare(e->left.expr, type == E_EQUAL ? E_UNEQUAL : E_EQUAL, sym); | 840 | return expr_trans_compare(e->left.expr, type == E_EQUAL ? E_UNEQUAL : E_EQUAL, sym); |
910 | case E_UNEQUAL: | 841 | case E_UNEQUAL: |
842 | case E_LTH: | ||
843 | case E_LEQ: | ||
844 | case E_GTH: | ||
845 | case E_GEQ: | ||
911 | case E_EQUAL: | 846 | case E_EQUAL: |
912 | if (type == E_EQUAL) { | 847 | if (type == E_EQUAL) { |
913 | if (sym == &symbol_yes) | 848 | if (sym == &symbol_yes) |
@@ -935,10 +870,57 @@ struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symb | |||
935 | return NULL; | 870 | return NULL; |
936 | } | 871 | } |
937 | 872 | ||
873 | enum string_value_kind { | ||
874 | k_string, | ||
875 | k_signed, | ||
876 | k_unsigned, | ||
877 | k_invalid | ||
878 | }; | ||
879 | |||
880 | union string_value { | ||
881 | unsigned long long u; | ||
882 | signed long long s; | ||
883 | }; | ||
884 | |||
885 | static enum string_value_kind expr_parse_string(const char *str, | ||
886 | enum symbol_type type, | ||
887 | union string_value *val) | ||
888 | { | ||
889 | char *tail; | ||
890 | enum string_value_kind kind; | ||
891 | |||
892 | errno = 0; | ||
893 | switch (type) { | ||
894 | case S_BOOLEAN: | ||
895 | case S_TRISTATE: | ||
896 | return k_string; | ||
897 | case S_INT: | ||
898 | val->s = strtoll(str, &tail, 10); | ||
899 | kind = k_signed; | ||
900 | break; | ||
901 | case S_HEX: | ||
902 | val->u = strtoull(str, &tail, 16); | ||
903 | kind = k_unsigned; | ||
904 | break; | ||
905 | case S_STRING: | ||
906 | case S_UNKNOWN: | ||
907 | val->s = strtoll(str, &tail, 0); | ||
908 | kind = k_signed; | ||
909 | break; | ||
910 | default: | ||
911 | return k_invalid; | ||
912 | } | ||
913 | return !errno && !*tail && tail > str && isxdigit(tail[-1]) | ||
914 | ? kind : k_string; | ||
915 | } | ||
916 | |||
938 | tristate expr_calc_value(struct expr *e) | 917 | tristate expr_calc_value(struct expr *e) |
939 | { | 918 | { |
940 | tristate val1, val2; | 919 | tristate val1, val2; |
941 | const char *str1, *str2; | 920 | const char *str1, *str2; |
921 | enum string_value_kind k1 = k_string, k2 = k_string; | ||
922 | union string_value lval = {}, rval = {}; | ||
923 | int res; | ||
942 | 924 | ||
943 | if (!e) | 925 | if (!e) |
944 | return yes; | 926 | return yes; |
@@ -959,31 +941,70 @@ tristate expr_calc_value(struct expr *e) | |||
959 | val1 = expr_calc_value(e->left.expr); | 941 | val1 = expr_calc_value(e->left.expr); |
960 | return EXPR_NOT(val1); | 942 | return EXPR_NOT(val1); |
961 | case E_EQUAL: | 943 | case E_EQUAL: |
962 | sym_calc_value(e->left.sym); | 944 | case E_GEQ: |
963 | sym_calc_value(e->right.sym); | 945 | case E_GTH: |
964 | str1 = sym_get_string_value(e->left.sym); | 946 | case E_LEQ: |
965 | str2 = sym_get_string_value(e->right.sym); | 947 | case E_LTH: |
966 | return !strcmp(str1, str2) ? yes : no; | ||
967 | case E_UNEQUAL: | 948 | case E_UNEQUAL: |
968 | sym_calc_value(e->left.sym); | 949 | break; |
969 | sym_calc_value(e->right.sym); | ||
970 | str1 = sym_get_string_value(e->left.sym); | ||
971 | str2 = sym_get_string_value(e->right.sym); | ||
972 | return !strcmp(str1, str2) ? no : yes; | ||
973 | default: | 950 | default: |
974 | printf("expr_calc_value: %d?\n", e->type); | 951 | printf("expr_calc_value: %d?\n", e->type); |
975 | return no; | 952 | return no; |
976 | } | 953 | } |
954 | |||
955 | sym_calc_value(e->left.sym); | ||
956 | sym_calc_value(e->right.sym); | ||
957 | str1 = sym_get_string_value(e->left.sym); | ||
958 | str2 = sym_get_string_value(e->right.sym); | ||
959 | |||
960 | if (e->left.sym->type != S_STRING || e->right.sym->type != S_STRING) { | ||
961 | k1 = expr_parse_string(str1, e->left.sym->type, &lval); | ||
962 | k2 = expr_parse_string(str2, e->right.sym->type, &rval); | ||
963 | } | ||
964 | |||
965 | if (k1 == k_string || k2 == k_string) | ||
966 | res = strcmp(str1, str2); | ||
967 | else if (k1 == k_invalid || k2 == k_invalid) { | ||
968 | if (e->type != E_EQUAL && e->type != E_UNEQUAL) { | ||
969 | printf("Cannot compare \"%s\" and \"%s\"\n", str1, str2); | ||
970 | return no; | ||
971 | } | ||
972 | res = strcmp(str1, str2); | ||
973 | } else if (k1 == k_unsigned || k2 == k_unsigned) | ||
974 | res = (lval.u > rval.u) - (lval.u < rval.u); | ||
975 | else /* if (k1 == k_signed && k2 == k_signed) */ | ||
976 | res = (lval.s > rval.s) - (lval.s < rval.s); | ||
977 | |||
978 | switch(e->type) { | ||
979 | case E_EQUAL: | ||
980 | return res ? no : yes; | ||
981 | case E_GEQ: | ||
982 | return res >= 0 ? yes : no; | ||
983 | case E_GTH: | ||
984 | return res > 0 ? yes : no; | ||
985 | case E_LEQ: | ||
986 | return res <= 0 ? yes : no; | ||
987 | case E_LTH: | ||
988 | return res < 0 ? yes : no; | ||
989 | case E_UNEQUAL: | ||
990 | return res ? yes : no; | ||
991 | default: | ||
992 | printf("expr_calc_value: relation %d?\n", e->type); | ||
993 | return no; | ||
994 | } | ||
977 | } | 995 | } |
978 | 996 | ||
979 | int expr_compare_type(enum expr_type t1, enum expr_type t2) | 997 | static int expr_compare_type(enum expr_type t1, enum expr_type t2) |
980 | { | 998 | { |
981 | #if 0 | ||
982 | return 1; | ||
983 | #else | ||
984 | if (t1 == t2) | 999 | if (t1 == t2) |
985 | return 0; | 1000 | return 0; |
986 | switch (t1) { | 1001 | switch (t1) { |
1002 | case E_LEQ: | ||
1003 | case E_LTH: | ||
1004 | case E_GEQ: | ||
1005 | case E_GTH: | ||
1006 | if (t2 == E_EQUAL || t2 == E_UNEQUAL) | ||
1007 | return 1; | ||
987 | case E_EQUAL: | 1008 | case E_EQUAL: |
988 | case E_UNEQUAL: | 1009 | case E_UNEQUAL: |
989 | if (t2 == E_NOT) | 1010 | if (t2 == E_NOT) |
@@ -1005,7 +1026,6 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2) | |||
1005 | } | 1026 | } |
1006 | printf("[%dgt%d?]", t1, t2); | 1027 | printf("[%dgt%d?]", t1, t2); |
1007 | return 0; | 1028 | return 0; |
1008 | #endif | ||
1009 | } | 1029 | } |
1010 | 1030 | ||
1011 | static inline struct expr * | 1031 | static inline struct expr * |
@@ -1078,6 +1098,24 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char * | |||
1078 | fn(data, NULL, "="); | 1098 | fn(data, NULL, "="); |
1079 | fn(data, e->right.sym, e->right.sym->name); | 1099 | fn(data, e->right.sym, e->right.sym->name); |
1080 | break; | 1100 | break; |
1101 | case E_LEQ: | ||
1102 | case E_LTH: | ||
1103 | if (e->left.sym->name) | ||
1104 | fn(data, e->left.sym, e->left.sym->name); | ||
1105 | else | ||
1106 | fn(data, NULL, "<choice>"); | ||
1107 | fn(data, NULL, e->type == E_LEQ ? "<=" : "<"); | ||
1108 | fn(data, e->right.sym, e->right.sym->name); | ||
1109 | break; | ||
1110 | case E_GEQ: | ||
1111 | case E_GTH: | ||
1112 | if (e->left.sym->name) | ||
1113 | fn(data, e->left.sym, e->left.sym->name); | ||
1114 | else | ||
1115 | fn(data, NULL, "<choice>"); | ||
1116 | fn(data, NULL, e->type == E_LEQ ? ">=" : ">"); | ||
1117 | fn(data, e->right.sym, e->right.sym->name); | ||
1118 | break; | ||
1081 | case E_UNEQUAL: | 1119 | case E_UNEQUAL: |
1082 | if (e->left.sym->name) | 1120 | if (e->left.sym->name) |
1083 | fn(data, e->left.sym, e->left.sym->name); | 1121 | fn(data, e->left.sym, e->left.sym->name); |
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 412ea8a2abb8..973b6f733368 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h | |||
@@ -29,7 +29,9 @@ typedef enum tristate { | |||
29 | } tristate; | 29 | } tristate; |
30 | 30 | ||
31 | enum expr_type { | 31 | enum expr_type { |
32 | E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_LIST, E_SYMBOL, E_RANGE | 32 | E_NONE, E_OR, E_AND, E_NOT, |
33 | E_EQUAL, E_UNEQUAL, E_LTH, E_LEQ, E_GTH, E_GEQ, | ||
34 | E_LIST, E_SYMBOL, E_RANGE | ||
33 | }; | 35 | }; |
34 | 36 | ||
35 | union expr_data { | 37 | union expr_data { |
@@ -205,18 +207,13 @@ struct expr *expr_alloc_and(struct expr *e1, struct expr *e2); | |||
205 | struct expr *expr_alloc_or(struct expr *e1, struct expr *e2); | 207 | struct expr *expr_alloc_or(struct expr *e1, struct expr *e2); |
206 | struct expr *expr_copy(const struct expr *org); | 208 | struct expr *expr_copy(const struct expr *org); |
207 | void expr_free(struct expr *e); | 209 | void expr_free(struct expr *e); |
208 | int expr_eq(struct expr *e1, struct expr *e2); | ||
209 | void expr_eliminate_eq(struct expr **ep1, struct expr **ep2); | 210 | void expr_eliminate_eq(struct expr **ep1, struct expr **ep2); |
210 | tristate expr_calc_value(struct expr *e); | 211 | tristate expr_calc_value(struct expr *e); |
211 | struct expr *expr_eliminate_yn(struct expr *e); | ||
212 | struct expr *expr_trans_bool(struct expr *e); | 212 | struct expr *expr_trans_bool(struct expr *e); |
213 | struct expr *expr_eliminate_dups(struct expr *e); | 213 | struct expr *expr_eliminate_dups(struct expr *e); |
214 | struct expr *expr_transform(struct expr *e); | 214 | struct expr *expr_transform(struct expr *e); |
215 | int expr_contains_symbol(struct expr *dep, struct symbol *sym); | 215 | int expr_contains_symbol(struct expr *dep, struct symbol *sym); |
216 | bool expr_depends_symbol(struct expr *dep, struct symbol *sym); | 216 | bool expr_depends_symbol(struct expr *dep, struct symbol *sym); |
217 | struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2); | ||
218 | struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2); | ||
219 | void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2); | ||
220 | struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); | 217 | struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); |
221 | struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2); | 218 | struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2); |
222 | 219 | ||
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index d0a35b21f308..26d208b435a0 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c | |||
@@ -169,14 +169,6 @@ void init_main_window(const gchar * glade_file) | |||
169 | style = gtk_widget_get_style(main_wnd); | 169 | style = gtk_widget_get_style(main_wnd); |
170 | widget = glade_xml_get_widget(xml, "toolbar1"); | 170 | widget = glade_xml_get_widget(xml, "toolbar1"); |
171 | 171 | ||
172 | #if 0 /* Use stock Gtk icons instead */ | ||
173 | replace_button_icon(xml, main_wnd->window, style, | ||
174 | "button1", (gchar **) xpm_back); | ||
175 | replace_button_icon(xml, main_wnd->window, style, | ||
176 | "button2", (gchar **) xpm_load); | ||
177 | replace_button_icon(xml, main_wnd->window, style, | ||
178 | "button3", (gchar **) xpm_save); | ||
179 | #endif | ||
180 | replace_button_icon(xml, main_wnd->window, style, | 172 | replace_button_icon(xml, main_wnd->window, style, |
181 | "button4", (gchar **) xpm_single_view); | 173 | "button4", (gchar **) xpm_single_view); |
182 | replace_button_icon(xml, main_wnd->window, style, | 174 | replace_button_icon(xml, main_wnd->window, style, |
@@ -184,22 +176,6 @@ void init_main_window(const gchar * glade_file) | |||
184 | replace_button_icon(xml, main_wnd->window, style, | 176 | replace_button_icon(xml, main_wnd->window, style, |
185 | "button6", (gchar **) xpm_tree_view); | 177 | "button6", (gchar **) xpm_tree_view); |
186 | 178 | ||
187 | #if 0 | ||
188 | switch (view_mode) { | ||
189 | case SINGLE_VIEW: | ||
190 | widget = glade_xml_get_widget(xml, "button4"); | ||
191 | g_signal_emit_by_name(widget, "clicked"); | ||
192 | break; | ||
193 | case SPLIT_VIEW: | ||
194 | widget = glade_xml_get_widget(xml, "button5"); | ||
195 | g_signal_emit_by_name(widget, "clicked"); | ||
196 | break; | ||
197 | case FULL_VIEW: | ||
198 | widget = glade_xml_get_widget(xml, "button6"); | ||
199 | g_signal_emit_by_name(widget, "clicked"); | ||
200 | break; | ||
201 | } | ||
202 | #endif | ||
203 | txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | 179 | txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); |
204 | tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1", | 180 | tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1", |
205 | "foreground", "red", | 181 | "foreground", "red", |
@@ -1498,9 +1474,12 @@ int main(int ac, char *av[]) | |||
1498 | case 'a': | 1474 | case 'a': |
1499 | //showAll = 1; | 1475 | //showAll = 1; |
1500 | break; | 1476 | break; |
1477 | case 's': | ||
1478 | conf_set_message_callback(NULL); | ||
1479 | break; | ||
1501 | case 'h': | 1480 | case 'h': |
1502 | case '?': | 1481 | case '?': |
1503 | printf("%s <config>\n", av[0]); | 1482 | printf("%s [-s] <config>\n", av[0]); |
1504 | exit(0); | 1483 | exit(0); |
1505 | } | 1484 | } |
1506 | name = av[2]; | 1485 | name = av[2]; |
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index d5daa7af8b49..91ca126ea080 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
@@ -21,9 +21,7 @@ static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; | |||
21 | extern "C" { | 21 | extern "C" { |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #define P(name,type,arg) extern type name arg | ||
25 | #include "lkc_proto.h" | 24 | #include "lkc_proto.h" |
26 | #undef P | ||
27 | 25 | ||
28 | #define SRCTREE "srctree" | 26 | #define SRCTREE "srctree" |
29 | 27 | ||
@@ -70,9 +68,6 @@ struct kconf_id { | |||
70 | enum symbol_type stype; | 68 | enum symbol_type stype; |
71 | }; | 69 | }; |
72 | 70 | ||
73 | extern int zconfdebug; | ||
74 | |||
75 | int zconfparse(void); | ||
76 | void zconfdump(FILE *out); | 71 | void zconfdump(FILE *out); |
77 | void zconf_starthelp(void); | 72 | void zconf_starthelp(void); |
78 | FILE *zconf_fopen(const char *name); | 73 | FILE *zconf_fopen(const char *name); |
@@ -90,11 +85,6 @@ void sym_add_change_count(int count); | |||
90 | bool conf_set_all_new_symbols(enum conf_def_mode mode); | 85 | bool conf_set_all_new_symbols(enum conf_def_mode mode); |
91 | void set_all_choice_values(struct symbol *csym); | 86 | void set_all_choice_values(struct symbol *csym); |
92 | 87 | ||
93 | struct conf_printer { | ||
94 | void (*print_symbol)(FILE *, struct symbol *, const char *, void *); | ||
95 | void (*print_comment)(FILE *, const char *, void *); | ||
96 | }; | ||
97 | |||
98 | /* confdata.c and expr.c */ | 88 | /* confdata.c and expr.c */ |
99 | static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) | 89 | static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) |
100 | { | 90 | { |
@@ -113,7 +103,6 @@ void menu_add_entry(struct symbol *sym); | |||
113 | void menu_end_entry(void); | 103 | void menu_end_entry(void); |
114 | void menu_add_dep(struct expr *dep); | 104 | void menu_add_dep(struct expr *dep); |
115 | void menu_add_visibility(struct expr *dep); | 105 | void menu_add_visibility(struct expr *dep); |
116 | struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep); | ||
117 | struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); | 106 | struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); |
118 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); | 107 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); |
119 | void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); | 108 | void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); |
@@ -137,7 +126,6 @@ struct gstr { | |||
137 | int max_width; | 126 | int max_width; |
138 | }; | 127 | }; |
139 | struct gstr str_new(void); | 128 | struct gstr str_new(void); |
140 | struct gstr str_assign(const char *s); | ||
141 | void str_free(struct gstr *gs); | 129 | void str_free(struct gstr *gs); |
142 | void str_append(struct gstr *gs, const char *s); | 130 | void str_append(struct gstr *gs, const char *s); |
143 | void str_printf(struct gstr *gs, const char *fmt, ...); | 131 | void str_printf(struct gstr *gs, const char *fmt, ...); |
@@ -148,8 +136,6 @@ extern struct expr *sym_env_list; | |||
148 | 136 | ||
149 | void sym_init(void); | 137 | void sym_init(void); |
150 | void sym_clear_all_valid(void); | 138 | void sym_clear_all_valid(void); |
151 | void sym_set_all_changed(void); | ||
152 | void sym_set_changed(struct symbol *sym); | ||
153 | struct symbol *sym_choice_default(struct symbol *sym); | 139 | struct symbol *sym_choice_default(struct symbol *sym); |
154 | const char *sym_get_string_default(struct symbol *sym); | 140 | const char *sym_get_string_default(struct symbol *sym); |
155 | struct symbol *sym_check_deps(struct symbol *sym); | 141 | struct symbol *sym_check_deps(struct symbol *sym); |
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index ecdb9659b67d..d5398718ec2a 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -1,57 +1,52 @@ | |||
1 | #include <stdarg.h> | 1 | #include <stdarg.h> |
2 | 2 | ||
3 | /* confdata.c */ | 3 | /* confdata.c */ |
4 | P(conf_parse,void,(const char *name)); | 4 | void conf_parse(const char *name); |
5 | P(conf_read,int,(const char *name)); | 5 | int conf_read(const char *name); |
6 | P(conf_read_simple,int,(const char *name, int)); | 6 | int conf_read_simple(const char *name, int); |
7 | P(conf_write_defconfig,int,(const char *name)); | 7 | int conf_write_defconfig(const char *name); |
8 | P(conf_write,int,(const char *name)); | 8 | int conf_write(const char *name); |
9 | P(conf_write_autoconf,int,(void)); | 9 | int conf_write_autoconf(void); |
10 | P(conf_get_changed,bool,(void)); | 10 | bool conf_get_changed(void); |
11 | P(conf_set_changed_callback, void,(void (*fn)(void))); | 11 | void conf_set_changed_callback(void (*fn)(void)); |
12 | P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap))); | 12 | void conf_set_message_callback(void (*fn)(const char *fmt, va_list ap)); |
13 | 13 | ||
14 | /* menu.c */ | 14 | /* menu.c */ |
15 | P(rootmenu,struct menu,); | 15 | extern struct menu rootmenu; |
16 | 16 | ||
17 | P(menu_is_empty, bool, (struct menu *menu)); | 17 | bool menu_is_empty(struct menu *menu); |
18 | P(menu_is_visible, bool, (struct menu *menu)); | 18 | bool menu_is_visible(struct menu *menu); |
19 | P(menu_has_prompt, bool, (struct menu *menu)); | 19 | bool menu_has_prompt(struct menu *menu); |
20 | P(menu_get_prompt,const char *,(struct menu *menu)); | 20 | const char * menu_get_prompt(struct menu *menu); |
21 | P(menu_get_root_menu,struct menu *,(struct menu *menu)); | 21 | struct menu * menu_get_root_menu(struct menu *menu); |
22 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); | 22 | struct menu * menu_get_parent_menu(struct menu *menu); |
23 | P(menu_has_help,bool,(struct menu *menu)); | 23 | bool menu_has_help(struct menu *menu); |
24 | P(menu_get_help,const char *,(struct menu *menu)); | 24 | const char * menu_get_help(struct menu *menu); |
25 | P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct list_head | 25 | struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head); |
26 | *head)); | 26 | void menu_get_ext_help(struct menu *menu, struct gstr *help); |
27 | P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct list_head | ||
28 | *head)); | ||
29 | P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); | ||
30 | 27 | ||
31 | /* symbol.c */ | 28 | /* symbol.c */ |
32 | P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); | 29 | extern struct symbol * symbol_hash[SYMBOL_HASHSIZE]; |
33 | 30 | ||
34 | P(sym_lookup,struct symbol *,(const char *name, int flags)); | 31 | struct symbol * sym_lookup(const char *name, int flags); |
35 | P(sym_find,struct symbol *,(const char *name)); | 32 | struct symbol * sym_find(const char *name); |
36 | P(sym_expand_string_value,const char *,(const char *in)); | 33 | const char * sym_expand_string_value(const char *in); |
37 | P(sym_escape_string_value, const char *,(const char *in)); | 34 | const char * sym_escape_string_value(const char *in); |
38 | P(sym_re_search,struct symbol **,(const char *pattern)); | 35 | struct symbol ** sym_re_search(const char *pattern); |
39 | P(sym_type_name,const char *,(enum symbol_type type)); | 36 | const char * sym_type_name(enum symbol_type type); |
40 | P(sym_calc_value,void,(struct symbol *sym)); | 37 | void sym_calc_value(struct symbol *sym); |
41 | P(sym_get_type,enum symbol_type,(struct symbol *sym)); | 38 | enum symbol_type sym_get_type(struct symbol *sym); |
42 | P(sym_tristate_within_range,bool,(struct symbol *sym,tristate tri)); | 39 | bool sym_tristate_within_range(struct symbol *sym,tristate tri); |
43 | P(sym_set_tristate_value,bool,(struct symbol *sym,tristate tri)); | 40 | bool sym_set_tristate_value(struct symbol *sym,tristate tri); |
44 | P(sym_toggle_tristate_value,tristate,(struct symbol *sym)); | 41 | tristate sym_toggle_tristate_value(struct symbol *sym); |
45 | P(sym_string_valid,bool,(struct symbol *sym, const char *newval)); | 42 | bool sym_string_valid(struct symbol *sym, const char *newval); |
46 | P(sym_string_within_range,bool,(struct symbol *sym, const char *str)); | 43 | bool sym_string_within_range(struct symbol *sym, const char *str); |
47 | P(sym_set_string_value,bool,(struct symbol *sym, const char *newval)); | 44 | bool sym_set_string_value(struct symbol *sym, const char *newval); |
48 | P(sym_is_changable,bool,(struct symbol *sym)); | 45 | bool sym_is_changable(struct symbol *sym); |
49 | P(sym_get_choice_prop,struct property *,(struct symbol *sym)); | 46 | struct property * sym_get_choice_prop(struct symbol *sym); |
50 | P(sym_get_default_prop,struct property *,(struct symbol *sym)); | 47 | const char * sym_get_string_value(struct symbol *sym); |
51 | P(sym_get_string_value,const char *,(struct symbol *sym)); | ||
52 | 48 | ||
53 | P(prop_get_type_name,const char *,(enum prop_type type)); | 49 | const char * prop_get_type_name(enum prop_type type); |
54 | 50 | ||
55 | /* expr.c */ | 51 | /* expr.c */ |
56 | P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2)); | 52 | void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken); |
57 | P(expr_print,void,(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)); | ||
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 4dd37552abc2..315ce2c7cb9d 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -279,6 +279,7 @@ static int child_count; | |||
279 | static int single_menu_mode; | 279 | static int single_menu_mode; |
280 | static int show_all_options; | 280 | static int show_all_options; |
281 | static int save_and_exit; | 281 | static int save_and_exit; |
282 | static int silent; | ||
282 | 283 | ||
283 | static void conf(struct menu *menu, struct menu *active_menu); | 284 | static void conf(struct menu *menu, struct menu *active_menu); |
284 | static void conf_choice(struct menu *menu); | 285 | static void conf_choice(struct menu *menu); |
@@ -777,10 +778,12 @@ static void conf_message_callback(const char *fmt, va_list ap) | |||
777 | char buf[PATH_MAX+1]; | 778 | char buf[PATH_MAX+1]; |
778 | 779 | ||
779 | vsnprintf(buf, sizeof(buf), fmt, ap); | 780 | vsnprintf(buf, sizeof(buf), fmt, ap); |
780 | if (save_and_exit) | 781 | if (save_and_exit) { |
781 | printf("%s", buf); | 782 | if (!silent) |
782 | else | 783 | printf("%s", buf); |
784 | } else { | ||
783 | show_textbox(NULL, buf, 6, 60); | 785 | show_textbox(NULL, buf, 6, 60); |
786 | } | ||
784 | } | 787 | } |
785 | 788 | ||
786 | static void show_help(struct menu *menu) | 789 | static void show_help(struct menu *menu) |
@@ -977,16 +980,18 @@ static int handle_exit(void) | |||
977 | } | 980 | } |
978 | /* fall through */ | 981 | /* fall through */ |
979 | case -1: | 982 | case -1: |
980 | printf(_("\n\n" | 983 | if (!silent) |
981 | "*** End of the configuration.\n" | 984 | printf(_("\n\n" |
982 | "*** Execute 'make' to start the build or try 'make help'." | 985 | "*** End of the configuration.\n" |
983 | "\n\n")); | 986 | "*** Execute 'make' to start the build or try 'make help'." |
987 | "\n\n")); | ||
984 | res = 0; | 988 | res = 0; |
985 | break; | 989 | break; |
986 | default: | 990 | default: |
987 | fprintf(stderr, _("\n\n" | 991 | if (!silent) |
988 | "Your configuration changes were NOT saved." | 992 | fprintf(stderr, _("\n\n" |
989 | "\n\n")); | 993 | "Your configuration changes were NOT saved." |
994 | "\n\n")); | ||
990 | if (res != KEY_ESC) | 995 | if (res != KEY_ESC) |
991 | res = 0; | 996 | res = 0; |
992 | } | 997 | } |
@@ -1010,6 +1015,12 @@ int main(int ac, char **av) | |||
1010 | 1015 | ||
1011 | signal(SIGINT, sig_handler); | 1016 | signal(SIGINT, sig_handler); |
1012 | 1017 | ||
1018 | if (ac > 1 && strcmp(av[1], "-s") == 0) { | ||
1019 | silent = 1; | ||
1020 | /* Silence conf_read() until the real callback is set up */ | ||
1021 | conf_set_message_callback(NULL); | ||
1022 | av++; | ||
1023 | } | ||
1013 | conf_parse(av[1]); | 1024 | conf_parse(av[1]); |
1014 | conf_read(NULL); | 1025 | conf_read(NULL); |
1015 | 1026 | ||
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 72c9dba84c5d..b05cc3d4a9be 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -125,7 +125,7 @@ void menu_set_type(int type) | |||
125 | sym_type_name(sym->type), sym_type_name(type)); | 125 | sym_type_name(sym->type), sym_type_name(type)); |
126 | } | 126 | } |
127 | 127 | ||
128 | struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) | 128 | static struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) |
129 | { | 129 | { |
130 | struct property *prop = prop_alloc(type, current_entry->sym); | 130 | struct property *prop = prop_alloc(type, current_entry->sym); |
131 | 131 | ||
@@ -615,7 +615,7 @@ static struct property *get_symbol_prop(struct symbol *sym) | |||
615 | /* | 615 | /* |
616 | * head is optional and may be NULL | 616 | * head is optional and may be NULL |
617 | */ | 617 | */ |
618 | void get_symbol_str(struct gstr *r, struct symbol *sym, | 618 | static void get_symbol_str(struct gstr *r, struct symbol *sym, |
619 | struct list_head *head) | 619 | struct list_head *head) |
620 | { | 620 | { |
621 | bool hit; | 621 | bool hit; |
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh index 2ab91b9b100d..ec8e20350a64 100755 --- a/scripts/kconfig/merge_config.sh +++ b/scripts/kconfig/merge_config.sh | |||
@@ -35,7 +35,7 @@ usage() { | |||
35 | echo " -O dir to put generated output files" | 35 | echo " -O dir to put generated output files" |
36 | } | 36 | } |
37 | 37 | ||
38 | MAKE=true | 38 | RUNMAKE=true |
39 | ALLTARGET=alldefconfig | 39 | ALLTARGET=alldefconfig |
40 | WARNREDUN=false | 40 | WARNREDUN=false |
41 | OUTPUT=. | 41 | OUTPUT=. |
@@ -48,7 +48,7 @@ while true; do | |||
48 | continue | 48 | continue |
49 | ;; | 49 | ;; |
50 | "-m") | 50 | "-m") |
51 | MAKE=false | 51 | RUNMAKE=false |
52 | shift | 52 | shift |
53 | continue | 53 | continue |
54 | ;; | 54 | ;; |
@@ -85,6 +85,11 @@ fi | |||
85 | INITFILE=$1 | 85 | INITFILE=$1 |
86 | shift; | 86 | shift; |
87 | 87 | ||
88 | if [ ! -r "$INITFILE" ]; then | ||
89 | echo "The base file '$INITFILE' does not exist. Exit." >&2 | ||
90 | exit 1 | ||
91 | fi | ||
92 | |||
88 | MERGE_LIST=$* | 93 | MERGE_LIST=$* |
89 | SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" | 94 | SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" |
90 | TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) | 95 | TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) |
@@ -92,31 +97,29 @@ TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) | |||
92 | echo "Using $INITFILE as base" | 97 | echo "Using $INITFILE as base" |
93 | cat $INITFILE > $TMP_FILE | 98 | cat $INITFILE > $TMP_FILE |
94 | 99 | ||
95 | # Merge files, printing warnings on overrided values | 100 | # Merge files, printing warnings on overridden values |
96 | for MERGE_FILE in $MERGE_LIST ; do | 101 | for MERGE_FILE in $MERGE_LIST ; do |
97 | echo "Merging $MERGE_FILE" | 102 | echo "Merging $MERGE_FILE" |
98 | CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE) | 103 | CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE) |
99 | 104 | ||
100 | for CFG in $CFG_LIST ; do | 105 | for CFG in $CFG_LIST ; do |
101 | grep -q -w $CFG $TMP_FILE | 106 | grep -q -w $CFG $TMP_FILE || continue |
102 | if [ $? -eq 0 ] ; then | 107 | PREV_VAL=$(grep -w $CFG $TMP_FILE) |
103 | PREV_VAL=$(grep -w $CFG $TMP_FILE) | 108 | NEW_VAL=$(grep -w $CFG $MERGE_FILE) |
104 | NEW_VAL=$(grep -w $CFG $MERGE_FILE) | 109 | if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then |
105 | if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then | ||
106 | echo Value of $CFG is redefined by fragment $MERGE_FILE: | 110 | echo Value of $CFG is redefined by fragment $MERGE_FILE: |
107 | echo Previous value: $PREV_VAL | 111 | echo Previous value: $PREV_VAL |
108 | echo New value: $NEW_VAL | 112 | echo New value: $NEW_VAL |
109 | echo | 113 | echo |
110 | elif [ "$WARNREDUN" = "true" ]; then | 114 | elif [ "$WARNREDUN" = "true" ]; then |
111 | echo Value of $CFG is redundant by fragment $MERGE_FILE: | 115 | echo Value of $CFG is redundant by fragment $MERGE_FILE: |
112 | fi | ||
113 | sed -i "/$CFG[ =]/d" $TMP_FILE | ||
114 | fi | 116 | fi |
117 | sed -i "/$CFG[ =]/d" $TMP_FILE | ||
115 | done | 118 | done |
116 | cat $MERGE_FILE >> $TMP_FILE | 119 | cat $MERGE_FILE >> $TMP_FILE |
117 | done | 120 | done |
118 | 121 | ||
119 | if [ "$MAKE" = "false" ]; then | 122 | if [ "$RUNMAKE" = "false" ]; then |
120 | cp $TMP_FILE $OUTPUT/.config | 123 | cp $TMP_FILE $OUTPUT/.config |
121 | echo "#" | 124 | echo "#" |
122 | echo "# merged configuration written to $OUTPUT/.config (needs make)" | 125 | echo "# merged configuration written to $OUTPUT/.config (needs make)" |
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index 984489ef2b46..d42d534a66cd 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c | |||
@@ -1482,6 +1482,11 @@ int main(int ac, char **av) | |||
1482 | bindtextdomain(PACKAGE, LOCALEDIR); | 1482 | bindtextdomain(PACKAGE, LOCALEDIR); |
1483 | textdomain(PACKAGE); | 1483 | textdomain(PACKAGE); |
1484 | 1484 | ||
1485 | if (ac > 1 && strcmp(av[1], "-s") == 0) { | ||
1486 | /* Silence conf_read() until the real callback is set up */ | ||
1487 | conf_set_message_callback(NULL); | ||
1488 | av++; | ||
1489 | } | ||
1485 | conf_parse(av[1]); | 1490 | conf_parse(av[1]); |
1486 | conf_read(NULL); | 1491 | conf_read(NULL); |
1487 | 1492 | ||
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 9d3b04b0769c..c3bb7fe8dfa6 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -1746,7 +1746,7 @@ static const char *progname; | |||
1746 | 1746 | ||
1747 | static void usage(void) | 1747 | static void usage(void) |
1748 | { | 1748 | { |
1749 | printf(_("%s <config>\n"), progname); | 1749 | printf(_("%s [-s] <config>\n"), progname); |
1750 | exit(0); | 1750 | exit(0); |
1751 | } | 1751 | } |
1752 | 1752 | ||
@@ -1762,6 +1762,9 @@ int main(int ac, char** av) | |||
1762 | configApp = new QApplication(ac, av); | 1762 | configApp = new QApplication(ac, av); |
1763 | if (ac > 1 && av[1][0] == '-') { | 1763 | if (ac > 1 && av[1][0] == '-') { |
1764 | switch (av[1][1]) { | 1764 | switch (av[1][1]) { |
1765 | case 's': | ||
1766 | conf_set_message_callback(NULL); | ||
1767 | break; | ||
1765 | case 'h': | 1768 | case 'h': |
1766 | case '?': | 1769 | case '?': |
1767 | usage(); | 1770 | usage(); |
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 7caabdb51c64..70c5ee189dce 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
@@ -112,7 +112,7 @@ struct property *sym_get_env_prop(struct symbol *sym) | |||
112 | return NULL; | 112 | return NULL; |
113 | } | 113 | } |
114 | 114 | ||
115 | struct property *sym_get_default_prop(struct symbol *sym) | 115 | static struct property *sym_get_default_prop(struct symbol *sym) |
116 | { | 116 | { |
117 | struct property *prop; | 117 | struct property *prop; |
118 | 118 | ||
@@ -186,6 +186,26 @@ static void sym_validate_range(struct symbol *sym) | |||
186 | sym->curr.val = strdup(str); | 186 | sym->curr.val = strdup(str); |
187 | } | 187 | } |
188 | 188 | ||
189 | static void sym_set_changed(struct symbol *sym) | ||
190 | { | ||
191 | struct property *prop; | ||
192 | |||
193 | sym->flags |= SYMBOL_CHANGED; | ||
194 | for (prop = sym->prop; prop; prop = prop->next) { | ||
195 | if (prop->menu) | ||
196 | prop->menu->flags |= MENU_CHANGED; | ||
197 | } | ||
198 | } | ||
199 | |||
200 | static void sym_set_all_changed(void) | ||
201 | { | ||
202 | struct symbol *sym; | ||
203 | int i; | ||
204 | |||
205 | for_all_symbols(i, sym) | ||
206 | sym_set_changed(sym); | ||
207 | } | ||
208 | |||
189 | static void sym_calc_visibility(struct symbol *sym) | 209 | static void sym_calc_visibility(struct symbol *sym) |
190 | { | 210 | { |
191 | struct property *prop; | 211 | struct property *prop; |
@@ -451,26 +471,6 @@ void sym_clear_all_valid(void) | |||
451 | sym_calc_value(modules_sym); | 471 | sym_calc_value(modules_sym); |
452 | } | 472 | } |
453 | 473 | ||
454 | void sym_set_changed(struct symbol *sym) | ||
455 | { | ||
456 | struct property *prop; | ||
457 | |||
458 | sym->flags |= SYMBOL_CHANGED; | ||
459 | for (prop = sym->prop; prop; prop = prop->next) { | ||
460 | if (prop->menu) | ||
461 | prop->menu->flags |= MENU_CHANGED; | ||
462 | } | ||
463 | } | ||
464 | |||
465 | void sym_set_all_changed(void) | ||
466 | { | ||
467 | struct symbol *sym; | ||
468 | int i; | ||
469 | |||
470 | for_all_symbols(i, sym) | ||
471 | sym_set_changed(sym); | ||
472 | } | ||
473 | |||
474 | bool sym_tristate_within_range(struct symbol *sym, tristate val) | 474 | bool sym_tristate_within_range(struct symbol *sym, tristate val) |
475 | { | 475 | { |
476 | int type = sym_get_type(sym); | 476 | int type = sym_get_type(sym); |
@@ -1166,6 +1166,10 @@ static struct symbol *sym_check_expr_deps(struct expr *e) | |||
1166 | case E_NOT: | 1166 | case E_NOT: |
1167 | return sym_check_expr_deps(e->left.expr); | 1167 | return sym_check_expr_deps(e->left.expr); |
1168 | case E_EQUAL: | 1168 | case E_EQUAL: |
1169 | case E_GEQ: | ||
1170 | case E_GTH: | ||
1171 | case E_LEQ: | ||
1172 | case E_LTH: | ||
1169 | case E_UNEQUAL: | 1173 | case E_UNEQUAL: |
1170 | sym = sym_check_deps(e->left.sym); | 1174 | sym = sym_check_deps(e->left.sym); |
1171 | if (sym) | 1175 | if (sym) |
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index 94f9c83e324f..0e76042473cc 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c | |||
@@ -88,16 +88,6 @@ struct gstr str_new(void) | |||
88 | return gs; | 88 | return gs; |
89 | } | 89 | } |
90 | 90 | ||
91 | /* Allocate and assign growable string */ | ||
92 | struct gstr str_assign(const char *s) | ||
93 | { | ||
94 | struct gstr gs; | ||
95 | gs.s = strdup(s); | ||
96 | gs.len = strlen(s) + 1; | ||
97 | gs.max_width = 0; | ||
98 | return gs; | ||
99 | } | ||
100 | |||
101 | /* Free storage for growable string */ | 91 | /* Free storage for growable string */ |
102 | void str_free(struct gstr *gs) | 92 | void str_free(struct gstr *gs) |
103 | { | 93 | { |
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 6c62d93b4ffb..200a3fe30091 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l | |||
@@ -122,6 +122,10 @@ n [A-Za-z0-9_] | |||
122 | "!" return T_NOT; | 122 | "!" return T_NOT; |
123 | "=" return T_EQUAL; | 123 | "=" return T_EQUAL; |
124 | "!=" return T_UNEQUAL; | 124 | "!=" return T_UNEQUAL; |
125 | "<=" return T_LESS_EQUAL; | ||
126 | ">=" return T_GREATER_EQUAL; | ||
127 | "<" return T_LESS; | ||
128 | ">" return T_GREATER; | ||
125 | \"|\' { | 129 | \"|\' { |
126 | str = yytext[0]; | 130 | str = yytext[0]; |
127 | new_string(); | 131 | new_string(); |
@@ -141,7 +145,12 @@ n [A-Za-z0-9_] | |||
141 | } | 145 | } |
142 | #.* /* comment */ | 146 | #.* /* comment */ |
143 | \\\n current_file->lineno++; | 147 | \\\n current_file->lineno++; |
144 | . | 148 | [[:blank:]]+ |
149 | . { | ||
150 | fprintf(stderr, | ||
151 | "%s:%d:warning: ignoring unsupported character '%c'\n", | ||
152 | zconf_curname(), zconf_lineno(), *yytext); | ||
153 | } | ||
145 | <<EOF>> { | 154 | <<EOF>> { |
146 | BEGIN(INITIAL); | 155 | BEGIN(INITIAL); |
147 | } | 156 | } |
diff --git a/scripts/kconfig/zconf.lex.c_shipped b/scripts/kconfig/zconf.lex.c_shipped index 349a7f24315b..dd4e86c82521 100644 --- a/scripts/kconfig/zconf.lex.c_shipped +++ b/scripts/kconfig/zconf.lex.c_shipped | |||
@@ -365,323 +365,354 @@ int zconflineno = 1; | |||
365 | 365 | ||
366 | extern char *zconftext; | 366 | extern char *zconftext; |
367 | #define yytext_ptr zconftext | 367 | #define yytext_ptr zconftext |
368 | static yyconst flex_int16_t yy_nxt[][17] = | 368 | static yyconst flex_int16_t yy_nxt[][19] = |
369 | { | 369 | { |
370 | { | 370 | { |
371 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 371 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
372 | 0, 0, 0, 0, 0, 0, 0 | 372 | 0, 0, 0, 0, 0, 0, 0, 0, 0 |
373 | }, | 373 | }, |
374 | 374 | ||
375 | { | 375 | { |
376 | 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, | 376 | 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, |
377 | 12, 12, 12, 12, 12, 12, 12 | 377 | 12, 12, 12, 12, 12, 12, 12, 12, 12 |
378 | }, | 378 | }, |
379 | 379 | ||
380 | { | 380 | { |
381 | 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, | 381 | 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, |
382 | 12, 12, 12, 12, 12, 12, 12 | 382 | 12, 12, 12, 12, 12, 12, 12, 12, 12 |
383 | }, | 383 | }, |
384 | 384 | ||
385 | { | 385 | { |
386 | 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, | 386 | 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, |
387 | 16, 16, 16, 18, 16, 16, 16 | 387 | 16, 16, 16, 18, 16, 16, 16, 16, 16 |
388 | }, | 388 | }, |
389 | 389 | ||
390 | { | 390 | { |
391 | 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, | 391 | 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, |
392 | 16, 16, 16, 18, 16, 16, 16 | 392 | 16, 16, 16, 18, 16, 16, 16, 16, 16 |
393 | 393 | ||
394 | }, | 394 | }, |
395 | 395 | ||
396 | { | 396 | { |
397 | 11, 19, 20, 21, 19, 19, 19, 19, 19, 19, | 397 | 11, 19, 20, 21, 19, 19, 19, 19, 19, 19, |
398 | 19, 19, 19, 19, 19, 19, 19 | 398 | 19, 19, 19, 19, 19, 19, 19, 19, 19 |
399 | }, | 399 | }, |
400 | 400 | ||
401 | { | 401 | { |
402 | 11, 19, 20, 21, 19, 19, 19, 19, 19, 19, | 402 | 11, 19, 20, 21, 19, 19, 19, 19, 19, 19, |
403 | 19, 19, 19, 19, 19, 19, 19 | 403 | 19, 19, 19, 19, 19, 19, 19, 19, 19 |
404 | }, | 404 | }, |
405 | 405 | ||
406 | { | 406 | { |
407 | 11, 22, 22, 23, 22, 24, 22, 22, 24, 22, | 407 | 11, 22, 22, 23, 22, 24, 22, 22, 24, 22, |
408 | 22, 22, 22, 22, 22, 25, 22 | 408 | 22, 22, 22, 22, 22, 22, 22, 25, 22 |
409 | }, | 409 | }, |
410 | 410 | ||
411 | { | 411 | { |
412 | 11, 22, 22, 23, 22, 24, 22, 22, 24, 22, | 412 | 11, 22, 22, 23, 22, 24, 22, 22, 24, 22, |
413 | 22, 22, 22, 22, 22, 25, 22 | 413 | 22, 22, 22, 22, 22, 22, 22, 25, 22 |
414 | }, | 414 | }, |
415 | 415 | ||
416 | { | 416 | { |
417 | 11, 26, 26, 27, 28, 29, 30, 31, 29, 32, | 417 | 11, 26, 27, 28, 29, 30, 31, 32, 30, 33, |
418 | 33, 34, 35, 35, 36, 37, 38 | 418 | 34, 35, 36, 36, 37, 38, 39, 40, 41 |
419 | 419 | ||
420 | }, | 420 | }, |
421 | 421 | ||
422 | { | 422 | { |
423 | 11, 26, 26, 27, 28, 29, 30, 31, 29, 32, | 423 | 11, 26, 27, 28, 29, 30, 31, 32, 30, 33, |
424 | 33, 34, 35, 35, 36, 37, 38 | 424 | 34, 35, 36, 36, 37, 38, 39, 40, 41 |
425 | }, | 425 | }, |
426 | 426 | ||
427 | { | 427 | { |
428 | -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, | 428 | -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, |
429 | -11, -11, -11, -11, -11, -11, -11 | 429 | -11, -11, -11, -11, -11, -11, -11, -11, -11 |
430 | }, | 430 | }, |
431 | 431 | ||
432 | { | 432 | { |
433 | 11, -12, -12, -12, -12, -12, -12, -12, -12, -12, | 433 | 11, -12, -12, -12, -12, -12, -12, -12, -12, -12, |
434 | -12, -12, -12, -12, -12, -12, -12 | 434 | -12, -12, -12, -12, -12, -12, -12, -12, -12 |
435 | }, | 435 | }, |
436 | 436 | ||
437 | { | 437 | { |
438 | 11, -13, 39, 40, -13, -13, 41, -13, -13, -13, | 438 | 11, -13, 42, 43, -13, -13, 44, -13, -13, -13, |
439 | -13, -13, -13, -13, -13, -13, -13 | 439 | -13, -13, -13, -13, -13, -13, -13, -13, -13 |
440 | }, | 440 | }, |
441 | 441 | ||
442 | { | 442 | { |
443 | 11, -14, -14, -14, -14, -14, -14, -14, -14, -14, | 443 | 11, -14, -14, -14, -14, -14, -14, -14, -14, -14, |
444 | -14, -14, -14, -14, -14, -14, -14 | 444 | -14, -14, -14, -14, -14, -14, -14, -14, -14 |
445 | 445 | ||
446 | }, | 446 | }, |
447 | 447 | ||
448 | { | 448 | { |
449 | 11, 42, 42, 43, 42, 42, 42, 42, 42, 42, | 449 | 11, 45, 45, 46, 45, 45, 45, 45, 45, 45, |
450 | 42, 42, 42, 42, 42, 42, 42 | 450 | 45, 45, 45, 45, 45, 45, 45, 45, 45 |
451 | }, | 451 | }, |
452 | 452 | ||
453 | { | 453 | { |
454 | 11, -16, -16, -16, -16, -16, -16, -16, -16, -16, | 454 | 11, -16, -16, -16, -16, -16, -16, -16, -16, -16, |
455 | -16, -16, -16, -16, -16, -16, -16 | 455 | -16, -16, -16, -16, -16, -16, -16, -16, -16 |
456 | }, | 456 | }, |
457 | 457 | ||
458 | { | 458 | { |
459 | 11, -17, -17, -17, -17, -17, -17, -17, -17, -17, | 459 | 11, -17, -17, -17, -17, -17, -17, -17, -17, -17, |
460 | -17, -17, -17, -17, -17, -17, -17 | 460 | -17, -17, -17, -17, -17, -17, -17, -17, -17 |
461 | }, | 461 | }, |
462 | 462 | ||
463 | { | 463 | { |
464 | 11, -18, -18, -18, -18, -18, -18, -18, -18, -18, | 464 | 11, -18, -18, -18, -18, -18, -18, -18, -18, -18, |
465 | -18, -18, -18, 44, -18, -18, -18 | 465 | -18, -18, -18, 47, -18, -18, -18, -18, -18 |
466 | }, | 466 | }, |
467 | 467 | ||
468 | { | 468 | { |
469 | 11, 45, 45, -19, 45, 45, 45, 45, 45, 45, | 469 | 11, 48, 48, -19, 48, 48, 48, 48, 48, 48, |
470 | 45, 45, 45, 45, 45, 45, 45 | 470 | 48, 48, 48, 48, 48, 48, 48, 48, 48 |
471 | 471 | ||
472 | }, | 472 | }, |
473 | 473 | ||
474 | { | 474 | { |
475 | 11, -20, 46, 47, -20, -20, -20, -20, -20, -20, | 475 | 11, -20, 49, 50, -20, -20, -20, -20, -20, -20, |
476 | -20, -20, -20, -20, -20, -20, -20 | 476 | -20, -20, -20, -20, -20, -20, -20, -20, -20 |
477 | }, | 477 | }, |
478 | 478 | ||
479 | { | 479 | { |
480 | 11, 48, -21, -21, 48, 48, 48, 48, 48, 48, | 480 | 11, 51, -21, -21, 51, 51, 51, 51, 51, 51, |
481 | 48, 48, 48, 48, 48, 48, 48 | 481 | 51, 51, 51, 51, 51, 51, 51, 51, 51 |
482 | }, | 482 | }, |
483 | 483 | ||
484 | { | 484 | { |
485 | 11, 49, 49, 50, 49, -22, 49, 49, -22, 49, | 485 | 11, 52, 52, 53, 52, -22, 52, 52, -22, 52, |
486 | 49, 49, 49, 49, 49, -22, 49 | 486 | 52, 52, 52, 52, 52, 52, 52, -22, 52 |
487 | }, | 487 | }, |
488 | 488 | ||
489 | { | 489 | { |
490 | 11, -23, -23, -23, -23, -23, -23, -23, -23, -23, | 490 | 11, -23, -23, -23, -23, -23, -23, -23, -23, -23, |
491 | -23, -23, -23, -23, -23, -23, -23 | 491 | -23, -23, -23, -23, -23, -23, -23, -23, -23 |
492 | }, | 492 | }, |
493 | 493 | ||
494 | { | 494 | { |
495 | 11, -24, -24, -24, -24, -24, -24, -24, -24, -24, | 495 | 11, -24, -24, -24, -24, -24, -24, -24, -24, -24, |
496 | -24, -24, -24, -24, -24, -24, -24 | 496 | -24, -24, -24, -24, -24, -24, -24, -24, -24 |
497 | 497 | ||
498 | }, | 498 | }, |
499 | 499 | ||
500 | { | 500 | { |
501 | 11, 51, 51, 52, 51, 51, 51, 51, 51, 51, | 501 | 11, 54, 54, 55, 54, 54, 54, 54, 54, 54, |
502 | 51, 51, 51, 51, 51, 51, 51 | 502 | 54, 54, 54, 54, 54, 54, 54, 54, 54 |
503 | }, | 503 | }, |
504 | 504 | ||
505 | { | 505 | { |
506 | 11, -26, -26, -26, -26, -26, -26, -26, -26, -26, | 506 | 11, -26, -26, -26, -26, -26, -26, -26, -26, -26, |
507 | -26, -26, -26, -26, -26, -26, -26 | 507 | -26, -26, -26, -26, -26, -26, -26, -26, -26 |
508 | }, | 508 | }, |
509 | 509 | ||
510 | { | 510 | { |
511 | 11, -27, -27, -27, -27, -27, -27, -27, -27, -27, | 511 | 11, -27, 56, -27, -27, -27, -27, -27, -27, -27, |
512 | -27, -27, -27, -27, -27, -27, -27 | 512 | -27, -27, -27, -27, -27, -27, -27, -27, -27 |
513 | }, | 513 | }, |
514 | 514 | ||
515 | { | 515 | { |
516 | 11, -28, -28, -28, -28, -28, -28, -28, -28, -28, | 516 | 11, -28, -28, -28, -28, -28, -28, -28, -28, -28, |
517 | -28, -28, -28, -28, 53, -28, -28 | 517 | -28, -28, -28, -28, -28, -28, -28, -28, -28 |
518 | }, | 518 | }, |
519 | 519 | ||
520 | { | 520 | { |
521 | 11, -29, -29, -29, -29, -29, -29, -29, -29, -29, | 521 | 11, -29, -29, -29, -29, -29, -29, -29, -29, -29, |
522 | -29, -29, -29, -29, -29, -29, -29 | 522 | -29, -29, -29, -29, -29, 57, -29, -29, -29 |
523 | 523 | ||
524 | }, | 524 | }, |
525 | 525 | ||
526 | { | 526 | { |
527 | 11, 54, 54, -30, 54, 54, 54, 54, 54, 54, | 527 | 11, -30, -30, -30, -30, -30, -30, -30, -30, -30, |
528 | 54, 54, 54, 54, 54, 54, 54 | 528 | -30, -30, -30, -30, -30, -30, -30, -30, -30 |
529 | }, | 529 | }, |
530 | 530 | ||
531 | { | 531 | { |
532 | 11, -31, -31, -31, -31, -31, -31, 55, -31, -31, | 532 | 11, 58, 58, -31, 58, 58, 58, 58, 58, 58, |
533 | -31, -31, -31, -31, -31, -31, -31 | 533 | 58, 58, 58, 58, 58, 58, 58, 58, 58 |
534 | }, | 534 | }, |
535 | 535 | ||
536 | { | 536 | { |
537 | 11, -32, -32, -32, -32, -32, -32, -32, -32, -32, | 537 | 11, -32, -32, -32, -32, -32, -32, 59, -32, -32, |
538 | -32, -32, -32, -32, -32, -32, -32 | 538 | -32, -32, -32, -32, -32, -32, -32, -32, -32 |
539 | }, | 539 | }, |
540 | 540 | ||
541 | { | 541 | { |
542 | 11, -33, -33, -33, -33, -33, -33, -33, -33, -33, | 542 | 11, -33, -33, -33, -33, -33, -33, -33, -33, -33, |
543 | -33, -33, -33, -33, -33, -33, -33 | 543 | -33, -33, -33, -33, -33, -33, -33, -33, -33 |
544 | }, | 544 | }, |
545 | 545 | ||
546 | { | 546 | { |
547 | 11, -34, -34, -34, -34, -34, -34, -34, -34, -34, | 547 | 11, -34, -34, -34, -34, -34, -34, -34, -34, -34, |
548 | -34, 56, 57, 57, -34, -34, -34 | 548 | -34, -34, -34, -34, -34, -34, -34, -34, -34 |
549 | 549 | ||
550 | }, | 550 | }, |
551 | 551 | ||
552 | { | 552 | { |
553 | 11, -35, -35, -35, -35, -35, -35, -35, -35, -35, | 553 | 11, -35, -35, -35, -35, -35, -35, -35, -35, -35, |
554 | -35, 57, 57, 57, -35, -35, -35 | 554 | -35, 60, 61, 61, -35, -35, -35, -35, -35 |
555 | }, | 555 | }, |
556 | 556 | ||
557 | { | 557 | { |
558 | 11, -36, -36, -36, -36, -36, -36, -36, -36, -36, | 558 | 11, -36, -36, -36, -36, -36, -36, -36, -36, -36, |
559 | -36, -36, -36, -36, -36, -36, -36 | 559 | -36, 61, 61, 61, -36, -36, -36, -36, -36 |
560 | }, | 560 | }, |
561 | 561 | ||
562 | { | 562 | { |
563 | 11, -37, -37, 58, -37, -37, -37, -37, -37, -37, | 563 | 11, -37, -37, -37, -37, -37, -37, -37, -37, -37, |
564 | -37, -37, -37, -37, -37, -37, -37 | 564 | -37, -37, -37, -37, -37, 62, -37, -37, -37 |
565 | }, | 565 | }, |
566 | 566 | ||
567 | { | 567 | { |
568 | 11, -38, -38, -38, -38, -38, -38, -38, -38, -38, | 568 | 11, -38, -38, -38, -38, -38, -38, -38, -38, -38, |
569 | -38, -38, -38, -38, -38, -38, 59 | 569 | -38, -38, -38, -38, -38, -38, -38, -38, -38 |
570 | }, | 570 | }, |
571 | 571 | ||
572 | { | 572 | { |
573 | 11, -39, 39, 40, -39, -39, 41, -39, -39, -39, | 573 | 11, -39, -39, -39, -39, -39, -39, -39, -39, -39, |
574 | -39, -39, -39, -39, -39, -39, -39 | 574 | -39, -39, -39, -39, -39, 63, -39, -39, -39 |
575 | 575 | ||
576 | }, | 576 | }, |
577 | 577 | ||
578 | { | 578 | { |
579 | 11, -40, -40, -40, -40, -40, -40, -40, -40, -40, | 579 | 11, -40, -40, 64, -40, -40, -40, -40, -40, -40, |
580 | -40, -40, -40, -40, -40, -40, -40 | 580 | -40, -40, -40, -40, -40, -40, -40, -40, -40 |
581 | }, | 581 | }, |
582 | 582 | ||
583 | { | 583 | { |
584 | 11, 42, 42, 43, 42, 42, 42, 42, 42, 42, | 584 | 11, -41, -41, -41, -41, -41, -41, -41, -41, -41, |
585 | 42, 42, 42, 42, 42, 42, 42 | 585 | -41, -41, -41, -41, -41, -41, -41, -41, 65 |
586 | }, | 586 | }, |
587 | 587 | ||
588 | { | 588 | { |
589 | 11, 42, 42, 43, 42, 42, 42, 42, 42, 42, | 589 | 11, -42, 42, 43, -42, -42, 44, -42, -42, -42, |
590 | 42, 42, 42, 42, 42, 42, 42 | 590 | -42, -42, -42, -42, -42, -42, -42, -42, -42 |
591 | }, | 591 | }, |
592 | 592 | ||
593 | { | 593 | { |
594 | 11, -43, -43, -43, -43, -43, -43, -43, -43, -43, | 594 | 11, -43, -43, -43, -43, -43, -43, -43, -43, -43, |
595 | -43, -43, -43, -43, -43, -43, -43 | 595 | -43, -43, -43, -43, -43, -43, -43, -43, -43 |
596 | }, | 596 | }, |
597 | 597 | ||
598 | { | 598 | { |
599 | 11, -44, -44, -44, -44, -44, -44, -44, -44, -44, | 599 | 11, 45, 45, 46, 45, 45, 45, 45, 45, 45, |
600 | -44, -44, -44, 44, -44, -44, -44 | 600 | 45, 45, 45, 45, 45, 45, 45, 45, 45 |
601 | 601 | ||
602 | }, | 602 | }, |
603 | 603 | ||
604 | { | 604 | { |
605 | 11, 45, 45, -45, 45, 45, 45, 45, 45, 45, | 605 | 11, 45, 45, 46, 45, 45, 45, 45, 45, 45, |
606 | 45, 45, 45, 45, 45, 45, 45 | 606 | 45, 45, 45, 45, 45, 45, 45, 45, 45 |
607 | }, | 607 | }, |
608 | 608 | ||
609 | { | 609 | { |
610 | 11, -46, 46, 47, -46, -46, -46, -46, -46, -46, | 610 | 11, -46, -46, -46, -46, -46, -46, -46, -46, -46, |
611 | -46, -46, -46, -46, -46, -46, -46 | 611 | -46, -46, -46, -46, -46, -46, -46, -46, -46 |
612 | }, | 612 | }, |
613 | 613 | ||
614 | { | 614 | { |
615 | 11, 48, -47, -47, 48, 48, 48, 48, 48, 48, | 615 | 11, -47, -47, -47, -47, -47, -47, -47, -47, -47, |
616 | 48, 48, 48, 48, 48, 48, 48 | 616 | -47, -47, -47, 47, -47, -47, -47, -47, -47 |
617 | }, | 617 | }, |
618 | 618 | ||
619 | { | 619 | { |
620 | 11, -48, -48, -48, -48, -48, -48, -48, -48, -48, | 620 | 11, 48, 48, -48, 48, 48, 48, 48, 48, 48, |
621 | -48, -48, -48, -48, -48, -48, -48 | 621 | 48, 48, 48, 48, 48, 48, 48, 48, 48 |
622 | }, | 622 | }, |
623 | 623 | ||
624 | { | 624 | { |
625 | 11, 49, 49, 50, 49, -49, 49, 49, -49, 49, | 625 | 11, -49, 49, 50, -49, -49, -49, -49, -49, -49, |
626 | 49, 49, 49, 49, 49, -49, 49 | 626 | -49, -49, -49, -49, -49, -49, -49, -49, -49 |
627 | 627 | ||
628 | }, | 628 | }, |
629 | 629 | ||
630 | { | 630 | { |
631 | 11, -50, -50, -50, -50, -50, -50, -50, -50, -50, | 631 | 11, 51, -50, -50, 51, 51, 51, 51, 51, 51, |
632 | -50, -50, -50, -50, -50, -50, -50 | 632 | 51, 51, 51, 51, 51, 51, 51, 51, 51 |
633 | }, | 633 | }, |
634 | 634 | ||
635 | { | 635 | { |
636 | 11, -51, -51, 52, -51, -51, -51, -51, -51, -51, | 636 | 11, -51, -51, -51, -51, -51, -51, -51, -51, -51, |
637 | -51, -51, -51, -51, -51, -51, -51 | 637 | -51, -51, -51, -51, -51, -51, -51, -51, -51 |
638 | }, | 638 | }, |
639 | 639 | ||
640 | { | 640 | { |
641 | 11, -52, -52, -52, -52, -52, -52, -52, -52, -52, | 641 | 11, 52, 52, 53, 52, -52, 52, 52, -52, 52, |
642 | -52, -52, -52, -52, -52, -52, -52 | 642 | 52, 52, 52, 52, 52, 52, 52, -52, 52 |
643 | }, | 643 | }, |
644 | 644 | ||
645 | { | 645 | { |
646 | 11, -53, -53, -53, -53, -53, -53, -53, -53, -53, | 646 | 11, -53, -53, -53, -53, -53, -53, -53, -53, -53, |
647 | -53, -53, -53, -53, -53, -53, -53 | 647 | -53, -53, -53, -53, -53, -53, -53, -53, -53 |
648 | }, | 648 | }, |
649 | 649 | ||
650 | { | 650 | { |
651 | 11, 54, 54, -54, 54, 54, 54, 54, 54, 54, | 651 | 11, -54, -54, 55, -54, -54, -54, -54, -54, -54, |
652 | 54, 54, 54, 54, 54, 54, 54 | 652 | -54, -54, -54, -54, -54, -54, -54, -54, -54 |
653 | 653 | ||
654 | }, | 654 | }, |
655 | 655 | ||
656 | { | 656 | { |
657 | 11, -55, -55, -55, -55, -55, -55, -55, -55, -55, | 657 | 11, -55, -55, -55, -55, -55, -55, -55, -55, -55, |
658 | -55, -55, -55, -55, -55, -55, -55 | 658 | -55, -55, -55, -55, -55, -55, -55, -55, -55 |
659 | }, | 659 | }, |
660 | 660 | ||
661 | { | 661 | { |
662 | 11, -56, -56, -56, -56, -56, -56, -56, -56, -56, | 662 | 11, -56, 56, -56, -56, -56, -56, -56, -56, -56, |
663 | -56, 60, 57, 57, -56, -56, -56 | 663 | -56, -56, -56, -56, -56, -56, -56, -56, -56 |
664 | }, | 664 | }, |
665 | 665 | ||
666 | { | 666 | { |
667 | 11, -57, -57, -57, -57, -57, -57, -57, -57, -57, | 667 | 11, -57, -57, -57, -57, -57, -57, -57, -57, -57, |
668 | -57, 57, 57, 57, -57, -57, -57 | 668 | -57, -57, -57, -57, -57, -57, -57, -57, -57 |
669 | }, | 669 | }, |
670 | 670 | ||
671 | { | 671 | { |
672 | 11, -58, -58, -58, -58, -58, -58, -58, -58, -58, | 672 | 11, 58, 58, -58, 58, 58, 58, 58, 58, 58, |
673 | -58, -58, -58, -58, -58, -58, -58 | 673 | 58, 58, 58, 58, 58, 58, 58, 58, 58 |
674 | }, | 674 | }, |
675 | 675 | ||
676 | { | 676 | { |
677 | 11, -59, -59, -59, -59, -59, -59, -59, -59, -59, | 677 | 11, -59, -59, -59, -59, -59, -59, -59, -59, -59, |
678 | -59, -59, -59, -59, -59, -59, -59 | 678 | -59, -59, -59, -59, -59, -59, -59, -59, -59 |
679 | 679 | ||
680 | }, | 680 | }, |
681 | 681 | ||
682 | { | 682 | { |
683 | 11, -60, -60, -60, -60, -60, -60, -60, -60, -60, | 683 | 11, -60, -60, -60, -60, -60, -60, -60, -60, -60, |
684 | -60, 57, 57, 57, -60, -60, -60 | 684 | -60, 66, 61, 61, -60, -60, -60, -60, -60 |
685 | }, | ||
686 | |||
687 | { | ||
688 | 11, -61, -61, -61, -61, -61, -61, -61, -61, -61, | ||
689 | -61, 61, 61, 61, -61, -61, -61, -61, -61 | ||
690 | }, | ||
691 | |||
692 | { | ||
693 | 11, -62, -62, -62, -62, -62, -62, -62, -62, -62, | ||
694 | -62, -62, -62, -62, -62, -62, -62, -62, -62 | ||
695 | }, | ||
696 | |||
697 | { | ||
698 | 11, -63, -63, -63, -63, -63, -63, -63, -63, -63, | ||
699 | -63, -63, -63, -63, -63, -63, -63, -63, -63 | ||
700 | }, | ||
701 | |||
702 | { | ||
703 | 11, -64, -64, -64, -64, -64, -64, -64, -64, -64, | ||
704 | -64, -64, -64, -64, -64, -64, -64, -64, -64 | ||
705 | |||
706 | }, | ||
707 | |||
708 | { | ||
709 | 11, -65, -65, -65, -65, -65, -65, -65, -65, -65, | ||
710 | -65, -65, -65, -65, -65, -65, -65, -65, -65 | ||
711 | }, | ||
712 | |||
713 | { | ||
714 | 11, -66, -66, -66, -66, -66, -66, -66, -66, -66, | ||
715 | -66, 61, 61, 61, -66, -66, -66, -66, -66 | ||
685 | }, | 716 | }, |
686 | 717 | ||
687 | } ; | 718 | } ; |
@@ -701,8 +732,8 @@ static void yy_fatal_error (yyconst char msg[] ); | |||
701 | *yy_cp = '\0'; \ | 732 | *yy_cp = '\0'; \ |
702 | (yy_c_buf_p) = yy_cp; | 733 | (yy_c_buf_p) = yy_cp; |
703 | 734 | ||
704 | #define YY_NUM_RULES 33 | 735 | #define YY_NUM_RULES 38 |
705 | #define YY_END_OF_BUFFER 34 | 736 | #define YY_END_OF_BUFFER 39 |
706 | /* This struct is not used in this scanner, | 737 | /* This struct is not used in this scanner, |
707 | but its presence is necessary. */ | 738 | but its presence is necessary. */ |
708 | struct yy_trans_info | 739 | struct yy_trans_info |
@@ -710,14 +741,15 @@ struct yy_trans_info | |||
710 | flex_int32_t yy_verify; | 741 | flex_int32_t yy_verify; |
711 | flex_int32_t yy_nxt; | 742 | flex_int32_t yy_nxt; |
712 | }; | 743 | }; |
713 | static yyconst flex_int16_t yy_accept[61] = | 744 | static yyconst flex_int16_t yy_accept[67] = |
714 | { 0, | 745 | { 0, |
715 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 746 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
716 | 34, 5, 4, 2, 3, 7, 8, 6, 32, 29, | 747 | 39, 5, 4, 2, 3, 7, 8, 6, 37, 34, |
717 | 31, 24, 28, 27, 26, 22, 17, 13, 16, 20, | 748 | 36, 29, 33, 32, 31, 27, 26, 21, 13, 20, |
718 | 22, 11, 12, 19, 19, 14, 22, 22, 4, 2, | 749 | 24, 27, 11, 12, 23, 23, 18, 14, 19, 27, |
719 | 3, 3, 1, 6, 32, 29, 31, 30, 24, 23, | 750 | 27, 4, 2, 3, 3, 1, 6, 37, 34, 36, |
720 | 26, 25, 15, 20, 9, 19, 19, 21, 10, 18 | 751 | 35, 29, 28, 31, 30, 26, 15, 24, 9, 23, |
752 | 23, 16, 17, 25, 10, 22 | ||
721 | } ; | 753 | } ; |
722 | 754 | ||
723 | static yyconst flex_int32_t yy_ec[256] = | 755 | static yyconst flex_int32_t yy_ec[256] = |
@@ -727,15 +759,15 @@ static yyconst flex_int32_t yy_ec[256] = | |||
727 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 759 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
728 | 1, 2, 4, 5, 6, 1, 1, 7, 8, 9, | 760 | 1, 2, 4, 5, 6, 1, 1, 7, 8, 9, |
729 | 10, 1, 1, 1, 11, 12, 12, 13, 13, 13, | 761 | 10, 1, 1, 1, 11, 12, 12, 13, 13, 13, |
730 | 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, | 762 | 13, 13, 13, 13, 13, 13, 13, 1, 1, 14, |
731 | 14, 1, 1, 1, 13, 13, 13, 13, 13, 13, | 763 | 15, 16, 1, 1, 13, 13, 13, 13, 13, 13, |
732 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, | 764 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, |
733 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, | 765 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, |
734 | 1, 15, 1, 1, 13, 1, 13, 13, 13, 13, | 766 | 1, 17, 1, 1, 13, 1, 13, 13, 13, 13, |
735 | 767 | ||
736 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, | 768 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, |
737 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, | 769 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, |
738 | 13, 13, 1, 16, 1, 1, 1, 1, 1, 1, | 770 | 13, 13, 1, 18, 1, 1, 1, 1, 1, 1, |
739 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 771 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
740 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 772 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
741 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 773 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
@@ -920,7 +952,7 @@ static int input (void ); | |||
920 | /* This used to be an fputs(), but since the string might contain NUL's, | 952 | /* This used to be an fputs(), but since the string might contain NUL's, |
921 | * we now use fwrite(). | 953 | * we now use fwrite(). |
922 | */ | 954 | */ |
923 | #define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0) | 955 | #define ECHO fwrite( zconftext, zconfleng, 1, zconfout ) |
924 | #endif | 956 | #endif |
925 | 957 | ||
926 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | 958 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
@@ -1142,22 +1174,38 @@ return T_UNEQUAL; | |||
1142 | YY_BREAK | 1174 | YY_BREAK |
1143 | case 16: | 1175 | case 16: |
1144 | YY_RULE_SETUP | 1176 | YY_RULE_SETUP |
1177 | return T_LESS_EQUAL; | ||
1178 | YY_BREAK | ||
1179 | case 17: | ||
1180 | YY_RULE_SETUP | ||
1181 | return T_GREATER_EQUAL; | ||
1182 | YY_BREAK | ||
1183 | case 18: | ||
1184 | YY_RULE_SETUP | ||
1185 | return T_LESS; | ||
1186 | YY_BREAK | ||
1187 | case 19: | ||
1188 | YY_RULE_SETUP | ||
1189 | return T_GREATER; | ||
1190 | YY_BREAK | ||
1191 | case 20: | ||
1192 | YY_RULE_SETUP | ||
1145 | { | 1193 | { |
1146 | str = zconftext[0]; | 1194 | str = zconftext[0]; |
1147 | new_string(); | 1195 | new_string(); |
1148 | BEGIN(STRING); | 1196 | BEGIN(STRING); |
1149 | } | 1197 | } |
1150 | YY_BREAK | 1198 | YY_BREAK |
1151 | case 17: | 1199 | case 21: |
1152 | /* rule 17 can match eol */ | 1200 | /* rule 21 can match eol */ |
1153 | YY_RULE_SETUP | 1201 | YY_RULE_SETUP |
1154 | BEGIN(INITIAL); current_file->lineno++; return T_EOL; | 1202 | BEGIN(INITIAL); current_file->lineno++; return T_EOL; |
1155 | YY_BREAK | 1203 | YY_BREAK |
1156 | case 18: | 1204 | case 22: |
1157 | YY_RULE_SETUP | 1205 | YY_RULE_SETUP |
1158 | /* ignore */ | 1206 | /* ignore */ |
1159 | YY_BREAK | 1207 | YY_BREAK |
1160 | case 19: | 1208 | case 23: |
1161 | YY_RULE_SETUP | 1209 | YY_RULE_SETUP |
1162 | { | 1210 | { |
1163 | const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); | 1211 | const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); |
@@ -1170,27 +1218,35 @@ YY_RULE_SETUP | |||
1170 | return T_WORD; | 1218 | return T_WORD; |
1171 | } | 1219 | } |
1172 | YY_BREAK | 1220 | YY_BREAK |
1173 | case 20: | 1221 | case 24: |
1174 | YY_RULE_SETUP | 1222 | YY_RULE_SETUP |
1175 | /* comment */ | 1223 | /* comment */ |
1176 | YY_BREAK | 1224 | YY_BREAK |
1177 | case 21: | 1225 | case 25: |
1178 | /* rule 21 can match eol */ | 1226 | /* rule 25 can match eol */ |
1179 | YY_RULE_SETUP | 1227 | YY_RULE_SETUP |
1180 | current_file->lineno++; | 1228 | current_file->lineno++; |
1181 | YY_BREAK | 1229 | YY_BREAK |
1182 | case 22: | 1230 | case 26: |
1183 | YY_RULE_SETUP | 1231 | YY_RULE_SETUP |
1184 | 1232 | ||
1185 | YY_BREAK | 1233 | YY_BREAK |
1234 | case 27: | ||
1235 | YY_RULE_SETUP | ||
1236 | { | ||
1237 | fprintf(stderr, | ||
1238 | "%s:%d:warning: ignoring unsupported character '%c'\n", | ||
1239 | zconf_curname(), zconf_lineno(), *zconftext); | ||
1240 | } | ||
1241 | YY_BREAK | ||
1186 | case YY_STATE_EOF(PARAM): | 1242 | case YY_STATE_EOF(PARAM): |
1187 | { | 1243 | { |
1188 | BEGIN(INITIAL); | 1244 | BEGIN(INITIAL); |
1189 | } | 1245 | } |
1190 | YY_BREAK | 1246 | YY_BREAK |
1191 | 1247 | ||
1192 | case 23: | 1248 | case 28: |
1193 | /* rule 23 can match eol */ | 1249 | /* rule 28 can match eol */ |
1194 | *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ | 1250 | *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ |
1195 | (yy_c_buf_p) = yy_cp -= 1; | 1251 | (yy_c_buf_p) = yy_cp -= 1; |
1196 | YY_DO_BEFORE_ACTION; /* set up zconftext again */ | 1252 | YY_DO_BEFORE_ACTION; /* set up zconftext again */ |
@@ -1201,14 +1257,14 @@ YY_RULE_SETUP | |||
1201 | return T_WORD_QUOTE; | 1257 | return T_WORD_QUOTE; |
1202 | } | 1258 | } |
1203 | YY_BREAK | 1259 | YY_BREAK |
1204 | case 24: | 1260 | case 29: |
1205 | YY_RULE_SETUP | 1261 | YY_RULE_SETUP |
1206 | { | 1262 | { |
1207 | append_string(zconftext, zconfleng); | 1263 | append_string(zconftext, zconfleng); |
1208 | } | 1264 | } |
1209 | YY_BREAK | 1265 | YY_BREAK |
1210 | case 25: | 1266 | case 30: |
1211 | /* rule 25 can match eol */ | 1267 | /* rule 30 can match eol */ |
1212 | *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ | 1268 | *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ |
1213 | (yy_c_buf_p) = yy_cp -= 1; | 1269 | (yy_c_buf_p) = yy_cp -= 1; |
1214 | YY_DO_BEFORE_ACTION; /* set up zconftext again */ | 1270 | YY_DO_BEFORE_ACTION; /* set up zconftext again */ |
@@ -1219,13 +1275,13 @@ YY_RULE_SETUP | |||
1219 | return T_WORD_QUOTE; | 1275 | return T_WORD_QUOTE; |
1220 | } | 1276 | } |
1221 | YY_BREAK | 1277 | YY_BREAK |
1222 | case 26: | 1278 | case 31: |
1223 | YY_RULE_SETUP | 1279 | YY_RULE_SETUP |
1224 | { | 1280 | { |
1225 | append_string(zconftext + 1, zconfleng - 1); | 1281 | append_string(zconftext + 1, zconfleng - 1); |
1226 | } | 1282 | } |
1227 | YY_BREAK | 1283 | YY_BREAK |
1228 | case 27: | 1284 | case 32: |
1229 | YY_RULE_SETUP | 1285 | YY_RULE_SETUP |
1230 | { | 1286 | { |
1231 | if (str == zconftext[0]) { | 1287 | if (str == zconftext[0]) { |
@@ -1236,8 +1292,8 @@ YY_RULE_SETUP | |||
1236 | append_string(zconftext, 1); | 1292 | append_string(zconftext, 1); |
1237 | } | 1293 | } |
1238 | YY_BREAK | 1294 | YY_BREAK |
1239 | case 28: | 1295 | case 33: |
1240 | /* rule 28 can match eol */ | 1296 | /* rule 33 can match eol */ |
1241 | YY_RULE_SETUP | 1297 | YY_RULE_SETUP |
1242 | { | 1298 | { |
1243 | printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); | 1299 | printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); |
@@ -1252,7 +1308,7 @@ case YY_STATE_EOF(STRING): | |||
1252 | } | 1308 | } |
1253 | YY_BREAK | 1309 | YY_BREAK |
1254 | 1310 | ||
1255 | case 29: | 1311 | case 34: |
1256 | YY_RULE_SETUP | 1312 | YY_RULE_SETUP |
1257 | { | 1313 | { |
1258 | ts = 0; | 1314 | ts = 0; |
@@ -1277,8 +1333,8 @@ YY_RULE_SETUP | |||
1277 | } | 1333 | } |
1278 | } | 1334 | } |
1279 | YY_BREAK | 1335 | YY_BREAK |
1280 | case 30: | 1336 | case 35: |
1281 | /* rule 30 can match eol */ | 1337 | /* rule 35 can match eol */ |
1282 | *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ | 1338 | *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ |
1283 | (yy_c_buf_p) = yy_cp -= 1; | 1339 | (yy_c_buf_p) = yy_cp -= 1; |
1284 | YY_DO_BEFORE_ACTION; /* set up zconftext again */ | 1340 | YY_DO_BEFORE_ACTION; /* set up zconftext again */ |
@@ -1289,15 +1345,15 @@ YY_RULE_SETUP | |||
1289 | return T_HELPTEXT; | 1345 | return T_HELPTEXT; |
1290 | } | 1346 | } |
1291 | YY_BREAK | 1347 | YY_BREAK |
1292 | case 31: | 1348 | case 36: |
1293 | /* rule 31 can match eol */ | 1349 | /* rule 36 can match eol */ |
1294 | YY_RULE_SETUP | 1350 | YY_RULE_SETUP |
1295 | { | 1351 | { |
1296 | current_file->lineno++; | 1352 | current_file->lineno++; |
1297 | append_string("\n", 1); | 1353 | append_string("\n", 1); |
1298 | } | 1354 | } |
1299 | YY_BREAK | 1355 | YY_BREAK |
1300 | case 32: | 1356 | case 37: |
1301 | YY_RULE_SETUP | 1357 | YY_RULE_SETUP |
1302 | { | 1358 | { |
1303 | while (zconfleng) { | 1359 | while (zconfleng) { |
@@ -1328,7 +1384,7 @@ case YY_STATE_EOF(COMMAND): | |||
1328 | yyterminate(); | 1384 | yyterminate(); |
1329 | } | 1385 | } |
1330 | YY_BREAK | 1386 | YY_BREAK |
1331 | case 33: | 1387 | case 38: |
1332 | YY_RULE_SETUP | 1388 | YY_RULE_SETUP |
1333 | YY_FATAL_ERROR( "flex scanner jammed" ); | 1389 | YY_FATAL_ERROR( "flex scanner jammed" ); |
1334 | YY_BREAK | 1390 | YY_BREAK |
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index de5e84ed3f96..7a4d658c2066 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped | |||
@@ -1,8 +1,8 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.5. */ | 1 | /* A Bison parser, made by GNU Bison 2.5.1. */ |
2 | 2 | ||
3 | /* Bison implementation for Yacc-like parsers in C | 3 | /* Bison implementation for Yacc-like parsers in C |
4 | 4 | ||
5 | Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. | 5 | Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. |
6 | 6 | ||
7 | This program is free software: you can redistribute it and/or modify | 7 | This program is free software: you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
@@ -44,7 +44,7 @@ | |||
44 | #define YYBISON 1 | 44 | #define YYBISON 1 |
45 | 45 | ||
46 | /* Bison version. */ | 46 | /* Bison version. */ |
47 | #define YYBISON_VERSION "2.5" | 47 | #define YYBISON_VERSION "2.5.1" |
48 | 48 | ||
49 | /* Skeleton name. */ | 49 | /* Skeleton name. */ |
50 | #define YYSKELETON_NAME "yacc.c" | 50 | #define YYSKELETON_NAME "yacc.c" |
@@ -108,6 +108,14 @@ static struct menu *current_menu, *current_entry; | |||
108 | 108 | ||
109 | 109 | ||
110 | 110 | ||
111 | # ifndef YY_NULL | ||
112 | # if defined __cplusplus && 201103L <= __cplusplus | ||
113 | # define YY_NULL nullptr | ||
114 | # else | ||
115 | # define YY_NULL 0 | ||
116 | # endif | ||
117 | # endif | ||
118 | |||
111 | /* Enabling traces. */ | 119 | /* Enabling traces. */ |
112 | #ifndef YYDEBUG | 120 | #ifndef YYDEBUG |
113 | # define YYDEBUG 1 | 121 | # define YYDEBUG 1 |
@@ -159,13 +167,17 @@ static struct menu *current_menu, *current_entry; | |||
159 | T_WORD = 281, | 167 | T_WORD = 281, |
160 | T_WORD_QUOTE = 282, | 168 | T_WORD_QUOTE = 282, |
161 | T_UNEQUAL = 283, | 169 | T_UNEQUAL = 283, |
162 | T_CLOSE_PAREN = 284, | 170 | T_LESS = 284, |
163 | T_OPEN_PAREN = 285, | 171 | T_LESS_EQUAL = 285, |
164 | T_EOL = 286, | 172 | T_GREATER = 286, |
165 | T_OR = 287, | 173 | T_GREATER_EQUAL = 287, |
166 | T_AND = 288, | 174 | T_CLOSE_PAREN = 288, |
167 | T_EQUAL = 289, | 175 | T_OPEN_PAREN = 289, |
168 | T_NOT = 290 | 176 | T_EOL = 290, |
177 | T_OR = 291, | ||
178 | T_AND = 292, | ||
179 | T_EQUAL = 293, | ||
180 | T_NOT = 294 | ||
169 | }; | 181 | }; |
170 | #endif | 182 | #endif |
171 | 183 | ||
@@ -304,6 +316,7 @@ YYID (yyi) | |||
304 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ | 316 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ |
305 | || defined __cplusplus || defined _MSC_VER) | 317 | || defined __cplusplus || defined _MSC_VER) |
306 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | 318 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
319 | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ | ||
307 | # ifndef EXIT_SUCCESS | 320 | # ifndef EXIT_SUCCESS |
308 | # define EXIT_SUCCESS 0 | 321 | # define EXIT_SUCCESS 0 |
309 | # endif | 322 | # endif |
@@ -395,20 +408,20 @@ union yyalloc | |||
395 | #endif | 408 | #endif |
396 | 409 | ||
397 | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED | 410 | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
398 | /* Copy COUNT objects from FROM to TO. The source and destination do | 411 | /* Copy COUNT objects from SRC to DST. The source and destination do |
399 | not overlap. */ | 412 | not overlap. */ |
400 | # ifndef YYCOPY | 413 | # ifndef YYCOPY |
401 | # if defined __GNUC__ && 1 < __GNUC__ | 414 | # if defined __GNUC__ && 1 < __GNUC__ |
402 | # define YYCOPY(To, From, Count) \ | 415 | # define YYCOPY(Dst, Src, Count) \ |
403 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | 416 | __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) |
404 | # else | 417 | # else |
405 | # define YYCOPY(To, From, Count) \ | 418 | # define YYCOPY(Dst, Src, Count) \ |
406 | do \ | 419 | do \ |
407 | { \ | 420 | { \ |
408 | YYSIZE_T yyi; \ | 421 | YYSIZE_T yyi; \ |
409 | for (yyi = 0; yyi < (Count); yyi++) \ | 422 | for (yyi = 0; yyi < (Count); yyi++) \ |
410 | (To)[yyi] = (From)[yyi]; \ | 423 | (Dst)[yyi] = (Src)[yyi]; \ |
411 | } \ | 424 | } \ |
412 | while (YYID (0)) | 425 | while (YYID (0)) |
413 | # endif | 426 | # endif |
414 | # endif | 427 | # endif |
@@ -417,20 +430,20 @@ union yyalloc | |||
417 | /* YYFINAL -- State number of the termination state. */ | 430 | /* YYFINAL -- State number of the termination state. */ |
418 | #define YYFINAL 11 | 431 | #define YYFINAL 11 |
419 | /* YYLAST -- Last index in YYTABLE. */ | 432 | /* YYLAST -- Last index in YYTABLE. */ |
420 | #define YYLAST 290 | 433 | #define YYLAST 298 |
421 | 434 | ||
422 | /* YYNTOKENS -- Number of terminals. */ | 435 | /* YYNTOKENS -- Number of terminals. */ |
423 | #define YYNTOKENS 36 | 436 | #define YYNTOKENS 40 |
424 | /* YYNNTS -- Number of nonterminals. */ | 437 | /* YYNNTS -- Number of nonterminals. */ |
425 | #define YYNNTS 50 | 438 | #define YYNNTS 50 |
426 | /* YYNRULES -- Number of rules. */ | 439 | /* YYNRULES -- Number of rules. */ |
427 | #define YYNRULES 118 | 440 | #define YYNRULES 122 |
428 | /* YYNRULES -- Number of states. */ | 441 | /* YYNRULES -- Number of states. */ |
429 | #define YYNSTATES 191 | 442 | #define YYNSTATES 199 |
430 | 443 | ||
431 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | 444 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
432 | #define YYUNDEFTOK 2 | 445 | #define YYUNDEFTOK 2 |
433 | #define YYMAXUTOK 290 | 446 | #define YYMAXUTOK 294 |
434 | 447 | ||
435 | #define YYTRANSLATE(YYX) \ | 448 | #define YYTRANSLATE(YYX) \ |
436 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | 449 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
@@ -467,7 +480,7 @@ static const yytype_uint8 yytranslate[] = | |||
467 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | 480 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
468 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | 481 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
469 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, | 482 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
470 | 35 | 483 | 35, 36, 37, 38, 39 |
471 | }; | 484 | }; |
472 | 485 | ||
473 | #if YYDEBUG | 486 | #if YYDEBUG |
@@ -486,64 +499,67 @@ static const yytype_uint16 yyprhs[] = | |||
486 | 235, 238, 241, 244, 248, 252, 255, 258, 261, 262, | 499 | 235, 238, 241, 244, 248, 252, 255, 258, 261, 262, |
487 | 265, 268, 271, 276, 277, 280, 283, 286, 287, 290, | 500 | 265, 268, 271, 276, 277, 280, 283, 286, 287, 290, |
488 | 292, 294, 297, 300, 303, 305, 308, 309, 312, 314, | 501 | 292, 294, 297, 300, 303, 305, 308, 309, 312, 314, |
489 | 318, 322, 326, 329, 333, 337, 339, 341, 342 | 502 | 318, 322, 326, 330, 334, 338, 342, 345, 349, 353, |
503 | 355, 357, 358 | ||
490 | }; | 504 | }; |
491 | 505 | ||
492 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | 506 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
493 | static const yytype_int8 yyrhs[] = | 507 | static const yytype_int8 yyrhs[] = |
494 | { | 508 | { |
495 | 37, 0, -1, 81, 38, -1, 38, -1, 63, 39, | 509 | 41, 0, -1, 85, 42, -1, 42, -1, 67, 43, |
496 | -1, 39, -1, -1, 39, 41, -1, 39, 55, -1, | 510 | -1, 43, -1, -1, 43, 45, -1, 43, 59, -1, |
497 | 39, 67, -1, 39, 80, -1, 39, 26, 1, 31, | 511 | 43, 71, -1, 43, 84, -1, 43, 26, 1, 35, |
498 | -1, 39, 40, 1, 31, -1, 39, 1, 31, -1, | 512 | -1, 43, 44, 1, 35, -1, 43, 1, 35, -1, |
499 | 16, -1, 18, -1, 19, -1, 21, -1, 17, -1, | 513 | 16, -1, 18, -1, 19, -1, 21, -1, 17, -1, |
500 | 22, -1, 20, -1, 23, -1, 31, -1, 61, -1, | 514 | 22, -1, 20, -1, 23, -1, 35, -1, 65, -1, |
501 | 71, -1, 44, -1, 46, -1, 69, -1, 26, 1, | 515 | 75, -1, 48, -1, 50, -1, 73, -1, 26, 1, |
502 | 31, -1, 1, 31, -1, 10, 26, 31, -1, 43, | 516 | 35, -1, 1, 35, -1, 10, 26, 35, -1, 47, |
503 | 47, -1, 11, 26, 31, -1, 45, 47, -1, -1, | 517 | 51, -1, 11, 26, 35, -1, 49, 51, -1, -1, |
504 | 47, 48, -1, 47, 49, -1, 47, 75, -1, 47, | 518 | 51, 52, -1, 51, 53, -1, 51, 79, -1, 51, |
505 | 73, -1, 47, 42, -1, 47, 31, -1, 19, 78, | 519 | 77, -1, 51, 46, -1, 51, 35, -1, 19, 82, |
506 | 31, -1, 18, 79, 82, 31, -1, 20, 83, 82, | 520 | 35, -1, 18, 83, 86, 35, -1, 20, 87, 86, |
507 | 31, -1, 21, 26, 82, 31, -1, 22, 84, 84, | 521 | 35, -1, 21, 26, 86, 35, -1, 22, 88, 88, |
508 | 82, 31, -1, 24, 50, 31, -1, -1, 50, 26, | 522 | 86, 35, -1, 24, 54, 35, -1, -1, 54, 26, |
509 | 51, -1, -1, 34, 79, -1, 7, 85, 31, -1, | 523 | 55, -1, -1, 38, 83, -1, 7, 89, 35, -1, |
510 | 52, 56, -1, 80, -1, 53, 58, 54, -1, -1, | 524 | 56, 60, -1, 84, -1, 57, 62, 58, -1, -1, |
511 | 56, 57, -1, 56, 75, -1, 56, 73, -1, 56, | 525 | 60, 61, -1, 60, 79, -1, 60, 77, -1, 60, |
512 | 31, -1, 56, 42, -1, 18, 79, 82, 31, -1, | 526 | 35, -1, 60, 46, -1, 18, 83, 86, 35, -1, |
513 | 19, 78, 31, -1, 17, 31, -1, 20, 26, 82, | 527 | 19, 82, 35, -1, 17, 35, -1, 20, 26, 86, |
514 | 31, -1, -1, 58, 41, -1, 14, 83, 81, -1, | 528 | 35, -1, -1, 62, 45, -1, 14, 87, 85, -1, |
515 | 80, -1, 59, 62, 60, -1, -1, 62, 41, -1, | 529 | 84, -1, 63, 66, 64, -1, -1, 66, 45, -1, |
516 | 62, 67, -1, 62, 55, -1, 3, 79, 81, -1, | 530 | 66, 71, -1, 66, 59, -1, 3, 83, 85, -1, |
517 | 4, 79, 31, -1, 64, 76, 74, -1, 80, -1, | 531 | 4, 83, 35, -1, 68, 80, 78, -1, 84, -1, |
518 | 65, 68, 66, -1, -1, 68, 41, -1, 68, 67, | 532 | 69, 72, 70, -1, -1, 72, 45, -1, 72, 71, |
519 | -1, 68, 55, -1, 6, 79, 31, -1, 9, 79, | 533 | -1, 72, 59, -1, 6, 83, 35, -1, 9, 83, |
520 | 31, -1, 70, 74, -1, 12, 31, -1, 72, 13, | 534 | 35, -1, 74, 78, -1, 12, 35, -1, 76, 13, |
521 | -1, -1, 74, 75, -1, 74, 31, -1, 74, 42, | 535 | -1, -1, 78, 79, -1, 78, 35, -1, 78, 46, |
522 | -1, 16, 25, 83, 31, -1, -1, 76, 77, -1, | 536 | -1, 16, 25, 87, 35, -1, -1, 80, 81, -1, |
523 | 76, 31, -1, 23, 82, -1, -1, 79, 82, -1, | 537 | 80, 35, -1, 23, 86, -1, -1, 83, 86, -1, |
524 | 26, -1, 27, -1, 5, 31, -1, 8, 31, -1, | 538 | 26, -1, 27, -1, 5, 35, -1, 8, 35, -1, |
525 | 15, 31, -1, 31, -1, 81, 31, -1, -1, 14, | 539 | 15, 35, -1, 35, -1, 85, 35, -1, -1, 14, |
526 | 83, -1, 84, -1, 84, 34, 84, -1, 84, 28, | 540 | 87, -1, 88, -1, 88, 29, 88, -1, 88, 30, |
527 | 84, -1, 30, 83, 29, -1, 35, 83, -1, 83, | 541 | 88, -1, 88, 31, 88, -1, 88, 32, 88, -1, |
528 | 32, 83, -1, 83, 33, 83, -1, 26, -1, 27, | 542 | 88, 38, 88, -1, 88, 28, 88, -1, 34, 87, |
529 | -1, -1, 26, -1 | 543 | 33, -1, 39, 87, -1, 87, 36, 87, -1, 87, |
544 | 37, 87, -1, 26, -1, 27, -1, -1, 26, -1 | ||
530 | }; | 545 | }; |
531 | 546 | ||
532 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | 547 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
533 | static const yytype_uint16 yyrline[] = | 548 | static const yytype_uint16 yyrline[] = |
534 | { | 549 | { |
535 | 0, 103, 103, 103, 105, 105, 107, 109, 110, 111, | 550 | 0, 108, 108, 108, 110, 110, 112, 114, 115, 116, |
536 | 112, 113, 114, 118, 122, 122, 122, 122, 122, 122, | 551 | 117, 118, 119, 123, 127, 127, 127, 127, 127, 127, |
537 | 122, 122, 126, 127, 128, 129, 130, 131, 135, 136, | 552 | 127, 127, 131, 132, 133, 134, 135, 136, 140, 141, |
538 | 142, 150, 156, 164, 174, 176, 177, 178, 179, 180, | 553 | 147, 155, 161, 169, 179, 181, 182, 183, 184, 185, |
539 | 181, 184, 192, 198, 208, 214, 220, 223, 225, 236, | 554 | 186, 189, 197, 203, 213, 219, 225, 228, 230, 241, |
540 | 237, 242, 251, 256, 264, 267, 269, 270, 271, 272, | 555 | 242, 247, 256, 261, 269, 272, 274, 275, 276, 277, |
541 | 273, 276, 282, 293, 299, 309, 311, 316, 324, 332, | 556 | 278, 281, 287, 298, 304, 314, 316, 321, 329, 337, |
542 | 335, 337, 338, 339, 344, 351, 358, 363, 371, 374, | 557 | 340, 342, 343, 344, 349, 356, 363, 368, 376, 379, |
543 | 376, 377, 378, 381, 389, 396, 403, 409, 416, 418, | 558 | 381, 382, 383, 386, 394, 401, 408, 414, 421, 423, |
544 | 419, 420, 423, 431, 433, 434, 437, 444, 446, 451, | 559 | 424, 425, 428, 436, 438, 439, 442, 449, 451, 456, |
545 | 452, 455, 456, 457, 461, 462, 465, 466, 469, 470, | 560 | 457, 460, 461, 462, 466, 467, 470, 471, 474, 475, |
546 | 471, 472, 473, 474, 475, 478, 479, 482, 483 | 561 | 476, 477, 478, 479, 480, 481, 482, 483, 484, 487, |
562 | 488, 491, 492 | ||
547 | }; | 563 | }; |
548 | #endif | 564 | #endif |
549 | 565 | ||
@@ -557,6 +573,7 @@ static const char *const yytname[] = | |||
557 | "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", | 573 | "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", |
558 | "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE", | 574 | "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE", |
559 | "T_VISIBLE", "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", | 575 | "T_VISIBLE", "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", |
576 | "T_LESS", "T_LESS_EQUAL", "T_GREATER", "T_GREATER_EQUAL", | ||
560 | "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL", | 577 | "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL", |
561 | "T_NOT", "$accept", "input", "start", "stmt_list", "option_name", | 578 | "T_NOT", "$accept", "input", "start", "stmt_list", "option_name", |
562 | "common_stmt", "option_error", "config_entry_start", "config_stmt", | 579 | "common_stmt", "option_error", "config_entry_start", "config_stmt", |
@@ -568,7 +585,7 @@ static const char *const yytname[] = | |||
568 | "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt", | 585 | "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt", |
569 | "comment", "comment_stmt", "help_start", "help", "depends_list", | 586 | "comment", "comment_stmt", "help_start", "help", "depends_list", |
570 | "depends", "visibility_list", "visible", "prompt_stmt_opt", "prompt", | 587 | "depends", "visibility_list", "visible", "prompt_stmt_opt", "prompt", |
571 | "end", "nl", "if_expr", "expr", "symbol", "word_opt", 0 | 588 | "end", "nl", "if_expr", "expr", "symbol", "word_opt", YY_NULL |
572 | }; | 589 | }; |
573 | #endif | 590 | #endif |
574 | 591 | ||
@@ -580,25 +597,26 @@ static const yytype_uint16 yytoknum[] = | |||
580 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | 597 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
581 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | 598 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
582 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, | 599 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
583 | 285, 286, 287, 288, 289, 290 | 600 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294 |
584 | }; | 601 | }; |
585 | # endif | 602 | # endif |
586 | 603 | ||
587 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | 604 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
588 | static const yytype_uint8 yyr1[] = | 605 | static const yytype_uint8 yyr1[] = |
589 | { | 606 | { |
590 | 0, 36, 37, 37, 38, 38, 39, 39, 39, 39, | 607 | 0, 40, 41, 41, 42, 42, 43, 43, 43, 43, |
591 | 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, | 608 | 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, |
592 | 40, 40, 41, 41, 41, 41, 41, 41, 42, 42, | 609 | 44, 44, 45, 45, 45, 45, 45, 45, 46, 46, |
593 | 43, 44, 45, 46, 47, 47, 47, 47, 47, 47, | 610 | 47, 48, 49, 50, 51, 51, 51, 51, 51, 51, |
594 | 47, 48, 48, 48, 48, 48, 49, 50, 50, 51, | 611 | 51, 52, 52, 52, 52, 52, 53, 54, 54, 55, |
595 | 51, 52, 53, 54, 55, 56, 56, 56, 56, 56, | 612 | 55, 56, 57, 58, 59, 60, 60, 60, 60, 60, |
596 | 56, 57, 57, 57, 57, 58, 58, 59, 60, 61, | 613 | 60, 61, 61, 61, 61, 62, 62, 63, 64, 65, |
597 | 62, 62, 62, 62, 63, 64, 65, 66, 67, 68, | 614 | 66, 66, 66, 66, 67, 68, 69, 70, 71, 72, |
598 | 68, 68, 68, 69, 70, 71, 72, 73, 74, 74, | 615 | 72, 72, 72, 73, 74, 75, 76, 77, 78, 78, |
599 | 74, 74, 75, 76, 76, 76, 77, 78, 78, 79, | 616 | 78, 78, 79, 80, 80, 80, 81, 82, 82, 83, |
600 | 79, 80, 80, 80, 81, 81, 82, 82, 83, 83, | 617 | 83, 84, 84, 84, 85, 85, 86, 86, 87, 87, |
601 | 83, 83, 83, 83, 83, 84, 84, 85, 85 | 618 | 87, 87, 87, 87, 87, 87, 87, 87, 87, 88, |
619 | 88, 89, 89 | ||
602 | }; | 620 | }; |
603 | 621 | ||
604 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | 622 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
@@ -615,7 +633,8 @@ static const yytype_uint8 yyr2[] = | |||
615 | 2, 2, 2, 3, 3, 2, 2, 2, 0, 2, | 633 | 2, 2, 2, 3, 3, 2, 2, 2, 0, 2, |
616 | 2, 2, 4, 0, 2, 2, 2, 0, 2, 1, | 634 | 2, 2, 4, 0, 2, 2, 2, 0, 2, 1, |
617 | 1, 2, 2, 2, 1, 2, 0, 2, 1, 3, | 635 | 1, 2, 2, 2, 1, 2, 0, 2, 1, 3, |
618 | 3, 3, 2, 3, 3, 1, 1, 0, 1 | 636 | 3, 3, 3, 3, 3, 3, 2, 3, 3, 1, |
637 | 1, 0, 1 | ||
619 | }; | 638 | }; |
620 | 639 | ||
621 | /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. | 640 | /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. |
@@ -624,72 +643,72 @@ static const yytype_uint8 yyr2[] = | |||
624 | static const yytype_uint8 yydefact[] = | 643 | static const yytype_uint8 yydefact[] = |
625 | { | 644 | { |
626 | 6, 0, 104, 0, 3, 0, 6, 6, 99, 100, | 645 | 6, 0, 104, 0, 3, 0, 6, 6, 99, 100, |
627 | 0, 1, 0, 0, 0, 0, 117, 0, 0, 0, | 646 | 0, 1, 0, 0, 0, 0, 121, 0, 0, 0, |
628 | 0, 0, 0, 14, 18, 15, 16, 20, 17, 19, | 647 | 0, 0, 0, 14, 18, 15, 16, 20, 17, 19, |
629 | 21, 0, 22, 0, 7, 34, 25, 34, 26, 55, | 648 | 21, 0, 22, 0, 7, 34, 25, 34, 26, 55, |
630 | 65, 8, 70, 23, 93, 79, 9, 27, 88, 24, | 649 | 65, 8, 70, 23, 93, 79, 9, 27, 88, 24, |
631 | 10, 0, 105, 2, 74, 13, 0, 101, 0, 118, | 650 | 10, 0, 105, 2, 74, 13, 0, 101, 0, 122, |
632 | 0, 102, 0, 0, 0, 115, 116, 0, 0, 0, | 651 | 0, 102, 0, 0, 0, 119, 120, 0, 0, 0, |
633 | 108, 103, 0, 0, 0, 0, 0, 0, 0, 88, | 652 | 108, 103, 0, 0, 0, 0, 0, 0, 0, 88, |
634 | 0, 0, 75, 83, 51, 84, 30, 32, 0, 112, | 653 | 0, 0, 75, 83, 51, 84, 30, 32, 0, 116, |
635 | 0, 0, 67, 0, 0, 11, 12, 0, 0, 0, | 654 | 0, 0, 67, 0, 0, 0, 0, 0, 0, 11, |
636 | 0, 97, 0, 0, 0, 47, 0, 40, 39, 35, | 655 | 12, 0, 0, 0, 0, 97, 0, 0, 0, 47, |
637 | 36, 0, 38, 37, 0, 0, 97, 0, 59, 60, | 656 | 0, 40, 39, 35, 36, 0, 38, 37, 0, 0, |
638 | 56, 58, 57, 66, 54, 53, 71, 73, 69, 72, | 657 | 97, 0, 59, 60, 56, 58, 57, 66, 54, 53, |
639 | 68, 106, 95, 0, 94, 80, 82, 78, 81, 77, | 658 | 71, 73, 69, 72, 68, 106, 95, 0, 94, 80, |
640 | 90, 91, 89, 111, 113, 114, 110, 109, 29, 86, | 659 | 82, 78, 81, 77, 90, 91, 89, 115, 117, 118, |
641 | 0, 106, 0, 106, 106, 106, 0, 0, 0, 87, | 660 | 114, 109, 110, 111, 112, 113, 29, 86, 0, 106, |
642 | 63, 106, 0, 106, 0, 96, 0, 0, 41, 98, | 661 | 0, 106, 106, 106, 0, 0, 0, 87, 63, 106, |
643 | 0, 0, 106, 49, 46, 28, 0, 62, 0, 107, | 662 | 0, 106, 0, 96, 0, 0, 41, 98, 0, 0, |
644 | 92, 42, 43, 44, 0, 0, 48, 61, 64, 45, | 663 | 106, 49, 46, 28, 0, 62, 0, 107, 92, 42, |
645 | 50 | 664 | 43, 44, 0, 0, 48, 61, 64, 45, 50 |
646 | }; | 665 | }; |
647 | 666 | ||
648 | /* YYDEFGOTO[NTERM-NUM]. */ | 667 | /* YYDEFGOTO[NTERM-NUM]. */ |
649 | static const yytype_int16 yydefgoto[] = | 668 | static const yytype_int16 yydefgoto[] = |
650 | { | 669 | { |
651 | -1, 3, 4, 5, 33, 34, 108, 35, 36, 37, | 670 | -1, 3, 4, 5, 33, 34, 112, 35, 36, 37, |
652 | 38, 74, 109, 110, 157, 186, 39, 40, 124, 41, | 671 | 38, 74, 113, 114, 165, 194, 39, 40, 128, 41, |
653 | 76, 120, 77, 42, 128, 43, 78, 6, 44, 45, | 672 | 76, 124, 77, 42, 132, 43, 78, 6, 44, 45, |
654 | 137, 46, 80, 47, 48, 49, 111, 112, 81, 113, | 673 | 141, 46, 80, 47, 48, 49, 115, 116, 81, 117, |
655 | 79, 134, 152, 153, 50, 7, 165, 69, 70, 60 | 674 | 79, 138, 160, 161, 50, 7, 173, 69, 70, 60 |
656 | }; | 675 | }; |
657 | 676 | ||
658 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | 677 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
659 | STATE-NUM. */ | 678 | STATE-NUM. */ |
660 | #define YYPACT_NINF -90 | 679 | #define YYPACT_NINF -91 |
661 | static const yytype_int16 yypact[] = | 680 | static const yytype_int16 yypact[] = |
662 | { | 681 | { |
663 | 4, 42, -90, 96, -90, 111, -90, 15, -90, -90, | 682 | 19, 37, -91, 13, -91, 79, -91, 20, -91, -91, |
664 | 75, -90, 82, 42, 104, 42, 110, 107, 42, 115, | 683 | -16, -91, 21, 37, 25, 37, 41, 36, 37, 78, |
665 | 125, -4, 121, -90, -90, -90, -90, -90, -90, -90, | 684 | 83, 31, 56, -91, -91, -91, -91, -91, -91, -91, |
666 | -90, 162, -90, 163, -90, -90, -90, -90, -90, -90, | 685 | -91, 116, -91, 127, -91, -91, -91, -91, -91, -91, |
667 | -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, | 686 | -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, |
668 | -90, 139, -90, -90, 138, -90, 142, -90, 143, -90, | 687 | -91, 147, -91, -91, 105, -91, 109, -91, 111, -91, |
669 | 152, -90, 164, 167, 168, -90, -90, -4, -4, 77, | 688 | 114, -91, 136, 137, 142, -91, -91, 31, 31, 76, |
670 | -18, -90, 177, 185, 33, 71, 195, 247, 236, -2, | 689 | 254, -91, 143, 146, 27, 115, 207, 258, 243, -14, |
671 | 236, 171, -90, -90, -90, -90, -90, -90, 41, -90, | 690 | 243, 179, -91, -91, -91, -91, -91, -91, -7, -91, |
672 | -4, -4, 138, 97, 97, -90, -90, 186, 187, 194, | 691 | 31, 31, 105, 51, 51, 51, 51, 51, 51, -91, |
673 | 42, 42, -4, 196, 97, -90, 219, -90, -90, -90, | 692 | -91, 156, 168, 181, 37, 37, 31, 178, 51, -91, |
674 | -90, 210, -90, -90, 204, 42, 42, 199, -90, -90, | 693 | 206, -91, -91, -91, -91, 196, -91, -91, 175, 37, |
675 | -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, | 694 | 37, 185, -91, -91, -91, -91, -91, -91, -91, -91, |
676 | -90, 222, -90, 223, -90, -90, -90, -90, -90, -90, | 695 | -91, -91, -91, -91, -91, 214, -91, 230, -91, -91, |
677 | -90, -90, -90, -90, 215, -90, -90, -90, -90, -90, | 696 | -91, -91, -91, -91, -91, -91, -91, -91, 183, -91, |
678 | -4, 222, 228, 222, -5, 222, 97, 35, 229, -90, | 697 | -91, -91, -91, -91, -91, -91, -91, -91, 31, 214, |
679 | -90, 222, 232, 222, -4, -90, 135, 233, -90, -90, | 698 | 194, 214, 45, 214, 51, 26, 195, -91, -91, 214, |
680 | 234, 235, 222, 240, -90, -90, 237, -90, 239, -13, | 699 | 197, 214, 31, -91, 139, 208, -91, -91, 220, 224, |
681 | -90, -90, -90, -90, 244, 42, -90, -90, -90, -90, | 700 | 214, 222, -91, -91, 226, -91, 227, 123, -91, -91, |
682 | -90 | 701 | -91, -91, 235, 37, -91, -91, -91, -91, -91 |
683 | }; | 702 | }; |
684 | 703 | ||
685 | /* YYPGOTO[NTERM-NUM]. */ | 704 | /* YYPGOTO[NTERM-NUM]. */ |
686 | static const yytype_int16 yypgoto[] = | 705 | static const yytype_int16 yypgoto[] = |
687 | { | 706 | { |
688 | -90, -90, 269, 271, -90, 23, -70, -90, -90, -90, | 707 | -91, -91, 264, 268, -91, 30, -65, -91, -91, -91, |
689 | -90, 243, -90, -90, -90, -90, -90, -90, -90, -48, | 708 | -91, 238, -91, -91, -91, -91, -91, -91, -91, -12, |
690 | -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, | 709 | -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, |
691 | -90, -20, -90, -90, -90, -90, -90, 206, 205, -68, | 710 | -91, -5, -91, -91, -91, -91, -91, 200, 209, -61, |
692 | -90, -90, 169, -1, 27, -7, 118, -66, -89, -90 | 711 | -91, -91, 170, -1, 65, 0, 118, -66, -90, -91 |
693 | }; | 712 | }; |
694 | 713 | ||
695 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | 714 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
@@ -698,102 +717,102 @@ static const yytype_int16 yypgoto[] = | |||
698 | #define YYTABLE_NINF -86 | 717 | #define YYTABLE_NINF -86 |
699 | static const yytype_int16 yytable[] = | 718 | static const yytype_int16 yytable[] = |
700 | { | 719 | { |
701 | 10, 88, 89, 54, 146, 147, 119, 1, 122, 164, | 720 | 10, 88, 89, 150, 151, 152, 153, 154, 155, 135, |
702 | 93, 141, 56, 142, 58, 156, 94, 62, 1, 90, | 721 | 54, 123, 56, 11, 58, 126, 145, 62, 164, 2, |
703 | 91, 131, 65, 66, 144, 145, 67, 90, 91, 132, | 722 | 146, 136, 1, 1, 148, 149, 147, -31, 101, 90, |
704 | 127, 68, 136, -31, 97, 2, 154, -31, -31, -31, | 723 | 91, -31, -31, -31, -31, -31, -31, -31, -31, 102, |
705 | -31, -31, -31, -31, -31, 98, 52, -31, -31, 99, | 724 | 162, -31, -31, 103, -31, 104, 105, 106, 107, 108, |
706 | -31, 100, 101, 102, 103, 104, -31, 105, 129, 106, | 725 | -31, 109, 181, 110, 2, 52, 55, 65, 66, 172, |
707 | 138, 173, 92, 141, 107, 142, 174, 172, 8, 9, | 726 | 57, 182, 111, 8, 9, 67, 131, 59, 140, 92, |
708 | 143, -33, 97, 90, 91, -33, -33, -33, -33, -33, | 727 | 68, 61, 145, 133, 180, 142, 146, 65, 66, -5, |
709 | -33, -33, -33, 98, 166, -33, -33, 99, -33, 100, | 728 | 12, 90, 91, 13, 14, 15, 16, 17, 18, 19, |
710 | 101, 102, 103, 104, -33, 105, 11, 106, 179, 151, | 729 | 20, 71, 174, 21, 22, 23, 24, 25, 26, 27, |
711 | 123, 126, 107, 135, 125, 130, 2, 139, 2, 90, | 730 | 28, 29, 30, 159, 63, 31, 187, 127, 130, 64, |
712 | 91, -5, 12, 55, 161, 13, 14, 15, 16, 17, | 731 | 139, 2, 90, 91, 32, -33, 101, 72, 169, -33, |
713 | 18, 19, 20, 65, 66, 21, 22, 23, 24, 25, | 732 | -33, -33, -33, -33, -33, -33, -33, 102, 73, -33, |
714 | 26, 27, 28, 29, 30, 57, 59, 31, 61, -4, | 733 | -33, 103, -33, 104, 105, 106, 107, 108, -33, 109, |
715 | 12, 63, 32, 13, 14, 15, 16, 17, 18, 19, | 734 | 52, 110, 129, 134, 82, 143, 83, -4, 12, 84, |
716 | 20, 64, 71, 21, 22, 23, 24, 25, 26, 27, | 735 | 111, 13, 14, 15, 16, 17, 18, 19, 20, 90, |
717 | 28, 29, 30, 72, 73, 31, 180, 90, 91, 52, | 736 | 91, 21, 22, 23, 24, 25, 26, 27, 28, 29, |
718 | 32, -85, 97, 82, 83, -85, -85, -85, -85, -85, | 737 | 30, 85, 86, 31, 188, 90, 91, 87, 99, -85, |
719 | -85, -85, -85, 84, 190, -85, -85, 99, -85, -85, | 738 | 101, 100, 32, -85, -85, -85, -85, -85, -85, -85, |
720 | -85, -85, -85, -85, -85, 85, 97, 106, 86, 87, | 739 | -85, 156, 198, -85, -85, 103, -85, -85, -85, -85, |
721 | -52, -52, 140, -52, -52, -52, -52, 98, 95, -52, | 740 | -85, -85, -85, 157, 163, 110, 158, 166, 101, 167, |
722 | -52, 99, 114, 115, 116, 117, 96, 148, 149, 150, | 741 | 168, 171, -52, -52, 144, -52, -52, -52, -52, 102, |
723 | 158, 106, 155, 159, 97, 163, 118, -76, -76, -76, | 742 | 91, -52, -52, 103, 118, 119, 120, 121, 172, 176, |
724 | -76, -76, -76, -76, -76, 160, 164, -76, -76, 99, | 743 | 183, 101, 185, 110, -76, -76, -76, -76, -76, -76, |
725 | 13, 14, 15, 16, 17, 18, 19, 20, 91, 106, | 744 | -76, -76, 122, 189, -76, -76, 103, 13, 14, 15, |
726 | 21, 22, 14, 15, 140, 17, 18, 19, 20, 168, | 745 | 16, 17, 18, 19, 20, 190, 110, 21, 22, 191, |
727 | 175, 21, 22, 177, 181, 182, 183, 32, 187, 167, | 746 | 193, 195, 196, 14, 15, 144, 17, 18, 19, 20, |
728 | 188, 169, 170, 171, 185, 189, 53, 51, 32, 176, | 747 | 197, 53, 21, 22, 51, 75, 125, 175, 32, 177, |
729 | 75, 178, 121, 0, 133, 162, 0, 0, 0, 0, | 748 | 178, 179, 93, 94, 95, 96, 97, 184, 137, 186, |
730 | 184 | 749 | 170, 0, 98, 32, 0, 0, 0, 0, 192 |
731 | }; | 750 | }; |
732 | 751 | ||
733 | #define yypact_value_is_default(yystate) \ | 752 | #define yypact_value_is_default(yystate) \ |
734 | ((yystate) == (-90)) | 753 | ((yystate) == (-91)) |
735 | 754 | ||
736 | #define yytable_value_is_error(yytable_value) \ | 755 | #define yytable_value_is_error(yytable_value) \ |
737 | YYID (0) | 756 | YYID (0) |
738 | 757 | ||
739 | static const yytype_int16 yycheck[] = | 758 | static const yytype_int16 yycheck[] = |
740 | { | 759 | { |
741 | 1, 67, 68, 10, 93, 94, 76, 3, 76, 14, | 760 | 1, 67, 68, 93, 94, 95, 96, 97, 98, 23, |
742 | 28, 81, 13, 81, 15, 104, 34, 18, 3, 32, | 761 | 10, 76, 13, 0, 15, 76, 81, 18, 108, 35, |
743 | 33, 23, 26, 27, 90, 91, 30, 32, 33, 31, | 762 | 81, 35, 3, 3, 90, 91, 33, 0, 1, 36, |
744 | 78, 35, 80, 0, 1, 31, 102, 4, 5, 6, | 763 | 37, 4, 5, 6, 7, 8, 9, 10, 11, 12, |
745 | 7, 8, 9, 10, 11, 12, 31, 14, 15, 16, | 764 | 106, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
746 | 17, 18, 19, 20, 21, 22, 23, 24, 78, 26, | 765 | 23, 24, 26, 26, 35, 35, 35, 26, 27, 14, |
747 | 80, 26, 69, 133, 31, 133, 31, 156, 26, 27, | 766 | 35, 35, 35, 26, 27, 34, 78, 26, 80, 69, |
748 | 29, 0, 1, 32, 33, 4, 5, 6, 7, 8, | 767 | 39, 35, 137, 78, 164, 80, 137, 26, 27, 0, |
749 | 9, 10, 11, 12, 150, 14, 15, 16, 17, 18, | 768 | 1, 36, 37, 4, 5, 6, 7, 8, 9, 10, |
750 | 19, 20, 21, 22, 23, 24, 0, 26, 164, 100, | 769 | 11, 35, 158, 14, 15, 16, 17, 18, 19, 20, |
751 | 77, 78, 31, 80, 77, 78, 31, 80, 31, 32, | 770 | 21, 22, 23, 104, 26, 26, 172, 77, 78, 26, |
752 | 33, 0, 1, 31, 115, 4, 5, 6, 7, 8, | 771 | 80, 35, 36, 37, 35, 0, 1, 1, 119, 4, |
753 | 9, 10, 11, 26, 27, 14, 15, 16, 17, 18, | 772 | 5, 6, 7, 8, 9, 10, 11, 12, 1, 14, |
754 | 19, 20, 21, 22, 23, 31, 26, 26, 31, 0, | 773 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
755 | 1, 26, 31, 4, 5, 6, 7, 8, 9, 10, | 774 | 35, 26, 77, 78, 35, 80, 35, 0, 1, 35, |
756 | 11, 26, 31, 14, 15, 16, 17, 18, 19, 20, | 775 | 35, 4, 5, 6, 7, 8, 9, 10, 11, 36, |
757 | 21, 22, 23, 1, 1, 26, 31, 32, 33, 31, | 776 | 37, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
758 | 31, 0, 1, 31, 31, 4, 5, 6, 7, 8, | 777 | 23, 35, 35, 26, 35, 36, 37, 35, 35, 0, |
759 | 9, 10, 11, 31, 185, 14, 15, 16, 17, 18, | 778 | 1, 35, 35, 4, 5, 6, 7, 8, 9, 10, |
760 | 19, 20, 21, 22, 23, 31, 1, 26, 31, 31, | 779 | 11, 35, 193, 14, 15, 16, 17, 18, 19, 20, |
761 | 5, 6, 31, 8, 9, 10, 11, 12, 31, 14, | 780 | 21, 22, 23, 35, 26, 26, 25, 1, 1, 13, |
762 | 15, 16, 17, 18, 19, 20, 31, 31, 31, 25, | 781 | 35, 26, 5, 6, 35, 8, 9, 10, 11, 12, |
763 | 1, 26, 26, 13, 1, 26, 31, 4, 5, 6, | 782 | 37, 14, 15, 16, 17, 18, 19, 20, 14, 35, |
764 | 7, 8, 9, 10, 11, 31, 14, 14, 15, 16, | 783 | 35, 1, 35, 26, 4, 5, 6, 7, 8, 9, |
765 | 4, 5, 6, 7, 8, 9, 10, 11, 33, 26, | 784 | 10, 11, 35, 35, 14, 15, 16, 4, 5, 6, |
766 | 14, 15, 5, 6, 31, 8, 9, 10, 11, 31, | 785 | 7, 8, 9, 10, 11, 35, 26, 14, 15, 35, |
767 | 31, 14, 15, 31, 31, 31, 31, 31, 31, 151, | 786 | 38, 35, 35, 5, 6, 35, 8, 9, 10, 11, |
768 | 31, 153, 154, 155, 34, 31, 7, 6, 31, 161, | 787 | 35, 7, 14, 15, 6, 37, 76, 159, 35, 161, |
769 | 37, 163, 76, -1, 79, 116, -1, -1, -1, -1, | 788 | 162, 163, 28, 29, 30, 31, 32, 169, 79, 171, |
770 | 172 | 789 | 120, -1, 38, 35, -1, -1, -1, -1, 180 |
771 | }; | 790 | }; |
772 | 791 | ||
773 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | 792 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
774 | symbol of state STATE-NUM. */ | 793 | symbol of state STATE-NUM. */ |
775 | static const yytype_uint8 yystos[] = | 794 | static const yytype_uint8 yystos[] = |
776 | { | 795 | { |
777 | 0, 3, 31, 37, 38, 39, 63, 81, 26, 27, | 796 | 0, 3, 35, 41, 42, 43, 67, 85, 26, 27, |
778 | 79, 0, 1, 4, 5, 6, 7, 8, 9, 10, | 797 | 83, 0, 1, 4, 5, 6, 7, 8, 9, 10, |
779 | 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, | 798 | 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
780 | 23, 26, 31, 40, 41, 43, 44, 45, 46, 52, | 799 | 23, 26, 35, 44, 45, 47, 48, 49, 50, 56, |
781 | 53, 55, 59, 61, 64, 65, 67, 69, 70, 71, | 800 | 57, 59, 63, 65, 68, 69, 71, 73, 74, 75, |
782 | 80, 39, 31, 38, 81, 31, 79, 31, 79, 26, | 801 | 84, 43, 35, 42, 85, 35, 83, 35, 83, 26, |
783 | 85, 31, 79, 26, 26, 26, 27, 30, 35, 83, | 802 | 89, 35, 83, 26, 26, 26, 27, 34, 39, 87, |
784 | 84, 31, 1, 1, 47, 47, 56, 58, 62, 76, | 803 | 88, 35, 1, 1, 51, 51, 60, 62, 66, 80, |
785 | 68, 74, 31, 31, 31, 31, 31, 31, 83, 83, | 804 | 72, 78, 35, 35, 35, 35, 35, 35, 87, 87, |
786 | 32, 33, 81, 28, 34, 31, 31, 1, 12, 16, | 805 | 36, 37, 85, 28, 29, 30, 31, 32, 38, 35, |
787 | 18, 19, 20, 21, 22, 24, 26, 31, 42, 48, | 806 | 35, 1, 12, 16, 18, 19, 20, 21, 22, 24, |
788 | 49, 72, 73, 75, 17, 18, 19, 20, 31, 42, | 807 | 26, 35, 46, 52, 53, 76, 77, 79, 17, 18, |
789 | 57, 73, 75, 41, 54, 80, 41, 55, 60, 67, | 808 | 19, 20, 35, 46, 61, 77, 79, 45, 58, 84, |
790 | 80, 23, 31, 74, 77, 41, 55, 66, 67, 80, | 809 | 45, 59, 64, 71, 84, 23, 35, 78, 81, 45, |
791 | 31, 42, 75, 29, 83, 83, 84, 84, 31, 31, | 810 | 59, 70, 71, 84, 35, 46, 79, 33, 87, 87, |
792 | 25, 79, 78, 79, 83, 26, 84, 50, 1, 13, | 811 | 88, 88, 88, 88, 88, 88, 35, 35, 25, 83, |
793 | 31, 79, 78, 26, 14, 82, 83, 82, 31, 82, | 812 | 82, 83, 87, 26, 88, 54, 1, 13, 35, 83, |
794 | 82, 82, 84, 26, 31, 31, 82, 31, 82, 83, | 813 | 82, 26, 14, 86, 87, 86, 35, 86, 86, 86, |
795 | 31, 31, 31, 31, 82, 34, 51, 31, 31, 31, | 814 | 88, 26, 35, 35, 86, 35, 86, 87, 35, 35, |
796 | 79 | 815 | 35, 35, 86, 38, 55, 35, 35, 35, 83 |
797 | }; | 816 | }; |
798 | 817 | ||
799 | #define yyerrok (yyerrstatus = 0) | 818 | #define yyerrok (yyerrstatus = 0) |
@@ -823,17 +842,18 @@ static const yytype_uint8 yystos[] = | |||
823 | 842 | ||
824 | #define YYRECOVERING() (!!yyerrstatus) | 843 | #define YYRECOVERING() (!!yyerrstatus) |
825 | 844 | ||
826 | #define YYBACKUP(Token, Value) \ | 845 | #define YYBACKUP(Token, Value) \ |
827 | do \ | 846 | do \ |
828 | if (yychar == YYEMPTY && yylen == 1) \ | 847 | if (yychar == YYEMPTY) \ |
829 | { \ | 848 | { \ |
830 | yychar = (Token); \ | 849 | yychar = (Token); \ |
831 | yylval = (Value); \ | 850 | yylval = (Value); \ |
832 | YYPOPSTACK (1); \ | 851 | YYPOPSTACK (yylen); \ |
833 | goto yybackup; \ | 852 | yystate = *yyssp; \ |
834 | } \ | 853 | goto yybackup; \ |
835 | else \ | 854 | } \ |
836 | { \ | 855 | else \ |
856 | { \ | ||
837 | yyerror (YY_("syntax error: cannot back up")); \ | 857 | yyerror (YY_("syntax error: cannot back up")); \ |
838 | YYERROR; \ | 858 | YYERROR; \ |
839 | } \ | 859 | } \ |
@@ -928,6 +948,8 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) | |||
928 | YYSTYPE const * const yyvaluep; | 948 | YYSTYPE const * const yyvaluep; |
929 | #endif | 949 | #endif |
930 | { | 950 | { |
951 | FILE *yyo = yyoutput; | ||
952 | YYUSE (yyo); | ||
931 | if (!yyvaluep) | 953 | if (!yyvaluep) |
932 | return; | 954 | return; |
933 | # ifdef YYPRINT | 955 | # ifdef YYPRINT |
@@ -1179,12 +1201,12 @@ static int | |||
1179 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | 1201 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, |
1180 | yytype_int16 *yyssp, int yytoken) | 1202 | yytype_int16 *yyssp, int yytoken) |
1181 | { | 1203 | { |
1182 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); | 1204 | YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); |
1183 | YYSIZE_T yysize = yysize0; | 1205 | YYSIZE_T yysize = yysize0; |
1184 | YYSIZE_T yysize1; | 1206 | YYSIZE_T yysize1; |
1185 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; | 1207 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
1186 | /* Internationalized format string. */ | 1208 | /* Internationalized format string. */ |
1187 | const char *yyformat = 0; | 1209 | const char *yyformat = YY_NULL; |
1188 | /* Arguments of yyformat. */ | 1210 | /* Arguments of yyformat. */ |
1189 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | 1211 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
1190 | /* Number of reported tokens (one for the "unexpected", one per | 1212 | /* Number of reported tokens (one for the "unexpected", one per |
@@ -1244,7 +1266,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | |||
1244 | break; | 1266 | break; |
1245 | } | 1267 | } |
1246 | yyarg[yycount++] = yytname[yyx]; | 1268 | yyarg[yycount++] = yytname[yyx]; |
1247 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); | 1269 | yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); |
1248 | if (! (yysize <= yysize1 | 1270 | if (! (yysize <= yysize1 |
1249 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) | 1271 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
1250 | return 2; | 1272 | return 2; |
@@ -1329,7 +1351,7 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1329 | 1351 | ||
1330 | switch (yytype) | 1352 | switch (yytype) |
1331 | { | 1353 | { |
1332 | case 53: /* "choice_entry" */ | 1354 | case 57: /* "choice_entry" */ |
1333 | 1355 | ||
1334 | { | 1356 | { |
1335 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | 1357 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
@@ -1339,7 +1361,7 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1339 | }; | 1361 | }; |
1340 | 1362 | ||
1341 | break; | 1363 | break; |
1342 | case 59: /* "if_entry" */ | 1364 | case 63: /* "if_entry" */ |
1343 | 1365 | ||
1344 | { | 1366 | { |
1345 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | 1367 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
@@ -1349,7 +1371,7 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1349 | }; | 1371 | }; |
1350 | 1372 | ||
1351 | break; | 1373 | break; |
1352 | case 65: /* "menu_entry" */ | 1374 | case 69: /* "menu_entry" */ |
1353 | 1375 | ||
1354 | { | 1376 | { |
1355 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | 1377 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
@@ -1426,7 +1448,7 @@ yyparse () | |||
1426 | `yyss': related to states. | 1448 | `yyss': related to states. |
1427 | `yyvs': related to semantic values. | 1449 | `yyvs': related to semantic values. |
1428 | 1450 | ||
1429 | Refer to the stacks thru separate pointers, to allow yyoverflow | 1451 | Refer to the stacks through separate pointers, to allow yyoverflow |
1430 | to reallocate them elsewhere. */ | 1452 | to reallocate them elsewhere. */ |
1431 | 1453 | ||
1432 | /* The state stack. */ | 1454 | /* The state stack. */ |
@@ -2012,46 +2034,66 @@ yyreduce: | |||
2012 | 2034 | ||
2013 | case 109: | 2035 | case 109: |
2014 | 2036 | ||
2015 | { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); } | 2037 | { (yyval.expr) = expr_alloc_comp(E_LTH, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); } |
2016 | break; | 2038 | break; |
2017 | 2039 | ||
2018 | case 110: | 2040 | case 110: |
2019 | 2041 | ||
2020 | { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); } | 2042 | { (yyval.expr) = expr_alloc_comp(E_LEQ, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); } |
2021 | break; | 2043 | break; |
2022 | 2044 | ||
2023 | case 111: | 2045 | case 111: |
2024 | 2046 | ||
2025 | { (yyval.expr) = (yyvsp[(2) - (3)].expr); } | 2047 | { (yyval.expr) = expr_alloc_comp(E_GTH, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); } |
2026 | break; | 2048 | break; |
2027 | 2049 | ||
2028 | case 112: | 2050 | case 112: |
2029 | 2051 | ||
2030 | { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); } | 2052 | { (yyval.expr) = expr_alloc_comp(E_GEQ, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); } |
2031 | break; | 2053 | break; |
2032 | 2054 | ||
2033 | case 113: | 2055 | case 113: |
2034 | 2056 | ||
2035 | { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } | 2057 | { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); } |
2036 | break; | 2058 | break; |
2037 | 2059 | ||
2038 | case 114: | 2060 | case 114: |
2039 | 2061 | ||
2040 | { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } | 2062 | { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); } |
2041 | break; | 2063 | break; |
2042 | 2064 | ||
2043 | case 115: | 2065 | case 115: |
2044 | 2066 | ||
2045 | { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); } | 2067 | { (yyval.expr) = (yyvsp[(2) - (3)].expr); } |
2046 | break; | 2068 | break; |
2047 | 2069 | ||
2048 | case 116: | 2070 | case 116: |
2049 | 2071 | ||
2050 | { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); } | 2072 | { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); } |
2051 | break; | 2073 | break; |
2052 | 2074 | ||
2053 | case 117: | 2075 | case 117: |
2054 | 2076 | ||
2077 | { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } | ||
2078 | break; | ||
2079 | |||
2080 | case 118: | ||
2081 | |||
2082 | { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } | ||
2083 | break; | ||
2084 | |||
2085 | case 119: | ||
2086 | |||
2087 | { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); } | ||
2088 | break; | ||
2089 | |||
2090 | case 120: | ||
2091 | |||
2092 | { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); } | ||
2093 | break; | ||
2094 | |||
2095 | case 121: | ||
2096 | |||
2055 | { (yyval.string) = NULL; } | 2097 | { (yyval.string) = NULL; } |
2056 | break; | 2098 | break; |
2057 | 2099 | ||
@@ -2243,7 +2285,7 @@ yyabortlab: | |||
2243 | yyresult = 1; | 2285 | yyresult = 1; |
2244 | goto yyreturn; | 2286 | goto yyreturn; |
2245 | 2287 | ||
2246 | #if !defined(yyoverflow) || YYERROR_VERBOSE | 2288 | #if !defined yyoverflow || YYERROR_VERBOSE |
2247 | /*-------------------------------------------------. | 2289 | /*-------------------------------------------------. |
2248 | | yyexhaustedlab -- memory exhaustion comes here. | | 2290 | | yyexhaustedlab -- memory exhaustion comes here. | |
2249 | `-------------------------------------------------*/ | 2291 | `-------------------------------------------------*/ |
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 0f683cfa53e9..71bf8bff696a 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y | |||
@@ -69,6 +69,10 @@ static struct menu *current_menu, *current_entry; | |||
69 | %token <string> T_WORD | 69 | %token <string> T_WORD |
70 | %token <string> T_WORD_QUOTE | 70 | %token <string> T_WORD_QUOTE |
71 | %token T_UNEQUAL | 71 | %token T_UNEQUAL |
72 | %token T_LESS | ||
73 | %token T_LESS_EQUAL | ||
74 | %token T_GREATER | ||
75 | %token T_GREATER_EQUAL | ||
72 | %token T_CLOSE_PAREN | 76 | %token T_CLOSE_PAREN |
73 | %token T_OPEN_PAREN | 77 | %token T_OPEN_PAREN |
74 | %token T_EOL | 78 | %token T_EOL |
@@ -76,6 +80,7 @@ static struct menu *current_menu, *current_entry; | |||
76 | %left T_OR | 80 | %left T_OR |
77 | %left T_AND | 81 | %left T_AND |
78 | %left T_EQUAL T_UNEQUAL | 82 | %left T_EQUAL T_UNEQUAL |
83 | %left T_LESS T_LESS_EQUAL T_GREATER T_GREATER_EQUAL | ||
79 | %nonassoc T_NOT | 84 | %nonassoc T_NOT |
80 | 85 | ||
81 | %type <string> prompt | 86 | %type <string> prompt |
@@ -467,6 +472,10 @@ if_expr: /* empty */ { $$ = NULL; } | |||
467 | ; | 472 | ; |
468 | 473 | ||
469 | expr: symbol { $$ = expr_alloc_symbol($1); } | 474 | expr: symbol { $$ = expr_alloc_symbol($1); } |
475 | | symbol T_LESS symbol { $$ = expr_alloc_comp(E_LTH, $1, $3); } | ||
476 | | symbol T_LESS_EQUAL symbol { $$ = expr_alloc_comp(E_LEQ, $1, $3); } | ||
477 | | symbol T_GREATER symbol { $$ = expr_alloc_comp(E_GTH, $1, $3); } | ||
478 | | symbol T_GREATER_EQUAL symbol { $$ = expr_alloc_comp(E_GEQ, $1, $3); } | ||
470 | | symbol T_EQUAL symbol { $$ = expr_alloc_comp(E_EQUAL, $1, $3); } | 479 | | symbol T_EQUAL symbol { $$ = expr_alloc_comp(E_EQUAL, $1, $3); } |
471 | | symbol T_UNEQUAL symbol { $$ = expr_alloc_comp(E_UNEQUAL, $1, $3); } | 480 | | symbol T_UNEQUAL symbol { $$ = expr_alloc_comp(E_UNEQUAL, $1, $3); } |
472 | | T_OPEN_PAREN expr T_CLOSE_PAREN { $$ = $2; } | 481 | | T_OPEN_PAREN expr T_CLOSE_PAREN { $$ = $2; } |
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 86a4fe75f453..1a10d8ac8162 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh | |||
@@ -82,7 +82,7 @@ kallsyms() | |||
82 | kallsymopt="${kallsymopt} --all-symbols" | 82 | kallsymopt="${kallsymopt} --all-symbols" |
83 | fi | 83 | fi |
84 | 84 | ||
85 | if [ -n "${CONFIG_ARM}" ] && [ -n "${CONFIG_PAGE_OFFSET}" ]; then | 85 | if [ -n "${CONFIG_ARM}" ] && [ -z "${CONFIG_XIP_KERNEL}" ] && [ -n "${CONFIG_PAGE_OFFSET}" ]; then |
86 | kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET" | 86 | kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET" |
87 | fi | 87 | fi |
88 | 88 | ||
@@ -111,7 +111,6 @@ sortextable() | |||
111 | } | 111 | } |
112 | 112 | ||
113 | # Delete output files in case of error | 113 | # Delete output files in case of error |
114 | trap cleanup SIGHUP SIGINT SIGQUIT SIGTERM ERR | ||
115 | cleanup() | 114 | cleanup() |
116 | { | 115 | { |
117 | rm -f .old_version | 116 | rm -f .old_version |
@@ -124,6 +123,20 @@ cleanup() | |||
124 | rm -f vmlinux.o | 123 | rm -f vmlinux.o |
125 | } | 124 | } |
126 | 125 | ||
126 | on_exit() | ||
127 | { | ||
128 | if [ $? -ne 0 ]; then | ||
129 | cleanup | ||
130 | fi | ||
131 | } | ||
132 | trap on_exit EXIT | ||
133 | |||
134 | on_signals() | ||
135 | { | ||
136 | exit 1 | ||
137 | } | ||
138 | trap on_signals HUP INT QUIT TERM | ||
139 | |||
127 | # | 140 | # |
128 | # | 141 | # |
129 | # Use "make V=1" to debug this script | 142 | # Use "make V=1" to debug this script |
@@ -231,7 +244,6 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then | |||
231 | if ! cmp -s System.map .tmp_System.map; then | 244 | if ! cmp -s System.map .tmp_System.map; then |
232 | echo >&2 Inconsistent kallsyms data | 245 | echo >&2 Inconsistent kallsyms data |
233 | echo >&2 Try "make KALLSYMS_EXTRA_PASS=1" as a workaround | 246 | echo >&2 Try "make KALLSYMS_EXTRA_PASS=1" as a workaround |
234 | cleanup | ||
235 | exit 1 | 247 | exit 1 |
236 | fi | 248 | fi |
237 | fi | 249 | fi |
diff --git a/scripts/mksysmap b/scripts/mksysmap index 7ada35a0f478..a35acc0d0b82 100755 --- a/scripts/mksysmap +++ b/scripts/mksysmap | |||
@@ -41,4 +41,4 @@ | |||
41 | # so we just ignore them to let readprofile continue to work. | 41 | # so we just ignore them to let readprofile continue to work. |
42 | # (At least sparc64 has __crc_ in the middle). | 42 | # (At least sparc64 has __crc_ in the middle). |
43 | 43 | ||
44 | $NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $2 | 44 | $NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( .L\)' > $2 |
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index f282516acc7b..e70fcd12eeeb 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c | |||
@@ -63,6 +63,8 @@ int main(void) | |||
63 | 63 | ||
64 | DEVID(acpi_device_id); | 64 | DEVID(acpi_device_id); |
65 | DEVID_FIELD(acpi_device_id, id); | 65 | DEVID_FIELD(acpi_device_id, id); |
66 | DEVID_FIELD(acpi_device_id, cls); | ||
67 | DEVID_FIELD(acpi_device_id, cls_msk); | ||
66 | 68 | ||
67 | DEVID(pnp_device_id); | 69 | DEVID(pnp_device_id); |
68 | DEVID_FIELD(pnp_device_id, id); | 70 | DEVID_FIELD(pnp_device_id, id); |
@@ -168,6 +170,9 @@ int main(void) | |||
168 | DEVID_FIELD(amba_id, id); | 170 | DEVID_FIELD(amba_id, id); |
169 | DEVID_FIELD(amba_id, mask); | 171 | DEVID_FIELD(amba_id, mask); |
170 | 172 | ||
173 | DEVID(mips_cdmm_device_id); | ||
174 | DEVID_FIELD(mips_cdmm_device_id, type); | ||
175 | |||
171 | DEVID(x86_cpu_id); | 176 | DEVID(x86_cpu_id); |
172 | DEVID_FIELD(x86_cpu_id, feature); | 177 | DEVID_FIELD(x86_cpu_id, feature); |
173 | DEVID_FIELD(x86_cpu_id, family); | 178 | DEVID_FIELD(x86_cpu_id, family); |
@@ -179,6 +184,7 @@ int main(void) | |||
179 | 184 | ||
180 | DEVID(mei_cl_device_id); | 185 | DEVID(mei_cl_device_id); |
181 | DEVID_FIELD(mei_cl_device_id, name); | 186 | DEVID_FIELD(mei_cl_device_id, name); |
187 | DEVID_FIELD(mei_cl_device_id, uuid); | ||
182 | 188 | ||
183 | DEVID(rio_device_id); | 189 | DEVID(rio_device_id); |
184 | DEVID_FIELD(rio_device_id, did); | 190 | DEVID_FIELD(rio_device_id, did); |
@@ -186,5 +192,9 @@ int main(void) | |||
186 | DEVID_FIELD(rio_device_id, asm_did); | 192 | DEVID_FIELD(rio_device_id, asm_did); |
187 | DEVID_FIELD(rio_device_id, asm_vid); | 193 | DEVID_FIELD(rio_device_id, asm_vid); |
188 | 194 | ||
195 | DEVID(ulpi_device_id); | ||
196 | DEVID_FIELD(ulpi_device_id, vendor); | ||
197 | DEVID_FIELD(ulpi_device_id, product); | ||
198 | |||
189 | return 0; | 199 | return 0; |
190 | } | 200 | } |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index e614ef689eee..5f2088209132 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -34,6 +34,9 @@ typedef Elf64_Addr kernel_ulong_t; | |||
34 | typedef uint32_t __u32; | 34 | typedef uint32_t __u32; |
35 | typedef uint16_t __u16; | 35 | typedef uint16_t __u16; |
36 | typedef unsigned char __u8; | 36 | typedef unsigned char __u8; |
37 | typedef struct { | ||
38 | __u8 b[16]; | ||
39 | } uuid_le; | ||
37 | 40 | ||
38 | /* Big exception to the "don't include kernel headers into userspace, which | 41 | /* Big exception to the "don't include kernel headers into userspace, which |
39 | * even potentially has different endianness and word sizes, since | 42 | * even potentially has different endianness and word sizes, since |
@@ -131,6 +134,15 @@ static inline void add_wildcard(char *str) | |||
131 | strcat(str + len, "*"); | 134 | strcat(str + len, "*"); |
132 | } | 135 | } |
133 | 136 | ||
137 | static inline void add_uuid(char *str, uuid_le uuid) | ||
138 | { | ||
139 | int len = strlen(str); | ||
140 | int i; | ||
141 | |||
142 | for (i = 0; i < 16; i++) | ||
143 | sprintf(str + len + (i << 1), "%02x", uuid.b[i]); | ||
144 | } | ||
145 | |||
134 | /** | 146 | /** |
135 | * Check that sizeof(device_id type) are consistent with size of section | 147 | * Check that sizeof(device_id type) are consistent with size of section |
136 | * in .o file. If in-consistent then userspace and kernel does not agree | 148 | * in .o file. If in-consistent then userspace and kernel does not agree |
@@ -511,12 +523,40 @@ static int do_serio_entry(const char *filename, | |||
511 | } | 523 | } |
512 | ADD_TO_DEVTABLE("serio", serio_device_id, do_serio_entry); | 524 | ADD_TO_DEVTABLE("serio", serio_device_id, do_serio_entry); |
513 | 525 | ||
514 | /* looks like: "acpi:ACPI0003 or acpi:PNP0C0B" or "acpi:LNXVIDEO" */ | 526 | /* looks like: "acpi:ACPI0003" or "acpi:PNP0C0B" or "acpi:LNXVIDEO" or |
527 | * "acpi:bbsspp" (bb=base-class, ss=sub-class, pp=prog-if) | ||
528 | * | ||
529 | * NOTE: Each driver should use one of the following : _HID, _CIDs | ||
530 | * or _CLS. Also, bb, ss, and pp can be substituted with ?? | ||
531 | * as don't care byte. | ||
532 | */ | ||
515 | static int do_acpi_entry(const char *filename, | 533 | static int do_acpi_entry(const char *filename, |
516 | void *symval, char *alias) | 534 | void *symval, char *alias) |
517 | { | 535 | { |
518 | DEF_FIELD_ADDR(symval, acpi_device_id, id); | 536 | DEF_FIELD_ADDR(symval, acpi_device_id, id); |
519 | sprintf(alias, "acpi*:%s:*", *id); | 537 | DEF_FIELD_ADDR(symval, acpi_device_id, cls); |
538 | DEF_FIELD_ADDR(symval, acpi_device_id, cls_msk); | ||
539 | |||
540 | if (id && strlen((const char *)*id)) | ||
541 | sprintf(alias, "acpi*:%s:*", *id); | ||
542 | else if (cls) { | ||
543 | int i, byte_shift, cnt = 0; | ||
544 | unsigned int msk; | ||
545 | |||
546 | sprintf(&alias[cnt], "acpi*:"); | ||
547 | cnt = 6; | ||
548 | for (i = 1; i <= 3; i++) { | ||
549 | byte_shift = 8 * (3-i); | ||
550 | msk = (*cls_msk >> byte_shift) & 0xFF; | ||
551 | if (msk) | ||
552 | sprintf(&alias[cnt], "%02x", | ||
553 | (*cls >> byte_shift) & 0xFF); | ||
554 | else | ||
555 | sprintf(&alias[cnt], "??"); | ||
556 | cnt += 2; | ||
557 | } | ||
558 | sprintf(&alias[cnt], ":*"); | ||
559 | } | ||
520 | return 1; | 560 | return 1; |
521 | } | 561 | } |
522 | ADD_TO_DEVTABLE("acpi", acpi_device_id, do_acpi_entry); | 562 | ADD_TO_DEVTABLE("acpi", acpi_device_id, do_acpi_entry); |
@@ -1109,6 +1149,22 @@ static int do_amba_entry(const char *filename, | |||
1109 | } | 1149 | } |
1110 | ADD_TO_DEVTABLE("amba", amba_id, do_amba_entry); | 1150 | ADD_TO_DEVTABLE("amba", amba_id, do_amba_entry); |
1111 | 1151 | ||
1152 | /* | ||
1153 | * looks like: "mipscdmm:tN" | ||
1154 | * | ||
1155 | * N is exactly 2 digits, where each is an upper-case hex digit, or | ||
1156 | * a ? or [] pattern matching exactly one digit. | ||
1157 | */ | ||
1158 | static int do_mips_cdmm_entry(const char *filename, | ||
1159 | void *symval, char *alias) | ||
1160 | { | ||
1161 | DEF_FIELD(symval, mips_cdmm_device_id, type); | ||
1162 | |||
1163 | sprintf(alias, "mipscdmm:t%02X*", type); | ||
1164 | return 1; | ||
1165 | } | ||
1166 | ADD_TO_DEVTABLE("mipscdmm", mips_cdmm_device_id, do_mips_cdmm_entry); | ||
1167 | |||
1112 | /* LOOKS like cpu:type:x86,venVVVVfamFFFFmodMMMM:feature:*,FEAT,* | 1168 | /* LOOKS like cpu:type:x86,venVVVVfamFFFFmodMMMM:feature:*,FEAT,* |
1113 | * All fields are numbers. It would be nicer to use strings for vendor | 1169 | * All fields are numbers. It would be nicer to use strings for vendor |
1114 | * and feature, but getting those out of the build system here is too | 1170 | * and feature, but getting those out of the build system here is too |
@@ -1144,13 +1200,18 @@ static int do_cpu_entry(const char *filename, void *symval, char *alias) | |||
1144 | } | 1200 | } |
1145 | ADD_TO_DEVTABLE("cpu", cpu_feature, do_cpu_entry); | 1201 | ADD_TO_DEVTABLE("cpu", cpu_feature, do_cpu_entry); |
1146 | 1202 | ||
1147 | /* Looks like: mei:S */ | 1203 | /* Looks like: mei:S:uuid */ |
1148 | static int do_mei_entry(const char *filename, void *symval, | 1204 | static int do_mei_entry(const char *filename, void *symval, |
1149 | char *alias) | 1205 | char *alias) |
1150 | { | 1206 | { |
1151 | DEF_FIELD_ADDR(symval, mei_cl_device_id, name); | 1207 | DEF_FIELD_ADDR(symval, mei_cl_device_id, name); |
1208 | DEF_FIELD_ADDR(symval, mei_cl_device_id, uuid); | ||
1209 | |||
1210 | sprintf(alias, MEI_CL_MODULE_PREFIX); | ||
1211 | sprintf(alias + strlen(alias), "%s:", (*name)[0] ? *name : "*"); | ||
1212 | add_uuid(alias, *uuid); | ||
1152 | 1213 | ||
1153 | sprintf(alias, MEI_CL_MODULE_PREFIX "%s", *name); | 1214 | strcat(alias, ":*"); |
1154 | 1215 | ||
1155 | return 1; | 1216 | return 1; |
1156 | } | 1217 | } |
@@ -1176,6 +1237,19 @@ static int do_rio_entry(const char *filename, | |||
1176 | } | 1237 | } |
1177 | ADD_TO_DEVTABLE("rapidio", rio_device_id, do_rio_entry); | 1238 | ADD_TO_DEVTABLE("rapidio", rio_device_id, do_rio_entry); |
1178 | 1239 | ||
1240 | /* Looks like: ulpi:vNpN */ | ||
1241 | static int do_ulpi_entry(const char *filename, void *symval, | ||
1242 | char *alias) | ||
1243 | { | ||
1244 | DEF_FIELD(symval, ulpi_device_id, vendor); | ||
1245 | DEF_FIELD(symval, ulpi_device_id, product); | ||
1246 | |||
1247 | sprintf(alias, "ulpi:v%04xp%04x", vendor, product); | ||
1248 | |||
1249 | return 1; | ||
1250 | } | ||
1251 | ADD_TO_DEVTABLE("ulpi", ulpi_device_id, do_ulpi_entry); | ||
1252 | |||
1179 | /* Does namelen bytes of name exactly match the symbol? */ | 1253 | /* Does namelen bytes of name exactly match the symbol? */ |
1180 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) | 1254 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) |
1181 | { | 1255 | { |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index d439856f8176..12d3db3bd46b 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -776,6 +776,7 @@ static const char *sech_name(struct elf_info *elf, Elf_Shdr *sechdr) | |||
776 | * "foo" will match an exact string equal to "foo" | 776 | * "foo" will match an exact string equal to "foo" |
777 | * "*foo" will match a string that ends with "foo" | 777 | * "*foo" will match a string that ends with "foo" |
778 | * "foo*" will match a string that begins with "foo" | 778 | * "foo*" will match a string that begins with "foo" |
779 | * "*foo*" will match a string that contains "foo" | ||
779 | */ | 780 | */ |
780 | static int match(const char *sym, const char * const pat[]) | 781 | static int match(const char *sym, const char * const pat[]) |
781 | { | 782 | { |
@@ -784,8 +785,17 @@ static int match(const char *sym, const char * const pat[]) | |||
784 | p = *pat++; | 785 | p = *pat++; |
785 | const char *endp = p + strlen(p) - 1; | 786 | const char *endp = p + strlen(p) - 1; |
786 | 787 | ||
788 | /* "*foo*" */ | ||
789 | if (*p == '*' && *endp == '*') { | ||
790 | char *here, *bare = strndup(p + 1, strlen(p) - 2); | ||
791 | |||
792 | here = strstr(sym, bare); | ||
793 | free(bare); | ||
794 | if (here != NULL) | ||
795 | return 1; | ||
796 | } | ||
787 | /* "*foo" */ | 797 | /* "*foo" */ |
788 | if (*p == '*') { | 798 | else if (*p == '*') { |
789 | if (strrcmp(sym, p + 1) == 0) | 799 | if (strrcmp(sym, p + 1) == 0) |
790 | return 1; | 800 | return 1; |
791 | } | 801 | } |
@@ -873,7 +883,11 @@ static void check_section(const char *modname, struct elf_info *elf, | |||
873 | #define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS | 883 | #define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS |
874 | 884 | ||
875 | #define DATA_SECTIONS ".data", ".data.rel" | 885 | #define DATA_SECTIONS ".data", ".data.rel" |
876 | #define TEXT_SECTIONS ".text", ".text.unlikely" | 886 | #define TEXT_SECTIONS ".text", ".text.unlikely", ".sched.text", \ |
887 | ".kprobes.text" | ||
888 | #define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \ | ||
889 | ".fixup", ".entry.text", ".exception.text", ".text.*", \ | ||
890 | ".coldtext" | ||
877 | 891 | ||
878 | #define INIT_SECTIONS ".init.*" | 892 | #define INIT_SECTIONS ".init.*" |
879 | #define MEM_INIT_SECTIONS ".meminit.*" | 893 | #define MEM_INIT_SECTIONS ".meminit.*" |
@@ -881,6 +895,9 @@ static void check_section(const char *modname, struct elf_info *elf, | |||
881 | #define EXIT_SECTIONS ".exit.*" | 895 | #define EXIT_SECTIONS ".exit.*" |
882 | #define MEM_EXIT_SECTIONS ".memexit.*" | 896 | #define MEM_EXIT_SECTIONS ".memexit.*" |
883 | 897 | ||
898 | #define ALL_TEXT_SECTIONS ALL_INIT_TEXT_SECTIONS, ALL_EXIT_TEXT_SECTIONS, \ | ||
899 | TEXT_SECTIONS, OTHER_TEXT_SECTIONS | ||
900 | |||
884 | /* init data sections */ | 901 | /* init data sections */ |
885 | static const char *const init_data_sections[] = | 902 | static const char *const init_data_sections[] = |
886 | { ALL_INIT_DATA_SECTIONS, NULL }; | 903 | { ALL_INIT_DATA_SECTIONS, NULL }; |
@@ -892,6 +909,9 @@ static const char *const init_sections[] = { ALL_INIT_SECTIONS, NULL }; | |||
892 | static const char *const init_exit_sections[] = | 909 | static const char *const init_exit_sections[] = |
893 | {ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }; | 910 | {ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }; |
894 | 911 | ||
912 | /* all text sections */ | ||
913 | static const char *const text_sections[] = { ALL_TEXT_SECTIONS, NULL }; | ||
914 | |||
895 | /* data section */ | 915 | /* data section */ |
896 | static const char *const data_sections[] = { DATA_SECTIONS, NULL }; | 916 | static const char *const data_sections[] = { DATA_SECTIONS, NULL }; |
897 | 917 | ||
@@ -910,6 +930,7 @@ static const char *const data_sections[] = { DATA_SECTIONS, NULL }; | |||
910 | static const char *const head_sections[] = { ".head.text*", NULL }; | 930 | static const char *const head_sections[] = { ".head.text*", NULL }; |
911 | static const char *const linker_symbols[] = | 931 | static const char *const linker_symbols[] = |
912 | { "__init_begin", "_sinittext", "_einittext", NULL }; | 932 | { "__init_begin", "_sinittext", "_einittext", NULL }; |
933 | static const char *const optim_symbols[] = { "*.constprop.*", NULL }; | ||
913 | 934 | ||
914 | enum mismatch { | 935 | enum mismatch { |
915 | TEXT_TO_ANY_INIT, | 936 | TEXT_TO_ANY_INIT, |
@@ -921,34 +942,65 @@ enum mismatch { | |||
921 | ANY_INIT_TO_ANY_EXIT, | 942 | ANY_INIT_TO_ANY_EXIT, |
922 | ANY_EXIT_TO_ANY_INIT, | 943 | ANY_EXIT_TO_ANY_INIT, |
923 | EXPORT_TO_INIT_EXIT, | 944 | EXPORT_TO_INIT_EXIT, |
945 | EXTABLE_TO_NON_TEXT, | ||
924 | }; | 946 | }; |
925 | 947 | ||
948 | /** | ||
949 | * Describe how to match sections on different criterias: | ||
950 | * | ||
951 | * @fromsec: Array of sections to be matched. | ||
952 | * | ||
953 | * @bad_tosec: Relocations applied to a section in @fromsec to a section in | ||
954 | * this array is forbidden (black-list). Can be empty. | ||
955 | * | ||
956 | * @good_tosec: Relocations applied to a section in @fromsec must be | ||
957 | * targetting sections in this array (white-list). Can be empty. | ||
958 | * | ||
959 | * @mismatch: Type of mismatch. | ||
960 | * | ||
961 | * @symbol_white_list: Do not match a relocation to a symbol in this list | ||
962 | * even if it is targetting a section in @bad_to_sec. | ||
963 | * | ||
964 | * @handler: Specific handler to call when a match is found. If NULL, | ||
965 | * default_mismatch_handler() will be called. | ||
966 | * | ||
967 | */ | ||
926 | struct sectioncheck { | 968 | struct sectioncheck { |
927 | const char *fromsec[20]; | 969 | const char *fromsec[20]; |
928 | const char *tosec[20]; | 970 | const char *bad_tosec[20]; |
971 | const char *good_tosec[20]; | ||
929 | enum mismatch mismatch; | 972 | enum mismatch mismatch; |
930 | const char *symbol_white_list[20]; | 973 | const char *symbol_white_list[20]; |
974 | void (*handler)(const char *modname, struct elf_info *elf, | ||
975 | const struct sectioncheck* const mismatch, | ||
976 | Elf_Rela *r, Elf_Sym *sym, const char *fromsec); | ||
977 | |||
931 | }; | 978 | }; |
932 | 979 | ||
980 | static void extable_mismatch_handler(const char *modname, struct elf_info *elf, | ||
981 | const struct sectioncheck* const mismatch, | ||
982 | Elf_Rela *r, Elf_Sym *sym, | ||
983 | const char *fromsec); | ||
984 | |||
933 | static const struct sectioncheck sectioncheck[] = { | 985 | static const struct sectioncheck sectioncheck[] = { |
934 | /* Do not reference init/exit code/data from | 986 | /* Do not reference init/exit code/data from |
935 | * normal code and data | 987 | * normal code and data |
936 | */ | 988 | */ |
937 | { | 989 | { |
938 | .fromsec = { TEXT_SECTIONS, NULL }, | 990 | .fromsec = { TEXT_SECTIONS, NULL }, |
939 | .tosec = { ALL_INIT_SECTIONS, NULL }, | 991 | .bad_tosec = { ALL_INIT_SECTIONS, NULL }, |
940 | .mismatch = TEXT_TO_ANY_INIT, | 992 | .mismatch = TEXT_TO_ANY_INIT, |
941 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 993 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
942 | }, | 994 | }, |
943 | { | 995 | { |
944 | .fromsec = { DATA_SECTIONS, NULL }, | 996 | .fromsec = { DATA_SECTIONS, NULL }, |
945 | .tosec = { ALL_XXXINIT_SECTIONS, NULL }, | 997 | .bad_tosec = { ALL_XXXINIT_SECTIONS, NULL }, |
946 | .mismatch = DATA_TO_ANY_INIT, | 998 | .mismatch = DATA_TO_ANY_INIT, |
947 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 999 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
948 | }, | 1000 | }, |
949 | { | 1001 | { |
950 | .fromsec = { DATA_SECTIONS, NULL }, | 1002 | .fromsec = { DATA_SECTIONS, NULL }, |
951 | .tosec = { INIT_SECTIONS, NULL }, | 1003 | .bad_tosec = { INIT_SECTIONS, NULL }, |
952 | .mismatch = DATA_TO_ANY_INIT, | 1004 | .mismatch = DATA_TO_ANY_INIT, |
953 | .symbol_white_list = { | 1005 | .symbol_white_list = { |
954 | "*_template", "*_timer", "*_sht", "*_ops", | 1006 | "*_template", "*_timer", "*_sht", "*_ops", |
@@ -957,56 +1009,66 @@ static const struct sectioncheck sectioncheck[] = { | |||
957 | }, | 1009 | }, |
958 | { | 1010 | { |
959 | .fromsec = { TEXT_SECTIONS, NULL }, | 1011 | .fromsec = { TEXT_SECTIONS, NULL }, |
960 | .tosec = { ALL_EXIT_SECTIONS, NULL }, | 1012 | .bad_tosec = { ALL_EXIT_SECTIONS, NULL }, |
961 | .mismatch = TEXT_TO_ANY_EXIT, | 1013 | .mismatch = TEXT_TO_ANY_EXIT, |
962 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 1014 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
963 | }, | 1015 | }, |
964 | { | 1016 | { |
965 | .fromsec = { DATA_SECTIONS, NULL }, | 1017 | .fromsec = { DATA_SECTIONS, NULL }, |
966 | .tosec = { ALL_EXIT_SECTIONS, NULL }, | 1018 | .bad_tosec = { ALL_EXIT_SECTIONS, NULL }, |
967 | .mismatch = DATA_TO_ANY_EXIT, | 1019 | .mismatch = DATA_TO_ANY_EXIT, |
968 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 1020 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
969 | }, | 1021 | }, |
970 | /* Do not reference init code/data from meminit code/data */ | 1022 | /* Do not reference init code/data from meminit code/data */ |
971 | { | 1023 | { |
972 | .fromsec = { ALL_XXXINIT_SECTIONS, NULL }, | 1024 | .fromsec = { ALL_XXXINIT_SECTIONS, NULL }, |
973 | .tosec = { INIT_SECTIONS, NULL }, | 1025 | .bad_tosec = { INIT_SECTIONS, NULL }, |
974 | .mismatch = XXXINIT_TO_SOME_INIT, | 1026 | .mismatch = XXXINIT_TO_SOME_INIT, |
975 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 1027 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
976 | }, | 1028 | }, |
977 | /* Do not reference exit code/data from memexit code/data */ | 1029 | /* Do not reference exit code/data from memexit code/data */ |
978 | { | 1030 | { |
979 | .fromsec = { ALL_XXXEXIT_SECTIONS, NULL }, | 1031 | .fromsec = { ALL_XXXEXIT_SECTIONS, NULL }, |
980 | .tosec = { EXIT_SECTIONS, NULL }, | 1032 | .bad_tosec = { EXIT_SECTIONS, NULL }, |
981 | .mismatch = XXXEXIT_TO_SOME_EXIT, | 1033 | .mismatch = XXXEXIT_TO_SOME_EXIT, |
982 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 1034 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
983 | }, | 1035 | }, |
984 | /* Do not use exit code/data from init code */ | 1036 | /* Do not use exit code/data from init code */ |
985 | { | 1037 | { |
986 | .fromsec = { ALL_INIT_SECTIONS, NULL }, | 1038 | .fromsec = { ALL_INIT_SECTIONS, NULL }, |
987 | .tosec = { ALL_EXIT_SECTIONS, NULL }, | 1039 | .bad_tosec = { ALL_EXIT_SECTIONS, NULL }, |
988 | .mismatch = ANY_INIT_TO_ANY_EXIT, | 1040 | .mismatch = ANY_INIT_TO_ANY_EXIT, |
989 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 1041 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
990 | }, | 1042 | }, |
991 | /* Do not use init code/data from exit code */ | 1043 | /* Do not use init code/data from exit code */ |
992 | { | 1044 | { |
993 | .fromsec = { ALL_EXIT_SECTIONS, NULL }, | 1045 | .fromsec = { ALL_EXIT_SECTIONS, NULL }, |
994 | .tosec = { ALL_INIT_SECTIONS, NULL }, | 1046 | .bad_tosec = { ALL_INIT_SECTIONS, NULL }, |
995 | .mismatch = ANY_EXIT_TO_ANY_INIT, | 1047 | .mismatch = ANY_EXIT_TO_ANY_INIT, |
996 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 1048 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
997 | }, | 1049 | }, |
998 | { | 1050 | { |
999 | .fromsec = { ALL_PCI_INIT_SECTIONS, NULL }, | 1051 | .fromsec = { ALL_PCI_INIT_SECTIONS, NULL }, |
1000 | .tosec = { INIT_SECTIONS, NULL }, | 1052 | .bad_tosec = { INIT_SECTIONS, NULL }, |
1001 | .mismatch = ANY_INIT_TO_ANY_EXIT, | 1053 | .mismatch = ANY_INIT_TO_ANY_EXIT, |
1002 | .symbol_white_list = { NULL }, | 1054 | .symbol_white_list = { NULL }, |
1003 | }, | 1055 | }, |
1004 | /* Do not export init/exit functions or data */ | 1056 | /* Do not export init/exit functions or data */ |
1005 | { | 1057 | { |
1006 | .fromsec = { "__ksymtab*", NULL }, | 1058 | .fromsec = { "__ksymtab*", NULL }, |
1007 | .tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL }, | 1059 | .bad_tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL }, |
1008 | .mismatch = EXPORT_TO_INIT_EXIT, | 1060 | .mismatch = EXPORT_TO_INIT_EXIT, |
1009 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 1061 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
1062 | }, | ||
1063 | { | ||
1064 | .fromsec = { "__ex_table", NULL }, | ||
1065 | /* If you're adding any new black-listed sections in here, consider | ||
1066 | * adding a special 'printer' for them in scripts/check_extable. | ||
1067 | */ | ||
1068 | .bad_tosec = { ".altinstr_replacement", NULL }, | ||
1069 | .good_tosec = {ALL_TEXT_SECTIONS , NULL}, | ||
1070 | .mismatch = EXTABLE_TO_NON_TEXT, | ||
1071 | .handler = extable_mismatch_handler, | ||
1010 | } | 1072 | } |
1011 | }; | 1073 | }; |
1012 | 1074 | ||
@@ -1017,10 +1079,22 @@ static const struct sectioncheck *section_mismatch( | |||
1017 | int elems = sizeof(sectioncheck) / sizeof(struct sectioncheck); | 1079 | int elems = sizeof(sectioncheck) / sizeof(struct sectioncheck); |
1018 | const struct sectioncheck *check = §ioncheck[0]; | 1080 | const struct sectioncheck *check = §ioncheck[0]; |
1019 | 1081 | ||
1082 | /* | ||
1083 | * The target section could be the SHT_NUL section when we're | ||
1084 | * handling relocations to un-resolved symbols, trying to match it | ||
1085 | * doesn't make much sense and causes build failures on parisc and | ||
1086 | * mn10300 architectures. | ||
1087 | */ | ||
1088 | if (*tosec == '\0') | ||
1089 | return NULL; | ||
1090 | |||
1020 | for (i = 0; i < elems; i++) { | 1091 | for (i = 0; i < elems; i++) { |
1021 | if (match(fromsec, check->fromsec) && | 1092 | if (match(fromsec, check->fromsec)) { |
1022 | match(tosec, check->tosec)) | 1093 | if (check->bad_tosec[0] && match(tosec, check->bad_tosec)) |
1023 | return check; | 1094 | return check; |
1095 | if (check->good_tosec[0] && !match(tosec, check->good_tosec)) | ||
1096 | return check; | ||
1097 | } | ||
1024 | check++; | 1098 | check++; |
1025 | } | 1099 | } |
1026 | return NULL; | 1100 | return NULL; |
@@ -1067,6 +1141,17 @@ static const struct sectioncheck *section_mismatch( | |||
1067 | * This pattern is identified by | 1141 | * This pattern is identified by |
1068 | * refsymname = __init_begin, _sinittext, _einittext | 1142 | * refsymname = __init_begin, _sinittext, _einittext |
1069 | * | 1143 | * |
1144 | * Pattern 5: | ||
1145 | * GCC may optimize static inlines when fed constant arg(s) resulting | ||
1146 | * in functions like cpumask_empty() -- generating an associated symbol | ||
1147 | * cpumask_empty.constprop.3 that appears in the audit. If the const that | ||
1148 | * is passed in comes from __init, like say nmi_ipi_mask, we get a | ||
1149 | * meaningless section warning. May need to add isra symbols too... | ||
1150 | * This pattern is identified by | ||
1151 | * tosec = init section | ||
1152 | * fromsec = text section | ||
1153 | * refsymname = *.constprop.* | ||
1154 | * | ||
1070 | **/ | 1155 | **/ |
1071 | static int secref_whitelist(const struct sectioncheck *mismatch, | 1156 | static int secref_whitelist(const struct sectioncheck *mismatch, |
1072 | const char *fromsec, const char *fromsym, | 1157 | const char *fromsec, const char *fromsym, |
@@ -1099,6 +1184,12 @@ static int secref_whitelist(const struct sectioncheck *mismatch, | |||
1099 | if (match(tosym, linker_symbols)) | 1184 | if (match(tosym, linker_symbols)) |
1100 | return 0; | 1185 | return 0; |
1101 | 1186 | ||
1187 | /* Check for pattern 5 */ | ||
1188 | if (match(fromsec, text_sections) && | ||
1189 | match(tosec, init_sections) && | ||
1190 | match(fromsym, optim_symbols)) | ||
1191 | return 0; | ||
1192 | |||
1102 | return 1; | 1193 | return 1; |
1103 | } | 1194 | } |
1104 | 1195 | ||
@@ -1261,6 +1352,15 @@ static void print_section_list(const char * const list[20]) | |||
1261 | fprintf(stderr, "\n"); | 1352 | fprintf(stderr, "\n"); |
1262 | } | 1353 | } |
1263 | 1354 | ||
1355 | static inline void get_pretty_name(int is_func, const char** name, const char** name_p) | ||
1356 | { | ||
1357 | switch (is_func) { | ||
1358 | case 0: *name = "variable"; *name_p = ""; break; | ||
1359 | case 1: *name = "function"; *name_p = "()"; break; | ||
1360 | default: *name = "(unknown reference)"; *name_p = ""; break; | ||
1361 | } | ||
1362 | } | ||
1363 | |||
1264 | /* | 1364 | /* |
1265 | * Print a warning about a section mismatch. | 1365 | * Print a warning about a section mismatch. |
1266 | * Try to find symbols near it so user can find it. | 1366 | * Try to find symbols near it so user can find it. |
@@ -1280,21 +1380,13 @@ static void report_sec_mismatch(const char *modname, | |||
1280 | char *prl_from; | 1380 | char *prl_from; |
1281 | char *prl_to; | 1381 | char *prl_to; |
1282 | 1382 | ||
1283 | switch (from_is_func) { | ||
1284 | case 0: from = "variable"; from_p = ""; break; | ||
1285 | case 1: from = "function"; from_p = "()"; break; | ||
1286 | default: from = "(unknown reference)"; from_p = ""; break; | ||
1287 | } | ||
1288 | switch (to_is_func) { | ||
1289 | case 0: to = "variable"; to_p = ""; break; | ||
1290 | case 1: to = "function"; to_p = "()"; break; | ||
1291 | default: to = "(unknown reference)"; to_p = ""; break; | ||
1292 | } | ||
1293 | |||
1294 | sec_mismatch_count++; | 1383 | sec_mismatch_count++; |
1295 | if (!sec_mismatch_verbose) | 1384 | if (!sec_mismatch_verbose) |
1296 | return; | 1385 | return; |
1297 | 1386 | ||
1387 | get_pretty_name(from_is_func, &from, &from_p); | ||
1388 | get_pretty_name(to_is_func, &to, &to_p); | ||
1389 | |||
1298 | warn("%s(%s+0x%llx): Section mismatch in reference from the %s %s%s " | 1390 | warn("%s(%s+0x%llx): Section mismatch in reference from the %s %s%s " |
1299 | "to the %s %s:%s%s\n", | 1391 | "to the %s %s:%s%s\n", |
1300 | modname, fromsec, fromaddr, from, fromsym, from_p, to, tosec, | 1392 | modname, fromsec, fromaddr, from, fromsym, from_p, to, tosec, |
@@ -1408,41 +1500,179 @@ static void report_sec_mismatch(const char *modname, | |||
1408 | tosym, prl_to, prl_to, tosym); | 1500 | tosym, prl_to, prl_to, tosym); |
1409 | free(prl_to); | 1501 | free(prl_to); |
1410 | break; | 1502 | break; |
1503 | case EXTABLE_TO_NON_TEXT: | ||
1504 | fatal("There's a special handler for this mismatch type, " | ||
1505 | "we should never get here."); | ||
1506 | break; | ||
1411 | } | 1507 | } |
1412 | fprintf(stderr, "\n"); | 1508 | fprintf(stderr, "\n"); |
1413 | } | 1509 | } |
1414 | 1510 | ||
1415 | static void check_section_mismatch(const char *modname, struct elf_info *elf, | 1511 | static void default_mismatch_handler(const char *modname, struct elf_info *elf, |
1416 | Elf_Rela *r, Elf_Sym *sym, const char *fromsec) | 1512 | const struct sectioncheck* const mismatch, |
1513 | Elf_Rela *r, Elf_Sym *sym, const char *fromsec) | ||
1417 | { | 1514 | { |
1418 | const char *tosec; | 1515 | const char *tosec; |
1419 | const struct sectioncheck *mismatch; | 1516 | Elf_Sym *to; |
1517 | Elf_Sym *from; | ||
1518 | const char *tosym; | ||
1519 | const char *fromsym; | ||
1520 | |||
1521 | from = find_elf_symbol2(elf, r->r_offset, fromsec); | ||
1522 | fromsym = sym_name(elf, from); | ||
1523 | |||
1524 | if (!strncmp(fromsym, "reference___initcall", | ||
1525 | sizeof("reference___initcall")-1)) | ||
1526 | return; | ||
1420 | 1527 | ||
1421 | tosec = sec_name(elf, get_secindex(elf, sym)); | 1528 | tosec = sec_name(elf, get_secindex(elf, sym)); |
1422 | mismatch = section_mismatch(fromsec, tosec); | 1529 | to = find_elf_symbol(elf, r->r_addend, sym); |
1530 | tosym = sym_name(elf, to); | ||
1531 | |||
1532 | /* check whitelist - we may ignore it */ | ||
1533 | if (secref_whitelist(mismatch, | ||
1534 | fromsec, fromsym, tosec, tosym)) { | ||
1535 | report_sec_mismatch(modname, mismatch, | ||
1536 | fromsec, r->r_offset, fromsym, | ||
1537 | is_function(from), tosec, tosym, | ||
1538 | is_function(to)); | ||
1539 | } | ||
1540 | } | ||
1541 | |||
1542 | static int is_executable_section(struct elf_info* elf, unsigned int section_index) | ||
1543 | { | ||
1544 | if (section_index > elf->num_sections) | ||
1545 | fatal("section_index is outside elf->num_sections!\n"); | ||
1546 | |||
1547 | return ((elf->sechdrs[section_index].sh_flags & SHF_EXECINSTR) == SHF_EXECINSTR); | ||
1548 | } | ||
1549 | |||
1550 | /* | ||
1551 | * We rely on a gross hack in section_rel[a]() calling find_extable_entry_size() | ||
1552 | * to know the sizeof(struct exception_table_entry) for the target architecture. | ||
1553 | */ | ||
1554 | static unsigned int extable_entry_size = 0; | ||
1555 | static void find_extable_entry_size(const char* const sec, const Elf_Rela* r) | ||
1556 | { | ||
1557 | /* | ||
1558 | * If we're currently checking the second relocation within __ex_table, | ||
1559 | * that relocation offset tells us the offsetof(struct | ||
1560 | * exception_table_entry, fixup) which is equal to sizeof(struct | ||
1561 | * exception_table_entry) divided by two. We use that to our advantage | ||
1562 | * since there's no portable way to get that size as every architecture | ||
1563 | * seems to go with different sized types. Not pretty but better than | ||
1564 | * hard-coding the size for every architecture.. | ||
1565 | */ | ||
1566 | if (!extable_entry_size) | ||
1567 | extable_entry_size = r->r_offset * 2; | ||
1568 | } | ||
1569 | |||
1570 | static inline bool is_extable_fault_address(Elf_Rela *r) | ||
1571 | { | ||
1572 | /* | ||
1573 | * extable_entry_size is only discovered after we've handled the | ||
1574 | * _second_ relocation in __ex_table, so only abort when we're not | ||
1575 | * handling the first reloc and extable_entry_size is zero. | ||
1576 | */ | ||
1577 | if (r->r_offset && extable_entry_size == 0) | ||
1578 | fatal("extable_entry size hasn't been discovered!\n"); | ||
1579 | |||
1580 | return ((r->r_offset == 0) || | ||
1581 | (r->r_offset % extable_entry_size == 0)); | ||
1582 | } | ||
1583 | |||
1584 | #define is_second_extable_reloc(Start, Cur, Sec) \ | ||
1585 | (((Cur) == (Start) + 1) && (strcmp("__ex_table", (Sec)) == 0)) | ||
1586 | |||
1587 | static void report_extable_warnings(const char* modname, struct elf_info* elf, | ||
1588 | const struct sectioncheck* const mismatch, | ||
1589 | Elf_Rela* r, Elf_Sym* sym, | ||
1590 | const char* fromsec, const char* tosec) | ||
1591 | { | ||
1592 | Elf_Sym* fromsym = find_elf_symbol2(elf, r->r_offset, fromsec); | ||
1593 | const char* fromsym_name = sym_name(elf, fromsym); | ||
1594 | Elf_Sym* tosym = find_elf_symbol(elf, r->r_addend, sym); | ||
1595 | const char* tosym_name = sym_name(elf, tosym); | ||
1596 | const char* from_pretty_name; | ||
1597 | const char* from_pretty_name_p; | ||
1598 | const char* to_pretty_name; | ||
1599 | const char* to_pretty_name_p; | ||
1600 | |||
1601 | get_pretty_name(is_function(fromsym), | ||
1602 | &from_pretty_name, &from_pretty_name_p); | ||
1603 | get_pretty_name(is_function(tosym), | ||
1604 | &to_pretty_name, &to_pretty_name_p); | ||
1605 | |||
1606 | warn("%s(%s+0x%lx): Section mismatch in reference" | ||
1607 | " from the %s %s%s to the %s %s:%s%s\n", | ||
1608 | modname, fromsec, (long)r->r_offset, from_pretty_name, | ||
1609 | fromsym_name, from_pretty_name_p, | ||
1610 | to_pretty_name, tosec, tosym_name, to_pretty_name_p); | ||
1611 | |||
1612 | if (!match(tosec, mismatch->bad_tosec) && | ||
1613 | is_executable_section(elf, get_secindex(elf, sym))) | ||
1614 | fprintf(stderr, | ||
1615 | "The relocation at %s+0x%lx references\n" | ||
1616 | "section \"%s\" which is not in the list of\n" | ||
1617 | "authorized sections. If you're adding a new section\n" | ||
1618 | "and/or if this reference is valid, add \"%s\" to the\n" | ||
1619 | "list of authorized sections to jump to on fault.\n" | ||
1620 | "This can be achieved by adding \"%s\" to \n" | ||
1621 | "OTHER_TEXT_SECTIONS in scripts/mod/modpost.c.\n", | ||
1622 | fromsec, (long)r->r_offset, tosec, tosec, tosec); | ||
1623 | } | ||
1624 | |||
1625 | static void extable_mismatch_handler(const char* modname, struct elf_info *elf, | ||
1626 | const struct sectioncheck* const mismatch, | ||
1627 | Elf_Rela* r, Elf_Sym* sym, | ||
1628 | const char *fromsec) | ||
1629 | { | ||
1630 | const char* tosec = sec_name(elf, get_secindex(elf, sym)); | ||
1631 | |||
1632 | sec_mismatch_count++; | ||
1633 | |||
1634 | if (sec_mismatch_verbose) | ||
1635 | report_extable_warnings(modname, elf, mismatch, r, sym, | ||
1636 | fromsec, tosec); | ||
1637 | |||
1638 | if (match(tosec, mismatch->bad_tosec)) | ||
1639 | fatal("The relocation at %s+0x%lx references\n" | ||
1640 | "section \"%s\" which is black-listed.\n" | ||
1641 | "Something is seriously wrong and should be fixed.\n" | ||
1642 | "You might get more information about where this is\n" | ||
1643 | "coming from by using scripts/check_extable.sh %s\n", | ||
1644 | fromsec, (long)r->r_offset, tosec, modname); | ||
1645 | else if (!is_executable_section(elf, get_secindex(elf, sym))) { | ||
1646 | if (is_extable_fault_address(r)) | ||
1647 | fatal("The relocation at %s+0x%lx references\n" | ||
1648 | "section \"%s\" which is not executable, IOW\n" | ||
1649 | "it is not possible for the kernel to fault\n" | ||
1650 | "at that address. Something is seriously wrong\n" | ||
1651 | "and should be fixed.\n", | ||
1652 | fromsec, (long)r->r_offset, tosec); | ||
1653 | else | ||
1654 | fatal("The relocation at %s+0x%lx references\n" | ||
1655 | "section \"%s\" which is not executable, IOW\n" | ||
1656 | "the kernel will fault if it ever tries to\n" | ||
1657 | "jump to it. Something is seriously wrong\n" | ||
1658 | "and should be fixed.\n", | ||
1659 | fromsec, (long)r->r_offset, tosec); | ||
1660 | } | ||
1661 | } | ||
1662 | |||
1663 | static void check_section_mismatch(const char *modname, struct elf_info *elf, | ||
1664 | Elf_Rela *r, Elf_Sym *sym, const char *fromsec) | ||
1665 | { | ||
1666 | const char *tosec = sec_name(elf, get_secindex(elf, sym));; | ||
1667 | const struct sectioncheck *mismatch = section_mismatch(fromsec, tosec); | ||
1668 | |||
1423 | if (mismatch) { | 1669 | if (mismatch) { |
1424 | Elf_Sym *to; | 1670 | if (mismatch->handler) |
1425 | Elf_Sym *from; | 1671 | mismatch->handler(modname, elf, mismatch, |
1426 | const char *tosym; | 1672 | r, sym, fromsec); |
1427 | const char *fromsym; | 1673 | else |
1428 | 1674 | default_mismatch_handler(modname, elf, mismatch, | |
1429 | from = find_elf_symbol2(elf, r->r_offset, fromsec); | 1675 | r, sym, fromsec); |
1430 | fromsym = sym_name(elf, from); | ||
1431 | to = find_elf_symbol(elf, r->r_addend, sym); | ||
1432 | tosym = sym_name(elf, to); | ||
1433 | |||
1434 | if (!strncmp(fromsym, "reference___initcall", | ||
1435 | sizeof("reference___initcall")-1)) | ||
1436 | return; | ||
1437 | |||
1438 | /* check whitelist - we may ignore it */ | ||
1439 | if (secref_whitelist(mismatch, | ||
1440 | fromsec, fromsym, tosec, tosym)) { | ||
1441 | report_sec_mismatch(modname, mismatch, | ||
1442 | fromsec, r->r_offset, fromsym, | ||
1443 | is_function(from), tosec, tosym, | ||
1444 | is_function(to)); | ||
1445 | } | ||
1446 | } | 1676 | } |
1447 | } | 1677 | } |
1448 | 1678 | ||
@@ -1582,6 +1812,8 @@ static void section_rela(const char *modname, struct elf_info *elf, | |||
1582 | /* Skip special sections */ | 1812 | /* Skip special sections */ |
1583 | if (is_shndx_special(sym->st_shndx)) | 1813 | if (is_shndx_special(sym->st_shndx)) |
1584 | continue; | 1814 | continue; |
1815 | if (is_second_extable_reloc(start, rela, fromsec)) | ||
1816 | find_extable_entry_size(fromsec, &r); | ||
1585 | check_section_mismatch(modname, elf, &r, sym, fromsec); | 1817 | check_section_mismatch(modname, elf, &r, sym, fromsec); |
1586 | } | 1818 | } |
1587 | } | 1819 | } |
@@ -1640,6 +1872,8 @@ static void section_rel(const char *modname, struct elf_info *elf, | |||
1640 | /* Skip special sections */ | 1872 | /* Skip special sections */ |
1641 | if (is_shndx_special(sym->st_shndx)) | 1873 | if (is_shndx_special(sym->st_shndx)) |
1642 | continue; | 1874 | continue; |
1875 | if (is_second_extable_reloc(start, rel, fromsec)) | ||
1876 | find_extable_entry_size(fromsec, &r); | ||
1643 | check_section_mismatch(modname, elf, &r, sym, fromsec); | 1877 | check_section_mismatch(modname, elf, &r, sym, fromsec); |
1644 | } | 1878 | } |
1645 | } | 1879 | } |
diff --git a/scripts/sortextable.c b/scripts/sortextable.c index 1052d4834a44..c2423d913b46 100644 --- a/scripts/sortextable.c +++ b/scripts/sortextable.c | |||
@@ -47,6 +47,10 @@ | |||
47 | #define EM_MICROBLAZE 189 | 47 | #define EM_MICROBLAZE 189 |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #ifndef EM_ARCV2 | ||
51 | #define EM_ARCV2 195 | ||
52 | #endif | ||
53 | |||
50 | static int fd_map; /* File descriptor for file being modified. */ | 54 | static int fd_map; /* File descriptor for file being modified. */ |
51 | static int mmap_failed; /* Boolean flag. */ | 55 | static int mmap_failed; /* Boolean flag. */ |
52 | static void *ehdr_curr; /* current ElfXX_Ehdr * for resource cleanup */ | 56 | static void *ehdr_curr; /* current ElfXX_Ehdr * for resource cleanup */ |
@@ -281,6 +285,7 @@ do_file(char const *const fname) | |||
281 | custom_sort = sort_relative_table; | 285 | custom_sort = sort_relative_table; |
282 | break; | 286 | break; |
283 | case EM_ARCOMPACT: | 287 | case EM_ARCOMPACT: |
288 | case EM_ARCV2: | ||
284 | case EM_ARM: | 289 | case EM_ARM: |
285 | case EM_AARCH64: | 290 | case EM_AARCH64: |
286 | case EM_MICROBLAZE: | 291 | case EM_MICROBLAZE: |
diff --git a/scripts/spelling.txt b/scripts/spelling.txt index fc7fd52b5e03..bb8e4d0a1911 100644 --- a/scripts/spelling.txt +++ b/scripts/spelling.txt | |||
@@ -825,6 +825,7 @@ retreived||retrieved | |||
825 | retreive||retrieve | 825 | retreive||retrieve |
826 | retrive||retrieve | 826 | retrive||retrieve |
827 | retuned||returned | 827 | retuned||returned |
828 | reudce||reduce | ||
828 | reuest||request | 829 | reuest||request |
829 | reuqest||request | 830 | reuqest||request |
830 | reutnred||returned | 831 | reutnred||returned |
diff --git a/scripts/tags.sh b/scripts/tags.sh index cdb491d84503..c0a932dff329 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
@@ -154,7 +154,7 @@ exuberant() | |||
154 | { | 154 | { |
155 | all_target_sources | xargs $1 -a \ | 155 | all_target_sources | xargs $1 -a \ |
156 | -I __initdata,__exitdata,__initconst, \ | 156 | -I __initdata,__exitdata,__initconst, \ |
157 | -I __cpuinitdata,__initdata_memblock \ | 157 | -I __initdata_memblock \ |
158 | -I __refdata,__attribute,__maybe_unused,__always_unused \ | 158 | -I __refdata,__attribute,__maybe_unused,__always_unused \ |
159 | -I __acquires,__releases,__deprecated \ | 159 | -I __acquires,__releases,__deprecated \ |
160 | -I __read_mostly,__aligned,____cacheline_aligned \ | 160 | -I __read_mostly,__aligned,____cacheline_aligned \ |
diff --git a/scripts/xen-hypercalls.sh b/scripts/xen-hypercalls.sh new file mode 100644 index 000000000000..676d9226814f --- /dev/null +++ b/scripts/xen-hypercalls.sh | |||
@@ -0,0 +1,12 @@ | |||
1 | #!/bin/sh | ||
2 | out="$1" | ||
3 | shift | ||
4 | in="$@" | ||
5 | |||
6 | for i in $in; do | ||
7 | eval $CPP $LINUXINCLUDE -dD -imacros "$i" -x c /dev/null | ||
8 | done | \ | ||
9 | awk '$1 == "#define" && $2 ~ /__HYPERVISOR_[a-z][a-z_0-9]*/ { v[$3] = $2 } | ||
10 | END { print "/* auto-generated by scripts/xen-hypercall.sh */" | ||
11 | for (i in v) if (!(v[i] in v)) | ||
12 | print "HYPERCALL("substr(v[i], 14)")"}' | sort -u >$out | ||