diff --git a/config/kernel/linux-sun8i-dev.config b/config/kernel/linux-sun8i-dev.config index a2ef9c546..fc84e7b8d 100644 --- a/config/kernel/linux-sun8i-dev.config +++ b/config/kernel/linux-sun8i-dev.config @@ -1709,6 +1709,7 @@ CONFIG_OF_MDIO=y CONFIG_OF_RESERVED_MEM=y CONFIG_OF_RESOLVE=y CONFIG_OF_OVERLAY=y +CONFIG_OF_CONFIGFS=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y CONFIG_PARPORT=m # CONFIG_PARPORT_PC is not set diff --git a/patch/kernel/sun8i-dev/add-configfs-overlay-for-v4.10.x.patch.disabled b/patch/kernel/sun8i-dev/add-configfs-overlay-for-v4.11.x.patch similarity index 100% rename from patch/kernel/sun8i-dev/add-configfs-overlay-for-v4.10.x.patch.disabled rename to patch/kernel/sun8i-dev/add-configfs-overlay-for-v4.11.x.patch diff --git a/patch/kernel/sun8i-dev/scripts-dtc-Update-to-version-with-overlays.patch b/patch/kernel/sun8i-dev/scripts-dtc-Update-to-version-with-overlays.patch new file mode 100644 index 000000000..a6dadb9ef --- /dev/null +++ b/patch/kernel/sun8i-dev/scripts-dtc-Update-to-version-with-overlays.patch @@ -0,0 +1,2340 @@ +diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c +index 3d18e45..5adfc8f 100644 +--- a/scripts/dtc/checks.c ++++ b/scripts/dtc/checks.c +@@ -72,17 +72,16 @@ struct check { + #define CHECK(_nm, _fn, _d, ...) \ + CHECK_ENTRY(_nm, _fn, _d, false, false, __VA_ARGS__) + +-#ifdef __GNUC__ +-static inline void check_msg(struct check *c, const char *fmt, ...) __attribute__((format (printf, 2, 3))); +-#endif +-static inline void check_msg(struct check *c, const char *fmt, ...) ++static inline void PRINTF(3, 4) check_msg(struct check *c, struct dt_info *dti, ++ const char *fmt, ...) + { + va_list ap; + va_start(ap, fmt); + + if ((c->warn && (quiet < 1)) + || (c->error && (quiet < 2))) { +- fprintf(stderr, "%s (%s): ", ++ fprintf(stderr, "%s: %s (%s): ", ++ strcmp(dti->outname, "-") ? dti->outname : "", + (c->error) ? "ERROR" : "Warning", c->name); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); +@@ -90,11 +89,11 @@ static inline void check_msg(struct check *c, const char *fmt, ...) + va_end(ap); + } + +-#define FAIL(c, ...) \ +- do { \ +- TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__); \ +- (c)->status = FAILED; \ +- check_msg((c), __VA_ARGS__); \ ++#define FAIL(c, dti, ...) \ ++ do { \ ++ TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__); \ ++ (c)->status = FAILED; \ ++ check_msg((c), dti, __VA_ARGS__); \ + } while (0) + + static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node) +@@ -127,7 +126,7 @@ static bool run_check(struct check *c, struct dt_info *dti) + error = error || run_check(prq, dti); + if (prq->status != PASSED) { + c->status = PREREQ; +- check_msg(c, "Failed prerequisite '%s'", ++ check_msg(c, dti, "Failed prerequisite '%s'", + c->prereq[i]->name); + } + } +@@ -157,7 +156,7 @@ static bool run_check(struct check *c, struct dt_info *dti) + static inline void check_always_fail(struct check *c, struct dt_info *dti, + struct node *node) + { +- FAIL(c, "always_fail check"); ++ FAIL(c, dti, "always_fail check"); + } + CHECK(always_fail, check_always_fail, NULL); + +@@ -172,7 +171,7 @@ static void check_is_string(struct check *c, struct dt_info *dti, + return; /* Not present, assumed ok */ + + if (!data_is_one_string(prop->val)) +- FAIL(c, "\"%s\" property in %s is not a string", ++ FAIL(c, dti, "\"%s\" property in %s is not a string", + propname, node->fullpath); + } + #define WARNING_IF_NOT_STRING(nm, propname) \ +@@ -191,7 +190,7 @@ static void check_is_cell(struct check *c, struct dt_info *dti, + return; /* Not present, assumed ok */ + + if (prop->val.len != sizeof(cell_t)) +- FAIL(c, "\"%s\" property in %s is not a single cell", ++ FAIL(c, dti, "\"%s\" property in %s is not a single cell", + propname, node->fullpath); + } + #define WARNING_IF_NOT_CELL(nm, propname) \ +@@ -213,7 +212,7 @@ static void check_duplicate_node_names(struct check *c, struct dt_info *dti, + child2; + child2 = child2->next_sibling) + if (streq(child->name, child2->name)) +- FAIL(c, "Duplicate node name %s", ++ FAIL(c, dti, "Duplicate node name %s", + child->fullpath); + } + ERROR(duplicate_node_names, check_duplicate_node_names, NULL); +@@ -228,7 +227,7 @@ static void check_duplicate_property_names(struct check *c, struct dt_info *dti, + if (prop2->deleted) + continue; + if (streq(prop->name, prop2->name)) +- FAIL(c, "Duplicate property name %s in %s", ++ FAIL(c, dti, "Duplicate property name %s in %s", + prop->name, node->fullpath); + } + } +@@ -239,6 +238,7 @@ static void check_duplicate_property_names(struct check *c, struct dt_info *dti, + #define UPPERCASE "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + #define DIGITS "0123456789" + #define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-" ++#define PROPNODECHARSSTRICT LOWERCASE UPPERCASE DIGITS ",-" + + static void check_node_name_chars(struct check *c, struct dt_info *dti, + struct node *node) +@@ -246,16 +246,27 @@ static void check_node_name_chars(struct check *c, struct dt_info *dti, + int n = strspn(node->name, c->data); + + if (n < strlen(node->name)) +- FAIL(c, "Bad character '%c' in node %s", ++ FAIL(c, dti, "Bad character '%c' in node %s", + node->name[n], node->fullpath); + } + ERROR(node_name_chars, check_node_name_chars, PROPNODECHARS "@"); + ++static void check_node_name_chars_strict(struct check *c, struct dt_info *dti, ++ struct node *node) ++{ ++ int n = strspn(node->name, c->data); ++ ++ if (n < node->basenamelen) ++ FAIL(c, dti, "Character '%c' not recommended in node %s", ++ node->name[n], node->fullpath); ++} ++CHECK(node_name_chars_strict, check_node_name_chars_strict, PROPNODECHARSSTRICT); ++ + static void check_node_name_format(struct check *c, struct dt_info *dti, + struct node *node) + { + if (strchr(get_unitname(node), '@')) +- FAIL(c, "Node %s has multiple '@' characters in name", ++ FAIL(c, dti, "Node %s has multiple '@' characters in name", + node->fullpath); + } + ERROR(node_name_format, check_node_name_format, NULL, &node_name_chars); +@@ -274,11 +285,11 @@ static void check_unit_address_vs_reg(struct check *c, struct dt_info *dti, + + if (prop) { + if (!unitname[0]) +- FAIL(c, "Node %s has a reg or ranges property, but no unit name", ++ FAIL(c, dti, "Node %s has a reg or ranges property, but no unit name", + node->fullpath); + } else { + if (unitname[0]) +- FAIL(c, "Node %s has a unit name, but no reg property", ++ FAIL(c, dti, "Node %s has a unit name, but no reg property", + node->fullpath); + } + } +@@ -293,12 +304,44 @@ static void check_property_name_chars(struct check *c, struct dt_info *dti, + int n = strspn(prop->name, c->data); + + if (n < strlen(prop->name)) +- FAIL(c, "Bad character '%c' in property name \"%s\", node %s", ++ FAIL(c, dti, "Bad character '%c' in property name \"%s\", node %s", + prop->name[n], prop->name, node->fullpath); + } + } + ERROR(property_name_chars, check_property_name_chars, PROPNODECHARS); + ++static void check_property_name_chars_strict(struct check *c, ++ struct dt_info *dti, ++ struct node *node) ++{ ++ struct property *prop; ++ ++ for_each_property(node, prop) { ++ const char *name = prop->name; ++ int n = strspn(name, c->data); ++ ++ if (n == strlen(prop->name)) ++ continue; ++ ++ /* Certain names are whitelisted */ ++ if (streq(name, "device_type")) ++ continue; ++ ++ /* ++ * # is only allowed at the beginning of property names not counting ++ * the vendor prefix. ++ */ ++ if (name[n] == '#' && ((n == 0) || (name[n-1] == ','))) { ++ name += n + 1; ++ n = strspn(name, c->data); ++ } ++ if (n < strlen(name)) ++ FAIL(c, dti, "Character '%c' not recommended in property name \"%s\", node %s", ++ name[n], prop->name, node->fullpath); ++ } ++} ++CHECK(property_name_chars_strict, check_property_name_chars_strict, PROPNODECHARSSTRICT); ++ + #define DESCLABEL_FMT "%s%s%s%s%s" + #define DESCLABEL_ARGS(node,prop,mark) \ + ((mark) ? "value of " : ""), \ +@@ -327,7 +370,7 @@ static void check_duplicate_label(struct check *c, struct dt_info *dti, + return; + + if ((othernode != node) || (otherprop != prop) || (othermark != mark)) +- FAIL(c, "Duplicate label '%s' on " DESCLABEL_FMT ++ FAIL(c, dti, "Duplicate label '%s' on " DESCLABEL_FMT + " and " DESCLABEL_FMT, + label, DESCLABEL_ARGS(node, prop, mark), + DESCLABEL_ARGS(othernode, otherprop, othermark)); +@@ -367,7 +410,7 @@ static cell_t check_phandle_prop(struct check *c, struct dt_info *dti, + return 0; + + if (prop->val.len != sizeof(cell_t)) { +- FAIL(c, "%s has bad length (%d) %s property", ++ FAIL(c, dti, "%s has bad length (%d) %s property", + node->fullpath, prop->val.len, prop->name); + return 0; + } +@@ -379,7 +422,7 @@ static cell_t check_phandle_prop(struct check *c, struct dt_info *dti, + /* "Set this node's phandle equal to some + * other node's phandle". That's nonsensical + * by construction. */ { +- FAIL(c, "%s in %s is a reference to another node", ++ FAIL(c, dti, "%s in %s is a reference to another node", + prop->name, node->fullpath); + } + /* But setting this node's phandle equal to its own +@@ -393,7 +436,7 @@ static cell_t check_phandle_prop(struct check *c, struct dt_info *dti, + phandle = propval_cell(prop); + + if ((phandle == 0) || (phandle == -1)) { +- FAIL(c, "%s has bad value (0x%x) in %s property", ++ FAIL(c, dti, "%s has bad value (0x%x) in %s property", + node->fullpath, phandle, prop->name); + return 0; + } +@@ -420,7 +463,7 @@ static void check_explicit_phandles(struct check *c, struct dt_info *dti, + return; + + if (linux_phandle && phandle && (phandle != linux_phandle)) +- FAIL(c, "%s has mismatching 'phandle' and 'linux,phandle'" ++ FAIL(c, dti, "%s has mismatching 'phandle' and 'linux,phandle'" + " properties", node->fullpath); + + if (linux_phandle && !phandle) +@@ -428,7 +471,7 @@ static void check_explicit_phandles(struct check *c, struct dt_info *dti, + + other = get_node_by_phandle(root, phandle); + if (other && (other != node)) { +- FAIL(c, "%s has duplicated phandle 0x%x (seen before at %s)", ++ FAIL(c, dti, "%s has duplicated phandle 0x%x (seen before at %s)", + node->fullpath, phandle, other->fullpath); + return; + } +@@ -453,7 +496,7 @@ static void check_name_properties(struct check *c, struct dt_info *dti, + + if ((prop->val.len != node->basenamelen+1) + || (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) { +- FAIL(c, "\"name\" property in %s is incorrect (\"%s\" instead" ++ FAIL(c, dti, "\"name\" property in %s is incorrect (\"%s\" instead" + " of base node name)", node->fullpath, prop->val.val); + } else { + /* The name property is correct, and therefore redundant. +@@ -488,16 +531,16 @@ static void fixup_phandle_references(struct check *c, struct dt_info *dti, + refnode = get_node_by_ref(dt, m->ref); + if (! refnode) { + if (!(dti->dtsflags & DTSF_PLUGIN)) +- FAIL(c, "Reference to non-existent node or " ++ FAIL(c, dti, "Reference to non-existent node or " + "label \"%s\"\n", m->ref); + else /* mark the entry as unresolved */ +- *((cell_t *)(prop->val.val + m->offset)) = ++ *((fdt32_t *)(prop->val.val + m->offset)) = + cpu_to_fdt32(0xffffffff); + continue; + } + + phandle = get_node_phandle(dt, refnode); +- *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); ++ *((fdt32_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); + } + } + } +@@ -520,7 +563,7 @@ static void fixup_path_references(struct check *c, struct dt_info *dti, + + refnode = get_node_by_ref(dt, m->ref); + if (!refnode) { +- FAIL(c, "Reference to non-existent node or label \"%s\"\n", ++ FAIL(c, dti, "Reference to non-existent node or label \"%s\"\n", + m->ref); + continue; + } +@@ -579,19 +622,19 @@ static void check_reg_format(struct check *c, struct dt_info *dti, + return; /* No "reg", that's fine */ + + if (!node->parent) { +- FAIL(c, "Root node has a \"reg\" property"); ++ FAIL(c, dti, "Root node has a \"reg\" property"); + return; + } + + if (prop->val.len == 0) +- FAIL(c, "\"reg\" property in %s is empty", node->fullpath); ++ FAIL(c, dti, "\"reg\" property in %s is empty", node->fullpath); + + addr_cells = node_addr_cells(node->parent); + size_cells = node_size_cells(node->parent); + entrylen = (addr_cells + size_cells) * sizeof(cell_t); + + if (!entrylen || (prop->val.len % entrylen) != 0) +- FAIL(c, "\"reg\" property in %s has invalid length (%d bytes) " ++ FAIL(c, dti, "\"reg\" property in %s has invalid length (%d bytes) " + "(#address-cells == %d, #size-cells == %d)", + node->fullpath, prop->val.len, addr_cells, size_cells); + } +@@ -608,7 +651,7 @@ static void check_ranges_format(struct check *c, struct dt_info *dti, + return; + + if (!node->parent) { +- FAIL(c, "Root node has a \"ranges\" property"); ++ FAIL(c, dti, "Root node has a \"ranges\" property"); + return; + } + +@@ -620,17 +663,17 @@ static void check_ranges_format(struct check *c, struct dt_info *dti, + + if (prop->val.len == 0) { + if (p_addr_cells != c_addr_cells) +- FAIL(c, "%s has empty \"ranges\" property but its " ++ FAIL(c, dti, "%s has empty \"ranges\" property but its " + "#address-cells (%d) differs from %s (%d)", + node->fullpath, c_addr_cells, node->parent->fullpath, + p_addr_cells); + if (p_size_cells != c_size_cells) +- FAIL(c, "%s has empty \"ranges\" property but its " ++ FAIL(c, dti, "%s has empty \"ranges\" property but its " + "#size-cells (%d) differs from %s (%d)", + node->fullpath, c_size_cells, node->parent->fullpath, + p_size_cells); + } else if ((prop->val.len % entrylen) != 0) { +- FAIL(c, "\"ranges\" property in %s has invalid length (%d bytes) " ++ FAIL(c, dti, "\"ranges\" property in %s has invalid length (%d bytes) " + "(parent #address-cells == %d, child #address-cells == %d, " + "#size-cells == %d)", node->fullpath, prop->val.len, + p_addr_cells, c_addr_cells, c_size_cells); +@@ -638,6 +681,229 @@ static void check_ranges_format(struct check *c, struct dt_info *dti, + } + WARNING(ranges_format, check_ranges_format, NULL, &addr_size_cells); + ++static const struct bus_type pci_bus = { ++ .name = "PCI", ++}; ++ ++static void check_pci_bridge(struct check *c, struct dt_info *dti, struct node *node) ++{ ++ struct property *prop; ++ cell_t *cells; ++ ++ prop = get_property(node, "device_type"); ++ if (!prop || !streq(prop->val.val, "pci")) ++ return; ++ ++ node->bus = &pci_bus; ++ ++ if (!strneq(node->name, "pci", node->basenamelen) && ++ !strneq(node->name, "pcie", node->basenamelen)) ++ FAIL(c, dti, "Node %s node name is not \"pci\" or \"pcie\"", ++ node->fullpath); ++ ++ prop = get_property(node, "ranges"); ++ if (!prop) ++ FAIL(c, dti, "Node %s missing ranges for PCI bridge (or not a bridge)", ++ node->fullpath); ++ ++ if (node_addr_cells(node) != 3) ++ FAIL(c, dti, "Node %s incorrect #address-cells for PCI bridge", ++ node->fullpath); ++ if (node_size_cells(node) != 2) ++ FAIL(c, dti, "Node %s incorrect #size-cells for PCI bridge", ++ node->fullpath); ++ ++ prop = get_property(node, "bus-range"); ++ if (!prop) { ++ FAIL(c, dti, "Node %s missing bus-range for PCI bridge", ++ node->fullpath); ++ return; ++ } ++ if (prop->val.len != (sizeof(cell_t) * 2)) { ++ FAIL(c, dti, "Node %s bus-range must be 2 cells", ++ node->fullpath); ++ return; ++ } ++ cells = (cell_t *)prop->val.val; ++ if (fdt32_to_cpu(cells[0]) > fdt32_to_cpu(cells[1])) ++ FAIL(c, dti, "Node %s bus-range 1st cell must be less than or equal to 2nd cell", ++ node->fullpath); ++ if (fdt32_to_cpu(cells[1]) > 0xff) ++ FAIL(c, dti, "Node %s bus-range maximum bus number must be less than 256", ++ node->fullpath); ++} ++WARNING(pci_bridge, check_pci_bridge, NULL, ++ &device_type_is_string, &addr_size_cells); ++ ++static void check_pci_device_bus_num(struct check *c, struct dt_info *dti, struct node *node) ++{ ++ struct property *prop; ++ unsigned int bus_num, min_bus, max_bus; ++ cell_t *cells; ++ ++ if (!node->parent || (node->parent->bus != &pci_bus)) ++ return; ++ ++ prop = get_property(node, "reg"); ++ if (!prop) ++ return; ++ ++ cells = (cell_t *)prop->val.val; ++ bus_num = (fdt32_to_cpu(cells[0]) & 0x00ff0000) >> 16; ++ ++ prop = get_property(node->parent, "bus-range"); ++ if (!prop) { ++ min_bus = max_bus = 0; ++ } else { ++ cells = (cell_t *)prop->val.val; ++ min_bus = fdt32_to_cpu(cells[0]); ++ max_bus = fdt32_to_cpu(cells[0]); ++ } ++ if ((bus_num < min_bus) || (bus_num > max_bus)) ++ FAIL(c, dti, "Node %s PCI bus number %d out of range, expected (%d - %d)", ++ node->fullpath, bus_num, min_bus, max_bus); ++} ++WARNING(pci_device_bus_num, check_pci_device_bus_num, NULL, ®_format, &pci_bridge); ++ ++static void check_pci_device_reg(struct check *c, struct dt_info *dti, struct node *node) ++{ ++ struct property *prop; ++ const char *unitname = get_unitname(node); ++ char unit_addr[5]; ++ unsigned int dev, func, reg; ++ cell_t *cells; ++ ++ if (!node->parent || (node->parent->bus != &pci_bus)) ++ return; ++ ++ prop = get_property(node, "reg"); ++ if (!prop) { ++ FAIL(c, dti, "Node %s missing PCI reg property", node->fullpath); ++ return; ++ } ++ ++ cells = (cell_t *)prop->val.val; ++ if (cells[1] || cells[2]) ++ FAIL(c, dti, "Node %s PCI reg config space address cells 2 and 3 must be 0", ++ node->fullpath); ++ ++ reg = fdt32_to_cpu(cells[0]); ++ dev = (reg & 0xf800) >> 11; ++ func = (reg & 0x700) >> 8; ++ ++ if (reg & 0xff000000) ++ FAIL(c, dti, "Node %s PCI reg address is not configuration space", ++ node->fullpath); ++ if (reg & 0x000000ff) ++ FAIL(c, dti, "Node %s PCI reg config space address register number must be 0", ++ node->fullpath); ++ ++ if (func == 0) { ++ snprintf(unit_addr, sizeof(unit_addr), "%x", dev); ++ if (streq(unitname, unit_addr)) ++ return; ++ } ++ ++ snprintf(unit_addr, sizeof(unit_addr), "%x,%x", dev, func); ++ if (streq(unitname, unit_addr)) ++ return; ++ ++ FAIL(c, dti, "Node %s PCI unit address format error, expected \"%s\"", ++ node->fullpath, unit_addr); ++} ++WARNING(pci_device_reg, check_pci_device_reg, NULL, ®_format, &pci_bridge); ++ ++static const struct bus_type simple_bus = { ++ .name = "simple-bus", ++}; ++ ++static bool node_is_compatible(struct node *node, const char *compat) ++{ ++ struct property *prop; ++ const char *str, *end; ++ ++ prop = get_property(node, "compatible"); ++ if (!prop) ++ return false; ++ ++ for (str = prop->val.val, end = str + prop->val.len; str < end; ++ str += strnlen(str, end - str) + 1) { ++ if (strneq(str, compat, end - str)) ++ return true; ++ } ++ return false; ++} ++ ++static void check_simple_bus_bridge(struct check *c, struct dt_info *dti, struct node *node) ++{ ++ if (node_is_compatible(node, "simple-bus")) ++ node->bus = &simple_bus; ++} ++WARNING(simple_bus_bridge, check_simple_bus_bridge, NULL, &addr_size_cells); ++ ++static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct node *node) ++{ ++ struct property *prop; ++ const char *unitname = get_unitname(node); ++ char unit_addr[17]; ++ unsigned int size; ++ uint64_t reg = 0; ++ cell_t *cells = NULL; ++ ++ if (!node->parent || (node->parent->bus != &simple_bus)) ++ return; ++ ++ prop = get_property(node, "reg"); ++ if (prop) ++ cells = (cell_t *)prop->val.val; ++ else { ++ prop = get_property(node, "ranges"); ++ if (prop && prop->val.len) ++ /* skip of child address */ ++ cells = ((cell_t *)prop->val.val) + node_addr_cells(node); ++ } ++ ++ if (!cells) { ++ if (node->parent->parent && !(node->bus == &simple_bus)) ++ FAIL(c, dti, "Node %s missing or empty reg/ranges property", node->fullpath); ++ return; ++ } ++ ++ size = node_addr_cells(node->parent); ++ while (size--) ++ reg = (reg << 32) | fdt32_to_cpu(*(cells++)); ++ ++ snprintf(unit_addr, sizeof(unit_addr), "%lx", reg); ++ if (!streq(unitname, unit_addr)) ++ FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"", ++ node->fullpath, unit_addr); ++} ++WARNING(simple_bus_reg, check_simple_bus_reg, NULL, ®_format, &simple_bus_bridge); ++ ++static void check_unit_address_format(struct check *c, struct dt_info *dti, ++ struct node *node) ++{ ++ const char *unitname = get_unitname(node); ++ ++ if (node->parent && node->parent->bus) ++ return; ++ ++ if (!unitname[0]) ++ return; ++ ++ if (!strncmp(unitname, "0x", 2)) { ++ FAIL(c, dti, "Node %s unit name should not have leading \"0x\"", ++ node->fullpath); ++ /* skip over 0x for next test */ ++ unitname += 2; ++ } ++ if (unitname[0] == '0' && isxdigit(unitname[1])) ++ FAIL(c, dti, "Node %s unit name should not have leading 0s", ++ node->fullpath); ++} ++WARNING(unit_address_format, check_unit_address_format, NULL, ++ &node_name_format, &pci_bridge, &simple_bus_bridge); ++ + /* + * Style checks + */ +@@ -656,11 +922,11 @@ static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti, + return; + + if (node->parent->addr_cells == -1) +- FAIL(c, "Relying on default #address-cells value for %s", ++ FAIL(c, dti, "Relying on default #address-cells value for %s", + node->fullpath); + + if (node->parent->size_cells == -1) +- FAIL(c, "Relying on default #size-cells value for %s", ++ FAIL(c, dti, "Relying on default #size-cells value for %s", + node->fullpath); + } + WARNING(avoid_default_addr_size, check_avoid_default_addr_size, NULL, +@@ -684,7 +950,7 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c, + + prop = get_property(chosen, "interrupt-controller"); + if (prop) +- FAIL(c, "/chosen has obsolete \"interrupt-controller\" " ++ FAIL(c, dti, "/chosen has obsolete \"interrupt-controller\" " + "property"); + } + WARNING(obsolete_chosen_interrupt_controller, +@@ -703,9 +969,20 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c, + &address_cells_is_cell, &size_cells_is_cell, &interrupt_cells_is_cell, + &device_type_is_string, &model_is_string, &status_is_string, + ++ &property_name_chars_strict, ++ &node_name_chars_strict, ++ + &addr_size_cells, ®_format, &ranges_format, + + &unit_address_vs_reg, ++ &unit_address_format, ++ ++ &pci_bridge, ++ &pci_device_reg, ++ &pci_device_bus_num, ++ ++ &simple_bus_bridge, ++ &simple_bus_reg, + + &avoid_default_addr_size, + &obsolete_chosen_interrupt_controller, +diff --git a/scripts/dtc/data.c b/scripts/dtc/data.c +index 8cae237..aa37a16 100644 +--- a/scripts/dtc/data.c ++++ b/scripts/dtc/data.c +@@ -171,9 +171,9 @@ struct data data_merge(struct data d1, struct data d2) + struct data data_append_integer(struct data d, uint64_t value, int bits) + { + uint8_t value_8; +- uint16_t value_16; +- uint32_t value_32; +- uint64_t value_64; ++ fdt16_t value_16; ++ fdt32_t value_32; ++ fdt64_t value_64; + + switch (bits) { + case 8: +@@ -197,14 +197,14 @@ struct data data_append_integer(struct data d, uint64_t value, int bits) + } + } + +-struct data data_append_re(struct data d, const struct fdt_reserve_entry *re) ++struct data data_append_re(struct data d, uint64_t address, uint64_t size) + { +- struct fdt_reserve_entry bere; ++ struct fdt_reserve_entry re; + +- bere.address = cpu_to_fdt64(re->address); +- bere.size = cpu_to_fdt64(re->size); ++ re.address = cpu_to_fdt64(address); ++ re.size = cpu_to_fdt64(size); + +- return data_append_data(d, &bere, sizeof(bere)); ++ return data_append_data(d, &re, sizeof(re)); + } + + struct data data_append_cell(struct data d, cell_t word) +diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l +index c600603..fd825eb 100644 +--- a/scripts/dtc/dtc-lexer.l ++++ b/scripts/dtc/dtc-lexer.l +@@ -62,7 +62,8 @@ static int dts_version = 1; + + static void push_input_file(const char *filename); + static bool pop_input_file(void); +-static void lexical_error(const char *fmt, ...); ++static void PRINTF(1, 2) lexical_error(const char *fmt, ...); ++ + %} + + %% +diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y +index b2fd4d1..ca3f500 100644 +--- a/scripts/dtc/dtc-parser.y ++++ b/scripts/dtc/dtc-parser.y +@@ -171,10 +171,10 @@ devicetree: + { + struct node *target = get_node_by_ref($1, $3); + +- add_label(&target->labels, $2); +- if (target) ++ if (target) { ++ add_label(&target->labels, $2); + merge_nodes(target, $4); +- else ++ } else + ERROR(&@3, "Label or path %s not found", $3); + $$ = $1; + } +diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c +index a4edf4c..f5eed9d 100644 +--- a/scripts/dtc/dtc.c ++++ b/scripts/dtc/dtc.c +@@ -138,7 +138,7 @@ static const char *guess_type_by_name(const char *fname, const char *fallback) + static const char *guess_input_format(const char *fname, const char *fallback) + { + struct stat statbuf; +- uint32_t magic; ++ fdt32_t magic; + FILE *f; + + if (stat(fname, &statbuf) != 0) +@@ -159,8 +159,7 @@ static const char *guess_input_format(const char *fname, const char *fallback) + } + fclose(f); + +- magic = fdt32_to_cpu(magic); +- if (magic == FDT_MAGIC) ++ if (fdt32_to_cpu(magic) == FDT_MAGIC) + return "dtb"; + + return guess_type_by_name(fname, fallback); +@@ -216,7 +215,7 @@ int main(int argc, char *argv[]) + alignsize = strtol(optarg, NULL, 0); + if (!is_power_of_2(alignsize)) + die("Invalid argument \"%d\" to -a option\n", +- optarg); ++ alignsize); + break; + case 'f': + force = true; +@@ -309,6 +308,8 @@ int main(int argc, char *argv[]) + else + die("Unknown input format \"%s\"\n", inform); + ++ dti->outname = outname; ++ + if (depfile) { + fputc('\n', depfile); + fclose(depfile); +diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h +index c6f125c..fc24e17 100644 +--- a/scripts/dtc/dtc.h ++++ b/scripts/dtc/dtc.h +@@ -43,7 +43,6 @@ + #define debug(...) + #endif + +- + #define DEFAULT_FDT_VERSION 17 + + /* +@@ -114,7 +113,7 @@ struct data data_insert_at_marker(struct data d, struct marker *m, + struct data data_merge(struct data d1, struct data d2); + struct data data_append_cell(struct data d, cell_t word); + struct data data_append_integer(struct data d, uint64_t word, int bits); +-struct data data_append_re(struct data d, const struct fdt_reserve_entry *re); ++struct data data_append_re(struct data d, uint64_t address, uint64_t size); + struct data data_append_addr(struct data d, uint64_t addr); + struct data data_append_byte(struct data d, uint8_t byte); + struct data data_append_zeroes(struct data d, int len); +@@ -136,6 +135,10 @@ struct label { + struct label *next; + }; + ++struct bus_type { ++ const char *name; ++}; ++ + struct property { + bool deleted; + char *name; +@@ -162,6 +165,7 @@ struct node { + int addr_cells, size_cells; + + struct label *labels; ++ const struct bus_type *bus; + }; + + #define for_each_label_withdel(l0, l) \ +@@ -227,7 +231,7 @@ struct marker *get_marker_label(struct node *tree, const char *label, + /* Boot info (tree plus memreserve information */ + + struct reserve_info { +- struct fdt_reserve_entry re; ++ uint64_t address, size; + + struct reserve_info *next; + +@@ -246,6 +250,7 @@ struct dt_info { + struct reserve_info *reservelist; + uint32_t boot_cpuid_phys; + struct node *dt; /* the device tree */ ++ const char *outname; /* filename being written to, "-" for stdout */ + }; + + /* DTS version flags definitions */ +diff --git a/scripts/dtc/fdtdump.c b/scripts/dtc/fdtdump.c +index 207a46d..fa3b561 100644 +--- a/scripts/dtc/fdtdump.c ++++ b/scripts/dtc/fdtdump.c +@@ -2,48 +2,49 @@ + * fdtdump.c - Contributed by Pantelis Antoniou + */ + ++#include + #include + #include + #include + #include + #include + +-#include ++#include + #include ++#include + + #include "util.h" + ++#define FDT_MAGIC_SIZE 4 ++#define MAX_VERSION 17 ++ + #define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1)) + #define PALIGN(p, a) ((void *)(ALIGN((unsigned long)(p), (a)))) +-#define GET_CELL(p) (p += 4, *((const uint32_t *)(p-4))) ++#define GET_CELL(p) (p += 4, *((const fdt32_t *)(p-4))) + +-static void print_data(const char *data, int len) ++static const char *tagname(uint32_t tag) + { +- int i; +- const char *p = data; +- +- /* no data, don't print */ +- if (len == 0) +- return; +- +- if (util_is_printable_string(data, len)) { +- printf(" = \"%s\"", (const char *)data); +- } else if ((len % 4) == 0) { +- printf(" = <"); +- for (i = 0; i < len; i += 4) +- printf("0x%08x%s", fdt32_to_cpu(GET_CELL(p)), +- i < (len - 4) ? " " : ""); +- printf(">"); +- } else { +- printf(" = ["); +- for (i = 0; i < len; i++) +- printf("%02x%s", *p++, i < len - 1 ? " " : ""); +- printf("]"); +- } ++ static const char * const names[] = { ++#define TN(t) [t] = #t ++ TN(FDT_BEGIN_NODE), ++ TN(FDT_END_NODE), ++ TN(FDT_PROP), ++ TN(FDT_NOP), ++ TN(FDT_END), ++#undef TN ++ }; ++ if (tag < ARRAY_SIZE(names)) ++ if (names[tag]) ++ return names[tag]; ++ return "FDT_???"; + } + +-static void dump_blob(void *blob) ++#define dumpf(fmt, args...) \ ++ do { if (debug) printf("// " fmt, ## args); } while (0) ++ ++static void dump_blob(void *blob, bool debug) + { ++ uintptr_t blob_off = (uintptr_t)blob; + struct fdt_header *bph = blob; + uint32_t off_mem_rsvmap = fdt32_to_cpu(bph->off_mem_rsvmap); + uint32_t off_dt = fdt32_to_cpu(bph->off_dt_struct); +@@ -90,14 +91,15 @@ static void dump_blob(void *blob) + if (addr == 0 && size == 0) + break; + +- printf("/memreserve/ %llx %llx;\n", ++ printf("/memreserve/ %#llx %#llx;\n", + (unsigned long long)addr, (unsigned long long)size); + } + + p = p_struct; + while ((tag = fdt32_to_cpu(GET_CELL(p))) != FDT_END) { + +- /* printf("tag: 0x%08x (%d)\n", tag, p - p_struct); */ ++ dumpf("%04zx: tag: 0x%08x (%s)\n", ++ (uintptr_t)p - blob_off - 4, tag, tagname(tag)); + + if (tag == FDT_BEGIN_NODE) { + s = p; +@@ -136,27 +138,108 @@ static void dump_blob(void *blob) + + p = PALIGN(p + sz, 4); + ++ dumpf("%04zx: string: %s\n", (uintptr_t)s - blob_off, s); ++ dumpf("%04zx: value\n", (uintptr_t)t - blob_off); + printf("%*s%s", depth * shift, "", s); +- print_data(t, sz); ++ utilfdt_print_data(t, sz); + printf(";\n"); + } + } + ++/* Usage related data. */ ++static const char usage_synopsis[] = "fdtdump [options] "; ++static const char usage_short_opts[] = "ds" USAGE_COMMON_SHORT_OPTS; ++static struct option const usage_long_opts[] = { ++ {"debug", no_argument, NULL, 'd'}, ++ {"scan", no_argument, NULL, 's'}, ++ USAGE_COMMON_LONG_OPTS ++}; ++static const char * const usage_opts_help[] = { ++ "Dump debug information while decoding the file", ++ "Scan for an embedded fdt in file", ++ USAGE_COMMON_OPTS_HELP ++}; ++ ++static bool valid_header(char *p, off_t len) ++{ ++ if (len < sizeof(struct fdt_header) || ++ fdt_magic(p) != FDT_MAGIC || ++ fdt_version(p) > MAX_VERSION || ++ fdt_last_comp_version(p) > MAX_VERSION || ++ fdt_totalsize(p) >= len || ++ fdt_off_dt_struct(p) >= len || ++ fdt_off_dt_strings(p) >= len) ++ return 0; ++ else ++ return 1; ++} + + int main(int argc, char *argv[]) + { ++ int opt; ++ const char *file; + char *buf; +- +- if (argc < 2) { +- fprintf(stderr, "supply input filename\n"); +- return 5; ++ bool debug = false; ++ bool scan = false; ++ off_t len; ++ ++ fprintf(stderr, "\n" ++"**** fdtdump is a low-level debugging tool, not meant for general use.\n" ++"**** If you want to decompile a dtb, you probably want\n" ++"**** dtc -I dtb -O dts \n\n" ++ ); ++ while ((opt = util_getopt_long()) != EOF) { ++ switch (opt) { ++ case_USAGE_COMMON_FLAGS ++ ++ case 'd': ++ debug = true; ++ break; ++ case 's': ++ scan = true; ++ break; ++ } + } +- +- buf = utilfdt_read(argv[1]); +- if (buf) +- dump_blob(buf); +- else +- return 10; ++ if (optind != argc - 1) ++ usage("missing input filename"); ++ file = argv[optind]; ++ ++ buf = utilfdt_read_len(file, &len); ++ if (!buf) ++ die("could not read: %s\n", file); ++ ++ /* try and locate an embedded fdt in a bigger blob */ ++ if (scan) { ++ unsigned char smagic[FDT_MAGIC_SIZE]; ++ char *p = buf; ++ char *endp = buf + len; ++ ++ fdt_set_magic(smagic, FDT_MAGIC); ++ ++ /* poor man's memmem */ ++ while ((endp - p) >= FDT_MAGIC_SIZE) { ++ p = memchr(p, smagic[0], endp - p - FDT_MAGIC_SIZE); ++ if (!p) ++ break; ++ if (fdt_magic(p) == FDT_MAGIC) { ++ /* try and validate the main struct */ ++ off_t this_len = endp - p; ++ if (valid_header(p, this_len)) ++ break; ++ if (debug) ++ printf("%s: skipping fdt magic at offset %#zx\n", ++ file, p - buf); ++ } ++ ++p; ++ } ++ if (!p || endp - p < sizeof(struct fdt_header)) ++ die("%s: could not locate fdt magic\n", file); ++ printf("%s: found fdt at offset %#zx\n", file, p - buf); ++ buf = p; ++ } else if (!valid_header(buf, len)) ++ die("%s: header is not valid\n", file); ++ ++ dump_blob(buf, debug); + + return 0; + } +diff --git a/scripts/dtc/fdtget.c b/scripts/dtc/fdtget.c +index c2fbab2..39f1742 100644 +--- a/scripts/dtc/fdtget.c ++++ b/scripts/dtc/fdtget.c +@@ -105,7 +105,7 @@ static int show_data(struct display_info *disp, const char *data, int len) + for (i = 0; i < len; i += size, p += size) { + if (i) + printf(" "); +- value = size == 4 ? fdt32_to_cpu(*(const uint32_t *)p) : ++ value = size == 4 ? fdt32_to_cpu(*(const fdt32_t *)p) : + size == 2 ? (*p << 8) | p[1] : *p; + printf(fmt, value); + } +@@ -245,7 +245,7 @@ static int show_data_for_item(const void *blob, struct display_info *disp, + * @param filename Filename of blob file + * @param arg List of arguments to process + * @param arg_count Number of arguments +- * @param return 0 if ok, -ve on error ++ * @return 0 if ok, -ve on error + */ + static int do_fdtget(struct display_info *disp, const char *filename, + char **arg, int arg_count, int args_per_step) +@@ -266,44 +266,50 @@ static int do_fdtget(struct display_info *disp, const char *filename, + continue; + } else { + report_error(arg[i], node); ++ free(blob); + return -1; + } + } + prop = args_per_step == 1 ? NULL : arg[i + 1]; + +- if (show_data_for_item(blob, disp, node, prop)) ++ if (show_data_for_item(blob, disp, node, prop)) { ++ free(blob); + return -1; ++ } + } ++ ++ free(blob); ++ + return 0; + } + +-static const char *usage_msg = +- "fdtget - read values from device tree\n" +- "\n" +- "Each value is printed on a new line.\n\n" +- "Usage:\n" ++/* Usage related data. */ ++static const char usage_synopsis[] = ++ "read values from device tree\n" + " fdtget
[ ]...\n" + " fdtget -p
[ ]...\n" +- "Options:\n" +- "\t-t \tType of data\n" +- "\t-p\t\tList properties for each node\n" +- "\t-l\t\tList subnodes for each node\n" +- "\t-d\t\tDefault value to display when the property is " +- "missing\n" +- "\t-h\t\tPrint this help\n\n" ++ "\n" ++ "Each value is printed on a new line.\n" + USAGE_TYPE_MSG; +- +-static void usage(const char *msg) +-{ +- if (msg) +- fprintf(stderr, "Error: %s\n\n", msg); +- +- fprintf(stderr, "%s", usage_msg); +- exit(2); +-} ++static const char usage_short_opts[] = "t:pld:" USAGE_COMMON_SHORT_OPTS; ++static struct option const usage_long_opts[] = { ++ {"type", a_argument, NULL, 't'}, ++ {"properties", no_argument, NULL, 'p'}, ++ {"list", no_argument, NULL, 'l'}, ++ {"default", a_argument, NULL, 'd'}, ++ USAGE_COMMON_LONG_OPTS, ++}; ++static const char * const usage_opts_help[] = { ++ "Type of data", ++ "List properties for each node", ++ "List subnodes for each node", ++ "Default value to display when the property is missing", ++ USAGE_COMMON_OPTS_HELP ++}; + + int main(int argc, char *argv[]) + { ++ int opt; + char *filename = NULL; + struct display_info disp; + int args_per_step = 2; +@@ -312,20 +318,14 @@ int main(int argc, char *argv[]) + memset(&disp, '\0', sizeof(disp)); + disp.size = -1; + disp.mode = MODE_SHOW_VALUE; +- for (;;) { +- int c = getopt(argc, argv, "d:hlpt:"); +- if (c == -1) +- break; +- +- switch (c) { +- case 'h': +- case '?': +- usage(NULL); ++ while ((opt = util_getopt_long()) != EOF) { ++ switch (opt) { ++ case_USAGE_COMMON_FLAGS + + case 't': + if (utilfdt_decode_type(optarg, &disp.type, + &disp.size)) +- usage("Invalid type string"); ++ usage("invalid type string"); + break; + + case 'p': +@@ -347,7 +347,7 @@ int main(int argc, char *argv[]) + if (optind < argc) + filename = argv[optind++]; + if (!filename) +- usage("Missing filename"); ++ usage("missing filename"); + + argv += optind; + argc -= optind; +@@ -358,7 +358,7 @@ int main(int argc, char *argv[]) + + /* Check for node, property arguments */ + if (args_per_step == 2 && (argc % 2)) +- usage("Must have an even number of arguments"); ++ usage("must have an even number of arguments"); + + if (do_fdtget(&disp, filename, argv, argc, args_per_step)) + return 1; +diff --git a/scripts/dtc/fdtput.c b/scripts/dtc/fdtput.c +index f2197f5..8d8e934 100644 +--- a/scripts/dtc/fdtput.c ++++ b/scripts/dtc/fdtput.c +@@ -32,6 +32,8 @@ + enum oper_type { + OPER_WRITE_PROP, /* Write a property in a node */ + OPER_CREATE_NODE, /* Create a new node */ ++ OPER_REMOVE_NODE, /* Delete a node */ ++ OPER_DELETE_PROP, /* Delete a property in a node */ + }; + + struct display_info { +@@ -65,7 +67,7 @@ static void report_error(const char *name, int namelen, int err) + * @param arg List of arguments from command line + * @param arg_count Number of arguments (may be 0) + * @param valuep Returns buffer containing value +- * @param *value_len Returns length of value encoded ++ * @param value_len Returns length of value encoded + */ + static int encode_value(struct display_info *disp, char **arg, int arg_count, + char **valuep, int *value_len) +@@ -96,12 +98,7 @@ static int encode_value(struct display_info *disp, char **arg, int arg_count, + /* enlarge our value buffer by a suitable margin if needed */ + if (upto + len > value_size) { + value_size = (upto + len) + 500; +- value = realloc(value, value_size); +- if (!value) { +- fprintf(stderr, "Out of mmory: cannot alloc " +- "%d bytes\n", value_size); +- return -1; +- } ++ value = xrealloc(value, value_size); + } + + ptr = value + upto; +@@ -110,7 +107,7 @@ static int encode_value(struct display_info *disp, char **arg, int arg_count, + if (disp->verbose) + fprintf(stderr, "\tstring: '%s'\n", ptr); + } else { +- int *iptr = (int *)ptr; ++ fdt32_t *iptr = (fdt32_t *)ptr; + sscanf(*arg, fmt, &ival); + if (len == 4) + *iptr = cpu_to_fdt32(ival); +@@ -131,19 +128,59 @@ static int encode_value(struct display_info *disp, char **arg, int arg_count, + return 0; + } + +-static int store_key_value(void *blob, const char *node_name, ++#define ALIGN(x) (((x) + (FDT_TAGSIZE) - 1) & ~((FDT_TAGSIZE) - 1)) ++ ++static char *_realloc_fdt(char *fdt, int delta) ++{ ++ int new_sz = fdt_totalsize(fdt) + delta; ++ fdt = xrealloc(fdt, new_sz); ++ fdt_open_into(fdt, fdt, new_sz); ++ return fdt; ++} ++ ++static char *realloc_node(char *fdt, const char *name) ++{ ++ int delta; ++ /* FDT_BEGIN_NODE, node name in off_struct and FDT_END_NODE */ ++ delta = sizeof(struct fdt_node_header) + ALIGN(strlen(name) + 1) ++ + FDT_TAGSIZE; ++ return _realloc_fdt(fdt, delta); ++} ++ ++static char *realloc_property(char *fdt, int nodeoffset, ++ const char *name, int newlen) ++{ ++ int delta = 0; ++ int oldlen = 0; ++ ++ if (!fdt_get_property(fdt, nodeoffset, name, &oldlen)) ++ /* strings + property header */ ++ delta = sizeof(struct fdt_property) + strlen(name) + 1; ++ ++ if (newlen > oldlen) ++ /* actual value in off_struct */ ++ delta += ALIGN(newlen) - ALIGN(oldlen); ++ ++ return _realloc_fdt(fdt, delta); ++} ++ ++static int store_key_value(char **blob, const char *node_name, + const char *property, const char *buf, int len) + { + int node; + int err; + +- node = fdt_path_offset(blob, node_name); ++ node = fdt_path_offset(*blob, node_name); + if (node < 0) { + report_error(node_name, -1, node); + return -1; + } + +- err = fdt_setprop(blob, node, property, buf, len); ++ err = fdt_setprop(*blob, node, property, buf, len); ++ if (err == -FDT_ERR_NOSPACE) { ++ *blob = realloc_property(*blob, node, property, len); ++ err = fdt_setprop(*blob, node, property, buf, len); ++ } + if (err) { + report_error(property, -1, err); + return -1; +@@ -161,7 +198,7 @@ static int store_key_value(void *blob, const char *node_name, + * @param in_path Path to process + * @return 0 if ok, -1 on error + */ +-static int create_paths(void *blob, const char *in_path) ++static int create_paths(char **blob, const char *in_path) + { + const char *path = in_path; + const char *sep; +@@ -177,10 +214,11 @@ static int create_paths(void *blob, const char *in_path) + if (!sep) + sep = path + strlen(path); + +- node = fdt_subnode_offset_namelen(blob, offset, path, ++ node = fdt_subnode_offset_namelen(*blob, offset, path, + sep - path); + if (node == -FDT_ERR_NOTFOUND) { +- node = fdt_add_subnode_namelen(blob, offset, path, ++ *blob = realloc_node(*blob, path); ++ node = fdt_add_subnode_namelen(*blob, offset, path, + sep - path); + } + if (node < 0) { +@@ -203,7 +241,7 @@ static int create_paths(void *blob, const char *in_path) + * @param node_name Name of node to create + * @return new node offset if found, or -1 on failure + */ +-static int create_node(void *blob, const char *node_name) ++static int create_node(char **blob, const char *node_name) + { + int node = 0; + char *p; +@@ -215,15 +253,17 @@ static int create_node(void *blob, const char *node_name) + } + *p = '\0'; + ++ *blob = realloc_node(*blob, p + 1); ++ + if (p > node_name) { +- node = fdt_path_offset(blob, node_name); ++ node = fdt_path_offset(*blob, node_name); + if (node < 0) { + report_error(node_name, -1, node); + return -1; + } + } + +- node = fdt_add_subnode(blob, node, p + 1); ++ node = fdt_add_subnode(*blob, node, p + 1); + if (node < 0) { + report_error(p + 1, -1, node); + return -1; +@@ -232,11 +272,65 @@ static int create_node(void *blob, const char *node_name) + return 0; + } + ++/** ++ * Delete a property of a node in the fdt. ++ * ++ * @param blob FDT blob to write into ++ * @param node_name Path to node containing the property to delete ++ * @param prop_name Name of property to delete ++ * @return 0 on success, or -1 on failure ++ */ ++static int delete_prop(char *blob, const char *node_name, const char *prop_name) ++{ ++ int node = 0; ++ ++ node = fdt_path_offset(blob, node_name); ++ if (node < 0) { ++ report_error(node_name, -1, node); ++ return -1; ++ } ++ ++ node = fdt_delprop(blob, node, prop_name); ++ if (node < 0) { ++ report_error(node_name, -1, node); ++ return -1; ++ } ++ ++ return 0; ++} ++ ++/** ++ * Delete a node in the fdt. ++ * ++ * @param blob FDT blob to write into ++ * @param node_name Name of node to delete ++ * @return 0 on success, or -1 on failure ++ */ ++static int delete_node(char *blob, const char *node_name) ++{ ++ int node = 0; ++ ++ node = fdt_path_offset(blob, node_name); ++ if (node < 0) { ++ report_error(node_name, -1, node); ++ return -1; ++ } ++ ++ node = fdt_del_node(blob, node); ++ if (node < 0) { ++ report_error(node_name, -1, node); ++ return -1; ++ } ++ ++ return 0; ++} ++ + static int do_fdtput(struct display_info *disp, const char *filename, + char **arg, int arg_count) + { +- char *value; ++ char *value = NULL; + char *blob; ++ char *node; + int len, ret = 0; + + blob = utilfdt_read(filename); +@@ -250,82 +344,102 @@ static int do_fdtput(struct display_info *disp, const char *filename, + * store them into the property. + */ + assert(arg_count >= 2); +- if (disp->auto_path && create_paths(blob, *arg)) ++ if (disp->auto_path && create_paths(&blob, *arg)) + return -1; + if (encode_value(disp, arg + 2, arg_count - 2, &value, &len) || +- store_key_value(blob, *arg, arg[1], value, len)) ++ store_key_value(&blob, *arg, arg[1], value, len)) + ret = -1; + break; + case OPER_CREATE_NODE: + for (; ret >= 0 && arg_count--; arg++) { + if (disp->auto_path) +- ret = create_paths(blob, *arg); ++ ret = create_paths(&blob, *arg); + else +- ret = create_node(blob, *arg); ++ ret = create_node(&blob, *arg); + } + break; ++ case OPER_REMOVE_NODE: ++ for (; ret >= 0 && arg_count--; arg++) ++ ret = delete_node(blob, *arg); ++ break; ++ case OPER_DELETE_PROP: ++ node = *arg; ++ for (arg++; ret >= 0 && arg_count-- > 1; arg++) ++ ret = delete_prop(blob, node, *arg); ++ break; + } +- if (ret >= 0) ++ if (ret >= 0) { ++ fdt_pack(blob); + ret = utilfdt_write(filename, blob); ++ } + + free(blob); ++ ++ if (value) { ++ free(value); ++ } ++ + return ret; + } + +-static const char *usage_msg = +- "fdtput - write a property value to a device tree\n" +- "\n" +- "The command line arguments are joined together into a single value.\n" +- "\n" +- "Usage:\n" ++/* Usage related data. */ ++static const char usage_synopsis[] = ++ "write a property value to a device tree\n" + " fdtput
[...]\n" + " fdtput -c
[...]\n" +- "Options:\n" +- "\t-c\t\tCreate nodes if they don't already exist\n" +- "\t-p\t\tAutomatically create nodes as needed for the node path\n" +- "\t-t \tType of data\n" +- "\t-v\t\tVerbose: display each value decoded from command line\n" +- "\t-h\t\tPrint this help\n\n" ++ " fdtput -r
[...]\n" ++ " fdtput -d
[...]\n" ++ "\n" ++ "The command line arguments are joined together into a single value.\n" + USAGE_TYPE_MSG; +- +-static void usage(const char *msg) +-{ +- if (msg) +- fprintf(stderr, "Error: %s\n\n", msg); +- +- fprintf(stderr, "%s", usage_msg); +- exit(2); +-} ++static const char usage_short_opts[] = "crdpt:v" USAGE_COMMON_SHORT_OPTS; ++static struct option const usage_long_opts[] = { ++ {"create", no_argument, NULL, 'c'}, ++ {"remove", no_argument, NULL, 'r'}, ++ {"delete", no_argument, NULL, 'd'}, ++ {"auto-path", no_argument, NULL, 'p'}, ++ {"type", a_argument, NULL, 't'}, ++ {"verbose", no_argument, NULL, 'v'}, ++ USAGE_COMMON_LONG_OPTS, ++}; ++static const char * const usage_opts_help[] = { ++ "Create nodes if they don't already exist", ++ "Delete nodes (and any subnodes) if they already exist", ++ "Delete properties if they already exist", ++ "Automatically create nodes as needed for the node path", ++ "Type of data", ++ "Display each value decoded from command line", ++ USAGE_COMMON_OPTS_HELP ++}; + + int main(int argc, char *argv[]) + { ++ int opt; + struct display_info disp; + char *filename = NULL; + + memset(&disp, '\0', sizeof(disp)); + disp.size = -1; + disp.oper = OPER_WRITE_PROP; +- for (;;) { +- int c = getopt(argc, argv, "chpt:v"); +- if (c == -1) +- break; +- ++ while ((opt = util_getopt_long()) != EOF) { + /* + * TODO: add options to: +- * - delete property +- * - delete node (optionally recursively) + * - rename node + * - pack fdt before writing + * - set amount of free space when writing +- * - expand fdt if value doesn't fit + */ +- switch (c) { ++ switch (opt) { ++ case_USAGE_COMMON_FLAGS ++ + case 'c': + disp.oper = OPER_CREATE_NODE; + break; +- case 'h': +- case '?': +- usage(NULL); ++ case 'r': ++ disp.oper = OPER_REMOVE_NODE; ++ break; ++ case 'd': ++ disp.oper = OPER_DELETE_PROP; ++ break; + case 'p': + disp.auto_path = 1; + break; +@@ -344,18 +458,22 @@ int main(int argc, char *argv[]) + if (optind < argc) + filename = argv[optind++]; + if (!filename) +- usage("Missing filename"); ++ usage("missing filename"); + + argv += optind; + argc -= optind; + + if (disp.oper == OPER_WRITE_PROP) { + if (argc < 1) +- usage("Missing node"); ++ usage("missing node"); + if (argc < 2) +- usage("Missing property"); ++ usage("missing property"); + } + ++ if (disp.oper == OPER_DELETE_PROP) ++ if (argc < 1) ++ usage("missing node"); ++ + if (do_fdtput(&disp, filename, argv, argc)) + return 1; + return 0; +diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c +index ebac548..fcf7154 100644 +--- a/scripts/dtc/flattree.c ++++ b/scripts/dtc/flattree.c +@@ -49,7 +49,7 @@ + + struct emitter { + void (*cell)(void *, cell_t); +- void (*string)(void *, char *, int); ++ void (*string)(void *, const char *, int); + void (*align)(void *, int); + void (*data)(void *, struct data); + void (*beginnode)(void *, struct label *labels); +@@ -64,7 +64,7 @@ static void bin_emit_cell(void *e, cell_t val) + *dtbuf = data_append_cell(*dtbuf, val); + } + +-static void bin_emit_string(void *e, char *str, int len) ++static void bin_emit_string(void *e, const char *str, int len) + { + struct data *dtbuf = e; + +@@ -144,22 +144,14 @@ static void asm_emit_cell(void *e, cell_t val) + (val >> 8) & 0xff, val & 0xff); + } + +-static void asm_emit_string(void *e, char *str, int len) ++static void asm_emit_string(void *e, const char *str, int len) + { + FILE *f = e; +- char c = 0; + +- if (len != 0) { +- /* XXX: ewww */ +- c = str[len]; +- str[len] = '\0'; +- } +- +- fprintf(f, "\t.string\t\"%s\"\n", str); +- +- if (len != 0) { +- str[len] = c; +- } ++ if (len != 0) ++ fprintf(f, "\t.string\t\"%.*s\"\n", len, str); ++ else ++ fprintf(f, "\t.string\t\"%s\"\n", str); + } + + static void asm_emit_align(void *e, int a) +@@ -179,7 +171,7 @@ static void asm_emit_data(void *e, struct data d) + emit_offset_label(f, m->ref, m->offset); + + while ((d.len - off) >= sizeof(uint32_t)) { +- asm_emit_cell(e, fdt32_to_cpu(*((uint32_t *)(d.val+off)))); ++ asm_emit_cell(e, fdt32_to_cpu(*((fdt32_t *)(d.val+off)))); + off += sizeof(uint32_t); + } + +@@ -318,17 +310,16 @@ static struct data flatten_reserve_list(struct reserve_info *reservelist, + { + struct reserve_info *re; + struct data d = empty_data; +- static struct fdt_reserve_entry null_re = {0,0}; + int j; + + for (re = reservelist; re; re = re->next) { +- d = data_append_re(d, &re->re); ++ d = data_append_re(d, re->address, re->size); + } + /* + * Add additional reserved slots if the user asked for them. + */ + for (j = 0; j < reservenum; j++) { +- d = data_append_re(d, &null_re); ++ d = data_append_re(d, 0, 0); + } + + return d; +@@ -544,11 +535,11 @@ void dt_to_asm(FILE *f, struct dt_info *dti, int version) + fprintf(f, "\t.globl\t%s\n", l->label); + fprintf(f, "%s:\n", l->label); + } +- ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->re.address >> 32)); ++ ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->address >> 32)); + ASM_EMIT_BELONG(f, "0x%08x", +- (unsigned int)(re->re.address & 0xffffffff)); +- ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->re.size >> 32)); +- ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->re.size & 0xffffffff)); ++ (unsigned int)(re->address & 0xffffffff)); ++ ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->size >> 32)); ++ ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->size & 0xffffffff)); + } + for (i = 0; i < reservenum; i++) { + fprintf(f, "\t.long\t0, 0\n\t.long\t0, 0\n"); +@@ -609,7 +600,7 @@ static void flat_read_chunk(struct inbuf *inb, void *p, int len) + + static uint32_t flat_read_word(struct inbuf *inb) + { +- uint32_t val; ++ fdt32_t val; + + assert(((inb->ptr - inb->base) % sizeof(val)) == 0); + +@@ -718,13 +709,15 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb) + * First pass, count entries. + */ + while (1) { ++ uint64_t address, size; ++ + flat_read_chunk(inb, &re, sizeof(re)); +- re.address = fdt64_to_cpu(re.address); +- re.size = fdt64_to_cpu(re.size); +- if (re.size == 0) ++ address = fdt64_to_cpu(re.address); ++ size = fdt64_to_cpu(re.size); ++ if (size == 0) + break; + +- new = build_reserve_entry(re.address, re.size); ++ new = build_reserve_entry(address, size); + reservelist = add_reserve_entry(reservelist, new); + } + +@@ -817,6 +810,7 @@ static struct node *unflatten_tree(struct inbuf *dtbuf, + struct dt_info *dt_from_blob(const char *fname) + { + FILE *f; ++ fdt32_t magic_buf, totalsize_buf; + uint32_t magic, totalsize, version, size_dt, boot_cpuid_phys; + uint32_t off_dt, off_str, off_mem_rsvmap; + int rc; +@@ -833,7 +827,7 @@ struct dt_info *dt_from_blob(const char *fname) + + f = srcfile_relative_open(fname, NULL); + +- rc = fread(&magic, sizeof(magic), 1, f); ++ rc = fread(&magic_buf, sizeof(magic_buf), 1, f); + if (ferror(f)) + die("Error reading DT blob magic number: %s\n", + strerror(errno)); +@@ -844,11 +838,11 @@ struct dt_info *dt_from_blob(const char *fname) + die("Mysterious short read reading magic number\n"); + } + +- magic = fdt32_to_cpu(magic); ++ magic = fdt32_to_cpu(magic_buf); + if (magic != FDT_MAGIC) + die("Blob has incorrect magic number\n"); + +- rc = fread(&totalsize, sizeof(totalsize), 1, f); ++ rc = fread(&totalsize_buf, sizeof(totalsize_buf), 1, f); + if (ferror(f)) + die("Error reading DT blob size: %s\n", strerror(errno)); + if (rc < 1) { +@@ -858,7 +852,7 @@ struct dt_info *dt_from_blob(const char *fname) + die("Mysterious short read reading blob size\n"); + } + +- totalsize = fdt32_to_cpu(totalsize); ++ totalsize = fdt32_to_cpu(totalsize_buf); + if (totalsize < FDT_V1_SIZE) + die("DT blob size (%d) is too small\n", totalsize); + +diff --git a/scripts/dtc/libfdt/fdt_empty_tree.c b/scripts/dtc/libfdt/fdt_empty_tree.c +index f72d13b..f2ae9b7 100644 +--- a/scripts/dtc/libfdt/fdt_empty_tree.c ++++ b/scripts/dtc/libfdt/fdt_empty_tree.c +@@ -81,4 +81,3 @@ int fdt_create_empty_tree(void *buf, int bufsize) + + return fdt_open_into(buf, buf, bufsize); + } +- +diff --git a/scripts/dtc/libfdt/fdt_ro.c b/scripts/dtc/libfdt/fdt_ro.c +index 3d00d2e..08de2cc 100644 +--- a/scripts/dtc/libfdt/fdt_ro.c ++++ b/scripts/dtc/libfdt/fdt_ro.c +@@ -60,7 +60,7 @@ static int _fdt_nodename_eq(const void *fdt, int offset, + { + const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1); + +- if (! p) ++ if (!p) + /* short match */ + return 0; + +@@ -327,7 +327,7 @@ const void *fdt_getprop_namelen(const void *fdt, int nodeoffset, + const struct fdt_property *prop; + + prop = fdt_get_property_namelen(fdt, nodeoffset, name, namelen, lenp); +- if (! prop) ++ if (!prop) + return NULL; + + return prop->data; +diff --git a/scripts/dtc/libfdt/fdt_rw.c b/scripts/dtc/libfdt/fdt_rw.c +index 2eed4f5..8b487f6 100644 +--- a/scripts/dtc/libfdt/fdt_rw.c ++++ b/scripts/dtc/libfdt/fdt_rw.c +@@ -207,7 +207,7 @@ static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name, + int err; + + *prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen); +- if (! (*prop)) ++ if (!*prop) + return oldlen; + + if ((err = _fdt_splice_struct(fdt, (*prop)->data, FDT_TAGALIGN(oldlen), +@@ -283,7 +283,8 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name, + if (err) + return err; + +- memcpy(prop->data, val, len); ++ if (len) ++ memcpy(prop->data, val, len); + return 0; + } + +@@ -322,7 +323,7 @@ int fdt_delprop(void *fdt, int nodeoffset, const char *name) + FDT_RW_CHECK_HEADER(fdt); + + prop = fdt_get_property_w(fdt, nodeoffset, name, &len); +- if (! prop) ++ if (!prop) + return len; + + proplen = sizeof(*prop) + FDT_TAGALIGN(len); +diff --git a/scripts/dtc/libfdt/fdt_sw.c b/scripts/dtc/libfdt/fdt_sw.c +index 6a80485..2bd15e7 100644 +--- a/scripts/dtc/libfdt/fdt_sw.c ++++ b/scripts/dtc/libfdt/fdt_sw.c +@@ -220,7 +220,7 @@ static int _fdt_find_add_string(void *fdt, const char *s) + return offset; + } + +-int fdt_property(void *fdt, const char *name, const void *val, int len) ++int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp) + { + struct fdt_property *prop; + int nameoff; +@@ -238,7 +238,19 @@ int fdt_property(void *fdt, const char *name, const void *val, int len) + prop->tag = cpu_to_fdt32(FDT_PROP); + prop->nameoff = cpu_to_fdt32(nameoff); + prop->len = cpu_to_fdt32(len); +- memcpy(prop->data, val, len); ++ *valp = prop->data; ++ return 0; ++} ++ ++int fdt_property(void *fdt, const char *name, const void *val, int len) ++{ ++ void *ptr; ++ int ret; ++ ++ ret = fdt_property_placeholder(fdt, name, len, &ptr); ++ if (ret) ++ return ret; ++ memcpy(ptr, val, len); + return 0; + } + +diff --git a/scripts/dtc/libfdt/fdt_wip.c b/scripts/dtc/libfdt/fdt_wip.c +index 6aaab39..5e85919 100644 +--- a/scripts/dtc/libfdt/fdt_wip.c ++++ b/scripts/dtc/libfdt/fdt_wip.c +@@ -82,7 +82,7 @@ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, + int proplen; + + propval = fdt_getprop(fdt, nodeoffset, name, &proplen); +- if (! propval) ++ if (!propval) + return proplen; + + if (proplen != len) +@@ -107,7 +107,7 @@ int fdt_nop_property(void *fdt, int nodeoffset, const char *name) + int len; + + prop = fdt_get_property_w(fdt, nodeoffset, name, &len); +- if (! prop) ++ if (!prop) + return len; + + _fdt_nop_region(prop, len + sizeof(*prop)); +diff --git a/scripts/dtc/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h +index b842b15..a248b1b 100644 +--- a/scripts/dtc/libfdt/libfdt.h ++++ b/scripts/dtc/libfdt/libfdt.h +@@ -143,7 +143,9 @@ + /* Low-level functions (you probably don't need these) */ + /**********************************************************************/ + ++#ifndef SWIG /* This function is not useful in Python */ + const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen); ++#endif + static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) + { + return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen); +@@ -210,7 +212,6 @@ static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) + /**********************************************************************/ + /* General functions */ + /**********************************************************************/ +- + #define fdt_get_header(fdt, field) \ + (fdt32_to_cpu(((const struct fdt_header *)(fdt))->field)) + #define fdt_magic(fdt) (fdt_get_header(fdt, magic)) +@@ -354,8 +355,10 @@ static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) + * useful for finding subnodes based on a portion of a larger string, + * such as a full path. + */ ++#ifndef SWIG /* Not available in Python */ + int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, + const char *name, int namelen); ++#endif + /** + * fdt_subnode_offset - find a subnode of a given node + * @fdt: pointer to the device tree blob +@@ -391,7 +394,9 @@ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, + * Identical to fdt_path_offset(), but only consider the first namelen + * characters of path as the path name. + */ ++#ifndef SWIG /* Not available in Python */ + int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen); ++#endif + + /** + * fdt_path_offset - find a tree node by its full path +@@ -550,10 +555,12 @@ const struct fdt_property *fdt_get_property_by_offset(const void *fdt, + * Identical to fdt_get_property(), but only examine the first namelen + * characters of name for matching the property name. + */ ++#ifndef SWIG /* Not available in Python */ + const struct fdt_property *fdt_get_property_namelen(const void *fdt, + int nodeoffset, + const char *name, + int namelen, int *lenp); ++#endif + + /** + * fdt_get_property - find a given property in a given node +@@ -624,8 +631,10 @@ static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings + */ ++#ifndef SWIG /* This function is not useful in Python */ + const void *fdt_getprop_by_offset(const void *fdt, int offset, + const char **namep, int *lenp); ++#endif + + /** + * fdt_getprop_namelen - get property value based on substring +@@ -638,6 +647,7 @@ const void *fdt_getprop_by_offset(const void *fdt, int offset, + * Identical to fdt_getprop(), but only examine the first namelen + * characters of name for matching the property name. + */ ++#ifndef SWIG /* Not available in Python */ + const void *fdt_getprop_namelen(const void *fdt, int nodeoffset, + const char *name, int namelen, int *lenp); + static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset, +@@ -647,6 +657,7 @@ static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset, + return (void *)(uintptr_t)fdt_getprop_namelen(fdt, nodeoffset, name, + namelen, lenp); + } ++#endif + + /** + * fdt_getprop - retrieve the value of a given property +@@ -707,8 +718,10 @@ static inline void *fdt_getprop_w(void *fdt, int nodeoffset, + * Identical to fdt_get_alias(), but only examine the first namelen + * characters of name for matching the alias name. + */ ++#ifndef SWIG /* Not available in Python */ + const char *fdt_get_alias_namelen(const void *fdt, + const char *name, int namelen); ++#endif + + /** + * fdt_get_alias - retrieve the path referenced by a given alias +@@ -1106,10 +1119,12 @@ const char *fdt_stringlist_get(const void *fdt, int nodeoffset, + * of the name. It is useful when you want to manipulate only one value of + * an array and you have a string that doesn't end with \0. + */ ++#ifndef SWIG /* Not available in Python */ + int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset, + const char *name, int namelen, + uint32_t idx, const void *val, + int len); ++#endif + + /** + * fdt_setprop_inplace - change a property's value, but not its size +@@ -1139,8 +1154,10 @@ int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings + */ ++#ifndef SWIG /* Not available in Python */ + int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, + const void *val, int len); ++#endif + + /** + * fdt_setprop_inplace_u32 - change the value of a 32-bit integer property +@@ -1297,6 +1314,22 @@ static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) + { + return fdt_property_u32(fdt, name, val); + } ++ ++/** ++ * fdt_property_placeholder - add a new property and return a ptr to its value ++ * ++ * @fdt: pointer to the device tree blob ++ * @name: name of property to add ++ * @len: length of property value in bytes ++ * @valp: returns a pointer to where where the value should be placed ++ * ++ * returns: ++ * 0, on success ++ * -FDT_ERR_BADMAGIC, ++ * -FDT_ERR_NOSPACE, standard meanings ++ */ ++int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp); ++ + #define fdt_property_string(fdt, name, str) \ + fdt_property(fdt, name, str, strlen(str)+1) + int fdt_end_node(void *fdt); +@@ -1527,6 +1560,36 @@ static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, + #define fdt_setprop_string(fdt, nodeoffset, name, str) \ + fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1) + ++ ++/** ++ * fdt_setprop_empty - set a property to an empty value ++ * @fdt: pointer to the device tree blob ++ * @nodeoffset: offset of the node whose property to change ++ * @name: name of the property to change ++ * ++ * fdt_setprop_empty() sets the value of the named property in the ++ * given node to an empty (zero length) value, or creates a new empty ++ * property if it does not already exist. ++ * ++ * This function may insert or delete data from the blob, and will ++ * therefore change the offsets of some existing nodes. ++ * ++ * returns: ++ * 0, on success ++ * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to ++ * contain the new property value ++ * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag ++ * -FDT_ERR_BADLAYOUT, ++ * -FDT_ERR_BADMAGIC, ++ * -FDT_ERR_BADVERSION, ++ * -FDT_ERR_BADSTATE, ++ * -FDT_ERR_BADSTRUCTURE, ++ * -FDT_ERR_BADLAYOUT, ++ * -FDT_ERR_TRUNCATED, standard meanings ++ */ ++#define fdt_setprop_empty(fdt, nodeoffset, name) \ ++ fdt_setprop((fdt), (nodeoffset), (name), NULL, 0) ++ + /** + * fdt_appendprop - append to or create a property + * @fdt: pointer to the device tree blob +@@ -1704,8 +1767,10 @@ static inline int fdt_appendprop_cell(void *fdt, int nodeoffset, + * creating subnodes based on a portion of a larger string, such as a + * full path. + */ ++#ifndef SWIG /* Not available in Python */ + int fdt_add_subnode_namelen(void *fdt, int parentoffset, + const char *name, int namelen); ++#endif + + /** + * fdt_add_subnode - creates a new node +diff --git a/scripts/dtc/libfdt/libfdt_env.h b/scripts/dtc/libfdt/libfdt_env.h +index 99f936d..952056c 100644 +--- a/scripts/dtc/libfdt/libfdt_env.h ++++ b/scripts/dtc/libfdt/libfdt_env.h +@@ -58,16 +58,16 @@ + #include + + #ifdef __CHECKER__ +-#define __force __attribute__((force)) +-#define __bitwise __attribute__((bitwise)) ++#define FDT_FORCE __attribute__((force)) ++#define FDT_BITWISE __attribute__((bitwise)) + #else +-#define __force +-#define __bitwise ++#define FDT_FORCE ++#define FDT_BITWISE + #endif + +-typedef uint16_t __bitwise fdt16_t; +-typedef uint32_t __bitwise fdt32_t; +-typedef uint64_t __bitwise fdt64_t; ++typedef uint16_t FDT_BITWISE fdt16_t; ++typedef uint32_t FDT_BITWISE fdt32_t; ++typedef uint64_t FDT_BITWISE fdt64_t; + + #define EXTRACT_BYTE(x, n) ((unsigned long long)((uint8_t *)&x)[n]) + #define CPU_TO_FDT16(x) ((EXTRACT_BYTE(x, 0) << 8) | EXTRACT_BYTE(x, 1)) +@@ -80,29 +80,29 @@ + + static inline uint16_t fdt16_to_cpu(fdt16_t x) + { +- return (__force uint16_t)CPU_TO_FDT16(x); ++ return (FDT_FORCE uint16_t)CPU_TO_FDT16(x); + } + static inline fdt16_t cpu_to_fdt16(uint16_t x) + { +- return (__force fdt16_t)CPU_TO_FDT16(x); ++ return (FDT_FORCE fdt16_t)CPU_TO_FDT16(x); + } + + static inline uint32_t fdt32_to_cpu(fdt32_t x) + { +- return (__force uint32_t)CPU_TO_FDT32(x); ++ return (FDT_FORCE uint32_t)CPU_TO_FDT32(x); + } + static inline fdt32_t cpu_to_fdt32(uint32_t x) + { +- return (__force fdt32_t)CPU_TO_FDT32(x); ++ return (FDT_FORCE fdt32_t)CPU_TO_FDT32(x); + } + + static inline uint64_t fdt64_to_cpu(fdt64_t x) + { +- return (__force uint64_t)CPU_TO_FDT64(x); ++ return (FDT_FORCE uint64_t)CPU_TO_FDT64(x); + } + static inline fdt64_t cpu_to_fdt64(uint64_t x) + { +- return (__force fdt64_t)CPU_TO_FDT64(x); ++ return (FDT_FORCE fdt64_t)CPU_TO_FDT64(x); + } + #undef CPU_TO_FDT64 + #undef CPU_TO_FDT32 +diff --git a/scripts/dtc/livetree.c b/scripts/dtc/livetree.c +index afa2f67..aecd278 100644 +--- a/scripts/dtc/livetree.c ++++ b/scripts/dtc/livetree.c +@@ -242,7 +242,7 @@ void delete_property_by_name(struct node *node, char *name) + struct property *prop = node->proplist; + + while (prop) { +- if (!strcmp(prop->name, name)) { ++ if (streq(prop->name, name)) { + delete_property(prop); + return; + } +@@ -275,7 +275,7 @@ void delete_node_by_name(struct node *parent, char *name) + struct node *node = parent->children; + + while (node) { +- if (!strcmp(node->name, name)) { ++ if (streq(node->name, name)) { + delete_node(node); + return; + } +@@ -319,8 +319,8 @@ struct reserve_info *build_reserve_entry(uint64_t address, uint64_t size) + + memset(new, 0, sizeof(*new)); + +- new->re.address = address; +- new->re.size = size; ++ new->address = address; ++ new->size = size; + + return new; + } +@@ -393,7 +393,7 @@ struct property *get_property(struct node *node, const char *propname) + cell_t propval_cell(struct property *prop) + { + assert(prop->val.len == sizeof(cell_t)); +- return fdt32_to_cpu(*((cell_t *)prop->val.val)); ++ return fdt32_to_cpu(*((fdt32_t *)prop->val.val)); + } + + struct property *get_property_by_label(struct node *tree, const char *label, +@@ -478,7 +478,8 @@ struct node *get_node_by_path(struct node *tree, const char *path) + p = strchr(path, '/'); + + for_each_child(tree, child) { +- if (p && strneq(path, child->name, p-path)) ++ if (p && (strlen(child->name) == p-path) && ++ strneq(path, child->name, p-path)) + return get_node_by_path(child, p+1); + else if (!p && streq(path, child->name)) + return child; +@@ -599,13 +600,13 @@ static int cmp_reserve_info(const void *ax, const void *bx) + a = *((const struct reserve_info * const *)ax); + b = *((const struct reserve_info * const *)bx); + +- if (a->re.address < b->re.address) ++ if (a->address < b->address) + return -1; +- else if (a->re.address > b->re.address) ++ else if (a->address > b->address) + return 1; +- else if (a->re.size < b->re.size) ++ else if (a->size < b->size) + return -1; +- else if (a->re.size > b->re.size) ++ else if (a->size > b->size) + return 1; + else + return 0; +@@ -847,6 +848,8 @@ static void add_fixup_entry(struct dt_info *dti, struct node *fn, + xasprintf(&entry, "%s:%s:%u", + node->fullpath, prop->name, m->offset); + append_to_property(fn, m->ref, entry, strlen(entry) + 1); ++ ++ free(entry); + } + + static void generate_fixups_tree_internal(struct dt_info *dti, +@@ -900,7 +903,7 @@ static void add_local_fixup_entry(struct dt_info *dti, + struct node *refnode) + { + struct node *wn, *nwn; /* local fixup node, walk node, new */ +- uint32_t value_32; ++ fdt32_t value_32; + char **compp; + int i, depth; + +diff --git a/scripts/dtc/srcpos.c b/scripts/dtc/srcpos.c +index aa3aad0..9d38459 100644 +--- a/scripts/dtc/srcpos.c ++++ b/scripts/dtc/srcpos.c +@@ -252,7 +252,7 @@ struct srcpos * + const char *fname = ""; + char *pos_str; + +- if (pos) ++ if (pos->file && pos->file->name) + fname = pos->file->name; + + +diff --git a/scripts/dtc/srcpos.h b/scripts/dtc/srcpos.h +index 2cdfcd8..7caca82 100644 +--- a/scripts/dtc/srcpos.h ++++ b/scripts/dtc/srcpos.h +@@ -22,6 +22,7 @@ + + #include + #include ++#include "util.h" + + struct srcfile_state { + FILE *f; +@@ -106,12 +107,10 @@ struct srcpos { + extern struct srcpos *srcpos_copy(struct srcpos *pos); + extern char *srcpos_string(struct srcpos *pos); + +-extern void srcpos_verror(struct srcpos *pos, const char *prefix, +- const char *fmt, va_list va) +- __attribute__((format(printf, 3, 0))); +-extern void srcpos_error(struct srcpos *pos, const char *prefix, +- const char *fmt, ...) +- __attribute__((format(printf, 3, 4))); ++extern void PRINTF(3, 0) srcpos_verror(struct srcpos *pos, const char *prefix, ++ const char *fmt, va_list va); ++extern void PRINTF(3, 4) srcpos_error(struct srcpos *pos, const char *prefix, ++ const char *fmt, ...); + + extern void srcpos_set_line(char *f, int l); + +diff --git a/scripts/dtc/treesource.c b/scripts/dtc/treesource.c +index c9d8967..2461a3d 100644 +--- a/scripts/dtc/treesource.c ++++ b/scripts/dtc/treesource.c +@@ -137,7 +137,7 @@ static void write_propval_string(FILE *f, struct data val) + static void write_propval_cells(FILE *f, struct data val) + { + void *propend = val.val + val.len; +- cell_t *cp = (cell_t *)val.val; ++ fdt32_t *cp = (fdt32_t *)val.val; + struct marker *m = val.markers; + + fprintf(f, "<"); +@@ -275,8 +275,8 @@ void dt_to_source(FILE *f, struct dt_info *dti) + for_each_label(re->labels, l) + fprintf(f, "%s: ", l->label); + fprintf(f, "/memreserve/\t0x%016llx 0x%016llx;\n", +- (unsigned long long)re->re.address, +- (unsigned long long)re->re.size); ++ (unsigned long long)re->address, ++ (unsigned long long)re->size); + } + + write_tree_source_node(f, dti->dt, 0); +diff --git a/scripts/dtc/util.c b/scripts/dtc/util.c +index 3550f86..9953c32 100644 +--- a/scripts/dtc/util.c ++++ b/scripts/dtc/util.c +@@ -396,7 +396,7 @@ void utilfdt_print_data(const char *data, int len) + } while (s < data + len); + + } else if ((len % 4) == 0) { +- const uint32_t *cell = (const uint32_t *)data; ++ const fdt32_t *cell = (const fdt32_t *)data; + + printf(" = <"); + for (i = 0, len /= 4; i < len; i++) +@@ -412,15 +412,16 @@ void utilfdt_print_data(const char *data, int len) + } + } + +-void util_version(void) ++void NORETURN util_version(void) + { + printf("Version: %s\n", DTC_VERSION); + exit(0); + } + +-void util_usage(const char *errmsg, const char *synopsis, +- const char *short_opts, struct option const long_opts[], +- const char * const opts_help[]) ++void NORETURN util_usage(const char *errmsg, const char *synopsis, ++ const char *short_opts, ++ struct option const long_opts[], ++ const char * const opts_help[]) + { + FILE *fp = errmsg ? stderr : stdout; + const char a_arg[] = ""; +diff --git a/scripts/dtc/util.h b/scripts/dtc/util.h +index f5c4f1b..ad5f411 100644 +--- a/scripts/dtc/util.h ++++ b/scripts/dtc/util.h +@@ -25,9 +25,17 @@ + * USA + */ + ++#ifdef __GNUC__ ++#define PRINTF(i, j) __attribute__((format (printf, i, j))) ++#define NORETURN __attribute__((noreturn)) ++#else ++#define PRINTF(i, j) ++#define NORETURN ++#endif ++ + #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + +-static inline void __attribute__((noreturn)) die(const char *str, ...) ++static inline void NORETURN PRINTF(1, 2) die(const char *str, ...) + { + va_list ap; + +@@ -53,13 +61,14 @@ static inline void *xrealloc(void *p, size_t len) + void *new = realloc(p, len); + + if (!new) +- die("realloc() failed (len=%d)\n", len); ++ die("realloc() failed (len=%zd)\n", len); + + return new; + } + + extern char *xstrdup(const char *s); +-extern int xasprintf(char **strp, const char *fmt, ...); ++ ++extern int PRINTF(2, 3) xasprintf(char **strp, const char *fmt, ...); + extern char *join_path(const char *path, const char *name); + + /** +@@ -188,7 +197,7 @@ static inline void *xrealloc(void *p, size_t len) + /** + * Show source version and exit + */ +-void util_version(void) __attribute__((noreturn)); ++void NORETURN util_version(void); + + /** + * Show usage and exit +@@ -202,9 +211,10 @@ static inline void *xrealloc(void *p, size_t len) + * @param long_opts The structure of long options + * @param opts_help An array of help strings (should align with long_opts) + */ +-void util_usage(const char *errmsg, const char *synopsis, +- const char *short_opts, struct option const long_opts[], +- const char * const opts_help[]) __attribute__((noreturn)); ++void NORETURN util_usage(const char *errmsg, const char *synopsis, ++ const char *short_opts, ++ struct option const long_opts[], ++ const char * const opts_help[]); + + /** + * Show usage and exit +diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h +index 16c2e53..74a2ffc 100644 +--- a/scripts/dtc/version_gen.h ++++ b/scripts/dtc/version_gen.h +@@ -1 +1 @@ +-#define DTC_VERSION "DTC 1.4.2-g0931cea3" ++#define DTC_VERSION "DTC 1.4.4-ga10cb3c8" +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index ddf83d0..a0fb9e3 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -275,7 +275,11 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \ + + # DTC + # --------------------------------------------------------------------------- ++ifeq ($(CONFIG_OF_CONFIGFS),y) ++DTC ?= $(objtree)/scripts/dtc/dtc -@ ++else + DTC ?= $(objtree)/scripts/dtc/dtc ++endif + + # Generate an assembly file to wrap the output of the device tree compiler + quiet_cmd_dt_S_dtb= DTB $@ diff --git a/patch/kernel/sun8i-dev/scripts-dtc-Update-to-version-with-overlays.patch.disabled b/patch/kernel/sun8i-dev/scripts-dtc-Update-to-version-with-overlays.patch.disabled deleted file mode 100644 index cb50f5a47..000000000 --- a/patch/kernel/sun8i-dev/scripts-dtc-Update-to-version-with-overlays.patch.disabled +++ /dev/null @@ -1,4908 +0,0 @@ -diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c -index 0c03ac9..65bf6fd 100644 ---- a/scripts/dtc/checks.c -+++ b/scripts/dtc/checks.c -@@ -466,8 +466,12 @@ static void fixup_phandle_references(struct check *c, struct node *dt, - - refnode = get_node_by_ref(dt, m->ref); - if (! refnode) { -- FAIL(c, "Reference to non-existent node or label \"%s\"\n", -- m->ref); -+ if (!source_is_plugin) -+ FAIL(c, "Reference to non-existent node or " -+ "label \"%s\"\n", m->ref); -+ else /* mark the entry as unresolved */ -+ *((cell_t *)(prop->val.val + m->offset)) = -+ cpu_to_fdt32(0xffffffff); - continue; - } - -@@ -652,6 +656,15 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c, - } - TREE_WARNING(obsolete_chosen_interrupt_controller, NULL); - -+static void check_deprecated_plugin_syntax(struct check *c, -+ struct node *dt) -+{ -+ if (deprecated_plugin_syntax_warning) -+ FAIL(c, "Use '/dts-v1/ /plugin/'; syntax. /dts-v1/; /plugin/; " -+ "is going to be removed in next versions"); -+} -+TREE_WARNING(deprecated_plugin_syntax, NULL); -+ - static struct check *check_table[] = { - &duplicate_node_names, &duplicate_property_names, - &node_name_chars, &node_name_format, &property_name_chars, -@@ -669,6 +682,7 @@ static struct check *check_table[] = { - - &avoid_default_addr_size, - &obsolete_chosen_interrupt_controller, -+ &deprecated_plugin_syntax, - - &always_fail, - }; -diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l -index 790fbf6..dd44ba2 100644 ---- a/scripts/dtc/dtc-lexer.l -+++ b/scripts/dtc/dtc-lexer.l -@@ -73,32 +73,24 @@ static void lexical_error(const char *fmt, ...); - } - - <*>^"#"(line)?[ \t]+[0-9]+[ \t]+{STRING}([ \t]+[0-9]+)? { -- char *line, *fnstart, *fnend; -- struct data fn; -+ char *line, *tmp, *fn; - /* skip text before line # */ - line = yytext; - while (!isdigit((unsigned char)*line)) - line++; -- -- /* regexp ensures that first and list " -- * in the whole yytext are those at -- * beginning and end of the filename string */ -- fnstart = memchr(yytext, '"', yyleng); -- for (fnend = yytext + yyleng - 1; -- *fnend != '"'; fnend--) -- ; -- assert(fnstart && fnend && (fnend > fnstart)); -- -- fn = data_copy_escape_string(fnstart + 1, -- fnend - fnstart - 1); -- -- /* Don't allow nuls in filenames */ -- if (memchr(fn.val, '\0', fn.len - 1)) -- lexical_error("nul in line number directive"); -- -+ /* skip digits in line # */ -+ tmp = line; -+ while (!isspace((unsigned char)*tmp)) -+ tmp++; -+ /* "NULL"-terminate line # */ -+ *tmp = '\0'; -+ /* start of filename */ -+ fn = strchr(tmp + 1, '"') + 1; -+ /* strip trailing " from filename */ -+ tmp = strchr(fn, '"'); -+ *tmp = 0; - /* -1 since #line is the number of the next line */ -- srcpos_set_line(xstrdup(fn.val), atoi(line) - 1); -- data_free(fn); -+ srcpos_set_line(xstrdup(fn), atoi(line) - 1); - } - - <*><> { -@@ -121,6 +113,11 @@ static void lexical_error(const char *fmt, ...); - return DT_V1; - } - -+<*>"/plugin/" { -+ DPRINT("Keyword: /plugin/\n"); -+ return DT_PLUGIN; -+ } -+ - <*>"/memreserve/" { - DPRINT("Keyword: /memreserve/\n"); - BEGIN_DEFAULT(); -@@ -161,10 +158,7 @@ static void lexical_error(const char *fmt, ...); - errno = 0; - yylval.integer = strtoull(yytext, &e, 0); - -- if (*e && e[strspn(e, "UL")]) { -- lexical_error("Bad integer literal '%s'", -- yytext); -- } -+ assert(!(*e) || !e[strspn(e, "UL")]); - - if (errno == ERANGE) - lexical_error("Integer literal '%s' out of range", -diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped -index ba525c2..1518525 100644 ---- a/scripts/dtc/dtc-lexer.lex.c_shipped -+++ b/scripts/dtc/dtc-lexer.lex.c_shipped -@@ -9,7 +9,7 @@ - #define FLEX_SCANNER - #define YY_FLEX_MAJOR_VERSION 2 - #define YY_FLEX_MINOR_VERSION 5 --#define YY_FLEX_SUBMINOR_VERSION 39 -+#define YY_FLEX_SUBMINOR_VERSION 35 - #if YY_FLEX_SUBMINOR_VERSION > 0 - #define FLEX_BETA - #endif -@@ -162,12 +162,7 @@ typedef unsigned int flex_uint32_t; - typedef struct yy_buffer_state *YY_BUFFER_STATE; - #endif - --#ifndef YY_TYPEDEF_YY_SIZE_T --#define YY_TYPEDEF_YY_SIZE_T --typedef size_t yy_size_t; --#endif -- --extern yy_size_t yyleng; -+extern int yyleng; - - extern FILE *yyin, *yyout; - -@@ -176,7 +171,6 @@ extern FILE *yyin, *yyout; - #define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) -- #define YY_LINENO_REWIND_TO(ptr) - - /* Return all but the first "n" matched characters back to the input stream. */ - #define yyless(n) \ -@@ -194,6 +188,11 @@ extern FILE *yyin, *yyout; - - #define unput(c) yyunput( c, (yytext_ptr) ) - -+#ifndef YY_TYPEDEF_YY_SIZE_T -+#define YY_TYPEDEF_YY_SIZE_T -+typedef size_t yy_size_t; -+#endif -+ - #ifndef YY_STRUCT_YY_BUFFER_STATE - #define YY_STRUCT_YY_BUFFER_STATE - struct yy_buffer_state -@@ -211,7 +210,7 @@ struct yy_buffer_state - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ -- yy_size_t yy_n_chars; -+ int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to -@@ -281,8 +280,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - - /* yy_hold_char holds the character lost when yytext is formed. */ - static char yy_hold_char; --static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ --yy_size_t yyleng; -+static int yy_n_chars; /* number of characters read into yy_ch_buf */ -+int yyleng; - - /* Points to current character in buffer. */ - static char *yy_c_buf_p = (char *) 0; -@@ -310,7 +309,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - - YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); - YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); --YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); -+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); - - void *yyalloc (yy_size_t ); - void *yyrealloc (void *,yy_size_t ); -@@ -342,7 +341,7 @@ void yyfree (void * ); - - /* Begin user sect3 */ - --#define yywrap() 1 -+#define yywrap(n) 1 - #define YY_SKIP_YYWRAP - - typedef unsigned char YY_CHAR; -@@ -373,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] ); - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - --#define YY_NUM_RULES 30 --#define YY_END_OF_BUFFER 31 -+#define YY_NUM_RULES 31 -+#define YY_END_OF_BUFFER 32 - /* This struct is not used in this scanner, - but its presence is necessary. */ - struct yy_trans_info -@@ -382,25 +381,26 @@ struct yy_trans_info - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; --static yyconst flex_int16_t yy_accept[159] = -+static yyconst flex_int16_t yy_accept[166] = - { 0, -- 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, -- 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, -- 29, 29, 29, 29, 29, 29, 15, 16, 16, 29, -- 16, 10, 10, 18, 26, 0, 3, 0, 27, 12, -- 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, -- 21, 23, 25, 24, 22, 0, 9, 28, 0, 0, -- 0, 14, 14, 16, 16, 16, 10, 10, 10, 0, -- 12, 0, 11, 0, 0, 0, 20, 0, 0, 0, -- 0, 0, 0, 0, 0, 16, 10, 10, 10, 0, -- 13, 19, 0, 0, 0, 0, 0, 0, 0, 0, -- -- 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, -- 0, 16, 6, 0, 0, 0, 0, 0, 0, 2, -- 0, 0, 0, 0, 0, 0, 0, 0, 4, 17, -- 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, -- 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -- 5, 8, 0, 0, 0, 0, 7, 0 -+ 0, 0, 0, 0, 0, 0, 0, 0, 32, 30, -+ 19, 19, 30, 30, 30, 30, 30, 30, 30, 30, -+ 30, 30, 30, 30, 30, 30, 16, 17, 17, 30, -+ 17, 11, 11, 19, 27, 0, 3, 0, 28, 13, -+ 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, -+ 0, 22, 24, 26, 25, 23, 0, 10, 29, 0, -+ 0, 0, 15, 15, 17, 17, 17, 11, 11, 11, -+ 0, 13, 0, 12, 0, 0, 0, 21, 0, 0, -+ 0, 0, 0, 0, 0, 0, 0, 17, 11, 11, -+ 11, 0, 14, 20, 0, 0, 0, 0, 0, 0, -+ -+ 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, -+ 0, 0, 0, 0, 0, 17, 7, 0, 0, 0, -+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, -+ 0, 0, 0, 0, 4, 18, 0, 0, 5, 2, -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -+ 0, 0, 1, 0, 0, 0, 0, 6, 9, 0, -+ 0, 0, 0, 8, 0 - } ; - - static yyconst flex_int32_t yy_ec[256] = -@@ -416,9 +416,9 @@ static yyconst flex_int32_t yy_ec[256] = - 22, 22, 22, 22, 24, 22, 22, 25, 22, 22, - 1, 26, 27, 1, 22, 1, 21, 28, 29, 30, - -- 31, 21, 22, 22, 32, 22, 22, 33, 34, 35, -- 36, 37, 22, 38, 39, 40, 41, 42, 22, 25, -- 43, 22, 44, 45, 46, 1, 1, 1, 1, 1, -+ 31, 21, 32, 22, 33, 22, 22, 34, 35, 36, -+ 37, 38, 22, 39, 40, 41, 42, 43, 22, 25, -+ 44, 22, 45, 46, 47, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -@@ -435,163 +435,165 @@ static yyconst flex_int32_t yy_ec[256] = - 1, 1, 1, 1, 1 - } ; - --static yyconst flex_int32_t yy_meta[47] = -+static yyconst flex_int32_t yy_meta[48] = - { 0, - 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, - 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, - 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, - 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, -- 8, 8, 8, 3, 1, 4 -+ 8, 8, 8, 8, 3, 1, 4 - } ; - --static yyconst flex_int16_t yy_base[173] = -+static yyconst flex_int16_t yy_base[180] = - { 0, -- 0, 383, 34, 382, 65, 381, 37, 105, 387, 391, -- 54, 111, 367, 110, 109, 109, 112, 41, 366, 104, -- 367, 338, 124, 117, 0, 144, 391, 0, 121, 0, -- 135, 155, 140, 179, 391, 160, 391, 379, 391, 0, -- 368, 141, 391, 167, 370, 376, 346, 103, 342, 345, -- 391, 391, 391, 391, 391, 358, 391, 391, 175, 342, -- 338, 391, 355, 0, 185, 339, 184, 347, 346, 0, -- 0, 322, 175, 357, 175, 363, 352, 324, 330, 323, -- 332, 326, 201, 324, 329, 322, 391, 333, 181, 309, -- 391, 341, 340, 313, 320, 338, 178, 311, 146, 317, -- -- 314, 315, 335, 331, 303, 300, 309, 299, 308, 188, -- 336, 335, 391, 305, 320, 281, 283, 271, 203, 288, -- 281, 271, 266, 264, 245, 242, 208, 104, 391, 391, -- 244, 218, 204, 219, 206, 224, 201, 212, 204, 229, -- 215, 208, 207, 200, 219, 391, 233, 221, 200, 181, -- 391, 391, 149, 122, 86, 41, 391, 391, 245, 251, -- 259, 263, 267, 273, 280, 284, 292, 300, 304, 310, -- 318, 326 -+ 0, 393, 35, 392, 66, 391, 38, 107, 397, 401, -+ 55, 113, 377, 112, 111, 111, 114, 42, 376, 106, -+ 377, 347, 126, 120, 0, 147, 401, 0, 124, 0, -+ 137, 158, 170, 163, 401, 153, 401, 389, 401, 0, -+ 378, 120, 401, 131, 380, 386, 355, 139, 351, 355, -+ 351, 401, 401, 401, 401, 401, 367, 401, 401, 185, -+ 350, 346, 401, 364, 0, 185, 347, 189, 356, 355, -+ 0, 0, 330, 180, 366, 141, 372, 361, 332, 338, -+ 331, 341, 334, 326, 205, 331, 337, 329, 401, 341, -+ 167, 316, 401, 349, 348, 320, 328, 346, 180, 318, -+ -+ 324, 209, 324, 320, 322, 342, 338, 309, 306, 315, -+ 305, 315, 312, 192, 342, 341, 401, 293, 306, 282, -+ 268, 252, 255, 203, 285, 282, 272, 268, 252, 233, -+ 232, 239, 208, 107, 401, 401, 238, 211, 401, 211, -+ 212, 208, 228, 203, 215, 207, 233, 222, 212, 211, -+ 203, 227, 401, 237, 225, 204, 185, 401, 401, 149, -+ 128, 88, 42, 401, 401, 253, 259, 267, 271, 275, -+ 281, 288, 292, 300, 308, 312, 318, 326, 334 - } ; - --static yyconst flex_int16_t yy_def[173] = -+static yyconst flex_int16_t yy_def[180] = - { 0, -- 158, 1, 1, 3, 158, 5, 1, 1, 158, 158, -- 158, 158, 158, 159, 160, 161, 158, 158, 158, 158, -- 162, 158, 158, 158, 163, 162, 158, 164, 165, 164, -- 164, 158, 158, 158, 158, 159, 158, 159, 158, 166, -- 158, 161, 158, 161, 167, 168, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 162, 158, 158, 158, 158, -- 158, 158, 162, 164, 165, 164, 158, 158, 158, 169, -- 166, 170, 161, 167, 167, 168, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 164, 158, 158, 169, 170, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- -- 158, 164, 158, 158, 158, 158, 158, 158, 158, 171, -- 158, 164, 158, 158, 158, 158, 158, 158, 171, 158, -- 171, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 172, 158, 158, 158, 172, 158, 172, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 0, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158 -+ 165, 1, 1, 3, 165, 5, 1, 1, 165, 165, -+ 165, 165, 165, 166, 167, 168, 165, 165, 165, 165, -+ 169, 165, 165, 165, 170, 169, 165, 171, 172, 171, -+ 171, 165, 165, 165, 165, 166, 165, 166, 165, 173, -+ 165, 168, 165, 168, 174, 175, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 169, 165, 165, 165, -+ 165, 165, 165, 169, 171, 172, 171, 165, 165, 165, -+ 176, 173, 177, 168, 174, 174, 175, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 171, 165, 165, -+ 176, 177, 165, 165, 165, 165, 165, 165, 165, 165, -+ -+ 165, 165, 165, 165, 171, 165, 165, 165, 165, 165, -+ 165, 165, 165, 178, 165, 171, 165, 165, 165, 165, -+ 165, 165, 165, 178, 165, 178, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 179, 165, 165, -+ 165, 179, 165, 179, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 0, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165 - } ; - --static yyconst flex_int16_t yy_nxt[438] = -+static yyconst flex_int16_t yy_nxt[449] = - { 0, - 10, 11, 12, 11, 13, 14, 10, 15, 16, 10, - 10, 10, 17, 10, 10, 10, 10, 18, 19, 20, - 21, 21, 21, 21, 21, 10, 10, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -- 21, 21, 21, 10, 22, 10, 24, 25, 25, 25, -- 32, 33, 33, 157, 26, 34, 34, 34, 51, 52, -- 27, 26, 26, 26, 26, 10, 11, 12, 11, 13, -- 14, 28, 15, 16, 28, 28, 28, 24, 28, 28, -- 28, 10, 18, 19, 20, 29, 29, 29, 29, 29, -- 30, 10, 29, 29, 29, 29, 29, 29, 29, 29, -- -- 29, 29, 29, 29, 29, 29, 29, 29, 10, 22, -- 10, 23, 34, 34, 34, 37, 39, 43, 32, 33, -- 33, 45, 54, 55, 46, 59, 45, 64, 156, 46, -- 64, 64, 64, 79, 44, 38, 59, 57, 134, 47, -- 135, 48, 80, 49, 47, 50, 48, 99, 61, 43, -- 50, 110, 41, 67, 67, 67, 60, 63, 63, 63, -- 57, 155, 68, 69, 63, 37, 44, 66, 67, 67, -- 67, 63, 63, 63, 63, 73, 59, 68, 69, 70, -- 34, 34, 34, 43, 75, 38, 154, 92, 83, 83, -- 83, 64, 44, 120, 64, 64, 64, 67, 67, 67, -- -- 44, 57, 99, 68, 69, 107, 68, 69, 120, 127, -- 108, 153, 152, 121, 83, 83, 83, 133, 133, 133, -- 146, 133, 133, 133, 146, 140, 140, 140, 121, 141, -- 140, 140, 140, 151, 141, 158, 150, 149, 148, 144, -- 147, 143, 142, 139, 147, 36, 36, 36, 36, 36, -- 36, 36, 36, 40, 138, 137, 136, 40, 40, 42, -- 42, 42, 42, 42, 42, 42, 42, 56, 56, 56, -- 56, 62, 132, 62, 64, 131, 130, 64, 129, 64, -- 64, 65, 128, 158, 65, 65, 65, 65, 71, 127, -- 71, 71, 74, 74, 74, 74, 74, 74, 74, 74, -- -- 76, 76, 76, 76, 76, 76, 76, 76, 89, 126, -- 89, 90, 125, 90, 90, 124, 90, 90, 119, 119, -- 119, 119, 119, 119, 119, 119, 145, 145, 145, 145, -- 145, 145, 145, 145, 123, 122, 59, 59, 118, 117, -- 116, 115, 114, 113, 45, 112, 108, 111, 109, 106, -- 105, 104, 46, 103, 91, 87, 102, 101, 100, 98, -- 97, 96, 95, 94, 93, 77, 75, 91, 88, 87, -- 86, 57, 85, 84, 57, 82, 81, 78, 77, 75, -- 72, 158, 58, 57, 53, 35, 158, 31, 23, 23, -- 9, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158 -+ 21, 21, 21, 21, 10, 22, 10, 24, 25, 25, -+ 25, 32, 33, 33, 164, 26, 34, 34, 34, 52, -+ 53, 27, 26, 26, 26, 26, 10, 11, 12, 11, -+ 13, 14, 28, 15, 16, 28, 28, 28, 24, 28, -+ 28, 28, 10, 18, 19, 20, 29, 29, 29, 29, -+ 29, 30, 10, 29, 29, 29, 29, 29, 29, 29, -+ -+ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -+ 10, 22, 10, 23, 34, 34, 34, 37, 39, 43, -+ 32, 33, 33, 45, 55, 56, 46, 60, 43, 45, -+ 65, 163, 46, 65, 65, 65, 44, 38, 60, 74, -+ 58, 47, 141, 48, 142, 44, 49, 47, 50, 48, -+ 76, 51, 62, 94, 50, 41, 44, 51, 37, 61, -+ 64, 64, 64, 58, 34, 34, 34, 64, 162, 80, -+ 67, 68, 68, 68, 64, 64, 64, 64, 38, 81, -+ 69, 70, 71, 68, 68, 68, 60, 161, 43, 69, -+ 70, 65, 69, 70, 65, 65, 65, 125, 85, 85, -+ -+ 85, 58, 68, 68, 68, 44, 102, 110, 125, 133, -+ 102, 69, 70, 111, 114, 160, 159, 126, 85, 85, -+ 85, 140, 140, 140, 140, 140, 140, 153, 126, 147, -+ 147, 147, 153, 148, 147, 147, 147, 158, 148, 165, -+ 157, 156, 155, 151, 150, 149, 146, 154, 145, 144, -+ 143, 139, 154, 36, 36, 36, 36, 36, 36, 36, -+ 36, 40, 138, 137, 136, 40, 40, 42, 42, 42, -+ 42, 42, 42, 42, 42, 57, 57, 57, 57, 63, -+ 135, 63, 65, 134, 165, 65, 133, 65, 65, 66, -+ 132, 131, 66, 66, 66, 66, 72, 130, 72, 72, -+ -+ 75, 75, 75, 75, 75, 75, 75, 75, 77, 77, -+ 77, 77, 77, 77, 77, 77, 91, 129, 91, 92, -+ 128, 92, 92, 127, 92, 92, 124, 124, 124, 124, -+ 124, 124, 124, 124, 152, 152, 152, 152, 152, 152, -+ 152, 152, 60, 60, 123, 122, 121, 120, 119, 118, -+ 117, 45, 116, 111, 115, 113, 112, 109, 108, 107, -+ 46, 106, 93, 89, 105, 104, 103, 101, 100, 99, -+ 98, 97, 96, 95, 78, 76, 93, 90, 89, 88, -+ 58, 87, 86, 58, 84, 83, 82, 79, 78, 76, -+ 73, 165, 59, 58, 54, 35, 165, 31, 23, 23, -+ -+ 9, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165 - } ; - --static yyconst flex_int16_t yy_chk[438] = -+static yyconst flex_int16_t yy_chk[449] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -- 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, -- 7, 7, 7, 156, 3, 11, 11, 11, 18, 18, -- 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, -+ 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, -+ 3, 7, 7, 7, 163, 3, 11, 11, 11, 18, -+ 18, 3, 3, 3, 3, 3, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -- 5, 8, 12, 12, 12, 14, 15, 16, 8, 8, -- 8, 17, 20, 20, 17, 23, 24, 29, 155, 24, -- 29, 29, 29, 48, 16, 14, 31, 29, 128, 17, -- 128, 17, 48, 17, 24, 17, 24, 99, 24, 42, -- 24, 99, 15, 33, 33, 33, 23, 26, 26, 26, -- 26, 154, 33, 33, 26, 36, 42, 31, 32, 32, -- 32, 26, 26, 26, 26, 44, 59, 32, 32, 32, -- 34, 34, 34, 73, 75, 36, 153, 75, 59, 59, -- 59, 65, 44, 110, 65, 65, 65, 67, 67, 67, -- -- 73, 65, 83, 89, 89, 97, 67, 67, 119, 127, -- 97, 150, 149, 110, 83, 83, 83, 133, 133, 133, -- 141, 127, 127, 127, 145, 136, 136, 136, 119, 136, -- 140, 140, 140, 148, 140, 147, 144, 143, 142, 139, -- 141, 138, 137, 135, 145, 159, 159, 159, 159, 159, -- 159, 159, 159, 160, 134, 132, 131, 160, 160, 161, -- 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, -- 162, 163, 126, 163, 164, 125, 124, 164, 123, 164, -- 164, 165, 122, 121, 165, 165, 165, 165, 166, 120, -- 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, -- -- 168, 168, 168, 168, 168, 168, 168, 168, 169, 118, -- 169, 170, 117, 170, 170, 116, 170, 170, 171, 171, -- 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, -- 172, 172, 172, 172, 115, 114, 112, 111, 109, 108, -- 107, 106, 105, 104, 103, 102, 101, 100, 98, 96, -- 95, 94, 93, 92, 90, 88, 86, 85, 84, 82, -- 81, 80, 79, 78, 77, 76, 74, 72, 69, 68, -- 66, 63, 61, 60, 56, 50, 49, 47, 46, 45, -+ 5, 5, 5, 8, 12, 12, 12, 14, 15, 16, -+ 8, 8, 8, 17, 20, 20, 17, 23, 42, 24, -+ 29, 162, 24, 29, 29, 29, 16, 14, 31, 44, -+ 29, 17, 134, 17, 134, 42, 17, 24, 17, 24, -+ 76, 17, 24, 76, 24, 15, 44, 24, 36, 23, -+ 26, 26, 26, 26, 34, 34, 34, 26, 161, 48, -+ 31, 32, 32, 32, 26, 26, 26, 26, 36, 48, -+ 32, 32, 32, 33, 33, 33, 60, 160, 74, 91, -+ 91, 66, 33, 33, 66, 66, 66, 114, 60, 60, -+ -+ 60, 66, 68, 68, 68, 74, 85, 99, 124, 133, -+ 102, 68, 68, 99, 102, 157, 156, 114, 85, 85, -+ 85, 133, 133, 133, 140, 140, 140, 148, 124, 143, -+ 143, 143, 152, 143, 147, 147, 147, 155, 147, 154, -+ 151, 150, 149, 146, 145, 144, 142, 148, 141, 138, -+ 137, 132, 152, 166, 166, 166, 166, 166, 166, 166, -+ 166, 167, 131, 130, 129, 167, 167, 168, 168, 168, -+ 168, 168, 168, 168, 168, 169, 169, 169, 169, 170, -+ 128, 170, 171, 127, 126, 171, 125, 171, 171, 172, -+ 123, 122, 172, 172, 172, 172, 173, 121, 173, 173, -+ -+ 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, -+ 175, 175, 175, 175, 175, 175, 176, 120, 176, 177, -+ 119, 177, 177, 118, 177, 177, 178, 178, 178, 178, -+ 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, -+ 179, 179, 116, 115, 113, 112, 111, 110, 109, 108, -+ 107, 106, 105, 104, 103, 101, 100, 98, 97, 96, -+ 95, 94, 92, 90, 88, 87, 86, 84, 83, 82, -+ 81, 80, 79, 78, 77, 75, 73, 70, 69, 67, -+ 64, 62, 61, 57, 51, 50, 49, 47, 46, 45, - 41, 38, 22, 21, 19, 13, 9, 6, 4, 2, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, - -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, -- 158, 158, 158, 158, 158, 158, 158 -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -+ 165, 165, 165, 165, 165, 165, 165, 165 - } ; - - static yy_state_type yy_last_accepting_state; -@@ -662,7 +664,7 @@ static int dts_version = 1; - static void push_input_file(const char *filename); - static bool pop_input_file(void); - static void lexical_error(const char *fmt, ...); --#line 666 "dtc-lexer.lex.c" -+#line 668 "dtc-lexer.lex.c" - - #define INITIAL 0 - #define BYTESTRING 1 -@@ -704,7 +706,7 @@ FILE *yyget_out (void ); - - void yyset_out (FILE * out_str ); - --yy_size_t yyget_leng (void ); -+int yyget_leng (void ); - - char *yyget_text (void ); - -@@ -853,6 +855,10 @@ YY_DECL - register char *yy_cp, *yy_bp; - register int yy_act; - -+#line 68 "dtc-lexer.l" -+ -+#line 861 "dtc-lexer.lex.c" -+ - if ( !(yy_init) ) - { - (yy_init) = 1; -@@ -879,11 +885,6 @@ YY_DECL - yy_load_buffer_state( ); - } - -- { --#line 68 "dtc-lexer.l" -- --#line 886 "dtc-lexer.lex.c" -- - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); -@@ -901,7 +902,7 @@ YY_DECL - yy_match: - do - { -- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; -+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; -@@ -910,13 +911,13 @@ yy_match: - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } -- while ( yy_current_state != 158 ); -+ while ( yy_current_state != 165 ); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - -@@ -951,39 +952,31 @@ case 2: - YY_RULE_SETUP - #line 75 "dtc-lexer.l" - { -- char *line, *fnstart, *fnend; -- struct data fn; -+ char *line, *tmp, *fn; - /* skip text before line # */ - line = yytext; - while (!isdigit((unsigned char)*line)) - line++; -- -- /* regexp ensures that first and list " -- * in the whole yytext are those at -- * beginning and end of the filename string */ -- fnstart = memchr(yytext, '"', yyleng); -- for (fnend = yytext + yyleng - 1; -- *fnend != '"'; fnend--) -- ; -- assert(fnstart && fnend && (fnend > fnstart)); -- -- fn = data_copy_escape_string(fnstart + 1, -- fnend - fnstart - 1); -- -- /* Don't allow nuls in filenames */ -- if (memchr(fn.val, '\0', fn.len - 1)) -- lexical_error("nul in line number directive"); -- -+ /* skip digits in line # */ -+ tmp = line; -+ while (!isspace((unsigned char)*tmp)) -+ tmp++; -+ /* "NULL"-terminate line # */ -+ *tmp = '\0'; -+ /* start of filename */ -+ fn = strchr(tmp + 1, '"') + 1; -+ /* strip trailing " from filename */ -+ tmp = strchr(fn, '"'); -+ *tmp = 0; - /* -1 since #line is the number of the next line */ -- srcpos_set_line(xstrdup(fn.val), atoi(line) - 1); -- data_free(fn); -+ srcpos_set_line(xstrdup(fn), atoi(line) - 1); - } - YY_BREAK - case YY_STATE_EOF(INITIAL): - case YY_STATE_EOF(BYTESTRING): - case YY_STATE_EOF(PROPNODENAME): - case YY_STATE_EOF(V1): --#line 104 "dtc-lexer.l" -+#line 96 "dtc-lexer.l" - { - if (!pop_input_file()) { - yyterminate(); -@@ -993,7 +986,7 @@ case YY_STATE_EOF(V1): - case 3: - /* rule 3 can match eol */ - YY_RULE_SETUP --#line 110 "dtc-lexer.l" -+#line 102 "dtc-lexer.l" - { - DPRINT("String: %s\n", yytext); - yylval.data = data_copy_escape_string(yytext+1, -@@ -1003,7 +996,7 @@ YY_RULE_SETUP - YY_BREAK - case 4: - YY_RULE_SETUP --#line 117 "dtc-lexer.l" -+#line 109 "dtc-lexer.l" - { - DPRINT("Keyword: /dts-v1/\n"); - dts_version = 1; -@@ -1013,25 +1006,33 @@ YY_RULE_SETUP - YY_BREAK - case 5: - YY_RULE_SETUP --#line 124 "dtc-lexer.l" -+#line 116 "dtc-lexer.l" -+{ -+ DPRINT("Keyword: /plugin/\n"); -+ return DT_PLUGIN; -+ } -+ YY_BREAK -+case 6: -+YY_RULE_SETUP -+#line 121 "dtc-lexer.l" - { - DPRINT("Keyword: /memreserve/\n"); - BEGIN_DEFAULT(); - return DT_MEMRESERVE; - } - YY_BREAK --case 6: -+case 7: - YY_RULE_SETUP --#line 130 "dtc-lexer.l" -+#line 127 "dtc-lexer.l" - { - DPRINT("Keyword: /bits/\n"); - BEGIN_DEFAULT(); - return DT_BITS; - } - YY_BREAK --case 7: -+case 8: - YY_RULE_SETUP --#line 136 "dtc-lexer.l" -+#line 133 "dtc-lexer.l" - { - DPRINT("Keyword: /delete-property/\n"); - DPRINT("\n"); -@@ -1039,9 +1040,9 @@ YY_RULE_SETUP - return DT_DEL_PROP; - } - YY_BREAK --case 8: -+case 9: - YY_RULE_SETUP --#line 143 "dtc-lexer.l" -+#line 140 "dtc-lexer.l" - { - DPRINT("Keyword: /delete-node/\n"); - DPRINT("\n"); -@@ -1049,9 +1050,9 @@ YY_RULE_SETUP - return DT_DEL_NODE; - } - YY_BREAK --case 9: -+case 10: - YY_RULE_SETUP --#line 150 "dtc-lexer.l" -+#line 147 "dtc-lexer.l" - { - DPRINT("Label: %s\n", yytext); - yylval.labelref = xstrdup(yytext); -@@ -1059,9 +1060,9 @@ YY_RULE_SETUP - return DT_LABEL; - } - YY_BREAK --case 10: -+case 11: - YY_RULE_SETUP --#line 157 "dtc-lexer.l" -+#line 154 "dtc-lexer.l" - { - char *e; - DPRINT("Integer Literal: '%s'\n", yytext); -@@ -1069,10 +1070,7 @@ YY_RULE_SETUP - errno = 0; - yylval.integer = strtoull(yytext, &e, 0); - -- if (*e && e[strspn(e, "UL")]) { -- lexical_error("Bad integer literal '%s'", -- yytext); -- } -+ assert(!(*e) || !e[strspn(e, "UL")]); - - if (errno == ERANGE) - lexical_error("Integer literal '%s' out of range", -@@ -1084,10 +1082,10 @@ YY_RULE_SETUP - return DT_LITERAL; - } - YY_BREAK --case 11: --/* rule 11 can match eol */ -+case 12: -+/* rule 12 can match eol */ - YY_RULE_SETUP --#line 179 "dtc-lexer.l" -+#line 173 "dtc-lexer.l" - { - struct data d; - DPRINT("Character literal: %s\n", yytext); -@@ -1109,18 +1107,18 @@ YY_RULE_SETUP - return DT_CHAR_LITERAL; - } - YY_BREAK --case 12: -+case 13: - YY_RULE_SETUP --#line 200 "dtc-lexer.l" -+#line 194 "dtc-lexer.l" - { /* label reference */ - DPRINT("Ref: %s\n", yytext+1); - yylval.labelref = xstrdup(yytext+1); - return DT_REF; - } - YY_BREAK --case 13: -+case 14: - YY_RULE_SETUP --#line 206 "dtc-lexer.l" -+#line 200 "dtc-lexer.l" - { /* new-style path reference */ - yytext[yyleng-1] = '\0'; - DPRINT("Ref: %s\n", yytext+2); -@@ -1128,27 +1126,27 @@ YY_RULE_SETUP - return DT_REF; - } - YY_BREAK --case 14: -+case 15: - YY_RULE_SETUP --#line 213 "dtc-lexer.l" -+#line 207 "dtc-lexer.l" - { - yylval.byte = strtol(yytext, NULL, 16); - DPRINT("Byte: %02x\n", (int)yylval.byte); - return DT_BYTE; - } - YY_BREAK --case 15: -+case 16: - YY_RULE_SETUP --#line 219 "dtc-lexer.l" -+#line 213 "dtc-lexer.l" - { - DPRINT("/BYTESTRING\n"); - BEGIN_DEFAULT(); - return ']'; - } - YY_BREAK --case 16: -+case 17: - YY_RULE_SETUP --#line 225 "dtc-lexer.l" -+#line 219 "dtc-lexer.l" - { - DPRINT("PropNodeName: %s\n", yytext); - yylval.propnodename = xstrdup((yytext[0] == '\\') ? -@@ -1157,75 +1155,75 @@ YY_RULE_SETUP - return DT_PROPNODENAME; - } - YY_BREAK --case 17: -+case 18: - YY_RULE_SETUP --#line 233 "dtc-lexer.l" -+#line 227 "dtc-lexer.l" - { - DPRINT("Binary Include\n"); - return DT_INCBIN; - } - YY_BREAK --case 18: --/* rule 18 can match eol */ --YY_RULE_SETUP --#line 238 "dtc-lexer.l" --/* eat whitespace */ -- YY_BREAK - case 19: - /* rule 19 can match eol */ - YY_RULE_SETUP --#line 239 "dtc-lexer.l" --/* eat C-style comments */ -+#line 232 "dtc-lexer.l" -+/* eat whitespace */ - YY_BREAK - case 20: - /* rule 20 can match eol */ - YY_RULE_SETUP --#line 240 "dtc-lexer.l" --/* eat C++-style comments */ -+#line 233 "dtc-lexer.l" -+/* eat C-style comments */ - YY_BREAK - case 21: -+/* rule 21 can match eol */ - YY_RULE_SETUP --#line 242 "dtc-lexer.l" --{ return DT_LSHIFT; }; -+#line 234 "dtc-lexer.l" -+/* eat C++-style comments */ - YY_BREAK - case 22: - YY_RULE_SETUP --#line 243 "dtc-lexer.l" --{ return DT_RSHIFT; }; -+#line 236 "dtc-lexer.l" -+{ return DT_LSHIFT; }; - YY_BREAK - case 23: - YY_RULE_SETUP --#line 244 "dtc-lexer.l" --{ return DT_LE; }; -+#line 237 "dtc-lexer.l" -+{ return DT_RSHIFT; }; - YY_BREAK - case 24: - YY_RULE_SETUP --#line 245 "dtc-lexer.l" --{ return DT_GE; }; -+#line 238 "dtc-lexer.l" -+{ return DT_LE; }; - YY_BREAK - case 25: - YY_RULE_SETUP --#line 246 "dtc-lexer.l" --{ return DT_EQ; }; -+#line 239 "dtc-lexer.l" -+{ return DT_GE; }; - YY_BREAK - case 26: - YY_RULE_SETUP --#line 247 "dtc-lexer.l" --{ return DT_NE; }; -+#line 240 "dtc-lexer.l" -+{ return DT_EQ; }; - YY_BREAK - case 27: - YY_RULE_SETUP --#line 248 "dtc-lexer.l" --{ return DT_AND; }; -+#line 241 "dtc-lexer.l" -+{ return DT_NE; }; - YY_BREAK - case 28: - YY_RULE_SETUP --#line 249 "dtc-lexer.l" --{ return DT_OR; }; -+#line 242 "dtc-lexer.l" -+{ return DT_AND; }; - YY_BREAK - case 29: - YY_RULE_SETUP --#line 251 "dtc-lexer.l" -+#line 243 "dtc-lexer.l" -+{ return DT_OR; }; -+ YY_BREAK -+case 30: -+YY_RULE_SETUP -+#line 245 "dtc-lexer.l" - { - DPRINT("Char: %c (\\x%02x)\n", yytext[0], - (unsigned)yytext[0]); -@@ -1241,12 +1239,12 @@ YY_RULE_SETUP - return yytext[0]; - } - YY_BREAK --case 30: -+case 31: - YY_RULE_SETUP --#line 266 "dtc-lexer.l" -+#line 260 "dtc-lexer.l" - ECHO; - YY_BREAK --#line 1250 "dtc-lexer.lex.c" -+#line 1248 "dtc-lexer.lex.c" - - case YY_END_OF_BUFFER: - { -@@ -1376,7 +1374,6 @@ ECHO; - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -- } /* end of user's declarations */ - } /* end of yylex */ - - /* yy_get_next_buffer - try to read in a new buffer -@@ -1432,21 +1429,21 @@ static int yy_get_next_buffer (void) - - else - { -- yy_size_t num_to_read = -+ int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ -- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; -+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { -- yy_size_t new_size = b->yy_buf_size * 2; -+ int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; -@@ -1477,7 +1474,7 @@ static int yy_get_next_buffer (void) - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), -- (yy_n_chars), num_to_read ); -+ (yy_n_chars), (size_t) num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } -@@ -1539,7 +1536,7 @@ static int yy_get_next_buffer (void) - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; -@@ -1567,13 +1564,13 @@ static int yy_get_next_buffer (void) - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; -- if ( yy_current_state >= 159 ) -+ if ( yy_current_state >= 166 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; -- yy_is_jam = (yy_current_state == 158); -+ yy_is_jam = (yy_current_state == 165); - -- return yy_is_jam ? 0 : yy_current_state; -+ return yy_is_jam ? 0 : yy_current_state; - } - - #ifndef YY_NO_INPUT -@@ -1600,7 +1597,7 @@ static int yy_get_next_buffer (void) - - else - { /* need more input */ -- yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); -+ int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) -@@ -1874,7 +1871,7 @@ void yypop_buffer_state (void) - */ - static void yyensure_buffer_stack (void) - { -- yy_size_t num_to_alloc; -+ int num_to_alloc; - - if (!(yy_buffer_stack)) { - -@@ -1971,12 +1968,12 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) - * - * @return the newly allocated buffer state object. - */ --YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) -+YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; -- yy_size_t i; -+ int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; -@@ -2058,7 +2055,7 @@ FILE *yyget_out (void) - /** Get the length of the current token. - * - */ --yy_size_t yyget_leng (void) -+int yyget_leng (void) - { - return yyleng; - } -@@ -2206,7 +2203,7 @@ void yyfree (void * ptr ) - - #define YYTABLES_NAME "yytables" - --#line 265 "dtc-lexer.l" -+#line 260 "dtc-lexer.l" - - - -diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped -index 31cec50..0f500de 100644 ---- a/scripts/dtc/dtc-parser.tab.c_shipped -+++ b/scripts/dtc/dtc-parser.tab.c_shipped -@@ -1,19 +1,21 @@ --/* A Bison parser, made by GNU Bison 3.0.2. */ - --/* Bison implementation for Yacc-like parsers in C -- -- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. -+/* A Bison parser, made by GNU Bison 2.4.1. */ - -+/* Skeleton implementation for Bison's Yacc-like parsers in C -+ -+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 -+ Free Software Foundation, Inc. -+ - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. -- -+ - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. -- -+ - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -@@ -26,7 +28,7 @@ - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. -- -+ - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -@@ -44,7 +46,7 @@ - #define YYBISON 1 - - /* Bison version. */ --#define YYBISON_VERSION "3.0.2" -+#define YYBISON_VERSION "2.4.1" - - /* Skeleton name. */ - #define YYSKELETON_NAME "yacc.c" -@@ -58,13 +60,18 @@ - /* Pull parsers. */ - #define YYPULL 1 - -+/* Using locations. */ -+#define YYLSP_NEEDED 1 - - - - /* Copy the first part of user declarations. */ --#line 20 "dtc-parser.y" /* yacc.c:339 */ -+ -+/* Line 189 of yacc.c */ -+#line 20 "dtc-parser.y" - - #include -+#include - - #include "dtc.h" - #include "srcpos.h" -@@ -80,15 +87,14 @@ extern void yyerror(char const *s); - extern struct boot_info *the_boot_info; - extern bool treesource_error; - --#line 84 "dtc-parser.tab.c" /* yacc.c:339 */ - --# ifndef YY_NULLPTR --# if defined __cplusplus && 201103L <= __cplusplus --# define YY_NULLPTR nullptr --# else --# define YY_NULLPTR 0 --# endif --# endif -+/* Line 189 of yacc.c */ -+#line 93 "dtc-parser.tab.c" -+ -+/* Enabling traces. */ -+#ifndef YYDEBUG -+# define YYDEBUG 0 -+#endif - - /* Enabling verbose error messages. */ - #ifdef YYERROR_VERBOSE -@@ -98,53 +104,51 @@ extern bool treesource_error; - # define YYERROR_VERBOSE 0 - #endif - --/* In a future release of Bison, this section will be replaced -- by #include "dtc-parser.tab.h". */ --#ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED --# define YY_YY_DTC_PARSER_TAB_H_INCLUDED --/* Debug traces. */ --#ifndef YYDEBUG --# define YYDEBUG 0 --#endif --#if YYDEBUG --extern int yydebug; -+/* Enabling the token table. */ -+#ifndef YYTOKEN_TABLE -+# define YYTOKEN_TABLE 0 - #endif - --/* Token type. */ -+ -+/* Tokens. */ - #ifndef YYTOKENTYPE - # define YYTOKENTYPE -- enum yytokentype -- { -- DT_V1 = 258, -- DT_MEMRESERVE = 259, -- DT_LSHIFT = 260, -- DT_RSHIFT = 261, -- DT_LE = 262, -- DT_GE = 263, -- DT_EQ = 264, -- DT_NE = 265, -- DT_AND = 266, -- DT_OR = 267, -- DT_BITS = 268, -- DT_DEL_PROP = 269, -- DT_DEL_NODE = 270, -- DT_PROPNODENAME = 271, -- DT_LITERAL = 272, -- DT_CHAR_LITERAL = 273, -- DT_BYTE = 274, -- DT_STRING = 275, -- DT_LABEL = 276, -- DT_REF = 277, -- DT_INCBIN = 278 -- }; -+ /* Put the tokens into the symbol table, so that GDB and other debuggers -+ know about them. */ -+ enum yytokentype { -+ DT_V1 = 258, -+ DT_PLUGIN = 259, -+ DT_MEMRESERVE = 260, -+ DT_LSHIFT = 261, -+ DT_RSHIFT = 262, -+ DT_LE = 263, -+ DT_GE = 264, -+ DT_EQ = 265, -+ DT_NE = 266, -+ DT_AND = 267, -+ DT_OR = 268, -+ DT_BITS = 269, -+ DT_DEL_PROP = 270, -+ DT_DEL_NODE = 271, -+ DT_PROPNODENAME = 272, -+ DT_LITERAL = 273, -+ DT_CHAR_LITERAL = 274, -+ DT_BYTE = 275, -+ DT_STRING = 276, -+ DT_LABEL = 277, -+ DT_REF = 278, -+ DT_INCBIN = 279 -+ }; - #endif - --/* Value type. */ -+ -+ - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED --typedef union YYSTYPE YYSTYPE; --union YYSTYPE -+typedef union YYSTYPE - { --#line 38 "dtc-parser.y" /* yacc.c:355 */ -+ -+/* Line 214 of yacc.c */ -+#line 39 "dtc-parser.y" - - char *propnodename; - char *labelref; -@@ -162,37 +166,37 @@ union YYSTYPE - struct node *nodelist; - struct reserve_info *re; - uint64_t integer; -+ bool is_plugin; - --#line 167 "dtc-parser.tab.c" /* yacc.c:355 */ --}; -+ -+ -+/* Line 214 of yacc.c */ -+#line 175 "dtc-parser.tab.c" -+} YYSTYPE; - # define YYSTYPE_IS_TRIVIAL 1 -+# define yystype YYSTYPE /* obsolescent; will be withdrawn */ - # define YYSTYPE_IS_DECLARED 1 - #endif - --/* Location type. */ - #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED --typedef struct YYLTYPE YYLTYPE; --struct YYLTYPE -+typedef struct YYLTYPE - { - int first_line; - int first_column; - int last_line; - int last_column; --}; -+} YYLTYPE; -+# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ - # define YYLTYPE_IS_DECLARED 1 - # define YYLTYPE_IS_TRIVIAL 1 - #endif - - --extern YYSTYPE yylval; --extern YYLTYPE yylloc; --int yyparse (void); -- --#endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ -- - /* Copy the second part of user declarations. */ - --#line 196 "dtc-parser.tab.c" /* yacc.c:358 */ -+ -+/* Line 264 of yacc.c */ -+#line 200 "dtc-parser.tab.c" - - #ifdef short - # undef short -@@ -206,8 +210,11 @@ typedef unsigned char yytype_uint8; - - #ifdef YYTYPE_INT8 - typedef YYTYPE_INT8 yytype_int8; --#else -+#elif (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - typedef signed char yytype_int8; -+#else -+typedef short int yytype_int8; - #endif - - #ifdef YYTYPE_UINT16 -@@ -227,7 +234,8 @@ typedef short int yytype_int16; - # define YYSIZE_T __SIZE_TYPE__ - # elif defined size_t - # define YYSIZE_T size_t --# elif ! defined YYSIZE_T -+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - # include /* INFRINGES ON USER NAME SPACE */ - # define YYSIZE_T size_t - # else -@@ -238,71 +246,42 @@ typedef short int yytype_int16; - #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - - #ifndef YY_ --# if defined YYENABLE_NLS && YYENABLE_NLS -+# if YYENABLE_NLS - # if ENABLE_NLS - # include /* INFRINGES ON USER NAME SPACE */ --# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -+# define YY_(msgid) dgettext ("bison-runtime", msgid) - # endif - # endif - # ifndef YY_ --# define YY_(Msgid) Msgid --# endif --#endif -- --#ifndef YY_ATTRIBUTE --# if (defined __GNUC__ \ -- && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ -- || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C --# define YY_ATTRIBUTE(Spec) __attribute__(Spec) --# else --# define YY_ATTRIBUTE(Spec) /* empty */ --# endif --#endif -- --#ifndef YY_ATTRIBUTE_PURE --# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) --#endif -- --#ifndef YY_ATTRIBUTE_UNUSED --# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) --#endif -- --#if !defined _Noreturn \ -- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) --# if defined _MSC_VER && 1200 <= _MSC_VER --# define _Noreturn __declspec (noreturn) --# else --# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) -+# define YY_(msgid) msgid - # endif - #endif - - /* Suppress unused-variable warnings by "using" E. */ - #if ! defined lint || defined __GNUC__ --# define YYUSE(E) ((void) (E)) -+# define YYUSE(e) ((void) (e)) - #else --# define YYUSE(E) /* empty */ -+# define YYUSE(e) /* empty */ - #endif - --#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ --/* Suppress an incorrect diagnostic about yylval being uninitialized. */ --# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ -- _Pragma ("GCC diagnostic push") \ -- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ -- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") --# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ -- _Pragma ("GCC diagnostic pop") -+/* Identity function, used to suppress warnings about constant conditions. */ -+#ifndef lint -+# define YYID(n) (n) - #else --# define YY_INITIAL_VALUE(Value) Value --#endif --#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN --# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN --# define YY_IGNORE_MAYBE_UNINITIALIZED_END -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) -+static int -+YYID (int yyi) -+#else -+static int -+YYID (yyi) -+ int yyi; - #endif --#ifndef YY_INITIAL_VALUE --# define YY_INITIAL_VALUE(Value) /* Nothing. */ -+{ -+ return yyi; -+} - #endif - -- - #if ! defined yyoverflow || YYERROR_VERBOSE - - /* The parser invokes alloca or malloc; define the necessary symbols. */ -@@ -320,11 +299,11 @@ typedef short int yytype_int16; - # define alloca _alloca - # else - # define YYSTACK_ALLOC alloca --# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -+# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - # include /* INFRINGES ON USER NAME SPACE */ -- /* Use EXIT_SUCCESS as a witness for stdlib.h. */ --# ifndef EXIT_SUCCESS --# define EXIT_SUCCESS 0 -+# ifndef _STDLIB_H -+# define _STDLIB_H 1 - # endif - # endif - # endif -@@ -332,8 +311,8 @@ typedef short int yytype_int16; - # endif - - # ifdef YYSTACK_ALLOC -- /* Pacify GCC's 'empty if-body' warning. */ --# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -+ /* Pacify GCC's `empty if-body' warning. */ -+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) - # ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely -@@ -347,23 +326,25 @@ typedef short int yytype_int16; - # ifndef YYSTACK_ALLOC_MAXIMUM - # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM - # endif --# if (defined __cplusplus && ! defined EXIT_SUCCESS \ -+# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ -- && (defined YYFREE || defined free))) -+ && (defined YYFREE || defined free))) - # include /* INFRINGES ON USER NAME SPACE */ --# ifndef EXIT_SUCCESS --# define EXIT_SUCCESS 0 -+# ifndef _STDLIB_H -+# define _STDLIB_H 1 - # endif - # endif - # ifndef YYMALLOC - # define YYMALLOC malloc --# if ! defined malloc && ! defined EXIT_SUCCESS -+# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ - # endif - # endif - # ifndef YYFREE - # define YYFREE free --# if ! defined free && ! defined EXIT_SUCCESS -+# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - void free (void *); /* INFRINGES ON USER NAME SPACE */ - # endif - # endif -@@ -373,8 +354,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ - - #if (! defined yyoverflow \ - && (! defined __cplusplus \ -- || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ -- && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) -+ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ -+ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - - /* A type that is properly aligned for any stack member. */ - union yyalloc -@@ -393,85 +374,79 @@ union yyalloc - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ - + 2 * YYSTACK_GAP_MAXIMUM) - --# define YYCOPY_NEEDED 1 -+/* Copy COUNT objects from FROM to TO. The source and destination do -+ not overlap. */ -+# ifndef YYCOPY -+# if defined __GNUC__ && 1 < __GNUC__ -+# define YYCOPY(To, From, Count) \ -+ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -+# else -+# define YYCOPY(To, From, Count) \ -+ do \ -+ { \ -+ YYSIZE_T yyi; \ -+ for (yyi = 0; yyi < (Count); yyi++) \ -+ (To)[yyi] = (From)[yyi]; \ -+ } \ -+ while (YYID (0)) -+# endif -+# endif - - /* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ --# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ -- do \ -- { \ -- YYSIZE_T yynewbytes; \ -- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ -- Stack = &yyptr->Stack_alloc; \ -- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ -- yyptr += yynewbytes / sizeof (*yyptr); \ -- } \ -- while (0) -+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ -+ do \ -+ { \ -+ YYSIZE_T yynewbytes; \ -+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ -+ Stack = &yyptr->Stack_alloc; \ -+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ -+ yyptr += yynewbytes / sizeof (*yyptr); \ -+ } \ -+ while (YYID (0)) - - #endif - --#if defined YYCOPY_NEEDED && YYCOPY_NEEDED --/* Copy COUNT objects from SRC to DST. The source and destination do -- not overlap. */ --# ifndef YYCOPY --# if defined __GNUC__ && 1 < __GNUC__ --# define YYCOPY(Dst, Src, Count) \ -- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) --# else --# define YYCOPY(Dst, Src, Count) \ -- do \ -- { \ -- YYSIZE_T yyi; \ -- for (yyi = 0; yyi < (Count); yyi++) \ -- (Dst)[yyi] = (Src)[yyi]; \ -- } \ -- while (0) --# endif --# endif --#endif /* !YYCOPY_NEEDED */ -- - /* YYFINAL -- State number of the termination state. */ --#define YYFINAL 4 -+#define YYFINAL 7 - /* YYLAST -- Last index in YYTABLE. */ --#define YYLAST 136 -+#define YYLAST 139 - - /* YYNTOKENS -- Number of terminals. */ --#define YYNTOKENS 47 -+#define YYNTOKENS 48 - /* YYNNTS -- Number of nonterminals. */ --#define YYNNTS 28 -+#define YYNNTS 31 - /* YYNRULES -- Number of rules. */ --#define YYNRULES 80 --/* YYNSTATES -- Number of states. */ --#define YYNSTATES 144 -+#define YYNRULES 86 -+/* YYNRULES -- Number of states. */ -+#define YYNSTATES 153 - --/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned -- by yylex, with out-of-bounds checking. */ -+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ - #define YYUNDEFTOK 2 --#define YYMAXUTOK 278 -+#define YYMAXUTOK 279 - --#define YYTRANSLATE(YYX) \ -+#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - --/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM -- as returned by yylex, without out-of-bounds checking. */ -+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ - static const yytype_uint8 yytranslate[] = - { - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 2, 2, 46, 2, 2, 2, 44, 40, 2, -- 32, 34, 43, 41, 33, 42, 2, 25, 2, 2, -- 2, 2, 2, 2, 2, 2, 2, 2, 37, 24, -- 35, 28, 29, 36, 2, 2, 2, 2, 2, 2, -+ 2, 2, 2, 47, 2, 2, 2, 45, 41, 2, -+ 33, 35, 44, 42, 34, 43, 2, 26, 2, 2, -+ 2, 2, 2, 2, 2, 2, 2, 2, 38, 25, -+ 36, 29, 30, 37, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 30, 2, 31, 39, 2, 2, 2, 2, 2, -+ 2, 31, 2, 32, 40, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -- 2, 2, 2, 26, 38, 27, 45, 2, 2, 2, -+ 2, 2, 2, 27, 39, 28, 46, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -@@ -486,366 +461,412 @@ static const yytype_uint8 yytranslate[] = - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -- 15, 16, 17, 18, 19, 20, 21, 22, 23 -+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 - }; - - #if YYDEBUG -- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in -+ YYRHS. */ -+static const yytype_uint16 yyprhs[] = -+{ -+ 0, 0, 3, 5, 7, 13, 14, 17, 23, 24, -+ 27, 32, 35, 38, 42, 47, 51, 56, 57, 63, -+ 64, 67, 72, 75, 79, 82, 85, 89, 94, 97, -+ 107, 113, 116, 117, 120, 123, 127, 129, 132, 135, -+ 138, 140, 142, 146, 148, 150, 156, 158, 162, 164, -+ 168, 170, 174, 176, 180, 182, 186, 188, 192, 196, -+ 198, 202, 206, 210, 214, 218, 222, 224, 228, 232, -+ 234, 238, 242, 246, 248, 250, 253, 256, 259, 260, -+ 263, 266, 267, 270, 273, 276, 280 -+}; -+ -+/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -+static const yytype_int8 yyrhs[] = -+{ -+ 49, 0, -1, 50, -1, 52, -1, 3, 25, 51, -+ 53, 55, -1, -1, 4, 25, -1, 3, 4, 25, -+ 53, 55, -1, -1, 54, 53, -1, 5, 62, 62, -+ 25, -1, 22, 54, -1, 26, 56, -1, 55, 26, -+ 56, -1, 55, 22, 23, 56, -1, 55, 23, 56, -+ -1, 55, 16, 23, 25, -1, -1, 27, 57, 77, -+ 28, 25, -1, -1, 57, 58, -1, 17, 29, 59, -+ 25, -1, 17, 25, -1, 15, 17, 25, -1, 22, -+ 58, -1, 60, 21, -1, 60, 61, 30, -1, 60, -+ 31, 76, 32, -1, 60, 23, -1, 60, 24, 33, -+ 21, 34, 62, 34, 62, 35, -1, 60, 24, 33, -+ 21, 35, -1, 59, 22, -1, -1, 59, 34, -1, -+ 60, 22, -1, 14, 18, 36, -1, 36, -1, 61, -+ 62, -1, 61, 23, -1, 61, 22, -1, 18, -1, -+ 19, -1, 33, 63, 35, -1, 64, -1, 65, -1, -+ 65, 37, 63, 38, 64, -1, 66, -1, 65, 13, -+ 66, -1, 67, -1, 66, 12, 67, -1, 68, -1, -+ 67, 39, 68, -1, 69, -1, 68, 40, 69, -1, -+ 70, -1, 69, 41, 70, -1, 71, -1, 70, 10, -+ 71, -1, 70, 11, 71, -1, 72, -1, 71, 36, -+ 72, -1, 71, 30, 72, -1, 71, 8, 72, -1, -+ 71, 9, 72, -1, 72, 6, 73, -1, 72, 7, -+ 73, -1, 73, -1, 73, 42, 74, -1, 73, 43, -+ 74, -1, 74, -1, 74, 44, 75, -1, 74, 26, -+ 75, -1, 74, 45, 75, -1, 75, -1, 62, -1, -+ 43, 75, -1, 46, 75, -1, 47, 75, -1, -1, -+ 76, 20, -1, 76, 22, -1, -1, 78, 77, -1, -+ 78, 58, -1, 17, 56, -1, 16, 17, 25, -1, -+ 22, 78, -1 -+}; -+ -+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ - static const yytype_uint16 yyrline[] = - { -- 0, 104, 104, 113, 116, 123, 127, 135, 139, 144, -- 155, 165, 180, 188, 191, 198, 202, 206, 210, 218, -- 222, 226, 230, 234, 250, 260, 268, 271, 275, 282, -- 298, 303, 322, 336, 343, 344, 345, 352, 356, 357, -- 361, 362, 366, 367, 371, 372, 376, 377, 381, 382, -- 386, 387, 388, 392, 393, 394, 395, 396, 400, 401, -- 402, 406, 407, 408, 412, 413, 422, 431, 435, 436, -- 437, 438, 443, 446, 450, 458, 461, 465, 473, 477, -- 481 -+ 0, 108, 108, 109, 113, 125, 128, 135, 146, 149, -+ 156, 160, 168, 172, 177, 188, 202, 215, 222, 230, -+ 233, 240, 244, 248, 252, 260, 264, 268, 272, 276, -+ 292, 302, 310, 313, 317, 324, 340, 345, 364, 378, -+ 385, 386, 387, 394, 398, 399, 403, 404, 408, 409, -+ 413, 414, 418, 419, 423, 424, 428, 429, 430, 434, -+ 435, 436, 437, 438, 442, 443, 444, 448, 449, 450, -+ 454, 455, 456, 457, 461, 462, 463, 464, 469, 472, -+ 476, 484, 487, 491, 499, 503, 507 - }; - #endif - --#if YYDEBUG || YYERROR_VERBOSE || 0 -+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE - /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ - static const char *const yytname[] = - { -- "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT", -- "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR", -- "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL", -- "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", -- "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", "']'", -- "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", "'+'", -- "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", -- "memreserves", "memreserve", "devicetree", "nodedef", "proplist", -- "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim", -- "integer_expr", "integer_trinary", "integer_or", "integer_and", -- "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq", -- "integer_rela", "integer_shift", "integer_add", "integer_mul", -- "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR -+ "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE", -+ "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", -+ "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", -+ "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", -+ "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", -+ "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", -+ "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", -+ "basesource", "plugindecl", "pluginsource", "memreserves", "memreserve", -+ "devicetree", "nodedef", "proplist", "propdef", "propdata", -+ "propdataprefix", "arrayprefix", "integer_prim", "integer_expr", -+ "integer_trinary", "integer_or", "integer_and", "integer_bitor", -+ "integer_bitxor", "integer_bitand", "integer_eq", "integer_rela", -+ "integer_shift", "integer_add", "integer_mul", "integer_unary", -+ "bytestring", "subnodes", "subnode", 0 - }; - #endif - - # ifdef YYPRINT --/* YYTOKNUM[NUM] -- (External) token number corresponding to the -- (internal) symbol number NUM (which must be that of a token). */ -+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to -+ token YYLEX-NUM. */ - static const yytype_uint16 yytoknum[] = - { - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, -- 275, 276, 277, 278, 59, 47, 123, 125, 61, 62, -- 91, 93, 40, 44, 41, 60, 63, 58, 124, 94, -- 38, 43, 45, 42, 37, 126, 33 -+ 275, 276, 277, 278, 279, 59, 47, 123, 125, 61, -+ 62, 91, 93, 40, 44, 41, 60, 63, 58, 124, -+ 94, 38, 43, 45, 42, 37, 126, 33 - }; - # endif - --#define YYPACT_NINF -81 -- --#define yypact_value_is_default(Yystate) \ -- (!!((Yystate) == (-81))) -- --#define YYTABLE_NINF -1 -- --#define yytable_value_is_error(Yytable_value) \ -- 0 -- -- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing -- STATE-NUM. */ --static const yytype_int8 yypact[] = -+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -+static const yytype_uint8 yyr1[] = - { -- 16, -11, 21, 10, -81, 25, 10, 19, 10, -81, -- -81, -9, 25, -81, 2, 51, -81, -9, -9, -9, -- -81, 1, -81, -6, 50, 14, 28, 29, 36, 3, -- 58, 44, -3, -81, 47, -81, -81, 65, 68, 2, -- 2, -81, -81, -81, -81, -9, -9, -9, -9, -9, -- -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -- -9, -9, -9, -9, -81, 63, 69, 2, -81, -81, -- 50, 57, 14, 28, 29, 36, 3, 3, 58, 58, -- 58, 58, 44, 44, -3, -3, -81, -81, -81, 79, -- 80, -8, 63, -81, 72, 63, -81, -81, -9, 76, -- 77, -81, -81, -81, -81, -81, 78, -81, -81, -81, -- -81, -81, 35, 4, -81, -81, -81, -81, 86, -81, -- -81, -81, 73, -81, -81, 33, 71, 84, 39, -81, -- -81, -81, -81, -81, 41, -81, -81, -81, 25, -81, -- 74, 25, 75, -81 -+ 0, 48, 49, 49, 50, 51, 51, 52, 53, 53, -+ 54, 54, 55, 55, 55, 55, 55, 55, 56, 57, -+ 57, 58, 58, 58, 58, 59, 59, 59, 59, 59, -+ 59, 59, 60, 60, 60, 61, 61, 61, 61, 61, -+ 62, 62, 62, 63, 64, 64, 65, 65, 66, 66, -+ 67, 67, 68, 68, 69, 69, 70, 70, 70, 71, -+ 71, 71, 71, 71, 72, 72, 72, 73, 73, 73, -+ 74, 74, 74, 74, 75, 75, 75, 75, 76, 76, -+ 76, 77, 77, 77, 78, 78, 78 - }; - -- /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. -- Performed when YYTABLE does not specify something else to do. Zero -- means the default is an error. */ --static const yytype_uint8 yydefact[] = -+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -+static const yytype_uint8 yyr2[] = - { -- 0, 0, 0, 3, 1, 0, 0, 0, 3, 34, -- 35, 0, 0, 6, 0, 2, 4, 0, 0, 0, -- 68, 0, 37, 38, 40, 42, 44, 46, 48, 50, -- 53, 60, 63, 67, 0, 13, 7, 0, 0, 0, -- 0, 69, 70, 71, 36, 0, 0, 0, 0, 0, -- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- 0, 0, 0, 0, 5, 75, 0, 0, 10, 8, -- 41, 0, 43, 45, 47, 49, 51, 52, 56, 57, -- 55, 54, 58, 59, 61, 62, 65, 64, 66, 0, -- 0, 0, 0, 14, 0, 75, 11, 9, 0, 0, -- 0, 16, 26, 78, 18, 80, 0, 77, 76, 39, -- 17, 79, 0, 0, 12, 25, 15, 27, 0, 19, -- 28, 22, 0, 72, 30, 0, 0, 0, 0, 33, -- 32, 20, 31, 29, 0, 73, 74, 21, 0, 24, -- 0, 0, 0, 23 -+ 0, 2, 1, 1, 5, 0, 2, 5, 0, 2, -+ 4, 2, 2, 3, 4, 3, 4, 0, 5, 0, -+ 2, 4, 2, 3, 2, 2, 3, 4, 2, 9, -+ 5, 2, 0, 2, 2, 3, 1, 2, 2, 2, -+ 1, 1, 3, 1, 1, 5, 1, 3, 1, 3, -+ 1, 3, 1, 3, 1, 3, 1, 3, 3, 1, -+ 3, 3, 3, 3, 3, 3, 1, 3, 3, 1, -+ 3, 3, 3, 1, 1, 2, 2, 2, 0, 2, -+ 2, 0, 2, 2, 2, 3, 2 - }; - -- /* YYPGOTO[NTERM-NUM]. */ --static const yytype_int8 yypgoto[] = -+/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state -+ STATE-NUM when YYTABLE doesn't specify something else to do. Zero -+ means the default is an error. */ -+static const yytype_uint8 yydefact[] = - { -- -81, -81, 100, 104, -81, -38, -81, -80, -81, -81, -- -81, -5, 66, 13, -81, 70, 67, 81, 64, 82, -- 37, 27, 34, 38, -14, -81, 22, 24 -+ 0, 0, 0, 2, 3, 0, 5, 1, 8, 0, -+ 8, 0, 0, 17, 8, 6, 17, 40, 41, 0, -+ 0, 11, 0, 7, 9, 4, 0, 0, 0, 74, -+ 0, 43, 44, 46, 48, 50, 52, 54, 56, 59, -+ 66, 69, 73, 0, 19, 12, 0, 0, 0, 0, -+ 75, 76, 77, 42, 0, 0, 0, 0, 0, 0, -+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -+ 0, 0, 0, 10, 81, 0, 0, 15, 13, 47, -+ 0, 49, 51, 53, 55, 57, 58, 62, 63, 61, -+ 60, 64, 65, 67, 68, 71, 70, 72, 0, 0, -+ 0, 0, 20, 0, 81, 16, 14, 0, 0, 0, -+ 22, 32, 84, 24, 86, 0, 83, 82, 45, 23, -+ 85, 0, 0, 18, 31, 21, 33, 0, 25, 34, -+ 28, 0, 78, 36, 0, 0, 0, 0, 39, 38, -+ 26, 37, 35, 0, 79, 80, 27, 0, 30, 0, -+ 0, 0, 29 - }; - -- /* YYDEFGOTO[NTERM-NUM]. */ -+/* YYDEFGOTO[NTERM-NUM]. */ - static const yytype_int16 yydefgoto[] = - { -- -1, 2, 7, 8, 15, 36, 65, 93, 112, 113, -- 125, 20, 21, 22, 23, 24, 25, 26, 27, 28, -- 29, 30, 31, 32, 33, 128, 94, 95 -+ -1, 2, 3, 10, 4, 13, 14, 23, 45, 74, -+ 102, 121, 122, 134, 29, 30, 31, 32, 33, 34, -+ 35, 36, 37, 38, 39, 40, 41, 42, 137, 103, -+ 104 - }; - -- /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If -- positive, shift that token. If negative, reduce the rule whose -- number is the opposite. If YYTABLE_NINF, syntax error. */ --static const yytype_uint8 yytable[] = -+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing -+ STATE-NUM. */ -+#define YYPACT_NINF -48 -+static const yytype_int8 yypact[] = - { -- 12, 68, 69, 41, 42, 43, 45, 34, 9, 10, -- 53, 54, 104, 3, 5, 107, 101, 118, 35, 1, -- 102, 4, 61, 11, 119, 120, 121, 122, 35, 97, -- 46, 6, 55, 17, 123, 44, 18, 19, 56, 124, -- 62, 63, 9, 10, 14, 51, 52, 86, 87, 88, -- 9, 10, 48, 103, 129, 130, 115, 11, 135, 116, -- 136, 47, 131, 57, 58, 11, 37, 49, 117, 50, -- 137, 64, 38, 39, 138, 139, 40, 89, 90, 91, -- 78, 79, 80, 81, 92, 59, 60, 66, 76, 77, -- 67, 82, 83, 96, 98, 99, 100, 84, 85, 106, -- 110, 111, 114, 126, 134, 127, 133, 141, 16, 143, -- 13, 109, 71, 74, 72, 70, 105, 108, 0, 0, -- 132, 0, 0, 0, 0, 0, 0, 0, 0, 73, -- 0, 0, 75, 140, 0, 0, 142 -+ 30, 15, 37, -48, -48, 36, 48, -48, 17, 49, -+ 17, -5, 17, 58, 17, -48, 58, -48, -48, -12, -+ -5, -48, 64, 41, -48, 41, -12, -12, -12, -48, -+ 59, -48, -1, 83, 57, 60, 35, 16, 2, 74, -+ 40, -3, -48, 72, -48, -48, 75, 76, 64, 64, -+ -48, -48, -48, -48, -12, -12, -12, -12, -12, -12, -+ -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -+ -12, -12, -12, -48, 56, 77, 64, -48, -48, 83, -+ 63, 57, 60, 35, 16, 2, 2, 74, 74, 74, -+ 74, 40, 40, -3, -3, -48, -48, -48, 86, 87, -+ 50, 56, -48, 78, 56, -48, -48, -12, 80, 82, -+ -48, -48, -48, -48, -48, 84, -48, -48, -48, -48, -+ -48, 34, -6, -48, -48, -48, -48, 90, -48, -48, -+ -48, 79, -48, -48, 32, 81, 89, 38, -48, -48, -+ -48, -48, -48, 51, -48, -48, -48, -5, -48, 85, -+ -5, 91, -48 - }; - --static const yytype_int16 yycheck[] = -+/* YYPGOTO[NTERM-NUM]. */ -+static const yytype_int8 yypgoto[] = - { -- 5, 39, 40, 17, 18, 19, 12, 12, 17, 18, -- 7, 8, 92, 24, 4, 95, 24, 13, 26, 3, -- 28, 0, 25, 32, 20, 21, 22, 23, 26, 67, -- 36, 21, 29, 42, 30, 34, 45, 46, 35, 35, -- 43, 44, 17, 18, 25, 9, 10, 61, 62, 63, -- 17, 18, 38, 91, 21, 22, 21, 32, 19, 24, -- 21, 11, 29, 5, 6, 32, 15, 39, 33, 40, -- 31, 24, 21, 22, 33, 34, 25, 14, 15, 16, -- 53, 54, 55, 56, 21, 41, 42, 22, 51, 52, -- 22, 57, 58, 24, 37, 16, 16, 59, 60, 27, -- 24, 24, 24, 17, 20, 32, 35, 33, 8, 34, -- 6, 98, 46, 49, 47, 45, 92, 95, -1, -1, -- 125, -1, -1, -1, -1, -1, -1, -1, -1, 48, -- -1, -1, 50, 138, -1, -1, 141 -+ -48, -48, -48, -48, -48, 10, 99, 97, -47, -48, -+ -35, -48, -48, -48, -11, 61, 7, -48, 66, 62, -+ 65, 67, 68, 27, -19, 23, 24, -23, -48, 11, -+ 20 - }; - -- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing -- symbol of state STATE-NUM. */ --static const yytype_uint8 yystos[] = -+/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If -+ positive, shift that token. If negative, reduce the rule which -+ number is the opposite. If zero, do what YYDEFACT says. -+ If YYTABLE_NINF, syntax error. */ -+#define YYTABLE_NINF -1 -+static const yytype_uint8 yytable[] = - { -- 0, 3, 48, 24, 0, 4, 21, 49, 50, 17, -- 18, 32, 58, 50, 25, 51, 49, 42, 45, 46, -- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, -- 68, 69, 70, 71, 58, 26, 52, 15, 21, 22, -- 25, 71, 71, 71, 34, 12, 36, 11, 38, 39, -- 40, 9, 10, 7, 8, 29, 35, 5, 6, 41, -- 42, 25, 43, 44, 24, 53, 22, 22, 52, 52, -- 62, 59, 63, 64, 65, 66, 67, 67, 68, 68, -- 68, 68, 69, 69, 70, 70, 71, 71, 71, 14, -- 15, 16, 21, 54, 73, 74, 24, 52, 37, 16, -- 16, 24, 28, 52, 54, 74, 27, 54, 73, 60, -- 24, 24, 55, 56, 24, 21, 24, 33, 13, 20, -- 21, 22, 23, 30, 35, 57, 17, 32, 72, 21, -- 22, 29, 58, 35, 20, 19, 21, 31, 33, 34, -- 58, 33, 58, 34 -+ 20, 77, 78, 50, 51, 52, 17, 18, 127, 43, -+ 62, 63, 54, 17, 18, 128, 129, 130, 131, 5, -+ 16, 19, 11, 70, 24, 132, 60, 61, 19, 106, -+ 133, 26, 64, 1, 27, 28, 55, 7, 65, 12, -+ 6, 71, 72, 87, 88, 89, 90, 95, 96, 97, -+ 17, 18, 9, 112, 138, 139, 124, 46, 144, 125, -+ 145, 8, 140, 47, 48, 19, 113, 49, 126, 116, -+ 146, 98, 99, 100, 15, 110, 59, 44, 101, 111, -+ 66, 67, 68, 69, 22, 147, 148, 85, 86, 91, -+ 92, 44, 93, 94, 53, 56, 57, 73, 75, 76, -+ 58, 107, 105, 108, 109, 119, 115, 120, 135, 123, -+ 143, 21, 136, 25, 118, 117, 80, 142, 81, 150, -+ 79, 114, 82, 141, 0, 83, 152, 84, 0, 0, -+ 0, 0, 0, 0, 0, 0, 149, 0, 0, 151 - }; - -- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ --static const yytype_uint8 yyr1[] = -+static const yytype_int16 yycheck[] = - { -- 0, 47, 48, 49, 49, 50, 50, 51, 51, 51, -- 51, 51, 52, 53, 53, 54, 54, 54, 54, 55, -- 55, 55, 55, 55, 55, 55, 56, 56, 56, 57, -- 57, 57, 57, 57, 58, 58, 58, 59, 60, 60, -- 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, -- 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, -- 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, -- 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, -- 74 -+ 11, 48, 49, 26, 27, 28, 18, 19, 14, 20, -+ 8, 9, 13, 18, 19, 21, 22, 23, 24, 4, -+ 10, 33, 5, 26, 14, 31, 10, 11, 33, 76, -+ 36, 43, 30, 3, 46, 47, 37, 0, 36, 22, -+ 25, 44, 45, 62, 63, 64, 65, 70, 71, 72, -+ 18, 19, 4, 100, 22, 23, 22, 16, 20, 25, -+ 22, 25, 30, 22, 23, 33, 101, 26, 34, 104, -+ 32, 15, 16, 17, 25, 25, 41, 27, 22, 29, -+ 6, 7, 42, 43, 26, 34, 35, 60, 61, 66, -+ 67, 27, 68, 69, 35, 12, 39, 25, 23, 23, -+ 40, 38, 25, 17, 17, 25, 28, 25, 18, 25, -+ 21, 12, 33, 16, 107, 104, 55, 36, 56, 34, -+ 54, 101, 57, 134, -1, 58, 35, 59, -1, -1, -+ -1, -1, -1, -1, -1, -1, 147, -1, -1, 150 - }; - -- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ --static const yytype_uint8 yyr2[] = -+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing -+ symbol of state STATE-NUM. */ -+static const yytype_uint8 yystos[] = - { -- 0, 2, 4, 0, 2, 4, 2, 2, 3, 4, -- 3, 4, 5, 0, 2, 4, 2, 3, 2, 2, -- 3, 4, 2, 9, 5, 2, 0, 2, 2, 3, -- 1, 2, 2, 2, 1, 1, 3, 1, 1, 5, -- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, -- 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, -- 1, 3, 3, 1, 3, 3, 3, 1, 1, 2, -- 2, 2, 0, 2, 2, 0, 2, 2, 2, 3, -- 2 -+ 0, 3, 49, 50, 52, 4, 25, 0, 25, 4, -+ 51, 5, 22, 53, 54, 25, 53, 18, 19, 33, -+ 62, 54, 26, 55, 53, 55, 43, 46, 47, 62, -+ 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, -+ 73, 74, 75, 62, 27, 56, 16, 22, 23, 26, -+ 75, 75, 75, 35, 13, 37, 12, 39, 40, 41, -+ 10, 11, 8, 9, 30, 36, 6, 7, 42, 43, -+ 26, 44, 45, 25, 57, 23, 23, 56, 56, 66, -+ 63, 67, 68, 69, 70, 71, 71, 72, 72, 72, -+ 72, 73, 73, 74, 74, 75, 75, 75, 15, 16, -+ 17, 22, 58, 77, 78, 25, 56, 38, 17, 17, -+ 25, 29, 56, 58, 78, 28, 58, 77, 64, 25, -+ 25, 59, 60, 25, 22, 25, 34, 14, 21, 22, -+ 23, 24, 31, 36, 61, 18, 33, 76, 22, 23, -+ 30, 62, 36, 21, 20, 22, 32, 34, 35, 62, -+ 34, 62, 35 - }; - -+#define yyerrok (yyerrstatus = 0) -+#define yyclearin (yychar = YYEMPTY) -+#define YYEMPTY (-2) -+#define YYEOF 0 -+ -+#define YYACCEPT goto yyacceptlab -+#define YYABORT goto yyabortlab -+#define YYERROR goto yyerrorlab - --#define yyerrok (yyerrstatus = 0) --#define yyclearin (yychar = YYEMPTY) --#define YYEMPTY (-2) --#define YYEOF 0 - --#define YYACCEPT goto yyacceptlab --#define YYABORT goto yyabortlab --#define YYERROR goto yyerrorlab -+/* Like YYERROR except do call yyerror. This remains here temporarily -+ to ease the transition to the new meaning of YYERROR, for GCC. -+ Once GCC version 2 has supplanted version 1, this can go. */ - -+#define YYFAIL goto yyerrlab - - #define YYRECOVERING() (!!yyerrstatus) - --#define YYBACKUP(Token, Value) \ --do \ -- if (yychar == YYEMPTY) \ -- { \ -- yychar = (Token); \ -- yylval = (Value); \ -- YYPOPSTACK (yylen); \ -- yystate = *yyssp; \ -- goto yybackup; \ -- } \ -- else \ -- { \ -+#define YYBACKUP(Token, Value) \ -+do \ -+ if (yychar == YYEMPTY && yylen == 1) \ -+ { \ -+ yychar = (Token); \ -+ yylval = (Value); \ -+ yytoken = YYTRANSLATE (yychar); \ -+ YYPOPSTACK (1); \ -+ goto yybackup; \ -+ } \ -+ else \ -+ { \ - yyerror (YY_("syntax error: cannot back up")); \ -- YYERROR; \ -- } \ --while (0) -+ YYERROR; \ -+ } \ -+while (YYID (0)) - --/* Error token number */ --#define YYTERROR 1 --#define YYERRCODE 256 -+ -+#define YYTERROR 1 -+#define YYERRCODE 256 - - - /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -+#define YYRHSLOC(Rhs, K) ((Rhs)[K]) - #ifndef YYLLOC_DEFAULT --# define YYLLOC_DEFAULT(Current, Rhs, N) \ -- do \ -- if (N) \ -- { \ -- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ -- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ -- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ -- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ -- } \ -- else \ -- { \ -- (Current).first_line = (Current).last_line = \ -- YYRHSLOC (Rhs, 0).last_line; \ -- (Current).first_column = (Current).last_column = \ -- YYRHSLOC (Rhs, 0).last_column; \ -- } \ -- while (0) -+# define YYLLOC_DEFAULT(Current, Rhs, N) \ -+ do \ -+ if (YYID (N)) \ -+ { \ -+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ -+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ -+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ -+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ -+ } \ -+ else \ -+ { \ -+ (Current).first_line = (Current).last_line = \ -+ YYRHSLOC (Rhs, 0).last_line; \ -+ (Current).first_column = (Current).last_column = \ -+ YYRHSLOC (Rhs, 0).last_column; \ -+ } \ -+ while (YYID (0)) - #endif - --#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -- -- --/* Enable debugging if requested. */ --#if YYDEBUG -- --# ifndef YYFPRINTF --# include /* INFRINGES ON USER NAME SPACE */ --# define YYFPRINTF fprintf --# endif -- --# define YYDPRINTF(Args) \ --do { \ -- if (yydebug) \ -- YYFPRINTF Args; \ --} while (0) -- - - /* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - - #ifndef YY_LOCATION_PRINT --# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -+# if YYLTYPE_IS_TRIVIAL -+# define YY_LOCATION_PRINT(File, Loc) \ -+ fprintf (File, "%d.%d-%d.%d", \ -+ (Loc).first_line, (Loc).first_column, \ -+ (Loc).last_line, (Loc).last_column) -+# else -+# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -+# endif -+#endif - --/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ - --YY_ATTRIBUTE_UNUSED --static unsigned --yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) --{ -- unsigned res = 0; -- int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; -- if (0 <= yylocp->first_line) -- { -- res += YYFPRINTF (yyo, "%d", yylocp->first_line); -- if (0 <= yylocp->first_column) -- res += YYFPRINTF (yyo, ".%d", yylocp->first_column); -- } -- if (0 <= yylocp->last_line) -- { -- if (yylocp->first_line < yylocp->last_line) -- { -- res += YYFPRINTF (yyo, "-%d", yylocp->last_line); -- if (0 <= end_col) -- res += YYFPRINTF (yyo, ".%d", end_col); -- } -- else if (0 <= end_col && yylocp->first_column < end_col) -- res += YYFPRINTF (yyo, "-%d", end_col); -- } -- return res; -- } -+/* YYLEX -- calling `yylex' with the right arguments. */ - --# define YY_LOCATION_PRINT(File, Loc) \ -- yy_location_print_ (File, &(Loc)) -+#ifdef YYLEX_PARAM -+# define YYLEX yylex (YYLEX_PARAM) -+#else -+# define YYLEX yylex () -+#endif - --# else --# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -+/* Enable debugging if requested. */ -+#if YYDEBUG -+ -+# ifndef YYFPRINTF -+# include /* INFRINGES ON USER NAME SPACE */ -+# define YYFPRINTF fprintf - # endif --#endif - -+# define YYDPRINTF(Args) \ -+do { \ -+ if (yydebug) \ -+ YYFPRINTF Args; \ -+} while (YYID (0)) - --# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ --do { \ -- if (yydebug) \ -- { \ -- YYFPRINTF (stderr, "%s ", Title); \ -- yy_symbol_print (stderr, \ -- Type, Value, Location); \ -- YYFPRINTF (stderr, "\n"); \ -- } \ --} while (0) -+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -+do { \ -+ if (yydebug) \ -+ { \ -+ YYFPRINTF (stderr, "%s ", Title); \ -+ yy_symbol_print (stderr, \ -+ Type, Value, Location); \ -+ YYFPRINTF (stderr, "\n"); \ -+ } \ -+} while (YYID (0)) - - --/*----------------------------------------. --| Print this symbol's value on YYOUTPUT. | --`----------------------------------------*/ -+/*--------------------------------. -+| Print this symbol on YYOUTPUT. | -+`--------------------------------*/ - -+/*ARGSUSED*/ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static void - yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) -+#else -+static void -+yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp) -+ FILE *yyoutput; -+ int yytype; -+ YYSTYPE const * const yyvaluep; -+ YYLTYPE const * const yylocationp; -+#endif - { -- FILE *yyo = yyoutput; -- YYUSE (yyo); -- YYUSE (yylocationp); - if (!yyvaluep) - return; -+ YYUSE (yylocationp); - # ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -+# else -+ YYUSE (yyoutput); - # endif -- YYUSE (yytype); -+ switch (yytype) -+ { -+ default: -+ break; -+ } - } - - -@@ -853,11 +874,23 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue - | Print this symbol on YYOUTPUT. | - `--------------------------------*/ - -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static void - yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) -+#else -+static void -+yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) -+ FILE *yyoutput; -+ int yytype; -+ YYSTYPE const * const yyvaluep; -+ YYLTYPE const * const yylocationp; -+#endif - { -- YYFPRINTF (yyoutput, "%s %s (", -- yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); -+ if (yytype < YYNTOKENS) -+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); -+ else -+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - YY_LOCATION_PRINT (yyoutput, *yylocationp); - YYFPRINTF (yyoutput, ": "); -@@ -870,8 +903,16 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYL - | TOP (included). | - `------------------------------------------------------------------*/ - -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static void - yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -+#else -+static void -+yy_stack_print (yybottom, yytop) -+ yytype_int16 *yybottom; -+ yytype_int16 *yytop; -+#endif - { - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) -@@ -882,42 +923,50 @@ yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) - YYFPRINTF (stderr, "\n"); - } - --# define YY_STACK_PRINT(Bottom, Top) \ --do { \ -- if (yydebug) \ -- yy_stack_print ((Bottom), (Top)); \ --} while (0) -+# define YY_STACK_PRINT(Bottom, Top) \ -+do { \ -+ if (yydebug) \ -+ yy_stack_print ((Bottom), (Top)); \ -+} while (YYID (0)) - - - /*------------------------------------------------. - | Report that the YYRULE is going to be reduced. | - `------------------------------------------------*/ - -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static void --yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) -+yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) -+#else -+static void -+yy_reduce_print (yyvsp, yylsp, yyrule) -+ YYSTYPE *yyvsp; -+ YYLTYPE *yylsp; -+ int yyrule; -+#endif - { -- unsigned long int yylno = yyrline[yyrule]; - int yynrhs = yyr2[yyrule]; - int yyi; -+ unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", -- yyrule - 1, yylno); -+ yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); -- yy_symbol_print (stderr, -- yystos[yyssp[yyi + 1 - yynrhs]], -- &(yyvsp[(yyi + 1) - (yynrhs)]) -- , &(yylsp[(yyi + 1) - (yynrhs)]) ); -+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], -+ &(yyvsp[(yyi + 1) - (yynrhs)]) -+ , &(yylsp[(yyi + 1) - (yynrhs)]) ); - YYFPRINTF (stderr, "\n"); - } - } - --# define YY_REDUCE_PRINT(Rule) \ --do { \ -- if (yydebug) \ -- yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \ --} while (0) -+# define YY_REDUCE_PRINT(Rule) \ -+do { \ -+ if (yydebug) \ -+ yy_reduce_print (yyvsp, yylsp, Rule); \ -+} while (YYID (0)) - - /* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -@@ -931,7 +980,7 @@ int yydebug; - - - /* YYINITDEPTH -- initial size of the parser's stacks. */ --#ifndef YYINITDEPTH -+#ifndef YYINITDEPTH - # define YYINITDEPTH 200 - #endif - -@@ -946,6 +995,7 @@ int yydebug; - # define YYMAXDEPTH 10000 - #endif - -+ - - #if YYERROR_VERBOSE - -@@ -954,8 +1004,15 @@ int yydebug; - # define yystrlen strlen - # else - /* Return the length of YYSTR. */ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static YYSIZE_T - yystrlen (const char *yystr) -+#else -+static YYSIZE_T -+yystrlen (yystr) -+ const char *yystr; -+#endif - { - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) -@@ -971,8 +1028,16 @@ yystrlen (const char *yystr) - # else - /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static char * - yystpcpy (char *yydest, const char *yysrc) -+#else -+static char * -+yystpcpy (yydest, yysrc) -+ char *yydest; -+ const char *yysrc; -+#endif - { - char *yyd = yydest; - const char *yys = yysrc; -@@ -1002,27 +1067,27 @@ yytnamerr (char *yyres, const char *yystr) - char const *yyp = yystr; - - for (;;) -- switch (*++yyp) -- { -- case '\'': -- case ',': -- goto do_not_strip_quotes; -- -- case '\\': -- if (*++yyp != '\\') -- goto do_not_strip_quotes; -- /* Fall through. */ -- default: -- if (yyres) -- yyres[yyn] = *yyp; -- yyn++; -- break; -- -- case '"': -- if (yyres) -- yyres[yyn] = '\0'; -- return yyn; -- } -+ switch (*++yyp) -+ { -+ case '\'': -+ case ',': -+ goto do_not_strip_quotes; -+ -+ case '\\': -+ if (*++yyp != '\\') -+ goto do_not_strip_quotes; -+ /* Fall through. */ -+ default: -+ if (yyres) -+ yyres[yyn] = *yyp; -+ yyn++; -+ break; -+ -+ case '"': -+ if (yyres) -+ yyres[yyn] = '\0'; -+ return yyn; -+ } - do_not_strip_quotes: ; - } - -@@ -1033,161 +1098,163 @@ yytnamerr (char *yyres, const char *yystr) - } - # endif - --/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message -- about the unexpected token YYTOKEN for the state stack whose top is -- YYSSP. -- -- Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is -- not large enough to hold the message. In that case, also set -- *YYMSG_ALLOC to the required number of bytes. Return 2 if the -- required number of bytes is too large to store. */ --static int --yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, -- yytype_int16 *yyssp, int yytoken) -+/* Copy into YYRESULT an error message about the unexpected token -+ YYCHAR while in state YYSTATE. Return the number of bytes copied, -+ including the terminating null byte. If YYRESULT is null, do not -+ copy anything; just return the number of bytes that would be -+ copied. As a special case, return 0 if an ordinary "syntax error" -+ message will do. Return YYSIZE_MAXIMUM if overflow occurs during -+ size calculation. */ -+static YYSIZE_T -+yysyntax_error (char *yyresult, int yystate, int yychar) - { -- YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); -- YYSIZE_T yysize = yysize0; -- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; -- /* Internationalized format string. */ -- const char *yyformat = YY_NULLPTR; -- /* Arguments of yyformat. */ -- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; -- /* Number of reported tokens (one for the "unexpected", one per -- "expected"). */ -- int yycount = 0; -- -- /* There are many possibilities here to consider: -- - If this state is a consistent state with a default action, then -- the only way this function was invoked is if the default action -- is an error action. In that case, don't check for expected -- tokens because there are none. -- - The only way there can be no lookahead present (in yychar) is if -- this state is a consistent state with a default action. Thus, -- detecting the absence of a lookahead is sufficient to determine -- that there is no unexpected or expected token to report. In that -- case, just report a simple "syntax error". -- - Don't assume there isn't a lookahead just because this state is a -- consistent state with a default action. There might have been a -- previous inconsistent state, consistent state with a non-default -- action, or user semantic action that manipulated yychar. -- - Of course, the expected token list depends on states to have -- correct lookahead information, and it depends on the parser not -- to perform extra reductions after fetching a lookahead from the -- scanner and before detecting a syntax error. Thus, state merging -- (from LALR or IELR) and default reductions corrupt the expected -- token list. However, the list is correct for canonical LR with -- one exception: it will still contain any token that will not be -- accepted due to an error action in a later state. -- */ -- if (yytoken != YYEMPTY) -- { -- int yyn = yypact[*yyssp]; -- yyarg[yycount++] = yytname[yytoken]; -- if (!yypact_value_is_default (yyn)) -- { -- /* Start YYX at -YYN if negative to avoid negative indexes in -- YYCHECK. In other words, skip the first -YYN actions for -- this state because they are default actions. */ -- int yyxbegin = yyn < 0 ? -yyn : 0; -- /* Stay within bounds of both yycheck and yytname. */ -- int yychecklim = YYLAST - yyn + 1; -- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; -- int yyx; -- -- for (yyx = yyxbegin; yyx < yyxend; ++yyx) -- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR -- && !yytable_value_is_error (yytable[yyx + yyn])) -- { -- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) -- { -- yycount = 1; -- yysize = yysize0; -- break; -- } -- yyarg[yycount++] = yytname[yyx]; -- { -- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); -- if (! (yysize <= yysize1 -- && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) -- return 2; -- yysize = yysize1; -- } -- } -- } -- } -- -- switch (yycount) -- { --# define YYCASE_(N, S) \ -- case N: \ -- yyformat = S; \ -- break -- YYCASE_(0, YY_("syntax error")); -- YYCASE_(1, YY_("syntax error, unexpected %s")); -- YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); -- YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); -- YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); -- YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); --# undef YYCASE_ -- } -+ int yyn = yypact[yystate]; - -- { -- YYSIZE_T yysize1 = yysize + yystrlen (yyformat); -- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) -- return 2; -- yysize = yysize1; -- } -- -- if (*yymsg_alloc < yysize) -+ if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) -+ return 0; -+ else - { -- *yymsg_alloc = 2 * yysize; -- if (! (yysize <= *yymsg_alloc -- && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) -- *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; -- return 1; -+ int yytype = YYTRANSLATE (yychar); -+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); -+ YYSIZE_T yysize = yysize0; -+ YYSIZE_T yysize1; -+ int yysize_overflow = 0; -+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; -+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; -+ int yyx; -+ -+# if 0 -+ /* This is so xgettext sees the translatable formats that are -+ constructed on the fly. */ -+ YY_("syntax error, unexpected %s"); -+ YY_("syntax error, unexpected %s, expecting %s"); -+ YY_("syntax error, unexpected %s, expecting %s or %s"); -+ YY_("syntax error, unexpected %s, expecting %s or %s or %s"); -+ YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -+# endif -+ char *yyfmt; -+ char const *yyf; -+ static char const yyunexpected[] = "syntax error, unexpected %s"; -+ static char const yyexpecting[] = ", expecting %s"; -+ static char const yyor[] = " or %s"; -+ char yyformat[sizeof yyunexpected -+ + sizeof yyexpecting - 1 -+ + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) -+ * (sizeof yyor - 1))]; -+ char const *yyprefix = yyexpecting; -+ -+ /* Start YYX at -YYN if negative to avoid negative indexes in -+ YYCHECK. */ -+ int yyxbegin = yyn < 0 ? -yyn : 0; -+ -+ /* Stay within bounds of both yycheck and yytname. */ -+ int yychecklim = YYLAST - yyn + 1; -+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; -+ int yycount = 1; -+ -+ yyarg[0] = yytname[yytype]; -+ yyfmt = yystpcpy (yyformat, yyunexpected); -+ -+ for (yyx = yyxbegin; yyx < yyxend; ++yyx) -+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) -+ { -+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) -+ { -+ yycount = 1; -+ yysize = yysize0; -+ yyformat[sizeof yyunexpected - 1] = '\0'; -+ break; -+ } -+ yyarg[yycount++] = yytname[yyx]; -+ yysize1 = yysize + yytnamerr (0, yytname[yyx]); -+ yysize_overflow |= (yysize1 < yysize); -+ yysize = yysize1; -+ yyfmt = yystpcpy (yyfmt, yyprefix); -+ yyprefix = yyor; -+ } -+ -+ yyf = YY_(yyformat); -+ yysize1 = yysize + yystrlen (yyf); -+ yysize_overflow |= (yysize1 < yysize); -+ yysize = yysize1; -+ -+ if (yysize_overflow) -+ return YYSIZE_MAXIMUM; -+ -+ if (yyresult) -+ { -+ /* Avoid sprintf, as that infringes on the user's name space. -+ Don't have undefined behavior even if the translation -+ produced a string with the wrong number of "%s"s. */ -+ char *yyp = yyresult; -+ int yyi = 0; -+ while ((*yyp = *yyf) != '\0') -+ { -+ if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) -+ { -+ yyp += yytnamerr (yyp, yyarg[yyi++]); -+ yyf += 2; -+ } -+ else -+ { -+ yyp++; -+ yyf++; -+ } -+ } -+ } -+ return yysize; - } -- -- /* Avoid sprintf, as that infringes on the user's name space. -- Don't have undefined behavior even if the translation -- produced a string with the wrong number of "%s"s. */ -- { -- char *yyp = *yymsg; -- int yyi = 0; -- while ((*yyp = *yyformat) != '\0') -- if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) -- { -- yyp += yytnamerr (yyp, yyarg[yyi++]); -- yyformat += 2; -- } -- else -- { -- yyp++; -- yyformat++; -- } -- } -- return 0; - } - #endif /* YYERROR_VERBOSE */ -+ - - /*-----------------------------------------------. - | Release the memory associated to this symbol. | - `-----------------------------------------------*/ - -+/*ARGSUSED*/ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - static void - yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) -+#else -+static void -+yydestruct (yymsg, yytype, yyvaluep, yylocationp) -+ const char *yymsg; -+ int yytype; -+ YYSTYPE *yyvaluep; -+ YYLTYPE *yylocationp; -+#endif - { - YYUSE (yyvaluep); - YYUSE (yylocationp); -+ - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - -- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -- YYUSE (yytype); -- YY_IGNORE_MAYBE_UNINITIALIZED_END --} -+ switch (yytype) -+ { - -+ default: -+ break; -+ } -+} - -+/* Prevent warnings from -Wmissing-prototypes. */ -+#ifdef YYPARSE_PARAM -+#if defined __STDC__ || defined __cplusplus -+int yyparse (void *YYPARSE_PARAM); -+#else -+int yyparse (); -+#endif -+#else /* ! YYPARSE_PARAM */ -+#if defined __STDC__ || defined __cplusplus -+int yyparse (void); -+#else -+int yyparse (); -+#endif -+#endif /* ! YYPARSE_PARAM */ - - - /* The lookahead symbol. */ -@@ -1195,33 +1262,53 @@ int yychar; - - /* The semantic value of the lookahead symbol. */ - YYSTYPE yylval; -+ - /* Location data for the lookahead symbol. */ --YYLTYPE yylloc --# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -- = { 1, 1, 1, 1 } --# endif --; -+YYLTYPE yylloc; -+ - /* Number of syntax errors so far. */ - int yynerrs; - - --/*----------. --| yyparse. | --`----------*/ - -+/*-------------------------. -+| yyparse or yypush_parse. | -+`-------------------------*/ -+ -+#ifdef YYPARSE_PARAM -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) -+int -+yyparse (void *YYPARSE_PARAM) -+#else -+int -+yyparse (YYPARSE_PARAM) -+ void *YYPARSE_PARAM; -+#endif -+#else /* ! YYPARSE_PARAM */ -+#if (defined __STDC__ || defined __C99__FUNC__ \ -+ || defined __cplusplus || defined _MSC_VER) - int - yyparse (void) -+#else -+int -+yyparse () -+ -+#endif -+#endif - { -+ -+ - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: -- 'yyss': related to states. -- 'yyvs': related to semantic values. -- 'yyls': related to locations. -+ `yyss': related to states. -+ `yyvs': related to semantic values. -+ `yyls': related to locations. - -- Refer to the stacks through separate pointers, to allow yyoverflow -+ Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ -@@ -1240,14 +1327,14 @@ yyparse (void) - YYLTYPE *yylsp; - - /* The locations where the error started and ended. */ -- YYLTYPE yyerror_range[3]; -+ YYLTYPE yyerror_range[2]; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ -- int yytoken = 0; -+ int yytoken; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; -@@ -1266,9 +1353,10 @@ yyparse (void) - Keep to zero when no symbol should be popped. */ - int yylen = 0; - -- yyssp = yyss = yyssa; -- yyvsp = yyvs = yyvsa; -- yylsp = yyls = yylsa; -+ yytoken = 0; -+ yyss = yyssa; -+ yyvs = yyvsa; -+ yyls = yylsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); -@@ -1277,7 +1365,21 @@ yyparse (void) - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ -- yylsp[0] = yylloc; -+ -+ /* Initialize stack pointers. -+ Waste one element of value and location stack -+ so that they stay on the same level as the state stack. -+ The wasted elements are never initialized. */ -+ yyssp = yyss; -+ yyvsp = yyvs; -+ yylsp = yyls; -+ -+#if YYLTYPE_IS_TRIVIAL -+ /* Initialize the default location before parsing starts. */ -+ yylloc.first_line = yylloc.last_line = 1; -+ yylloc.first_column = yylloc.last_column = 1; -+#endif -+ - goto yysetstate; - - /*------------------------------------------------------------. -@@ -1298,26 +1400,26 @@ yyparse (void) - - #ifdef yyoverflow - { -- /* Give user a chance to reallocate the stack. Use copies of -- these so that the &'s don't force the real ones into -- memory. */ -- YYSTYPE *yyvs1 = yyvs; -- yytype_int16 *yyss1 = yyss; -- YYLTYPE *yyls1 = yyls; -- -- /* Each stack pointer address is followed by the size of the -- data in use in that stack, in bytes. This used to be a -- conditional around just the two extra args, but that might -- be undefined if yyoverflow is a macro. */ -- yyoverflow (YY_("memory exhausted"), -- &yyss1, yysize * sizeof (*yyssp), -- &yyvs1, yysize * sizeof (*yyvsp), -- &yyls1, yysize * sizeof (*yylsp), -- &yystacksize); -- -- yyls = yyls1; -- yyss = yyss1; -- yyvs = yyvs1; -+ /* Give user a chance to reallocate the stack. Use copies of -+ these so that the &'s don't force the real ones into -+ memory. */ -+ YYSTYPE *yyvs1 = yyvs; -+ yytype_int16 *yyss1 = yyss; -+ YYLTYPE *yyls1 = yyls; -+ -+ /* Each stack pointer address is followed by the size of the -+ data in use in that stack, in bytes. This used to be a -+ conditional around just the two extra args, but that might -+ be undefined if yyoverflow is a macro. */ -+ yyoverflow (YY_("memory exhausted"), -+ &yyss1, yysize * sizeof (*yyssp), -+ &yyvs1, yysize * sizeof (*yyvsp), -+ &yyls1, yysize * sizeof (*yylsp), -+ &yystacksize); -+ -+ yyls = yyls1; -+ yyss = yyss1; -+ yyvs = yyvs1; - } - #else /* no yyoverflow */ - # ifndef YYSTACK_RELOCATE -@@ -1325,23 +1427,23 @@ yyparse (void) - # else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) -- goto yyexhaustedlab; -+ goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) -- yystacksize = YYMAXDEPTH; -+ yystacksize = YYMAXDEPTH; - - { -- yytype_int16 *yyss1 = yyss; -- union yyalloc *yyptr = -- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); -- if (! yyptr) -- goto yyexhaustedlab; -- YYSTACK_RELOCATE (yyss_alloc, yyss); -- YYSTACK_RELOCATE (yyvs_alloc, yyvs); -- YYSTACK_RELOCATE (yyls_alloc, yyls); -+ yytype_int16 *yyss1 = yyss; -+ union yyalloc *yyptr = -+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); -+ if (! yyptr) -+ goto yyexhaustedlab; -+ YYSTACK_RELOCATE (yyss_alloc, yyss); -+ YYSTACK_RELOCATE (yyvs_alloc, yyvs); -+ YYSTACK_RELOCATE (yyls_alloc, yyls); - # undef YYSTACK_RELOCATE -- if (yyss1 != yyssa) -- YYSTACK_FREE (yyss1); -+ if (yyss1 != yyssa) -+ YYSTACK_FREE (yyss1); - } - # endif - #endif /* no yyoverflow */ -@@ -1351,10 +1453,10 @@ yyparse (void) - yylsp = yyls + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", -- (unsigned long int) yystacksize)); -+ (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) -- YYABORT; -+ YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); -@@ -1374,7 +1476,7 @@ yybackup: - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; -- if (yypact_value_is_default (yyn)) -+ if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ -@@ -1383,7 +1485,7 @@ yybackup: - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); -- yychar = yylex (); -+ yychar = YYLEX; - } - - if (yychar <= YYEOF) -@@ -1405,8 +1507,8 @@ yybackup: - yyn = yytable[yyn]; - if (yyn <= 0) - { -- if (yytable_value_is_error (yyn)) -- goto yyerrlab; -+ if (yyn == 0 || yyn == YYTABLE_NINF) -+ goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } -@@ -1423,9 +1525,7 @@ yybackup: - yychar = YYEMPTY; - - yystate = yyn; -- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; -- YY_IGNORE_MAYBE_UNINITIALIZED_END - *++yylsp = yylloc; - goto yynewstate; - -@@ -1448,7 +1548,7 @@ yyreduce: - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: -- '$$ = $1'. -+ `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison -@@ -1462,298 +1562,376 @@ yyreduce: - YY_REDUCE_PRINT (yyn); - switch (yyn) - { -- case 2: --#line 105 "dtc-parser.y" /* yacc.c:1646 */ -- { -- the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node), -- guess_boot_cpuid((yyvsp[0].node))); -- } --#line 1472 "dtc-parser.tab.c" /* yacc.c:1646 */ -- break; -+ case 4: - -- case 3: --#line 113 "dtc-parser.y" /* yacc.c:1646 */ -+/* Line 1455 of yacc.c */ -+#line 114 "dtc-parser.y" - { -- (yyval.re) = NULL; -- } --#line 1480 "dtc-parser.tab.c" /* yacc.c:1646 */ -- break; -- -- case 4: --#line 117 "dtc-parser.y" /* yacc.c:1646 */ -- { -- (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); -- } --#line 1488 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ source_is_plugin = (yyvsp[(3) - (5)].is_plugin); -+ if (source_is_plugin) -+ deprecated_plugin_syntax_warning = true; -+ the_boot_info = build_boot_info((yyvsp[(4) - (5)].re), (yyvsp[(5) - (5)].node), -+ guess_boot_cpuid((yyvsp[(5) - (5)].node))); -+ ;} - break; - - case 5: --#line 124 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 125 "dtc-parser.y" - { -- (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); -- } --#line 1496 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.is_plugin) = false; -+ ;} - break; - - case 6: --#line 128 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 129 "dtc-parser.y" - { -- add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref)); -- (yyval.re) = (yyvsp[0].re); -- } --#line 1505 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.is_plugin) = true; -+ ;} - break; - - case 7: --#line 136 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 136 "dtc-parser.y" - { -- (yyval.node) = name_node((yyvsp[0].node), ""); -- } --#line 1513 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ source_is_plugin = true; -+ deprecated_plugin_syntax_warning = false; -+ the_boot_info = build_boot_info((yyvsp[(4) - (5)].re), (yyvsp[(5) - (5)].node), -+ guess_boot_cpuid((yyvsp[(5) - (5)].node))); -+ ;} - break; - - case 8: --#line 140 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 146 "dtc-parser.y" - { -- (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node)); -- } --#line 1521 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.re) = NULL; -+ ;} - break; - - case 9: --#line 145 "dtc-parser.y" /* yacc.c:1646 */ -- { -- struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); - -- add_label(&target->labels, (yyvsp[-2].labelref)); -- if (target) -- merge_nodes(target, (yyvsp[0].node)); -- else -- ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); -- (yyval.node) = (yyvsp[-3].node); -- } --#line 1536 "dtc-parser.tab.c" /* yacc.c:1646 */ -+/* Line 1455 of yacc.c */ -+#line 150 "dtc-parser.y" -+ { -+ (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); -+ ;} - break; - - case 10: --#line 156 "dtc-parser.y" /* yacc.c:1646 */ -- { -- struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref)); - -- if (target) -- merge_nodes(target, (yyvsp[0].node)); -- else -- ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); -- (yyval.node) = (yyvsp[-2].node); -- } --#line 1550 "dtc-parser.tab.c" /* yacc.c:1646 */ -+/* Line 1455 of yacc.c */ -+#line 157 "dtc-parser.y" -+ { -+ (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer)); -+ ;} - break; - - case 11: --#line 166 "dtc-parser.y" /* yacc.c:1646 */ -- { -- struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); -- -- if (target) -- delete_node(target); -- else -- ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); - -- -- (yyval.node) = (yyvsp[-3].node); -- } --#line 1566 "dtc-parser.tab.c" /* yacc.c:1646 */ -+/* Line 1455 of yacc.c */ -+#line 161 "dtc-parser.y" -+ { -+ add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref)); -+ (yyval.re) = (yyvsp[(2) - (2)].re); -+ ;} - break; - - case 12: --#line 181 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 169 "dtc-parser.y" - { -- (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist)); -- } --#line 1574 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.node) = name_node((yyvsp[(2) - (2)].node), ""); -+ ;} - break; - - case 13: --#line 188 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 173 "dtc-parser.y" - { -- (yyval.proplist) = NULL; -- } --#line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); -+ ;} - break; - - case 14: --#line 192 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 178 "dtc-parser.y" - { -- (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist)); -- } --#line 1590 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref)); -+ -+ add_label(&target->labels, (yyvsp[(2) - (4)].labelref)); -+ if (target) -+ merge_nodes(target, (yyvsp[(4) - (4)].node)); -+ else -+ ERROR(&(yylsp[(3) - (4)]), "Label or path %s not found", (yyvsp[(3) - (4)].labelref)); -+ (yyval.node) = (yyvsp[(1) - (4)].node); -+ ;} - break; - - case 15: --#line 199 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 189 "dtc-parser.y" - { -- (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data)); -- } --#line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref)); -+ -+ if (target) { -+ merge_nodes(target, (yyvsp[(3) - (3)].node)); -+ } else { -+ if (symbol_fixup_support) -+ add_orphan_node((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yyvsp[(2) - (3)].labelref)); -+ else -+ ERROR(&(yylsp[(2) - (3)]), "Label or path %s not found", (yyvsp[(2) - (3)].labelref)); -+ } -+ (yyval.node) = (yyvsp[(1) - (3)].node); -+ ;} - break; - - case 16: --#line 203 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 203 "dtc-parser.y" - { -- (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data); -- } --#line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref)); -+ -+ if (target) -+ delete_node(target); -+ else -+ ERROR(&(yylsp[(3) - (4)]), "Label or path %s not found", (yyvsp[(3) - (4)].labelref)); -+ -+ -+ (yyval.node) = (yyvsp[(1) - (4)].node); -+ ;} - break; - - case 17: --#line 207 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 215 "dtc-parser.y" - { -- (yyval.prop) = build_property_delete((yyvsp[-1].propnodename)); -- } --#line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ /* build empty node */ -+ (yyval.node) = name_node(build_node(NULL, NULL), ""); -+ ;} - break; - - case 18: --#line 211 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 223 "dtc-parser.y" - { -- add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref)); -- (yyval.prop) = (yyvsp[0].prop); -- } --#line 1623 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); -+ ;} - break; - - case 19: --#line 219 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 230 "dtc-parser.y" - { -- (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data)); -- } --#line 1631 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.proplist) = NULL; -+ ;} - break; - - case 20: --#line 223 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 234 "dtc-parser.y" - { -- (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data); -- } --#line 1639 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); -+ ;} - break; - - case 21: --#line 227 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 241 "dtc-parser.y" - { -- (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data)); -- } --#line 1647 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data)); -+ ;} - break; - - case 22: --#line 231 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 245 "dtc-parser.y" - { -- (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref)); -- } --#line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data); -+ ;} - break; - - case 23: --#line 235 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 249 "dtc-parser.y" -+ { -+ (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename)); -+ ;} -+ break; -+ -+ case 24: -+ -+/* Line 1455 of yacc.c */ -+#line 253 "dtc-parser.y" -+ { -+ add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref)); -+ (yyval.prop) = (yyvsp[(2) - (2)].prop); -+ ;} -+ break; -+ -+ case 25: -+ -+/* Line 1455 of yacc.c */ -+#line 261 "dtc-parser.y" -+ { -+ (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); -+ ;} -+ break; -+ -+ case 26: -+ -+/* Line 1455 of yacc.c */ -+#line 265 "dtc-parser.y" -+ { -+ (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data); -+ ;} -+ break; -+ -+ case 27: -+ -+/* Line 1455 of yacc.c */ -+#line 269 "dtc-parser.y" -+ { -+ (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); -+ ;} -+ break; -+ -+ case 28: -+ -+/* Line 1455 of yacc.c */ -+#line 273 "dtc-parser.y" -+ { -+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); -+ ;} -+ break; -+ -+ case 29: -+ -+/* Line 1455 of yacc.c */ -+#line 277 "dtc-parser.y" - { -- FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL); -+ FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL); - struct data d; - -- if ((yyvsp[-3].integer) != 0) -- if (fseek(f, (yyvsp[-3].integer), SEEK_SET) != 0) -+ if ((yyvsp[(6) - (9)].integer) != 0) -+ if (fseek(f, (yyvsp[(6) - (9)].integer), SEEK_SET) != 0) - die("Couldn't seek to offset %llu in \"%s\": %s", -- (unsigned long long)(yyvsp[-3].integer), (yyvsp[-5].data).val, -+ (unsigned long long)(yyvsp[(6) - (9)].integer), (yyvsp[(4) - (9)].data).val, - strerror(errno)); - -- d = data_copy_file(f, (yyvsp[-1].integer)); -+ d = data_copy_file(f, (yyvsp[(8) - (9)].integer)); - -- (yyval.data) = data_merge((yyvsp[-8].data), d); -+ (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d); - fclose(f); -- } --#line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ ;} - break; - -- case 24: --#line 251 "dtc-parser.y" /* yacc.c:1646 */ -+ case 30: -+ -+/* Line 1455 of yacc.c */ -+#line 293 "dtc-parser.y" - { -- FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL); -+ FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL); - struct data d = empty_data; - - d = data_copy_file(f, -1); - -- (yyval.data) = data_merge((yyvsp[-4].data), d); -+ (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d); - fclose(f); -- } --#line 1689 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ ;} - break; - -- case 25: --#line 261 "dtc-parser.y" /* yacc.c:1646 */ -+ case 31: -+ -+/* Line 1455 of yacc.c */ -+#line 303 "dtc-parser.y" - { -- (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); -- } --#line 1697 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); -+ ;} - break; - -- case 26: --#line 268 "dtc-parser.y" /* yacc.c:1646 */ -+ case 32: -+ -+/* Line 1455 of yacc.c */ -+#line 310 "dtc-parser.y" - { - (yyval.data) = empty_data; -- } --#line 1705 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ ;} - break; - -- case 27: --#line 272 "dtc-parser.y" /* yacc.c:1646 */ -+ case 33: -+ -+/* Line 1455 of yacc.c */ -+#line 314 "dtc-parser.y" - { -- (yyval.data) = (yyvsp[-1].data); -- } --#line 1713 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.data) = (yyvsp[(1) - (2)].data); -+ ;} - break; - -- case 28: --#line 276 "dtc-parser.y" /* yacc.c:1646 */ -+ case 34: -+ -+/* Line 1455 of yacc.c */ -+#line 318 "dtc-parser.y" - { -- (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); -- } --#line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); -+ ;} - break; - -- case 29: --#line 283 "dtc-parser.y" /* yacc.c:1646 */ -+ case 35: -+ -+/* Line 1455 of yacc.c */ -+#line 325 "dtc-parser.y" - { - unsigned long long bits; - -- bits = (yyvsp[-1].integer); -+ bits = (yyvsp[(2) - (3)].integer); - - if ((bits != 8) && (bits != 16) && - (bits != 32) && (bits != 64)) { -- ERROR(&(yylsp[-1]), "Array elements must be" -+ ERROR(&(yylsp[(2) - (3)]), "Array elements must be" - " 8, 16, 32 or 64-bits"); - bits = 32; - } - - (yyval.array).data = empty_data; - (yyval.array).bits = bits; -- } --#line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ ;} - break; - -- case 30: --#line 299 "dtc-parser.y" /* yacc.c:1646 */ -+ case 36: -+ -+/* Line 1455 of yacc.c */ -+#line 341 "dtc-parser.y" - { - (yyval.array).data = empty_data; - (yyval.array).bits = 32; -- } --#line 1750 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ ;} - break; - -- case 31: --#line 304 "dtc-parser.y" /* yacc.c:1646 */ -+ case 37: -+ -+/* Line 1455 of yacc.c */ -+#line 346 "dtc-parser.y" - { -- if ((yyvsp[-1].array).bits < 64) { -- uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1; -+ if ((yyvsp[(1) - (2)].array).bits < 64) { -+ uint64_t mask = (1ULL << (yyvsp[(1) - (2)].array).bits) - 1; - /* - * Bits above mask must either be all zero - * (positive within range of mask) or all one -@@ -1762,285 +1940,295 @@ yyreduce: - * within the mask to one (i.e. | in the - * mask), all bits are one. - */ -- if (((yyvsp[0].integer) > mask) && (((yyvsp[0].integer) | mask) != -1ULL)) -- ERROR(&(yylsp[0]), "Value out of range for" -- " %d-bit array element", (yyvsp[-1].array).bits); -+ if (((yyvsp[(2) - (2)].integer) > mask) && (((yyvsp[(2) - (2)].integer) | mask) != -1ULL)) -+ ERROR(&(yylsp[(2) - (2)]), "Value out of range for" -+ " %d-bit array element", (yyvsp[(1) - (2)].array).bits); - } - -- (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits); -- } --#line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits); -+ ;} - break; - -- case 32: --#line 323 "dtc-parser.y" /* yacc.c:1646 */ -+ case 38: -+ -+/* Line 1455 of yacc.c */ -+#line 365 "dtc-parser.y" - { -- uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits); -+ uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits); - -- if ((yyvsp[-1].array).bits == 32) -- (yyvsp[-1].array).data = data_add_marker((yyvsp[-1].array).data, -+ if ((yyvsp[(1) - (2)].array).bits == 32) -+ (yyvsp[(1) - (2)].array).data = data_add_marker((yyvsp[(1) - (2)].array).data, - REF_PHANDLE, -- (yyvsp[0].labelref)); -+ (yyvsp[(2) - (2)].labelref)); - else -- ERROR(&(yylsp[0]), "References are only allowed in " -+ ERROR(&(yylsp[(2) - (2)]), "References are only allowed in " - "arrays with 32-bit elements."); - -- (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits); -- } --#line 1791 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits); -+ ;} - break; - -- case 33: --#line 337 "dtc-parser.y" /* yacc.c:1646 */ -- { -- (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref)); -- } --#line 1799 "dtc-parser.tab.c" /* yacc.c:1646 */ -- break; -+ case 39: - -- case 36: --#line 346 "dtc-parser.y" /* yacc.c:1646 */ -+/* Line 1455 of yacc.c */ -+#line 379 "dtc-parser.y" - { -- (yyval.integer) = (yyvsp[-1].integer); -- } --#line 1807 "dtc-parser.tab.c" /* yacc.c:1646 */ -- break; -- -- case 39: --#line 357 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); } --#line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref)); -+ ;} - break; - -- case 41: --#line 362 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); } --#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ -- break; -+ case 42: - -- case 43: --#line 367 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); } --#line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */ -+/* Line 1455 of yacc.c */ -+#line 388 "dtc-parser.y" -+ { -+ (yyval.integer) = (yyvsp[(2) - (3)].integer); -+ ;} - break; - - case 45: --#line 372 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); } --#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 399 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); ;} - break; - - case 47: --#line 377 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); } --#line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 404 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); ;} - break; - - case 49: --#line 382 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); } --#line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 409 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); ;} - break; - - case 51: --#line 387 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); } --#line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */ -- break; - -- case 52: --#line 388 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); } --#line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */ -+/* Line 1455 of yacc.c */ -+#line 414 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); ;} - break; - -- case 54: --#line 393 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); } --#line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 53: -+ -+/* Line 1455 of yacc.c */ -+#line 419 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); ;} - break; - - case 55: --#line 394 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); } --#line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */ -- break; - -- case 56: --#line 395 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); } --#line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */ -+/* Line 1455 of yacc.c */ -+#line 424 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); ;} - break; - - case 57: --#line 396 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); } --#line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 429 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); ;} - break; - - case 58: --#line 400 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); } --#line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 430 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); ;} - break; - -- case 59: --#line 401 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); } --#line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 60: -+ -+/* Line 1455 of yacc.c */ -+#line 435 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); ;} - break; - - case 61: --#line 406 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); } --#line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 436 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); ;} - break; - - case 62: --#line 407 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); } --#line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 437 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); ;} -+ break; -+ -+ case 63: -+ -+/* Line 1455 of yacc.c */ -+#line 438 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); ;} - break; - - case 64: --#line 412 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); } --#line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 442 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); ;} - break; - - case 65: --#line 414 "dtc-parser.y" /* yacc.c:1646 */ -- { -- if ((yyvsp[0].integer) != 0) { -- (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); -- } else { -- ERROR(&(yyloc), "Division by zero"); -- (yyval.integer) = 0; -- } -- } --#line 1922 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 443 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); ;} - break; - -- case 66: --#line 423 "dtc-parser.y" /* yacc.c:1646 */ -- { -- if ((yyvsp[0].integer) != 0) { -- (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); -- } else { -- ERROR(&(yyloc), "Division by zero"); -- (yyval.integer) = 0; -- } -- } --#line 1935 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 67: -+ -+/* Line 1455 of yacc.c */ -+#line 448 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} - break; - -- case 69: --#line 436 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = -(yyvsp[0].integer); } --#line 1941 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ case 68: -+ -+/* Line 1455 of yacc.c */ -+#line 449 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); ;} - break; - - case 70: --#line 437 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = ~(yyvsp[0].integer); } --#line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 454 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); ;} - break; - - case 71: --#line 438 "dtc-parser.y" /* yacc.c:1646 */ -- { (yyval.integer) = !(yyvsp[0].integer); } --#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 455 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); ;} - break; - - case 72: --#line 443 "dtc-parser.y" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 456 "dtc-parser.y" -+ { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); ;} -+ break; -+ -+ case 75: -+ -+/* Line 1455 of yacc.c */ -+#line 462 "dtc-parser.y" -+ { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} -+ break; -+ -+ case 76: -+ -+/* Line 1455 of yacc.c */ -+#line 463 "dtc-parser.y" -+ { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); ;} -+ break; -+ -+ case 77: -+ -+/* Line 1455 of yacc.c */ -+#line 464 "dtc-parser.y" -+ { (yyval.integer) = !(yyvsp[(2) - (2)].integer); ;} -+ break; -+ -+ case 78: -+ -+/* Line 1455 of yacc.c */ -+#line 469 "dtc-parser.y" - { - (yyval.data) = empty_data; -- } --#line 1961 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ ;} - break; - -- case 73: --#line 447 "dtc-parser.y" /* yacc.c:1646 */ -+ case 79: -+ -+/* Line 1455 of yacc.c */ -+#line 473 "dtc-parser.y" - { -- (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte)); -- } --#line 1969 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); -+ ;} - break; - -- case 74: --#line 451 "dtc-parser.y" /* yacc.c:1646 */ -+ case 80: -+ -+/* Line 1455 of yacc.c */ -+#line 477 "dtc-parser.y" - { -- (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); -- } --#line 1977 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); -+ ;} - break; - -- case 75: --#line 458 "dtc-parser.y" /* yacc.c:1646 */ -+ case 81: -+ -+/* Line 1455 of yacc.c */ -+#line 484 "dtc-parser.y" - { - (yyval.nodelist) = NULL; -- } --#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ ;} - break; - -- case 76: --#line 462 "dtc-parser.y" /* yacc.c:1646 */ -+ case 82: -+ -+/* Line 1455 of yacc.c */ -+#line 488 "dtc-parser.y" - { -- (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist)); -- } --#line 1993 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); -+ ;} - break; - -- case 77: --#line 466 "dtc-parser.y" /* yacc.c:1646 */ -+ case 83: -+ -+/* Line 1455 of yacc.c */ -+#line 492 "dtc-parser.y" - { -- ERROR(&(yylsp[0]), "Properties must precede subnodes"); -+ ERROR(&(yylsp[(2) - (2)]), "Properties must precede subnodes"); - YYERROR; -- } --#line 2002 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ ;} - break; - -- case 78: --#line 474 "dtc-parser.y" /* yacc.c:1646 */ -+ case 84: -+ -+/* Line 1455 of yacc.c */ -+#line 500 "dtc-parser.y" - { -- (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename)); -- } --#line 2010 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename)); -+ ;} - break; - -- case 79: --#line 478 "dtc-parser.y" /* yacc.c:1646 */ -+ case 85: -+ -+/* Line 1455 of yacc.c */ -+#line 504 "dtc-parser.y" - { -- (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename)); -- } --#line 2018 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename)); -+ ;} - break; - -- case 80: --#line 482 "dtc-parser.y" /* yacc.c:1646 */ -+ case 86: -+ -+/* Line 1455 of yacc.c */ -+#line 508 "dtc-parser.y" - { -- add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref)); -- (yyval.node) = (yyvsp[0].node); -- } --#line 2027 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref)); -+ (yyval.node) = (yyvsp[(2) - (2)].node); -+ ;} - break; - - --#line 2031 "dtc-parser.tab.c" /* yacc.c:1646 */ -+ -+/* Line 1455 of yacc.c */ -+#line 2230 "dtc-parser.tab.c" - default: break; - } -- /* User semantic actions sometimes alter yychar, and that requires -- that yytoken be updated with the new translation. We take the -- approach of translating immediately before every use of yytoken. -- One alternative is translating here after every semantic action, -- but that translation would be missed if the semantic action invokes -- YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or -- if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an -- incorrect destructor might then be invoked immediately. In the -- case of YYERROR or YYBACKUP, subsequent parser actions might lead -- to an incorrect destructor call or verbose syntax error message -- before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); -@@ -2050,7 +2238,7 @@ yyreduce: - *++yyvsp = yyval; - *++yylsp = yyloc; - -- /* Now 'shift' the result of the reduction. Determine what state -+ /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - -@@ -2065,14 +2253,10 @@ yyreduce: - goto yynewstate; - - --/*--------------------------------------. --| yyerrlab -- here on detecting error. | --`--------------------------------------*/ -+/*------------------------------------. -+| yyerrlab -- here on detecting error | -+`------------------------------------*/ - yyerrlab: -- /* Make sure we have latest lookahead translation. See comments at -- user semantic actions for why this is necessary. */ -- yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); -- - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { -@@ -2080,58 +2264,59 @@ yyerrlab: - #if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); - #else --# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ -- yyssp, yytoken) - { -- char const *yymsgp = YY_("syntax error"); -- int yysyntax_error_status; -- yysyntax_error_status = YYSYNTAX_ERROR; -- if (yysyntax_error_status == 0) -- yymsgp = yymsg; -- else if (yysyntax_error_status == 1) -- { -- if (yymsg != yymsgbuf) -- YYSTACK_FREE (yymsg); -- yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); -- if (!yymsg) -- { -- yymsg = yymsgbuf; -- yymsg_alloc = sizeof yymsgbuf; -- yysyntax_error_status = 2; -- } -- else -- { -- yysyntax_error_status = YYSYNTAX_ERROR; -- yymsgp = yymsg; -- } -- } -- yyerror (yymsgp); -- if (yysyntax_error_status == 2) -- goto yyexhaustedlab; -+ YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); -+ if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) -+ { -+ YYSIZE_T yyalloc = 2 * yysize; -+ if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) -+ yyalloc = YYSTACK_ALLOC_MAXIMUM; -+ if (yymsg != yymsgbuf) -+ YYSTACK_FREE (yymsg); -+ yymsg = (char *) YYSTACK_ALLOC (yyalloc); -+ if (yymsg) -+ yymsg_alloc = yyalloc; -+ else -+ { -+ yymsg = yymsgbuf; -+ yymsg_alloc = sizeof yymsgbuf; -+ } -+ } -+ -+ if (0 < yysize && yysize <= yymsg_alloc) -+ { -+ (void) yysyntax_error (yymsg, yystate, yychar); -+ yyerror (yymsg); -+ } -+ else -+ { -+ yyerror (YY_("syntax error")); -+ if (yysize != 0) -+ goto yyexhaustedlab; -+ } - } --# undef YYSYNTAX_ERROR - #endif - } - -- yyerror_range[1] = yylloc; -+ yyerror_range[0] = yylloc; - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an -- error, discard it. */ -+ error, discard it. */ - - if (yychar <= YYEOF) -- { -- /* Return failure if at end of input. */ -- if (yychar == YYEOF) -- YYABORT; -- } -+ { -+ /* Return failure if at end of input. */ -+ if (yychar == YYEOF) -+ YYABORT; -+ } - else -- { -- yydestruct ("Error: discarding", -- yytoken, &yylval, &yylloc); -- yychar = YYEMPTY; -- } -+ { -+ yydestruct ("Error: discarding", -+ yytoken, &yylval, &yylloc); -+ yychar = YYEMPTY; -+ } - } - - /* Else will try to reuse lookahead token after shifting the error -@@ -2150,8 +2335,8 @@ yyerrorlab: - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - -- yyerror_range[1] = yylsp[1-yylen]; -- /* Do not reclaim the symbols of the rule whose action triggered -+ yyerror_range[0] = yylsp[1-yylen]; -+ /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; -@@ -2164,42 +2349,40 @@ yyerrorlab: - | yyerrlab1 -- common code for both syntax error and YYERROR. | - `-------------------------------------------------------------*/ - yyerrlab1: -- yyerrstatus = 3; /* Each real token shifted decrements this. */ -+ yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; -- if (!yypact_value_is_default (yyn)) -- { -- yyn += YYTERROR; -- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) -- { -- yyn = yytable[yyn]; -- if (0 < yyn) -- break; -- } -- } -+ if (yyn != YYPACT_NINF) -+ { -+ yyn += YYTERROR; -+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) -+ { -+ yyn = yytable[yyn]; -+ if (0 < yyn) -+ break; -+ } -+ } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) -- YYABORT; -+ YYABORT; - -- yyerror_range[1] = *yylsp; -+ yyerror_range[0] = *yylsp; - yydestruct ("Error: popping", -- yystos[yystate], yyvsp, yylsp); -+ yystos[yystate], yyvsp, yylsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - -- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; -- YY_IGNORE_MAYBE_UNINITIALIZED_END - -- yyerror_range[2] = yylloc; -+ yyerror_range[1] = yylloc; - /* Using YYLLOC is tempting, but would change the location of - the lookahead. YYLOC is available though. */ -- YYLLOC_DEFAULT (yyloc, yyerror_range, 2); -+ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); - *++yylsp = yyloc; - - /* Shift the error token. */ -@@ -2223,7 +2406,7 @@ yyabortlab: - yyresult = 1; - goto yyreturn; - --#if !defined yyoverflow || YYERROR_VERBOSE -+#if !defined(yyoverflow) || YYERROR_VERBOSE - /*-------------------------------------------------. - | yyexhaustedlab -- memory exhaustion comes here. | - `-------------------------------------------------*/ -@@ -2235,21 +2418,16 @@ yyexhaustedlab: - - yyreturn: - if (yychar != YYEMPTY) -- { -- /* Make sure we have latest lookahead translation. See comments at -- user semantic actions for why this is necessary. */ -- yytoken = YYTRANSLATE (yychar); -- yydestruct ("Cleanup: discarding lookahead", -- yytoken, &yylval, &yylloc); -- } -- /* Do not reclaim the symbols of the rule whose action triggered -+ yydestruct ("Cleanup: discarding lookahead", -+ yytoken, &yylval, &yylloc); -+ /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", -- yystos[*yyssp], yyvsp, yylsp); -+ yystos[*yyssp], yyvsp, yylsp); - YYPOPSTACK (1); - } - #ifndef yyoverflow -@@ -2260,12 +2438,18 @@ yyreturn: - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - #endif -- return yyresult; -+ /* Make sure YYID is used. */ -+ return YYID (yyresult); - } --#line 488 "dtc-parser.y" /* yacc.c:1906 */ -+ -+ -+ -+/* Line 1675 of yacc.c */ -+#line 514 "dtc-parser.y" - - - void yyerror(char const *s) - { - ERROR(&yylloc, "%s", s); - } -+ -diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped -index 30867c6..38f7b36 100644 ---- a/scripts/dtc/dtc-parser.tab.h_shipped -+++ b/scripts/dtc/dtc-parser.tab.h_shipped -@@ -1,19 +1,21 @@ --/* A Bison parser, made by GNU Bison 3.0.2. */ - --/* Bison interface for Yacc-like parsers in C -- -- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. -+/* A Bison parser, made by GNU Bison 2.4.1. */ - -+/* Skeleton interface for Bison's Yacc-like parsers in C -+ -+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 -+ Free Software Foundation, Inc. -+ - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. -- -+ - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. -- -+ - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -@@ -26,55 +28,50 @@ - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. -- -+ - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - --#ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED --# define YY_YY_DTC_PARSER_TAB_H_INCLUDED --/* Debug traces. */ --#ifndef YYDEBUG --# define YYDEBUG 0 --#endif --#if YYDEBUG --extern int yydebug; --#endif - --/* Token type. */ -+/* Tokens. */ - #ifndef YYTOKENTYPE - # define YYTOKENTYPE -- enum yytokentype -- { -- DT_V1 = 258, -- DT_MEMRESERVE = 259, -- DT_LSHIFT = 260, -- DT_RSHIFT = 261, -- DT_LE = 262, -- DT_GE = 263, -- DT_EQ = 264, -- DT_NE = 265, -- DT_AND = 266, -- DT_OR = 267, -- DT_BITS = 268, -- DT_DEL_PROP = 269, -- DT_DEL_NODE = 270, -- DT_PROPNODENAME = 271, -- DT_LITERAL = 272, -- DT_CHAR_LITERAL = 273, -- DT_BYTE = 274, -- DT_STRING = 275, -- DT_LABEL = 276, -- DT_REF = 277, -- DT_INCBIN = 278 -- }; -+ /* Put the tokens into the symbol table, so that GDB and other debuggers -+ know about them. */ -+ enum yytokentype { -+ DT_V1 = 258, -+ DT_PLUGIN = 259, -+ DT_MEMRESERVE = 260, -+ DT_LSHIFT = 261, -+ DT_RSHIFT = 262, -+ DT_LE = 263, -+ DT_GE = 264, -+ DT_EQ = 265, -+ DT_NE = 266, -+ DT_AND = 267, -+ DT_OR = 268, -+ DT_BITS = 269, -+ DT_DEL_PROP = 270, -+ DT_DEL_NODE = 271, -+ DT_PROPNODENAME = 272, -+ DT_LITERAL = 273, -+ DT_CHAR_LITERAL = 274, -+ DT_BYTE = 275, -+ DT_STRING = 276, -+ DT_LABEL = 277, -+ DT_REF = 278, -+ DT_INCBIN = 279 -+ }; - #endif - --/* Value type. */ -+ -+ - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED --typedef union YYSTYPE YYSTYPE; --union YYSTYPE -+typedef union YYSTYPE - { --#line 38 "dtc-parser.y" /* yacc.c:1909 */ -+ -+/* Line 1676 of yacc.c */ -+#line 39 "dtc-parser.y" - - char *propnodename; - char *labelref; -@@ -92,30 +89,32 @@ union YYSTYPE - struct node *nodelist; - struct reserve_info *re; - uint64_t integer; -+ bool is_plugin; -+ - --#line 97 "dtc-parser.tab.h" /* yacc.c:1909 */ --}; -+ -+/* Line 1676 of yacc.c */ -+#line 98 "dtc-parser.tab.h" -+} YYSTYPE; - # define YYSTYPE_IS_TRIVIAL 1 -+# define yystype YYSTYPE /* obsolescent; will be withdrawn */ - # define YYSTYPE_IS_DECLARED 1 - #endif - --/* Location type. */ -+extern YYSTYPE yylval; -+ - #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED --typedef struct YYLTYPE YYLTYPE; --struct YYLTYPE -+typedef struct YYLTYPE - { - int first_line; - int first_column; - int last_line; - int last_column; --}; -+} YYLTYPE; -+# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ - # define YYLTYPE_IS_DECLARED 1 - # define YYLTYPE_IS_TRIVIAL 1 - #endif - -- --extern YYSTYPE yylval; - extern YYLTYPE yylloc; --int yyparse (void); - --#endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ -diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c -index 5fa23c4..ee37be9 100644 ---- a/scripts/dtc/dtc.c -+++ b/scripts/dtc/dtc.c -@@ -31,6 +31,8 @@ int reservenum; /* Number of memory reservation slots */ - int minsize; /* Minimum blob size */ - int padsize; /* Additional padding to blob */ - int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */ -+int symbol_fixup_support; -+int auto_label_aliases; - - static void fill_fullpaths(struct node *tree, const char *prefix) - { -@@ -53,7 +55,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix) - #define FDT_VERSION(version) _FDT_VERSION(version) - #define _FDT_VERSION(version) #version - static const char usage_synopsis[] = "dtc [options] "; --static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv"; -+static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:@Ahv"; - static struct option const usage_long_opts[] = { - {"quiet", no_argument, NULL, 'q'}, - {"in-format", a_argument, NULL, 'I'}, -@@ -71,6 +73,8 @@ static struct option const usage_long_opts[] = { - {"phandle", a_argument, NULL, 'H'}, - {"warning", a_argument, NULL, 'W'}, - {"error", a_argument, NULL, 'E'}, -+ {"symbols", no_argument, NULL, '@'}, -+ {"auto-alias", no_argument, NULL, 'A'}, - {"help", no_argument, NULL, 'h'}, - {"version", no_argument, NULL, 'v'}, - {NULL, no_argument, NULL, 0x0}, -@@ -101,6 +105,8 @@ static const char * const usage_opts_help[] = { - "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties", - "\n\tEnable/disable warnings (prefix with \"no-\")", - "\n\tEnable/disable errors (prefix with \"no-\")", -+ "\n\tEnable symbols/fixup support", -+ "\n\tEnable auto-alias of labels", - "\n\tPrint this help and exit", - "\n\tPrint version and exit", - NULL, -@@ -233,7 +239,12 @@ int main(int argc, char *argv[]) - case 'E': - parse_checks_option(false, true, optarg); - break; -- -+ case '@': -+ symbol_fixup_support = 1; -+ break; -+ case 'A': -+ auto_label_aliases = 1; -+ break; - case 'h': - usage(NULL); - default: -@@ -294,6 +305,12 @@ int main(int argc, char *argv[]) - if (sort) - sort_tree(bi); - -+ if (symbol_fixup_support || auto_label_aliases) -+ generate_label_node(bi->dt, bi->dt); -+ -+ if (symbol_fixup_support) -+ generate_fixups_node(bi->dt, bi->dt); -+ - if (streq(outname, "-")) { - outf = stdout; - } else { -diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h -index 56212c8..d025111 100644 ---- a/scripts/dtc/dtc.h -+++ b/scripts/dtc/dtc.h -@@ -20,7 +20,7 @@ - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ -- -+#define _GNU_SOURCE - #include - #include - #include -@@ -54,6 +54,14 @@ extern int reservenum; /* Number of memory reservation slots */ - extern int minsize; /* Minimum blob size */ - extern int padsize; /* Additional padding to blob */ - extern int phandle_format; /* Use linux,phandle or phandle properties */ -+extern int symbol_fixup_support;/* enable symbols & fixup support */ -+extern int auto_label_aliases; /* auto generate labels -> aliases */ -+ -+/* -+ * Tree source globals -+ */ -+extern bool source_is_plugin; -+extern bool deprecated_plugin_syntax_warning; - - #define PHANDLE_LEGACY 0x1 - #define PHANDLE_EPAPR 0x2 -@@ -194,6 +202,7 @@ struct node *build_node_delete(void); - struct node *name_node(struct node *node, char *name); - struct node *chain_node(struct node *first, struct node *list); - struct node *merge_nodes(struct node *old_node, struct node *new_node); -+void add_orphan_node(struct node *old_node, struct node *new_node, char *ref); - - void add_property(struct node *node, struct property *prop); - void delete_property_by_name(struct node *node, char *name); -@@ -244,6 +253,8 @@ struct boot_info { - struct boot_info *build_boot_info(struct reserve_info *reservelist, - struct node *tree, uint32_t boot_cpuid_phys); - void sort_tree(struct boot_info *bi); -+void generate_label_node(struct node *node, struct node *dt); -+void generate_fixups_node(struct node *node, struct node *dt); - - /* Checks */ - -diff --git a/scripts/dtc/livetree.c b/scripts/dtc/livetree.c -index e229b84..1ef9fc4 100644 ---- a/scripts/dtc/livetree.c -+++ b/scripts/dtc/livetree.c -@@ -216,6 +216,34 @@ struct node *merge_nodes(struct node *old_node, struct node *new_node) - return old_node; - } - -+void add_orphan_node(struct node *dt, struct node *new_node, char *ref) -+{ -+ static unsigned int next_orphan_fragment = 0; -+ struct node *ovl = xmalloc(sizeof(*ovl)); -+ struct property *p; -+ struct data d = empty_data; -+ char *name; -+ int ret; -+ -+ memset(ovl, 0, sizeof(*ovl)); -+ -+ d = data_add_marker(d, REF_PHANDLE, ref); -+ d = data_append_integer(d, 0xffffffff, 32); -+ -+ p = build_property("target", d); -+ add_property(ovl, p); -+ -+ ret = asprintf(&name, "fragment@%u", -+ next_orphan_fragment++); -+ if (ret == -1) -+ die("asprintf() failed\n"); -+ name_node(ovl, name); -+ name_node(new_node, "__overlay__"); -+ -+ add_child(dt, ovl); -+ add_child(ovl, new_node); -+} -+ - struct node *chain_node(struct node *first, struct node *list) - { - assert(first->next_sibling == NULL); -@@ -709,3 +737,177 @@ void sort_tree(struct boot_info *bi) - sort_reserve_entries(bi); - sort_node(bi->dt); - } -+ -+void generate_label_node(struct node *node, struct node *dt) -+{ -+ struct node *c, *an; -+ struct property *p; -+ struct label *l; -+ int has_label; -+ char *gen_node_name; -+ -+ if (auto_label_aliases) -+ gen_node_name = "aliases"; -+ else -+ gen_node_name = "__symbols__"; -+ -+ /* Make sure the label isn't already there */ -+ has_label = 0; -+ for_each_label(node->labels, l) { -+ has_label = 1; -+ break; -+ } -+ -+ if (has_label) { -+ -+ /* an is the aliases/__symbols__ node */ -+ an = get_subnode(dt, gen_node_name); -+ /* if no node exists, create it */ -+ if (!an) { -+ an = build_node(NULL, NULL); -+ name_node(an, gen_node_name); -+ add_child(dt, an); -+ } -+ -+ /* now add the label in the node */ -+ for_each_label(node->labels, l) { -+ /* check whether the label already exists */ -+ p = get_property(an, l->label); -+ if (p) { -+ fprintf(stderr, "WARNING: label %s already" -+ " exists in /%s", l->label, -+ gen_node_name); -+ continue; -+ } -+ -+ /* insert it */ -+ p = build_property(l->label, -+ data_copy_escape_string(node->fullpath, -+ strlen(node->fullpath))); -+ add_property(an, p); -+ } -+ -+ /* force allocation of a phandle for this node */ -+ if (symbol_fixup_support) -+ (void)get_node_phandle(dt, node); -+ } -+ -+ for_each_child(node, c) -+ generate_label_node(c, dt); -+} -+ -+static void add_fixup_entry(struct node *dt, struct node *node, -+ struct property *prop, struct marker *m) -+{ -+ struct node *fn; /* local fixup node */ -+ struct property *p; -+ char *fixups_name = "__fixups__"; -+ struct data d; -+ char *entry; -+ int ret; -+ -+ /* fn is the node we're putting entries in */ -+ fn = get_subnode(dt, fixups_name); -+ /* if no node exists, create it */ -+ if (!fn) { -+ fn = build_node(NULL, NULL); -+ name_node(fn, fixups_name); -+ add_child(dt, fn); -+ } -+ -+ ret = asprintf(&entry, "%s:%s:%u", -+ node->fullpath, prop->name, m->offset); -+ if (ret == -1) -+ die("asprintf() failed\n"); -+ -+ p = get_property(fn, m->ref); -+ d = data_append_data(p ? p->val : empty_data, entry, strlen(entry) + 1); -+ if (!p) -+ add_property(fn, build_property(m->ref, d)); -+ else -+ p->val = d; -+} -+ -+static void add_local_fixup_entry(struct node *dt, struct node *node, -+ struct property *prop, struct marker *m, -+ struct node *refnode) -+{ -+ struct node *lfn, *wn, *nwn; /* local fixup node, walk node, new */ -+ struct property *p; -+ struct data d; -+ char *local_fixups_name = "__local_fixups__"; -+ char *s, *e, *comp; -+ int len; -+ -+ /* fn is the node we're putting entries in */ -+ lfn = get_subnode(dt, local_fixups_name); -+ /* if no node exists, create it */ -+ if (!lfn) { -+ lfn = build_node(NULL, NULL); -+ name_node(lfn, local_fixups_name); -+ add_child(dt, lfn); -+ } -+ -+ /* walk the path components creating nodes if they don't exist */ -+ comp = NULL; -+ /* start skipping the first / */ -+ s = node->fullpath + 1; -+ wn = lfn; -+ while (*s) { -+ /* retrieve path component */ -+ e = strchr(s, '/'); -+ if (e == NULL) -+ e = s + strlen(s); -+ len = e - s; -+ comp = xrealloc(comp, len + 1); -+ memcpy(comp, s, len); -+ comp[len] = '\0'; -+ -+ /* if no node exists, create it */ -+ nwn = get_subnode(wn, comp); -+ if (!nwn) { -+ nwn = build_node(NULL, NULL); -+ name_node(nwn, strdup(comp)); -+ add_child(wn, nwn); -+ } -+ wn = nwn; -+ -+ /* last path component */ -+ if (!*e) -+ break; -+ -+ /* next path component */ -+ s = e + 1; -+ } -+ free(comp); -+ -+ p = get_property(wn, prop->name); -+ d = data_append_cell(p ? p->val : empty_data, (cell_t)m->offset); -+ if (!p) -+ add_property(wn, build_property(prop->name, d)); -+ else -+ p->val = d; -+} -+ -+void generate_fixups_node(struct node *node, struct node *dt) -+{ -+ struct node *c; -+ struct property *prop; -+ struct marker *m; -+ struct node *refnode; -+ -+ for_each_property(node, prop) { -+ m = prop->val.markers; -+ for_each_marker_of_type(m, REF_PHANDLE) { -+ refnode = get_node_by_ref(dt, m->ref); -+ if (!refnode) -+ add_fixup_entry(dt, node, prop, m); -+ else -+ add_local_fixup_entry(dt, node, prop, m, -+ refnode); -+ } -+ } -+ -+ for_each_child(node, c) -+ generate_fixups_node(c, dt); -+} -diff --git a/scripts/dtc/treesource.c b/scripts/dtc/treesource.c -index a55d1d1..e1d6657 100644 ---- a/scripts/dtc/treesource.c -+++ b/scripts/dtc/treesource.c -@@ -28,6 +28,9 @@ extern YYLTYPE yylloc; - struct boot_info *the_boot_info; - bool treesource_error; - -+bool source_is_plugin; -+bool deprecated_plugin_syntax_warning; -+ - struct boot_info *dt_from_source(const char *fname) - { - the_boot_info = NULL; -diff --git a/scripts/dtc/util.c b/scripts/dtc/util.c -index fb124ee..cbb945b 100644 ---- a/scripts/dtc/util.c -+++ b/scripts/dtc/util.c -@@ -152,6 +152,7 @@ char get_escape_char(const char *s, int *i) - int j = *i + 1; - char val; - -+ assert(c); - switch (c) { - case 'a': - val = '\a'; -diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h -index 11d93e6..03df694 100644 ---- a/scripts/dtc/version_gen.h -+++ b/scripts/dtc/version_gen.h -@@ -1 +1 @@ --#define DTC_VERSION "DTC 1.4.1-g53bf130b" -+#define DTC_VERSION "DTC 1.4.1-g4273dca2" -diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib -index ddf83d0..a0fb9e3 100644 ---- a/scripts/Makefile.lib -+++ b/scripts/Makefile.lib -@@ -275,7 +275,11 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \ - - # DTC - # --------------------------------------------------------------------------- -+ifeq ($(CONFIG_OF_CONFIGFS),y) -+DTC ?= $(objtree)/scripts/dtc/dtc -@ -+else - DTC ?= $(objtree)/scripts/dtc/dtc -+endif - - # Generate an assembly file to wrap the output of the device tree compiler - quiet_cmd_dt_S_dtb= DTB $@