diff options
Diffstat (limited to 'scripts')
26 files changed, 628 insertions, 5035 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 5589bae34af6..dcc934319f92 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
| @@ -217,7 +217,7 @@ $(filter %.tab.c,$(targets)): $(obj)/%.tab.c: $(src)/%.y FORCE | |||
| 217 | $(call if_changed,bison) | 217 | $(call if_changed,bison) |
| 218 | 218 | ||
| 219 | quiet_cmd_bison_h = YACC $@ | 219 | quiet_cmd_bison_h = YACC $@ |
| 220 | cmd_bison_h = bison -o/dev/null --defines=$@ -t -l -p $(YACC_PREFIX) $< | 220 | cmd_bison_h = bison -o/dev/null --defines=$@ -t -l $< |
| 221 | 221 | ||
| 222 | ifdef REGENERATE_PARSERS | 222 | ifdef REGENERATE_PARSERS |
| 223 | .PRECIOUS: $(src)/%.tab.h_shipped | 223 | .PRECIOUS: $(src)/%.tab.h_shipped |
| @@ -276,10 +276,9 @@ DTC ?= $(objtree)/scripts/dtc/dtc | |||
| 276 | # Disable noisy checks by default | 276 | # Disable noisy checks by default |
| 277 | ifeq ($(findstring 1,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) | 277 | ifeq ($(findstring 1,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) |
| 278 | DTC_FLAGS += -Wno-unit_address_vs_reg \ | 278 | DTC_FLAGS += -Wno-unit_address_vs_reg \ |
| 279 | -Wno-simple_bus_reg \ | ||
| 280 | -Wno-unit_address_format \ | 279 | -Wno-unit_address_format \ |
| 281 | -Wno-pci_bridge \ | 280 | -Wno-avoid_unnecessary_addr_size \ |
| 282 | -Wno-pci_device_bus_num \ | 281 | -Wno-alias_paths \ |
| 283 | -Wno-pci_device_reg | 282 | -Wno-pci_device_reg |
| 284 | endif | 283 | endif |
| 285 | 284 | ||
| @@ -316,7 +315,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ | |||
| 316 | -d $(depfile).dtc.tmp $(dtc-tmp) ; \ | 315 | -d $(depfile).dtc.tmp $(dtc-tmp) ; \ |
| 317 | cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) | 316 | cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) |
| 318 | 317 | ||
| 319 | $(obj)/%.dtb: $(src)/%.dts FORCE | 318 | $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE |
| 320 | $(call if_changed_dep,dtc) | 319 | $(call if_changed_dep,dtc) |
| 321 | 320 | ||
| 322 | dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) | 321 | dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) |
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile index 0dc922bb7aea..a88b8c9bf46d 100644 --- a/scripts/dtc/Makefile +++ b/scripts/dtc/Makefile | |||
| @@ -28,5 +28,7 @@ HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC) | |||
| 28 | # dependencies on generated files need to be listed explicitly | 28 | # dependencies on generated files need to be listed explicitly |
| 29 | $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h | 29 | $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h |
| 30 | 30 | ||
| 31 | # generated files need to be cleaned explicitly | 31 | # generated files need to include *.cmd and be cleaned explicitly |
| 32 | clean-files := dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h | 32 | generated-files := dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h |
| 33 | targets := $(generated-files) | ||
| 34 | clean-files := $(generated-files) | ||
diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c index e66138449886..c07ba4da9e36 100644 --- a/scripts/dtc/checks.c +++ b/scripts/dtc/checks.c | |||
| @@ -53,26 +53,28 @@ struct check { | |||
| 53 | struct check **prereq; | 53 | struct check **prereq; |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | #define CHECK_ENTRY(_nm, _fn, _d, _w, _e, ...) \ | 56 | #define CHECK_ENTRY(nm_, fn_, d_, w_, e_, ...) \ |
| 57 | static struct check *_nm##_prereqs[] = { __VA_ARGS__ }; \ | 57 | static struct check *nm_##_prereqs[] = { __VA_ARGS__ }; \ |
| 58 | static struct check _nm = { \ | 58 | static struct check nm_ = { \ |
| 59 | .name = #_nm, \ | 59 | .name = #nm_, \ |
| 60 | .fn = (_fn), \ | 60 | .fn = (fn_), \ |
| 61 | .data = (_d), \ | 61 | .data = (d_), \ |
| 62 | .warn = (_w), \ | 62 | .warn = (w_), \ |
| 63 | .error = (_e), \ | 63 | .error = (e_), \ |
| 64 | .status = UNCHECKED, \ | 64 | .status = UNCHECKED, \ |
| 65 | .num_prereqs = ARRAY_SIZE(_nm##_prereqs), \ | 65 | .num_prereqs = ARRAY_SIZE(nm_##_prereqs), \ |
| 66 | .prereq = _nm##_prereqs, \ | 66 | .prereq = nm_##_prereqs, \ |
| 67 | }; | 67 | }; |
| 68 | #define WARNING(_nm, _fn, _d, ...) \ | 68 | #define WARNING(nm_, fn_, d_, ...) \ |
| 69 | CHECK_ENTRY(_nm, _fn, _d, true, false, __VA_ARGS__) | 69 | CHECK_ENTRY(nm_, fn_, d_, true, false, __VA_ARGS__) |
| 70 | #define ERROR(_nm, _fn, _d, ...) \ | 70 | #define ERROR(nm_, fn_, d_, ...) \ |
| 71 | CHECK_ENTRY(_nm, _fn, _d, false, true, __VA_ARGS__) | 71 | CHECK_ENTRY(nm_, fn_, d_, false, true, __VA_ARGS__) |
| 72 | #define CHECK(_nm, _fn, _d, ...) \ | 72 | #define CHECK(nm_, fn_, d_, ...) \ |
| 73 | CHECK_ENTRY(_nm, _fn, _d, false, false, __VA_ARGS__) | 73 | CHECK_ENTRY(nm_, fn_, d_, false, false, __VA_ARGS__) |
| 74 | 74 | ||
| 75 | static inline void PRINTF(3, 4) check_msg(struct check *c, struct dt_info *dti, | 75 | static inline void PRINTF(5, 6) check_msg(struct check *c, struct dt_info *dti, |
| 76 | struct node *node, | ||
| 77 | struct property *prop, | ||
| 76 | const char *fmt, ...) | 78 | const char *fmt, ...) |
| 77 | { | 79 | { |
| 78 | va_list ap; | 80 | va_list ap; |
| @@ -83,19 +85,33 @@ static inline void PRINTF(3, 4) check_msg(struct check *c, struct dt_info *dti, | |||
| 83 | fprintf(stderr, "%s: %s (%s): ", | 85 | fprintf(stderr, "%s: %s (%s): ", |
| 84 | strcmp(dti->outname, "-") ? dti->outname : "<stdout>", | 86 | strcmp(dti->outname, "-") ? dti->outname : "<stdout>", |
| 85 | (c->error) ? "ERROR" : "Warning", c->name); | 87 | (c->error) ? "ERROR" : "Warning", c->name); |
| 88 | if (node) { | ||
| 89 | fprintf(stderr, "%s", node->fullpath); | ||
| 90 | if (prop) | ||
| 91 | fprintf(stderr, ":%s", prop->name); | ||
| 92 | fputs(": ", stderr); | ||
| 93 | } | ||
| 86 | vfprintf(stderr, fmt, ap); | 94 | vfprintf(stderr, fmt, ap); |
| 87 | fprintf(stderr, "\n"); | 95 | fprintf(stderr, "\n"); |
| 88 | } | 96 | } |
| 89 | va_end(ap); | 97 | va_end(ap); |
| 90 | } | 98 | } |
| 91 | 99 | ||
| 92 | #define FAIL(c, dti, ...) \ | 100 | #define FAIL(c, dti, node, ...) \ |
| 101 | do { \ | ||
| 102 | TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__); \ | ||
| 103 | (c)->status = FAILED; \ | ||
| 104 | check_msg((c), dti, node, NULL, __VA_ARGS__); \ | ||
| 105 | } while (0) | ||
| 106 | |||
| 107 | #define FAIL_PROP(c, dti, node, prop, ...) \ | ||
| 93 | do { \ | 108 | do { \ |
| 94 | TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__); \ | 109 | TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__); \ |
| 95 | (c)->status = FAILED; \ | 110 | (c)->status = FAILED; \ |
| 96 | check_msg((c), dti, __VA_ARGS__); \ | 111 | check_msg((c), dti, node, prop, __VA_ARGS__); \ |
| 97 | } while (0) | 112 | } while (0) |
| 98 | 113 | ||
| 114 | |||
| 99 | static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node) | 115 | static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node) |
| 100 | { | 116 | { |
| 101 | struct node *child; | 117 | struct node *child; |
| @@ -126,7 +142,7 @@ static bool run_check(struct check *c, struct dt_info *dti) | |||
| 126 | error = error || run_check(prq, dti); | 142 | error = error || run_check(prq, dti); |
| 127 | if (prq->status != PASSED) { | 143 | if (prq->status != PASSED) { |
| 128 | c->status = PREREQ; | 144 | c->status = PREREQ; |
| 129 | check_msg(c, dti, "Failed prerequisite '%s'", | 145 | check_msg(c, dti, NULL, NULL, "Failed prerequisite '%s'", |
| 130 | c->prereq[i]->name); | 146 | c->prereq[i]->name); |
| 131 | } | 147 | } |
| 132 | } | 148 | } |
| @@ -156,7 +172,7 @@ out: | |||
| 156 | static inline void check_always_fail(struct check *c, struct dt_info *dti, | 172 | static inline void check_always_fail(struct check *c, struct dt_info *dti, |
| 157 | struct node *node) | 173 | struct node *node) |
| 158 | { | 174 | { |
| 159 | FAIL(c, dti, "always_fail check"); | 175 | FAIL(c, dti, node, "always_fail check"); |
| 160 | } | 176 | } |
| 161 | CHECK(always_fail, check_always_fail, NULL); | 177 | CHECK(always_fail, check_always_fail, NULL); |
| 162 | 178 | ||
| @@ -171,14 +187,42 @@ static void check_is_string(struct check *c, struct dt_info *dti, | |||
| 171 | return; /* Not present, assumed ok */ | 187 | return; /* Not present, assumed ok */ |
| 172 | 188 | ||
| 173 | if (!data_is_one_string(prop->val)) | 189 | if (!data_is_one_string(prop->val)) |
| 174 | FAIL(c, dti, "\"%s\" property in %s is not a string", | 190 | FAIL_PROP(c, dti, node, prop, "property is not a string"); |
| 175 | propname, node->fullpath); | ||
| 176 | } | 191 | } |
| 177 | #define WARNING_IF_NOT_STRING(nm, propname) \ | 192 | #define WARNING_IF_NOT_STRING(nm, propname) \ |
| 178 | WARNING(nm, check_is_string, (propname)) | 193 | WARNING(nm, check_is_string, (propname)) |
| 179 | #define ERROR_IF_NOT_STRING(nm, propname) \ | 194 | #define ERROR_IF_NOT_STRING(nm, propname) \ |
| 180 | ERROR(nm, check_is_string, (propname)) | 195 | ERROR(nm, check_is_string, (propname)) |
| 181 | 196 | ||
| 197 | static void check_is_string_list(struct check *c, struct dt_info *dti, | ||
| 198 | struct node *node) | ||
| 199 | { | ||
| 200 | int rem, l; | ||
| 201 | struct property *prop; | ||
| 202 | char *propname = c->data; | ||
| 203 | char *str; | ||
| 204 | |||
| 205 | prop = get_property(node, propname); | ||
| 206 | if (!prop) | ||
| 207 | return; /* Not present, assumed ok */ | ||
| 208 | |||
| 209 | str = prop->val.val; | ||
| 210 | rem = prop->val.len; | ||
| 211 | while (rem > 0) { | ||
| 212 | l = strnlen(str, rem); | ||
| 213 | if (l == rem) { | ||
| 214 | FAIL_PROP(c, dti, node, prop, "property is not a string list"); | ||
| 215 | break; | ||
| 216 | } | ||
| 217 | rem -= l + 1; | ||
| 218 | str += l + 1; | ||
| 219 | } | ||
| 220 | } | ||
| 221 | #define WARNING_IF_NOT_STRING_LIST(nm, propname) \ | ||
| 222 | WARNING(nm, check_is_string_list, (propname)) | ||
| 223 | #define ERROR_IF_NOT_STRING_LIST(nm, propname) \ | ||
| 224 | ERROR(nm, check_is_string_list, (propname)) | ||
| 225 | |||
| 182 | static void check_is_cell(struct check *c, struct dt_info *dti, | 226 | static void check_is_cell(struct check *c, struct dt_info *dti, |
| 183 | struct node *node) | 227 | struct node *node) |
| 184 | { | 228 | { |
| @@ -190,8 +234,7 @@ static void check_is_cell(struct check *c, struct dt_info *dti, | |||
| 190 | return; /* Not present, assumed ok */ | 234 | return; /* Not present, assumed ok */ |
| 191 | 235 | ||
| 192 | if (prop->val.len != sizeof(cell_t)) | 236 | if (prop->val.len != sizeof(cell_t)) |
| 193 | FAIL(c, dti, "\"%s\" property in %s is not a single cell", | 237 | FAIL_PROP(c, dti, node, prop, "property is not a single cell"); |
| 194 | propname, node->fullpath); | ||
| 195 | } | 238 | } |
| 196 | #define WARNING_IF_NOT_CELL(nm, propname) \ | 239 | #define WARNING_IF_NOT_CELL(nm, propname) \ |
| 197 | WARNING(nm, check_is_cell, (propname)) | 240 | WARNING(nm, check_is_cell, (propname)) |
| @@ -212,8 +255,7 @@ static void check_duplicate_node_names(struct check *c, struct dt_info *dti, | |||
| 212 | child2; | 255 | child2; |
| 213 | child2 = child2->next_sibling) | 256 | child2 = child2->next_sibling) |
| 214 | if (streq(child->name, child2->name)) | 257 | if (streq(child->name, child2->name)) |
| 215 | FAIL(c, dti, "Duplicate node name %s", | 258 | FAIL(c, dti, node, "Duplicate node name"); |
| 216 | child->fullpath); | ||
| 217 | } | 259 | } |
| 218 | ERROR(duplicate_node_names, check_duplicate_node_names, NULL); | 260 | ERROR(duplicate_node_names, check_duplicate_node_names, NULL); |
| 219 | 261 | ||
| @@ -227,8 +269,7 @@ static void check_duplicate_property_names(struct check *c, struct dt_info *dti, | |||
| 227 | if (prop2->deleted) | 269 | if (prop2->deleted) |
| 228 | continue; | 270 | continue; |
| 229 | if (streq(prop->name, prop2->name)) | 271 | if (streq(prop->name, prop2->name)) |
| 230 | FAIL(c, dti, "Duplicate property name %s in %s", | 272 | FAIL_PROP(c, dti, node, prop, "Duplicate property name"); |
| 231 | prop->name, node->fullpath); | ||
| 232 | } | 273 | } |
| 233 | } | 274 | } |
| 234 | } | 275 | } |
| @@ -246,8 +287,8 @@ static void check_node_name_chars(struct check *c, struct dt_info *dti, | |||
| 246 | int n = strspn(node->name, c->data); | 287 | int n = strspn(node->name, c->data); |
| 247 | 288 | ||
| 248 | if (n < strlen(node->name)) | 289 | if (n < strlen(node->name)) |
| 249 | FAIL(c, dti, "Bad character '%c' in node %s", | 290 | FAIL(c, dti, node, "Bad character '%c' in node name", |
| 250 | node->name[n], node->fullpath); | 291 | node->name[n]); |
| 251 | } | 292 | } |
| 252 | ERROR(node_name_chars, check_node_name_chars, PROPNODECHARS "@"); | 293 | ERROR(node_name_chars, check_node_name_chars, PROPNODECHARS "@"); |
| 253 | 294 | ||
| @@ -257,8 +298,8 @@ static void check_node_name_chars_strict(struct check *c, struct dt_info *dti, | |||
| 257 | int n = strspn(node->name, c->data); | 298 | int n = strspn(node->name, c->data); |
| 258 | 299 | ||
| 259 | if (n < node->basenamelen) | 300 | if (n < node->basenamelen) |
| 260 | FAIL(c, dti, "Character '%c' not recommended in node %s", | 301 | FAIL(c, dti, node, "Character '%c' not recommended in node name", |
| 261 | node->name[n], node->fullpath); | 302 | node->name[n]); |
| 262 | } | 303 | } |
| 263 | CHECK(node_name_chars_strict, check_node_name_chars_strict, PROPNODECHARSSTRICT); | 304 | CHECK(node_name_chars_strict, check_node_name_chars_strict, PROPNODECHARSSTRICT); |
| 264 | 305 | ||
| @@ -266,8 +307,7 @@ static void check_node_name_format(struct check *c, struct dt_info *dti, | |||
| 266 | struct node *node) | 307 | struct node *node) |
| 267 | { | 308 | { |
| 268 | if (strchr(get_unitname(node), '@')) | 309 | if (strchr(get_unitname(node), '@')) |
| 269 | FAIL(c, dti, "Node %s has multiple '@' characters in name", | 310 | FAIL(c, dti, node, "multiple '@' characters in node name"); |
| 270 | node->fullpath); | ||
| 271 | } | 311 | } |
| 272 | ERROR(node_name_format, check_node_name_format, NULL, &node_name_chars); | 312 | ERROR(node_name_format, check_node_name_format, NULL, &node_name_chars); |
| 273 | 313 | ||
| @@ -285,12 +325,10 @@ static void check_unit_address_vs_reg(struct check *c, struct dt_info *dti, | |||
| 285 | 325 | ||
| 286 | if (prop) { | 326 | if (prop) { |
| 287 | if (!unitname[0]) | 327 | if (!unitname[0]) |
| 288 | FAIL(c, dti, "Node %s has a reg or ranges property, but no unit name", | 328 | FAIL(c, dti, node, "node has a reg or ranges property, but no unit name"); |
| 289 | node->fullpath); | ||
| 290 | } else { | 329 | } else { |
| 291 | if (unitname[0]) | 330 | if (unitname[0]) |
| 292 | FAIL(c, dti, "Node %s has a unit name, but no reg property", | 331 | FAIL(c, dti, node, "node has a unit name, but no reg property"); |
| 293 | node->fullpath); | ||
| 294 | } | 332 | } |
| 295 | } | 333 | } |
| 296 | WARNING(unit_address_vs_reg, check_unit_address_vs_reg, NULL); | 334 | WARNING(unit_address_vs_reg, check_unit_address_vs_reg, NULL); |
| @@ -304,8 +342,8 @@ static void check_property_name_chars(struct check *c, struct dt_info *dti, | |||
| 304 | int n = strspn(prop->name, c->data); | 342 | int n = strspn(prop->name, c->data); |
| 305 | 343 | ||
| 306 | if (n < strlen(prop->name)) | 344 | if (n < strlen(prop->name)) |
| 307 | FAIL(c, dti, "Bad character '%c' in property name \"%s\", node %s", | 345 | FAIL_PROP(c, dti, node, prop, "Bad character '%c' in property name", |
| 308 | prop->name[n], prop->name, node->fullpath); | 346 | prop->name[n]); |
| 309 | } | 347 | } |
| 310 | } | 348 | } |
| 311 | ERROR(property_name_chars, check_property_name_chars, PROPNODECHARS); | 349 | ERROR(property_name_chars, check_property_name_chars, PROPNODECHARS); |
| @@ -336,8 +374,8 @@ static void check_property_name_chars_strict(struct check *c, | |||
| 336 | n = strspn(name, c->data); | 374 | n = strspn(name, c->data); |
| 337 | } | 375 | } |
| 338 | if (n < strlen(name)) | 376 | if (n < strlen(name)) |
| 339 | FAIL(c, dti, "Character '%c' not recommended in property name \"%s\", node %s", | 377 | FAIL_PROP(c, dti, node, prop, "Character '%c' not recommended in property name", |
| 340 | name[n], prop->name, node->fullpath); | 378 | name[n]); |
| 341 | } | 379 | } |
| 342 | } | 380 | } |
| 343 | CHECK(property_name_chars_strict, check_property_name_chars_strict, PROPNODECHARSSTRICT); | 381 | CHECK(property_name_chars_strict, check_property_name_chars_strict, PROPNODECHARSSTRICT); |
| @@ -370,7 +408,7 @@ static void check_duplicate_label(struct check *c, struct dt_info *dti, | |||
| 370 | return; | 408 | return; |
| 371 | 409 | ||
| 372 | if ((othernode != node) || (otherprop != prop) || (othermark != mark)) | 410 | if ((othernode != node) || (otherprop != prop) || (othermark != mark)) |
| 373 | FAIL(c, dti, "Duplicate label '%s' on " DESCLABEL_FMT | 411 | FAIL(c, dti, node, "Duplicate label '%s' on " DESCLABEL_FMT |
| 374 | " and " DESCLABEL_FMT, | 412 | " and " DESCLABEL_FMT, |
| 375 | label, DESCLABEL_ARGS(node, prop, mark), | 413 | label, DESCLABEL_ARGS(node, prop, mark), |
| 376 | DESCLABEL_ARGS(othernode, otherprop, othermark)); | 414 | DESCLABEL_ARGS(othernode, otherprop, othermark)); |
| @@ -410,8 +448,8 @@ static cell_t check_phandle_prop(struct check *c, struct dt_info *dti, | |||
| 410 | return 0; | 448 | return 0; |
| 411 | 449 | ||
| 412 | if (prop->val.len != sizeof(cell_t)) { | 450 | if (prop->val.len != sizeof(cell_t)) { |
| 413 | FAIL(c, dti, "%s has bad length (%d) %s property", | 451 | FAIL_PROP(c, dti, node, prop, "bad length (%d) %s property", |
| 414 | node->fullpath, prop->val.len, prop->name); | 452 | prop->val.len, prop->name); |
| 415 | return 0; | 453 | return 0; |
| 416 | } | 454 | } |
| 417 | 455 | ||
| @@ -422,8 +460,8 @@ static cell_t check_phandle_prop(struct check *c, struct dt_info *dti, | |||
| 422 | /* "Set this node's phandle equal to some | 460 | /* "Set this node's phandle equal to some |
| 423 | * other node's phandle". That's nonsensical | 461 | * other node's phandle". That's nonsensical |
| 424 | * by construction. */ { | 462 | * by construction. */ { |
| 425 | FAIL(c, dti, "%s in %s is a reference to another node", | 463 | FAIL(c, dti, node, "%s is a reference to another node", |
| 426 | prop->name, node->fullpath); | 464 | prop->name); |
| 427 | } | 465 | } |
| 428 | /* But setting this node's phandle equal to its own | 466 | /* But setting this node's phandle equal to its own |
| 429 | * phandle is allowed - that means allocate a unique | 467 | * phandle is allowed - that means allocate a unique |
| @@ -436,8 +474,8 @@ static cell_t check_phandle_prop(struct check *c, struct dt_info *dti, | |||
| 436 | phandle = propval_cell(prop); | 474 | phandle = propval_cell(prop); |
| 437 | 475 | ||
| 438 | if ((phandle == 0) || (phandle == -1)) { | 476 | if ((phandle == 0) || (phandle == -1)) { |
| 439 | FAIL(c, dti, "%s has bad value (0x%x) in %s property", | 477 | FAIL_PROP(c, dti, node, prop, "bad value (0x%x) in %s property", |
| 440 | node->fullpath, phandle, prop->name); | 478 | phandle, prop->name); |
| 441 | return 0; | 479 | return 0; |
| 442 | } | 480 | } |
| 443 | 481 | ||
| @@ -463,16 +501,16 @@ static void check_explicit_phandles(struct check *c, struct dt_info *dti, | |||
| 463 | return; | 501 | return; |
| 464 | 502 | ||
| 465 | if (linux_phandle && phandle && (phandle != linux_phandle)) | 503 | if (linux_phandle && phandle && (phandle != linux_phandle)) |
| 466 | FAIL(c, dti, "%s has mismatching 'phandle' and 'linux,phandle'" | 504 | FAIL(c, dti, node, "mismatching 'phandle' and 'linux,phandle'" |
| 467 | " properties", node->fullpath); | 505 | " properties"); |
| 468 | 506 | ||
| 469 | if (linux_phandle && !phandle) | 507 | if (linux_phandle && !phandle) |
| 470 | phandle = linux_phandle; | 508 | phandle = linux_phandle; |
| 471 | 509 | ||
| 472 | other = get_node_by_phandle(root, phandle); | 510 | other = get_node_by_phandle(root, phandle); |
| 473 | if (other && (other != node)) { | 511 | if (other && (other != node)) { |
| 474 | FAIL(c, dti, "%s has duplicated phandle 0x%x (seen before at %s)", | 512 | FAIL(c, dti, node, "duplicated phandle 0x%x (seen before at %s)", |
| 475 | node->fullpath, phandle, other->fullpath); | 513 | phandle, other->fullpath); |
| 476 | return; | 514 | return; |
| 477 | } | 515 | } |
| 478 | 516 | ||
| @@ -496,8 +534,8 @@ static void check_name_properties(struct check *c, struct dt_info *dti, | |||
| 496 | 534 | ||
| 497 | if ((prop->val.len != node->basenamelen+1) | 535 | if ((prop->val.len != node->basenamelen+1) |
| 498 | || (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) { | 536 | || (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) { |
| 499 | FAIL(c, dti, "\"name\" property in %s is incorrect (\"%s\" instead" | 537 | FAIL(c, dti, node, "\"name\" property is incorrect (\"%s\" instead" |
| 500 | " of base node name)", node->fullpath, prop->val.val); | 538 | " of base node name)", prop->val.val); |
| 501 | } else { | 539 | } else { |
| 502 | /* The name property is correct, and therefore redundant. | 540 | /* The name property is correct, and therefore redundant. |
| 503 | * Delete it */ | 541 | * Delete it */ |
| @@ -531,7 +569,7 @@ static void fixup_phandle_references(struct check *c, struct dt_info *dti, | |||
| 531 | refnode = get_node_by_ref(dt, m->ref); | 569 | refnode = get_node_by_ref(dt, m->ref); |
| 532 | if (! refnode) { | 570 | if (! refnode) { |
| 533 | if (!(dti->dtsflags & DTSF_PLUGIN)) | 571 | if (!(dti->dtsflags & DTSF_PLUGIN)) |
| 534 | FAIL(c, dti, "Reference to non-existent node or " | 572 | FAIL(c, dti, node, "Reference to non-existent node or " |
| 535 | "label \"%s\"\n", m->ref); | 573 | "label \"%s\"\n", m->ref); |
| 536 | else /* mark the entry as unresolved */ | 574 | else /* mark the entry as unresolved */ |
| 537 | *((fdt32_t *)(prop->val.val + m->offset)) = | 575 | *((fdt32_t *)(prop->val.val + m->offset)) = |
| @@ -563,7 +601,7 @@ static void fixup_path_references(struct check *c, struct dt_info *dti, | |||
| 563 | 601 | ||
| 564 | refnode = get_node_by_ref(dt, m->ref); | 602 | refnode = get_node_by_ref(dt, m->ref); |
| 565 | if (!refnode) { | 603 | if (!refnode) { |
| 566 | FAIL(c, dti, "Reference to non-existent node or label \"%s\"\n", | 604 | FAIL(c, dti, node, "Reference to non-existent node or label \"%s\"\n", |
| 567 | m->ref); | 605 | m->ref); |
| 568 | continue; | 606 | continue; |
| 569 | } | 607 | } |
| @@ -586,6 +624,45 @@ WARNING_IF_NOT_CELL(interrupt_cells_is_cell, "#interrupt-cells"); | |||
| 586 | WARNING_IF_NOT_STRING(device_type_is_string, "device_type"); | 624 | WARNING_IF_NOT_STRING(device_type_is_string, "device_type"); |
| 587 | WARNING_IF_NOT_STRING(model_is_string, "model"); | 625 | WARNING_IF_NOT_STRING(model_is_string, "model"); |
| 588 | WARNING_IF_NOT_STRING(status_is_string, "status"); | 626 | WARNING_IF_NOT_STRING(status_is_string, "status"); |
| 627 | WARNING_IF_NOT_STRING(label_is_string, "label"); | ||
| 628 | |||
| 629 | WARNING_IF_NOT_STRING_LIST(compatible_is_string_list, "compatible"); | ||
| 630 | |||
| 631 | static void check_names_is_string_list(struct check *c, struct dt_info *dti, | ||
| 632 | struct node *node) | ||
| 633 | { | ||
| 634 | struct property *prop; | ||
| 635 | |||
| 636 | for_each_property(node, prop) { | ||
| 637 | const char *s = strrchr(prop->name, '-'); | ||
| 638 | if (!s || !streq(s, "-names")) | ||
| 639 | continue; | ||
| 640 | |||
| 641 | c->data = prop->name; | ||
| 642 | check_is_string_list(c, dti, node); | ||
| 643 | } | ||
| 644 | } | ||
| 645 | WARNING(names_is_string_list, check_names_is_string_list, NULL); | ||
| 646 | |||
| 647 | static void check_alias_paths(struct check *c, struct dt_info *dti, | ||
| 648 | struct node *node) | ||
| 649 | { | ||
| 650 | struct property *prop; | ||
| 651 | |||
| 652 | if (!streq(node->name, "aliases")) | ||
| 653 | return; | ||
| 654 | |||
| 655 | for_each_property(node, prop) { | ||
| 656 | if (!prop->val.val || !get_node_by_path(dti->dt, prop->val.val)) { | ||
| 657 | FAIL_PROP(c, dti, node, prop, "aliases property is not a valid node (%s)", | ||
| 658 | prop->val.val); | ||
| 659 | continue; | ||
| 660 | } | ||
| 661 | if (strspn(prop->name, LOWERCASE DIGITS "-") != strlen(prop->name)) | ||
| 662 | FAIL(c, dti, node, "aliases property name must include only lowercase and '-'"); | ||
| 663 | } | ||
| 664 | } | ||
| 665 | WARNING(alias_paths, check_alias_paths, NULL); | ||
| 589 | 666 | ||
| 590 | static void fixup_addr_size_cells(struct check *c, struct dt_info *dti, | 667 | static void fixup_addr_size_cells(struct check *c, struct dt_info *dti, |
| 591 | struct node *node) | 668 | struct node *node) |
| @@ -622,21 +699,21 @@ static void check_reg_format(struct check *c, struct dt_info *dti, | |||
| 622 | return; /* No "reg", that's fine */ | 699 | return; /* No "reg", that's fine */ |
| 623 | 700 | ||
| 624 | if (!node->parent) { | 701 | if (!node->parent) { |
| 625 | FAIL(c, dti, "Root node has a \"reg\" property"); | 702 | FAIL(c, dti, node, "Root node has a \"reg\" property"); |
| 626 | return; | 703 | return; |
| 627 | } | 704 | } |
| 628 | 705 | ||
| 629 | if (prop->val.len == 0) | 706 | if (prop->val.len == 0) |
| 630 | FAIL(c, dti, "\"reg\" property in %s is empty", node->fullpath); | 707 | FAIL_PROP(c, dti, node, prop, "property is empty"); |
| 631 | 708 | ||
| 632 | addr_cells = node_addr_cells(node->parent); | 709 | addr_cells = node_addr_cells(node->parent); |
| 633 | size_cells = node_size_cells(node->parent); | 710 | size_cells = node_size_cells(node->parent); |
| 634 | entrylen = (addr_cells + size_cells) * sizeof(cell_t); | 711 | entrylen = (addr_cells + size_cells) * sizeof(cell_t); |
| 635 | 712 | ||
| 636 | if (!entrylen || (prop->val.len % entrylen) != 0) | 713 | if (!entrylen || (prop->val.len % entrylen) != 0) |
| 637 | FAIL(c, dti, "\"reg\" property in %s has invalid length (%d bytes) " | 714 | FAIL_PROP(c, dti, node, prop, "property has invalid length (%d bytes) " |
| 638 | "(#address-cells == %d, #size-cells == %d)", | 715 | "(#address-cells == %d, #size-cells == %d)", |
| 639 | node->fullpath, prop->val.len, addr_cells, size_cells); | 716 | prop->val.len, addr_cells, size_cells); |
| 640 | } | 717 | } |
| 641 | WARNING(reg_format, check_reg_format, NULL, &addr_size_cells); | 718 | WARNING(reg_format, check_reg_format, NULL, &addr_size_cells); |
| 642 | 719 | ||
| @@ -651,7 +728,7 @@ static void check_ranges_format(struct check *c, struct dt_info *dti, | |||
| 651 | return; | 728 | return; |
| 652 | 729 | ||
| 653 | if (!node->parent) { | 730 | if (!node->parent) { |
| 654 | FAIL(c, dti, "Root node has a \"ranges\" property"); | 731 | FAIL_PROP(c, dti, node, prop, "Root node has a \"ranges\" property"); |
| 655 | return; | 732 | return; |
| 656 | } | 733 | } |
| 657 | 734 | ||
| @@ -663,20 +740,20 @@ static void check_ranges_format(struct check *c, struct dt_info *dti, | |||
| 663 | 740 | ||
| 664 | if (prop->val.len == 0) { | 741 | if (prop->val.len == 0) { |
| 665 | if (p_addr_cells != c_addr_cells) | 742 | if (p_addr_cells != c_addr_cells) |
| 666 | FAIL(c, dti, "%s has empty \"ranges\" property but its " | 743 | FAIL_PROP(c, dti, node, prop, "empty \"ranges\" property but its " |
| 667 | "#address-cells (%d) differs from %s (%d)", | 744 | "#address-cells (%d) differs from %s (%d)", |
| 668 | node->fullpath, c_addr_cells, node->parent->fullpath, | 745 | c_addr_cells, node->parent->fullpath, |
| 669 | p_addr_cells); | 746 | p_addr_cells); |
| 670 | if (p_size_cells != c_size_cells) | 747 | if (p_size_cells != c_size_cells) |
| 671 | FAIL(c, dti, "%s has empty \"ranges\" property but its " | 748 | FAIL_PROP(c, dti, node, prop, "empty \"ranges\" property but its " |
| 672 | "#size-cells (%d) differs from %s (%d)", | 749 | "#size-cells (%d) differs from %s (%d)", |
| 673 | node->fullpath, c_size_cells, node->parent->fullpath, | 750 | c_size_cells, node->parent->fullpath, |
| 674 | p_size_cells); | 751 | p_size_cells); |
| 675 | } else if ((prop->val.len % entrylen) != 0) { | 752 | } else if ((prop->val.len % entrylen) != 0) { |
| 676 | FAIL(c, dti, "\"ranges\" property in %s has invalid length (%d bytes) " | 753 | FAIL_PROP(c, dti, node, prop, "\"ranges\" property has invalid length (%d bytes) " |
| 677 | "(parent #address-cells == %d, child #address-cells == %d, " | 754 | "(parent #address-cells == %d, child #address-cells == %d, " |
| 678 | "#size-cells == %d)", node->fullpath, prop->val.len, | 755 | "#size-cells == %d)", prop->val.len, |
| 679 | p_addr_cells, c_addr_cells, c_size_cells); | 756 | p_addr_cells, c_addr_cells, c_size_cells); |
| 680 | } | 757 | } |
| 681 | } | 758 | } |
| 682 | WARNING(ranges_format, check_ranges_format, NULL, &addr_size_cells); | 759 | WARNING(ranges_format, check_ranges_format, NULL, &addr_size_cells); |
| @@ -696,41 +773,33 @@ static void check_pci_bridge(struct check *c, struct dt_info *dti, struct node * | |||
| 696 | 773 | ||
| 697 | node->bus = &pci_bus; | 774 | node->bus = &pci_bus; |
| 698 | 775 | ||
| 699 | if (!strneq(node->name, "pci", node->basenamelen) && | 776 | if (!strprefixeq(node->name, node->basenamelen, "pci") && |
| 700 | !strneq(node->name, "pcie", node->basenamelen)) | 777 | !strprefixeq(node->name, node->basenamelen, "pcie")) |
| 701 | FAIL(c, dti, "Node %s node name is not \"pci\" or \"pcie\"", | 778 | FAIL(c, dti, node, "node name is not \"pci\" or \"pcie\""); |
| 702 | node->fullpath); | ||
| 703 | 779 | ||
| 704 | prop = get_property(node, "ranges"); | 780 | prop = get_property(node, "ranges"); |
| 705 | if (!prop) | 781 | if (!prop) |
| 706 | FAIL(c, dti, "Node %s missing ranges for PCI bridge (or not a bridge)", | 782 | FAIL(c, dti, node, "missing ranges for PCI bridge (or not a bridge)"); |
| 707 | node->fullpath); | ||
| 708 | 783 | ||
| 709 | if (node_addr_cells(node) != 3) | 784 | if (node_addr_cells(node) != 3) |
| 710 | FAIL(c, dti, "Node %s incorrect #address-cells for PCI bridge", | 785 | FAIL(c, dti, node, "incorrect #address-cells for PCI bridge"); |
| 711 | node->fullpath); | ||
| 712 | if (node_size_cells(node) != 2) | 786 | if (node_size_cells(node) != 2) |
| 713 | FAIL(c, dti, "Node %s incorrect #size-cells for PCI bridge", | 787 | FAIL(c, dti, node, "incorrect #size-cells for PCI bridge"); |
| 714 | node->fullpath); | ||
| 715 | 788 | ||
| 716 | prop = get_property(node, "bus-range"); | 789 | prop = get_property(node, "bus-range"); |
| 717 | if (!prop) { | 790 | if (!prop) { |
| 718 | FAIL(c, dti, "Node %s missing bus-range for PCI bridge", | 791 | FAIL(c, dti, node, "missing bus-range for PCI bridge"); |
| 719 | node->fullpath); | ||
| 720 | return; | 792 | return; |
| 721 | } | 793 | } |
| 722 | if (prop->val.len != (sizeof(cell_t) * 2)) { | 794 | if (prop->val.len != (sizeof(cell_t) * 2)) { |
| 723 | FAIL(c, dti, "Node %s bus-range must be 2 cells", | 795 | FAIL_PROP(c, dti, node, prop, "value must be 2 cells"); |
| 724 | node->fullpath); | ||
| 725 | return; | 796 | return; |
| 726 | } | 797 | } |
| 727 | cells = (cell_t *)prop->val.val; | 798 | cells = (cell_t *)prop->val.val; |
| 728 | if (fdt32_to_cpu(cells[0]) > fdt32_to_cpu(cells[1])) | 799 | if (fdt32_to_cpu(cells[0]) > fdt32_to_cpu(cells[1])) |
| 729 | FAIL(c, dti, "Node %s bus-range 1st cell must be less than or equal to 2nd cell", | 800 | FAIL_PROP(c, dti, node, prop, "1st cell must be less than or equal to 2nd cell"); |
| 730 | node->fullpath); | ||
| 731 | if (fdt32_to_cpu(cells[1]) > 0xff) | 801 | if (fdt32_to_cpu(cells[1]) > 0xff) |
| 732 | FAIL(c, dti, "Node %s bus-range maximum bus number must be less than 256", | 802 | FAIL_PROP(c, dti, node, prop, "maximum bus number must be less than 256"); |
| 733 | node->fullpath); | ||
| 734 | } | 803 | } |
| 735 | WARNING(pci_bridge, check_pci_bridge, NULL, | 804 | WARNING(pci_bridge, check_pci_bridge, NULL, |
| 736 | &device_type_is_string, &addr_size_cells); | 805 | &device_type_is_string, &addr_size_cells); |
| @@ -760,8 +829,8 @@ static void check_pci_device_bus_num(struct check *c, struct dt_info *dti, struc | |||
| 760 | max_bus = fdt32_to_cpu(cells[0]); | 829 | max_bus = fdt32_to_cpu(cells[0]); |
| 761 | } | 830 | } |
| 762 | if ((bus_num < min_bus) || (bus_num > max_bus)) | 831 | if ((bus_num < min_bus) || (bus_num > max_bus)) |
| 763 | FAIL(c, dti, "Node %s PCI bus number %d out of range, expected (%d - %d)", | 832 | FAIL_PROP(c, dti, node, prop, "PCI bus number %d out of range, expected (%d - %d)", |
| 764 | node->fullpath, bus_num, min_bus, max_bus); | 833 | bus_num, min_bus, max_bus); |
| 765 | } | 834 | } |
| 766 | WARNING(pci_device_bus_num, check_pci_device_bus_num, NULL, ®_format, &pci_bridge); | 835 | WARNING(pci_device_bus_num, check_pci_device_bus_num, NULL, ®_format, &pci_bridge); |
| 767 | 836 | ||
| @@ -778,25 +847,22 @@ static void check_pci_device_reg(struct check *c, struct dt_info *dti, struct no | |||
| 778 | 847 | ||
| 779 | prop = get_property(node, "reg"); | 848 | prop = get_property(node, "reg"); |
| 780 | if (!prop) { | 849 | if (!prop) { |
| 781 | FAIL(c, dti, "Node %s missing PCI reg property", node->fullpath); | 850 | FAIL(c, dti, node, "missing PCI reg property"); |
| 782 | return; | 851 | return; |
| 783 | } | 852 | } |
| 784 | 853 | ||
| 785 | cells = (cell_t *)prop->val.val; | 854 | cells = (cell_t *)prop->val.val; |
| 786 | if (cells[1] || cells[2]) | 855 | if (cells[1] || cells[2]) |
| 787 | FAIL(c, dti, "Node %s PCI reg config space address cells 2 and 3 must be 0", | 856 | FAIL_PROP(c, dti, node, prop, "PCI reg config space address cells 2 and 3 must be 0"); |
| 788 | node->fullpath); | ||
| 789 | 857 | ||
| 790 | reg = fdt32_to_cpu(cells[0]); | 858 | reg = fdt32_to_cpu(cells[0]); |
| 791 | dev = (reg & 0xf800) >> 11; | 859 | dev = (reg & 0xf800) >> 11; |
| 792 | func = (reg & 0x700) >> 8; | 860 | func = (reg & 0x700) >> 8; |
| 793 | 861 | ||
| 794 | if (reg & 0xff000000) | 862 | if (reg & 0xff000000) |
| 795 | FAIL(c, dti, "Node %s PCI reg address is not configuration space", | 863 | FAIL_PROP(c, dti, node, prop, "PCI reg address is not configuration space"); |
| 796 | node->fullpath); | ||
| 797 | if (reg & 0x000000ff) | 864 | if (reg & 0x000000ff) |
| 798 | FAIL(c, dti, "Node %s PCI reg config space address register number must be 0", | 865 | FAIL_PROP(c, dti, node, prop, "PCI reg config space address register number must be 0"); |
| 799 | node->fullpath); | ||
| 800 | 866 | ||
| 801 | if (func == 0) { | 867 | if (func == 0) { |
| 802 | snprintf(unit_addr, sizeof(unit_addr), "%x", dev); | 868 | snprintf(unit_addr, sizeof(unit_addr), "%x", dev); |
| @@ -808,8 +874,8 @@ static void check_pci_device_reg(struct check *c, struct dt_info *dti, struct no | |||
| 808 | if (streq(unitname, unit_addr)) | 874 | if (streq(unitname, unit_addr)) |
| 809 | return; | 875 | return; |
| 810 | 876 | ||
| 811 | FAIL(c, dti, "Node %s PCI unit address format error, expected \"%s\"", | 877 | FAIL(c, dti, node, "PCI unit address format error, expected \"%s\"", |
| 812 | node->fullpath, unit_addr); | 878 | unit_addr); |
| 813 | } | 879 | } |
| 814 | WARNING(pci_device_reg, check_pci_device_reg, NULL, ®_format, &pci_bridge); | 880 | WARNING(pci_device_reg, check_pci_device_reg, NULL, ®_format, &pci_bridge); |
| 815 | 881 | ||
| @@ -828,7 +894,7 @@ static bool node_is_compatible(struct node *node, const char *compat) | |||
| 828 | 894 | ||
| 829 | for (str = prop->val.val, end = str + prop->val.len; str < end; | 895 | for (str = prop->val.val, end = str + prop->val.len; str < end; |
| 830 | str += strnlen(str, end - str) + 1) { | 896 | str += strnlen(str, end - str) + 1) { |
| 831 | if (strneq(str, compat, end - str)) | 897 | if (strprefixeq(str, end - str, compat)) |
| 832 | return true; | 898 | return true; |
| 833 | } | 899 | } |
| 834 | return false; | 900 | return false; |
| @@ -865,7 +931,7 @@ static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct no | |||
| 865 | 931 | ||
| 866 | if (!cells) { | 932 | if (!cells) { |
| 867 | if (node->parent->parent && !(node->bus == &simple_bus)) | 933 | if (node->parent->parent && !(node->bus == &simple_bus)) |
| 868 | FAIL(c, dti, "Node %s missing or empty reg/ranges property", node->fullpath); | 934 | FAIL(c, dti, node, "missing or empty reg/ranges property"); |
| 869 | return; | 935 | return; |
| 870 | } | 936 | } |
| 871 | 937 | ||
| @@ -875,8 +941,8 @@ static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct no | |||
| 875 | 941 | ||
| 876 | snprintf(unit_addr, sizeof(unit_addr), "%"PRIx64, reg); | 942 | snprintf(unit_addr, sizeof(unit_addr), "%"PRIx64, reg); |
| 877 | if (!streq(unitname, unit_addr)) | 943 | if (!streq(unitname, unit_addr)) |
| 878 | FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"", | 944 | FAIL(c, dti, node, "simple-bus unit address format error, expected \"%s\"", |
| 879 | node->fullpath, unit_addr); | 945 | unit_addr); |
| 880 | } | 946 | } |
| 881 | WARNING(simple_bus_reg, check_simple_bus_reg, NULL, ®_format, &simple_bus_bridge); | 947 | WARNING(simple_bus_reg, check_simple_bus_reg, NULL, ®_format, &simple_bus_bridge); |
| 882 | 948 | ||
| @@ -892,14 +958,12 @@ static void check_unit_address_format(struct check *c, struct dt_info *dti, | |||
| 892 | return; | 958 | return; |
| 893 | 959 | ||
| 894 | if (!strncmp(unitname, "0x", 2)) { | 960 | if (!strncmp(unitname, "0x", 2)) { |
| 895 | FAIL(c, dti, "Node %s unit name should not have leading \"0x\"", | 961 | FAIL(c, dti, node, "unit name should not have leading \"0x\""); |
| 896 | node->fullpath); | ||
| 897 | /* skip over 0x for next test */ | 962 | /* skip over 0x for next test */ |
| 898 | unitname += 2; | 963 | unitname += 2; |
| 899 | } | 964 | } |
| 900 | if (unitname[0] == '0' && isxdigit(unitname[1])) | 965 | if (unitname[0] == '0' && isxdigit(unitname[1])) |
| 901 | FAIL(c, dti, "Node %s unit name should not have leading 0s", | 966 | FAIL(c, dti, node, "unit name should not have leading 0s"); |
| 902 | node->fullpath); | ||
| 903 | } | 967 | } |
| 904 | WARNING(unit_address_format, check_unit_address_format, NULL, | 968 | WARNING(unit_address_format, check_unit_address_format, NULL, |
| 905 | &node_name_format, &pci_bridge, &simple_bus_bridge); | 969 | &node_name_format, &pci_bridge, &simple_bus_bridge); |
| @@ -922,16 +986,38 @@ static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti, | |||
| 922 | return; | 986 | return; |
| 923 | 987 | ||
| 924 | if (node->parent->addr_cells == -1) | 988 | if (node->parent->addr_cells == -1) |
| 925 | FAIL(c, dti, "Relying on default #address-cells value for %s", | 989 | FAIL(c, dti, node, "Relying on default #address-cells value"); |
| 926 | node->fullpath); | ||
| 927 | 990 | ||
| 928 | if (node->parent->size_cells == -1) | 991 | if (node->parent->size_cells == -1) |
| 929 | FAIL(c, dti, "Relying on default #size-cells value for %s", | 992 | FAIL(c, dti, node, "Relying on default #size-cells value"); |
| 930 | node->fullpath); | ||
| 931 | } | 993 | } |
| 932 | WARNING(avoid_default_addr_size, check_avoid_default_addr_size, NULL, | 994 | WARNING(avoid_default_addr_size, check_avoid_default_addr_size, NULL, |
| 933 | &addr_size_cells); | 995 | &addr_size_cells); |
| 934 | 996 | ||
| 997 | static void check_avoid_unnecessary_addr_size(struct check *c, struct dt_info *dti, | ||
| 998 | struct node *node) | ||
| 999 | { | ||
| 1000 | struct property *prop; | ||
| 1001 | struct node *child; | ||
| 1002 | bool has_reg = false; | ||
| 1003 | |||
| 1004 | if (!node->parent || node->addr_cells < 0 || node->size_cells < 0) | ||
| 1005 | return; | ||
| 1006 | |||
| 1007 | if (get_property(node, "ranges") || !node->children) | ||
| 1008 | return; | ||
| 1009 | |||
| 1010 | for_each_child(node, child) { | ||
| 1011 | prop = get_property(child, "reg"); | ||
| 1012 | if (prop) | ||
| 1013 | has_reg = true; | ||
| 1014 | } | ||
| 1015 | |||
| 1016 | if (!has_reg) | ||
| 1017 | FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\" or child \"reg\" property"); | ||
| 1018 | } | ||
| 1019 | WARNING(avoid_unnecessary_addr_size, check_avoid_unnecessary_addr_size, NULL, &avoid_default_addr_size); | ||
| 1020 | |||
| 935 | static void check_obsolete_chosen_interrupt_controller(struct check *c, | 1021 | static void check_obsolete_chosen_interrupt_controller(struct check *c, |
| 936 | struct dt_info *dti, | 1022 | struct dt_info *dti, |
| 937 | struct node *node) | 1023 | struct node *node) |
| @@ -950,12 +1036,61 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c, | |||
| 950 | 1036 | ||
| 951 | prop = get_property(chosen, "interrupt-controller"); | 1037 | prop = get_property(chosen, "interrupt-controller"); |
| 952 | if (prop) | 1038 | if (prop) |
| 953 | FAIL(c, dti, "/chosen has obsolete \"interrupt-controller\" " | 1039 | FAIL_PROP(c, dti, node, prop, |
| 954 | "property"); | 1040 | "/chosen has obsolete \"interrupt-controller\" property"); |
| 955 | } | 1041 | } |
| 956 | WARNING(obsolete_chosen_interrupt_controller, | 1042 | WARNING(obsolete_chosen_interrupt_controller, |
| 957 | check_obsolete_chosen_interrupt_controller, NULL); | 1043 | check_obsolete_chosen_interrupt_controller, NULL); |
| 958 | 1044 | ||
| 1045 | static void check_chosen_node_is_root(struct check *c, struct dt_info *dti, | ||
| 1046 | struct node *node) | ||
| 1047 | { | ||
| 1048 | if (!streq(node->name, "chosen")) | ||
| 1049 | return; | ||
| 1050 | |||
| 1051 | if (node->parent != dti->dt) | ||
| 1052 | FAIL(c, dti, node, "chosen node must be at root node"); | ||
| 1053 | } | ||
| 1054 | WARNING(chosen_node_is_root, check_chosen_node_is_root, NULL); | ||
| 1055 | |||
| 1056 | static void check_chosen_node_bootargs(struct check *c, struct dt_info *dti, | ||
| 1057 | struct node *node) | ||
| 1058 | { | ||
| 1059 | struct property *prop; | ||
| 1060 | |||
| 1061 | if (!streq(node->name, "chosen")) | ||
| 1062 | return; | ||
| 1063 | |||
| 1064 | prop = get_property(node, "bootargs"); | ||
| 1065 | if (!prop) | ||
| 1066 | return; | ||
| 1067 | |||
| 1068 | c->data = prop->name; | ||
| 1069 | check_is_string(c, dti, node); | ||
| 1070 | } | ||
| 1071 | WARNING(chosen_node_bootargs, check_chosen_node_bootargs, NULL); | ||
| 1072 | |||
| 1073 | static void check_chosen_node_stdout_path(struct check *c, struct dt_info *dti, | ||
| 1074 | struct node *node) | ||
| 1075 | { | ||
| 1076 | struct property *prop; | ||
| 1077 | |||
| 1078 | if (!streq(node->name, "chosen")) | ||
| 1079 | return; | ||
| 1080 | |||
| 1081 | prop = get_property(node, "stdout-path"); | ||
| 1082 | if (!prop) { | ||
| 1083 | prop = get_property(node, "linux,stdout-path"); | ||
| 1084 | if (!prop) | ||
| 1085 | return; | ||
| 1086 | FAIL_PROP(c, dti, node, prop, "Use 'stdout-path' instead"); | ||
| 1087 | } | ||
| 1088 | |||
| 1089 | c->data = prop->name; | ||
| 1090 | check_is_string(c, dti, node); | ||
| 1091 | } | ||
| 1092 | WARNING(chosen_node_stdout_path, check_chosen_node_stdout_path, NULL); | ||
| 1093 | |||
| 959 | struct provider { | 1094 | struct provider { |
| 960 | const char *prop_name; | 1095 | const char *prop_name; |
| 961 | const char *cell_name; | 1096 | const char *cell_name; |
| @@ -972,8 +1107,9 @@ static void check_property_phandle_args(struct check *c, | |||
| 972 | int cell, cellsize = 0; | 1107 | int cell, cellsize = 0; |
| 973 | 1108 | ||
| 974 | if (prop->val.len % sizeof(cell_t)) { | 1109 | if (prop->val.len % sizeof(cell_t)) { |
| 975 | FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %zu in node %s", | 1110 | FAIL_PROP(c, dti, node, prop, |
| 976 | prop->name, prop->val.len, sizeof(cell_t), node->fullpath); | 1111 | "property size (%d) is invalid, expected multiple of %zu", |
| 1112 | prop->val.len, sizeof(cell_t)); | ||
| 977 | return; | 1113 | return; |
| 978 | } | 1114 | } |
| 979 | 1115 | ||
| @@ -1004,14 +1140,16 @@ static void check_property_phandle_args(struct check *c, | |||
| 1004 | break; | 1140 | break; |
| 1005 | } | 1141 | } |
| 1006 | if (!m) | 1142 | if (!m) |
| 1007 | FAIL(c, dti, "Property '%s', cell %d is not a phandle reference in %s", | 1143 | FAIL_PROP(c, dti, node, prop, |
| 1008 | prop->name, cell, node->fullpath); | 1144 | "cell %d is not a phandle reference", |
| 1145 | cell); | ||
| 1009 | } | 1146 | } |
| 1010 | 1147 | ||
| 1011 | provider_node = get_node_by_phandle(root, phandle); | 1148 | provider_node = get_node_by_phandle(root, phandle); |
| 1012 | if (!provider_node) { | 1149 | if (!provider_node) { |
| 1013 | FAIL(c, dti, "Could not get phandle node for %s:%s(cell %d)", | 1150 | FAIL_PROP(c, dti, node, prop, |
| 1014 | node->fullpath, prop->name, cell); | 1151 | "Could not get phandle node for (cell %d)", |
| 1152 | cell); | ||
| 1015 | break; | 1153 | break; |
| 1016 | } | 1154 | } |
| 1017 | 1155 | ||
| @@ -1021,16 +1159,17 @@ static void check_property_phandle_args(struct check *c, | |||
| 1021 | } else if (provider->optional) { | 1159 | } else if (provider->optional) { |
| 1022 | cellsize = 0; | 1160 | cellsize = 0; |
| 1023 | } else { | 1161 | } else { |
| 1024 | FAIL(c, dti, "Missing property '%s' in node %s or bad phandle (referred from %s:%s[%d])", | 1162 | FAIL(c, dti, node, "Missing property '%s' in node %s or bad phandle (referred from %s[%d])", |
| 1025 | provider->cell_name, | 1163 | provider->cell_name, |
| 1026 | provider_node->fullpath, | 1164 | provider_node->fullpath, |
| 1027 | node->fullpath, prop->name, cell); | 1165 | prop->name, cell); |
| 1028 | break; | 1166 | break; |
| 1029 | } | 1167 | } |
| 1030 | 1168 | ||
| 1031 | if (prop->val.len < ((cell + cellsize + 1) * sizeof(cell_t))) { | 1169 | if (prop->val.len < ((cell + cellsize + 1) * sizeof(cell_t))) { |
| 1032 | FAIL(c, dti, "%s property size (%d) too small for cell size %d in %s", | 1170 | FAIL_PROP(c, dti, node, prop, |
| 1033 | prop->name, prop->val.len, cellsize, node->fullpath); | 1171 | "property size (%d) too small for cell size %d", |
| 1172 | prop->val.len, cellsize); | ||
| 1034 | } | 1173 | } |
| 1035 | } | 1174 | } |
| 1036 | } | 1175 | } |
| @@ -1066,7 +1205,7 @@ WARNING_PROPERTY_PHANDLE_CELLS(phys, "phys", "#phy-cells"); | |||
| 1066 | WARNING_PROPERTY_PHANDLE_CELLS(power_domains, "power-domains", "#power-domain-cells"); | 1205 | WARNING_PROPERTY_PHANDLE_CELLS(power_domains, "power-domains", "#power-domain-cells"); |
| 1067 | WARNING_PROPERTY_PHANDLE_CELLS(pwms, "pwms", "#pwm-cells"); | 1206 | WARNING_PROPERTY_PHANDLE_CELLS(pwms, "pwms", "#pwm-cells"); |
| 1068 | WARNING_PROPERTY_PHANDLE_CELLS(resets, "resets", "#reset-cells"); | 1207 | WARNING_PROPERTY_PHANDLE_CELLS(resets, "resets", "#reset-cells"); |
| 1069 | WARNING_PROPERTY_PHANDLE_CELLS(sound_dais, "sound-dais", "#sound-dai-cells"); | 1208 | WARNING_PROPERTY_PHANDLE_CELLS(sound_dai, "sound-dai", "#sound-dai-cells"); |
| 1070 | WARNING_PROPERTY_PHANDLE_CELLS(thermal_sensors, "thermal-sensors", "#thermal-sensor-cells"); | 1209 | WARNING_PROPERTY_PHANDLE_CELLS(thermal_sensors, "thermal-sensors", "#thermal-sensor-cells"); |
| 1071 | 1210 | ||
| 1072 | static bool prop_is_gpio(struct property *prop) | 1211 | static bool prop_is_gpio(struct property *prop) |
| @@ -1132,8 +1271,8 @@ static void check_deprecated_gpio_property(struct check *c, | |||
| 1132 | if (!streq(str, "gpio")) | 1271 | if (!streq(str, "gpio")) |
| 1133 | continue; | 1272 | continue; |
| 1134 | 1273 | ||
| 1135 | FAIL(c, dti, "'[*-]gpio' is deprecated, use '[*-]gpios' instead for %s:%s", | 1274 | FAIL_PROP(c, dti, node, prop, |
| 1136 | node->fullpath, prop->name); | 1275 | "'[*-]gpio' is deprecated, use '[*-]gpios' instead"); |
| 1137 | } | 1276 | } |
| 1138 | 1277 | ||
| 1139 | } | 1278 | } |
| @@ -1167,9 +1306,8 @@ static void check_interrupts_property(struct check *c, | |||
| 1167 | return; | 1306 | return; |
| 1168 | 1307 | ||
| 1169 | if (irq_prop->val.len % sizeof(cell_t)) | 1308 | if (irq_prop->val.len % sizeof(cell_t)) |
| 1170 | FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %zu in node %s", | 1309 | FAIL_PROP(c, dti, node, irq_prop, "size (%d) is invalid, expected multiple of %zu", |
| 1171 | irq_prop->name, irq_prop->val.len, sizeof(cell_t), | 1310 | irq_prop->val.len, sizeof(cell_t)); |
| 1172 | node->fullpath); | ||
| 1173 | 1311 | ||
| 1174 | while (parent && !prop) { | 1312 | while (parent && !prop) { |
| 1175 | if (parent != node && node_is_interrupt_provider(parent)) { | 1313 | if (parent != node && node_is_interrupt_provider(parent)) { |
| @@ -1187,14 +1325,12 @@ static void check_interrupts_property(struct check *c, | |||
| 1187 | 1325 | ||
| 1188 | irq_node = get_node_by_phandle(root, phandle); | 1326 | irq_node = get_node_by_phandle(root, phandle); |
| 1189 | if (!irq_node) { | 1327 | if (!irq_node) { |
| 1190 | FAIL(c, dti, "Bad interrupt-parent phandle for %s", | 1328 | FAIL_PROP(c, dti, parent, prop, "Bad phandle"); |
| 1191 | node->fullpath); | ||
| 1192 | return; | 1329 | return; |
| 1193 | } | 1330 | } |
| 1194 | if (!node_is_interrupt_provider(irq_node)) | 1331 | if (!node_is_interrupt_provider(irq_node)) |
| 1195 | FAIL(c, dti, | 1332 | FAIL(c, dti, irq_node, |
| 1196 | "Missing interrupt-controller or interrupt-map property in %s", | 1333 | "Missing interrupt-controller or interrupt-map property"); |
| 1197 | irq_node->fullpath); | ||
| 1198 | 1334 | ||
| 1199 | break; | 1335 | break; |
| 1200 | } | 1336 | } |
| @@ -1203,23 +1339,21 @@ static void check_interrupts_property(struct check *c, | |||
| 1203 | } | 1339 | } |
| 1204 | 1340 | ||
| 1205 | if (!irq_node) { | 1341 | if (!irq_node) { |
| 1206 | FAIL(c, dti, "Missing interrupt-parent for %s", node->fullpath); | 1342 | FAIL(c, dti, node, "Missing interrupt-parent"); |
| 1207 | return; | 1343 | return; |
| 1208 | } | 1344 | } |
| 1209 | 1345 | ||
| 1210 | prop = get_property(irq_node, "#interrupt-cells"); | 1346 | prop = get_property(irq_node, "#interrupt-cells"); |
| 1211 | if (!prop) { | 1347 | if (!prop) { |
| 1212 | FAIL(c, dti, "Missing #interrupt-cells in interrupt-parent %s", | 1348 | FAIL(c, dti, irq_node, "Missing #interrupt-cells in interrupt-parent"); |
| 1213 | irq_node->fullpath); | ||
| 1214 | return; | 1349 | return; |
| 1215 | } | 1350 | } |
| 1216 | 1351 | ||
| 1217 | irq_cells = propval_cell(prop); | 1352 | irq_cells = propval_cell(prop); |
| 1218 | if (irq_prop->val.len % (irq_cells * sizeof(cell_t))) { | 1353 | if (irq_prop->val.len % (irq_cells * sizeof(cell_t))) { |
| 1219 | FAIL(c, dti, | 1354 | FAIL_PROP(c, dti, node, prop, |
| 1220 | "interrupts size is (%d), expected multiple of %d in %s", | 1355 | "size is (%d), expected multiple of %d", |
| 1221 | irq_prop->val.len, (int)(irq_cells * sizeof(cell_t)), | 1356 | irq_prop->val.len, (int)(irq_cells * sizeof(cell_t))); |
| 1222 | node->fullpath); | ||
| 1223 | } | 1357 | } |
| 1224 | } | 1358 | } |
| 1225 | WARNING(interrupts_property, check_interrupts_property, &phandle_references); | 1359 | WARNING(interrupts_property, check_interrupts_property, &phandle_references); |
| @@ -1236,6 +1370,9 @@ static struct check *check_table[] = { | |||
| 1236 | 1370 | ||
| 1237 | &address_cells_is_cell, &size_cells_is_cell, &interrupt_cells_is_cell, | 1371 | &address_cells_is_cell, &size_cells_is_cell, &interrupt_cells_is_cell, |
| 1238 | &device_type_is_string, &model_is_string, &status_is_string, | 1372 | &device_type_is_string, &model_is_string, &status_is_string, |
| 1373 | &label_is_string, | ||
| 1374 | |||
| 1375 | &compatible_is_string_list, &names_is_string_list, | ||
| 1239 | 1376 | ||
| 1240 | &property_name_chars_strict, | 1377 | &property_name_chars_strict, |
| 1241 | &node_name_chars_strict, | 1378 | &node_name_chars_strict, |
| @@ -1253,7 +1390,9 @@ static struct check *check_table[] = { | |||
| 1253 | &simple_bus_reg, | 1390 | &simple_bus_reg, |
| 1254 | 1391 | ||
| 1255 | &avoid_default_addr_size, | 1392 | &avoid_default_addr_size, |
| 1393 | &avoid_unnecessary_addr_size, | ||
| 1256 | &obsolete_chosen_interrupt_controller, | 1394 | &obsolete_chosen_interrupt_controller, |
| 1395 | &chosen_node_is_root, &chosen_node_bootargs, &chosen_node_stdout_path, | ||
| 1257 | 1396 | ||
| 1258 | &clocks_property, | 1397 | &clocks_property, |
| 1259 | &cooling_device_property, | 1398 | &cooling_device_property, |
| @@ -1269,13 +1408,15 @@ static struct check *check_table[] = { | |||
| 1269 | &power_domains_property, | 1408 | &power_domains_property, |
| 1270 | &pwms_property, | 1409 | &pwms_property, |
| 1271 | &resets_property, | 1410 | &resets_property, |
| 1272 | &sound_dais_property, | 1411 | &sound_dai_property, |
| 1273 | &thermal_sensors_property, | 1412 | &thermal_sensors_property, |
| 1274 | 1413 | ||
| 1275 | &deprecated_gpio_property, | 1414 | &deprecated_gpio_property, |
| 1276 | &gpios_property, | 1415 | &gpios_property, |
| 1277 | &interrupts_property, | 1416 | &interrupts_property, |
| 1278 | 1417 | ||
| 1418 | &alias_paths, | ||
| 1419 | |||
| 1279 | &always_fail, | 1420 | &always_fail, |
| 1280 | }; | 1421 | }; |
| 1281 | 1422 | ||
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped deleted file mode 100644 index 011bb9632ff2..000000000000 --- a/scripts/dtc/dtc-lexer.lex.c_shipped +++ /dev/null | |||
| @@ -1,2259 +0,0 @@ | |||
| 1 | #line 2 "dtc-lexer.lex.c" | ||
| 2 | |||
| 3 | #line 4 "dtc-lexer.lex.c" | ||
| 4 | |||
| 5 | #define YY_INT_ALIGNED short int | ||
| 6 | |||
| 7 | /* A lexical scanner generated by flex */ | ||
| 8 | |||
| 9 | #define FLEX_SCANNER | ||
| 10 | #define YY_FLEX_MAJOR_VERSION 2 | ||
| 11 | #define YY_FLEX_MINOR_VERSION 6 | ||
| 12 | #define YY_FLEX_SUBMINOR_VERSION 1 | ||
| 13 | #if YY_FLEX_SUBMINOR_VERSION > 0 | ||
| 14 | #define FLEX_BETA | ||
| 15 | #endif | ||
| 16 | |||
| 17 | /* First, we deal with platform-specific or compiler-specific issues. */ | ||
| 18 | |||
| 19 | /* begin standard C headers. */ | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <string.h> | ||
| 22 | #include <errno.h> | ||
| 23 | #include <stdlib.h> | ||
| 24 | |||
| 25 | /* end standard C headers. */ | ||
| 26 | |||
| 27 | /* flex integer type definitions */ | ||
| 28 | |||
| 29 | #ifndef FLEXINT_H | ||
| 30 | #define FLEXINT_H | ||
| 31 | |||
| 32 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ | ||
| 33 | |||
| 34 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | ||
| 35 | |||
| 36 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, | ||
| 37 | * if you want the limit (max/min) macros for int types. | ||
| 38 | */ | ||
| 39 | #ifndef __STDC_LIMIT_MACROS | ||
| 40 | #define __STDC_LIMIT_MACROS 1 | ||
| 41 | #endif | ||
| 42 | |||
| 43 | #include <inttypes.h> | ||
| 44 | typedef int8_t flex_int8_t; | ||
| 45 | typedef uint8_t flex_uint8_t; | ||
| 46 | typedef int16_t flex_int16_t; | ||
| 47 | typedef uint16_t flex_uint16_t; | ||
| 48 | typedef int32_t flex_int32_t; | ||
| 49 | typedef uint32_t flex_uint32_t; | ||
| 50 | #else | ||
| 51 | typedef signed char flex_int8_t; | ||
| 52 | typedef short int flex_int16_t; | ||
| 53 | typedef int flex_int32_t; | ||
| 54 | typedef unsigned char flex_uint8_t; | ||
| 55 | typedef unsigned short int flex_uint16_t; | ||
| 56 | typedef unsigned int flex_uint32_t; | ||
| 57 | |||
| 58 | /* Limits of integral types. */ | ||
| 59 | #ifndef INT8_MIN | ||
| 60 | #define INT8_MIN (-128) | ||
| 61 | #endif | ||
| 62 | #ifndef INT16_MIN | ||
| 63 | #define INT16_MIN (-32767-1) | ||
| 64 | #endif | ||
| 65 | #ifndef INT32_MIN | ||
| 66 | #define INT32_MIN (-2147483647-1) | ||
| 67 | #endif | ||
| 68 | #ifndef INT8_MAX | ||
| 69 | #define INT8_MAX (127) | ||
| 70 | #endif | ||
| 71 | #ifndef INT16_MAX | ||
| 72 | #define INT16_MAX (32767) | ||
| 73 | #endif | ||
| 74 | #ifndef INT32_MAX | ||
| 75 | #define INT32_MAX (2147483647) | ||
| 76 | #endif | ||
| 77 | #ifndef UINT8_MAX | ||
| 78 | #define UINT8_MAX (255U) | ||
| 79 | #endif | ||
| 80 | #ifndef UINT16_MAX | ||
| 81 | #define UINT16_MAX (65535U) | ||
| 82 | #endif | ||
| 83 | #ifndef UINT32_MAX | ||
| 84 | #define UINT32_MAX (4294967295U) | ||
| 85 | #endif | ||
| 86 | |||
| 87 | #endif /* ! C99 */ | ||
| 88 | |||
| 89 | #endif /* ! FLEXINT_H */ | ||
| 90 | |||
| 91 | /* TODO: this is always defined, so inline it */ | ||
| 92 | #define yyconst const | ||
| 93 | |||
| 94 | #if defined(__GNUC__) && __GNUC__ >= 3 | ||
| 95 | #define yynoreturn __attribute__((__noreturn__)) | ||
| 96 | #else | ||
| 97 | #define yynoreturn | ||
| 98 | #endif | ||
| 99 | |||
| 100 | /* Returned upon end-of-file. */ | ||
| 101 | #define YY_NULL 0 | ||
| 102 | |||
| 103 | /* Promotes a possibly negative, possibly signed char to an unsigned | ||
| 104 | * integer for use as an array index. If the signed char is negative, | ||
| 105 | * we want to instead treat it as an 8-bit unsigned char, hence the | ||
| 106 | * double cast. | ||
| 107 | */ | ||
| 108 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) | ||
| 109 | |||
| 110 | /* Enter a start condition. This macro really ought to take a parameter, | ||
| 111 | * but we do it the disgusting crufty way forced on us by the ()-less | ||
| 112 | * definition of BEGIN. | ||
| 113 | */ | ||
| 114 | #define BEGIN (yy_start) = 1 + 2 * | ||
| 115 | |||
| 116 | /* Translate the current start state into a value that can be later handed | ||
| 117 | * to BEGIN to return to the state. The YYSTATE alias is for lex | ||
| 118 | * compatibility. | ||
| 119 | */ | ||
| 120 | #define YY_START (((yy_start) - 1) / 2) | ||
| 121 | #define YYSTATE YY_START | ||
| 122 | |||
| 123 | /* Action number for EOF rule of a given start state. */ | ||
| 124 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) | ||
| 125 | |||
| 126 | /* Special action meaning "start processing a new file". */ | ||
| 127 | #define YY_NEW_FILE yyrestart(yyin ) | ||
| 128 | |||
| 129 | #define YY_END_OF_BUFFER_CHAR 0 | ||
| 130 | |||
| 131 | /* Size of default input buffer. */ | ||
| 132 | #ifndef YY_BUF_SIZE | ||
| 133 | #ifdef __ia64__ | ||
| 134 | /* On IA-64, the buffer size is 16k, not 8k. | ||
| 135 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. | ||
| 136 | * Ditto for the __ia64__ case accordingly. | ||
| 137 | */ | ||
| 138 | #define YY_BUF_SIZE 32768 | ||
| 139 | #else | ||
| 140 | #define YY_BUF_SIZE 16384 | ||
| 141 | #endif /* __ia64__ */ | ||
| 142 | #endif | ||
| 143 | |||
| 144 | /* The state buf must be large enough to hold one state per character in the main buffer. | ||
| 145 | */ | ||
| 146 | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) | ||
| 147 | |||
| 148 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE | ||
| 149 | #define YY_TYPEDEF_YY_BUFFER_STATE | ||
| 150 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | ||
| 151 | #endif | ||
| 152 | |||
| 153 | #ifndef YY_TYPEDEF_YY_SIZE_T | ||
| 154 | #define YY_TYPEDEF_YY_SIZE_T | ||
| 155 | typedef size_t yy_size_t; | ||
| 156 | #endif | ||
| 157 | |||
| 158 | extern int yyleng; | ||
| 159 | |||
| 160 | extern FILE *yyin, *yyout; | ||
| 161 | |||
| 162 | #define EOB_ACT_CONTINUE_SCAN 0 | ||
| 163 | #define EOB_ACT_END_OF_FILE 1 | ||
| 164 | #define EOB_ACT_LAST_MATCH 2 | ||
| 165 | |||
| 166 | #define YY_LESS_LINENO(n) | ||
| 167 | #define YY_LINENO_REWIND_TO(ptr) | ||
| 168 | |||
| 169 | /* Return all but the first "n" matched characters back to the input stream. */ | ||
| 170 | #define yyless(n) \ | ||
| 171 | do \ | ||
| 172 | { \ | ||
| 173 | /* Undo effects of setting up yytext. */ \ | ||
| 174 | int yyless_macro_arg = (n); \ | ||
| 175 | YY_LESS_LINENO(yyless_macro_arg);\ | ||
| 176 | *yy_cp = (yy_hold_char); \ | ||
| 177 | YY_RESTORE_YY_MORE_OFFSET \ | ||
| 178 | (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ | ||
| 179 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ | ||
| 180 | } \ | ||
| 181 | while ( 0 ) | ||
| 182 | |||
| 183 | #define unput(c) yyunput( c, (yytext_ptr) ) | ||
| 184 | |||
| 185 | #ifndef YY_STRUCT_YY_BUFFER_STATE | ||
| 186 | #define YY_STRUCT_YY_BUFFER_STATE | ||
| 187 | struct yy_buffer_state | ||
| 188 | { | ||
| 189 | FILE *yy_input_file; | ||
| 190 | |||
| 191 | char *yy_ch_buf; /* input buffer */ | ||
| 192 | char *yy_buf_pos; /* current position in input buffer */ | ||
| 193 | |||
| 194 | /* Size of input buffer in bytes, not including room for EOB | ||
| 195 | * characters. | ||
| 196 | */ | ||
| 197 | int yy_buf_size; | ||
| 198 | |||
| 199 | /* Number of characters read into yy_ch_buf, not including EOB | ||
| 200 | * characters. | ||
| 201 | */ | ||
| 202 | int yy_n_chars; | ||
| 203 | |||
| 204 | /* Whether we "own" the buffer - i.e., we know we created it, | ||
| 205 | * and can realloc() it to grow it, and should free() it to | ||
| 206 | * delete it. | ||
| 207 | */ | ||
| 208 | int yy_is_our_buffer; | ||
| 209 | |||
| 210 | /* Whether this is an "interactive" input source; if so, and | ||
| 211 | * if we're using stdio for input, then we want to use getc() | ||
| 212 | * instead of fread(), to make sure we stop fetching input after | ||
| 213 | * each newline. | ||
| 214 | */ | ||
| 215 | int yy_is_interactive; | ||
| 216 | |||
| 217 | /* Whether we're considered to be at the beginning of a line. | ||
| 218 | * If so, '^' rules will be active on the next match, otherwise | ||
| 219 | * not. | ||
| 220 | */ | ||
| 221 | int yy_at_bol; | ||
| 222 | |||
| 223 | int yy_bs_lineno; /**< The line count. */ | ||
| 224 | int yy_bs_column; /**< The column count. */ | ||
| 225 | |||
| 226 | /* Whether to try to fill the input buffer when we reach the | ||
| 227 | * end of it. | ||
| 228 | */ | ||
| 229 | int yy_fill_buffer; | ||
| 230 | |||
| 231 | int yy_buffer_status; | ||
| 232 | |||
| 233 | #define YY_BUFFER_NEW 0 | ||
| 234 | #define YY_BUFFER_NORMAL 1 | ||
| 235 | /* When an EOF's been seen but there's still some text to process | ||
| 236 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we | ||
| 237 | * shouldn't try reading from the input source any more. We might | ||
| 238 | * still have a bunch of tokens to match, though, because of | ||
| 239 | * possible backing-up. | ||
| 240 | * | ||
| 241 | * When we actually see the EOF, we change the status to "new" | ||
| 242 | * (via yyrestart()), so that the user can continue scanning by | ||
| 243 | * just pointing yyin at a new input file. | ||
| 244 | */ | ||
| 245 | #define YY_BUFFER_EOF_PENDING 2 | ||
| 246 | |||
| 247 | }; | ||
| 248 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ | ||
| 249 | |||
| 250 | /* Stack of input buffers. */ | ||
| 251 | static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ | ||
| 252 | static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ | ||
| 253 | static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ | ||
| 254 | |||
| 255 | /* We provide macros for accessing buffer states in case in the | ||
| 256 | * future we want to put the buffer states in a more general | ||
| 257 | * "scanner state". | ||
| 258 | * | ||
| 259 | * Returns the top of the stack, or NULL. | ||
| 260 | */ | ||
| 261 | #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ | ||
| 262 | ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ | ||
| 263 | : NULL) | ||
| 264 | |||
| 265 | /* Same as previous macro, but useful when we know that the buffer stack is not | ||
| 266 | * NULL or when we need an lvalue. For internal use only. | ||
| 267 | */ | ||
| 268 | #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] | ||
| 269 | |||
| 270 | /* yy_hold_char holds the character lost when yytext is formed. */ | ||
| 271 | static char yy_hold_char; | ||
| 272 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ | ||
| 273 | int yyleng; | ||
| 274 | |||
| 275 | /* Points to current character in buffer. */ | ||
| 276 | static char *yy_c_buf_p = NULL; | ||
| 277 | static int yy_init = 0; /* whether we need to initialize */ | ||
| 278 | static int yy_start = 0; /* start state number */ | ||
| 279 | |||
| 280 | /* Flag which is used to allow yywrap()'s to do buffer switches | ||
| 281 | * instead of setting up a fresh yyin. A bit of a hack ... | ||
| 282 | */ | ||
| 283 | static int yy_did_buffer_switch_on_eof; | ||
| 284 | |||
| 285 | void yyrestart (FILE *input_file ); | ||
| 286 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); | ||
| 287 | YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); | ||
| 288 | void yy_delete_buffer (YY_BUFFER_STATE b ); | ||
| 289 | void yy_flush_buffer (YY_BUFFER_STATE b ); | ||
| 290 | void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); | ||
| 291 | void yypop_buffer_state (void ); | ||
| 292 | |||
| 293 | static void yyensure_buffer_stack (void ); | ||
| 294 | static void yy_load_buffer_state (void ); | ||
| 295 | static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); | ||
| 296 | |||
| 297 | #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) | ||
| 298 | |||
| 299 | YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); | ||
| 300 | YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); | ||
| 301 | YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); | ||
| 302 | |||
| 303 | void *yyalloc (yy_size_t ); | ||
| 304 | void *yyrealloc (void *,yy_size_t ); | ||
| 305 | void yyfree (void * ); | ||
| 306 | |||
| 307 | #define yy_new_buffer yy_create_buffer | ||
| 308 | |||
| 309 | #define yy_set_interactive(is_interactive) \ | ||
| 310 | { \ | ||
| 311 | if ( ! YY_CURRENT_BUFFER ){ \ | ||
| 312 | yyensure_buffer_stack (); \ | ||
| 313 | YY_CURRENT_BUFFER_LVALUE = \ | ||
| 314 | yy_create_buffer(yyin,YY_BUF_SIZE ); \ | ||
| 315 | } \ | ||
| 316 | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ | ||
| 317 | } | ||
| 318 | |||
| 319 | #define yy_set_bol(at_bol) \ | ||
| 320 | { \ | ||
| 321 | if ( ! YY_CURRENT_BUFFER ){\ | ||
| 322 | yyensure_buffer_stack (); \ | ||
| 323 | YY_CURRENT_BUFFER_LVALUE = \ | ||
| 324 | yy_create_buffer(yyin,YY_BUF_SIZE ); \ | ||
| 325 | } \ | ||
| 326 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ | ||
| 327 | } | ||
| 328 | |||
| 329 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) | ||
| 330 | |||
| 331 | /* Begin user sect3 */ | ||
| 332 | |||
| 333 | #define yywrap() (/*CONSTCOND*/1) | ||
| 334 | #define YY_SKIP_YYWRAP | ||
| 335 | |||
| 336 | typedef unsigned char YY_CHAR; | ||
| 337 | |||
| 338 | FILE *yyin = NULL, *yyout = NULL; | ||
| 339 | |||
| 340 | typedef int yy_state_type; | ||
| 341 | |||
| 342 | extern int yylineno; | ||
| 343 | |||
| 344 | int yylineno = 1; | ||
| 345 | |||
| 346 | extern char *yytext; | ||
| 347 | #ifdef yytext_ptr | ||
| 348 | #undef yytext_ptr | ||
| 349 | #endif | ||
| 350 | #define yytext_ptr yytext | ||
| 351 | |||
| 352 | static yy_state_type yy_get_previous_state (void ); | ||
| 353 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); | ||
| 354 | static int yy_get_next_buffer (void ); | ||
| 355 | static void yynoreturn yy_fatal_error (yyconst char* msg ); | ||
| 356 | |||
| 357 | /* Done after the current pattern has been matched and before the | ||
| 358 | * corresponding action - sets up yytext. | ||
| 359 | */ | ||
| 360 | #define YY_DO_BEFORE_ACTION \ | ||
| 361 | (yytext_ptr) = yy_bp; \ | ||
| 362 | yyleng = (int) (yy_cp - yy_bp); \ | ||
| 363 | (yy_hold_char) = *yy_cp; \ | ||
| 364 | *yy_cp = '\0'; \ | ||
| 365 | (yy_c_buf_p) = yy_cp; | ||
| 366 | |||
| 367 | #define YY_NUM_RULES 31 | ||
| 368 | #define YY_END_OF_BUFFER 32 | ||
| 369 | /* This struct is not used in this scanner, | ||
| 370 | but its presence is necessary. */ | ||
| 371 | struct yy_trans_info | ||
| 372 | { | ||
| 373 | flex_int32_t yy_verify; | ||
| 374 | flex_int32_t yy_nxt; | ||
| 375 | }; | ||
| 376 | static yyconst flex_int16_t yy_accept[166] = | ||
| 377 | { 0, | ||
| 378 | 0, 0, 0, 0, 0, 0, 0, 0, 32, 30, | ||
| 379 | 19, 19, 30, 30, 30, 30, 30, 30, 30, 30, | ||
| 380 | 30, 30, 30, 30, 30, 30, 16, 17, 17, 30, | ||
| 381 | 17, 11, 11, 19, 27, 0, 3, 0, 28, 13, | ||
| 382 | 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, | ||
| 383 | 0, 22, 24, 26, 25, 23, 0, 10, 29, 0, | ||
| 384 | 0, 0, 15, 15, 17, 17, 17, 11, 11, 11, | ||
| 385 | 0, 13, 0, 12, 0, 0, 0, 21, 0, 0, | ||
| 386 | 0, 0, 0, 0, 0, 0, 0, 17, 11, 11, | ||
| 387 | 11, 0, 14, 20, 0, 0, 0, 0, 0, 0, | ||
| 388 | |||
| 389 | 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, | ||
| 390 | 0, 0, 0, 0, 0, 17, 7, 0, 0, 0, | ||
| 391 | 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, | ||
| 392 | 0, 0, 0, 0, 4, 18, 0, 0, 5, 2, | ||
| 393 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 394 | 0, 0, 1, 0, 0, 0, 0, 6, 9, 0, | ||
| 395 | 0, 0, 0, 8, 0 | ||
| 396 | } ; | ||
| 397 | |||
| 398 | static yyconst YY_CHAR yy_ec[256] = | ||
| 399 | { 0, | ||
| 400 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, | ||
| 401 | 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, | ||
| 402 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 403 | 1, 2, 5, 6, 7, 1, 1, 8, 9, 1, | ||
| 404 | 1, 10, 11, 11, 12, 11, 13, 14, 15, 16, | ||
| 405 | 16, 16, 16, 16, 16, 16, 16, 17, 1, 18, | ||
| 406 | 19, 20, 11, 11, 21, 21, 21, 21, 21, 21, | ||
| 407 | 22, 22, 22, 22, 22, 23, 22, 22, 22, 22, | ||
| 408 | 22, 22, 22, 22, 24, 22, 22, 25, 22, 22, | ||
| 409 | 1, 26, 27, 1, 22, 1, 21, 28, 29, 30, | ||
| 410 | |||
| 411 | 31, 21, 32, 22, 33, 22, 22, 34, 35, 36, | ||
| 412 | 37, 38, 22, 39, 40, 41, 42, 43, 22, 25, | ||
| 413 | 44, 22, 45, 46, 47, 1, 1, 1, 1, 1, | ||
| 414 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 415 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 416 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 417 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 418 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 419 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 420 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 421 | |||
| 422 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 423 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 424 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 425 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 426 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 427 | 1, 1, 1, 1, 1 | ||
| 428 | } ; | ||
| 429 | |||
| 430 | static yyconst YY_CHAR yy_meta[48] = | ||
| 431 | { 0, | ||
| 432 | 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, | ||
| 433 | 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, | ||
| 434 | 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, | ||
| 435 | 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
| 436 | 8, 8, 8, 8, 3, 1, 4 | ||
| 437 | } ; | ||
| 438 | |||
| 439 | static yyconst flex_uint16_t yy_base[180] = | ||
| 440 | { 0, | ||
| 441 | 0, 393, 35, 392, 66, 391, 38, 107, 397, 401, | ||
| 442 | 55, 113, 377, 112, 111, 111, 114, 42, 376, 106, | ||
| 443 | 377, 347, 126, 120, 0, 147, 401, 0, 124, 0, | ||
| 444 | 137, 158, 170, 163, 401, 153, 401, 389, 401, 0, | ||
| 445 | 378, 120, 401, 131, 380, 386, 355, 139, 351, 355, | ||
| 446 | 351, 401, 401, 401, 401, 401, 367, 401, 401, 185, | ||
| 447 | 350, 346, 401, 364, 0, 185, 347, 189, 356, 355, | ||
| 448 | 0, 0, 330, 180, 366, 141, 372, 361, 332, 338, | ||
| 449 | 331, 341, 334, 326, 205, 331, 337, 329, 401, 341, | ||
| 450 | 167, 316, 401, 349, 348, 320, 328, 346, 180, 318, | ||
| 451 | |||
| 452 | 324, 209, 324, 320, 322, 342, 338, 309, 306, 315, | ||
| 453 | 305, 315, 312, 192, 342, 341, 401, 293, 306, 282, | ||
| 454 | 268, 252, 255, 203, 285, 282, 272, 268, 252, 233, | ||
| 455 | 232, 239, 208, 107, 401, 401, 238, 211, 401, 211, | ||
| 456 | 212, 208, 228, 203, 215, 207, 233, 222, 212, 211, | ||
| 457 | 203, 227, 401, 237, 225, 204, 185, 401, 401, 149, | ||
| 458 | 128, 88, 42, 401, 401, 253, 259, 267, 271, 275, | ||
| 459 | 281, 288, 292, 300, 308, 312, 318, 326, 334 | ||
| 460 | } ; | ||
| 461 | |||
| 462 | static yyconst flex_int16_t yy_def[180] = | ||
| 463 | { 0, | ||
| 464 | 165, 1, 1, 3, 165, 5, 1, 1, 165, 165, | ||
| 465 | 165, 165, 165, 166, 167, 168, 165, 165, 165, 165, | ||
| 466 | 169, 165, 165, 165, 170, 169, 165, 171, 172, 171, | ||
| 467 | 171, 165, 165, 165, 165, 166, 165, 166, 165, 173, | ||
| 468 | 165, 168, 165, 168, 174, 175, 165, 165, 165, 165, | ||
| 469 | 165, 165, 165, 165, 165, 165, 169, 165, 165, 165, | ||
| 470 | 165, 165, 165, 169, 171, 172, 171, 165, 165, 165, | ||
| 471 | 176, 173, 177, 168, 174, 174, 175, 165, 165, 165, | ||
| 472 | 165, 165, 165, 165, 165, 165, 165, 171, 165, 165, | ||
| 473 | 176, 177, 165, 165, 165, 165, 165, 165, 165, 165, | ||
| 474 | |||
| 475 | 165, 165, 165, 165, 171, 165, 165, 165, 165, 165, | ||
| 476 | 165, 165, 165, 178, 165, 171, 165, 165, 165, 165, | ||
| 477 | 165, 165, 165, 178, 165, 178, 165, 165, 165, 165, | ||
| 478 | 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, | ||
| 479 | 165, 165, 165, 165, 165, 165, 165, 179, 165, 165, | ||
| 480 | 165, 179, 165, 179, 165, 165, 165, 165, 165, 165, | ||
| 481 | 165, 165, 165, 165, 0, 165, 165, 165, 165, 165, | ||
| 482 | 165, 165, 165, 165, 165, 165, 165, 165, 165 | ||
| 483 | } ; | ||
| 484 | |||
| 485 | static yyconst flex_uint16_t yy_nxt[449] = | ||
| 486 | { 0, | ||
| 487 | 10, 11, 12, 11, 13, 14, 10, 15, 16, 10, | ||
| 488 | 10, 10, 17, 10, 10, 10, 10, 18, 19, 20, | ||
| 489 | 21, 21, 21, 21, 21, 10, 10, 21, 21, 21, | ||
| 490 | 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, | ||
| 491 | 21, 21, 21, 21, 10, 22, 10, 24, 25, 25, | ||
| 492 | 25, 32, 33, 33, 164, 26, 34, 34, 34, 52, | ||
| 493 | 53, 27, 26, 26, 26, 26, 10, 11, 12, 11, | ||
| 494 | 13, 14, 28, 15, 16, 28, 28, 28, 24, 28, | ||
| 495 | 28, 28, 10, 18, 19, 20, 29, 29, 29, 29, | ||
| 496 | 29, 30, 10, 29, 29, 29, 29, 29, 29, 29, | ||
| 497 | |||
| 498 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, | ||
| 499 | 10, 22, 10, 23, 34, 34, 34, 37, 39, 43, | ||
| 500 | 32, 33, 33, 45, 55, 56, 46, 60, 43, 45, | ||
| 501 | 65, 163, 46, 65, 65, 65, 44, 38, 60, 74, | ||
| 502 | 58, 47, 141, 48, 142, 44, 49, 47, 50, 48, | ||
| 503 | 76, 51, 62, 94, 50, 41, 44, 51, 37, 61, | ||
| 504 | 64, 64, 64, 58, 34, 34, 34, 64, 162, 80, | ||
| 505 | 67, 68, 68, 68, 64, 64, 64, 64, 38, 81, | ||
| 506 | 69, 70, 71, 68, 68, 68, 60, 161, 43, 69, | ||
| 507 | 70, 65, 69, 70, 65, 65, 65, 125, 85, 85, | ||
| 508 | |||
| 509 | 85, 58, 68, 68, 68, 44, 102, 110, 125, 133, | ||
| 510 | 102, 69, 70, 111, 114, 160, 159, 126, 85, 85, | ||
| 511 | 85, 140, 140, 140, 140, 140, 140, 153, 126, 147, | ||
| 512 | 147, 147, 153, 148, 147, 147, 147, 158, 148, 165, | ||
| 513 | 157, 156, 155, 151, 150, 149, 146, 154, 145, 144, | ||
| 514 | 143, 139, 154, 36, 36, 36, 36, 36, 36, 36, | ||
| 515 | 36, 40, 138, 137, 136, 40, 40, 42, 42, 42, | ||
| 516 | 42, 42, 42, 42, 42, 57, 57, 57, 57, 63, | ||
| 517 | 135, 63, 65, 134, 165, 65, 133, 65, 65, 66, | ||
| 518 | 132, 131, 66, 66, 66, 66, 72, 130, 72, 72, | ||
| 519 | |||
| 520 | 75, 75, 75, 75, 75, 75, 75, 75, 77, 77, | ||
| 521 | 77, 77, 77, 77, 77, 77, 91, 129, 91, 92, | ||
| 522 | 128, 92, 92, 127, 92, 92, 124, 124, 124, 124, | ||
| 523 | 124, 124, 124, 124, 152, 152, 152, 152, 152, 152, | ||
| 524 | 152, 152, 60, 60, 123, 122, 121, 120, 119, 118, | ||
| 525 | 117, 45, 116, 111, 115, 113, 112, 109, 108, 107, | ||
| 526 | 46, 106, 93, 89, 105, 104, 103, 101, 100, 99, | ||
| 527 | 98, 97, 96, 95, 78, 76, 93, 90, 89, 88, | ||
| 528 | 58, 87, 86, 58, 84, 83, 82, 79, 78, 76, | ||
| 529 | 73, 165, 59, 58, 54, 35, 165, 31, 23, 23, | ||
| 530 | |||
| 531 | 9, 165, 165, 165, 165, 165, 165, 165, 165, 165, | ||
| 532 | 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, | ||
| 533 | 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, | ||
| 534 | 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, | ||
| 535 | 165, 165, 165, 165, 165, 165, 165, 165 | ||
| 536 | } ; | ||
| 537 | |||
| 538 | static yyconst flex_int16_t yy_chk[449] = | ||
| 539 | { 0, | ||
| 540 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 541 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 542 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 543 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 544 | 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, | ||
| 545 | 3, 7, 7, 7, 163, 3, 11, 11, 11, 18, | ||
| 546 | 18, 3, 3, 3, 3, 3, 5, 5, 5, 5, | ||
| 547 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 548 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 549 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 550 | |||
| 551 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
| 552 | 5, 5, 5, 8, 12, 12, 12, 14, 15, 16, | ||
| 553 | 8, 8, 8, 17, 20, 20, 17, 23, 42, 24, | ||
| 554 | 29, 162, 24, 29, 29, 29, 16, 14, 31, 44, | ||
| 555 | 29, 17, 134, 17, 134, 42, 17, 24, 17, 24, | ||
| 556 | 76, 17, 24, 76, 24, 15, 44, 24, 36, 23, | ||
| 557 | 26, 26, 26, 26, 34, 34, 34, 26, 161, 48, | ||
| 558 | 31, 32, 32, 32, 26, 26, 26, 26, 36, 48, | ||
| 559 | 32, 32, 32, 33, 33, 33, 60, 160, 74, 91, | ||
| 560 | 91, 66, 33, 33, 66, 66, 66, 114, 60, 60, | ||
| 561 | |||
| 562 | 60, 66, 68, 68, 68, 74, 85, 99, 124, 133, | ||
| 563 | 102, 68, 68, 99, 102, 157, 156, 114, 85, 85, | ||
| 564 | 85, 133, 133, 133, 140, 140, 140, 148, 124, 143, | ||
| 565 | 143, 143, 152, 143, 147, 147, 147, 155, 147, 154, | ||
| 566 | 151, 150, 149, 146, 145, 144, 142, 148, 141, 138, | ||
| 567 | 137, 132, 152, 166, 166, 166, 166, 166, 166, 166, | ||
| 568 | 166, 167, 131, 130, 129, 167, 167, 168, 168, 168, | ||
| 569 | 168, 168, 168, 168, 168, 169, 169, 169, 169, 170, | ||
| 570 | 128, 170, 171, 127, 126, 171, 125, 171, 171, 172, | ||
| 571 | 123, 122, 172, 172, 172, 172, 173, 121, 173, 173, | ||
| 572 | |||
| 573 | 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, | ||
| 574 | 175, 175, 175, 175, 175, 175, 176, 120, 176, 177, | ||
| 575 | 119, 177, 177, 118, 177, 177, 178, 178, 178, 178, | ||
| 576 | 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, | ||
| 577 | 179, 179, 116, 115, 113, 112, 111, 110, 109, 108, | ||
| 578 | 107, 106, 105, 104, 103, 101, 100, 98, 97, 96, | ||
| 579 | 95, 94, 92, 90, 88, 87, 86, 84, 83, 82, | ||
| 580 | 81, 80, 79, 78, 77, 75, 73, 70, 69, 67, | ||
| 581 | 64, 62, 61, 57, 51, 50, 49, 47, 46, 45, | ||
| 582 | 41, 38, 22, 21, 19, 13, 9, 6, 4, 2, | ||
| 583 | |||
| 584 | 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, | ||
| 585 | 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, | ||
| 586 | 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, | ||
| 587 | 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, | ||
| 588 | 165, 165, 165, 165, 165, 165, 165, 165 | ||
| 589 | } ; | ||
| 590 | |||
| 591 | static yy_state_type yy_last_accepting_state; | ||
| 592 | static char *yy_last_accepting_cpos; | ||
| 593 | |||
| 594 | extern int yy_flex_debug; | ||
| 595 | int yy_flex_debug = 0; | ||
| 596 | |||
| 597 | /* The intent behind this definition is that it'll catch | ||
| 598 | * any uses of REJECT which flex missed. | ||
| 599 | */ | ||
| 600 | #define REJECT reject_used_but_not_detected | ||
| 601 | #define yymore() yymore_used_but_not_detected | ||
| 602 | #define YY_MORE_ADJ 0 | ||
| 603 | #define YY_RESTORE_YY_MORE_OFFSET | ||
| 604 | char *yytext; | ||
| 605 | #line 1 "dtc-lexer.l" | ||
| 606 | /* | ||
| 607 | * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. | ||
| 608 | * | ||
| 609 | * | ||
| 610 | * This program is free software; you can redistribute it and/or | ||
| 611 | * modify it under the terms of the GNU General Public License as | ||
| 612 | * published by the Free Software Foundation; either version 2 of the | ||
| 613 | * License, or (at your option) any later version. | ||
| 614 | * | ||
| 615 | * This program is distributed in the hope that it will be useful, | ||
| 616 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 617 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 618 | * General Public License for more details. | ||
| 619 | * | ||
| 620 | * You should have received a copy of the GNU General Public License | ||
| 621 | * along with this program; if not, write to the Free Software | ||
| 622 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
| 623 | * USA | ||
| 624 | */ | ||
| 625 | #define YY_NO_INPUT 1 | ||
| 626 | |||
| 627 | |||
| 628 | |||
| 629 | #line 37 "dtc-lexer.l" | ||
| 630 | #include "dtc.h" | ||
| 631 | #include "srcpos.h" | ||
| 632 | #include "dtc-parser.tab.h" | ||
| 633 | |||
| 634 | YYLTYPE yylloc; | ||
| 635 | extern bool treesource_error; | ||
| 636 | |||
| 637 | /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ | ||
| 638 | #define YY_USER_ACTION \ | ||
| 639 | { \ | ||
| 640 | srcpos_update(&yylloc, yytext, yyleng); \ | ||
| 641 | } | ||
| 642 | |||
| 643 | /*#define LEXDEBUG 1*/ | ||
| 644 | |||
| 645 | #ifdef LEXDEBUG | ||
| 646 | #define DPRINT(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__) | ||
| 647 | #else | ||
| 648 | #define DPRINT(fmt, ...) do { } while (0) | ||
| 649 | #endif | ||
| 650 | |||
| 651 | static int dts_version = 1; | ||
| 652 | |||
| 653 | #define BEGIN_DEFAULT() DPRINT("<V1>\n"); \ | ||
| 654 | BEGIN(V1); \ | ||
| 655 | |||
| 656 | static void push_input_file(const char *filename); | ||
| 657 | static bool pop_input_file(void); | ||
| 658 | static void PRINTF(1, 2) lexical_error(const char *fmt, ...); | ||
| 659 | |||
| 660 | #line 661 "dtc-lexer.lex.c" | ||
| 661 | |||
| 662 | #define INITIAL 0 | ||
| 663 | #define BYTESTRING 1 | ||
| 664 | #define PROPNODENAME 2 | ||
| 665 | #define V1 3 | ||
| 666 | |||
| 667 | #ifndef YY_NO_UNISTD_H | ||
| 668 | /* Special case for "unistd.h", since it is non-ANSI. We include it way | ||
| 669 | * down here because we want the user's section 1 to have been scanned first. | ||
| 670 | * The user has a chance to override it with an option. | ||
| 671 | */ | ||
| 672 | #include <unistd.h> | ||
| 673 | #endif | ||
| 674 | |||
| 675 | #ifndef YY_EXTRA_TYPE | ||
| 676 | #define YY_EXTRA_TYPE void * | ||
| 677 | #endif | ||
| 678 | |||
| 679 | static int yy_init_globals (void ); | ||
| 680 | |||
| 681 | /* Accessor methods to globals. | ||
| 682 | These are made visible to non-reentrant scanners for convenience. */ | ||
| 683 | |||
| 684 | int yylex_destroy (void ); | ||
| 685 | |||
| 686 | int yyget_debug (void ); | ||
| 687 | |||
| 688 | void yyset_debug (int debug_flag ); | ||
| 689 | |||
| 690 | YY_EXTRA_TYPE yyget_extra (void ); | ||
| 691 | |||
| 692 | void yyset_extra (YY_EXTRA_TYPE user_defined ); | ||
| 693 | |||
| 694 | FILE *yyget_in (void ); | ||
| 695 | |||
| 696 | void yyset_in (FILE * _in_str ); | ||
| 697 | |||
| 698 | FILE *yyget_out (void ); | ||
| 699 | |||
| 700 | void yyset_out (FILE * _out_str ); | ||
| 701 | |||
| 702 | int yyget_leng (void ); | ||
| 703 | |||
| 704 | char *yyget_text (void ); | ||
| 705 | |||
| 706 | int yyget_lineno (void ); | ||
| 707 | |||
| 708 | void yyset_lineno (int _line_number ); | ||
| 709 | |||
| 710 | /* Macros after this point can all be overridden by user definitions in | ||
| 711 | * section 1. | ||
| 712 | */ | ||
| 713 | |||
| 714 | #ifndef YY_SKIP_YYWRAP | ||
| 715 | #ifdef __cplusplus | ||
| 716 | extern "C" int yywrap (void ); | ||
| 717 | #else | ||
| 718 | extern int yywrap (void ); | ||
| 719 | #endif | ||
| 720 | #endif | ||
| 721 | |||
| 722 | #ifndef YY_NO_UNPUT | ||
| 723 | |||
| 724 | #endif | ||
| 725 | |||
| 726 | #ifndef yytext_ptr | ||
| 727 | static void yy_flex_strncpy (char *,yyconst char *,int ); | ||
| 728 | #endif | ||
| 729 | |||
| 730 | #ifdef YY_NEED_STRLEN | ||
| 731 | static int yy_flex_strlen (yyconst char * ); | ||
| 732 | #endif | ||
| 733 | |||
| 734 | #ifndef YY_NO_INPUT | ||
| 735 | |||
| 736 | #ifdef __cplusplus | ||
| 737 | static int yyinput (void ); | ||
| 738 | #else | ||
| 739 | static int input (void ); | ||
| 740 | #endif | ||
| 741 | |||
| 742 | #endif | ||
| 743 | |||
| 744 | /* Amount of stuff to slurp up with each read. */ | ||
| 745 | #ifndef YY_READ_BUF_SIZE | ||
| 746 | #ifdef __ia64__ | ||
| 747 | /* On IA-64, the buffer size is 16k, not 8k */ | ||
| 748 | #define YY_READ_BUF_SIZE 16384 | ||
| 749 | #else | ||
| 750 | #define YY_READ_BUF_SIZE 8192 | ||
| 751 | #endif /* __ia64__ */ | ||
| 752 | #endif | ||
| 753 | |||
| 754 | /* Copy whatever the last rule matched to the standard output. */ | ||
| 755 | #ifndef ECHO | ||
| 756 | /* This used to be an fputs(), but since the string might contain NUL's, | ||
| 757 | * we now use fwrite(). | ||
| 758 | */ | ||
| 759 | #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) | ||
| 760 | #endif | ||
| 761 | |||
| 762 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | ||
| 763 | * is returned in "result". | ||
| 764 | */ | ||
| 765 | #ifndef YY_INPUT | ||
| 766 | #define YY_INPUT(buf,result,max_size) \ | ||
| 767 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ | ||
| 768 | { \ | ||
| 769 | int c = '*'; \ | ||
| 770 | size_t n; \ | ||
| 771 | for ( n = 0; n < max_size && \ | ||
| 772 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ | ||
| 773 | buf[n] = (char) c; \ | ||
| 774 | if ( c == '\n' ) \ | ||
| 775 | buf[n++] = (char) c; \ | ||
| 776 | if ( c == EOF && ferror( yyin ) ) \ | ||
| 777 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ | ||
| 778 | result = n; \ | ||
| 779 | } \ | ||
| 780 | else \ | ||
| 781 | { \ | ||
| 782 | errno=0; \ | ||
| 783 | while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ | ||
| 784 | { \ | ||
| 785 | if( errno != EINTR) \ | ||
| 786 | { \ | ||
| 787 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ | ||
| 788 | break; \ | ||
| 789 | } \ | ||
| 790 | errno=0; \ | ||
| 791 | clearerr(yyin); \ | ||
| 792 | } \ | ||
| 793 | }\ | ||
| 794 | \ | ||
| 795 | |||
| 796 | #endif | ||
| 797 | |||
| 798 | /* No semi-colon after return; correct usage is to write "yyterminate();" - | ||
| 799 | * we don't want an extra ';' after the "return" because that will cause | ||
| 800 | * some compilers to complain about unreachable statements. | ||
| 801 | */ | ||
| 802 | #ifndef yyterminate | ||
| 803 | #define yyterminate() return YY_NULL | ||
| 804 | #endif | ||
| 805 | |||
| 806 | /* Number of entries by which start-condition stack grows. */ | ||
| 807 | #ifndef YY_START_STACK_INCR | ||
| 808 | #define YY_START_STACK_INCR 25 | ||
| 809 | #endif | ||
| 810 | |||
| 811 | /* Report a fatal error. */ | ||
| 812 | #ifndef YY_FATAL_ERROR | ||
| 813 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) | ||
| 814 | #endif | ||
| 815 | |||
| 816 | /* end tables serialization structures and prototypes */ | ||
| 817 | |||
| 818 | /* Default declaration of generated scanner - a define so the user can | ||
| 819 | * easily add parameters. | ||
| 820 | */ | ||
| 821 | #ifndef YY_DECL | ||
| 822 | #define YY_DECL_IS_OURS 1 | ||
| 823 | |||
| 824 | extern int yylex (void); | ||
| 825 | |||
| 826 | #define YY_DECL int yylex (void) | ||
| 827 | #endif /* !YY_DECL */ | ||
| 828 | |||
| 829 | /* Code executed at the beginning of each rule, after yytext and yyleng | ||
| 830 | * have been set up. | ||
| 831 | */ | ||
| 832 | #ifndef YY_USER_ACTION | ||
| 833 | #define YY_USER_ACTION | ||
| 834 | #endif | ||
| 835 | |||
| 836 | /* Code executed at the end of each rule. */ | ||
| 837 | #ifndef YY_BREAK | ||
| 838 | #define YY_BREAK /*LINTED*/break; | ||
| 839 | #endif | ||
| 840 | |||
| 841 | #define YY_RULE_SETUP \ | ||
| 842 | if ( yyleng > 0 ) \ | ||
| 843 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ | ||
| 844 | (yytext[yyleng - 1] == '\n'); \ | ||
| 845 | YY_USER_ACTION | ||
| 846 | |||
| 847 | /** The main scanner function which does all the work. | ||
| 848 | */ | ||
| 849 | YY_DECL | ||
| 850 | { | ||
| 851 | yy_state_type yy_current_state; | ||
| 852 | char *yy_cp, *yy_bp; | ||
| 853 | int yy_act; | ||
| 854 | |||
| 855 | if ( !(yy_init) ) | ||
| 856 | { | ||
| 857 | (yy_init) = 1; | ||
| 858 | |||
| 859 | #ifdef YY_USER_INIT | ||
| 860 | YY_USER_INIT; | ||
| 861 | #endif | ||
| 862 | |||
| 863 | if ( ! (yy_start) ) | ||
| 864 | (yy_start) = 1; /* first start state */ | ||
| 865 | |||
| 866 | if ( ! yyin ) | ||
| 867 | yyin = stdin; | ||
| 868 | |||
| 869 | if ( ! yyout ) | ||
| 870 | yyout = stdout; | ||
| 871 | |||
| 872 | if ( ! YY_CURRENT_BUFFER ) { | ||
| 873 | yyensure_buffer_stack (); | ||
| 874 | YY_CURRENT_BUFFER_LVALUE = | ||
| 875 | yy_create_buffer(yyin,YY_BUF_SIZE ); | ||
| 876 | } | ||
| 877 | |||
| 878 | yy_load_buffer_state( ); | ||
| 879 | } | ||
| 880 | |||
| 881 | { | ||
| 882 | #line 69 "dtc-lexer.l" | ||
| 883 | |||
| 884 | #line 885 "dtc-lexer.lex.c" | ||
| 885 | |||
| 886 | while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ | ||
| 887 | { | ||
| 888 | yy_cp = (yy_c_buf_p); | ||
| 889 | |||
| 890 | /* Support of yytext. */ | ||
| 891 | *yy_cp = (yy_hold_char); | ||
| 892 | |||
| 893 | /* yy_bp points to the position in yy_ch_buf of the start of | ||
| 894 | * the current run. | ||
| 895 | */ | ||
| 896 | yy_bp = yy_cp; | ||
| 897 | |||
| 898 | yy_current_state = (yy_start); | ||
| 899 | yy_current_state += YY_AT_BOL(); | ||
| 900 | yy_match: | ||
| 901 | do | ||
| 902 | { | ||
| 903 | YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; | ||
| 904 | if ( yy_accept[yy_current_state] ) | ||
| 905 | { | ||
| 906 | (yy_last_accepting_state) = yy_current_state; | ||
| 907 | (yy_last_accepting_cpos) = yy_cp; | ||
| 908 | } | ||
| 909 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | ||
| 910 | { | ||
| 911 | yy_current_state = (int) yy_def[yy_current_state]; | ||
| 912 | if ( yy_current_state >= 166 ) | ||
| 913 | yy_c = yy_meta[(unsigned int) yy_c]; | ||
| 914 | } | ||
| 915 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; | ||
| 916 | ++yy_cp; | ||
| 917 | } | ||
| 918 | while ( yy_current_state != 165 ); | ||
| 919 | yy_cp = (yy_last_accepting_cpos); | ||
| 920 | yy_current_state = (yy_last_accepting_state); | ||
| 921 | |||
| 922 | yy_find_action: | ||
| 923 | yy_act = yy_accept[yy_current_state]; | ||
| 924 | |||
| 925 | YY_DO_BEFORE_ACTION; | ||
| 926 | |||
| 927 | do_action: /* This label is used only to access EOF actions. */ | ||
| 928 | |||
| 929 | switch ( yy_act ) | ||
| 930 | { /* beginning of action switch */ | ||
| 931 | case 0: /* must back up */ | ||
| 932 | /* undo the effects of YY_DO_BEFORE_ACTION */ | ||
| 933 | *yy_cp = (yy_hold_char); | ||
| 934 | yy_cp = (yy_last_accepting_cpos); | ||
| 935 | yy_current_state = (yy_last_accepting_state); | ||
| 936 | goto yy_find_action; | ||
| 937 | |||
| 938 | case 1: | ||
| 939 | /* rule 1 can match eol */ | ||
| 940 | YY_RULE_SETUP | ||
| 941 | #line 70 "dtc-lexer.l" | ||
| 942 | { | ||
| 943 | char *name = strchr(yytext, '\"') + 1; | ||
| 944 | yytext[yyleng-1] = '\0'; | ||
| 945 | push_input_file(name); | ||
| 946 | } | ||
| 947 | YY_BREAK | ||
| 948 | case 2: | ||
| 949 | /* rule 2 can match eol */ | ||
| 950 | YY_RULE_SETUP | ||
| 951 | #line 76 "dtc-lexer.l" | ||
| 952 | { | ||
| 953 | char *line, *fnstart, *fnend; | ||
| 954 | struct data fn; | ||
| 955 | /* skip text before line # */ | ||
| 956 | line = yytext; | ||
| 957 | while (!isdigit((unsigned char)*line)) | ||
| 958 | line++; | ||
| 959 | |||
| 960 | /* regexp ensures that first and list " | ||
| 961 | * in the whole yytext are those at | ||
| 962 | * beginning and end of the filename string */ | ||
| 963 | fnstart = memchr(yytext, '"', yyleng); | ||
| 964 | for (fnend = yytext + yyleng - 1; | ||
| 965 | *fnend != '"'; fnend--) | ||
| 966 | ; | ||
| 967 | assert(fnstart && fnend && (fnend > fnstart)); | ||
| 968 | |||
| 969 | fn = data_copy_escape_string(fnstart + 1, | ||
| 970 | fnend - fnstart - 1); | ||
| 971 | |||
| 972 | /* Don't allow nuls in filenames */ | ||
| 973 | if (memchr(fn.val, '\0', fn.len - 1)) | ||
| 974 | lexical_error("nul in line number directive"); | ||
| 975 | |||
| 976 | /* -1 since #line is the number of the next line */ | ||
| 977 | srcpos_set_line(xstrdup(fn.val), atoi(line) - 1); | ||
| 978 | data_free(fn); | ||
| 979 | } | ||
| 980 | YY_BREAK | ||
| 981 | case YY_STATE_EOF(INITIAL): | ||
| 982 | case YY_STATE_EOF(BYTESTRING): | ||
| 983 | case YY_STATE_EOF(PROPNODENAME): | ||
| 984 | case YY_STATE_EOF(V1): | ||
| 985 | #line 105 "dtc-lexer.l" | ||
| 986 | { | ||
| 987 | if (!pop_input_file()) { | ||
| 988 | yyterminate(); | ||
| 989 | } | ||
| 990 | } | ||
| 991 | YY_BREAK | ||
| 992 | case 3: | ||
| 993 | /* rule 3 can match eol */ | ||
| 994 | YY_RULE_SETUP | ||
| 995 | #line 111 "dtc-lexer.l" | ||
| 996 | { | ||
| 997 | DPRINT("String: %s\n", yytext); | ||
| 998 | yylval.data = data_copy_escape_string(yytext+1, | ||
| 999 | yyleng-2); | ||
| 1000 | return DT_STRING; | ||
| 1001 | } | ||
| 1002 | YY_BREAK | ||
| 1003 | case 4: | ||
| 1004 | YY_RULE_SETUP | ||
| 1005 | #line 118 "dtc-lexer.l" | ||
| 1006 | { | ||
| 1007 | DPRINT("Keyword: /dts-v1/\n"); | ||
| 1008 | dts_version = 1; | ||
| 1009 | BEGIN_DEFAULT(); | ||
| 1010 | return DT_V1; | ||
| 1011 | } | ||
| 1012 | YY_BREAK | ||
| 1013 | case 5: | ||
| 1014 | YY_RULE_SETUP | ||
| 1015 | #line 125 "dtc-lexer.l" | ||
| 1016 | { | ||
| 1017 | DPRINT("Keyword: /plugin/\n"); | ||
| 1018 | return DT_PLUGIN; | ||
| 1019 | } | ||
| 1020 | YY_BREAK | ||
| 1021 | case 6: | ||
| 1022 | YY_RULE_SETUP | ||
| 1023 | #line 130 "dtc-lexer.l" | ||
| 1024 | { | ||
| 1025 | DPRINT("Keyword: /memreserve/\n"); | ||
| 1026 | BEGIN_DEFAULT(); | ||
| 1027 | return DT_MEMRESERVE; | ||
| 1028 | } | ||
| 1029 | YY_BREAK | ||
| 1030 | case 7: | ||
| 1031 | YY_RULE_SETUP | ||
| 1032 | #line 136 "dtc-lexer.l" | ||
| 1033 | { | ||
| 1034 | DPRINT("Keyword: /bits/\n"); | ||
| 1035 | BEGIN_DEFAULT(); | ||
| 1036 | return DT_BITS; | ||
| 1037 | } | ||
| 1038 | YY_BREAK | ||
| 1039 | case 8: | ||
| 1040 | YY_RULE_SETUP | ||
| 1041 | #line 142 "dtc-lexer.l" | ||
| 1042 | { | ||
| 1043 | DPRINT("Keyword: /delete-property/\n"); | ||
| 1044 | DPRINT("<PROPNODENAME>\n"); | ||
| 1045 | BEGIN(PROPNODENAME); | ||
| 1046 | return DT_DEL_PROP; | ||
| 1047 | } | ||
| 1048 | YY_BREAK | ||
| 1049 | case 9: | ||
| 1050 | YY_RULE_SETUP | ||
| 1051 | #line 149 "dtc-lexer.l" | ||
| 1052 | { | ||
| 1053 | DPRINT("Keyword: /delete-node/\n"); | ||
| 1054 | DPRINT("<PROPNODENAME>\n"); | ||
| 1055 | BEGIN(PROPNODENAME); | ||
| 1056 | return DT_DEL_NODE; | ||
| 1057 | } | ||
| 1058 | YY_BREAK | ||
| 1059 | case 10: | ||
| 1060 | YY_RULE_SETUP | ||
| 1061 | #line 156 "dtc-lexer.l" | ||
| 1062 | { | ||
| 1063 | DPRINT("Label: %s\n", yytext); | ||
| 1064 | yylval.labelref = xstrdup(yytext); | ||
| 1065 | yylval.labelref[yyleng-1] = '\0'; | ||
| 1066 | return DT_LABEL; | ||
| 1067 | } | ||
| 1068 | YY_BREAK | ||
| 1069 | case 11: | ||
| 1070 | YY_RULE_SETUP | ||
| 1071 | #line 163 "dtc-lexer.l" | ||
| 1072 | { | ||
| 1073 | char *e; | ||
| 1074 | DPRINT("Integer Literal: '%s'\n", yytext); | ||
| 1075 | |||
| 1076 | errno = 0; | ||
| 1077 | yylval.integer = strtoull(yytext, &e, 0); | ||
| 1078 | |||
| 1079 | if (*e && e[strspn(e, "UL")]) { | ||
| 1080 | lexical_error("Bad integer literal '%s'", | ||
| 1081 | yytext); | ||
| 1082 | } | ||
| 1083 | |||
| 1084 | if (errno == ERANGE) | ||
| 1085 | lexical_error("Integer literal '%s' out of range", | ||
| 1086 | yytext); | ||
| 1087 | else | ||
| 1088 | /* ERANGE is the only strtoull error triggerable | ||
| 1089 | * by strings matching the pattern */ | ||
| 1090 | assert(errno == 0); | ||
| 1091 | return DT_LITERAL; | ||
| 1092 | } | ||
| 1093 | YY_BREAK | ||
| 1094 | case 12: | ||
| 1095 | /* rule 12 can match eol */ | ||
| 1096 | YY_RULE_SETUP | ||
| 1097 | #line 185 "dtc-lexer.l" | ||
| 1098 | { | ||
| 1099 | struct data d; | ||
| 1100 | DPRINT("Character literal: %s\n", yytext); | ||
| 1101 | |||
| 1102 | d = data_copy_escape_string(yytext+1, yyleng-2); | ||
| 1103 | if (d.len == 1) { | ||
| 1104 | lexical_error("Empty character literal"); | ||
| 1105 | yylval.integer = 0; | ||
| 1106 | } else { | ||
| 1107 | yylval.integer = (unsigned char)d.val[0]; | ||
| 1108 | |||
| 1109 | if (d.len > 2) | ||
| 1110 | lexical_error("Character literal has %d" | ||
| 1111 | " characters instead of 1", | ||
| 1112 | d.len - 1); | ||
| 1113 | } | ||
| 1114 | |||
| 1115 | data_free(d); | ||
| 1116 | return DT_CHAR_LITERAL; | ||
| 1117 | } | ||
| 1118 | YY_BREAK | ||
| 1119 | case 13: | ||
| 1120 | YY_RULE_SETUP | ||
| 1121 | #line 206 "dtc-lexer.l" | ||
| 1122 | { /* label reference */ | ||
| 1123 | DPRINT("Ref: %s\n", yytext+1); | ||
| 1124 | yylval.labelref = xstrdup(yytext+1); | ||
| 1125 | return DT_REF; | ||
| 1126 | } | ||
| 1127 | YY_BREAK | ||
| 1128 | case 14: | ||
| 1129 | YY_RULE_SETUP | ||
| 1130 | #line 212 "dtc-lexer.l" | ||
| 1131 | { /* new-style path reference */ | ||
| 1132 | yytext[yyleng-1] = '\0'; | ||
| 1133 | DPRINT("Ref: %s\n", yytext+2); | ||
| 1134 | yylval.labelref = xstrdup(yytext+2); | ||
| 1135 | return DT_REF; | ||
| 1136 | } | ||
| 1137 | YY_BREAK | ||
| 1138 | case 15: | ||
| 1139 | YY_RULE_SETUP | ||
| 1140 | #line 219 "dtc-lexer.l" | ||
| 1141 | { | ||
| 1142 | yylval.byte = strtol(yytext, NULL, 16); | ||
| 1143 | DPRINT("Byte: %02x\n", (int)yylval.byte); | ||
| 1144 | return DT_BYTE; | ||
| 1145 | } | ||
| 1146 | YY_BREAK | ||
| 1147 | case 16: | ||
| 1148 | YY_RULE_SETUP | ||
| 1149 | #line 225 "dtc-lexer.l" | ||
| 1150 | { | ||
| 1151 | DPRINT("/BYTESTRING\n"); | ||
| 1152 | BEGIN_DEFAULT(); | ||
| 1153 | return ']'; | ||
| 1154 | } | ||
| 1155 | YY_BREAK | ||
| 1156 | case 17: | ||
| 1157 | YY_RULE_SETUP | ||
| 1158 | #line 231 "dtc-lexer.l" | ||
| 1159 | { | ||
| 1160 | DPRINT("PropNodeName: %s\n", yytext); | ||
| 1161 | yylval.propnodename = xstrdup((yytext[0] == '\\') ? | ||
| 1162 | yytext + 1 : yytext); | ||
| 1163 | BEGIN_DEFAULT(); | ||
| 1164 | return DT_PROPNODENAME; | ||
| 1165 | } | ||
| 1166 | YY_BREAK | ||
| 1167 | case 18: | ||
| 1168 | YY_RULE_SETUP | ||
| 1169 | #line 239 "dtc-lexer.l" | ||
| 1170 | { | ||
| 1171 | DPRINT("Binary Include\n"); | ||
| 1172 | return DT_INCBIN; | ||
| 1173 | } | ||
| 1174 | YY_BREAK | ||
| 1175 | case 19: | ||
| 1176 | /* rule 19 can match eol */ | ||
| 1177 | YY_RULE_SETUP | ||
| 1178 | #line 244 "dtc-lexer.l" | ||
| 1179 | /* eat whitespace */ | ||
| 1180 | YY_BREAK | ||
| 1181 | case 20: | ||
| 1182 | /* rule 20 can match eol */ | ||
| 1183 | YY_RULE_SETUP | ||
| 1184 | #line 245 "dtc-lexer.l" | ||
| 1185 | /* eat C-style comments */ | ||
| 1186 | YY_BREAK | ||
| 1187 | case 21: | ||
| 1188 | /* rule 21 can match eol */ | ||
| 1189 | YY_RULE_SETUP | ||
| 1190 | #line 246 "dtc-lexer.l" | ||
| 1191 | /* eat C++-style comments */ | ||
| 1192 | YY_BREAK | ||
| 1193 | case 22: | ||
| 1194 | YY_RULE_SETUP | ||
| 1195 | #line 248 "dtc-lexer.l" | ||
| 1196 | { return DT_LSHIFT; }; | ||
| 1197 | YY_BREAK | ||
| 1198 | case 23: | ||
| 1199 | YY_RULE_SETUP | ||
| 1200 | #line 249 "dtc-lexer.l" | ||
| 1201 | { return DT_RSHIFT; }; | ||
| 1202 | YY_BREAK | ||
| 1203 | case 24: | ||
| 1204 | YY_RULE_SETUP | ||
| 1205 | #line 250 "dtc-lexer.l" | ||
| 1206 | { return DT_LE; }; | ||
| 1207 | YY_BREAK | ||
| 1208 | case 25: | ||
| 1209 | YY_RULE_SETUP | ||
| 1210 | #line 251 "dtc-lexer.l" | ||
| 1211 | { return DT_GE; }; | ||
| 1212 | YY_BREAK | ||
| 1213 | case 26: | ||
| 1214 | YY_RULE_SETUP | ||
| 1215 | #line 252 "dtc-lexer.l" | ||
| 1216 | { return DT_EQ; }; | ||
| 1217 | YY_BREAK | ||
| 1218 | case 27: | ||
| 1219 | YY_RULE_SETUP | ||
| 1220 | #line 253 "dtc-lexer.l" | ||
| 1221 | { return DT_NE; }; | ||
| 1222 | YY_BREAK | ||
| 1223 | case 28: | ||
| 1224 | YY_RULE_SETUP | ||
| 1225 | #line 254 "dtc-lexer.l" | ||
| 1226 | { return DT_AND; }; | ||
| 1227 | YY_BREAK | ||
| 1228 | case 29: | ||
| 1229 | YY_RULE_SETUP | ||
| 1230 | #line 255 "dtc-lexer.l" | ||
| 1231 | { return DT_OR; }; | ||
| 1232 | YY_BREAK | ||
| 1233 | case 30: | ||
| 1234 | YY_RULE_SETUP | ||
| 1235 | #line 257 "dtc-lexer.l" | ||
| 1236 | { | ||
| 1237 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], | ||
| 1238 | (unsigned)yytext[0]); | ||
| 1239 | if (yytext[0] == '[') { | ||
| 1240 | DPRINT("<BYTESTRING>\n"); | ||
| 1241 | BEGIN(BYTESTRING); | ||
| 1242 | } | ||
| 1243 | if ((yytext[0] == '{') | ||
| 1244 | || (yytext[0] == ';')) { | ||
| 1245 | DPRINT("<PROPNODENAME>\n"); | ||
| 1246 | BEGIN(PROPNODENAME); | ||
| 1247 | } | ||
| 1248 | return yytext[0]; | ||
| 1249 | } | ||
| 1250 | YY_BREAK | ||
| 1251 | case 31: | ||
| 1252 | YY_RULE_SETUP | ||
| 1253 | #line 272 "dtc-lexer.l" | ||
| 1254 | ECHO; | ||
| 1255 | YY_BREAK | ||
| 1256 | #line 1257 "dtc-lexer.lex.c" | ||
| 1257 | |||
| 1258 | case YY_END_OF_BUFFER: | ||
| 1259 | { | ||
| 1260 | /* Amount of text matched not including the EOB char. */ | ||
| 1261 | int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; | ||
| 1262 | |||
| 1263 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ | ||
| 1264 | *yy_cp = (yy_hold_char); | ||
| 1265 | YY_RESTORE_YY_MORE_OFFSET | ||
| 1266 | |||
| 1267 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) | ||
| 1268 | { | ||
| 1269 | /* We're scanning a new file or input source. It's | ||
| 1270 | * possible that this happened because the user | ||
| 1271 | * just pointed yyin at a new source and called | ||
| 1272 | * yylex(). If so, then we have to assure | ||
| 1273 | * consistency between YY_CURRENT_BUFFER and our | ||
| 1274 | * globals. Here is the right place to do so, because | ||
| 1275 | * this is the first action (other than possibly a | ||
| 1276 | * back-up) that will match for the new input source. | ||
| 1277 | */ | ||
| 1278 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | ||
| 1279 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; | ||
| 1280 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; | ||
| 1281 | } | ||
| 1282 | |||
| 1283 | /* Note that here we test for yy_c_buf_p "<=" to the position | ||
| 1284 | * of the first EOB in the buffer, since yy_c_buf_p will | ||
| 1285 | * already have been incremented past the NUL character | ||
| 1286 | * (since all states make transitions on EOB to the | ||
| 1287 | * end-of-buffer state). Contrast this with the test | ||
| 1288 | * in input(). | ||
| 1289 | */ | ||
| 1290 | if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) | ||
| 1291 | { /* This was really a NUL. */ | ||
| 1292 | yy_state_type yy_next_state; | ||
| 1293 | |||
| 1294 | (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; | ||
| 1295 | |||
| 1296 | yy_current_state = yy_get_previous_state( ); | ||
| 1297 | |||
| 1298 | /* Okay, we're now positioned to make the NUL | ||
| 1299 | * transition. We couldn't have | ||
| 1300 | * yy_get_previous_state() go ahead and do it | ||
| 1301 | * for us because it doesn't know how to deal | ||
| 1302 | * with the possibility of jamming (and we don't | ||
| 1303 | * want to build jamming into it because then it | ||
| 1304 | * will run more slowly). | ||
| 1305 | */ | ||
| 1306 | |||
| 1307 | yy_next_state = yy_try_NUL_trans( yy_current_state ); | ||
| 1308 | |||
| 1309 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
| 1310 | |||
| 1311 | if ( yy_next_state ) | ||
| 1312 | { | ||
| 1313 | /* Consume the NUL. */ | ||
| 1314 | yy_cp = ++(yy_c_buf_p); | ||
| 1315 | yy_current_state = yy_next_state; | ||
| 1316 | goto yy_match; | ||
| 1317 | } | ||
| 1318 | |||
| 1319 | else | ||
| 1320 | { | ||
| 1321 | yy_cp = (yy_last_accepting_cpos); | ||
| 1322 | yy_current_state = (yy_last_accepting_state); | ||
| 1323 | goto yy_find_action; | ||
| 1324 | } | ||
| 1325 | } | ||
| 1326 | |||
| 1327 | else switch ( yy_get_next_buffer( ) ) | ||
| 1328 | { | ||
| 1329 | case EOB_ACT_END_OF_FILE: | ||
| 1330 | { | ||
| 1331 | (yy_did_buffer_switch_on_eof) = 0; | ||
| 1332 | |||
| 1333 | if ( yywrap( ) ) | ||
| 1334 | { | ||
| 1335 | /* Note: because we've taken care in | ||
| 1336 | * yy_get_next_buffer() to have set up | ||
| 1337 | * yytext, we can now set up | ||
| 1338 | * yy_c_buf_p so that if some total | ||
| 1339 | * hoser (like flex itself) wants to | ||
| 1340 | * call the scanner after we return the | ||
| 1341 | * YY_NULL, it'll still work - another | ||
| 1342 | * YY_NULL will get returned. | ||
| 1343 | */ | ||
| 1344 | (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; | ||
| 1345 | |||
| 1346 | yy_act = YY_STATE_EOF(YY_START); | ||
| 1347 | goto do_action; | ||
| 1348 | } | ||
| 1349 | |||
| 1350 | else | ||
| 1351 | { | ||
| 1352 | if ( ! (yy_did_buffer_switch_on_eof) ) | ||
| 1353 | YY_NEW_FILE; | ||
| 1354 | } | ||
| 1355 | break; | ||
| 1356 | } | ||
| 1357 | |||
| 1358 | case EOB_ACT_CONTINUE_SCAN: | ||
| 1359 | (yy_c_buf_p) = | ||
| 1360 | (yytext_ptr) + yy_amount_of_matched_text; | ||
| 1361 | |||
| 1362 | yy_current_state = yy_get_previous_state( ); | ||
| 1363 | |||
| 1364 | yy_cp = (yy_c_buf_p); | ||
| 1365 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
| 1366 | goto yy_match; | ||
| 1367 | |||
| 1368 | case EOB_ACT_LAST_MATCH: | ||
| 1369 | (yy_c_buf_p) = | ||
| 1370 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; | ||
| 1371 | |||
| 1372 | yy_current_state = yy_get_previous_state( ); | ||
| 1373 | |||
| 1374 | yy_cp = (yy_c_buf_p); | ||
| 1375 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
| 1376 | goto yy_find_action; | ||
| 1377 | } | ||
| 1378 | break; | ||
| 1379 | } | ||
| 1380 | |||
| 1381 | default: | ||
| 1382 | YY_FATAL_ERROR( | ||
| 1383 | "fatal flex scanner internal error--no action found" ); | ||
| 1384 | } /* end of action switch */ | ||
| 1385 | } /* end of scanning one token */ | ||
| 1386 | } /* end of user's declarations */ | ||
| 1387 | } /* end of yylex */ | ||
| 1388 | |||
| 1389 | /* yy_get_next_buffer - try to read in a new buffer | ||
| 1390 | * | ||
| 1391 | * Returns a code representing an action: | ||
| 1392 | * EOB_ACT_LAST_MATCH - | ||
| 1393 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position | ||
| 1394 | * EOB_ACT_END_OF_FILE - end of file | ||
| 1395 | */ | ||
| 1396 | static int yy_get_next_buffer (void) | ||
| 1397 | { | ||
| 1398 | char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; | ||
| 1399 | char *source = (yytext_ptr); | ||
| 1400 | int number_to_move, i; | ||
| 1401 | int ret_val; | ||
| 1402 | |||
| 1403 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) | ||
| 1404 | YY_FATAL_ERROR( | ||
| 1405 | "fatal flex scanner internal error--end of buffer missed" ); | ||
| 1406 | |||
| 1407 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) | ||
| 1408 | { /* Don't try to fill the buffer, so this is an EOF. */ | ||
| 1409 | if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) | ||
| 1410 | { | ||
| 1411 | /* We matched a single character, the EOB, so | ||
| 1412 | * treat this as a final EOF. | ||
| 1413 | */ | ||
| 1414 | return EOB_ACT_END_OF_FILE; | ||
| 1415 | } | ||
| 1416 | |||
| 1417 | else | ||
| 1418 | { | ||
| 1419 | /* We matched some text prior to the EOB, first | ||
| 1420 | * process it. | ||
| 1421 | */ | ||
| 1422 | return EOB_ACT_LAST_MATCH; | ||
| 1423 | } | ||
| 1424 | } | ||
| 1425 | |||
| 1426 | /* Try to read more data. */ | ||
| 1427 | |||
| 1428 | /* First move last chars to start of buffer. */ | ||
| 1429 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); | ||
| 1430 | |||
| 1431 | for ( i = 0; i < number_to_move; ++i ) | ||
| 1432 | *(dest++) = *(source++); | ||
| 1433 | |||
| 1434 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) | ||
| 1435 | /* don't do the read, it's not guaranteed to return an EOF, | ||
| 1436 | * just force an EOF | ||
| 1437 | */ | ||
| 1438 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; | ||
| 1439 | |||
| 1440 | else | ||
| 1441 | { | ||
| 1442 | int num_to_read = | ||
| 1443 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; | ||
| 1444 | |||
| 1445 | while ( num_to_read <= 0 ) | ||
| 1446 | { /* Not enough room in the buffer - grow it. */ | ||
| 1447 | |||
| 1448 | /* just a shorter name for the current buffer */ | ||
| 1449 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; | ||
| 1450 | |||
| 1451 | int yy_c_buf_p_offset = | ||
| 1452 | (int) ((yy_c_buf_p) - b->yy_ch_buf); | ||
| 1453 | |||
| 1454 | if ( b->yy_is_our_buffer ) | ||
| 1455 | { | ||
| 1456 | int new_size = b->yy_buf_size * 2; | ||
| 1457 | |||
| 1458 | if ( new_size <= 0 ) | ||
| 1459 | b->yy_buf_size += b->yy_buf_size / 8; | ||
| 1460 | else | ||
| 1461 | b->yy_buf_size *= 2; | ||
| 1462 | |||
| 1463 | b->yy_ch_buf = (char *) | ||
| 1464 | /* Include room in for 2 EOB chars. */ | ||
| 1465 | yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); | ||
| 1466 | } | ||
| 1467 | else | ||
| 1468 | /* Can't grow it, we don't own it. */ | ||
| 1469 | b->yy_ch_buf = NULL; | ||
| 1470 | |||
| 1471 | if ( ! b->yy_ch_buf ) | ||
| 1472 | YY_FATAL_ERROR( | ||
| 1473 | "fatal error - scanner input buffer overflow" ); | ||
| 1474 | |||
| 1475 | (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; | ||
| 1476 | |||
| 1477 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - | ||
| 1478 | number_to_move - 1; | ||
| 1479 | |||
| 1480 | } | ||
| 1481 | |||
| 1482 | if ( num_to_read > YY_READ_BUF_SIZE ) | ||
| 1483 | num_to_read = YY_READ_BUF_SIZE; | ||
| 1484 | |||
| 1485 | /* Read in more data. */ | ||
| 1486 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), | ||
| 1487 | (yy_n_chars), num_to_read ); | ||
| 1488 | |||
| 1489 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
| 1490 | } | ||
| 1491 | |||
| 1492 | if ( (yy_n_chars) == 0 ) | ||
| 1493 | { | ||
| 1494 | if ( number_to_move == YY_MORE_ADJ ) | ||
| 1495 | { | ||
| 1496 | ret_val = EOB_ACT_END_OF_FILE; | ||
| 1497 | yyrestart(yyin ); | ||
| 1498 | } | ||
| 1499 | |||
| 1500 | else | ||
| 1501 | { | ||
| 1502 | ret_val = EOB_ACT_LAST_MATCH; | ||
| 1503 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = | ||
| 1504 | YY_BUFFER_EOF_PENDING; | ||
| 1505 | } | ||
| 1506 | } | ||
| 1507 | |||
| 1508 | else | ||
| 1509 | ret_val = EOB_ACT_CONTINUE_SCAN; | ||
| 1510 | |||
| 1511 | if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { | ||
| 1512 | /* Extend the array by 50%, plus the number we really need. */ | ||
| 1513 | int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); | ||
| 1514 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); | ||
| 1515 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) | ||
| 1516 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); | ||
| 1517 | } | ||
| 1518 | |||
| 1519 | (yy_n_chars) += number_to_move; | ||
| 1520 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; | ||
| 1521 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; | ||
| 1522 | |||
| 1523 | (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; | ||
| 1524 | |||
| 1525 | return ret_val; | ||
| 1526 | } | ||
| 1527 | |||
| 1528 | /* yy_get_previous_state - get the state just before the EOB char was reached */ | ||
| 1529 | |||
| 1530 | static yy_state_type yy_get_previous_state (void) | ||
| 1531 | { | ||
| 1532 | yy_state_type yy_current_state; | ||
| 1533 | char *yy_cp; | ||
| 1534 | |||
| 1535 | yy_current_state = (yy_start); | ||
| 1536 | yy_current_state += YY_AT_BOL(); | ||
| 1537 | |||
| 1538 | for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) | ||
| 1539 | { | ||
| 1540 | YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); | ||
| 1541 | if ( yy_accept[yy_current_state] ) | ||
| 1542 | { | ||
| 1543 | (yy_last_accepting_state) = yy_current_state; | ||
| 1544 | (yy_last_accepting_cpos) = yy_cp; | ||
| 1545 | } | ||
| 1546 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | ||
| 1547 | { | ||
| 1548 | yy_current_state = (int) yy_def[yy_current_state]; | ||
| 1549 | if ( yy_current_state >= 166 ) | ||
| 1550 | yy_c = yy_meta[(unsigned int) yy_c]; | ||
| 1551 | } | ||
| 1552 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; | ||
| 1553 | } | ||
| 1554 | |||
| 1555 | return yy_current_state; | ||
| 1556 | } | ||
| 1557 | |||
| 1558 | /* yy_try_NUL_trans - try to make a transition on the NUL character | ||
| 1559 | * | ||
| 1560 | * synopsis | ||
| 1561 | * next_state = yy_try_NUL_trans( current_state ); | ||
| 1562 | */ | ||
| 1563 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) | ||
| 1564 | { | ||
| 1565 | int yy_is_jam; | ||
| 1566 | char *yy_cp = (yy_c_buf_p); | ||
| 1567 | |||
| 1568 | YY_CHAR yy_c = 1; | ||
| 1569 | if ( yy_accept[yy_current_state] ) | ||
| 1570 | { | ||
| 1571 | (yy_last_accepting_state) = yy_current_state; | ||
| 1572 | (yy_last_accepting_cpos) = yy_cp; | ||
| 1573 | } | ||
| 1574 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | ||
| 1575 | { | ||
| 1576 | yy_current_state = (int) yy_def[yy_current_state]; | ||
| 1577 | if ( yy_current_state >= 166 ) | ||
| 1578 | yy_c = yy_meta[(unsigned int) yy_c]; | ||
| 1579 | } | ||
| 1580 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; | ||
| 1581 | yy_is_jam = (yy_current_state == 165); | ||
| 1582 | |||
| 1583 | return yy_is_jam ? 0 : yy_current_state; | ||
| 1584 | } | ||
| 1585 | |||
| 1586 | #ifndef YY_NO_UNPUT | ||
| 1587 | |||
| 1588 | #endif | ||
| 1589 | |||
| 1590 | #ifndef YY_NO_INPUT | ||
| 1591 | #ifdef __cplusplus | ||
| 1592 | static int yyinput (void) | ||
| 1593 | #else | ||
| 1594 | static int input (void) | ||
| 1595 | #endif | ||
| 1596 | |||
| 1597 | { | ||
| 1598 | int c; | ||
| 1599 | |||
| 1600 | *(yy_c_buf_p) = (yy_hold_char); | ||
| 1601 | |||
| 1602 | if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) | ||
| 1603 | { | ||
| 1604 | /* yy_c_buf_p now points to the character we want to return. | ||
| 1605 | * If this occurs *before* the EOB characters, then it's a | ||
| 1606 | * valid NUL; if not, then we've hit the end of the buffer. | ||
| 1607 | */ | ||
| 1608 | if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) | ||
| 1609 | /* This was really a NUL. */ | ||
| 1610 | *(yy_c_buf_p) = '\0'; | ||
| 1611 | |||
| 1612 | else | ||
| 1613 | { /* need more input */ | ||
| 1614 | int offset = (yy_c_buf_p) - (yytext_ptr); | ||
| 1615 | ++(yy_c_buf_p); | ||
| 1616 | |||
| 1617 | switch ( yy_get_next_buffer( ) ) | ||
| 1618 | { | ||
| 1619 | case EOB_ACT_LAST_MATCH: | ||
| 1620 | /* This happens because yy_g_n_b() | ||
| 1621 | * sees that we've accumulated a | ||
| 1622 | * token and flags that we need to | ||
| 1623 | * try matching the token before | ||
| 1624 | * proceeding. But for input(), | ||
| 1625 | * there's no matching to consider. | ||
| 1626 | * So convert the EOB_ACT_LAST_MATCH | ||
| 1627 | * to EOB_ACT_END_OF_FILE. | ||
| 1628 | */ | ||
| 1629 | |||
| 1630 | /* Reset buffer status. */ | ||
| 1631 | yyrestart(yyin ); | ||
| 1632 | |||
| 1633 | /*FALLTHROUGH*/ | ||
| 1634 | |||
| 1635 | case EOB_ACT_END_OF_FILE: | ||
| 1636 | { | ||
| 1637 | if ( yywrap( ) ) | ||
| 1638 | return 0; | ||
| 1639 | |||
| 1640 | if ( ! (yy_did_buffer_switch_on_eof) ) | ||
| 1641 | YY_NEW_FILE; | ||
| 1642 | #ifdef __cplusplus | ||
| 1643 | return yyinput(); | ||
| 1644 | #else | ||
| 1645 | return input(); | ||
| 1646 | #endif | ||
| 1647 | } | ||
| 1648 | |||
| 1649 | case EOB_ACT_CONTINUE_SCAN: | ||
| 1650 | (yy_c_buf_p) = (yytext_ptr) + offset; | ||
| 1651 | break; | ||
| 1652 | } | ||
| 1653 | } | ||
| 1654 | } | ||
| 1655 | |||
| 1656 | c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ | ||
| 1657 | *(yy_c_buf_p) = '\0'; /* preserve yytext */ | ||
| 1658 | (yy_hold_char) = *++(yy_c_buf_p); | ||
| 1659 | |||
| 1660 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); | ||
| 1661 | |||
| 1662 | return c; | ||
| 1663 | } | ||
| 1664 | #endif /* ifndef YY_NO_INPUT */ | ||
| 1665 | |||
| 1666 | /** Immediately switch to a different input stream. | ||
| 1667 | * @param input_file A readable stream. | ||
| 1668 | * | ||
| 1669 | * @note This function does not reset the start condition to @c INITIAL . | ||
| 1670 | */ | ||
| 1671 | void yyrestart (FILE * input_file ) | ||
| 1672 | { | ||
| 1673 | |||
| 1674 | if ( ! YY_CURRENT_BUFFER ){ | ||
| 1675 | yyensure_buffer_stack (); | ||
| 1676 | YY_CURRENT_BUFFER_LVALUE = | ||
| 1677 | yy_create_buffer(yyin,YY_BUF_SIZE ); | ||
| 1678 | } | ||
| 1679 | |||
| 1680 | yy_init_buffer(YY_CURRENT_BUFFER,input_file ); | ||
| 1681 | yy_load_buffer_state( ); | ||
| 1682 | } | ||
| 1683 | |||
| 1684 | /** Switch to a different input buffer. | ||
| 1685 | * @param new_buffer The new input buffer. | ||
| 1686 | * | ||
| 1687 | */ | ||
| 1688 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) | ||
| 1689 | { | ||
| 1690 | |||
| 1691 | /* TODO. We should be able to replace this entire function body | ||
| 1692 | * with | ||
| 1693 | * yypop_buffer_state(); | ||
| 1694 | * yypush_buffer_state(new_buffer); | ||
| 1695 | */ | ||
| 1696 | yyensure_buffer_stack (); | ||
| 1697 | if ( YY_CURRENT_BUFFER == new_buffer ) | ||
| 1698 | return; | ||
| 1699 | |||
| 1700 | if ( YY_CURRENT_BUFFER ) | ||
| 1701 | { | ||
| 1702 | /* Flush out information for old buffer. */ | ||
| 1703 | *(yy_c_buf_p) = (yy_hold_char); | ||
| 1704 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); | ||
| 1705 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
| 1706 | } | ||
| 1707 | |||
| 1708 | YY_CURRENT_BUFFER_LVALUE = new_buffer; | ||
| 1709 | yy_load_buffer_state( ); | ||
| 1710 | |||
| 1711 | /* We don't actually know whether we did this switch during | ||
| 1712 | * EOF (yywrap()) processing, but the only time this flag | ||
| 1713 | * is looked at is after yywrap() is called, so it's safe | ||
| 1714 | * to go ahead and always set it. | ||
| 1715 | */ | ||
| 1716 | (yy_did_buffer_switch_on_eof) = 1; | ||
| 1717 | } | ||
| 1718 | |||
| 1719 | static void yy_load_buffer_state (void) | ||
| 1720 | { | ||
| 1721 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | ||
| 1722 | (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; | ||
| 1723 | yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; | ||
| 1724 | (yy_hold_char) = *(yy_c_buf_p); | ||
| 1725 | } | ||
| 1726 | |||
| 1727 | /** Allocate and initialize an input buffer state. | ||
| 1728 | * @param file A readable stream. | ||
| 1729 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. | ||
| 1730 | * | ||
| 1731 | * @return the allocated buffer state. | ||
| 1732 | */ | ||
| 1733 | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) | ||
| 1734 | { | ||
| 1735 | YY_BUFFER_STATE b; | ||
| 1736 | |||
| 1737 | b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); | ||
| 1738 | if ( ! b ) | ||
| 1739 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); | ||
| 1740 | |||
| 1741 | b->yy_buf_size = (yy_size_t)size; | ||
| 1742 | |||
| 1743 | /* yy_ch_buf has to be 2 characters longer than the size given because | ||
| 1744 | * we need to put in 2 end-of-buffer characters. | ||
| 1745 | */ | ||
| 1746 | b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); | ||
| 1747 | if ( ! b->yy_ch_buf ) | ||
| 1748 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); | ||
| 1749 | |||
| 1750 | b->yy_is_our_buffer = 1; | ||
| 1751 | |||
| 1752 | yy_init_buffer(b,file ); | ||
| 1753 | |||
| 1754 | return b; | ||
| 1755 | } | ||
| 1756 | |||
| 1757 | /** Destroy the buffer. | ||
| 1758 | * @param b a buffer created with yy_create_buffer() | ||
| 1759 | * | ||
| 1760 | */ | ||
| 1761 | void yy_delete_buffer (YY_BUFFER_STATE b ) | ||
| 1762 | { | ||
| 1763 | |||
| 1764 | if ( ! b ) | ||
| 1765 | return; | ||
| 1766 | |||
| 1767 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ | ||
| 1768 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; | ||
| 1769 | |||
| 1770 | if ( b->yy_is_our_buffer ) | ||
| 1771 | yyfree((void *) b->yy_ch_buf ); | ||
| 1772 | |||
| 1773 | yyfree((void *) b ); | ||
| 1774 | } | ||
| 1775 | |||
| 1776 | /* Initializes or reinitializes a buffer. | ||
| 1777 | * This function is sometimes called more than once on the same buffer, | ||
| 1778 | * such as during a yyrestart() or at EOF. | ||
| 1779 | */ | ||
| 1780 | static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) | ||
| 1781 | |||
| 1782 | { | ||
| 1783 | int oerrno = errno; | ||
| 1784 | |||
| 1785 | yy_flush_buffer(b ); | ||
| 1786 | |||
| 1787 | b->yy_input_file = file; | ||
| 1788 | b->yy_fill_buffer = 1; | ||
| 1789 | |||
| 1790 | /* If b is the current buffer, then yy_init_buffer was _probably_ | ||
| 1791 | * called from yyrestart() or through yy_get_next_buffer. | ||
| 1792 | * In that case, we don't want to reset the lineno or column. | ||
| 1793 | */ | ||
| 1794 | if (b != YY_CURRENT_BUFFER){ | ||
| 1795 | b->yy_bs_lineno = 1; | ||
| 1796 | b->yy_bs_column = 0; | ||
| 1797 | } | ||
| 1798 | |||
| 1799 | b->yy_is_interactive = 0; | ||
| 1800 | |||
| 1801 | errno = oerrno; | ||
| 1802 | } | ||
| 1803 | |||
| 1804 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. | ||
| 1805 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. | ||
| 1806 | * | ||
| 1807 | */ | ||
| 1808 | void yy_flush_buffer (YY_BUFFER_STATE b ) | ||
| 1809 | { | ||
| 1810 | if ( ! b ) | ||
| 1811 | return; | ||
| 1812 | |||
| 1813 | b->yy_n_chars = 0; | ||
| 1814 | |||
| 1815 | /* We always need two end-of-buffer characters. The first causes | ||
| 1816 | * a transition to the end-of-buffer state. The second causes | ||
| 1817 | * a jam in that state. | ||
| 1818 | */ | ||
| 1819 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; | ||
| 1820 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; | ||
| 1821 | |||
| 1822 | b->yy_buf_pos = &b->yy_ch_buf[0]; | ||
| 1823 | |||
| 1824 | b->yy_at_bol = 1; | ||
| 1825 | b->yy_buffer_status = YY_BUFFER_NEW; | ||
| 1826 | |||
| 1827 | if ( b == YY_CURRENT_BUFFER ) | ||
| 1828 | yy_load_buffer_state( ); | ||
| 1829 | } | ||
| 1830 | |||
| 1831 | /** Pushes the new state onto the stack. The new state becomes | ||
| 1832 | * the current state. This function will allocate the stack | ||
| 1833 | * if necessary. | ||
| 1834 | * @param new_buffer The new state. | ||
| 1835 | * | ||
| 1836 | */ | ||
| 1837 | void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) | ||
| 1838 | { | ||
| 1839 | if (new_buffer == NULL) | ||
| 1840 | return; | ||
| 1841 | |||
| 1842 | yyensure_buffer_stack(); | ||
| 1843 | |||
| 1844 | /* This block is copied from yy_switch_to_buffer. */ | ||
| 1845 | if ( YY_CURRENT_BUFFER ) | ||
| 1846 | { | ||
| 1847 | /* Flush out information for old buffer. */ | ||
| 1848 | *(yy_c_buf_p) = (yy_hold_char); | ||
| 1849 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); | ||
| 1850 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
| 1851 | } | ||
| 1852 | |||
| 1853 | /* Only push if top exists. Otherwise, replace top. */ | ||
| 1854 | if (YY_CURRENT_BUFFER) | ||
| 1855 | (yy_buffer_stack_top)++; | ||
| 1856 | YY_CURRENT_BUFFER_LVALUE = new_buffer; | ||
| 1857 | |||
| 1858 | /* copied from yy_switch_to_buffer. */ | ||
| 1859 | yy_load_buffer_state( ); | ||
| 1860 | (yy_did_buffer_switch_on_eof) = 1; | ||
| 1861 | } | ||
| 1862 | |||
| 1863 | /** Removes and deletes the top of the stack, if present. | ||
| 1864 | * The next element becomes the new top. | ||
| 1865 | * | ||
| 1866 | */ | ||
| 1867 | void yypop_buffer_state (void) | ||
| 1868 | { | ||
| 1869 | if (!YY_CURRENT_BUFFER) | ||
| 1870 | return; | ||
| 1871 | |||
| 1872 | yy_delete_buffer(YY_CURRENT_BUFFER ); | ||
| 1873 | YY_CURRENT_BUFFER_LVALUE = NULL; | ||
| 1874 | if ((yy_buffer_stack_top) > 0) | ||
| 1875 | --(yy_buffer_stack_top); | ||
| 1876 | |||
| 1877 | if (YY_CURRENT_BUFFER) { | ||
| 1878 | yy_load_buffer_state( ); | ||
| 1879 | (yy_did_buffer_switch_on_eof) = 1; | ||
| 1880 | } | ||
| 1881 | } | ||
| 1882 | |||
| 1883 | /* Allocates the stack if it does not exist. | ||
| 1884 | * Guarantees space for at least one push. | ||
| 1885 | */ | ||
| 1886 | static void yyensure_buffer_stack (void) | ||
| 1887 | { | ||
| 1888 | int num_to_alloc; | ||
| 1889 | |||
| 1890 | if (!(yy_buffer_stack)) { | ||
| 1891 | |||
| 1892 | /* First allocation is just for 2 elements, since we don't know if this | ||
| 1893 | * scanner will even need a stack. We use 2 instead of 1 to avoid an | ||
| 1894 | * immediate realloc on the next call. | ||
| 1895 | */ | ||
| 1896 | num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ | ||
| 1897 | (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc | ||
| 1898 | (num_to_alloc * sizeof(struct yy_buffer_state*) | ||
| 1899 | ); | ||
| 1900 | if ( ! (yy_buffer_stack) ) | ||
| 1901 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); | ||
| 1902 | |||
| 1903 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); | ||
| 1904 | |||
| 1905 | (yy_buffer_stack_max) = num_to_alloc; | ||
| 1906 | (yy_buffer_stack_top) = 0; | ||
| 1907 | return; | ||
| 1908 | } | ||
| 1909 | |||
| 1910 | if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ | ||
| 1911 | |||
| 1912 | /* Increase the buffer to prepare for a possible push. */ | ||
| 1913 | yy_size_t grow_size = 8 /* arbitrary grow size */; | ||
| 1914 | |||
| 1915 | num_to_alloc = (yy_buffer_stack_max) + grow_size; | ||
| 1916 | (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc | ||
| 1917 | ((yy_buffer_stack), | ||
| 1918 | num_to_alloc * sizeof(struct yy_buffer_state*) | ||
| 1919 | ); | ||
| 1920 | if ( ! (yy_buffer_stack) ) | ||
| 1921 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); | ||
| 1922 | |||
| 1923 | /* zero only the new slots.*/ | ||
| 1924 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); | ||
| 1925 | (yy_buffer_stack_max) = num_to_alloc; | ||
| 1926 | } | ||
| 1927 | } | ||
| 1928 | |||
| 1929 | /** Setup the input buffer state to scan directly from a user-specified character buffer. | ||
| 1930 | * @param base the character buffer | ||
| 1931 | * @param size the size in bytes of the character buffer | ||
| 1932 | * | ||
| 1933 | * @return the newly allocated buffer state object. | ||
| 1934 | */ | ||
| 1935 | YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) | ||
| 1936 | { | ||
| 1937 | YY_BUFFER_STATE b; | ||
| 1938 | |||
| 1939 | if ( size < 2 || | ||
| 1940 | base[size-2] != YY_END_OF_BUFFER_CHAR || | ||
| 1941 | base[size-1] != YY_END_OF_BUFFER_CHAR ) | ||
| 1942 | /* They forgot to leave room for the EOB's. */ | ||
| 1943 | return NULL; | ||
| 1944 | |||
| 1945 | b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); | ||
| 1946 | if ( ! b ) | ||
| 1947 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); | ||
| 1948 | |||
| 1949 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ | ||
| 1950 | b->yy_buf_pos = b->yy_ch_buf = base; | ||
| 1951 | b->yy_is_our_buffer = 0; | ||
| 1952 | b->yy_input_file = NULL; | ||
| 1953 | b->yy_n_chars = b->yy_buf_size; | ||
| 1954 | b->yy_is_interactive = 0; | ||
| 1955 | b->yy_at_bol = 1; | ||
| 1956 | b->yy_fill_buffer = 0; | ||
| 1957 | b->yy_buffer_status = YY_BUFFER_NEW; | ||
| 1958 | |||
| 1959 | yy_switch_to_buffer(b ); | ||
| 1960 | |||
| 1961 | return b; | ||
| 1962 | } | ||
| 1963 | |||
| 1964 | /** Setup the input buffer state to scan a string. The next call to yylex() will | ||
| 1965 | * scan from a @e copy of @a str. | ||
| 1966 | * @param yystr a NUL-terminated string to scan | ||
| 1967 | * | ||
| 1968 | * @return the newly allocated buffer state object. | ||
| 1969 | * @note If you want to scan bytes that may contain NUL values, then use | ||
| 1970 | * yy_scan_bytes() instead. | ||
| 1971 | */ | ||
| 1972 | YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) | ||
| 1973 | { | ||
| 1974 | |||
| 1975 | return yy_scan_bytes(yystr,(int) strlen(yystr) ); | ||
| 1976 | } | ||
| 1977 | |||
| 1978 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will | ||
| 1979 | * scan from a @e copy of @a bytes. | ||
| 1980 | * @param yybytes the byte buffer to scan | ||
| 1981 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. | ||
| 1982 | * | ||
| 1983 | * @return the newly allocated buffer state object. | ||
| 1984 | */ | ||
| 1985 | YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) | ||
| 1986 | { | ||
| 1987 | YY_BUFFER_STATE b; | ||
| 1988 | char *buf; | ||
| 1989 | yy_size_t n; | ||
| 1990 | int i; | ||
| 1991 | |||
| 1992 | /* Get memory for full buffer, including space for trailing EOB's. */ | ||
| 1993 | n = (yy_size_t) (_yybytes_len + 2); | ||
| 1994 | buf = (char *) yyalloc(n ); | ||
| 1995 | if ( ! buf ) | ||
| 1996 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); | ||
| 1997 | |||
| 1998 | for ( i = 0; i < _yybytes_len; ++i ) | ||
| 1999 | buf[i] = yybytes[i]; | ||
| 2000 | |||
| 2001 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; | ||
| 2002 | |||
| 2003 | b = yy_scan_buffer(buf,n ); | ||
| 2004 | if ( ! b ) | ||
| 2005 | YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); | ||
| 2006 | |||
| 2007 | /* It's okay to grow etc. this buffer, and we should throw it | ||
| 2008 | * away when we're done. | ||
| 2009 | */ | ||
| 2010 | b->yy_is_our_buffer = 1; | ||
| 2011 | |||
| 2012 | return b; | ||
| 2013 | } | ||
| 2014 | |||
| 2015 | #ifndef YY_EXIT_FAILURE | ||
| 2016 | #define YY_EXIT_FAILURE 2 | ||
| 2017 | #endif | ||
| 2018 | |||
| 2019 | static void yynoreturn yy_fatal_error (yyconst char* msg ) | ||
| 2020 | { | ||
| 2021 | (void) fprintf( stderr, "%s\n", msg ); | ||
| 2022 | exit( YY_EXIT_FAILURE ); | ||
| 2023 | } | ||
| 2024 | |||
| 2025 | /* Redefine yyless() so it works in section 3 code. */ | ||
| 2026 | |||
| 2027 | #undef yyless | ||
| 2028 | #define yyless(n) \ | ||
| 2029 | do \ | ||
| 2030 | { \ | ||
| 2031 | /* Undo effects of setting up yytext. */ \ | ||
| 2032 | int yyless_macro_arg = (n); \ | ||
| 2033 | YY_LESS_LINENO(yyless_macro_arg);\ | ||
| 2034 | yytext[yyleng] = (yy_hold_char); \ | ||
| 2035 | (yy_c_buf_p) = yytext + yyless_macro_arg; \ | ||
| 2036 | (yy_hold_char) = *(yy_c_buf_p); \ | ||
| 2037 | *(yy_c_buf_p) = '\0'; \ | ||
| 2038 | yyleng = yyless_macro_arg; \ | ||
| 2039 | } \ | ||
| 2040 | while ( 0 ) | ||
| 2041 | |||
| 2042 | /* Accessor methods (get/set functions) to struct members. */ | ||
| 2043 | |||
| 2044 | /** Get the current line number. | ||
| 2045 | * | ||
| 2046 | */ | ||
| 2047 | int yyget_lineno (void) | ||
| 2048 | { | ||
| 2049 | |||
| 2050 | return yylineno; | ||
| 2051 | } | ||
| 2052 | |||
| 2053 | /** Get the input stream. | ||
| 2054 | * | ||
| 2055 | */ | ||
| 2056 | FILE *yyget_in (void) | ||
| 2057 | { | ||
| 2058 | return yyin; | ||
| 2059 | } | ||
| 2060 | |||
| 2061 | /** Get the output stream. | ||
| 2062 | * | ||
| 2063 | */ | ||
| 2064 | FILE *yyget_out (void) | ||
| 2065 | { | ||
| 2066 | return yyout; | ||
| 2067 | } | ||
| 2068 | |||
| 2069 | /** Get the length of the current token. | ||
| 2070 | * | ||
| 2071 | */ | ||
| 2072 | int yyget_leng (void) | ||
| 2073 | { | ||
| 2074 | return yyleng; | ||
| 2075 | } | ||
| 2076 | |||
| 2077 | /** Get the current token. | ||
| 2078 | * | ||
| 2079 | */ | ||
| 2080 | |||
| 2081 | char *yyget_text (void) | ||
| 2082 | { | ||
| 2083 | return yytext; | ||
| 2084 | } | ||
| 2085 | |||
| 2086 | /** Set the current line number. | ||
| 2087 | * @param _line_number line number | ||
| 2088 | * | ||
| 2089 | */ | ||
| 2090 | void yyset_lineno (int _line_number ) | ||
| 2091 | { | ||
| 2092 | |||
| 2093 | yylineno = _line_number; | ||
| 2094 | } | ||
| 2095 | |||
| 2096 | /** Set the input stream. This does not discard the current | ||
| 2097 | * input buffer. | ||
| 2098 | * @param _in_str A readable stream. | ||
| 2099 | * | ||
| 2100 | * @see yy_switch_to_buffer | ||
| 2101 | */ | ||
| 2102 | void yyset_in (FILE * _in_str ) | ||
| 2103 | { | ||
| 2104 | yyin = _in_str ; | ||
| 2105 | } | ||
| 2106 | |||
| 2107 | void yyset_out (FILE * _out_str ) | ||
| 2108 | { | ||
| 2109 | yyout = _out_str ; | ||
| 2110 | } | ||
| 2111 | |||
| 2112 | int yyget_debug (void) | ||
| 2113 | { | ||
| 2114 | return yy_flex_debug; | ||
| 2115 | } | ||
| 2116 | |||
| 2117 | void yyset_debug (int _bdebug ) | ||
| 2118 | { | ||
| 2119 | yy_flex_debug = _bdebug ; | ||
| 2120 | } | ||
| 2121 | |||
| 2122 | static int yy_init_globals (void) | ||
| 2123 | { | ||
| 2124 | /* Initialization is the same as for the non-reentrant scanner. | ||
| 2125 | * This function is called from yylex_destroy(), so don't allocate here. | ||
| 2126 | */ | ||
| 2127 | |||
| 2128 | (yy_buffer_stack) = NULL; | ||
| 2129 | (yy_buffer_stack_top) = 0; | ||
| 2130 | (yy_buffer_stack_max) = 0; | ||
| 2131 | (yy_c_buf_p) = NULL; | ||
| 2132 | (yy_init) = 0; | ||
| 2133 | (yy_start) = 0; | ||
| 2134 | |||
| 2135 | /* Defined in main.c */ | ||
| 2136 | #ifdef YY_STDINIT | ||
| 2137 | yyin = stdin; | ||
| 2138 | yyout = stdout; | ||
| 2139 | #else | ||
| 2140 | yyin = NULL; | ||
| 2141 | yyout = NULL; | ||
| 2142 | #endif | ||
| 2143 | |||
| 2144 | /* For future reference: Set errno on error, since we are called by | ||
| 2145 | * yylex_init() | ||
| 2146 | */ | ||
| 2147 | return 0; | ||
| 2148 | } | ||
| 2149 | |||
| 2150 | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ | ||
| 2151 | int yylex_destroy (void) | ||
| 2152 | { | ||
| 2153 | |||
| 2154 | /* Pop the buffer stack, destroying each element. */ | ||
| 2155 | while(YY_CURRENT_BUFFER){ | ||
| 2156 | yy_delete_buffer(YY_CURRENT_BUFFER ); | ||
| 2157 | YY_CURRENT_BUFFER_LVALUE = NULL; | ||
| 2158 | yypop_buffer_state(); | ||
| 2159 | } | ||
| 2160 | |||
| 2161 | /* Destroy the stack itself. */ | ||
| 2162 | yyfree((yy_buffer_stack) ); | ||
| 2163 | (yy_buffer_stack) = NULL; | ||
| 2164 | |||
| 2165 | /* Reset the globals. This is important in a non-reentrant scanner so the next time | ||
| 2166 | * yylex() is called, initialization will occur. */ | ||
| 2167 | yy_init_globals( ); | ||
| 2168 | |||
| 2169 | return 0; | ||
| 2170 | } | ||
| 2171 | |||
| 2172 | /* | ||
| 2173 | * Internal utility routines. | ||
| 2174 | */ | ||
| 2175 | |||
| 2176 | #ifndef yytext_ptr | ||
| 2177 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) | ||
| 2178 | { | ||
| 2179 | |||
| 2180 | int i; | ||
| 2181 | for ( i = 0; i < n; ++i ) | ||
| 2182 | s1[i] = s2[i]; | ||
| 2183 | } | ||
| 2184 | #endif | ||
| 2185 | |||
| 2186 | #ifdef YY_NEED_STRLEN | ||
| 2187 | static int yy_flex_strlen (yyconst char * s ) | ||
| 2188 | { | ||
| 2189 | int n; | ||
| 2190 | for ( n = 0; s[n]; ++n ) | ||
| 2191 | ; | ||
| 2192 | |||
| 2193 | return n; | ||
| 2194 | } | ||
| 2195 | #endif | ||
| 2196 | |||
| 2197 | void *yyalloc (yy_size_t size ) | ||
| 2198 | { | ||
| 2199 | return malloc(size); | ||
| 2200 | } | ||
| 2201 | |||
| 2202 | void *yyrealloc (void * ptr, yy_size_t size ) | ||
| 2203 | { | ||
| 2204 | |||
| 2205 | /* The cast to (char *) in the following accommodates both | ||
| 2206 | * implementations that use char* generic pointers, and those | ||
| 2207 | * that use void* generic pointers. It works with the latter | ||
| 2208 | * because both ANSI C and C++ allow castless assignment from | ||
| 2209 | * any pointer type to void*, and deal with argument conversions | ||
| 2210 | * as though doing an assignment. | ||
| 2211 | */ | ||
| 2212 | return realloc(ptr, size); | ||
| 2213 | } | ||
| 2214 | |||
| 2215 | void yyfree (void * ptr ) | ||
| 2216 | { | ||
| 2217 | free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ | ||
| 2218 | } | ||
| 2219 | |||
| 2220 | #define YYTABLES_NAME "yytables" | ||
| 2221 | |||
| 2222 | #line 272 "dtc-lexer.l" | ||
| 2223 | |||
| 2224 | |||
| 2225 | |||
| 2226 | static void push_input_file(const char *filename) | ||
| 2227 | { | ||
| 2228 | assert(filename); | ||
| 2229 | |||
| 2230 | srcfile_push(filename); | ||
| 2231 | |||
| 2232 | yyin = current_srcfile->f; | ||
| 2233 | |||
| 2234 | yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE)); | ||
| 2235 | } | ||
| 2236 | |||
| 2237 | |||
| 2238 | static bool pop_input_file(void) | ||
| 2239 | { | ||
| 2240 | if (srcfile_pop() == 0) | ||
| 2241 | return false; | ||
| 2242 | |||
| 2243 | yypop_buffer_state(); | ||
| 2244 | yyin = current_srcfile->f; | ||
| 2245 | |||
| 2246 | return true; | ||
| 2247 | } | ||
| 2248 | |||
| 2249 | static void lexical_error(const char *fmt, ...) | ||
| 2250 | { | ||
| 2251 | va_list ap; | ||
| 2252 | |||
| 2253 | va_start(ap, fmt); | ||
| 2254 | srcpos_verror(&yylloc, "Lexical error", fmt, ap); | ||
| 2255 | va_end(ap); | ||
| 2256 | |||
| 2257 | treesource_error = true; | ||
| 2258 | } | ||
| 2259 | |||
diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped deleted file mode 100644 index aea514fa6928..000000000000 --- a/scripts/dtc/dtc-parser.tab.c_shipped +++ /dev/null | |||
| @@ -1,2321 +0,0 @@ | |||
| 1 | /* A Bison parser, made by GNU Bison 3.0.4. */ | ||
| 2 | |||
| 3 | /* Bison implementation for Yacc-like parsers in C | ||
| 4 | |||
| 5 | Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. | ||
| 6 | |||
| 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 | ||
| 9 | the Free Software Foundation, either version 3 of the License, or | ||
| 10 | (at your option) any later version. | ||
| 11 | |||
| 12 | This program is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 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/>. */ | ||
| 19 | |||
| 20 | /* As a special exception, you may create a larger work that contains | ||
| 21 | part or all of the Bison parser skeleton and distribute that work | ||
| 22 | under terms of your choice, so long as that work isn't itself a | ||
| 23 | parser generator using the skeleton or a modified version thereof | ||
| 24 | as a parser skeleton. Alternatively, if you modify or redistribute | ||
| 25 | the parser skeleton itself, you may (at your option) remove this | ||
| 26 | special exception, which will cause the skeleton and the resulting | ||
| 27 | Bison output files to be licensed under the GNU General Public | ||
| 28 | License without this special exception. | ||
| 29 | |||
| 30 | This special exception was added by the Free Software Foundation in | ||
| 31 | version 2.2 of Bison. */ | ||
| 32 | |||
| 33 | /* C LALR(1) parser skeleton written by Richard Stallman, by | ||
| 34 | simplifying the original so-called "semantic" parser. */ | ||
| 35 | |||
| 36 | /* All symbols defined below should begin with yy or YY, to avoid | ||
| 37 | infringing on user name space. This should be done even for local | ||
| 38 | variables, as they might otherwise be expanded by user macros. | ||
| 39 | There are some unavoidable exceptions within include files to | ||
| 40 | define necessary library symbols; they are noted "INFRINGES ON | ||
| 41 | USER NAME SPACE" below. */ | ||
| 42 | |||
| 43 | /* Identify Bison output. */ | ||
| 44 | #define YYBISON 1 | ||
| 45 | |||
| 46 | /* Bison version. */ | ||
| 47 | #define YYBISON_VERSION "3.0.4" | ||
| 48 | |||
| 49 | /* Skeleton name. */ | ||
| 50 | #define YYSKELETON_NAME "yacc.c" | ||
| 51 | |||
| 52 | /* Pure parsers. */ | ||
| 53 | #define YYPURE 0 | ||
| 54 | |||
| 55 | /* Push parsers. */ | ||
| 56 | #define YYPUSH 0 | ||
| 57 | |||
| 58 | /* Pull parsers. */ | ||
| 59 | #define YYPULL 1 | ||
| 60 | |||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | /* Copy the first part of user declarations. */ | ||
| 65 | #line 20 "dtc-parser.y" /* yacc.c:339 */ | ||
| 66 | |||
| 67 | #include <stdio.h> | ||
| 68 | #include <inttypes.h> | ||
| 69 | |||
| 70 | #include "dtc.h" | ||
| 71 | #include "srcpos.h" | ||
| 72 | |||
| 73 | extern int yylex(void); | ||
| 74 | extern void yyerror(char const *s); | ||
| 75 | #define ERROR(loc, ...) \ | ||
| 76 | do { \ | ||
| 77 | srcpos_error((loc), "Error", __VA_ARGS__); \ | ||
| 78 | treesource_error = true; \ | ||
| 79 | } while (0) | ||
| 80 | |||
| 81 | extern struct dt_info *parser_output; | ||
| 82 | extern bool treesource_error; | ||
| 83 | |||
| 84 | #line 85 "dtc-parser.tab.c" /* yacc.c:339 */ | ||
| 85 | |||
| 86 | # ifndef YY_NULLPTR | ||
| 87 | # if defined __cplusplus && 201103L <= __cplusplus | ||
| 88 | # define YY_NULLPTR nullptr | ||
| 89 | # else | ||
| 90 | # define YY_NULLPTR 0 | ||
| 91 | # endif | ||
| 92 | # endif | ||
| 93 | |||
| 94 | /* Enabling verbose error messages. */ | ||
| 95 | #ifdef YYERROR_VERBOSE | ||
| 96 | # undef YYERROR_VERBOSE | ||
| 97 | # define YYERROR_VERBOSE 1 | ||
| 98 | #else | ||
| 99 | # define YYERROR_VERBOSE 0 | ||
| 100 | #endif | ||
| 101 | |||
| 102 | /* In a future release of Bison, this section will be replaced | ||
| 103 | by #include "dtc-parser.tab.h". */ | ||
| 104 | #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED | ||
| 105 | # define YY_YY_DTC_PARSER_TAB_H_INCLUDED | ||
| 106 | /* Debug traces. */ | ||
| 107 | #ifndef YYDEBUG | ||
| 108 | # define YYDEBUG 0 | ||
| 109 | #endif | ||
| 110 | #if YYDEBUG | ||
| 111 | extern int yydebug; | ||
| 112 | #endif | ||
| 113 | |||
| 114 | /* Token type. */ | ||
| 115 | #ifndef YYTOKENTYPE | ||
| 116 | # define YYTOKENTYPE | ||
| 117 | enum yytokentype | ||
| 118 | { | ||
| 119 | DT_V1 = 258, | ||
| 120 | DT_PLUGIN = 259, | ||
| 121 | DT_MEMRESERVE = 260, | ||
| 122 | DT_LSHIFT = 261, | ||
| 123 | DT_RSHIFT = 262, | ||
| 124 | DT_LE = 263, | ||
| 125 | DT_GE = 264, | ||
| 126 | DT_EQ = 265, | ||
| 127 | DT_NE = 266, | ||
| 128 | DT_AND = 267, | ||
| 129 | DT_OR = 268, | ||
| 130 | DT_BITS = 269, | ||
| 131 | DT_DEL_PROP = 270, | ||
| 132 | DT_DEL_NODE = 271, | ||
| 133 | DT_PROPNODENAME = 272, | ||
| 134 | DT_LITERAL = 273, | ||
| 135 | DT_CHAR_LITERAL = 274, | ||
| 136 | DT_BYTE = 275, | ||
| 137 | DT_STRING = 276, | ||
| 138 | DT_LABEL = 277, | ||
| 139 | DT_REF = 278, | ||
| 140 | DT_INCBIN = 279 | ||
| 141 | }; | ||
| 142 | #endif | ||
| 143 | |||
| 144 | /* Value type. */ | ||
| 145 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | ||
| 146 | |||
| 147 | union YYSTYPE | ||
| 148 | { | ||
| 149 | #line 39 "dtc-parser.y" /* yacc.c:355 */ | ||
| 150 | |||
| 151 | char *propnodename; | ||
| 152 | char *labelref; | ||
| 153 | uint8_t byte; | ||
| 154 | struct data data; | ||
| 155 | |||
| 156 | struct { | ||
| 157 | struct data data; | ||
| 158 | int bits; | ||
| 159 | } array; | ||
| 160 | |||
| 161 | struct property *prop; | ||
| 162 | struct property *proplist; | ||
| 163 | struct node *node; | ||
| 164 | struct node *nodelist; | ||
| 165 | struct reserve_info *re; | ||
| 166 | uint64_t integer; | ||
| 167 | unsigned int flags; | ||
| 168 | |||
| 169 | #line 170 "dtc-parser.tab.c" /* yacc.c:355 */ | ||
| 170 | }; | ||
| 171 | |||
| 172 | typedef union YYSTYPE YYSTYPE; | ||
| 173 | # define YYSTYPE_IS_TRIVIAL 1 | ||
| 174 | # define YYSTYPE_IS_DECLARED 1 | ||
| 175 | #endif | ||
| 176 | |||
| 177 | /* Location type. */ | ||
| 178 | #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED | ||
| 179 | typedef struct YYLTYPE YYLTYPE; | ||
| 180 | struct YYLTYPE | ||
| 181 | { | ||
| 182 | int first_line; | ||
| 183 | int first_column; | ||
| 184 | int last_line; | ||
| 185 | int last_column; | ||
| 186 | }; | ||
| 187 | # define YYLTYPE_IS_DECLARED 1 | ||
| 188 | # define YYLTYPE_IS_TRIVIAL 1 | ||
| 189 | #endif | ||
| 190 | |||
| 191 | |||
| 192 | extern YYSTYPE yylval; | ||
| 193 | extern YYLTYPE yylloc; | ||
| 194 | int yyparse (void); | ||
| 195 | |||
| 196 | #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ | ||
| 197 | |||
| 198 | /* Copy the second part of user declarations. */ | ||
| 199 | |||
| 200 | #line 201 "dtc-parser.tab.c" /* yacc.c:358 */ | ||
| 201 | |||
| 202 | #ifdef short | ||
| 203 | # undef short | ||
| 204 | #endif | ||
| 205 | |||
| 206 | #ifdef YYTYPE_UINT8 | ||
| 207 | typedef YYTYPE_UINT8 yytype_uint8; | ||
| 208 | #else | ||
| 209 | typedef unsigned char yytype_uint8; | ||
| 210 | #endif | ||
| 211 | |||
| 212 | #ifdef YYTYPE_INT8 | ||
| 213 | typedef YYTYPE_INT8 yytype_int8; | ||
| 214 | #else | ||
| 215 | typedef signed char yytype_int8; | ||
| 216 | #endif | ||
| 217 | |||
| 218 | #ifdef YYTYPE_UINT16 | ||
| 219 | typedef YYTYPE_UINT16 yytype_uint16; | ||
| 220 | #else | ||
| 221 | typedef unsigned short int yytype_uint16; | ||
| 222 | #endif | ||
| 223 | |||
| 224 | #ifdef YYTYPE_INT16 | ||
| 225 | typedef YYTYPE_INT16 yytype_int16; | ||
| 226 | #else | ||
| 227 | typedef short int yytype_int16; | ||
| 228 | #endif | ||
| 229 | |||
| 230 | #ifndef YYSIZE_T | ||
| 231 | # ifdef __SIZE_TYPE__ | ||
| 232 | # define YYSIZE_T __SIZE_TYPE__ | ||
| 233 | # elif defined size_t | ||
| 234 | # define YYSIZE_T size_t | ||
| 235 | # elif ! defined YYSIZE_T | ||
| 236 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 237 | # define YYSIZE_T size_t | ||
| 238 | # else | ||
| 239 | # define YYSIZE_T unsigned int | ||
| 240 | # endif | ||
| 241 | #endif | ||
| 242 | |||
| 243 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) | ||
| 244 | |||
| 245 | #ifndef YY_ | ||
| 246 | # if defined YYENABLE_NLS && YYENABLE_NLS | ||
| 247 | # if ENABLE_NLS | ||
| 248 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 249 | # define YY_(Msgid) dgettext ("bison-runtime", Msgid) | ||
| 250 | # endif | ||
| 251 | # endif | ||
| 252 | # ifndef YY_ | ||
| 253 | # define YY_(Msgid) Msgid | ||
| 254 | # endif | ||
| 255 | #endif | ||
| 256 | |||
| 257 | #ifndef YY_ATTRIBUTE | ||
| 258 | # if (defined __GNUC__ \ | ||
| 259 | && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ | ||
| 260 | || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C | ||
| 261 | # define YY_ATTRIBUTE(Spec) __attribute__(Spec) | ||
| 262 | # else | ||
| 263 | # define YY_ATTRIBUTE(Spec) /* empty */ | ||
| 264 | # endif | ||
| 265 | #endif | ||
| 266 | |||
| 267 | #ifndef YY_ATTRIBUTE_PURE | ||
| 268 | # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) | ||
| 269 | #endif | ||
| 270 | |||
| 271 | #ifndef YY_ATTRIBUTE_UNUSED | ||
| 272 | # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) | ||
| 273 | #endif | ||
| 274 | |||
| 275 | #if !defined _Noreturn \ | ||
| 276 | && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) | ||
| 277 | # if defined _MSC_VER && 1200 <= _MSC_VER | ||
| 278 | # define _Noreturn __declspec (noreturn) | ||
| 279 | # else | ||
| 280 | # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) | ||
| 281 | # endif | ||
| 282 | #endif | ||
| 283 | |||
| 284 | /* Suppress unused-variable warnings by "using" E. */ | ||
| 285 | #if ! defined lint || defined __GNUC__ | ||
| 286 | # define YYUSE(E) ((void) (E)) | ||
| 287 | #else | ||
| 288 | # define YYUSE(E) /* empty */ | ||
| 289 | #endif | ||
| 290 | |||
| 291 | #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ | ||
| 292 | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ | ||
| 293 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ | ||
| 294 | _Pragma ("GCC diagnostic push") \ | ||
| 295 | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ | ||
| 296 | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") | ||
| 297 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ | ||
| 298 | _Pragma ("GCC diagnostic pop") | ||
| 299 | #else | ||
| 300 | # define YY_INITIAL_VALUE(Value) Value | ||
| 301 | #endif | ||
| 302 | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN | ||
| 303 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN | ||
| 304 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END | ||
| 305 | #endif | ||
| 306 | #ifndef YY_INITIAL_VALUE | ||
| 307 | # define YY_INITIAL_VALUE(Value) /* Nothing. */ | ||
| 308 | #endif | ||
| 309 | |||
| 310 | |||
| 311 | #if ! defined yyoverflow || YYERROR_VERBOSE | ||
| 312 | |||
| 313 | /* The parser invokes alloca or malloc; define the necessary symbols. */ | ||
| 314 | |||
| 315 | # ifdef YYSTACK_USE_ALLOCA | ||
| 316 | # if YYSTACK_USE_ALLOCA | ||
| 317 | # ifdef __GNUC__ | ||
| 318 | # define YYSTACK_ALLOC __builtin_alloca | ||
| 319 | # elif defined __BUILTIN_VA_ARG_INCR | ||
| 320 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 321 | # elif defined _AIX | ||
| 322 | # define YYSTACK_ALLOC __alloca | ||
| 323 | # elif defined _MSC_VER | ||
| 324 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 325 | # define alloca _alloca | ||
| 326 | # else | ||
| 327 | # define YYSTACK_ALLOC alloca | ||
| 328 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS | ||
| 329 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 330 | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ | ||
| 331 | # ifndef EXIT_SUCCESS | ||
| 332 | # define EXIT_SUCCESS 0 | ||
| 333 | # endif | ||
| 334 | # endif | ||
| 335 | # endif | ||
| 336 | # endif | ||
| 337 | # endif | ||
| 338 | |||
| 339 | # ifdef YYSTACK_ALLOC | ||
| 340 | /* Pacify GCC's 'empty if-body' warning. */ | ||
| 341 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) | ||
| 342 | # ifndef YYSTACK_ALLOC_MAXIMUM | ||
| 343 | /* The OS might guarantee only one guard page at the bottom of the stack, | ||
| 344 | and a page size can be as small as 4096 bytes. So we cannot safely | ||
| 345 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number | ||
| 346 | to allow for a few compiler-allocated temporary stack slots. */ | ||
| 347 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ | ||
| 348 | # endif | ||
| 349 | # else | ||
| 350 | # define YYSTACK_ALLOC YYMALLOC | ||
| 351 | # define YYSTACK_FREE YYFREE | ||
| 352 | # ifndef YYSTACK_ALLOC_MAXIMUM | ||
| 353 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM | ||
| 354 | # endif | ||
| 355 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ | ||
| 356 | && ! ((defined YYMALLOC || defined malloc) \ | ||
| 357 | && (defined YYFREE || defined free))) | ||
| 358 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 359 | # ifndef EXIT_SUCCESS | ||
| 360 | # define EXIT_SUCCESS 0 | ||
| 361 | # endif | ||
| 362 | # endif | ||
| 363 | # ifndef YYMALLOC | ||
| 364 | # define YYMALLOC malloc | ||
| 365 | # if ! defined malloc && ! defined EXIT_SUCCESS | ||
| 366 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ | ||
| 367 | # endif | ||
| 368 | # endif | ||
| 369 | # ifndef YYFREE | ||
| 370 | # define YYFREE free | ||
| 371 | # if ! defined free && ! defined EXIT_SUCCESS | ||
| 372 | void free (void *); /* INFRINGES ON USER NAME SPACE */ | ||
| 373 | # endif | ||
| 374 | # endif | ||
| 375 | # endif | ||
| 376 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ | ||
| 377 | |||
| 378 | |||
| 379 | #if (! defined yyoverflow \ | ||
| 380 | && (! defined __cplusplus \ | ||
| 381 | || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ | ||
| 382 | && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) | ||
| 383 | |||
| 384 | /* A type that is properly aligned for any stack member. */ | ||
| 385 | union yyalloc | ||
| 386 | { | ||
| 387 | yytype_int16 yyss_alloc; | ||
| 388 | YYSTYPE yyvs_alloc; | ||
| 389 | YYLTYPE yyls_alloc; | ||
| 390 | }; | ||
| 391 | |||
| 392 | /* The size of the maximum gap between one aligned stack and the next. */ | ||
| 393 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) | ||
| 394 | |||
| 395 | /* The size of an array large to enough to hold all stacks, each with | ||
| 396 | N elements. */ | ||
| 397 | # define YYSTACK_BYTES(N) \ | ||
| 398 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ | ||
| 399 | + 2 * YYSTACK_GAP_MAXIMUM) | ||
| 400 | |||
| 401 | # define YYCOPY_NEEDED 1 | ||
| 402 | |||
| 403 | /* Relocate STACK from its old location to the new one. The | ||
| 404 | local variables YYSIZE and YYSTACKSIZE give the old and new number of | ||
| 405 | elements in the stack, and YYPTR gives the new location of the | ||
| 406 | stack. Advance YYPTR to a properly aligned location for the next | ||
| 407 | stack. */ | ||
| 408 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ | ||
| 409 | do \ | ||
| 410 | { \ | ||
| 411 | YYSIZE_T yynewbytes; \ | ||
| 412 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ | ||
| 413 | Stack = &yyptr->Stack_alloc; \ | ||
| 414 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | ||
| 415 | yyptr += yynewbytes / sizeof (*yyptr); \ | ||
| 416 | } \ | ||
| 417 | while (0) | ||
| 418 | |||
| 419 | #endif | ||
| 420 | |||
| 421 | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED | ||
| 422 | /* Copy COUNT objects from SRC to DST. The source and destination do | ||
| 423 | not overlap. */ | ||
| 424 | # ifndef YYCOPY | ||
| 425 | # if defined __GNUC__ && 1 < __GNUC__ | ||
| 426 | # define YYCOPY(Dst, Src, Count) \ | ||
| 427 | __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) | ||
| 428 | # else | ||
| 429 | # define YYCOPY(Dst, Src, Count) \ | ||
| 430 | do \ | ||
| 431 | { \ | ||
| 432 | YYSIZE_T yyi; \ | ||
| 433 | for (yyi = 0; yyi < (Count); yyi++) \ | ||
| 434 | (Dst)[yyi] = (Src)[yyi]; \ | ||
| 435 | } \ | ||
| 436 | while (0) | ||
| 437 | # endif | ||
| 438 | # endif | ||
| 439 | #endif /* !YYCOPY_NEEDED */ | ||
| 440 | |||
| 441 | /* YYFINAL -- State number of the termination state. */ | ||
| 442 | #define YYFINAL 6 | ||
| 443 | /* YYLAST -- Last index in YYTABLE. */ | ||
| 444 | #define YYLAST 138 | ||
| 445 | |||
| 446 | /* YYNTOKENS -- Number of terminals. */ | ||
| 447 | #define YYNTOKENS 48 | ||
| 448 | /* YYNNTS -- Number of nonterminals. */ | ||
| 449 | #define YYNNTS 30 | ||
| 450 | /* YYNRULES -- Number of rules. */ | ||
| 451 | #define YYNRULES 85 | ||
| 452 | /* YYNSTATES -- Number of states. */ | ||
| 453 | #define YYNSTATES 149 | ||
| 454 | |||
| 455 | /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned | ||
| 456 | by yylex, with out-of-bounds checking. */ | ||
| 457 | #define YYUNDEFTOK 2 | ||
| 458 | #define YYMAXUTOK 279 | ||
| 459 | |||
| 460 | #define YYTRANSLATE(YYX) \ | ||
| 461 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | ||
| 462 | |||
| 463 | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM | ||
| 464 | as returned by yylex, without out-of-bounds checking. */ | ||
| 465 | static const yytype_uint8 yytranslate[] = | ||
| 466 | { | ||
| 467 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 468 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 469 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 470 | 2, 2, 2, 47, 2, 2, 2, 45, 41, 2, | ||
| 471 | 33, 35, 44, 42, 34, 43, 2, 26, 2, 2, | ||
| 472 | 2, 2, 2, 2, 2, 2, 2, 2, 38, 25, | ||
| 473 | 36, 29, 30, 37, 2, 2, 2, 2, 2, 2, | ||
| 474 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 475 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 476 | 2, 31, 2, 32, 40, 2, 2, 2, 2, 2, | ||
| 477 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 478 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 479 | 2, 2, 2, 27, 39, 28, 46, 2, 2, 2, | ||
| 480 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 481 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 482 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 483 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 484 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 485 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 486 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 487 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 488 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 489 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 490 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 491 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 492 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | ||
| 493 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | ||
| 494 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 | ||
| 495 | }; | ||
| 496 | |||
| 497 | #if YYDEBUG | ||
| 498 | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ | ||
| 499 | static const yytype_uint16 yyrline[] = | ||
| 500 | { | ||
| 501 | 0, 109, 109, 117, 121, 128, 129, 139, 142, 149, | ||
| 502 | 153, 161, 165, 170, 181, 200, 213, 220, 228, 231, | ||
| 503 | 238, 242, 246, 250, 258, 262, 266, 270, 274, 290, | ||
| 504 | 300, 308, 311, 315, 322, 338, 343, 362, 376, 383, | ||
| 505 | 384, 385, 392, 396, 397, 401, 402, 406, 407, 411, | ||
| 506 | 412, 416, 417, 421, 422, 426, 427, 428, 432, 433, | ||
| 507 | 434, 435, 436, 440, 441, 442, 446, 447, 448, 452, | ||
| 508 | 453, 462, 471, 475, 476, 477, 478, 483, 486, 490, | ||
| 509 | 498, 501, 505, 513, 517, 521 | ||
| 510 | }; | ||
| 511 | #endif | ||
| 512 | |||
| 513 | #if YYDEBUG || YYERROR_VERBOSE || 0 | ||
| 514 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. | ||
| 515 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ | ||
| 516 | static const char *const yytname[] = | ||
| 517 | { | ||
| 518 | "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE", | ||
| 519 | "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", | ||
| 520 | "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", | ||
| 521 | "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", | ||
| 522 | "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", | ||
| 523 | "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", | ||
| 524 | "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", | ||
| 525 | "header", "headers", "memreserves", "memreserve", "devicetree", | ||
| 526 | "nodedef", "proplist", "propdef", "propdata", "propdataprefix", | ||
| 527 | "arrayprefix", "integer_prim", "integer_expr", "integer_trinary", | ||
| 528 | "integer_or", "integer_and", "integer_bitor", "integer_bitxor", | ||
| 529 | "integer_bitand", "integer_eq", "integer_rela", "integer_shift", | ||
| 530 | "integer_add", "integer_mul", "integer_unary", "bytestring", "subnodes", | ||
| 531 | "subnode", YY_NULLPTR | ||
| 532 | }; | ||
| 533 | #endif | ||
| 534 | |||
| 535 | # ifdef YYPRINT | ||
| 536 | /* YYTOKNUM[NUM] -- (External) token number corresponding to the | ||
| 537 | (internal) symbol number NUM (which must be that of a token). */ | ||
| 538 | static const yytype_uint16 yytoknum[] = | ||
| 539 | { | ||
| 540 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | ||
| 541 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | ||
| 542 | 275, 276, 277, 278, 279, 59, 47, 123, 125, 61, | ||
| 543 | 62, 91, 93, 40, 44, 41, 60, 63, 58, 124, | ||
| 544 | 94, 38, 43, 45, 42, 37, 126, 33 | ||
| 545 | }; | ||
| 546 | # endif | ||
| 547 | |||
| 548 | #define YYPACT_NINF -44 | ||
| 549 | |||
| 550 | #define yypact_value_is_default(Yystate) \ | ||
| 551 | (!!((Yystate) == (-44))) | ||
| 552 | |||
| 553 | #define YYTABLE_NINF -1 | ||
| 554 | |||
| 555 | #define yytable_value_is_error(Yytable_value) \ | ||
| 556 | 0 | ||
| 557 | |||
| 558 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | ||
| 559 | STATE-NUM. */ | ||
| 560 | static const yytype_int8 yypact[] = | ||
| 561 | { | ||
| 562 | 14, 27, 61, 14, 8, 18, -44, -44, 37, 8, | ||
| 563 | 40, 8, 64, -44, -44, -12, 37, -44, 50, 52, | ||
| 564 | -44, -44, -12, -12, -12, -44, 51, -44, -4, 78, | ||
| 565 | 53, 54, 55, 17, 2, 30, 38, -3, -44, 66, | ||
| 566 | -44, -44, 70, 72, 50, 50, -44, -44, -44, -44, | ||
| 567 | -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, | ||
| 568 | -12, -12, -12, -12, -12, -12, -12, -12, -12, -44, | ||
| 569 | 3, 73, 50, -44, -44, 78, 59, 53, 54, 55, | ||
| 570 | 17, 2, 2, 30, 30, 30, 30, 38, 38, -3, | ||
| 571 | -3, -44, -44, -44, 82, 83, 44, 3, -44, 74, | ||
| 572 | 3, -44, -44, -12, 76, 79, -44, -44, -44, -44, | ||
| 573 | -44, 80, -44, -44, -44, -44, -44, -10, 36, -44, | ||
| 574 | -44, -44, -44, 85, -44, -44, -44, 75, -44, -44, | ||
| 575 | 21, 71, 88, -6, -44, -44, -44, -44, -44, 11, | ||
| 576 | -44, -44, -44, 37, -44, 77, 37, 81, -44 | ||
| 577 | }; | ||
| 578 | |||
| 579 | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. | ||
| 580 | Performed when YYTABLE does not specify something else to do. Zero | ||
| 581 | means the default is an error. */ | ||
| 582 | static const yytype_uint8 yydefact[] = | ||
| 583 | { | ||
| 584 | 0, 0, 0, 5, 7, 3, 1, 6, 0, 0, | ||
| 585 | 16, 7, 0, 39, 40, 0, 0, 10, 0, 2, | ||
| 586 | 8, 4, 0, 0, 0, 73, 0, 42, 43, 45, | ||
| 587 | 47, 49, 51, 53, 55, 58, 65, 68, 72, 0, | ||
| 588 | 18, 11, 0, 0, 0, 0, 74, 75, 76, 41, | ||
| 589 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 590 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, | ||
| 591 | 80, 0, 0, 14, 12, 46, 0, 48, 50, 52, | ||
| 592 | 54, 56, 57, 61, 62, 60, 59, 63, 64, 66, | ||
| 593 | 67, 70, 69, 71, 0, 0, 0, 0, 19, 0, | ||
| 594 | 80, 15, 13, 0, 0, 0, 21, 31, 83, 23, | ||
| 595 | 85, 0, 82, 81, 44, 22, 84, 0, 0, 17, | ||
| 596 | 30, 20, 32, 0, 24, 33, 27, 0, 77, 35, | ||
| 597 | 0, 0, 0, 0, 38, 37, 25, 36, 34, 0, | ||
| 598 | 78, 79, 26, 0, 29, 0, 0, 0, 28 | ||
| 599 | }; | ||
| 600 | |||
| 601 | /* YYPGOTO[NTERM-NUM]. */ | ||
| 602 | static const yytype_int8 yypgoto[] = | ||
| 603 | { | ||
| 604 | -44, -44, -44, 103, 99, 104, -44, -43, -44, -21, | ||
| 605 | -44, -44, -44, -8, 63, 9, -44, 65, 67, 68, | ||
| 606 | 69, 62, 26, 4, 22, 23, -19, -44, 20, 28 | ||
| 607 | }; | ||
| 608 | |||
| 609 | /* YYDEFGOTO[NTERM-NUM]. */ | ||
| 610 | static const yytype_int16 yydefgoto[] = | ||
| 611 | { | ||
| 612 | -1, 2, 3, 4, 10, 11, 19, 41, 70, 98, | ||
| 613 | 117, 118, 130, 25, 26, 27, 28, 29, 30, 31, | ||
| 614 | 32, 33, 34, 35, 36, 37, 38, 133, 99, 100 | ||
| 615 | }; | ||
| 616 | |||
| 617 | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If | ||
| 618 | positive, shift that token. If negative, reduce the rule whose | ||
| 619 | number is the opposite. If YYTABLE_NINF, syntax error. */ | ||
| 620 | static const yytype_uint8 yytable[] = | ||
| 621 | { | ||
| 622 | 16, 73, 74, 46, 47, 48, 13, 14, 39, 50, | ||
| 623 | 58, 59, 120, 8, 140, 121, 141, 1, 94, 95, | ||
| 624 | 96, 15, 12, 66, 122, 97, 142, 56, 57, 102, | ||
| 625 | 9, 22, 60, 51, 23, 24, 62, 63, 61, 13, | ||
| 626 | 14, 67, 68, 134, 135, 143, 144, 91, 92, 93, | ||
| 627 | 123, 136, 5, 108, 15, 13, 14, 124, 125, 126, | ||
| 628 | 127, 6, 83, 84, 85, 86, 18, 128, 42, 106, | ||
| 629 | 15, 40, 129, 107, 43, 44, 109, 40, 45, 112, | ||
| 630 | 64, 65, 81, 82, 87, 88, 49, 89, 90, 21, | ||
| 631 | 52, 69, 53, 71, 54, 72, 55, 103, 101, 104, | ||
| 632 | 105, 115, 111, 131, 116, 119, 7, 138, 132, 139, | ||
| 633 | 20, 146, 114, 17, 76, 75, 148, 80, 0, 77, | ||
| 634 | 113, 78, 137, 79, 0, 110, 0, 0, 0, 0, | ||
| 635 | 0, 0, 0, 0, 0, 145, 0, 0, 147 | ||
| 636 | }; | ||
| 637 | |||
| 638 | static const yytype_int16 yycheck[] = | ||
| 639 | { | ||
| 640 | 8, 44, 45, 22, 23, 24, 18, 19, 16, 13, | ||
| 641 | 8, 9, 22, 5, 20, 25, 22, 3, 15, 16, | ||
| 642 | 17, 33, 4, 26, 34, 22, 32, 10, 11, 72, | ||
| 643 | 22, 43, 30, 37, 46, 47, 6, 7, 36, 18, | ||
| 644 | 19, 44, 45, 22, 23, 34, 35, 66, 67, 68, | ||
| 645 | 14, 30, 25, 96, 33, 18, 19, 21, 22, 23, | ||
| 646 | 24, 0, 58, 59, 60, 61, 26, 31, 16, 25, | ||
| 647 | 33, 27, 36, 29, 22, 23, 97, 27, 26, 100, | ||
| 648 | 42, 43, 56, 57, 62, 63, 35, 64, 65, 25, | ||
| 649 | 12, 25, 39, 23, 40, 23, 41, 38, 25, 17, | ||
| 650 | 17, 25, 28, 18, 25, 25, 3, 36, 33, 21, | ||
| 651 | 11, 34, 103, 9, 51, 50, 35, 55, -1, 52, | ||
| 652 | 100, 53, 130, 54, -1, 97, -1, -1, -1, -1, | ||
| 653 | -1, -1, -1, -1, -1, 143, -1, -1, 146 | ||
| 654 | }; | ||
| 655 | |||
| 656 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | ||
| 657 | symbol of state STATE-NUM. */ | ||
| 658 | static const yytype_uint8 yystos[] = | ||
| 659 | { | ||
| 660 | 0, 3, 49, 50, 51, 25, 0, 51, 5, 22, | ||
| 661 | 52, 53, 4, 18, 19, 33, 61, 53, 26, 54, | ||
| 662 | 52, 25, 43, 46, 47, 61, 62, 63, 64, 65, | ||
| 663 | 66, 67, 68, 69, 70, 71, 72, 73, 74, 61, | ||
| 664 | 27, 55, 16, 22, 23, 26, 74, 74, 74, 35, | ||
| 665 | 13, 37, 12, 39, 40, 41, 10, 11, 8, 9, | ||
| 666 | 30, 36, 6, 7, 42, 43, 26, 44, 45, 25, | ||
| 667 | 56, 23, 23, 55, 55, 65, 62, 66, 67, 68, | ||
| 668 | 69, 70, 70, 71, 71, 71, 71, 72, 72, 73, | ||
| 669 | 73, 74, 74, 74, 15, 16, 17, 22, 57, 76, | ||
| 670 | 77, 25, 55, 38, 17, 17, 25, 29, 55, 57, | ||
| 671 | 77, 28, 57, 76, 63, 25, 25, 58, 59, 25, | ||
| 672 | 22, 25, 34, 14, 21, 22, 23, 24, 31, 36, | ||
| 673 | 60, 18, 33, 75, 22, 23, 30, 61, 36, 21, | ||
| 674 | 20, 22, 32, 34, 35, 61, 34, 61, 35 | ||
| 675 | }; | ||
| 676 | |||
| 677 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | ||
| 678 | static const yytype_uint8 yyr1[] = | ||
| 679 | { | ||
| 680 | 0, 48, 49, 50, 50, 51, 51, 52, 52, 53, | ||
| 681 | 53, 54, 54, 54, 54, 54, 54, 55, 56, 56, | ||
| 682 | 57, 57, 57, 57, 58, 58, 58, 58, 58, 58, | ||
| 683 | 58, 59, 59, 59, 60, 60, 60, 60, 60, 61, | ||
| 684 | 61, 61, 62, 63, 63, 64, 64, 65, 65, 66, | ||
| 685 | 66, 67, 67, 68, 68, 69, 69, 69, 70, 70, | ||
| 686 | 70, 70, 70, 71, 71, 71, 72, 72, 72, 73, | ||
| 687 | 73, 73, 73, 74, 74, 74, 74, 75, 75, 75, | ||
| 688 | 76, 76, 76, 77, 77, 77 | ||
| 689 | }; | ||
| 690 | |||
| 691 | /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ | ||
| 692 | static const yytype_uint8 yyr2[] = | ||
| 693 | { | ||
| 694 | 0, 2, 3, 2, 4, 1, 2, 0, 2, 4, | ||
| 695 | 2, 2, 3, 4, 3, 4, 0, 5, 0, 2, | ||
| 696 | 4, 2, 3, 2, 2, 3, 4, 2, 9, 5, | ||
| 697 | 2, 0, 2, 2, 3, 1, 2, 2, 2, 1, | ||
| 698 | 1, 3, 1, 1, 5, 1, 3, 1, 3, 1, | ||
| 699 | 3, 1, 3, 1, 3, 1, 3, 3, 1, 3, | ||
| 700 | 3, 3, 3, 3, 3, 1, 3, 3, 1, 3, | ||
| 701 | 3, 3, 1, 1, 2, 2, 2, 0, 2, 2, | ||
| 702 | 0, 2, 2, 2, 3, 2 | ||
| 703 | }; | ||
| 704 | |||
| 705 | |||
| 706 | #define yyerrok (yyerrstatus = 0) | ||
| 707 | #define yyclearin (yychar = YYEMPTY) | ||
| 708 | #define YYEMPTY (-2) | ||
| 709 | #define YYEOF 0 | ||
| 710 | |||
| 711 | #define YYACCEPT goto yyacceptlab | ||
| 712 | #define YYABORT goto yyabortlab | ||
| 713 | #define YYERROR goto yyerrorlab | ||
| 714 | |||
| 715 | |||
| 716 | #define YYRECOVERING() (!!yyerrstatus) | ||
| 717 | |||
| 718 | #define YYBACKUP(Token, Value) \ | ||
| 719 | do \ | ||
| 720 | if (yychar == YYEMPTY) \ | ||
| 721 | { \ | ||
| 722 | yychar = (Token); \ | ||
| 723 | yylval = (Value); \ | ||
| 724 | YYPOPSTACK (yylen); \ | ||
| 725 | yystate = *yyssp; \ | ||
| 726 | goto yybackup; \ | ||
| 727 | } \ | ||
| 728 | else \ | ||
| 729 | { \ | ||
| 730 | yyerror (YY_("syntax error: cannot back up")); \ | ||
| 731 | YYERROR; \ | ||
| 732 | } \ | ||
| 733 | while (0) | ||
| 734 | |||
| 735 | /* Error token number */ | ||
| 736 | #define YYTERROR 1 | ||
| 737 | #define YYERRCODE 256 | ||
| 738 | |||
| 739 | |||
| 740 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. | ||
| 741 | If N is 0, then set CURRENT to the empty location which ends | ||
| 742 | the previous symbol: RHS[0] (always defined). */ | ||
| 743 | |||
| 744 | #ifndef YYLLOC_DEFAULT | ||
| 745 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ | ||
| 746 | do \ | ||
| 747 | if (N) \ | ||
| 748 | { \ | ||
| 749 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ | ||
| 750 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ | ||
| 751 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ | ||
| 752 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ | ||
| 753 | } \ | ||
| 754 | else \ | ||
| 755 | { \ | ||
| 756 | (Current).first_line = (Current).last_line = \ | ||
| 757 | YYRHSLOC (Rhs, 0).last_line; \ | ||
| 758 | (Current).first_column = (Current).last_column = \ | ||
| 759 | YYRHSLOC (Rhs, 0).last_column; \ | ||
| 760 | } \ | ||
| 761 | while (0) | ||
| 762 | #endif | ||
| 763 | |||
| 764 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) | ||
| 765 | |||
| 766 | |||
| 767 | /* Enable debugging if requested. */ | ||
| 768 | #if YYDEBUG | ||
| 769 | |||
| 770 | # ifndef YYFPRINTF | ||
| 771 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 772 | # define YYFPRINTF fprintf | ||
| 773 | # endif | ||
| 774 | |||
| 775 | # define YYDPRINTF(Args) \ | ||
| 776 | do { \ | ||
| 777 | if (yydebug) \ | ||
| 778 | YYFPRINTF Args; \ | ||
| 779 | } while (0) | ||
| 780 | |||
| 781 | |||
| 782 | /* YY_LOCATION_PRINT -- Print the location on the stream. | ||
| 783 | This macro was not mandated originally: define only if we know | ||
| 784 | we won't break user code: when these are the locations we know. */ | ||
| 785 | |||
| 786 | #ifndef YY_LOCATION_PRINT | ||
| 787 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL | ||
| 788 | |||
| 789 | /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ | ||
| 790 | |||
| 791 | YY_ATTRIBUTE_UNUSED | ||
| 792 | static unsigned | ||
| 793 | yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) | ||
| 794 | { | ||
| 795 | unsigned res = 0; | ||
| 796 | int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; | ||
| 797 | if (0 <= yylocp->first_line) | ||
| 798 | { | ||
| 799 | res += YYFPRINTF (yyo, "%d", yylocp->first_line); | ||
| 800 | if (0 <= yylocp->first_column) | ||
| 801 | res += YYFPRINTF (yyo, ".%d", yylocp->first_column); | ||
| 802 | } | ||
| 803 | if (0 <= yylocp->last_line) | ||
| 804 | { | ||
| 805 | if (yylocp->first_line < yylocp->last_line) | ||
| 806 | { | ||
| 807 | res += YYFPRINTF (yyo, "-%d", yylocp->last_line); | ||
| 808 | if (0 <= end_col) | ||
| 809 | res += YYFPRINTF (yyo, ".%d", end_col); | ||
| 810 | } | ||
| 811 | else if (0 <= end_col && yylocp->first_column < end_col) | ||
| 812 | res += YYFPRINTF (yyo, "-%d", end_col); | ||
| 813 | } | ||
| 814 | return res; | ||
| 815 | } | ||
| 816 | |||
| 817 | # define YY_LOCATION_PRINT(File, Loc) \ | ||
| 818 | yy_location_print_ (File, &(Loc)) | ||
| 819 | |||
| 820 | # else | ||
| 821 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | ||
| 822 | # endif | ||
| 823 | #endif | ||
| 824 | |||
| 825 | |||
| 826 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ | ||
| 827 | do { \ | ||
| 828 | if (yydebug) \ | ||
| 829 | { \ | ||
| 830 | YYFPRINTF (stderr, "%s ", Title); \ | ||
| 831 | yy_symbol_print (stderr, \ | ||
| 832 | Type, Value, Location); \ | ||
| 833 | YYFPRINTF (stderr, "\n"); \ | ||
| 834 | } \ | ||
| 835 | } while (0) | ||
| 836 | |||
| 837 | |||
| 838 | /*----------------------------------------. | ||
| 839 | | Print this symbol's value on YYOUTPUT. | | ||
| 840 | `----------------------------------------*/ | ||
| 841 | |||
| 842 | static void | ||
| 843 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) | ||
| 844 | { | ||
| 845 | FILE *yyo = yyoutput; | ||
| 846 | YYUSE (yyo); | ||
| 847 | YYUSE (yylocationp); | ||
| 848 | if (!yyvaluep) | ||
| 849 | return; | ||
| 850 | # ifdef YYPRINT | ||
| 851 | if (yytype < YYNTOKENS) | ||
| 852 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | ||
| 853 | # endif | ||
| 854 | YYUSE (yytype); | ||
| 855 | } | ||
| 856 | |||
| 857 | |||
| 858 | /*--------------------------------. | ||
| 859 | | Print this symbol on YYOUTPUT. | | ||
| 860 | `--------------------------------*/ | ||
| 861 | |||
| 862 | static void | ||
| 863 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) | ||
| 864 | { | ||
| 865 | YYFPRINTF (yyoutput, "%s %s (", | ||
| 866 | yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); | ||
| 867 | |||
| 868 | YY_LOCATION_PRINT (yyoutput, *yylocationp); | ||
| 869 | YYFPRINTF (yyoutput, ": "); | ||
| 870 | yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); | ||
| 871 | YYFPRINTF (yyoutput, ")"); | ||
| 872 | } | ||
| 873 | |||
| 874 | /*------------------------------------------------------------------. | ||
| 875 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | | ||
| 876 | | TOP (included). | | ||
| 877 | `------------------------------------------------------------------*/ | ||
| 878 | |||
| 879 | static void | ||
| 880 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) | ||
| 881 | { | ||
| 882 | YYFPRINTF (stderr, "Stack now"); | ||
| 883 | for (; yybottom <= yytop; yybottom++) | ||
| 884 | { | ||
| 885 | int yybot = *yybottom; | ||
| 886 | YYFPRINTF (stderr, " %d", yybot); | ||
| 887 | } | ||
| 888 | YYFPRINTF (stderr, "\n"); | ||
| 889 | } | ||
| 890 | |||
| 891 | # define YY_STACK_PRINT(Bottom, Top) \ | ||
| 892 | do { \ | ||
| 893 | if (yydebug) \ | ||
| 894 | yy_stack_print ((Bottom), (Top)); \ | ||
| 895 | } while (0) | ||
| 896 | |||
| 897 | |||
| 898 | /*------------------------------------------------. | ||
| 899 | | Report that the YYRULE is going to be reduced. | | ||
| 900 | `------------------------------------------------*/ | ||
| 901 | |||
| 902 | static void | ||
| 903 | yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) | ||
| 904 | { | ||
| 905 | unsigned long int yylno = yyrline[yyrule]; | ||
| 906 | int yynrhs = yyr2[yyrule]; | ||
| 907 | int yyi; | ||
| 908 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", | ||
| 909 | yyrule - 1, yylno); | ||
| 910 | /* The symbols being reduced. */ | ||
| 911 | for (yyi = 0; yyi < yynrhs; yyi++) | ||
| 912 | { | ||
| 913 | YYFPRINTF (stderr, " $%d = ", yyi + 1); | ||
| 914 | yy_symbol_print (stderr, | ||
| 915 | yystos[yyssp[yyi + 1 - yynrhs]], | ||
| 916 | &(yyvsp[(yyi + 1) - (yynrhs)]) | ||
| 917 | , &(yylsp[(yyi + 1) - (yynrhs)]) ); | ||
| 918 | YYFPRINTF (stderr, "\n"); | ||
| 919 | } | ||
| 920 | } | ||
| 921 | |||
| 922 | # define YY_REDUCE_PRINT(Rule) \ | ||
| 923 | do { \ | ||
| 924 | if (yydebug) \ | ||
| 925 | yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \ | ||
| 926 | } while (0) | ||
| 927 | |||
| 928 | /* Nonzero means print parse trace. It is left uninitialized so that | ||
| 929 | multiple parsers can coexist. */ | ||
| 930 | int yydebug; | ||
| 931 | #else /* !YYDEBUG */ | ||
| 932 | # define YYDPRINTF(Args) | ||
| 933 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) | ||
| 934 | # define YY_STACK_PRINT(Bottom, Top) | ||
| 935 | # define YY_REDUCE_PRINT(Rule) | ||
| 936 | #endif /* !YYDEBUG */ | ||
| 937 | |||
| 938 | |||
| 939 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | ||
| 940 | #ifndef YYINITDEPTH | ||
| 941 | # define YYINITDEPTH 200 | ||
| 942 | #endif | ||
| 943 | |||
| 944 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only | ||
| 945 | if the built-in stack extension method is used). | ||
| 946 | |||
| 947 | Do not make this value too large; the results are undefined if | ||
| 948 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) | ||
| 949 | evaluated with infinite-precision integer arithmetic. */ | ||
| 950 | |||
| 951 | #ifndef YYMAXDEPTH | ||
| 952 | # define YYMAXDEPTH 10000 | ||
| 953 | #endif | ||
| 954 | |||
| 955 | |||
| 956 | #if YYERROR_VERBOSE | ||
| 957 | |||
| 958 | # ifndef yystrlen | ||
| 959 | # if defined __GLIBC__ && defined _STRING_H | ||
| 960 | # define yystrlen strlen | ||
| 961 | # else | ||
| 962 | /* Return the length of YYSTR. */ | ||
| 963 | static YYSIZE_T | ||
| 964 | yystrlen (const char *yystr) | ||
| 965 | { | ||
| 966 | YYSIZE_T yylen; | ||
| 967 | for (yylen = 0; yystr[yylen]; yylen++) | ||
| 968 | continue; | ||
| 969 | return yylen; | ||
| 970 | } | ||
| 971 | # endif | ||
| 972 | # endif | ||
| 973 | |||
| 974 | # ifndef yystpcpy | ||
| 975 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE | ||
| 976 | # define yystpcpy stpcpy | ||
| 977 | # else | ||
| 978 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | ||
| 979 | YYDEST. */ | ||
| 980 | static char * | ||
| 981 | yystpcpy (char *yydest, const char *yysrc) | ||
| 982 | { | ||
| 983 | char *yyd = yydest; | ||
| 984 | const char *yys = yysrc; | ||
| 985 | |||
| 986 | while ((*yyd++ = *yys++) != '\0') | ||
| 987 | continue; | ||
| 988 | |||
| 989 | return yyd - 1; | ||
| 990 | } | ||
| 991 | # endif | ||
| 992 | # endif | ||
| 993 | |||
| 994 | # ifndef yytnamerr | ||
| 995 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary | ||
| 996 | quotes and backslashes, so that it's suitable for yyerror. The | ||
| 997 | heuristic is that double-quoting is unnecessary unless the string | ||
| 998 | contains an apostrophe, a comma, or backslash (other than | ||
| 999 | backslash-backslash). YYSTR is taken from yytname. If YYRES is | ||
| 1000 | null, do not copy; instead, return the length of what the result | ||
| 1001 | would have been. */ | ||
| 1002 | static YYSIZE_T | ||
| 1003 | yytnamerr (char *yyres, const char *yystr) | ||
| 1004 | { | ||
| 1005 | if (*yystr == '"') | ||
| 1006 | { | ||
| 1007 | YYSIZE_T yyn = 0; | ||
| 1008 | char const *yyp = yystr; | ||
| 1009 | |||
| 1010 | for (;;) | ||
| 1011 | switch (*++yyp) | ||
| 1012 | { | ||
| 1013 | case '\'': | ||
| 1014 | case ',': | ||
| 1015 | goto do_not_strip_quotes; | ||
| 1016 | |||
| 1017 | case '\\': | ||
| 1018 | if (*++yyp != '\\') | ||
| 1019 | goto do_not_strip_quotes; | ||
| 1020 | /* Fall through. */ | ||
| 1021 | default: | ||
| 1022 | if (yyres) | ||
| 1023 | yyres[yyn] = *yyp; | ||
| 1024 | yyn++; | ||
| 1025 | break; | ||
| 1026 | |||
| 1027 | case '"': | ||
| 1028 | if (yyres) | ||
| 1029 | yyres[yyn] = '\0'; | ||
| 1030 | return yyn; | ||
| 1031 | } | ||
| 1032 | do_not_strip_quotes: ; | ||
| 1033 | } | ||
| 1034 | |||
| 1035 | if (! yyres) | ||
| 1036 | return yystrlen (yystr); | ||
| 1037 | |||
| 1038 | return yystpcpy (yyres, yystr) - yyres; | ||
| 1039 | } | ||
| 1040 | # endif | ||
| 1041 | |||
| 1042 | /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message | ||
| 1043 | about the unexpected token YYTOKEN for the state stack whose top is | ||
| 1044 | YYSSP. | ||
| 1045 | |||
| 1046 | Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is | ||
| 1047 | not large enough to hold the message. In that case, also set | ||
| 1048 | *YYMSG_ALLOC to the required number of bytes. Return 2 if the | ||
| 1049 | required number of bytes is too large to store. */ | ||
| 1050 | static int | ||
| 1051 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | ||
| 1052 | yytype_int16 *yyssp, int yytoken) | ||
| 1053 | { | ||
| 1054 | YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); | ||
| 1055 | YYSIZE_T yysize = yysize0; | ||
| 1056 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; | ||
| 1057 | /* Internationalized format string. */ | ||
| 1058 | const char *yyformat = YY_NULLPTR; | ||
| 1059 | /* Arguments of yyformat. */ | ||
| 1060 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | ||
| 1061 | /* Number of reported tokens (one for the "unexpected", one per | ||
| 1062 | "expected"). */ | ||
| 1063 | int yycount = 0; | ||
| 1064 | |||
| 1065 | /* There are many possibilities here to consider: | ||
| 1066 | - If this state is a consistent state with a default action, then | ||
| 1067 | the only way this function was invoked is if the default action | ||
| 1068 | is an error action. In that case, don't check for expected | ||
| 1069 | tokens because there are none. | ||
| 1070 | - The only way there can be no lookahead present (in yychar) is if | ||
| 1071 | this state is a consistent state with a default action. Thus, | ||
| 1072 | detecting the absence of a lookahead is sufficient to determine | ||
| 1073 | that there is no unexpected or expected token to report. In that | ||
| 1074 | case, just report a simple "syntax error". | ||
| 1075 | - Don't assume there isn't a lookahead just because this state is a | ||
| 1076 | consistent state with a default action. There might have been a | ||
| 1077 | previous inconsistent state, consistent state with a non-default | ||
| 1078 | action, or user semantic action that manipulated yychar. | ||
| 1079 | - Of course, the expected token list depends on states to have | ||
| 1080 | correct lookahead information, and it depends on the parser not | ||
| 1081 | to perform extra reductions after fetching a lookahead from the | ||
| 1082 | scanner and before detecting a syntax error. Thus, state merging | ||
| 1083 | (from LALR or IELR) and default reductions corrupt the expected | ||
| 1084 | token list. However, the list is correct for canonical LR with | ||
| 1085 | one exception: it will still contain any token that will not be | ||
| 1086 | accepted due to an error action in a later state. | ||
| 1087 | */ | ||
| 1088 | if (yytoken != YYEMPTY) | ||
| 1089 | { | ||
| 1090 | int yyn = yypact[*yyssp]; | ||
| 1091 | yyarg[yycount++] = yytname[yytoken]; | ||
| 1092 | if (!yypact_value_is_default (yyn)) | ||
| 1093 | { | ||
| 1094 | /* Start YYX at -YYN if negative to avoid negative indexes in | ||
| 1095 | YYCHECK. In other words, skip the first -YYN actions for | ||
| 1096 | this state because they are default actions. */ | ||
| 1097 | int yyxbegin = yyn < 0 ? -yyn : 0; | ||
| 1098 | /* Stay within bounds of both yycheck and yytname. */ | ||
| 1099 | int yychecklim = YYLAST - yyn + 1; | ||
| 1100 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; | ||
| 1101 | int yyx; | ||
| 1102 | |||
| 1103 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | ||
| 1104 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR | ||
| 1105 | && !yytable_value_is_error (yytable[yyx + yyn])) | ||
| 1106 | { | ||
| 1107 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) | ||
| 1108 | { | ||
| 1109 | yycount = 1; | ||
| 1110 | yysize = yysize0; | ||
| 1111 | break; | ||
| 1112 | } | ||
| 1113 | yyarg[yycount++] = yytname[yyx]; | ||
| 1114 | { | ||
| 1115 | YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); | ||
| 1116 | if (! (yysize <= yysize1 | ||
| 1117 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) | ||
| 1118 | return 2; | ||
| 1119 | yysize = yysize1; | ||
| 1120 | } | ||
| 1121 | } | ||
| 1122 | } | ||
| 1123 | } | ||
| 1124 | |||
| 1125 | switch (yycount) | ||
| 1126 | { | ||
| 1127 | # define YYCASE_(N, S) \ | ||
| 1128 | case N: \ | ||
| 1129 | yyformat = S; \ | ||
| 1130 | break | ||
| 1131 | YYCASE_(0, YY_("syntax error")); | ||
| 1132 | YYCASE_(1, YY_("syntax error, unexpected %s")); | ||
| 1133 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); | ||
| 1134 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); | ||
| 1135 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); | ||
| 1136 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); | ||
| 1137 | # undef YYCASE_ | ||
| 1138 | } | ||
| 1139 | |||
| 1140 | { | ||
| 1141 | YYSIZE_T yysize1 = yysize + yystrlen (yyformat); | ||
| 1142 | if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) | ||
| 1143 | return 2; | ||
| 1144 | yysize = yysize1; | ||
| 1145 | } | ||
| 1146 | |||
| 1147 | if (*yymsg_alloc < yysize) | ||
| 1148 | { | ||
| 1149 | *yymsg_alloc = 2 * yysize; | ||
| 1150 | if (! (yysize <= *yymsg_alloc | ||
| 1151 | && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) | ||
| 1152 | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; | ||
| 1153 | return 1; | ||
| 1154 | } | ||
| 1155 | |||
| 1156 | /* Avoid sprintf, as that infringes on the user's name space. | ||
| 1157 | Don't have undefined behavior even if the translation | ||
| 1158 | produced a string with the wrong number of "%s"s. */ | ||
| 1159 | { | ||
| 1160 | char *yyp = *yymsg; | ||
| 1161 | int yyi = 0; | ||
| 1162 | while ((*yyp = *yyformat) != '\0') | ||
| 1163 | if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) | ||
| 1164 | { | ||
| 1165 | yyp += yytnamerr (yyp, yyarg[yyi++]); | ||
| 1166 | yyformat += 2; | ||
| 1167 | } | ||
| 1168 | else | ||
| 1169 | { | ||
| 1170 | yyp++; | ||
| 1171 | yyformat++; | ||
| 1172 | } | ||
| 1173 | } | ||
| 1174 | return 0; | ||
| 1175 | } | ||
| 1176 | #endif /* YYERROR_VERBOSE */ | ||
| 1177 | |||
| 1178 | /*-----------------------------------------------. | ||
| 1179 | | Release the memory associated to this symbol. | | ||
| 1180 | `-----------------------------------------------*/ | ||
| 1181 | |||
| 1182 | static void | ||
| 1183 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) | ||
| 1184 | { | ||
| 1185 | YYUSE (yyvaluep); | ||
| 1186 | YYUSE (yylocationp); | ||
| 1187 | if (!yymsg) | ||
| 1188 | yymsg = "Deleting"; | ||
| 1189 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); | ||
| 1190 | |||
| 1191 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN | ||
| 1192 | YYUSE (yytype); | ||
| 1193 | YY_IGNORE_MAYBE_UNINITIALIZED_END | ||
| 1194 | } | ||
| 1195 | |||
| 1196 | |||
| 1197 | |||
| 1198 | |||
| 1199 | /* The lookahead symbol. */ | ||
| 1200 | int yychar; | ||
| 1201 | |||
| 1202 | /* The semantic value of the lookahead symbol. */ | ||
| 1203 | YYSTYPE yylval; | ||
| 1204 | /* Location data for the lookahead symbol. */ | ||
| 1205 | YYLTYPE yylloc | ||
| 1206 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL | ||
| 1207 | = { 1, 1, 1, 1 } | ||
| 1208 | # endif | ||
| 1209 | ; | ||
| 1210 | /* Number of syntax errors so far. */ | ||
| 1211 | int yynerrs; | ||
| 1212 | |||
| 1213 | |||
| 1214 | /*----------. | ||
| 1215 | | yyparse. | | ||
| 1216 | `----------*/ | ||
| 1217 | |||
| 1218 | int | ||
| 1219 | yyparse (void) | ||
| 1220 | { | ||
| 1221 | int yystate; | ||
| 1222 | /* Number of tokens to shift before error messages enabled. */ | ||
| 1223 | int yyerrstatus; | ||
| 1224 | |||
| 1225 | /* The stacks and their tools: | ||
| 1226 | 'yyss': related to states. | ||
| 1227 | 'yyvs': related to semantic values. | ||
| 1228 | 'yyls': related to locations. | ||
| 1229 | |||
| 1230 | Refer to the stacks through separate pointers, to allow yyoverflow | ||
| 1231 | to reallocate them elsewhere. */ | ||
| 1232 | |||
| 1233 | /* The state stack. */ | ||
| 1234 | yytype_int16 yyssa[YYINITDEPTH]; | ||
| 1235 | yytype_int16 *yyss; | ||
| 1236 | yytype_int16 *yyssp; | ||
| 1237 | |||
| 1238 | /* The semantic value stack. */ | ||
| 1239 | YYSTYPE yyvsa[YYINITDEPTH]; | ||
| 1240 | YYSTYPE *yyvs; | ||
| 1241 | YYSTYPE *yyvsp; | ||
| 1242 | |||
| 1243 | /* The location stack. */ | ||
| 1244 | YYLTYPE yylsa[YYINITDEPTH]; | ||
| 1245 | YYLTYPE *yyls; | ||
| 1246 | YYLTYPE *yylsp; | ||
| 1247 | |||
| 1248 | /* The locations where the error started and ended. */ | ||
| 1249 | YYLTYPE yyerror_range[3]; | ||
| 1250 | |||
| 1251 | YYSIZE_T yystacksize; | ||
| 1252 | |||
| 1253 | int yyn; | ||
| 1254 | int yyresult; | ||
| 1255 | /* Lookahead token as an internal (translated) token number. */ | ||
| 1256 | int yytoken = 0; | ||
| 1257 | /* The variables used to return semantic value and location from the | ||
| 1258 | action routines. */ | ||
| 1259 | YYSTYPE yyval; | ||
| 1260 | YYLTYPE yyloc; | ||
| 1261 | |||
| 1262 | #if YYERROR_VERBOSE | ||
| 1263 | /* Buffer for error messages, and its allocated size. */ | ||
| 1264 | char yymsgbuf[128]; | ||
| 1265 | char *yymsg = yymsgbuf; | ||
| 1266 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | ||
| 1267 | #endif | ||
| 1268 | |||
| 1269 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) | ||
| 1270 | |||
| 1271 | /* The number of symbols on the RHS of the reduced rule. | ||
| 1272 | Keep to zero when no symbol should be popped. */ | ||
| 1273 | int yylen = 0; | ||
| 1274 | |||
| 1275 | yyssp = yyss = yyssa; | ||
| 1276 | yyvsp = yyvs = yyvsa; | ||
| 1277 | yylsp = yyls = yylsa; | ||
| 1278 | yystacksize = YYINITDEPTH; | ||
| 1279 | |||
| 1280 | YYDPRINTF ((stderr, "Starting parse\n")); | ||
| 1281 | |||
| 1282 | yystate = 0; | ||
| 1283 | yyerrstatus = 0; | ||
| 1284 | yynerrs = 0; | ||
| 1285 | yychar = YYEMPTY; /* Cause a token to be read. */ | ||
| 1286 | yylsp[0] = yylloc; | ||
| 1287 | goto yysetstate; | ||
| 1288 | |||
| 1289 | /*------------------------------------------------------------. | ||
| 1290 | | yynewstate -- Push a new state, which is found in yystate. | | ||
| 1291 | `------------------------------------------------------------*/ | ||
| 1292 | yynewstate: | ||
| 1293 | /* In all cases, when you get here, the value and location stacks | ||
| 1294 | have just been pushed. So pushing a state here evens the stacks. */ | ||
| 1295 | yyssp++; | ||
| 1296 | |||
| 1297 | yysetstate: | ||
| 1298 | *yyssp = yystate; | ||
| 1299 | |||
| 1300 | if (yyss + yystacksize - 1 <= yyssp) | ||
| 1301 | { | ||
| 1302 | /* Get the current used size of the three stacks, in elements. */ | ||
| 1303 | YYSIZE_T yysize = yyssp - yyss + 1; | ||
| 1304 | |||
| 1305 | #ifdef yyoverflow | ||
| 1306 | { | ||
| 1307 | /* Give user a chance to reallocate the stack. Use copies of | ||
| 1308 | these so that the &'s don't force the real ones into | ||
| 1309 | memory. */ | ||
| 1310 | YYSTYPE *yyvs1 = yyvs; | ||
| 1311 | yytype_int16 *yyss1 = yyss; | ||
| 1312 | YYLTYPE *yyls1 = yyls; | ||
| 1313 | |||
| 1314 | /* Each stack pointer address is followed by the size of the | ||
| 1315 | data in use in that stack, in bytes. This used to be a | ||
| 1316 | conditional around just the two extra args, but that might | ||
| 1317 | be undefined if yyoverflow is a macro. */ | ||
| 1318 | yyoverflow (YY_("memory exhausted"), | ||
| 1319 | &yyss1, yysize * sizeof (*yyssp), | ||
| 1320 | &yyvs1, yysize * sizeof (*yyvsp), | ||
| 1321 | &yyls1, yysize * sizeof (*yylsp), | ||
| 1322 | &yystacksize); | ||
| 1323 | |||
| 1324 | yyls = yyls1; | ||
| 1325 | yyss = yyss1; | ||
| 1326 | yyvs = yyvs1; | ||
| 1327 | } | ||
| 1328 | #else /* no yyoverflow */ | ||
| 1329 | # ifndef YYSTACK_RELOCATE | ||
| 1330 | goto yyexhaustedlab; | ||
| 1331 | # else | ||
| 1332 | /* Extend the stack our own way. */ | ||
| 1333 | if (YYMAXDEPTH <= yystacksize) | ||
| 1334 | goto yyexhaustedlab; | ||
| 1335 | yystacksize *= 2; | ||
| 1336 | if (YYMAXDEPTH < yystacksize) | ||
| 1337 | yystacksize = YYMAXDEPTH; | ||
| 1338 | |||
| 1339 | { | ||
| 1340 | yytype_int16 *yyss1 = yyss; | ||
| 1341 | union yyalloc *yyptr = | ||
| 1342 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | ||
| 1343 | if (! yyptr) | ||
| 1344 | goto yyexhaustedlab; | ||
| 1345 | YYSTACK_RELOCATE (yyss_alloc, yyss); | ||
| 1346 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); | ||
| 1347 | YYSTACK_RELOCATE (yyls_alloc, yyls); | ||
| 1348 | # undef YYSTACK_RELOCATE | ||
| 1349 | if (yyss1 != yyssa) | ||
| 1350 | YYSTACK_FREE (yyss1); | ||
| 1351 | } | ||
| 1352 | # endif | ||
| 1353 | #endif /* no yyoverflow */ | ||
| 1354 | |||
| 1355 | yyssp = yyss + yysize - 1; | ||
| 1356 | yyvsp = yyvs + yysize - 1; | ||
| 1357 | yylsp = yyls + yysize - 1; | ||
| 1358 | |||
| 1359 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | ||
| 1360 | (unsigned long int) yystacksize)); | ||
| 1361 | |||
| 1362 | if (yyss + yystacksize - 1 <= yyssp) | ||
| 1363 | YYABORT; | ||
| 1364 | } | ||
| 1365 | |||
| 1366 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | ||
| 1367 | |||
| 1368 | if (yystate == YYFINAL) | ||
| 1369 | YYACCEPT; | ||
| 1370 | |||
| 1371 | goto yybackup; | ||
| 1372 | |||
| 1373 | /*-----------. | ||
| 1374 | | yybackup. | | ||
| 1375 | `-----------*/ | ||
| 1376 | yybackup: | ||
| 1377 | |||
| 1378 | /* Do appropriate processing given the current state. Read a | ||
| 1379 | lookahead token if we need one and don't already have one. */ | ||
| 1380 | |||
| 1381 | /* First try to decide what to do without reference to lookahead token. */ | ||
| 1382 | yyn = yypact[yystate]; | ||
| 1383 | if (yypact_value_is_default (yyn)) | ||
| 1384 | goto yydefault; | ||
| 1385 | |||
| 1386 | /* Not known => get a lookahead token if don't already have one. */ | ||
| 1387 | |||
| 1388 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ | ||
| 1389 | if (yychar == YYEMPTY) | ||
| 1390 | { | ||
| 1391 | YYDPRINTF ((stderr, "Reading a token: ")); | ||
| 1392 | yychar = yylex (); | ||
| 1393 | } | ||
| 1394 | |||
| 1395 | if (yychar <= YYEOF) | ||
| 1396 | { | ||
| 1397 | yychar = yytoken = YYEOF; | ||
| 1398 | YYDPRINTF ((stderr, "Now at end of input.\n")); | ||
| 1399 | } | ||
| 1400 | else | ||
| 1401 | { | ||
| 1402 | yytoken = YYTRANSLATE (yychar); | ||
| 1403 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); | ||
| 1404 | } | ||
| 1405 | |||
| 1406 | /* If the proper action on seeing token YYTOKEN is to reduce or to | ||
| 1407 | detect an error, take that action. */ | ||
| 1408 | yyn += yytoken; | ||
| 1409 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) | ||
| 1410 | goto yydefault; | ||
| 1411 | yyn = yytable[yyn]; | ||
| 1412 | if (yyn <= 0) | ||
| 1413 | { | ||
| 1414 | if (yytable_value_is_error (yyn)) | ||
| 1415 | goto yyerrlab; | ||
| 1416 | yyn = -yyn; | ||
| 1417 | goto yyreduce; | ||
| 1418 | } | ||
| 1419 | |||
| 1420 | /* Count tokens shifted since error; after three, turn off error | ||
| 1421 | status. */ | ||
| 1422 | if (yyerrstatus) | ||
| 1423 | yyerrstatus--; | ||
| 1424 | |||
| 1425 | /* Shift the lookahead token. */ | ||
| 1426 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); | ||
| 1427 | |||
| 1428 | /* Discard the shifted token. */ | ||
| 1429 | yychar = YYEMPTY; | ||
| 1430 | |||
| 1431 | yystate = yyn; | ||
| 1432 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN | ||
| 1433 | *++yyvsp = yylval; | ||
| 1434 | YY_IGNORE_MAYBE_UNINITIALIZED_END | ||
| 1435 | *++yylsp = yylloc; | ||
| 1436 | goto yynewstate; | ||
| 1437 | |||
| 1438 | |||
| 1439 | /*-----------------------------------------------------------. | ||
| 1440 | | yydefault -- do the default action for the current state. | | ||
| 1441 | `-----------------------------------------------------------*/ | ||
| 1442 | yydefault: | ||
| 1443 | yyn = yydefact[yystate]; | ||
| 1444 | if (yyn == 0) | ||
| 1445 | goto yyerrlab; | ||
| 1446 | goto yyreduce; | ||
| 1447 | |||
| 1448 | |||
| 1449 | /*-----------------------------. | ||
| 1450 | | yyreduce -- Do a reduction. | | ||
| 1451 | `-----------------------------*/ | ||
| 1452 | yyreduce: | ||
| 1453 | /* yyn is the number of a rule to reduce with. */ | ||
| 1454 | yylen = yyr2[yyn]; | ||
| 1455 | |||
| 1456 | /* If YYLEN is nonzero, implement the default value of the action: | ||
| 1457 | '$$ = $1'. | ||
| 1458 | |||
| 1459 | Otherwise, the following line sets YYVAL to garbage. | ||
| 1460 | This behavior is undocumented and Bison | ||
| 1461 | users should not rely upon it. Assigning to YYVAL | ||
| 1462 | unconditionally makes the parser a bit smaller, and it avoids a | ||
| 1463 | GCC warning that YYVAL may be used uninitialized. */ | ||
| 1464 | yyval = yyvsp[1-yylen]; | ||
| 1465 | |||
| 1466 | /* Default location. */ | ||
| 1467 | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); | ||
| 1468 | YY_REDUCE_PRINT (yyn); | ||
| 1469 | switch (yyn) | ||
| 1470 | { | ||
| 1471 | case 2: | ||
| 1472 | #line 110 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1473 | { | ||
| 1474 | parser_output = build_dt_info((yyvsp[-2].flags), (yyvsp[-1].re), (yyvsp[0].node), | ||
| 1475 | guess_boot_cpuid((yyvsp[0].node))); | ||
| 1476 | } | ||
| 1477 | #line 1478 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1478 | break; | ||
| 1479 | |||
| 1480 | case 3: | ||
| 1481 | #line 118 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1482 | { | ||
| 1483 | (yyval.flags) = DTSF_V1; | ||
| 1484 | } | ||
| 1485 | #line 1486 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1486 | break; | ||
| 1487 | |||
| 1488 | case 4: | ||
| 1489 | #line 122 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1490 | { | ||
| 1491 | (yyval.flags) = DTSF_V1 | DTSF_PLUGIN; | ||
| 1492 | } | ||
| 1493 | #line 1494 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1494 | break; | ||
| 1495 | |||
| 1496 | case 6: | ||
| 1497 | #line 130 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1498 | { | ||
| 1499 | if ((yyvsp[0].flags) != (yyvsp[-1].flags)) | ||
| 1500 | ERROR(&(yylsp[0]), "Header flags don't match earlier ones"); | ||
| 1501 | (yyval.flags) = (yyvsp[-1].flags); | ||
| 1502 | } | ||
| 1503 | #line 1504 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1504 | break; | ||
| 1505 | |||
| 1506 | case 7: | ||
| 1507 | #line 139 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1508 | { | ||
| 1509 | (yyval.re) = NULL; | ||
| 1510 | } | ||
| 1511 | #line 1512 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1512 | break; | ||
| 1513 | |||
| 1514 | case 8: | ||
| 1515 | #line 143 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1516 | { | ||
| 1517 | (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); | ||
| 1518 | } | ||
| 1519 | #line 1520 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1520 | break; | ||
| 1521 | |||
| 1522 | case 9: | ||
| 1523 | #line 150 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1524 | { | ||
| 1525 | (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); | ||
| 1526 | } | ||
| 1527 | #line 1528 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1528 | break; | ||
| 1529 | |||
| 1530 | case 10: | ||
| 1531 | #line 154 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1532 | { | ||
| 1533 | add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref)); | ||
| 1534 | (yyval.re) = (yyvsp[0].re); | ||
| 1535 | } | ||
| 1536 | #line 1537 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1537 | break; | ||
| 1538 | |||
| 1539 | case 11: | ||
| 1540 | #line 162 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1541 | { | ||
| 1542 | (yyval.node) = name_node((yyvsp[0].node), ""); | ||
| 1543 | } | ||
| 1544 | #line 1545 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1545 | break; | ||
| 1546 | |||
| 1547 | case 12: | ||
| 1548 | #line 166 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1549 | { | ||
| 1550 | (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node)); | ||
| 1551 | } | ||
| 1552 | #line 1553 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1553 | break; | ||
| 1554 | |||
| 1555 | case 13: | ||
| 1556 | #line 171 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1557 | { | ||
| 1558 | struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); | ||
| 1559 | |||
| 1560 | if (target) { | ||
| 1561 | add_label(&target->labels, (yyvsp[-2].labelref)); | ||
| 1562 | merge_nodes(target, (yyvsp[0].node)); | ||
| 1563 | } else | ||
| 1564 | ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); | ||
| 1565 | (yyval.node) = (yyvsp[-3].node); | ||
| 1566 | } | ||
| 1567 | #line 1568 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1568 | break; | ||
| 1569 | |||
| 1570 | case 14: | ||
| 1571 | #line 182 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1572 | { | ||
| 1573 | struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref)); | ||
| 1574 | |||
| 1575 | if (target) { | ||
| 1576 | merge_nodes(target, (yyvsp[0].node)); | ||
| 1577 | } else { | ||
| 1578 | /* | ||
| 1579 | * We rely on the rule being always: | ||
| 1580 | * versioninfo plugindecl memreserves devicetree | ||
| 1581 | * so $-1 is what we want (plugindecl) | ||
| 1582 | */ | ||
| 1583 | if ((yyvsp[(-1) - (3)].flags) & DTSF_PLUGIN) | ||
| 1584 | add_orphan_node((yyvsp[-2].node), (yyvsp[0].node), (yyvsp[-1].labelref)); | ||
| 1585 | else | ||
| 1586 | ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); | ||
| 1587 | } | ||
| 1588 | (yyval.node) = (yyvsp[-2].node); | ||
| 1589 | } | ||
| 1590 | #line 1591 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1591 | break; | ||
| 1592 | |||
| 1593 | case 15: | ||
| 1594 | #line 201 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1595 | { | ||
| 1596 | struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); | ||
| 1597 | |||
| 1598 | if (target) | ||
| 1599 | delete_node(target); | ||
| 1600 | else | ||
| 1601 | ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); | ||
| 1602 | |||
| 1603 | |||
| 1604 | (yyval.node) = (yyvsp[-3].node); | ||
| 1605 | } | ||
| 1606 | #line 1607 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1607 | break; | ||
| 1608 | |||
| 1609 | case 16: | ||
| 1610 | #line 213 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1611 | { | ||
| 1612 | /* build empty node */ | ||
| 1613 | (yyval.node) = name_node(build_node(NULL, NULL), ""); | ||
| 1614 | } | ||
| 1615 | #line 1616 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1616 | break; | ||
| 1617 | |||
| 1618 | case 17: | ||
| 1619 | #line 221 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1620 | { | ||
| 1621 | (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist)); | ||
| 1622 | } | ||
| 1623 | #line 1624 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1624 | break; | ||
| 1625 | |||
| 1626 | case 18: | ||
| 1627 | #line 228 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1628 | { | ||
| 1629 | (yyval.proplist) = NULL; | ||
| 1630 | } | ||
| 1631 | #line 1632 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1632 | break; | ||
| 1633 | |||
| 1634 | case 19: | ||
| 1635 | #line 232 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1636 | { | ||
| 1637 | (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist)); | ||
| 1638 | } | ||
| 1639 | #line 1640 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1640 | break; | ||
| 1641 | |||
| 1642 | case 20: | ||
| 1643 | #line 239 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1644 | { | ||
| 1645 | (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data)); | ||
| 1646 | } | ||
| 1647 | #line 1648 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1648 | break; | ||
| 1649 | |||
| 1650 | case 21: | ||
| 1651 | #line 243 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1652 | { | ||
| 1653 | (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data); | ||
| 1654 | } | ||
| 1655 | #line 1656 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1656 | break; | ||
| 1657 | |||
| 1658 | case 22: | ||
| 1659 | #line 247 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1660 | { | ||
| 1661 | (yyval.prop) = build_property_delete((yyvsp[-1].propnodename)); | ||
| 1662 | } | ||
| 1663 | #line 1664 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1664 | break; | ||
| 1665 | |||
| 1666 | case 23: | ||
| 1667 | #line 251 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1668 | { | ||
| 1669 | add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref)); | ||
| 1670 | (yyval.prop) = (yyvsp[0].prop); | ||
| 1671 | } | ||
| 1672 | #line 1673 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1673 | break; | ||
| 1674 | |||
| 1675 | case 24: | ||
| 1676 | #line 259 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1677 | { | ||
| 1678 | (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data)); | ||
| 1679 | } | ||
| 1680 | #line 1681 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1681 | break; | ||
| 1682 | |||
| 1683 | case 25: | ||
| 1684 | #line 263 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1685 | { | ||
| 1686 | (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data); | ||
| 1687 | } | ||
| 1688 | #line 1689 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1689 | break; | ||
| 1690 | |||
| 1691 | case 26: | ||
| 1692 | #line 267 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1693 | { | ||
| 1694 | (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data)); | ||
| 1695 | } | ||
| 1696 | #line 1697 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1697 | break; | ||
| 1698 | |||
| 1699 | case 27: | ||
| 1700 | #line 271 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1701 | { | ||
| 1702 | (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref)); | ||
| 1703 | } | ||
| 1704 | #line 1705 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1705 | break; | ||
| 1706 | |||
| 1707 | case 28: | ||
| 1708 | #line 275 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1709 | { | ||
| 1710 | FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL); | ||
| 1711 | struct data d; | ||
| 1712 | |||
| 1713 | if ((yyvsp[-3].integer) != 0) | ||
| 1714 | if (fseek(f, (yyvsp[-3].integer), SEEK_SET) != 0) | ||
| 1715 | die("Couldn't seek to offset %llu in \"%s\": %s", | ||
| 1716 | (unsigned long long)(yyvsp[-3].integer), (yyvsp[-5].data).val, | ||
| 1717 | strerror(errno)); | ||
| 1718 | |||
| 1719 | d = data_copy_file(f, (yyvsp[-1].integer)); | ||
| 1720 | |||
| 1721 | (yyval.data) = data_merge((yyvsp[-8].data), d); | ||
| 1722 | fclose(f); | ||
| 1723 | } | ||
| 1724 | #line 1725 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1725 | break; | ||
| 1726 | |||
| 1727 | case 29: | ||
| 1728 | #line 291 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1729 | { | ||
| 1730 | FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL); | ||
| 1731 | struct data d = empty_data; | ||
| 1732 | |||
| 1733 | d = data_copy_file(f, -1); | ||
| 1734 | |||
| 1735 | (yyval.data) = data_merge((yyvsp[-4].data), d); | ||
| 1736 | fclose(f); | ||
| 1737 | } | ||
| 1738 | #line 1739 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1739 | break; | ||
| 1740 | |||
| 1741 | case 30: | ||
| 1742 | #line 301 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1743 | { | ||
| 1744 | (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); | ||
| 1745 | } | ||
| 1746 | #line 1747 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1747 | break; | ||
| 1748 | |||
| 1749 | case 31: | ||
| 1750 | #line 308 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1751 | { | ||
| 1752 | (yyval.data) = empty_data; | ||
| 1753 | } | ||
| 1754 | #line 1755 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1755 | break; | ||
| 1756 | |||
| 1757 | case 32: | ||
| 1758 | #line 312 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1759 | { | ||
| 1760 | (yyval.data) = (yyvsp[-1].data); | ||
| 1761 | } | ||
| 1762 | #line 1763 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1763 | break; | ||
| 1764 | |||
| 1765 | case 33: | ||
| 1766 | #line 316 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1767 | { | ||
| 1768 | (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); | ||
| 1769 | } | ||
| 1770 | #line 1771 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1771 | break; | ||
| 1772 | |||
| 1773 | case 34: | ||
| 1774 | #line 323 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1775 | { | ||
| 1776 | unsigned long long bits; | ||
| 1777 | |||
| 1778 | bits = (yyvsp[-1].integer); | ||
| 1779 | |||
| 1780 | if ((bits != 8) && (bits != 16) && | ||
| 1781 | (bits != 32) && (bits != 64)) { | ||
| 1782 | ERROR(&(yylsp[-1]), "Array elements must be" | ||
| 1783 | " 8, 16, 32 or 64-bits"); | ||
| 1784 | bits = 32; | ||
| 1785 | } | ||
| 1786 | |||
| 1787 | (yyval.array).data = empty_data; | ||
| 1788 | (yyval.array).bits = bits; | ||
| 1789 | } | ||
| 1790 | #line 1791 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1791 | break; | ||
| 1792 | |||
| 1793 | case 35: | ||
| 1794 | #line 339 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1795 | { | ||
| 1796 | (yyval.array).data = empty_data; | ||
| 1797 | (yyval.array).bits = 32; | ||
| 1798 | } | ||
| 1799 | #line 1800 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1800 | break; | ||
| 1801 | |||
| 1802 | case 36: | ||
| 1803 | #line 344 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1804 | { | ||
| 1805 | if ((yyvsp[-1].array).bits < 64) { | ||
| 1806 | uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1; | ||
| 1807 | /* | ||
| 1808 | * Bits above mask must either be all zero | ||
| 1809 | * (positive within range of mask) or all one | ||
| 1810 | * (negative and sign-extended). The second | ||
| 1811 | * condition is true if when we set all bits | ||
| 1812 | * within the mask to one (i.e. | in the | ||
| 1813 | * mask), all bits are one. | ||
| 1814 | */ | ||
| 1815 | if (((yyvsp[0].integer) > mask) && (((yyvsp[0].integer) | mask) != -1ULL)) | ||
| 1816 | ERROR(&(yylsp[0]), "Value out of range for" | ||
| 1817 | " %d-bit array element", (yyvsp[-1].array).bits); | ||
| 1818 | } | ||
| 1819 | |||
| 1820 | (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits); | ||
| 1821 | } | ||
| 1822 | #line 1823 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1823 | break; | ||
| 1824 | |||
| 1825 | case 37: | ||
| 1826 | #line 363 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1827 | { | ||
| 1828 | uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits); | ||
| 1829 | |||
| 1830 | if ((yyvsp[-1].array).bits == 32) | ||
| 1831 | (yyvsp[-1].array).data = data_add_marker((yyvsp[-1].array).data, | ||
| 1832 | REF_PHANDLE, | ||
| 1833 | (yyvsp[0].labelref)); | ||
| 1834 | else | ||
| 1835 | ERROR(&(yylsp[0]), "References are only allowed in " | ||
| 1836 | "arrays with 32-bit elements."); | ||
| 1837 | |||
| 1838 | (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits); | ||
| 1839 | } | ||
| 1840 | #line 1841 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1841 | break; | ||
| 1842 | |||
| 1843 | case 38: | ||
| 1844 | #line 377 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1845 | { | ||
| 1846 | (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref)); | ||
| 1847 | } | ||
| 1848 | #line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1849 | break; | ||
| 1850 | |||
| 1851 | case 41: | ||
| 1852 | #line 386 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1853 | { | ||
| 1854 | (yyval.integer) = (yyvsp[-1].integer); | ||
| 1855 | } | ||
| 1856 | #line 1857 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1857 | break; | ||
| 1858 | |||
| 1859 | case 44: | ||
| 1860 | #line 397 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1861 | { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); } | ||
| 1862 | #line 1863 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1863 | break; | ||
| 1864 | |||
| 1865 | case 46: | ||
| 1866 | #line 402 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1867 | { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); } | ||
| 1868 | #line 1869 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1869 | break; | ||
| 1870 | |||
| 1871 | case 48: | ||
| 1872 | #line 407 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1873 | { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); } | ||
| 1874 | #line 1875 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1875 | break; | ||
| 1876 | |||
| 1877 | case 50: | ||
| 1878 | #line 412 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1879 | { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); } | ||
| 1880 | #line 1881 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1881 | break; | ||
| 1882 | |||
| 1883 | case 52: | ||
| 1884 | #line 417 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1885 | { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); } | ||
| 1886 | #line 1887 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1887 | break; | ||
| 1888 | |||
| 1889 | case 54: | ||
| 1890 | #line 422 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1891 | { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); } | ||
| 1892 | #line 1893 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1893 | break; | ||
| 1894 | |||
| 1895 | case 56: | ||
| 1896 | #line 427 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1897 | { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); } | ||
| 1898 | #line 1899 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1899 | break; | ||
| 1900 | |||
| 1901 | case 57: | ||
| 1902 | #line 428 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1903 | { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); } | ||
| 1904 | #line 1905 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1905 | break; | ||
| 1906 | |||
| 1907 | case 59: | ||
| 1908 | #line 433 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1909 | { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); } | ||
| 1910 | #line 1911 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1911 | break; | ||
| 1912 | |||
| 1913 | case 60: | ||
| 1914 | #line 434 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1915 | { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); } | ||
| 1916 | #line 1917 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1917 | break; | ||
| 1918 | |||
| 1919 | case 61: | ||
| 1920 | #line 435 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1921 | { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); } | ||
| 1922 | #line 1923 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1923 | break; | ||
| 1924 | |||
| 1925 | case 62: | ||
| 1926 | #line 436 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1927 | { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); } | ||
| 1928 | #line 1929 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1929 | break; | ||
| 1930 | |||
| 1931 | case 63: | ||
| 1932 | #line 440 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1933 | { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); } | ||
| 1934 | #line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1935 | break; | ||
| 1936 | |||
| 1937 | case 64: | ||
| 1938 | #line 441 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1939 | { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); } | ||
| 1940 | #line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1941 | break; | ||
| 1942 | |||
| 1943 | case 66: | ||
| 1944 | #line 446 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1945 | { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); } | ||
| 1946 | #line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1947 | break; | ||
| 1948 | |||
| 1949 | case 67: | ||
| 1950 | #line 447 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1951 | { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); } | ||
| 1952 | #line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1953 | break; | ||
| 1954 | |||
| 1955 | case 69: | ||
| 1956 | #line 452 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1957 | { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); } | ||
| 1958 | #line 1959 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1959 | break; | ||
| 1960 | |||
| 1961 | case 70: | ||
| 1962 | #line 454 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1963 | { | ||
| 1964 | if ((yyvsp[0].integer) != 0) { | ||
| 1965 | (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); | ||
| 1966 | } else { | ||
| 1967 | ERROR(&(yyloc), "Division by zero"); | ||
| 1968 | (yyval.integer) = 0; | ||
| 1969 | } | ||
| 1970 | } | ||
| 1971 | #line 1972 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1972 | break; | ||
| 1973 | |||
| 1974 | case 71: | ||
| 1975 | #line 463 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1976 | { | ||
| 1977 | if ((yyvsp[0].integer) != 0) { | ||
| 1978 | (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); | ||
| 1979 | } else { | ||
| 1980 | ERROR(&(yyloc), "Division by zero"); | ||
| 1981 | (yyval.integer) = 0; | ||
| 1982 | } | ||
| 1983 | } | ||
| 1984 | #line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1985 | break; | ||
| 1986 | |||
| 1987 | case 74: | ||
| 1988 | #line 476 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1989 | { (yyval.integer) = -(yyvsp[0].integer); } | ||
| 1990 | #line 1991 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1991 | break; | ||
| 1992 | |||
| 1993 | case 75: | ||
| 1994 | #line 477 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 1995 | { (yyval.integer) = ~(yyvsp[0].integer); } | ||
| 1996 | #line 1997 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 1997 | break; | ||
| 1998 | |||
| 1999 | case 76: | ||
| 2000 | #line 478 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 2001 | { (yyval.integer) = !(yyvsp[0].integer); } | ||
| 2002 | #line 2003 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 2003 | break; | ||
| 2004 | |||
| 2005 | case 77: | ||
| 2006 | #line 483 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 2007 | { | ||
| 2008 | (yyval.data) = empty_data; | ||
| 2009 | } | ||
| 2010 | #line 2011 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 2011 | break; | ||
| 2012 | |||
| 2013 | case 78: | ||
| 2014 | #line 487 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 2015 | { | ||
| 2016 | (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte)); | ||
| 2017 | } | ||
| 2018 | #line 2019 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 2019 | break; | ||
| 2020 | |||
| 2021 | case 79: | ||
| 2022 | #line 491 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 2023 | { | ||
| 2024 | (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); | ||
| 2025 | } | ||
| 2026 | #line 2027 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 2027 | break; | ||
| 2028 | |||
| 2029 | case 80: | ||
| 2030 | #line 498 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 2031 | { | ||
| 2032 | (yyval.nodelist) = NULL; | ||
| 2033 | } | ||
| 2034 | #line 2035 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 2035 | break; | ||
| 2036 | |||
| 2037 | case 81: | ||
| 2038 | #line 502 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 2039 | { | ||
| 2040 | (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist)); | ||
| 2041 | } | ||
| 2042 | #line 2043 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 2043 | break; | ||
| 2044 | |||
| 2045 | case 82: | ||
| 2046 | #line 506 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 2047 | { | ||
| 2048 | ERROR(&(yylsp[0]), "Properties must precede subnodes"); | ||
| 2049 | YYERROR; | ||
| 2050 | } | ||
| 2051 | #line 2052 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 2052 | break; | ||
| 2053 | |||
| 2054 | case 83: | ||
| 2055 | #line 514 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 2056 | { | ||
| 2057 | (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename)); | ||
| 2058 | } | ||
| 2059 | #line 2060 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 2060 | break; | ||
| 2061 | |||
| 2062 | case 84: | ||
| 2063 | #line 518 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 2064 | { | ||
| 2065 | (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename)); | ||
| 2066 | } | ||
| 2067 | #line 2068 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 2068 | break; | ||
| 2069 | |||
| 2070 | case 85: | ||
| 2071 | #line 522 "dtc-parser.y" /* yacc.c:1646 */ | ||
| 2072 | { | ||
| 2073 | add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref)); | ||
| 2074 | (yyval.node) = (yyvsp[0].node); | ||
| 2075 | } | ||
| 2076 | #line 2077 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 2077 | break; | ||
| 2078 | |||
| 2079 | |||
| 2080 | #line 2081 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
| 2081 | default: break; | ||
| 2082 | } | ||
| 2083 | /* User semantic actions sometimes alter yychar, and that requires | ||
| 2084 | that yytoken be updated with the new translation. We take the | ||
| 2085 | approach of translating immediately before every use of yytoken. | ||
| 2086 | One alternative is translating here after every semantic action, | ||
| 2087 | but that translation would be missed if the semantic action invokes | ||
| 2088 | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or | ||
| 2089 | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an | ||
| 2090 | incorrect destructor might then be invoked immediately. In the | ||
| 2091 | case of YYERROR or YYBACKUP, subsequent parser actions might lead | ||
| 2092 | to an incorrect destructor call or verbose syntax error message | ||
| 2093 | before the lookahead is translated. */ | ||
| 2094 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); | ||
| 2095 | |||
| 2096 | YYPOPSTACK (yylen); | ||
| 2097 | yylen = 0; | ||
| 2098 | YY_STACK_PRINT (yyss, yyssp); | ||
| 2099 | |||
| 2100 | *++yyvsp = yyval; | ||
| 2101 | *++yylsp = yyloc; | ||
| 2102 | |||
| 2103 | /* Now 'shift' the result of the reduction. Determine what state | ||
| 2104 | that goes to, based on the state we popped back to and the rule | ||
| 2105 | number reduced by. */ | ||
| 2106 | |||
| 2107 | yyn = yyr1[yyn]; | ||
| 2108 | |||
| 2109 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; | ||
| 2110 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) | ||
| 2111 | yystate = yytable[yystate]; | ||
| 2112 | else | ||
| 2113 | yystate = yydefgoto[yyn - YYNTOKENS]; | ||
| 2114 | |||
| 2115 | goto yynewstate; | ||
| 2116 | |||
| 2117 | |||
| 2118 | /*--------------------------------------. | ||
| 2119 | | yyerrlab -- here on detecting error. | | ||
| 2120 | `--------------------------------------*/ | ||
| 2121 | yyerrlab: | ||
| 2122 | /* Make sure we have latest lookahead translation. See comments at | ||
| 2123 | user semantic actions for why this is necessary. */ | ||
| 2124 | yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); | ||
| 2125 | |||
| 2126 | /* If not already recovering from an error, report this error. */ | ||
| 2127 | if (!yyerrstatus) | ||
| 2128 | { | ||
| 2129 | ++yynerrs; | ||
| 2130 | #if ! YYERROR_VERBOSE | ||
| 2131 | yyerror (YY_("syntax error")); | ||
| 2132 | #else | ||
| 2133 | # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ | ||
| 2134 | yyssp, yytoken) | ||
| 2135 | { | ||
| 2136 | char const *yymsgp = YY_("syntax error"); | ||
| 2137 | int yysyntax_error_status; | ||
| 2138 | yysyntax_error_status = YYSYNTAX_ERROR; | ||
| 2139 | if (yysyntax_error_status == 0) | ||
| 2140 | yymsgp = yymsg; | ||
| 2141 | else if (yysyntax_error_status == 1) | ||
| 2142 | { | ||
| 2143 | if (yymsg != yymsgbuf) | ||
| 2144 | YYSTACK_FREE (yymsg); | ||
| 2145 | yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); | ||
| 2146 | if (!yymsg) | ||
| 2147 | { | ||
| 2148 | yymsg = yymsgbuf; | ||
| 2149 | yymsg_alloc = sizeof yymsgbuf; | ||
| 2150 | yysyntax_error_status = 2; | ||
| 2151 | } | ||
| 2152 | else | ||
| 2153 | { | ||
| 2154 | yysyntax_error_status = YYSYNTAX_ERROR; | ||
| 2155 | yymsgp = yymsg; | ||
| 2156 | } | ||
| 2157 | } | ||
| 2158 | yyerror (yymsgp); | ||
| 2159 | if (yysyntax_error_status == 2) | ||
| 2160 | goto yyexhaustedlab; | ||
| 2161 | } | ||
| 2162 | # undef YYSYNTAX_ERROR | ||
| 2163 | #endif | ||
| 2164 | } | ||
| 2165 | |||
| 2166 | yyerror_range[1] = yylloc; | ||
| 2167 | |||
| 2168 | if (yyerrstatus == 3) | ||
| 2169 | { | ||
| 2170 | /* If just tried and failed to reuse lookahead token after an | ||
| 2171 | error, discard it. */ | ||
| 2172 | |||
| 2173 | if (yychar <= YYEOF) | ||
| 2174 | { | ||
| 2175 | /* Return failure if at end of input. */ | ||
| 2176 | if (yychar == YYEOF) | ||
| 2177 | YYABORT; | ||
| 2178 | } | ||
| 2179 | else | ||
| 2180 | { | ||
| 2181 | yydestruct ("Error: discarding", | ||
| 2182 | yytoken, &yylval, &yylloc); | ||
| 2183 | yychar = YYEMPTY; | ||
| 2184 | } | ||
| 2185 | } | ||
| 2186 | |||
| 2187 | /* Else will try to reuse lookahead token after shifting the error | ||
| 2188 | token. */ | ||
| 2189 | goto yyerrlab1; | ||
| 2190 | |||
| 2191 | |||
| 2192 | /*---------------------------------------------------. | ||
| 2193 | | yyerrorlab -- error raised explicitly by YYERROR. | | ||
| 2194 | `---------------------------------------------------*/ | ||
| 2195 | yyerrorlab: | ||
| 2196 | |||
| 2197 | /* Pacify compilers like GCC when the user code never invokes | ||
| 2198 | YYERROR and the label yyerrorlab therefore never appears in user | ||
| 2199 | code. */ | ||
| 2200 | if (/*CONSTCOND*/ 0) | ||
| 2201 | goto yyerrorlab; | ||
| 2202 | |||
| 2203 | yyerror_range[1] = yylsp[1-yylen]; | ||
| 2204 | /* Do not reclaim the symbols of the rule whose action triggered | ||
| 2205 | this YYERROR. */ | ||
| 2206 | YYPOPSTACK (yylen); | ||
| 2207 | yylen = 0; | ||
| 2208 | YY_STACK_PRINT (yyss, yyssp); | ||
| 2209 | yystate = *yyssp; | ||
| 2210 | goto yyerrlab1; | ||
| 2211 | |||
| 2212 | |||
| 2213 | /*-------------------------------------------------------------. | ||
| 2214 | | yyerrlab1 -- common code for both syntax error and YYERROR. | | ||
| 2215 | `-------------------------------------------------------------*/ | ||
| 2216 | yyerrlab1: | ||
| 2217 | yyerrstatus = 3; /* Each real token shifted decrements this. */ | ||
| 2218 | |||
| 2219 | for (;;) | ||
| 2220 | { | ||
| 2221 | yyn = yypact[yystate]; | ||
| 2222 | if (!yypact_value_is_default (yyn)) | ||
| 2223 | { | ||
| 2224 | yyn += YYTERROR; | ||
| 2225 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | ||
| 2226 | { | ||
| 2227 | yyn = yytable[yyn]; | ||
| 2228 | if (0 < yyn) | ||
| 2229 | break; | ||
| 2230 | } | ||
| 2231 | } | ||
| 2232 | |||
| 2233 | /* Pop the current state because it cannot handle the error token. */ | ||
| 2234 | if (yyssp == yyss) | ||
| 2235 | YYABORT; | ||
| 2236 | |||
| 2237 | yyerror_range[1] = *yylsp; | ||
| 2238 | yydestruct ("Error: popping", | ||
| 2239 | yystos[yystate], yyvsp, yylsp); | ||
| 2240 | YYPOPSTACK (1); | ||
| 2241 | yystate = *yyssp; | ||
| 2242 | YY_STACK_PRINT (yyss, yyssp); | ||
| 2243 | } | ||
| 2244 | |||
| 2245 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN | ||
| 2246 | *++yyvsp = yylval; | ||
| 2247 | YY_IGNORE_MAYBE_UNINITIALIZED_END | ||
| 2248 | |||
| 2249 | yyerror_range[2] = yylloc; | ||
| 2250 | /* Using YYLLOC is tempting, but would change the location of | ||
| 2251 | the lookahead. YYLOC is available though. */ | ||
| 2252 | YYLLOC_DEFAULT (yyloc, yyerror_range, 2); | ||
| 2253 | *++yylsp = yyloc; | ||
| 2254 | |||
| 2255 | /* Shift the error token. */ | ||
| 2256 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); | ||
| 2257 | |||
| 2258 | yystate = yyn; | ||
| 2259 | goto yynewstate; | ||
| 2260 | |||
| 2261 | |||
| 2262 | /*-------------------------------------. | ||
| 2263 | | yyacceptlab -- YYACCEPT comes here. | | ||
| 2264 | `-------------------------------------*/ | ||
| 2265 | yyacceptlab: | ||
| 2266 | yyresult = 0; | ||
| 2267 | goto yyreturn; | ||
| 2268 | |||
| 2269 | /*-----------------------------------. | ||
| 2270 | | yyabortlab -- YYABORT comes here. | | ||
| 2271 | `-----------------------------------*/ | ||
| 2272 | yyabortlab: | ||
| 2273 | yyresult = 1; | ||
| 2274 | goto yyreturn; | ||
| 2275 | |||
| 2276 | #if !defined yyoverflow || YYERROR_VERBOSE | ||
| 2277 | /*-------------------------------------------------. | ||
| 2278 | | yyexhaustedlab -- memory exhaustion comes here. | | ||
| 2279 | `-------------------------------------------------*/ | ||
| 2280 | yyexhaustedlab: | ||
| 2281 | yyerror (YY_("memory exhausted")); | ||
| 2282 | yyresult = 2; | ||
| 2283 | /* Fall through. */ | ||
| 2284 | #endif | ||
| 2285 | |||
| 2286 | yyreturn: | ||
| 2287 | if (yychar != YYEMPTY) | ||
| 2288 | { | ||
| 2289 | /* Make sure we have latest lookahead translation. See comments at | ||
| 2290 | user semantic actions for why this is necessary. */ | ||
| 2291 | yytoken = YYTRANSLATE (yychar); | ||
| 2292 | yydestruct ("Cleanup: discarding lookahead", | ||
| 2293 | yytoken, &yylval, &yylloc); | ||
| 2294 | } | ||
| 2295 | /* Do not reclaim the symbols of the rule whose action triggered | ||
| 2296 | this YYABORT or YYACCEPT. */ | ||
| 2297 | YYPOPSTACK (yylen); | ||
| 2298 | YY_STACK_PRINT (yyss, yyssp); | ||
| 2299 | while (yyssp != yyss) | ||
| 2300 | { | ||
| 2301 | yydestruct ("Cleanup: popping", | ||
| 2302 | yystos[*yyssp], yyvsp, yylsp); | ||
| 2303 | YYPOPSTACK (1); | ||
| 2304 | } | ||
| 2305 | #ifndef yyoverflow | ||
| 2306 | if (yyss != yyssa) | ||
| 2307 | YYSTACK_FREE (yyss); | ||
| 2308 | #endif | ||
| 2309 | #if YYERROR_VERBOSE | ||
| 2310 | if (yymsg != yymsgbuf) | ||
| 2311 | YYSTACK_FREE (yymsg); | ||
| 2312 | #endif | ||
| 2313 | return yyresult; | ||
| 2314 | } | ||
| 2315 | #line 528 "dtc-parser.y" /* yacc.c:1906 */ | ||
| 2316 | |||
| 2317 | |||
| 2318 | void yyerror(char const *s) | ||
| 2319 | { | ||
| 2320 | ERROR(&yylloc, "%s", s); | ||
| 2321 | } | ||
diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped deleted file mode 100644 index 6aa512c1b337..000000000000 --- a/scripts/dtc/dtc-parser.tab.h_shipped +++ /dev/null | |||
| @@ -1,125 +0,0 @@ | |||
| 1 | /* A Bison parser, made by GNU Bison 3.0.4. */ | ||
| 2 | |||
| 3 | /* Bison interface for Yacc-like parsers in C | ||
| 4 | |||
| 5 | Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. | ||
| 6 | |||
| 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 | ||
| 9 | the Free Software Foundation, either version 3 of the License, or | ||
| 10 | (at your option) any later version. | ||
| 11 | |||
| 12 | This program is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 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/>. */ | ||
| 19 | |||
| 20 | /* As a special exception, you may create a larger work that contains | ||
| 21 | part or all of the Bison parser skeleton and distribute that work | ||
| 22 | under terms of your choice, so long as that work isn't itself a | ||
| 23 | parser generator using the skeleton or a modified version thereof | ||
| 24 | as a parser skeleton. Alternatively, if you modify or redistribute | ||
| 25 | the parser skeleton itself, you may (at your option) remove this | ||
| 26 | special exception, which will cause the skeleton and the resulting | ||
| 27 | Bison output files to be licensed under the GNU General Public | ||
| 28 | License without this special exception. | ||
| 29 | |||
| 30 | This special exception was added by the Free Software Foundation in | ||
| 31 | version 2.2 of Bison. */ | ||
| 32 | |||
| 33 | #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED | ||
| 34 | # define YY_YY_DTC_PARSER_TAB_H_INCLUDED | ||
| 35 | /* Debug traces. */ | ||
| 36 | #ifndef YYDEBUG | ||
| 37 | # define YYDEBUG 0 | ||
| 38 | #endif | ||
| 39 | #if YYDEBUG | ||
| 40 | extern int yydebug; | ||
| 41 | #endif | ||
| 42 | |||
| 43 | /* Token type. */ | ||
| 44 | #ifndef YYTOKENTYPE | ||
| 45 | # define YYTOKENTYPE | ||
| 46 | enum yytokentype | ||
| 47 | { | ||
| 48 | DT_V1 = 258, | ||
| 49 | DT_PLUGIN = 259, | ||
| 50 | DT_MEMRESERVE = 260, | ||
| 51 | DT_LSHIFT = 261, | ||
| 52 | DT_RSHIFT = 262, | ||
| 53 | DT_LE = 263, | ||
| 54 | DT_GE = 264, | ||
| 55 | DT_EQ = 265, | ||
| 56 | DT_NE = 266, | ||
| 57 | DT_AND = 267, | ||
| 58 | DT_OR = 268, | ||
| 59 | DT_BITS = 269, | ||
| 60 | DT_DEL_PROP = 270, | ||
| 61 | DT_DEL_NODE = 271, | ||
| 62 | DT_PROPNODENAME = 272, | ||
| 63 | DT_LITERAL = 273, | ||
| 64 | DT_CHAR_LITERAL = 274, | ||
| 65 | DT_BYTE = 275, | ||
| 66 | DT_STRING = 276, | ||
| 67 | DT_LABEL = 277, | ||
| 68 | DT_REF = 278, | ||
| 69 | DT_INCBIN = 279 | ||
| 70 | }; | ||
| 71 | #endif | ||
| 72 | |||
| 73 | /* Value type. */ | ||
| 74 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | ||
| 75 | |||
| 76 | union YYSTYPE | ||
| 77 | { | ||
| 78 | #line 39 "dtc-parser.y" /* yacc.c:1909 */ | ||
| 79 | |||
| 80 | char *propnodename; | ||
| 81 | char *labelref; | ||
| 82 | uint8_t byte; | ||
| 83 | struct data data; | ||
| 84 | |||
| 85 | struct { | ||
| 86 | struct data data; | ||
| 87 | int bits; | ||
| 88 | } array; | ||
| 89 | |||
| 90 | struct property *prop; | ||
| 91 | struct property *proplist; | ||
| 92 | struct node *node; | ||
| 93 | struct node *nodelist; | ||
| 94 | struct reserve_info *re; | ||
| 95 | uint64_t integer; | ||
| 96 | unsigned int flags; | ||
| 97 | |||
| 98 | #line 99 "dtc-parser.tab.h" /* yacc.c:1909 */ | ||
| 99 | }; | ||
| 100 | |||
| 101 | typedef union YYSTYPE YYSTYPE; | ||
| 102 | # define YYSTYPE_IS_TRIVIAL 1 | ||
| 103 | # define YYSTYPE_IS_DECLARED 1 | ||
| 104 | #endif | ||
| 105 | |||
| 106 | /* Location type. */ | ||
| 107 | #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED | ||
| 108 | typedef struct YYLTYPE YYLTYPE; | ||
| 109 | struct YYLTYPE | ||
| 110 | { | ||
| 111 | int first_line; | ||
| 112 | int first_column; | ||
| 113 | int last_line; | ||
| 114 | int last_column; | ||
| 115 | }; | ||
| 116 | # define YYLTYPE_IS_DECLARED 1 | ||
| 117 | # define YYLTYPE_IS_TRIVIAL 1 | ||
| 118 | #endif | ||
| 119 | |||
| 120 | |||
| 121 | extern YYSTYPE yylval; | ||
| 122 | extern YYLTYPE yylloc; | ||
| 123 | int yyparse (void); | ||
| 124 | |||
| 125 | #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ | ||
diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y index affc81a8f9ab..44af170abfea 100644 --- a/scripts/dtc/dtc-parser.y +++ b/scripts/dtc/dtc-parser.y | |||
| @@ -166,7 +166,17 @@ devicetree: | |||
| 166 | { | 166 | { |
| 167 | $$ = merge_nodes($1, $3); | 167 | $$ = merge_nodes($1, $3); |
| 168 | } | 168 | } |
| 169 | 169 | | DT_REF nodedef | |
| 170 | { | ||
| 171 | /* | ||
| 172 | * We rely on the rule being always: | ||
| 173 | * versioninfo plugindecl memreserves devicetree | ||
| 174 | * so $-1 is what we want (plugindecl) | ||
| 175 | */ | ||
| 176 | if (!($<flags>-1 & DTSF_PLUGIN)) | ||
| 177 | ERROR(&@2, "Label or path %s not found", $1); | ||
| 178 | $$ = add_orphan_node(name_node(build_node(NULL, NULL), ""), $2, $1); | ||
| 179 | } | ||
| 170 | | devicetree DT_LABEL DT_REF nodedef | 180 | | devicetree DT_LABEL DT_REF nodedef |
| 171 | { | 181 | { |
| 172 | struct node *target = get_node_by_ref($1, $3); | 182 | struct node *target = get_node_by_ref($1, $3); |
| @@ -209,11 +219,6 @@ devicetree: | |||
| 209 | 219 | ||
| 210 | $$ = $1; | 220 | $$ = $1; |
| 211 | } | 221 | } |
| 212 | | /* empty */ | ||
| 213 | { | ||
| 214 | /* build empty node */ | ||
| 215 | $$ = name_node(build_node(NULL, NULL), ""); | ||
| 216 | } | ||
| 217 | ; | 222 | ; |
| 218 | 223 | ||
| 219 | nodedef: | 224 | nodedef: |
diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c index 5ed873c72ad1..c36994e6eac5 100644 --- a/scripts/dtc/dtc.c +++ b/scripts/dtc/dtc.c | |||
| @@ -59,8 +59,6 @@ static void fill_fullpaths(struct node *tree, const char *prefix) | |||
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | /* Usage related data. */ | 61 | /* Usage related data. */ |
| 62 | #define FDT_VERSION(version) _FDT_VERSION(version) | ||
| 63 | #define _FDT_VERSION(version) #version | ||
| 64 | static const char usage_synopsis[] = "dtc [options] <input file>"; | 62 | static const char usage_synopsis[] = "dtc [options] <input file>"; |
| 65 | static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:a:fb:i:H:sW:E:@Ahv"; | 63 | static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:a:fb:i:H:sW:E:@Ahv"; |
| 66 | static struct option const usage_long_opts[] = { | 64 | static struct option const usage_long_opts[] = { |
| @@ -98,7 +96,7 @@ static const char * const usage_opts_help[] = { | |||
| 98 | "\t\tdts - device tree source text\n" | 96 | "\t\tdts - device tree source text\n" |
| 99 | "\t\tdtb - device tree blob\n" | 97 | "\t\tdtb - device tree blob\n" |
| 100 | "\t\tasm - assembler source", | 98 | "\t\tasm - assembler source", |
| 101 | "\n\tBlob version to produce, defaults to "FDT_VERSION(DEFAULT_FDT_VERSION)" (for dtb and asm output)", | 99 | "\n\tBlob version to produce, defaults to "stringify(DEFAULT_FDT_VERSION)" (for dtb and asm output)", |
| 102 | "\n\tOutput dependency file", | 100 | "\n\tOutput dependency file", |
| 103 | "\n\tMake space for <number> reserve map entries (for dtb and asm output)", | 101 | "\n\tMake space for <number> reserve map entries (for dtb and asm output)", |
| 104 | "\n\tMake the blob at least <bytes> long (extra space)", | 102 | "\n\tMake the blob at least <bytes> long (extra space)", |
| @@ -319,13 +317,14 @@ int main(int argc, char *argv[]) | |||
| 319 | dti->boot_cpuid_phys = cmdline_boot_cpuid; | 317 | dti->boot_cpuid_phys = cmdline_boot_cpuid; |
| 320 | 318 | ||
| 321 | fill_fullpaths(dti->dt, ""); | 319 | fill_fullpaths(dti->dt, ""); |
| 322 | process_checks(force, dti); | ||
| 323 | 320 | ||
| 324 | /* on a plugin, generate by default */ | 321 | /* on a plugin, generate by default */ |
| 325 | if (dti->dtsflags & DTSF_PLUGIN) { | 322 | if (dti->dtsflags & DTSF_PLUGIN) { |
| 326 | generate_fixups = 1; | 323 | generate_fixups = 1; |
| 327 | } | 324 | } |
| 328 | 325 | ||
| 326 | process_checks(force, dti); | ||
| 327 | |||
| 329 | if (auto_label_aliases) | 328 | if (auto_label_aliases) |
| 330 | generate_label_tree(dti, "aliases", false); | 329 | generate_label_tree(dti, "aliases", false); |
| 331 | 330 | ||
diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h index 35cf926cc14a..3b18a42b866e 100644 --- a/scripts/dtc/dtc.h +++ b/scripts/dtc/dtc.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #ifndef _DTC_H | 1 | #ifndef DTC_H |
| 2 | #define _DTC_H | 2 | #define DTC_H |
| 3 | 3 | ||
| 4 | /* | 4 | /* |
| 5 | * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. | 5 | * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. |
| @@ -67,7 +67,8 @@ typedef uint32_t cell_t; | |||
| 67 | 67 | ||
| 68 | 68 | ||
| 69 | #define streq(a, b) (strcmp((a), (b)) == 0) | 69 | #define streq(a, b) (strcmp((a), (b)) == 0) |
| 70 | #define strneq(a, b, n) (strncmp((a), (b), (n)) == 0) | 70 | #define strstarts(s, prefix) (strncmp((s), (prefix), strlen(prefix)) == 0) |
| 71 | #define strprefixeq(a, n, b) (strlen(b) == (n) && (memcmp(a, b, n) == 0)) | ||
| 71 | 72 | ||
| 72 | #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) | 73 | #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) |
| 73 | 74 | ||
| @@ -203,7 +204,7 @@ struct node *build_node_delete(void); | |||
| 203 | struct node *name_node(struct node *node, char *name); | 204 | struct node *name_node(struct node *node, char *name); |
| 204 | struct node *chain_node(struct node *first, struct node *list); | 205 | struct node *chain_node(struct node *first, struct node *list); |
| 205 | struct node *merge_nodes(struct node *old_node, struct node *new_node); | 206 | struct node *merge_nodes(struct node *old_node, struct node *new_node); |
| 206 | void add_orphan_node(struct node *old_node, struct node *new_node, char *ref); | 207 | struct node *add_orphan_node(struct node *old_node, struct node *new_node, char *ref); |
| 207 | 208 | ||
| 208 | void add_property(struct node *node, struct property *prop); | 209 | void add_property(struct node *node, struct property *prop); |
| 209 | void delete_property_by_name(struct node *node, char *name); | 210 | void delete_property_by_name(struct node *node, char *name); |
| @@ -289,4 +290,4 @@ struct dt_info *dt_from_source(const char *f); | |||
| 289 | 290 | ||
| 290 | struct dt_info *dt_from_fs(const char *dirname); | 291 | struct dt_info *dt_from_fs(const char *dirname); |
| 291 | 292 | ||
| 292 | #endif /* _DTC_H */ | 293 | #endif /* DTC_H */ |
diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c index fcf71541d8a7..8d268fb785db 100644 --- a/scripts/dtc/flattree.c +++ b/scripts/dtc/flattree.c | |||
| @@ -731,7 +731,7 @@ static char *nodename_from_path(const char *ppath, const char *cpath) | |||
| 731 | 731 | ||
| 732 | plen = strlen(ppath); | 732 | plen = strlen(ppath); |
| 733 | 733 | ||
| 734 | if (!strneq(ppath, cpath, plen)) | 734 | if (!strstarts(cpath, ppath)) |
| 735 | die("Path \"%s\" is not valid as a child of \"%s\"\n", | 735 | die("Path \"%s\" is not valid as a child of \"%s\"\n", |
| 736 | cpath, ppath); | 736 | cpath, ppath); |
| 737 | 737 | ||
diff --git a/scripts/dtc/libfdt/fdt.c b/scripts/dtc/libfdt/fdt.c index 22286a1aaeaf..7855a1787763 100644 --- a/scripts/dtc/libfdt/fdt.c +++ b/scripts/dtc/libfdt/fdt.c | |||
| @@ -88,7 +88,7 @@ const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int len) | |||
| 88 | || ((offset + len) > fdt_size_dt_struct(fdt))) | 88 | || ((offset + len) > fdt_size_dt_struct(fdt))) |
| 89 | return NULL; | 89 | return NULL; |
| 90 | 90 | ||
| 91 | return _fdt_offset_ptr(fdt, offset); | 91 | return fdt_offset_ptr_(fdt, offset); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset) | 94 | uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset) |
| @@ -123,6 +123,9 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset) | |||
| 123 | /* skip-name offset, length and value */ | 123 | /* skip-name offset, length and value */ |
| 124 | offset += sizeof(struct fdt_property) - FDT_TAGSIZE | 124 | offset += sizeof(struct fdt_property) - FDT_TAGSIZE |
| 125 | + fdt32_to_cpu(*lenp); | 125 | + fdt32_to_cpu(*lenp); |
| 126 | if (fdt_version(fdt) < 0x10 && fdt32_to_cpu(*lenp) >= 8 && | ||
| 127 | ((offset - fdt32_to_cpu(*lenp)) % 8) != 0) | ||
| 128 | offset += 4; | ||
| 126 | break; | 129 | break; |
| 127 | 130 | ||
| 128 | case FDT_END: | 131 | case FDT_END: |
| @@ -141,7 +144,7 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset) | |||
| 141 | return tag; | 144 | return tag; |
| 142 | } | 145 | } |
| 143 | 146 | ||
| 144 | int _fdt_check_node_offset(const void *fdt, int offset) | 147 | int fdt_check_node_offset_(const void *fdt, int offset) |
| 145 | { | 148 | { |
| 146 | if ((offset < 0) || (offset % FDT_TAGSIZE) | 149 | if ((offset < 0) || (offset % FDT_TAGSIZE) |
| 147 | || (fdt_next_tag(fdt, offset, &offset) != FDT_BEGIN_NODE)) | 150 | || (fdt_next_tag(fdt, offset, &offset) != FDT_BEGIN_NODE)) |
| @@ -150,7 +153,7 @@ int _fdt_check_node_offset(const void *fdt, int offset) | |||
| 150 | return offset; | 153 | return offset; |
| 151 | } | 154 | } |
| 152 | 155 | ||
| 153 | int _fdt_check_prop_offset(const void *fdt, int offset) | 156 | int fdt_check_prop_offset_(const void *fdt, int offset) |
| 154 | { | 157 | { |
| 155 | if ((offset < 0) || (offset % FDT_TAGSIZE) | 158 | if ((offset < 0) || (offset % FDT_TAGSIZE) |
| 156 | || (fdt_next_tag(fdt, offset, &offset) != FDT_PROP)) | 159 | || (fdt_next_tag(fdt, offset, &offset) != FDT_PROP)) |
| @@ -165,7 +168,7 @@ int fdt_next_node(const void *fdt, int offset, int *depth) | |||
| 165 | uint32_t tag; | 168 | uint32_t tag; |
| 166 | 169 | ||
| 167 | if (offset >= 0) | 170 | if (offset >= 0) |
| 168 | if ((nextoffset = _fdt_check_node_offset(fdt, offset)) < 0) | 171 | if ((nextoffset = fdt_check_node_offset_(fdt, offset)) < 0) |
| 169 | return nextoffset; | 172 | return nextoffset; |
| 170 | 173 | ||
| 171 | do { | 174 | do { |
| @@ -227,7 +230,7 @@ int fdt_next_subnode(const void *fdt, int offset) | |||
| 227 | return offset; | 230 | return offset; |
| 228 | } | 231 | } |
| 229 | 232 | ||
| 230 | const char *_fdt_find_string(const char *strtab, int tabsize, const char *s) | 233 | const char *fdt_find_string_(const char *strtab, int tabsize, const char *s) |
| 231 | { | 234 | { |
| 232 | int len = strlen(s) + 1; | 235 | int len = strlen(s) + 1; |
| 233 | const char *last = strtab + tabsize - len; | 236 | const char *last = strtab + tabsize - len; |
diff --git a/scripts/dtc/libfdt/fdt.h b/scripts/dtc/libfdt/fdt.h index 526aedb51556..74961f9026d1 100644 --- a/scripts/dtc/libfdt/fdt.h +++ b/scripts/dtc/libfdt/fdt.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #ifndef _FDT_H | 1 | #ifndef FDT_H |
| 2 | #define _FDT_H | 2 | #define FDT_H |
| 3 | /* | 3 | /* |
| 4 | * libfdt - Flat Device Tree manipulation | 4 | * libfdt - Flat Device Tree manipulation |
| 5 | * Copyright (C) 2006 David Gibson, IBM Corporation. | 5 | * Copyright (C) 2006 David Gibson, IBM Corporation. |
| @@ -108,4 +108,4 @@ struct fdt_property { | |||
| 108 | #define FDT_V16_SIZE FDT_V3_SIZE | 108 | #define FDT_V16_SIZE FDT_V3_SIZE |
| 109 | #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(fdt32_t)) | 109 | #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(fdt32_t)) |
| 110 | 110 | ||
| 111 | #endif /* _FDT_H */ | 111 | #endif /* FDT_H */ |
diff --git a/scripts/dtc/libfdt/fdt_overlay.c b/scripts/dtc/libfdt/fdt_overlay.c index bd81241e6658..bf75388ec9a2 100644 --- a/scripts/dtc/libfdt/fdt_overlay.c +++ b/scripts/dtc/libfdt/fdt_overlay.c | |||
| @@ -1,3 +1,54 @@ | |||
| 1 | /* | ||
| 2 | * libfdt - Flat Device Tree manipulation | ||
| 3 | * Copyright (C) 2016 Free Electrons | ||
| 4 | * Copyright (C) 2016 NextThing Co. | ||
| 5 | * | ||
| 6 | * libfdt is dual licensed: you can use it either under the terms of | ||
| 7 | * the GPL, or the BSD license, at your option. | ||
| 8 | * | ||
| 9 | * a) This library is free software; you can redistribute it and/or | ||
| 10 | * modify it under the terms of the GNU General Public License as | ||
| 11 | * published by the Free Software Foundation; either version 2 of the | ||
| 12 | * License, or (at your option) any later version. | ||
| 13 | * | ||
| 14 | * This library is distributed in the hope that it will be useful, | ||
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | * GNU General Public License for more details. | ||
| 18 | * | ||
| 19 | * You should have received a copy of the GNU General Public | ||
| 20 | * License along with this library; if not, write to the Free | ||
| 21 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, | ||
| 22 | * MA 02110-1301 USA | ||
| 23 | * | ||
| 24 | * Alternatively, | ||
| 25 | * | ||
| 26 | * b) Redistribution and use in source and binary forms, with or | ||
| 27 | * without modification, are permitted provided that the following | ||
| 28 | * conditions are met: | ||
| 29 | * | ||
| 30 | * 1. Redistributions of source code must retain the above | ||
| 31 | * copyright notice, this list of conditions and the following | ||
| 32 | * disclaimer. | ||
| 33 | * 2. Redistributions in binary form must reproduce the above | ||
| 34 | * copyright notice, this list of conditions and the following | ||
| 35 | * disclaimer in the documentation and/or other materials | ||
| 36 | * provided with the distribution. | ||
| 37 | * | ||
| 38 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
| 39 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
| 40 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| 41 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
| 42 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
| 43 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 48 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
| 49 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
| 50 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | */ | ||
| 1 | #include "libfdt_env.h" | 52 | #include "libfdt_env.h" |
| 2 | 53 | ||
| 3 | #include <fdt.h> | 54 | #include <fdt.h> |
diff --git a/scripts/dtc/libfdt/fdt_ro.c b/scripts/dtc/libfdt/fdt_ro.c index 08de2cce674d..dfb3236da388 100644 --- a/scripts/dtc/libfdt/fdt_ro.c +++ b/scripts/dtc/libfdt/fdt_ro.c | |||
| @@ -55,12 +55,13 @@ | |||
| 55 | 55 | ||
| 56 | #include "libfdt_internal.h" | 56 | #include "libfdt_internal.h" |
| 57 | 57 | ||
| 58 | static int _fdt_nodename_eq(const void *fdt, int offset, | 58 | static int fdt_nodename_eq_(const void *fdt, int offset, |
| 59 | const char *s, int len) | 59 | const char *s, int len) |
| 60 | { | 60 | { |
| 61 | const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1); | 61 | int olen; |
| 62 | const char *p = fdt_get_name(fdt, offset, &olen); | ||
| 62 | 63 | ||
| 63 | if (!p) | 64 | if (!p || olen < len) |
| 64 | /* short match */ | 65 | /* short match */ |
| 65 | return 0; | 66 | return 0; |
| 66 | 67 | ||
| @@ -80,7 +81,7 @@ const char *fdt_string(const void *fdt, int stroffset) | |||
| 80 | return (const char *)fdt + fdt_off_dt_strings(fdt) + stroffset; | 81 | return (const char *)fdt + fdt_off_dt_strings(fdt) + stroffset; |
| 81 | } | 82 | } |
| 82 | 83 | ||
| 83 | static int _fdt_string_eq(const void *fdt, int stroffset, | 84 | static int fdt_string_eq_(const void *fdt, int stroffset, |
| 84 | const char *s, int len) | 85 | const char *s, int len) |
| 85 | { | 86 | { |
| 86 | const char *p = fdt_string(fdt, stroffset); | 87 | const char *p = fdt_string(fdt, stroffset); |
| @@ -117,8 +118,8 @@ uint32_t fdt_get_max_phandle(const void *fdt) | |||
| 117 | int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size) | 118 | int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size) |
| 118 | { | 119 | { |
| 119 | FDT_CHECK_HEADER(fdt); | 120 | FDT_CHECK_HEADER(fdt); |
| 120 | *address = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->address); | 121 | *address = fdt64_to_cpu(fdt_mem_rsv_(fdt, n)->address); |
| 121 | *size = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->size); | 122 | *size = fdt64_to_cpu(fdt_mem_rsv_(fdt, n)->size); |
| 122 | return 0; | 123 | return 0; |
| 123 | } | 124 | } |
| 124 | 125 | ||
| @@ -126,12 +127,12 @@ int fdt_num_mem_rsv(const void *fdt) | |||
| 126 | { | 127 | { |
| 127 | int i = 0; | 128 | int i = 0; |
| 128 | 129 | ||
| 129 | while (fdt64_to_cpu(_fdt_mem_rsv(fdt, i)->size) != 0) | 130 | while (fdt64_to_cpu(fdt_mem_rsv_(fdt, i)->size) != 0) |
| 130 | i++; | 131 | i++; |
| 131 | return i; | 132 | return i; |
| 132 | } | 133 | } |
| 133 | 134 | ||
| 134 | static int _nextprop(const void *fdt, int offset) | 135 | static int nextprop_(const void *fdt, int offset) |
| 135 | { | 136 | { |
| 136 | uint32_t tag; | 137 | uint32_t tag; |
| 137 | int nextoffset; | 138 | int nextoffset; |
| @@ -166,7 +167,7 @@ int fdt_subnode_offset_namelen(const void *fdt, int offset, | |||
| 166 | (offset >= 0) && (depth >= 0); | 167 | (offset >= 0) && (depth >= 0); |
| 167 | offset = fdt_next_node(fdt, offset, &depth)) | 168 | offset = fdt_next_node(fdt, offset, &depth)) |
| 168 | if ((depth == 1) | 169 | if ((depth == 1) |
| 169 | && _fdt_nodename_eq(fdt, offset, name, namelen)) | 170 | && fdt_nodename_eq_(fdt, offset, name, namelen)) |
| 170 | return offset; | 171 | return offset; |
| 171 | 172 | ||
| 172 | if (depth < 0) | 173 | if (depth < 0) |
| @@ -232,17 +233,35 @@ int fdt_path_offset(const void *fdt, const char *path) | |||
| 232 | 233 | ||
| 233 | const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) | 234 | const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) |
| 234 | { | 235 | { |
| 235 | const struct fdt_node_header *nh = _fdt_offset_ptr(fdt, nodeoffset); | 236 | const struct fdt_node_header *nh = fdt_offset_ptr_(fdt, nodeoffset); |
| 237 | const char *nameptr; | ||
| 236 | int err; | 238 | int err; |
| 237 | 239 | ||
| 238 | if (((err = fdt_check_header(fdt)) != 0) | 240 | if (((err = fdt_check_header(fdt)) != 0) |
| 239 | || ((err = _fdt_check_node_offset(fdt, nodeoffset)) < 0)) | 241 | || ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0)) |
| 240 | goto fail; | 242 | goto fail; |
| 241 | 243 | ||
| 244 | nameptr = nh->name; | ||
| 245 | |||
| 246 | if (fdt_version(fdt) < 0x10) { | ||
| 247 | /* | ||
| 248 | * For old FDT versions, match the naming conventions of V16: | ||
| 249 | * give only the leaf name (after all /). The actual tree | ||
| 250 | * contents are loosely checked. | ||
| 251 | */ | ||
| 252 | const char *leaf; | ||
| 253 | leaf = strrchr(nameptr, '/'); | ||
| 254 | if (leaf == NULL) { | ||
| 255 | err = -FDT_ERR_BADSTRUCTURE; | ||
| 256 | goto fail; | ||
| 257 | } | ||
| 258 | nameptr = leaf+1; | ||
| 259 | } | ||
| 260 | |||
| 242 | if (len) | 261 | if (len) |
| 243 | *len = strlen(nh->name); | 262 | *len = strlen(nameptr); |
| 244 | 263 | ||
| 245 | return nh->name; | 264 | return nameptr; |
| 246 | 265 | ||
| 247 | fail: | 266 | fail: |
| 248 | if (len) | 267 | if (len) |
| @@ -254,34 +273,34 @@ int fdt_first_property_offset(const void *fdt, int nodeoffset) | |||
| 254 | { | 273 | { |
| 255 | int offset; | 274 | int offset; |
| 256 | 275 | ||
| 257 | if ((offset = _fdt_check_node_offset(fdt, nodeoffset)) < 0) | 276 | if ((offset = fdt_check_node_offset_(fdt, nodeoffset)) < 0) |
| 258 | return offset; | 277 | return offset; |
| 259 | 278 | ||
| 260 | return _nextprop(fdt, offset); | 279 | return nextprop_(fdt, offset); |
| 261 | } | 280 | } |
| 262 | 281 | ||
| 263 | int fdt_next_property_offset(const void *fdt, int offset) | 282 | int fdt_next_property_offset(const void *fdt, int offset) |
| 264 | { | 283 | { |
| 265 | if ((offset = _fdt_check_prop_offset(fdt, offset)) < 0) | 284 | if ((offset = fdt_check_prop_offset_(fdt, offset)) < 0) |
| 266 | return offset; | 285 | return offset; |
| 267 | 286 | ||
| 268 | return _nextprop(fdt, offset); | 287 | return nextprop_(fdt, offset); |
| 269 | } | 288 | } |
| 270 | 289 | ||
| 271 | const struct fdt_property *fdt_get_property_by_offset(const void *fdt, | 290 | static const struct fdt_property *fdt_get_property_by_offset_(const void *fdt, |
| 272 | int offset, | 291 | int offset, |
| 273 | int *lenp) | 292 | int *lenp) |
| 274 | { | 293 | { |
| 275 | int err; | 294 | int err; |
| 276 | const struct fdt_property *prop; | 295 | const struct fdt_property *prop; |
| 277 | 296 | ||
| 278 | if ((err = _fdt_check_prop_offset(fdt, offset)) < 0) { | 297 | if ((err = fdt_check_prop_offset_(fdt, offset)) < 0) { |
| 279 | if (lenp) | 298 | if (lenp) |
| 280 | *lenp = err; | 299 | *lenp = err; |
| 281 | return NULL; | 300 | return NULL; |
| 282 | } | 301 | } |
| 283 | 302 | ||
| 284 | prop = _fdt_offset_ptr(fdt, offset); | 303 | prop = fdt_offset_ptr_(fdt, offset); |
| 285 | 304 | ||
| 286 | if (lenp) | 305 | if (lenp) |
| 287 | *lenp = fdt32_to_cpu(prop->len); | 306 | *lenp = fdt32_to_cpu(prop->len); |
| @@ -289,23 +308,44 @@ const struct fdt_property *fdt_get_property_by_offset(const void *fdt, | |||
| 289 | return prop; | 308 | return prop; |
| 290 | } | 309 | } |
| 291 | 310 | ||
| 292 | const struct fdt_property *fdt_get_property_namelen(const void *fdt, | 311 | const struct fdt_property *fdt_get_property_by_offset(const void *fdt, |
| 293 | int offset, | 312 | int offset, |
| 294 | const char *name, | 313 | int *lenp) |
| 295 | int namelen, int *lenp) | 314 | { |
| 315 | /* Prior to version 16, properties may need realignment | ||
| 316 | * and this API does not work. fdt_getprop_*() will, however. */ | ||
| 317 | |||
| 318 | if (fdt_version(fdt) < 0x10) { | ||
| 319 | if (lenp) | ||
| 320 | *lenp = -FDT_ERR_BADVERSION; | ||
| 321 | return NULL; | ||
| 322 | } | ||
| 323 | |||
| 324 | return fdt_get_property_by_offset_(fdt, offset, lenp); | ||
| 325 | } | ||
| 326 | |||
| 327 | static const struct fdt_property *fdt_get_property_namelen_(const void *fdt, | ||
| 328 | int offset, | ||
| 329 | const char *name, | ||
| 330 | int namelen, | ||
| 331 | int *lenp, | ||
| 332 | int *poffset) | ||
| 296 | { | 333 | { |
| 297 | for (offset = fdt_first_property_offset(fdt, offset); | 334 | for (offset = fdt_first_property_offset(fdt, offset); |
| 298 | (offset >= 0); | 335 | (offset >= 0); |
| 299 | (offset = fdt_next_property_offset(fdt, offset))) { | 336 | (offset = fdt_next_property_offset(fdt, offset))) { |
| 300 | const struct fdt_property *prop; | 337 | const struct fdt_property *prop; |
| 301 | 338 | ||
| 302 | if (!(prop = fdt_get_property_by_offset(fdt, offset, lenp))) { | 339 | if (!(prop = fdt_get_property_by_offset_(fdt, offset, lenp))) { |
| 303 | offset = -FDT_ERR_INTERNAL; | 340 | offset = -FDT_ERR_INTERNAL; |
| 304 | break; | 341 | break; |
| 305 | } | 342 | } |
| 306 | if (_fdt_string_eq(fdt, fdt32_to_cpu(prop->nameoff), | 343 | if (fdt_string_eq_(fdt, fdt32_to_cpu(prop->nameoff), |
| 307 | name, namelen)) | 344 | name, namelen)) { |
| 345 | if (poffset) | ||
| 346 | *poffset = offset; | ||
| 308 | return prop; | 347 | return prop; |
| 348 | } | ||
| 309 | } | 349 | } |
| 310 | 350 | ||
| 311 | if (lenp) | 351 | if (lenp) |
| @@ -313,6 +353,25 @@ const struct fdt_property *fdt_get_property_namelen(const void *fdt, | |||
| 313 | return NULL; | 353 | return NULL; |
| 314 | } | 354 | } |
| 315 | 355 | ||
| 356 | |||
| 357 | const struct fdt_property *fdt_get_property_namelen(const void *fdt, | ||
| 358 | int offset, | ||
| 359 | const char *name, | ||
| 360 | int namelen, int *lenp) | ||
| 361 | { | ||
| 362 | /* Prior to version 16, properties may need realignment | ||
| 363 | * and this API does not work. fdt_getprop_*() will, however. */ | ||
| 364 | if (fdt_version(fdt) < 0x10) { | ||
| 365 | if (lenp) | ||
| 366 | *lenp = -FDT_ERR_BADVERSION; | ||
| 367 | return NULL; | ||
| 368 | } | ||
| 369 | |||
| 370 | return fdt_get_property_namelen_(fdt, offset, name, namelen, lenp, | ||
| 371 | NULL); | ||
| 372 | } | ||
| 373 | |||
| 374 | |||
| 316 | const struct fdt_property *fdt_get_property(const void *fdt, | 375 | const struct fdt_property *fdt_get_property(const void *fdt, |
| 317 | int nodeoffset, | 376 | int nodeoffset, |
| 318 | const char *name, int *lenp) | 377 | const char *name, int *lenp) |
| @@ -324,12 +383,18 @@ const struct fdt_property *fdt_get_property(const void *fdt, | |||
| 324 | const void *fdt_getprop_namelen(const void *fdt, int nodeoffset, | 383 | const void *fdt_getprop_namelen(const void *fdt, int nodeoffset, |
| 325 | const char *name, int namelen, int *lenp) | 384 | const char *name, int namelen, int *lenp) |
| 326 | { | 385 | { |
| 386 | int poffset; | ||
| 327 | const struct fdt_property *prop; | 387 | const struct fdt_property *prop; |
| 328 | 388 | ||
| 329 | prop = fdt_get_property_namelen(fdt, nodeoffset, name, namelen, lenp); | 389 | prop = fdt_get_property_namelen_(fdt, nodeoffset, name, namelen, lenp, |
| 390 | &poffset); | ||
| 330 | if (!prop) | 391 | if (!prop) |
| 331 | return NULL; | 392 | return NULL; |
| 332 | 393 | ||
| 394 | /* Handle realignment */ | ||
| 395 | if (fdt_version(fdt) < 0x10 && (poffset + sizeof(*prop)) % 8 && | ||
| 396 | fdt32_to_cpu(prop->len) >= 8) | ||
| 397 | return prop->data + 4; | ||
| 333 | return prop->data; | 398 | return prop->data; |
| 334 | } | 399 | } |
| 335 | 400 | ||
| @@ -338,11 +403,16 @@ const void *fdt_getprop_by_offset(const void *fdt, int offset, | |||
| 338 | { | 403 | { |
| 339 | const struct fdt_property *prop; | 404 | const struct fdt_property *prop; |
| 340 | 405 | ||
| 341 | prop = fdt_get_property_by_offset(fdt, offset, lenp); | 406 | prop = fdt_get_property_by_offset_(fdt, offset, lenp); |
| 342 | if (!prop) | 407 | if (!prop) |
| 343 | return NULL; | 408 | return NULL; |
| 344 | if (namep) | 409 | if (namep) |
| 345 | *namep = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); | 410 | *namep = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); |
| 411 | |||
| 412 | /* Handle realignment */ | ||
| 413 | if (fdt_version(fdt) < 0x10 && (offset + sizeof(*prop)) % 8 && | ||
| 414 | fdt32_to_cpu(prop->len) >= 8) | ||
| 415 | return prop->data + 4; | ||
| 346 | return prop->data; | 416 | return prop->data; |
| 347 | } | 417 | } |
| 348 | 418 | ||
diff --git a/scripts/dtc/libfdt/fdt_rw.c b/scripts/dtc/libfdt/fdt_rw.c index 5c3a2bb0bc6b..9b829051e444 100644 --- a/scripts/dtc/libfdt/fdt_rw.c +++ b/scripts/dtc/libfdt/fdt_rw.c | |||
| @@ -55,8 +55,8 @@ | |||
| 55 | 55 | ||
| 56 | #include "libfdt_internal.h" | 56 | #include "libfdt_internal.h" |
| 57 | 57 | ||
| 58 | static int _fdt_blocks_misordered(const void *fdt, | 58 | static int fdt_blocks_misordered_(const void *fdt, |
| 59 | int mem_rsv_size, int struct_size) | 59 | int mem_rsv_size, int struct_size) |
| 60 | { | 60 | { |
| 61 | return (fdt_off_mem_rsvmap(fdt) < FDT_ALIGN(sizeof(struct fdt_header), 8)) | 61 | return (fdt_off_mem_rsvmap(fdt) < FDT_ALIGN(sizeof(struct fdt_header), 8)) |
| 62 | || (fdt_off_dt_struct(fdt) < | 62 | || (fdt_off_dt_struct(fdt) < |
| @@ -67,13 +67,13 @@ static int _fdt_blocks_misordered(const void *fdt, | |||
| 67 | (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt))); | 67 | (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt))); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | static int _fdt_rw_check_header(void *fdt) | 70 | static int fdt_rw_check_header_(void *fdt) |
| 71 | { | 71 | { |
| 72 | FDT_CHECK_HEADER(fdt); | 72 | FDT_CHECK_HEADER(fdt); |
| 73 | 73 | ||
| 74 | if (fdt_version(fdt) < 17) | 74 | if (fdt_version(fdt) < 17) |
| 75 | return -FDT_ERR_BADVERSION; | 75 | return -FDT_ERR_BADVERSION; |
| 76 | if (_fdt_blocks_misordered(fdt, sizeof(struct fdt_reserve_entry), | 76 | if (fdt_blocks_misordered_(fdt, sizeof(struct fdt_reserve_entry), |
| 77 | fdt_size_dt_struct(fdt))) | 77 | fdt_size_dt_struct(fdt))) |
| 78 | return -FDT_ERR_BADLAYOUT; | 78 | return -FDT_ERR_BADLAYOUT; |
| 79 | if (fdt_version(fdt) > 17) | 79 | if (fdt_version(fdt) > 17) |
| @@ -84,20 +84,20 @@ 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) |
| 93 | { | 93 | { |
| 94 | return fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt); | 94 | return fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | static int _fdt_splice(void *fdt, void *splicepoint, int oldlen, int newlen) | 97 | static int fdt_splice_(void *fdt, void *splicepoint, int oldlen, int newlen) |
| 98 | { | 98 | { |
| 99 | char *p = splicepoint; | 99 | char *p = splicepoint; |
| 100 | char *end = (char *)fdt + _fdt_data_size(fdt); | 100 | char *end = (char *)fdt + fdt_data_size_(fdt); |
| 101 | 101 | ||
| 102 | if (((p + oldlen) < p) || ((p + oldlen) > end)) | 102 | if (((p + oldlen) < p) || ((p + oldlen) > end)) |
| 103 | return -FDT_ERR_BADOFFSET; | 103 | return -FDT_ERR_BADOFFSET; |
| @@ -109,12 +109,12 @@ static int _fdt_splice(void *fdt, void *splicepoint, int oldlen, int newlen) | |||
| 109 | return 0; | 109 | return 0; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | static int _fdt_splice_mem_rsv(void *fdt, struct fdt_reserve_entry *p, | 112 | static int fdt_splice_mem_rsv_(void *fdt, struct fdt_reserve_entry *p, |
| 113 | int oldn, int newn) | 113 | int oldn, int newn) |
| 114 | { | 114 | { |
| 115 | int delta = (newn - oldn) * sizeof(*p); | 115 | int delta = (newn - oldn) * sizeof(*p); |
| 116 | int err; | 116 | int err; |
| 117 | err = _fdt_splice(fdt, p, oldn * sizeof(*p), newn * sizeof(*p)); | 117 | err = fdt_splice_(fdt, p, oldn * sizeof(*p), newn * sizeof(*p)); |
| 118 | if (err) | 118 | if (err) |
| 119 | return err; | 119 | return err; |
| 120 | fdt_set_off_dt_struct(fdt, fdt_off_dt_struct(fdt) + delta); | 120 | fdt_set_off_dt_struct(fdt, fdt_off_dt_struct(fdt) + delta); |
| @@ -122,13 +122,13 @@ static int _fdt_splice_mem_rsv(void *fdt, struct fdt_reserve_entry *p, | |||
| 122 | return 0; | 122 | return 0; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | static int _fdt_splice_struct(void *fdt, void *p, | 125 | static int fdt_splice_struct_(void *fdt, void *p, |
| 126 | int oldlen, int newlen) | 126 | int oldlen, int newlen) |
| 127 | { | 127 | { |
| 128 | int delta = newlen - oldlen; | 128 | int delta = newlen - oldlen; |
| 129 | int err; | 129 | int err; |
| 130 | 130 | ||
| 131 | if ((err = _fdt_splice(fdt, p, oldlen, newlen))) | 131 | if ((err = fdt_splice_(fdt, p, oldlen, newlen))) |
| 132 | return err; | 132 | return err; |
| 133 | 133 | ||
| 134 | fdt_set_size_dt_struct(fdt, fdt_size_dt_struct(fdt) + delta); | 134 | fdt_set_size_dt_struct(fdt, fdt_size_dt_struct(fdt) + delta); |
| @@ -136,20 +136,20 @@ static int _fdt_splice_struct(void *fdt, void *p, | |||
| 136 | return 0; | 136 | return 0; |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | static int _fdt_splice_string(void *fdt, int newlen) | 139 | static int fdt_splice_string_(void *fdt, int newlen) |
| 140 | { | 140 | { |
| 141 | void *p = (char *)fdt | 141 | void *p = (char *)fdt |
| 142 | + fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt); | 142 | + fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt); |
| 143 | int err; | 143 | int err; |
| 144 | 144 | ||
| 145 | if ((err = _fdt_splice(fdt, p, 0, newlen))) | 145 | if ((err = fdt_splice_(fdt, p, 0, newlen))) |
| 146 | return err; | 146 | return err; |
| 147 | 147 | ||
| 148 | fdt_set_size_dt_strings(fdt, fdt_size_dt_strings(fdt) + newlen); | 148 | fdt_set_size_dt_strings(fdt, fdt_size_dt_strings(fdt) + newlen); |
| 149 | return 0; | 149 | return 0; |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | static int _fdt_find_add_string(void *fdt, const char *s) | 152 | static int fdt_find_add_string_(void *fdt, const char *s) |
| 153 | { | 153 | { |
| 154 | char *strtab = (char *)fdt + fdt_off_dt_strings(fdt); | 154 | char *strtab = (char *)fdt + fdt_off_dt_strings(fdt); |
| 155 | const char *p; | 155 | const char *p; |
| @@ -157,13 +157,13 @@ static int _fdt_find_add_string(void *fdt, const char *s) | |||
| 157 | int len = strlen(s) + 1; | 157 | int len = strlen(s) + 1; |
| 158 | int err; | 158 | int err; |
| 159 | 159 | ||
| 160 | p = _fdt_find_string(strtab, fdt_size_dt_strings(fdt), s); | 160 | p = fdt_find_string_(strtab, fdt_size_dt_strings(fdt), s); |
| 161 | if (p) | 161 | if (p) |
| 162 | /* found it */ | 162 | /* found it */ |
| 163 | return (p - strtab); | 163 | return (p - strtab); |
| 164 | 164 | ||
| 165 | new = strtab + fdt_size_dt_strings(fdt); | 165 | new = strtab + fdt_size_dt_strings(fdt); |
| 166 | err = _fdt_splice_string(fdt, len); | 166 | err = fdt_splice_string_(fdt, len); |
| 167 | if (err) | 167 | if (err) |
| 168 | return err; | 168 | return err; |
| 169 | 169 | ||
| @@ -178,8 +178,8 @@ int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size) | |||
| 178 | 178 | ||
| 179 | FDT_RW_CHECK_HEADER(fdt); | 179 | FDT_RW_CHECK_HEADER(fdt); |
| 180 | 180 | ||
| 181 | re = _fdt_mem_rsv_w(fdt, fdt_num_mem_rsv(fdt)); | 181 | re = fdt_mem_rsv_w_(fdt, fdt_num_mem_rsv(fdt)); |
| 182 | err = _fdt_splice_mem_rsv(fdt, re, 0, 1); | 182 | err = fdt_splice_mem_rsv_(fdt, re, 0, 1); |
| 183 | if (err) | 183 | if (err) |
| 184 | return err; | 184 | return err; |
| 185 | 185 | ||
| @@ -190,17 +190,17 @@ int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size) | |||
| 190 | 190 | ||
| 191 | int fdt_del_mem_rsv(void *fdt, int n) | 191 | int fdt_del_mem_rsv(void *fdt, int n) |
| 192 | { | 192 | { |
| 193 | struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n); | 193 | struct fdt_reserve_entry *re = fdt_mem_rsv_w_(fdt, n); |
| 194 | 194 | ||
| 195 | FDT_RW_CHECK_HEADER(fdt); | 195 | FDT_RW_CHECK_HEADER(fdt); |
| 196 | 196 | ||
| 197 | if (n >= fdt_num_mem_rsv(fdt)) | 197 | if (n >= fdt_num_mem_rsv(fdt)) |
| 198 | return -FDT_ERR_NOTFOUND; | 198 | return -FDT_ERR_NOTFOUND; |
| 199 | 199 | ||
| 200 | return _fdt_splice_mem_rsv(fdt, re, 1, 0); | 200 | return fdt_splice_mem_rsv_(fdt, re, 1, 0); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name, | 203 | static int fdt_resize_property_(void *fdt, int nodeoffset, const char *name, |
| 204 | int len, struct fdt_property **prop) | 204 | int len, struct fdt_property **prop) |
| 205 | { | 205 | { |
| 206 | int oldlen; | 206 | int oldlen; |
| @@ -210,7 +210,7 @@ static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name, | |||
| 210 | if (!*prop) | 210 | if (!*prop) |
| 211 | return oldlen; | 211 | return oldlen; |
| 212 | 212 | ||
| 213 | if ((err = _fdt_splice_struct(fdt, (*prop)->data, FDT_TAGALIGN(oldlen), | 213 | if ((err = fdt_splice_struct_(fdt, (*prop)->data, FDT_TAGALIGN(oldlen), |
| 214 | FDT_TAGALIGN(len)))) | 214 | FDT_TAGALIGN(len)))) |
| 215 | return err; | 215 | return err; |
| 216 | 216 | ||
| @@ -218,7 +218,7 @@ static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name, | |||
| 218 | return 0; | 218 | return 0; |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | static int _fdt_add_property(void *fdt, int nodeoffset, const char *name, | 221 | static int fdt_add_property_(void *fdt, int nodeoffset, const char *name, |
| 222 | int len, struct fdt_property **prop) | 222 | int len, struct fdt_property **prop) |
| 223 | { | 223 | { |
| 224 | int proplen; | 224 | int proplen; |
| @@ -226,17 +226,17 @@ static int _fdt_add_property(void *fdt, int nodeoffset, const char *name, | |||
| 226 | int namestroff; | 226 | int namestroff; |
| 227 | int err; | 227 | int err; |
| 228 | 228 | ||
| 229 | if ((nextoffset = _fdt_check_node_offset(fdt, nodeoffset)) < 0) | 229 | if ((nextoffset = fdt_check_node_offset_(fdt, nodeoffset)) < 0) |
| 230 | return nextoffset; | 230 | return nextoffset; |
| 231 | 231 | ||
| 232 | namestroff = _fdt_find_add_string(fdt, name); | 232 | namestroff = fdt_find_add_string_(fdt, name); |
| 233 | if (namestroff < 0) | 233 | if (namestroff < 0) |
| 234 | return namestroff; | 234 | return namestroff; |
| 235 | 235 | ||
| 236 | *prop = _fdt_offset_ptr_w(fdt, nextoffset); | 236 | *prop = fdt_offset_ptr_w_(fdt, nextoffset); |
| 237 | proplen = sizeof(**prop) + FDT_TAGALIGN(len); | 237 | proplen = sizeof(**prop) + FDT_TAGALIGN(len); |
| 238 | 238 | ||
| 239 | err = _fdt_splice_struct(fdt, *prop, 0, proplen); | 239 | err = fdt_splice_struct_(fdt, *prop, 0, proplen); |
| 240 | if (err) | 240 | if (err) |
| 241 | return err; | 241 | return err; |
| 242 | 242 | ||
| @@ -260,7 +260,7 @@ int fdt_set_name(void *fdt, int nodeoffset, const char *name) | |||
| 260 | 260 | ||
| 261 | newlen = strlen(name); | 261 | newlen = strlen(name); |
| 262 | 262 | ||
| 263 | err = _fdt_splice_struct(fdt, namep, FDT_TAGALIGN(oldlen+1), | 263 | err = fdt_splice_struct_(fdt, namep, FDT_TAGALIGN(oldlen+1), |
| 264 | FDT_TAGALIGN(newlen+1)); | 264 | FDT_TAGALIGN(newlen+1)); |
| 265 | if (err) | 265 | if (err) |
| 266 | return err; | 266 | return err; |
| @@ -277,9 +277,9 @@ int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name, | |||
| 277 | 277 | ||
| 278 | FDT_RW_CHECK_HEADER(fdt); | 278 | FDT_RW_CHECK_HEADER(fdt); |
| 279 | 279 | ||
| 280 | err = _fdt_resize_property(fdt, nodeoffset, name, len, &prop); | 280 | err = fdt_resize_property_(fdt, nodeoffset, name, len, &prop); |
| 281 | if (err == -FDT_ERR_NOTFOUND) | 281 | if (err == -FDT_ERR_NOTFOUND) |
| 282 | err = _fdt_add_property(fdt, nodeoffset, name, len, &prop); | 282 | err = fdt_add_property_(fdt, nodeoffset, name, len, &prop); |
| 283 | if (err) | 283 | if (err) |
| 284 | return err; | 284 | return err; |
| 285 | 285 | ||
| @@ -313,7 +313,7 @@ int fdt_appendprop(void *fdt, int nodeoffset, const char *name, | |||
| 313 | prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen); | 313 | prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen); |
| 314 | if (prop) { | 314 | if (prop) { |
| 315 | newlen = len + oldlen; | 315 | newlen = len + oldlen; |
| 316 | err = _fdt_splice_struct(fdt, prop->data, | 316 | err = fdt_splice_struct_(fdt, prop->data, |
| 317 | FDT_TAGALIGN(oldlen), | 317 | FDT_TAGALIGN(oldlen), |
| 318 | FDT_TAGALIGN(newlen)); | 318 | FDT_TAGALIGN(newlen)); |
| 319 | if (err) | 319 | if (err) |
| @@ -321,7 +321,7 @@ int fdt_appendprop(void *fdt, int nodeoffset, const char *name, | |||
| 321 | prop->len = cpu_to_fdt32(newlen); | 321 | prop->len = cpu_to_fdt32(newlen); |
| 322 | memcpy(prop->data + oldlen, val, len); | 322 | memcpy(prop->data + oldlen, val, len); |
| 323 | } else { | 323 | } else { |
| 324 | err = _fdt_add_property(fdt, nodeoffset, name, len, &prop); | 324 | err = fdt_add_property_(fdt, nodeoffset, name, len, &prop); |
| 325 | if (err) | 325 | if (err) |
| 326 | return err; | 326 | return err; |
| 327 | memcpy(prop->data, val, len); | 327 | memcpy(prop->data, val, len); |
| @@ -341,7 +341,7 @@ int fdt_delprop(void *fdt, int nodeoffset, const char *name) | |||
| 341 | return len; | 341 | return len; |
| 342 | 342 | ||
| 343 | proplen = sizeof(*prop) + FDT_TAGALIGN(len); | 343 | proplen = sizeof(*prop) + FDT_TAGALIGN(len); |
| 344 | return _fdt_splice_struct(fdt, prop, proplen, 0); | 344 | return fdt_splice_struct_(fdt, prop, proplen, 0); |
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | int fdt_add_subnode_namelen(void *fdt, int parentoffset, | 347 | int fdt_add_subnode_namelen(void *fdt, int parentoffset, |
| @@ -369,10 +369,10 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset, | |||
| 369 | tag = fdt_next_tag(fdt, offset, &nextoffset); | 369 | tag = fdt_next_tag(fdt, offset, &nextoffset); |
| 370 | } while ((tag == FDT_PROP) || (tag == FDT_NOP)); | 370 | } while ((tag == FDT_PROP) || (tag == FDT_NOP)); |
| 371 | 371 | ||
| 372 | nh = _fdt_offset_ptr_w(fdt, offset); | 372 | nh = fdt_offset_ptr_w_(fdt, offset); |
| 373 | nodelen = sizeof(*nh) + FDT_TAGALIGN(namelen+1) + FDT_TAGSIZE; | 373 | nodelen = sizeof(*nh) + FDT_TAGALIGN(namelen+1) + FDT_TAGSIZE; |
| 374 | 374 | ||
| 375 | err = _fdt_splice_struct(fdt, nh, 0, nodelen); | 375 | err = fdt_splice_struct_(fdt, nh, 0, nodelen); |
| 376 | if (err) | 376 | if (err) |
| 377 | return err; | 377 | return err; |
| 378 | 378 | ||
| @@ -396,15 +396,15 @@ int fdt_del_node(void *fdt, int nodeoffset) | |||
| 396 | 396 | ||
| 397 | FDT_RW_CHECK_HEADER(fdt); | 397 | FDT_RW_CHECK_HEADER(fdt); |
| 398 | 398 | ||
| 399 | endoffset = _fdt_node_end_offset(fdt, nodeoffset); | 399 | endoffset = fdt_node_end_offset_(fdt, nodeoffset); |
| 400 | if (endoffset < 0) | 400 | if (endoffset < 0) |
| 401 | return endoffset; | 401 | return endoffset; |
| 402 | 402 | ||
| 403 | return _fdt_splice_struct(fdt, _fdt_offset_ptr_w(fdt, nodeoffset), | 403 | return fdt_splice_struct_(fdt, fdt_offset_ptr_w_(fdt, nodeoffset), |
| 404 | endoffset - nodeoffset, 0); | 404 | endoffset - nodeoffset, 0); |
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | static void _fdt_packblocks(const char *old, char *new, | 407 | static void fdt_packblocks_(const char *old, char *new, |
| 408 | int mem_rsv_size, int struct_size) | 408 | int mem_rsv_size, int struct_size) |
| 409 | { | 409 | { |
| 410 | int mem_rsv_off, struct_off, strings_off; | 410 | int mem_rsv_off, struct_off, strings_off; |
| @@ -450,7 +450,7 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize) | |||
| 450 | return struct_size; | 450 | return struct_size; |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | if (!_fdt_blocks_misordered(fdt, mem_rsv_size, struct_size)) { | 453 | if (!fdt_blocks_misordered_(fdt, mem_rsv_size, struct_size)) { |
| 454 | /* no further work necessary */ | 454 | /* no further work necessary */ |
| 455 | err = fdt_move(fdt, buf, bufsize); | 455 | err = fdt_move(fdt, buf, bufsize); |
| 456 | if (err) | 456 | if (err) |
| @@ -478,7 +478,7 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize) | |||
| 478 | return -FDT_ERR_NOSPACE; | 478 | return -FDT_ERR_NOSPACE; |
| 479 | } | 479 | } |
| 480 | 480 | ||
| 481 | _fdt_packblocks(fdt, tmp, mem_rsv_size, struct_size); | 481 | fdt_packblocks_(fdt, tmp, mem_rsv_size, struct_size); |
| 482 | memmove(buf, tmp, newsize); | 482 | memmove(buf, tmp, newsize); |
| 483 | 483 | ||
| 484 | fdt_set_magic(buf, FDT_MAGIC); | 484 | fdt_set_magic(buf, FDT_MAGIC); |
| @@ -498,8 +498,8 @@ int fdt_pack(void *fdt) | |||
| 498 | 498 | ||
| 499 | mem_rsv_size = (fdt_num_mem_rsv(fdt)+1) | 499 | mem_rsv_size = (fdt_num_mem_rsv(fdt)+1) |
| 500 | * sizeof(struct fdt_reserve_entry); | 500 | * sizeof(struct fdt_reserve_entry); |
| 501 | _fdt_packblocks(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt)); | 501 | fdt_packblocks_(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt)); |
| 502 | fdt_set_totalsize(fdt, _fdt_data_size(fdt)); | 502 | fdt_set_totalsize(fdt, fdt_data_size_(fdt)); |
| 503 | 503 | ||
| 504 | return 0; | 504 | return 0; |
| 505 | } | 505 | } |
diff --git a/scripts/dtc/libfdt/fdt_sw.c b/scripts/dtc/libfdt/fdt_sw.c index 2bd15e7aef87..6d33cc29d022 100644 --- a/scripts/dtc/libfdt/fdt_sw.c +++ b/scripts/dtc/libfdt/fdt_sw.c | |||
| @@ -55,7 +55,7 @@ | |||
| 55 | 55 | ||
| 56 | #include "libfdt_internal.h" | 56 | #include "libfdt_internal.h" |
| 57 | 57 | ||
| 58 | static int _fdt_sw_check_header(void *fdt) | 58 | static int fdt_sw_check_header_(void *fdt) |
| 59 | { | 59 | { |
| 60 | if (fdt_magic(fdt) != FDT_SW_MAGIC) | 60 | if (fdt_magic(fdt) != FDT_SW_MAGIC) |
| 61 | return -FDT_ERR_BADMAGIC; | 61 | return -FDT_ERR_BADMAGIC; |
| @@ -66,11 +66,11 @@ static int _fdt_sw_check_header(void *fdt) | |||
| 66 | #define FDT_SW_CHECK_HEADER(fdt) \ | 66 | #define FDT_SW_CHECK_HEADER(fdt) \ |
| 67 | { \ | 67 | { \ |
| 68 | int err; \ | 68 | int err; \ |
| 69 | if ((err = _fdt_sw_check_header(fdt)) != 0) \ | 69 | if ((err = fdt_sw_check_header_(fdt)) != 0) \ |
| 70 | return err; \ | 70 | return err; \ |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | static void *_fdt_grab_space(void *fdt, size_t len) | 73 | static void *fdt_grab_space_(void *fdt, size_t len) |
| 74 | { | 74 | { |
| 75 | int offset = fdt_size_dt_struct(fdt); | 75 | int offset = fdt_size_dt_struct(fdt); |
| 76 | int spaceleft; | 76 | int spaceleft; |
| @@ -82,7 +82,7 @@ static void *_fdt_grab_space(void *fdt, size_t len) | |||
| 82 | return NULL; | 82 | return NULL; |
| 83 | 83 | ||
| 84 | fdt_set_size_dt_struct(fdt, offset + len); | 84 | fdt_set_size_dt_struct(fdt, offset + len); |
| 85 | return _fdt_offset_ptr_w(fdt, offset); | 85 | return fdt_offset_ptr_w_(fdt, offset); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | int fdt_create(void *buf, int bufsize) | 88 | int fdt_create(void *buf, int bufsize) |
| @@ -174,7 +174,7 @@ int fdt_begin_node(void *fdt, const char *name) | |||
| 174 | 174 | ||
| 175 | FDT_SW_CHECK_HEADER(fdt); | 175 | FDT_SW_CHECK_HEADER(fdt); |
| 176 | 176 | ||
| 177 | nh = _fdt_grab_space(fdt, sizeof(*nh) + FDT_TAGALIGN(namelen)); | 177 | nh = fdt_grab_space_(fdt, sizeof(*nh) + FDT_TAGALIGN(namelen)); |
| 178 | if (! nh) | 178 | if (! nh) |
| 179 | return -FDT_ERR_NOSPACE; | 179 | return -FDT_ERR_NOSPACE; |
| 180 | 180 | ||
| @@ -189,7 +189,7 @@ int fdt_end_node(void *fdt) | |||
| 189 | 189 | ||
| 190 | FDT_SW_CHECK_HEADER(fdt); | 190 | FDT_SW_CHECK_HEADER(fdt); |
| 191 | 191 | ||
| 192 | en = _fdt_grab_space(fdt, FDT_TAGSIZE); | 192 | en = fdt_grab_space_(fdt, FDT_TAGSIZE); |
| 193 | if (! en) | 193 | if (! en) |
| 194 | return -FDT_ERR_NOSPACE; | 194 | return -FDT_ERR_NOSPACE; |
| 195 | 195 | ||
| @@ -197,7 +197,7 @@ int fdt_end_node(void *fdt) | |||
| 197 | return 0; | 197 | return 0; |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | static int _fdt_find_add_string(void *fdt, const char *s) | 200 | static int fdt_find_add_string_(void *fdt, const char *s) |
| 201 | { | 201 | { |
| 202 | char *strtab = (char *)fdt + fdt_totalsize(fdt); | 202 | char *strtab = (char *)fdt + fdt_totalsize(fdt); |
| 203 | const char *p; | 203 | const char *p; |
| @@ -205,7 +205,7 @@ static int _fdt_find_add_string(void *fdt, const char *s) | |||
| 205 | int len = strlen(s) + 1; | 205 | int len = strlen(s) + 1; |
| 206 | int struct_top, offset; | 206 | int struct_top, offset; |
| 207 | 207 | ||
| 208 | p = _fdt_find_string(strtab - strtabsize, strtabsize, s); | 208 | p = fdt_find_string_(strtab - strtabsize, strtabsize, s); |
| 209 | if (p) | 209 | if (p) |
| 210 | return p - strtab; | 210 | return p - strtab; |
| 211 | 211 | ||
| @@ -227,11 +227,11 @@ int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp) | |||
| 227 | 227 | ||
| 228 | FDT_SW_CHECK_HEADER(fdt); | 228 | FDT_SW_CHECK_HEADER(fdt); |
| 229 | 229 | ||
| 230 | nameoff = _fdt_find_add_string(fdt, name); | 230 | nameoff = fdt_find_add_string_(fdt, name); |
| 231 | if (nameoff == 0) | 231 | if (nameoff == 0) |
| 232 | return -FDT_ERR_NOSPACE; | 232 | return -FDT_ERR_NOSPACE; |
| 233 | 233 | ||
| 234 | prop = _fdt_grab_space(fdt, sizeof(*prop) + FDT_TAGALIGN(len)); | 234 | prop = fdt_grab_space_(fdt, sizeof(*prop) + FDT_TAGALIGN(len)); |
| 235 | if (! prop) | 235 | if (! prop) |
| 236 | return -FDT_ERR_NOSPACE; | 236 | return -FDT_ERR_NOSPACE; |
| 237 | 237 | ||
| @@ -265,7 +265,7 @@ int fdt_finish(void *fdt) | |||
| 265 | FDT_SW_CHECK_HEADER(fdt); | 265 | FDT_SW_CHECK_HEADER(fdt); |
| 266 | 266 | ||
| 267 | /* Add terminator */ | 267 | /* Add terminator */ |
| 268 | end = _fdt_grab_space(fdt, sizeof(*end)); | 268 | end = fdt_grab_space_(fdt, sizeof(*end)); |
| 269 | if (! end) | 269 | if (! end) |
| 270 | return -FDT_ERR_NOSPACE; | 270 | return -FDT_ERR_NOSPACE; |
| 271 | *end = cpu_to_fdt32(FDT_END); | 271 | *end = cpu_to_fdt32(FDT_END); |
| @@ -281,7 +281,7 @@ int fdt_finish(void *fdt) | |||
| 281 | while ((tag = fdt_next_tag(fdt, offset, &nextoffset)) != FDT_END) { | 281 | while ((tag = fdt_next_tag(fdt, offset, &nextoffset)) != FDT_END) { |
| 282 | if (tag == FDT_PROP) { | 282 | if (tag == FDT_PROP) { |
| 283 | struct fdt_property *prop = | 283 | struct fdt_property *prop = |
| 284 | _fdt_offset_ptr_w(fdt, offset); | 284 | fdt_offset_ptr_w_(fdt, offset); |
| 285 | int nameoff; | 285 | int nameoff; |
| 286 | 286 | ||
| 287 | nameoff = fdt32_to_cpu(prop->nameoff); | 287 | nameoff = fdt32_to_cpu(prop->nameoff); |
diff --git a/scripts/dtc/libfdt/fdt_wip.c b/scripts/dtc/libfdt/fdt_wip.c index 5e859198622b..534c1cbbb2f3 100644 --- a/scripts/dtc/libfdt/fdt_wip.c +++ b/scripts/dtc/libfdt/fdt_wip.c | |||
| @@ -93,7 +93,7 @@ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, | |||
| 93 | val, len); | 93 | val, len); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | static void _fdt_nop_region(void *start, int len) | 96 | static void fdt_nop_region_(void *start, int len) |
| 97 | { | 97 | { |
| 98 | fdt32_t *p; | 98 | fdt32_t *p; |
| 99 | 99 | ||
| @@ -110,12 +110,12 @@ int fdt_nop_property(void *fdt, int nodeoffset, const char *name) | |||
| 110 | if (!prop) | 110 | if (!prop) |
| 111 | return len; | 111 | return len; |
| 112 | 112 | ||
| 113 | _fdt_nop_region(prop, len + sizeof(*prop)); | 113 | fdt_nop_region_(prop, len + sizeof(*prop)); |
| 114 | 114 | ||
| 115 | return 0; | 115 | return 0; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | int _fdt_node_end_offset(void *fdt, int offset) | 118 | int fdt_node_end_offset_(void *fdt, int offset) |
| 119 | { | 119 | { |
| 120 | int depth = 0; | 120 | int depth = 0; |
| 121 | 121 | ||
| @@ -129,11 +129,11 @@ int fdt_nop_node(void *fdt, int nodeoffset) | |||
| 129 | { | 129 | { |
| 130 | int endoffset; | 130 | int endoffset; |
| 131 | 131 | ||
| 132 | endoffset = _fdt_node_end_offset(fdt, nodeoffset); | 132 | endoffset = fdt_node_end_offset_(fdt, nodeoffset); |
| 133 | if (endoffset < 0) | 133 | if (endoffset < 0) |
| 134 | return endoffset; | 134 | return endoffset; |
| 135 | 135 | ||
| 136 | _fdt_nop_region(fdt_offset_ptr_w(fdt, nodeoffset, 0), | 136 | fdt_nop_region_(fdt_offset_ptr_w(fdt, nodeoffset, 0), |
| 137 | endoffset - nodeoffset); | 137 | endoffset - nodeoffset); |
| 138 | return 0; | 138 | return 0; |
| 139 | } | 139 | } |
diff --git a/scripts/dtc/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h index 7f83023ee109..1e27780e1185 100644 --- a/scripts/dtc/libfdt/libfdt.h +++ b/scripts/dtc/libfdt/libfdt.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #ifndef _LIBFDT_H | 1 | #ifndef LIBFDT_H |
| 2 | #define _LIBFDT_H | 2 | #define LIBFDT_H |
| 3 | /* | 3 | /* |
| 4 | * libfdt - Flat Device Tree manipulation | 4 | * libfdt - Flat Device Tree manipulation |
| 5 | * Copyright (C) 2006 David Gibson, IBM Corporation. | 5 | * Copyright (C) 2006 David Gibson, IBM Corporation. |
| @@ -54,7 +54,7 @@ | |||
| 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 0x02 |
| 58 | #define FDT_LAST_SUPPORTED_VERSION 0x11 | 58 | #define FDT_LAST_SUPPORTED_VERSION 0x11 |
| 59 | 59 | ||
| 60 | /* Error codes: informative error codes */ | 60 | /* Error codes: informative error codes */ |
| @@ -225,23 +225,23 @@ int fdt_next_subnode(const void *fdt, int offset); | |||
| 225 | #define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings)) | 225 | #define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings)) |
| 226 | #define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct)) | 226 | #define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct)) |
| 227 | 227 | ||
| 228 | #define __fdt_set_hdr(name) \ | 228 | #define fdt_set_hdr_(name) \ |
| 229 | static inline void fdt_set_##name(void *fdt, uint32_t val) \ | 229 | static inline void fdt_set_##name(void *fdt, uint32_t val) \ |
| 230 | { \ | 230 | { \ |
| 231 | struct fdt_header *fdth = (struct fdt_header *)fdt; \ | 231 | struct fdt_header *fdth = (struct fdt_header *)fdt; \ |
| 232 | fdth->name = cpu_to_fdt32(val); \ | 232 | fdth->name = cpu_to_fdt32(val); \ |
| 233 | } | 233 | } |
| 234 | __fdt_set_hdr(magic); | 234 | fdt_set_hdr_(magic); |
| 235 | __fdt_set_hdr(totalsize); | 235 | fdt_set_hdr_(totalsize); |
| 236 | __fdt_set_hdr(off_dt_struct); | 236 | fdt_set_hdr_(off_dt_struct); |
| 237 | __fdt_set_hdr(off_dt_strings); | 237 | fdt_set_hdr_(off_dt_strings); |
| 238 | __fdt_set_hdr(off_mem_rsvmap); | 238 | fdt_set_hdr_(off_mem_rsvmap); |
| 239 | __fdt_set_hdr(version); | 239 | fdt_set_hdr_(version); |
| 240 | __fdt_set_hdr(last_comp_version); | 240 | fdt_set_hdr_(last_comp_version); |
| 241 | __fdt_set_hdr(boot_cpuid_phys); | 241 | fdt_set_hdr_(boot_cpuid_phys); |
| 242 | __fdt_set_hdr(size_dt_strings); | 242 | fdt_set_hdr_(size_dt_strings); |
| 243 | __fdt_set_hdr(size_dt_struct); | 243 | fdt_set_hdr_(size_dt_struct); |
| 244 | #undef __fdt_set_hdr | 244 | #undef fdt_set_hdr_ |
| 245 | 245 | ||
| 246 | /** | 246 | /** |
| 247 | * fdt_check_header - sanity check a device tree or possible device tree | 247 | * fdt_check_header - sanity check a device tree or possible device tree |
| @@ -527,6 +527,9 @@ int fdt_next_property_offset(const void *fdt, int offset); | |||
| 527 | * offset. If lenp is non-NULL, the length of the property value is | 527 | * offset. If lenp is non-NULL, the length of the property value is |
| 528 | * also returned, in the integer pointed to by lenp. | 528 | * also returned, in the integer pointed to by lenp. |
| 529 | * | 529 | * |
| 530 | * Note that this code only works on device tree versions >= 16. fdt_getprop() | ||
| 531 | * works on all versions. | ||
| 532 | * | ||
| 530 | * returns: | 533 | * returns: |
| 531 | * pointer to the structure representing the property | 534 | * pointer to the structure representing the property |
| 532 | * if lenp is non-NULL, *lenp contains the length of the property | 535 | * if lenp is non-NULL, *lenp contains the length of the property |
| @@ -1449,7 +1452,7 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name, | |||
| 1449 | const void *val, int len); | 1452 | const void *val, int len); |
| 1450 | 1453 | ||
| 1451 | /** | 1454 | /** |
| 1452 | * fdt_setprop _placeholder - allocate space for a property | 1455 | * fdt_setprop_placeholder - allocate space for a property |
| 1453 | * @fdt: pointer to the device tree blob | 1456 | * @fdt: pointer to the device tree blob |
| 1454 | * @nodeoffset: offset of the node whose property to change | 1457 | * @nodeoffset: offset of the node whose property to change |
| 1455 | * @name: name of the property to change | 1458 | * @name: name of the property to change |
| @@ -1896,4 +1899,4 @@ int fdt_overlay_apply(void *fdt, void *fdto); | |||
| 1896 | 1899 | ||
| 1897 | const char *fdt_strerror(int errval); | 1900 | const char *fdt_strerror(int errval); |
| 1898 | 1901 | ||
| 1899 | #endif /* _LIBFDT_H */ | 1902 | #endif /* LIBFDT_H */ |
diff --git a/scripts/dtc/libfdt/libfdt_env.h b/scripts/dtc/libfdt/libfdt_env.h index 952056cddf09..bd2474628775 100644 --- a/scripts/dtc/libfdt/libfdt_env.h +++ b/scripts/dtc/libfdt/libfdt_env.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #ifndef _LIBFDT_ENV_H | 1 | #ifndef LIBFDT_ENV_H |
| 2 | #define _LIBFDT_ENV_H | 2 | #define LIBFDT_ENV_H |
| 3 | /* | 3 | /* |
| 4 | * libfdt - Flat Device Tree manipulation | 4 | * libfdt - Flat Device Tree manipulation |
| 5 | * Copyright (C) 2006 David Gibson, IBM Corporation. | 5 | * Copyright (C) 2006 David Gibson, IBM Corporation. |
| @@ -109,4 +109,31 @@ static inline fdt64_t cpu_to_fdt64(uint64_t x) | |||
| 109 | #undef CPU_TO_FDT16 | 109 | #undef CPU_TO_FDT16 |
| 110 | #undef EXTRACT_BYTE | 110 | #undef EXTRACT_BYTE |
| 111 | 111 | ||
| 112 | #endif /* _LIBFDT_ENV_H */ | 112 | #ifdef __APPLE__ |
| 113 | #include <AvailabilityMacros.h> | ||
| 114 | |||
| 115 | /* strnlen() is not available on Mac OS < 10.7 */ | ||
| 116 | # if !defined(MAC_OS_X_VERSION_10_7) || (MAC_OS_X_VERSION_MAX_ALLOWED < \ | ||
| 117 | MAC_OS_X_VERSION_10_7) | ||
| 118 | |||
| 119 | #define strnlen fdt_strnlen | ||
| 120 | |||
| 121 | /* | ||
| 122 | * fdt_strnlen: returns the length of a string or max_count - which ever is | ||
| 123 | * smallest. | ||
| 124 | * Input 1 string: the string whose size is to be determined | ||
| 125 | * Input 2 max_count: the maximum value returned by this function | ||
| 126 | * Output: length of the string or max_count (the smallest of the two) | ||
| 127 | */ | ||
| 128 | static inline size_t fdt_strnlen(const char *string, size_t max_count) | ||
| 129 | { | ||
| 130 | const char *p = memchr(string, 0, max_count); | ||
| 131 | return p ? p - string : max_count; | ||
| 132 | } | ||
| 133 | |||
| 134 | #endif /* !defined(MAC_OS_X_VERSION_10_7) || (MAC_OS_X_VERSION_MAX_ALLOWED < | ||
| 135 | MAC_OS_X_VERSION_10_7) */ | ||
| 136 | |||
| 137 | #endif /* __APPLE__ */ | ||
| 138 | |||
| 139 | #endif /* LIBFDT_ENV_H */ | ||
diff --git a/scripts/dtc/libfdt/libfdt_internal.h b/scripts/dtc/libfdt/libfdt_internal.h index 02cfa6fb612d..7681e192295b 100644 --- a/scripts/dtc/libfdt/libfdt_internal.h +++ b/scripts/dtc/libfdt/libfdt_internal.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #ifndef _LIBFDT_INTERNAL_H | 1 | #ifndef LIBFDT_INTERNAL_H |
| 2 | #define _LIBFDT_INTERNAL_H | 2 | #define LIBFDT_INTERNAL_H |
| 3 | /* | 3 | /* |
| 4 | * libfdt - Flat Device Tree manipulation | 4 | * libfdt - Flat Device Tree manipulation |
| 5 | * Copyright (C) 2006 David Gibson, IBM Corporation. | 5 | * Copyright (C) 2006 David Gibson, IBM Corporation. |
| @@ -57,27 +57,27 @@ | |||
| 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); |
| 66 | int _fdt_check_prop_offset(const void *fdt, int offset); | 66 | int fdt_check_prop_offset_(const void *fdt, int offset); |
| 67 | const char *_fdt_find_string(const char *strtab, int tabsize, const char *s); | 67 | const char *fdt_find_string_(const char *strtab, int tabsize, const char *s); |
| 68 | int _fdt_node_end_offset(void *fdt, int nodeoffset); | 68 | int fdt_node_end_offset_(void *fdt, int nodeoffset); |
| 69 | 69 | ||
| 70 | static inline const void *_fdt_offset_ptr(const void *fdt, int offset) | 70 | static inline const void *fdt_offset_ptr_(const void *fdt, int offset) |
| 71 | { | 71 | { |
| 72 | return (const char *)fdt + fdt_off_dt_struct(fdt) + offset; | 72 | return (const char *)fdt + fdt_off_dt_struct(fdt) + offset; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | static inline void *_fdt_offset_ptr_w(void *fdt, int offset) | 75 | static inline void *fdt_offset_ptr_w_(void *fdt, int offset) |
| 76 | { | 76 | { |
| 77 | return (void *)(uintptr_t)_fdt_offset_ptr(fdt, offset); | 77 | return (void *)(uintptr_t)fdt_offset_ptr_(fdt, offset); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n) | 80 | static inline const struct fdt_reserve_entry *fdt_mem_rsv_(const void *fdt, int n) |
| 81 | { | 81 | { |
| 82 | const struct fdt_reserve_entry *rsv_table = | 82 | const struct fdt_reserve_entry *rsv_table = |
| 83 | (const struct fdt_reserve_entry *) | 83 | (const struct fdt_reserve_entry *) |
| @@ -85,11 +85,11 @@ static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int | |||
| 85 | 85 | ||
| 86 | return rsv_table + n; | 86 | return rsv_table + n; |
| 87 | } | 87 | } |
| 88 | static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n) | 88 | static inline struct fdt_reserve_entry *fdt_mem_rsv_w_(void *fdt, int n) |
| 89 | { | 89 | { |
| 90 | return (void *)(uintptr_t)_fdt_mem_rsv(fdt, n); | 90 | return (void *)(uintptr_t)fdt_mem_rsv_(fdt, n); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | #define FDT_SW_MAGIC (~FDT_MAGIC) | 93 | #define FDT_SW_MAGIC (~FDT_MAGIC) |
| 94 | 94 | ||
| 95 | #endif /* _LIBFDT_INTERNAL_H */ | 95 | #endif /* LIBFDT_INTERNAL_H */ |
diff --git a/scripts/dtc/livetree.c b/scripts/dtc/livetree.c index 6846ad2fd6d2..57b7db2ed153 100644 --- a/scripts/dtc/livetree.c +++ b/scripts/dtc/livetree.c | |||
| @@ -216,7 +216,7 @@ struct node *merge_nodes(struct node *old_node, struct node *new_node) | |||
| 216 | return old_node; | 216 | return old_node; |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | void add_orphan_node(struct node *dt, struct node *new_node, char *ref) | 219 | struct node * add_orphan_node(struct node *dt, struct node *new_node, char *ref) |
| 220 | { | 220 | { |
| 221 | static unsigned int next_orphan_fragment = 0; | 221 | static unsigned int next_orphan_fragment = 0; |
| 222 | struct node *node; | 222 | struct node *node; |
| @@ -236,6 +236,7 @@ void add_orphan_node(struct node *dt, struct node *new_node, char *ref) | |||
| 236 | name_node(node, name); | 236 | name_node(node, name); |
| 237 | 237 | ||
| 238 | add_child(dt, node); | 238 | add_child(dt, node); |
| 239 | return dt; | ||
| 239 | } | 240 | } |
| 240 | 241 | ||
| 241 | struct node *chain_node(struct node *first, struct node *list) | 242 | struct node *chain_node(struct node *first, struct node *list) |
| @@ -507,7 +508,7 @@ struct node *get_node_by_path(struct node *tree, const char *path) | |||
| 507 | 508 | ||
| 508 | for_each_child(tree, child) { | 509 | for_each_child(tree, child) { |
| 509 | if (p && (strlen(child->name) == p-path) && | 510 | if (p && (strlen(child->name) == p-path) && |
| 510 | strneq(path, child->name, p-path)) | 511 | strprefixeq(path, p - path, child->name)) |
| 511 | return get_node_by_path(child, p+1); | 512 | return get_node_by_path(child, p+1); |
| 512 | else if (!p && streq(path, child->name)) | 513 | else if (!p && streq(path, child->name)) |
| 513 | return child; | 514 | return child; |
| @@ -540,7 +541,10 @@ struct node *get_node_by_phandle(struct node *tree, cell_t phandle) | |||
| 540 | { | 541 | { |
| 541 | struct node *child, *node; | 542 | struct node *child, *node; |
| 542 | 543 | ||
| 543 | assert((phandle != 0) && (phandle != -1)); | 544 | if ((phandle == 0) || (phandle == -1)) { |
| 545 | assert(generate_fixups); | ||
| 546 | return NULL; | ||
| 547 | } | ||
| 544 | 548 | ||
| 545 | if (tree->phandle == phandle) { | 549 | if (tree->phandle == phandle) { |
| 546 | if (tree->deleted) | 550 | if (tree->deleted) |
diff --git a/scripts/dtc/srcpos.c b/scripts/dtc/srcpos.c index 9d38459902f3..cb6ed0e3e5e4 100644 --- a/scripts/dtc/srcpos.c +++ b/scripts/dtc/srcpos.c | |||
| @@ -209,8 +209,6 @@ struct srcpos srcpos_empty = { | |||
| 209 | .file = NULL, | 209 | .file = NULL, |
| 210 | }; | 210 | }; |
| 211 | 211 | ||
| 212 | #define TAB_SIZE 8 | ||
| 213 | |||
| 214 | void srcpos_update(struct srcpos *pos, const char *text, int len) | 212 | void srcpos_update(struct srcpos *pos, const char *text, int len) |
| 215 | { | 213 | { |
| 216 | int i; | 214 | int i; |
| @@ -224,9 +222,6 @@ void srcpos_update(struct srcpos *pos, const char *text, int len) | |||
| 224 | if (text[i] == '\n') { | 222 | if (text[i] == '\n') { |
| 225 | current_srcfile->lineno++; | 223 | current_srcfile->lineno++; |
| 226 | current_srcfile->colno = 1; | 224 | current_srcfile->colno = 1; |
| 227 | } else if (text[i] == '\t') { | ||
| 228 | current_srcfile->colno = | ||
| 229 | ALIGN(current_srcfile->colno, TAB_SIZE); | ||
| 230 | } else { | 225 | } else { |
| 231 | current_srcfile->colno++; | 226 | current_srcfile->colno++; |
| 232 | } | 227 | } |
diff --git a/scripts/dtc/srcpos.h b/scripts/dtc/srcpos.h index 7caca8257c6d..9ded12a3830a 100644 --- a/scripts/dtc/srcpos.h +++ b/scripts/dtc/srcpos.h | |||
| @@ -17,8 +17,8 @@ | |||
| 17 | * USA | 17 | * USA |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #ifndef _SRCPOS_H_ | 20 | #ifndef SRCPOS_H |
| 21 | #define _SRCPOS_H_ | 21 | #define SRCPOS_H |
| 22 | 22 | ||
| 23 | #include <stdio.h> | 23 | #include <stdio.h> |
| 24 | #include <stdbool.h> | 24 | #include <stdbool.h> |
| @@ -114,4 +114,4 @@ extern void PRINTF(3, 4) srcpos_error(struct srcpos *pos, const char *prefix, | |||
| 114 | 114 | ||
| 115 | extern void srcpos_set_line(char *f, int l); | 115 | extern void srcpos_set_line(char *f, int l); |
| 116 | 116 | ||
| 117 | #endif /* _SRCPOS_H_ */ | 117 | #endif /* SRCPOS_H */ |
diff --git a/scripts/dtc/update-dtc-source.sh b/scripts/dtc/update-dtc-source.sh index fe8926bb3b54..1a009fd195d0 100755 --- a/scripts/dtc/update-dtc-source.sh +++ b/scripts/dtc/update-dtc-source.sh | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | # | 4 | # |
| 5 | # This script assumes that the dtc and the linux git trees are in the | 5 | # This script assumes that the dtc and the linux git trees are in the |
| 6 | # same directory. After building dtc in the dtc directory, it copies the | 6 | # same directory. After building dtc in the dtc directory, it copies the |
| 7 | # source files and generated source files into the scripts/dtc directory | 7 | # source files and generated source file(s) into the scripts/dtc directory |
| 8 | # in the kernel and creates a git commit updating them to the new | 8 | # in the kernel and creates a git commit updating them to the new |
| 9 | # version. | 9 | # version. |
| 10 | # | 10 | # |
| @@ -34,7 +34,6 @@ DTC_LINUX_PATH=`pwd`/scripts/dtc | |||
| 34 | DTC_SOURCE="checks.c data.c dtc.c dtc.h flattree.c fstree.c livetree.c srcpos.c \ | 34 | DTC_SOURCE="checks.c data.c dtc.c dtc.h flattree.c fstree.c livetree.c srcpos.c \ |
| 35 | srcpos.h treesource.c util.c util.h version_gen.h Makefile.dtc \ | 35 | srcpos.h treesource.c util.c util.h version_gen.h Makefile.dtc \ |
| 36 | dtc-lexer.l dtc-parser.y" | 36 | dtc-lexer.l dtc-parser.y" |
| 37 | DTC_GENERATED="dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h" | ||
| 38 | LIBFDT_SOURCE="Makefile.libfdt fdt.c fdt.h fdt_addresses.c fdt_empty_tree.c \ | 37 | LIBFDT_SOURCE="Makefile.libfdt fdt.c fdt.h fdt_addresses.c fdt_empty_tree.c \ |
| 39 | fdt_overlay.c fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c \ | 38 | fdt_overlay.c fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c \ |
| 40 | fdt_wip.c libfdt.h libfdt_env.h libfdt_internal.h" | 39 | fdt_wip.c libfdt.h libfdt_env.h libfdt_internal.h" |
| @@ -59,10 +58,6 @@ for f in $DTC_SOURCE; do | |||
| 59 | cp ${DTC_UPSTREAM_PATH}/${f} ${f} | 58 | cp ${DTC_UPSTREAM_PATH}/${f} ${f} |
| 60 | git add ${f} | 59 | git add ${f} |
| 61 | done | 60 | done |
| 62 | for f in $DTC_GENERATED; do | ||
| 63 | cp ${DTC_UPSTREAM_PATH}/$f ${f}_shipped | ||
| 64 | git add ${f}_shipped | ||
| 65 | done | ||
| 66 | for f in $LIBFDT_SOURCE; do | 61 | for f in $LIBFDT_SOURCE; do |
| 67 | cp ${DTC_UPSTREAM_PATH}/libfdt/${f} libfdt/${f} | 62 | cp ${DTC_UPSTREAM_PATH}/libfdt/${f} libfdt/${f} |
| 68 | git add libfdt/${f} | 63 | git add libfdt/${f} |
diff --git a/scripts/dtc/util.h b/scripts/dtc/util.h index ad5f41199edb..66fba8ea709b 100644 --- a/scripts/dtc/util.h +++ b/scripts/dtc/util.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #ifndef _UTIL_H | 1 | #ifndef UTIL_H |
| 2 | #define _UTIL_H | 2 | #define UTIL_H |
| 3 | 3 | ||
| 4 | #include <stdarg.h> | 4 | #include <stdarg.h> |
| 5 | #include <stdbool.h> | 5 | #include <stdbool.h> |
| @@ -35,6 +35,9 @@ | |||
| 35 | 35 | ||
| 36 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 36 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
| 37 | 37 | ||
| 38 | #define stringify(s) stringify_(s) | ||
| 39 | #define stringify_(s) #s | ||
| 40 | |||
| 38 | static inline void NORETURN PRINTF(1, 2) die(const char *str, ...) | 41 | static inline void NORETURN PRINTF(1, 2) die(const char *str, ...) |
| 39 | { | 42 | { |
| 40 | va_list ap; | 43 | va_list ap; |
| @@ -260,4 +263,4 @@ void NORETURN util_usage(const char *errmsg, const char *synopsis, | |||
| 260 | case 'V': util_version(); \ | 263 | case 'V': util_version(); \ |
| 261 | case '?': usage("unknown option"); | 264 | case '?': usage("unknown option"); |
| 262 | 265 | ||
| 263 | #endif /* _UTIL_H */ | 266 | #endif /* UTIL_H */ |
diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h index 6a4e84798966..ad87849e333b 100644 --- a/scripts/dtc/version_gen.h +++ b/scripts/dtc/version_gen.h | |||
| @@ -1 +1 @@ | |||
| #define DTC_VERSION "DTC 1.4.5-gc1e55a55" | #define DTC_VERSION "DTC 1.4.6-gaadd0b65" | ||
