1 From c0b05569c40e9a8817c2d655335251e2253428cd Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Fri, 23 Jan 2015 14:48:55 +0000
4 Subject: [PATCH 075/114] scripts/dtc: Update to upstream version with overlay
8 scripts/dtc/checks.c | 151 ++-
9 scripts/dtc/data.c | 12 +-
10 scripts/dtc/dtc-lexer.l | 70 +-
11 scripts/dtc/dtc-lexer.lex.c_shipped | 540 +++++-----
12 scripts/dtc/dtc-parser.tab.c_shipped | 1783 ++++++++++++++++------------------
13 scripts/dtc/dtc-parser.tab.h_shipped | 116 ++-
14 scripts/dtc/dtc-parser.y | 158 +--
15 scripts/dtc/dtc.c | 23 +-
16 scripts/dtc/dtc.h | 56 +-
17 scripts/dtc/flattree.c | 145 ++-
18 scripts/dtc/fstree.c | 16 +-
19 scripts/dtc/livetree.c | 4 +-
20 scripts/dtc/srcpos.c | 49 +-
21 scripts/dtc/srcpos.h | 15 +-
22 scripts/dtc/treesource.c | 14 +-
23 scripts/dtc/util.c | 18 +-
24 scripts/dtc/util.h | 4 +-
25 scripts/dtc/version_gen.h | 2 +-
26 18 files changed, 1697 insertions(+), 1479 deletions(-)
28 diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c
29 index ee96a25..27f45f1 100644
30 --- a/scripts/dtc/checks.c
31 +++ b/scripts/dtc/checks.c
32 @@ -53,7 +53,7 @@ struct check {
35 enum checkstatus status;
39 struct check **prereq;
41 @@ -113,6 +113,7 @@ static inline void check_msg(struct check *c, const char *fmt, ...)
42 vfprintf(stderr, fmt, ap);
43 fprintf(stderr, "\n");
48 #define FAIL(c, ...) \
49 @@ -141,9 +142,9 @@ static void check_nodes_props(struct check *c, struct node *dt, struct node *nod
50 check_nodes_props(c, dt, child);
53 -static int run_check(struct check *c, struct node *dt)
54 +static bool run_check(struct check *c, struct node *dt)
60 assert(!c->inprogress);
61 @@ -151,11 +152,11 @@ static int run_check(struct check *c, struct node *dt)
62 if (c->status != UNCHECKED)
66 + c->inprogress = true;
68 for (i = 0; i < c->num_prereqs; i++) {
69 struct check *prq = c->prereq[i];
70 - error |= run_check(prq, dt);
71 + error = error || run_check(prq, dt);
72 if (prq->status != PASSED) {
74 check_msg(c, "Failed prerequisite '%s'",
75 @@ -177,9 +178,9 @@ static int run_check(struct check *c, struct node *dt)
76 TRACE(c, "\tCompleted, status %d", c->status);
80 + c->inprogress = false;
81 if ((c->status != PASSED) && (c->error))
87 @@ -457,22 +458,93 @@ static void fixup_phandle_references(struct check *c, struct node *dt,
88 struct node *node, struct property *prop)
90 struct marker *m = prop->val.markers;
91 + struct fixup *f, **fp;
92 + struct fixup_entry *fe, **fep;
95 + int has_phandle_refs;
97 + has_phandle_refs = 0;
98 + for_each_marker_of_type(m, REF_PHANDLE) {
99 + has_phandle_refs = 1;
103 + if (!has_phandle_refs)
106 for_each_marker_of_type(m, REF_PHANDLE) {
107 assert(m->offset + sizeof(cell_t) <= prop->val.len);
109 refnode = get_node_by_ref(dt, m->ref);
111 + if (!refnode && !symbol_fixup_support) {
112 FAIL(c, "Reference to non-existent node or label \"%s\"\n",
118 - phandle = get_node_phandle(dt, refnode);
119 - *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
121 + /* allocate fixup entry */
122 + fe = xmalloc(sizeof(*fe));
126 + fe->offset = m->offset;
129 + /* search for an already existing fixup */
130 + for_each_fixup(dt, f)
131 + if (strcmp(f->ref, m->ref) == 0)
134 + /* no fixup found, add new */
136 + f = xmalloc(sizeof(*f));
141 + /* add it to the tree */
148 + /* and now append fixup entry */
151 + fep = &(*fep)->next;
154 + /* mark the entry as unresolved */
155 + phandle = 0xdeadbeef;
157 + phandle = get_node_phandle(dt, refnode);
159 + /* if it's a plugin, we need to record it */
160 + if (symbol_fixup_support && dt->is_plugin) {
162 + /* allocate a new local fixup entry */
163 + fe = xmalloc(sizeof(*fe));
167 + fe->offset = m->offset;
170 + /* append it to the local fixups */
171 + fep = &dt->local_fixups;
173 + fep = &(*fep)->next;
178 + *((cell_t *)(prop->val.val + m->offset)) =
179 + cpu_to_fdt32(phandle);
183 ERROR(phandle_references, NULL, NULL, fixup_phandle_references, NULL,
184 &duplicate_node_names, &explicit_phandles);
185 @@ -624,11 +696,11 @@ static void check_avoid_default_addr_size(struct check *c, struct node *dt,
189 - if ((node->parent->addr_cells == -1))
190 + if (node->parent->addr_cells == -1)
191 FAIL(c, "Relying on default #address-cells value for %s",
194 - if ((node->parent->size_cells == -1))
195 + if (node->parent->size_cells == -1)
196 FAIL(c, "Relying on default #size-cells value for %s",
199 @@ -651,6 +723,45 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c,
201 TREE_WARNING(obsolete_chosen_interrupt_controller, NULL);
203 +static void check_auto_label_phandles(struct check *c, struct node *dt,
207 + struct symbol *s, **sp;
210 + if (!symbol_fixup_support)
214 + for_each_label(node->labels, l) {
222 + /* force allocation of a phandle for this node */
223 + (void)get_node_phandle(dt, node);
225 + /* add the symbol */
226 + for_each_label(node->labels, l) {
228 + s = xmalloc(sizeof(*s));
233 + /* add it to the symbols list */
236 + sp = &((*sp)->next);
240 +NODE_WARNING(auto_label_phandles, NULL);
242 static struct check *check_table[] = {
243 &duplicate_node_names, &duplicate_property_names,
244 &node_name_chars, &node_name_format, &property_name_chars,
245 @@ -669,6 +780,8 @@ static struct check *check_table[] = {
246 &avoid_default_addr_size,
247 &obsolete_chosen_interrupt_controller,
249 + &auto_label_phandles,
254 @@ -706,15 +819,15 @@ static void disable_warning_error(struct check *c, bool warn, bool error)
255 c->error = c->error && !error;
258 -void parse_checks_option(bool warn, bool error, const char *optarg)
259 +void parse_checks_option(bool warn, bool error, const char *arg)
262 - const char *name = optarg;
263 + const char *name = arg;
266 - if ((strncmp(optarg, "no-", 3) == 0)
267 - || (strncmp(optarg, "no_", 3) == 0)) {
269 + if ((strncmp(arg, "no-", 3) == 0)
270 + || (strncmp(arg, "no_", 3) == 0)) {
275 @@ -733,7 +846,7 @@ void parse_checks_option(bool warn, bool error, const char *optarg)
276 die("Unrecognized check name \"%s\"\n", name);
279 -void process_checks(int force, struct boot_info *bi)
280 +void process_checks(bool force, struct boot_info *bi)
282 struct node *dt = bi->dt;
284 diff --git a/scripts/dtc/data.c b/scripts/dtc/data.c
285 index 4a40c5b..8cae237 100644
286 --- a/scripts/dtc/data.c
287 +++ b/scripts/dtc/data.c
288 @@ -74,7 +74,7 @@ struct data data_copy_escape_string(const char *s, int len)
292 - d = data_grow_for(empty_data, strlen(s)+1);
293 + d = data_grow_for(empty_data, len + 1);
297 @@ -250,20 +250,20 @@ struct data data_add_marker(struct data d, enum markertype type, char *ref)
298 return data_append_markers(d, m);
301 -int data_is_one_string(struct data d)
302 +bool data_is_one_string(struct data d)
311 for (i = 0; i < len-1; i++)
312 if (d.val[i] == '\0')
316 if (d.val[len-1] != '\0')
323 diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
324 index 3b41bfc..dd44ba2 100644
325 --- a/scripts/dtc/dtc-lexer.l
326 +++ b/scripts/dtc/dtc-lexer.l
329 %option noyywrap nounput noinput never-interactive
335 @@ -40,6 +39,7 @@ LINECOMMENT "//".*\n
336 #include "dtc-parser.tab.h"
339 +extern bool treesource_error;
341 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
342 #define YY_USER_ACTION \
343 @@ -61,7 +61,8 @@ static int dts_version = 1;
346 static void push_input_file(const char *filename);
347 -static int pop_input_file(void);
348 +static bool pop_input_file(void);
349 +static void lexical_error(const char *fmt, ...);
353 @@ -75,11 +76,11 @@ static int pop_input_file(void);
354 char *line, *tmp, *fn;
355 /* skip text before line # */
357 - while (!isdigit(*line))
358 + while (!isdigit((unsigned char)*line))
360 /* skip digits in line # */
362 - while (!isspace(*tmp))
363 + while (!isspace((unsigned char)*tmp))
365 /* "NULL"-terminate line # */
367 @@ -112,6 +113,11 @@ static int pop_input_file(void);
372 + DPRINT("Keyword: /plugin/\n");
377 DPRINT("Keyword: /memreserve/\n");
379 @@ -146,15 +152,42 @@ static int pop_input_file(void);
382 <V1>([0-9]+|0[xX][0-9a-fA-F]+)(U|L|UL|LL|ULL)? {
383 - yylval.literal = xstrdup(yytext);
384 - DPRINT("Literal: '%s'\n", yylval.literal);
386 + DPRINT("Integer Literal: '%s'\n", yytext);
389 + yylval.integer = strtoull(yytext, &e, 0);
391 + assert(!(*e) || !e[strspn(e, "UL")]);
393 + if (errno == ERANGE)
394 + lexical_error("Integer literal '%s' out of range",
397 + /* ERANGE is the only strtoull error triggerable
398 + * by strings matching the pattern */
399 + assert(errno == 0);
404 - yytext[yyleng-1] = '\0';
405 - yylval.literal = xstrdup(yytext+1);
406 - DPRINT("Character literal: %s\n", yylval.literal);
408 + DPRINT("Character literal: %s\n", yytext);
410 + d = data_copy_escape_string(yytext+1, yyleng-2);
412 + lexical_error("Empty character literal");
413 + yylval.integer = 0;
414 + return DT_CHAR_LITERAL;
417 + yylval.integer = (unsigned char)d.val[0];
420 + lexical_error("Character literal has %d"
421 + " characters instead of 1",
424 return DT_CHAR_LITERAL;
427 @@ -164,7 +197,7 @@ static int pop_input_file(void);
431 -<*>"&{/"{PATHCHAR}+\} { /* new-style path reference */
432 +<*>"&{/"{PATHCHAR}*\} { /* new-style path reference */
433 yytext[yyleng-1] = '\0';
434 DPRINT("Ref: %s\n", yytext+2);
435 yylval.labelref = xstrdup(yytext+2);
436 @@ -238,13 +271,24 @@ static void push_input_file(const char *filename)
440 -static int pop_input_file(void)
441 +static bool pop_input_file(void)
443 if (srcfile_pop() == 0)
447 yypop_buffer_state();
448 yyin = current_srcfile->f;
454 +static void lexical_error(const char *fmt, ...)
459 + srcpos_verror(&yylloc, "Lexical error", fmt, ap);
462 + treesource_error = true;
464 diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped
465 index 2d30f41..1518525 100644
466 --- a/scripts/dtc/dtc-lexer.lex.c_shipped
467 +++ b/scripts/dtc/dtc-lexer.lex.c_shipped
468 @@ -372,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] );
470 (yy_c_buf_p) = yy_cp;
472 -#define YY_NUM_RULES 30
473 -#define YY_END_OF_BUFFER 31
474 +#define YY_NUM_RULES 31
475 +#define YY_END_OF_BUFFER 32
476 /* This struct is not used in this scanner,
477 but its presence is necessary. */
479 @@ -381,25 +381,26 @@ struct yy_trans_info
480 flex_int32_t yy_verify;
483 -static yyconst flex_int16_t yy_accept[161] =
484 +static yyconst flex_int16_t yy_accept[166] =
486 + 0, 0, 0, 0, 0, 0, 0, 0, 32, 30,
487 + 19, 19, 30, 30, 30, 30, 30, 30, 30, 30,
488 + 30, 30, 30, 30, 30, 30, 16, 17, 17, 30,
489 + 17, 11, 11, 19, 27, 0, 3, 0, 28, 13,
490 + 0, 0, 12, 0, 0, 0, 0, 0, 0, 0,
491 + 0, 22, 24, 26, 25, 23, 0, 10, 29, 0,
492 + 0, 0, 15, 15, 17, 17, 17, 11, 11, 11,
493 + 0, 13, 0, 12, 0, 0, 0, 21, 0, 0,
494 + 0, 0, 0, 0, 0, 0, 0, 17, 11, 11,
495 + 11, 0, 14, 20, 0, 0, 0, 0, 0, 0,
497 + 0, 0, 0, 0, 17, 0, 0, 0, 0, 0,
498 + 0, 0, 0, 0, 0, 17, 7, 0, 0, 0,
499 + 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
500 + 0, 0, 0, 0, 4, 18, 0, 0, 5, 2,
501 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
502 - 31, 29, 18, 18, 29, 29, 29, 29, 29, 29,
503 - 29, 29, 29, 29, 29, 29, 29, 29, 15, 16,
504 - 16, 29, 16, 10, 10, 18, 26, 0, 3, 0,
505 - 27, 12, 0, 0, 11, 0, 0, 0, 0, 0,
506 - 0, 0, 21, 23, 25, 24, 22, 0, 9, 28,
507 - 0, 0, 0, 14, 14, 16, 16, 16, 10, 10,
508 - 10, 0, 12, 0, 11, 0, 0, 0, 20, 0,
509 - 0, 0, 0, 0, 0, 0, 0, 16, 10, 10,
510 - 10, 0, 19, 0, 0, 0, 0, 0, 0, 0,
512 - 0, 0, 16, 13, 0, 0, 0, 0, 0, 0,
513 - 0, 0, 0, 16, 6, 0, 0, 0, 0, 0,
514 - 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
515 - 4, 17, 0, 0, 2, 0, 0, 0, 0, 0,
516 - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
517 - 0, 0, 5, 8, 0, 0, 0, 0, 7, 0
518 + 0, 0, 1, 0, 0, 0, 0, 6, 9, 0,
522 static yyconst flex_int32_t yy_ec[256] =
523 @@ -415,9 +416,9 @@ static yyconst flex_int32_t yy_ec[256] =
524 22, 22, 22, 22, 24, 22, 22, 25, 22, 22,
525 1, 26, 27, 1, 22, 1, 21, 28, 29, 30,
527 - 31, 21, 22, 22, 32, 22, 22, 33, 34, 35,
528 - 36, 37, 22, 38, 39, 40, 41, 42, 22, 25,
529 - 43, 22, 44, 45, 46, 1, 1, 1, 1, 1,
530 + 31, 21, 32, 22, 33, 22, 22, 34, 35, 36,
531 + 37, 38, 22, 39, 40, 41, 42, 43, 22, 25,
532 + 44, 22, 45, 46, 47, 1, 1, 1, 1, 1,
533 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
534 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
535 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
536 @@ -434,163 +435,165 @@ static yyconst flex_int32_t yy_ec[256] =
540 -static yyconst flex_int32_t yy_meta[47] =
541 +static yyconst flex_int32_t yy_meta[48] =
543 1, 1, 1, 1, 1, 1, 2, 3, 1, 2,
544 2, 2, 4, 5, 5, 5, 6, 1, 1, 1,
545 7, 8, 8, 8, 8, 1, 1, 7, 7, 7,
546 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
548 + 8, 8, 8, 8, 3, 1, 4
551 -static yyconst flex_int16_t yy_base[175] =
552 +static yyconst flex_int16_t yy_base[180] =
554 - 0, 385, 378, 40, 41, 383, 72, 382, 34, 44,
555 - 388, 393, 61, 117, 368, 116, 115, 115, 115, 48,
556 - 367, 107, 368, 339, 127, 120, 0, 147, 393, 0,
557 - 127, 0, 133, 156, 168, 153, 393, 125, 393, 380,
558 - 393, 0, 369, 127, 393, 160, 371, 377, 347, 21,
559 - 343, 346, 393, 393, 393, 393, 393, 359, 393, 393,
560 - 183, 343, 339, 393, 356, 0, 183, 340, 187, 348,
561 - 347, 0, 0, 0, 178, 359, 195, 365, 354, 326,
562 - 332, 325, 334, 328, 204, 326, 331, 324, 393, 335,
563 - 150, 311, 343, 342, 315, 322, 340, 179, 313, 207,
565 - 319, 316, 317, 393, 337, 333, 305, 302, 311, 301,
566 - 310, 190, 338, 337, 393, 307, 322, 301, 305, 277,
567 - 208, 311, 307, 278, 271, 270, 248, 246, 213, 130,
568 - 393, 393, 263, 235, 207, 221, 218, 229, 213, 213,
569 - 206, 234, 218, 210, 208, 193, 219, 393, 223, 204,
570 - 176, 157, 393, 393, 120, 106, 97, 119, 393, 393,
571 - 245, 251, 259, 263, 267, 273, 280, 284, 292, 300,
573 + 0, 393, 35, 392, 66, 391, 38, 107, 397, 401,
574 + 55, 113, 377, 112, 111, 111, 114, 42, 376, 106,
575 + 377, 347, 126, 120, 0, 147, 401, 0, 124, 0,
576 + 137, 158, 170, 163, 401, 153, 401, 389, 401, 0,
577 + 378, 120, 401, 131, 380, 386, 355, 139, 351, 355,
578 + 351, 401, 401, 401, 401, 401, 367, 401, 401, 185,
579 + 350, 346, 401, 364, 0, 185, 347, 189, 356, 355,
580 + 0, 0, 330, 180, 366, 141, 372, 361, 332, 338,
581 + 331, 341, 334, 326, 205, 331, 337, 329, 401, 341,
582 + 167, 316, 401, 349, 348, 320, 328, 346, 180, 318,
584 + 324, 209, 324, 320, 322, 342, 338, 309, 306, 315,
585 + 305, 315, 312, 192, 342, 341, 401, 293, 306, 282,
586 + 268, 252, 255, 203, 285, 282, 272, 268, 252, 233,
587 + 232, 239, 208, 107, 401, 401, 238, 211, 401, 211,
588 + 212, 208, 228, 203, 215, 207, 233, 222, 212, 211,
589 + 203, 227, 401, 237, 225, 204, 185, 401, 401, 149,
590 + 128, 88, 42, 401, 401, 253, 259, 267, 271, 275,
591 + 281, 288, 292, 300, 308, 312, 318, 326, 334
594 -static yyconst flex_int16_t yy_def[175] =
595 +static yyconst flex_int16_t yy_def[180] =
597 - 160, 1, 1, 1, 1, 5, 160, 7, 1, 1,
598 - 160, 160, 160, 160, 160, 161, 162, 163, 160, 160,
599 - 160, 160, 164, 160, 160, 160, 165, 164, 160, 166,
600 - 167, 166, 166, 160, 160, 160, 160, 161, 160, 161,
601 - 160, 168, 160, 163, 160, 163, 169, 170, 160, 160,
602 - 160, 160, 160, 160, 160, 160, 160, 164, 160, 160,
603 - 160, 160, 160, 160, 164, 166, 167, 166, 160, 160,
604 - 160, 171, 168, 172, 163, 169, 169, 170, 160, 160,
605 - 160, 160, 160, 160, 160, 160, 160, 166, 160, 160,
606 - 171, 172, 160, 160, 160, 160, 160, 160, 160, 160,
608 - 160, 160, 166, 160, 160, 160, 160, 160, 160, 160,
609 - 160, 173, 160, 166, 160, 160, 160, 160, 160, 160,
610 - 173, 160, 173, 160, 160, 160, 160, 160, 160, 160,
611 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
612 - 160, 160, 174, 160, 160, 160, 174, 160, 174, 160,
613 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 0,
614 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
616 + 165, 1, 1, 3, 165, 5, 1, 1, 165, 165,
617 + 165, 165, 165, 166, 167, 168, 165, 165, 165, 165,
618 + 169, 165, 165, 165, 170, 169, 165, 171, 172, 171,
619 + 171, 165, 165, 165, 165, 166, 165, 166, 165, 173,
620 + 165, 168, 165, 168, 174, 175, 165, 165, 165, 165,
621 + 165, 165, 165, 165, 165, 165, 169, 165, 165, 165,
622 + 165, 165, 165, 169, 171, 172, 171, 165, 165, 165,
623 + 176, 173, 177, 168, 174, 174, 175, 165, 165, 165,
624 + 165, 165, 165, 165, 165, 165, 165, 171, 165, 165,
625 + 176, 177, 165, 165, 165, 165, 165, 165, 165, 165,
627 + 165, 165, 165, 165, 171, 165, 165, 165, 165, 165,
628 + 165, 165, 165, 178, 165, 171, 165, 165, 165, 165,
629 + 165, 165, 165, 178, 165, 178, 165, 165, 165, 165,
630 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
631 + 165, 165, 165, 165, 165, 165, 165, 179, 165, 165,
632 + 165, 179, 165, 179, 165, 165, 165, 165, 165, 165,
633 + 165, 165, 165, 165, 0, 165, 165, 165, 165, 165,
634 + 165, 165, 165, 165, 165, 165, 165, 165, 165
637 -static yyconst flex_int16_t yy_nxt[440] =
638 +static yyconst flex_int16_t yy_nxt[449] =
640 - 12, 13, 14, 13, 15, 16, 12, 17, 18, 12,
641 - 12, 12, 19, 12, 12, 12, 12, 20, 21, 22,
642 - 23, 23, 23, 23, 23, 12, 12, 23, 23, 23,
643 - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
644 - 23, 23, 23, 12, 24, 12, 25, 34, 35, 35,
645 - 25, 81, 26, 26, 27, 27, 27, 34, 35, 35,
646 - 82, 28, 36, 36, 36, 53, 54, 29, 28, 28,
647 - 28, 28, 12, 13, 14, 13, 15, 16, 30, 17,
648 - 18, 30, 30, 30, 26, 30, 30, 30, 12, 20,
649 - 21, 22, 31, 31, 31, 31, 31, 32, 12, 31,
651 - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
652 - 31, 31, 31, 31, 31, 12, 24, 12, 36, 36,
653 - 36, 39, 41, 45, 47, 56, 57, 48, 61, 47,
654 - 39, 159, 48, 66, 61, 45, 66, 66, 66, 158,
655 - 46, 40, 49, 59, 50, 157, 51, 49, 52, 50,
656 - 40, 63, 46, 52, 36, 36, 36, 156, 43, 62,
657 - 65, 65, 65, 59, 136, 68, 137, 65, 75, 69,
658 - 69, 69, 70, 71, 65, 65, 65, 65, 70, 71,
659 - 72, 69, 69, 69, 61, 46, 45, 155, 154, 66,
660 - 70, 71, 66, 66, 66, 122, 85, 85, 85, 59,
662 - 69, 69, 69, 46, 77, 100, 109, 93, 100, 70,
663 - 71, 110, 112, 122, 129, 123, 153, 85, 85, 85,
664 - 135, 135, 135, 148, 148, 160, 135, 135, 135, 152,
665 - 142, 142, 142, 123, 143, 142, 142, 142, 151, 143,
666 - 150, 146, 145, 149, 149, 38, 38, 38, 38, 38,
667 - 38, 38, 38, 42, 144, 141, 140, 42, 42, 44,
668 - 44, 44, 44, 44, 44, 44, 44, 58, 58, 58,
669 - 58, 64, 139, 64, 66, 138, 134, 66, 133, 66,
670 - 66, 67, 132, 131, 67, 67, 67, 67, 73, 130,
671 - 73, 73, 76, 76, 76, 76, 76, 76, 76, 76,
673 - 78, 78, 78, 78, 78, 78, 78, 78, 91, 160,
674 - 91, 92, 129, 92, 92, 128, 92, 92, 121, 121,
675 - 121, 121, 121, 121, 121, 121, 147, 147, 147, 147,
676 - 147, 147, 147, 147, 127, 126, 125, 124, 61, 61,
677 - 120, 119, 118, 117, 116, 115, 47, 114, 110, 113,
678 - 111, 108, 107, 106, 48, 105, 104, 89, 103, 102,
679 - 101, 99, 98, 97, 96, 95, 94, 79, 77, 90,
680 - 89, 88, 59, 87, 86, 59, 84, 83, 80, 79,
681 - 77, 74, 160, 60, 59, 55, 37, 160, 33, 25,
682 - 26, 25, 11, 160, 160, 160, 160, 160, 160, 160,
684 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
685 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
686 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
687 - 160, 160, 160, 160, 160, 160, 160, 160, 160
688 + 10, 11, 12, 11, 13, 14, 10, 15, 16, 10,
689 + 10, 10, 17, 10, 10, 10, 10, 18, 19, 20,
690 + 21, 21, 21, 21, 21, 10, 10, 21, 21, 21,
691 + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
692 + 21, 21, 21, 21, 10, 22, 10, 24, 25, 25,
693 + 25, 32, 33, 33, 164, 26, 34, 34, 34, 52,
694 + 53, 27, 26, 26, 26, 26, 10, 11, 12, 11,
695 + 13, 14, 28, 15, 16, 28, 28, 28, 24, 28,
696 + 28, 28, 10, 18, 19, 20, 29, 29, 29, 29,
697 + 29, 30, 10, 29, 29, 29, 29, 29, 29, 29,
699 + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
700 + 10, 22, 10, 23, 34, 34, 34, 37, 39, 43,
701 + 32, 33, 33, 45, 55, 56, 46, 60, 43, 45,
702 + 65, 163, 46, 65, 65, 65, 44, 38, 60, 74,
703 + 58, 47, 141, 48, 142, 44, 49, 47, 50, 48,
704 + 76, 51, 62, 94, 50, 41, 44, 51, 37, 61,
705 + 64, 64, 64, 58, 34, 34, 34, 64, 162, 80,
706 + 67, 68, 68, 68, 64, 64, 64, 64, 38, 81,
707 + 69, 70, 71, 68, 68, 68, 60, 161, 43, 69,
708 + 70, 65, 69, 70, 65, 65, 65, 125, 85, 85,
710 + 85, 58, 68, 68, 68, 44, 102, 110, 125, 133,
711 + 102, 69, 70, 111, 114, 160, 159, 126, 85, 85,
712 + 85, 140, 140, 140, 140, 140, 140, 153, 126, 147,
713 + 147, 147, 153, 148, 147, 147, 147, 158, 148, 165,
714 + 157, 156, 155, 151, 150, 149, 146, 154, 145, 144,
715 + 143, 139, 154, 36, 36, 36, 36, 36, 36, 36,
716 + 36, 40, 138, 137, 136, 40, 40, 42, 42, 42,
717 + 42, 42, 42, 42, 42, 57, 57, 57, 57, 63,
718 + 135, 63, 65, 134, 165, 65, 133, 65, 65, 66,
719 + 132, 131, 66, 66, 66, 66, 72, 130, 72, 72,
721 + 75, 75, 75, 75, 75, 75, 75, 75, 77, 77,
722 + 77, 77, 77, 77, 77, 77, 91, 129, 91, 92,
723 + 128, 92, 92, 127, 92, 92, 124, 124, 124, 124,
724 + 124, 124, 124, 124, 152, 152, 152, 152, 152, 152,
725 + 152, 152, 60, 60, 123, 122, 121, 120, 119, 118,
726 + 117, 45, 116, 111, 115, 113, 112, 109, 108, 107,
727 + 46, 106, 93, 89, 105, 104, 103, 101, 100, 99,
728 + 98, 97, 96, 95, 78, 76, 93, 90, 89, 88,
729 + 58, 87, 86, 58, 84, 83, 82, 79, 78, 76,
730 + 73, 165, 59, 58, 54, 35, 165, 31, 23, 23,
732 + 9, 165, 165, 165, 165, 165, 165, 165, 165, 165,
733 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
734 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
735 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
736 + 165, 165, 165, 165, 165, 165, 165, 165
739 -static yyconst flex_int16_t yy_chk[440] =
740 +static yyconst flex_int16_t yy_chk[449] =
742 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
743 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
744 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
745 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
746 - 1, 1, 1, 1, 1, 1, 4, 9, 9, 9,
747 - 10, 50, 4, 5, 5, 5, 5, 10, 10, 10,
748 - 50, 5, 13, 13, 13, 20, 20, 5, 5, 5,
749 - 5, 5, 7, 7, 7, 7, 7, 7, 7, 7,
750 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
751 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
753 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
754 - 7, 7, 7, 7, 7, 7, 7, 7, 14, 14,
755 - 14, 16, 17, 18, 19, 22, 22, 19, 25, 26,
756 - 38, 158, 26, 31, 33, 44, 31, 31, 31, 157,
757 - 18, 16, 19, 31, 19, 156, 19, 26, 19, 26,
758 - 38, 26, 44, 26, 36, 36, 36, 155, 17, 25,
759 - 28, 28, 28, 28, 130, 33, 130, 28, 46, 34,
760 - 34, 34, 91, 91, 28, 28, 28, 28, 34, 34,
761 - 34, 35, 35, 35, 61, 46, 75, 152, 151, 67,
762 - 35, 35, 67, 67, 67, 112, 61, 61, 61, 67,
764 - 69, 69, 69, 75, 77, 85, 98, 77, 100, 69,
765 - 69, 98, 100, 121, 129, 112, 150, 85, 85, 85,
766 - 135, 135, 135, 143, 147, 149, 129, 129, 129, 146,
767 - 138, 138, 138, 121, 138, 142, 142, 142, 145, 142,
768 - 144, 141, 140, 143, 147, 161, 161, 161, 161, 161,
769 - 161, 161, 161, 162, 139, 137, 136, 162, 162, 163,
770 - 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
771 - 164, 165, 134, 165, 166, 133, 128, 166, 127, 166,
772 - 166, 167, 126, 125, 167, 167, 167, 167, 168, 124,
773 - 168, 168, 169, 169, 169, 169, 169, 169, 169, 169,
775 - 170, 170, 170, 170, 170, 170, 170, 170, 171, 123,
776 - 171, 172, 122, 172, 172, 120, 172, 172, 173, 173,
777 - 173, 173, 173, 173, 173, 173, 174, 174, 174, 174,
778 - 174, 174, 174, 174, 119, 118, 117, 116, 114, 113,
779 - 111, 110, 109, 108, 107, 106, 105, 103, 102, 101,
780 - 99, 97, 96, 95, 94, 93, 92, 90, 88, 87,
781 - 86, 84, 83, 82, 81, 80, 79, 78, 76, 71,
782 - 70, 68, 65, 63, 62, 58, 52, 51, 49, 48,
783 - 47, 43, 40, 24, 23, 21, 15, 11, 8, 6,
784 - 3, 2, 160, 160, 160, 160, 160, 160, 160, 160,
786 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
787 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
788 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
789 - 160, 160, 160, 160, 160, 160, 160, 160, 160
790 + 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
791 + 3, 7, 7, 7, 163, 3, 11, 11, 11, 18,
792 + 18, 3, 3, 3, 3, 3, 5, 5, 5, 5,
793 + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
794 + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
795 + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
797 + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
798 + 5, 5, 5, 8, 12, 12, 12, 14, 15, 16,
799 + 8, 8, 8, 17, 20, 20, 17, 23, 42, 24,
800 + 29, 162, 24, 29, 29, 29, 16, 14, 31, 44,
801 + 29, 17, 134, 17, 134, 42, 17, 24, 17, 24,
802 + 76, 17, 24, 76, 24, 15, 44, 24, 36, 23,
803 + 26, 26, 26, 26, 34, 34, 34, 26, 161, 48,
804 + 31, 32, 32, 32, 26, 26, 26, 26, 36, 48,
805 + 32, 32, 32, 33, 33, 33, 60, 160, 74, 91,
806 + 91, 66, 33, 33, 66, 66, 66, 114, 60, 60,
808 + 60, 66, 68, 68, 68, 74, 85, 99, 124, 133,
809 + 102, 68, 68, 99, 102, 157, 156, 114, 85, 85,
810 + 85, 133, 133, 133, 140, 140, 140, 148, 124, 143,
811 + 143, 143, 152, 143, 147, 147, 147, 155, 147, 154,
812 + 151, 150, 149, 146, 145, 144, 142, 148, 141, 138,
813 + 137, 132, 152, 166, 166, 166, 166, 166, 166, 166,
814 + 166, 167, 131, 130, 129, 167, 167, 168, 168, 168,
815 + 168, 168, 168, 168, 168, 169, 169, 169, 169, 170,
816 + 128, 170, 171, 127, 126, 171, 125, 171, 171, 172,
817 + 123, 122, 172, 172, 172, 172, 173, 121, 173, 173,
819 + 174, 174, 174, 174, 174, 174, 174, 174, 175, 175,
820 + 175, 175, 175, 175, 175, 175, 176, 120, 176, 177,
821 + 119, 177, 177, 118, 177, 177, 178, 178, 178, 178,
822 + 178, 178, 178, 178, 179, 179, 179, 179, 179, 179,
823 + 179, 179, 116, 115, 113, 112, 111, 110, 109, 108,
824 + 107, 106, 105, 104, 103, 101, 100, 98, 97, 96,
825 + 95, 94, 92, 90, 88, 87, 86, 84, 83, 82,
826 + 81, 80, 79, 78, 77, 75, 73, 70, 69, 67,
827 + 64, 62, 61, 57, 51, 50, 49, 47, 46, 45,
828 + 41, 38, 22, 21, 19, 13, 9, 6, 4, 2,
830 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
831 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
832 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
833 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
834 + 165, 165, 165, 165, 165, 165, 165, 165
837 static yy_state_type yy_last_accepting_state;
838 @@ -631,13 +634,13 @@ char *yytext;
843 -#line 38 "dtc-lexer.l"
844 +#line 37 "dtc-lexer.l"
847 #include "dtc-parser.tab.h"
850 +extern bool treesource_error;
852 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
853 #define YY_USER_ACTION \
854 @@ -659,14 +662,14 @@ static int dts_version = 1;
857 static void push_input_file(const char *filename);
858 -static int pop_input_file(void);
859 -#line 664 "dtc-lexer.lex.c"
860 +static bool pop_input_file(void);
861 +static void lexical_error(const char *fmt, ...);
862 +#line 668 "dtc-lexer.lex.c"
866 -#define BYTESTRING 2
867 -#define PROPNODENAME 3
869 +#define BYTESTRING 1
870 +#define PROPNODENAME 2
873 #ifndef YY_NO_UNISTD_H
874 /* Special case for "unistd.h", since it is non-ANSI. We include it way
875 @@ -852,9 +855,9 @@ YY_DECL
876 register char *yy_cp, *yy_bp;
879 -#line 67 "dtc-lexer.l"
880 +#line 68 "dtc-lexer.l"
882 -#line 858 "dtc-lexer.lex.c"
883 +#line 861 "dtc-lexer.lex.c"
887 @@ -908,13 +911,13 @@ yy_match:
888 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
890 yy_current_state = (int) yy_def[yy_current_state];
891 - if ( yy_current_state >= 161 )
892 + if ( yy_current_state >= 166 )
893 yy_c = yy_meta[(unsigned int) yy_c];
895 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
898 - while ( yy_current_state != 160 );
899 + while ( yy_current_state != 165 );
900 yy_cp = (yy_last_accepting_cpos);
901 yy_current_state = (yy_last_accepting_state);
903 @@ -937,7 +940,7 @@ do_action: /* This label is used only to access EOF actions. */
905 /* rule 1 can match eol */
907 -#line 68 "dtc-lexer.l"
908 +#line 69 "dtc-lexer.l"
910 char *name = strchr(yytext, '\"') + 1;
911 yytext[yyleng-1] = '\0';
912 @@ -947,16 +950,16 @@ YY_RULE_SETUP
914 /* rule 2 can match eol */
916 -#line 74 "dtc-lexer.l"
917 +#line 75 "dtc-lexer.l"
919 char *line, *tmp, *fn;
920 /* skip text before line # */
922 - while (!isdigit(*line))
923 + while (!isdigit((unsigned char)*line))
925 /* skip digits in line # */
927 - while (!isspace(*tmp))
928 + while (!isspace((unsigned char)*tmp))
930 /* "NULL"-terminate line # */
932 @@ -970,11 +973,10 @@ YY_RULE_SETUP
935 case YY_STATE_EOF(INITIAL):
936 -case YY_STATE_EOF(INCLUDE):
937 case YY_STATE_EOF(BYTESTRING):
938 case YY_STATE_EOF(PROPNODENAME):
939 case YY_STATE_EOF(V1):
940 -#line 95 "dtc-lexer.l"
941 +#line 96 "dtc-lexer.l"
943 if (!pop_input_file()) {
945 @@ -984,7 +986,7 @@ case YY_STATE_EOF(V1):
947 /* rule 3 can match eol */
949 -#line 101 "dtc-lexer.l"
950 +#line 102 "dtc-lexer.l"
952 DPRINT("String: %s\n", yytext);
953 yylval.data = data_copy_escape_string(yytext+1,
954 @@ -994,7 +996,7 @@ YY_RULE_SETUP
958 -#line 108 "dtc-lexer.l"
959 +#line 109 "dtc-lexer.l"
961 DPRINT("Keyword: /dts-v1/\n");
963 @@ -1004,25 +1006,33 @@ YY_RULE_SETUP
967 -#line 115 "dtc-lexer.l"
968 +#line 116 "dtc-lexer.l"
970 + DPRINT("Keyword: /plugin/\n");
976 +#line 121 "dtc-lexer.l"
978 DPRINT("Keyword: /memreserve/\n");
980 return DT_MEMRESERVE;
986 -#line 121 "dtc-lexer.l"
987 +#line 127 "dtc-lexer.l"
989 DPRINT("Keyword: /bits/\n");
997 -#line 127 "dtc-lexer.l"
998 +#line 133 "dtc-lexer.l"
1000 DPRINT("Keyword: /delete-property/\n");
1001 DPRINT("<PROPNODENAME>\n");
1002 @@ -1030,9 +1040,9 @@ YY_RULE_SETUP
1009 -#line 134 "dtc-lexer.l"
1010 +#line 140 "dtc-lexer.l"
1012 DPRINT("Keyword: /delete-node/\n");
1013 DPRINT("<PROPNODENAME>\n");
1014 @@ -1040,9 +1050,9 @@ YY_RULE_SETUP
1021 -#line 141 "dtc-lexer.l"
1022 +#line 147 "dtc-lexer.l"
1024 DPRINT("Label: %s\n", yytext);
1025 yylval.labelref = xstrdup(yytext);
1026 @@ -1050,38 +1060,65 @@ YY_RULE_SETUP
1033 -#line 148 "dtc-lexer.l"
1034 +#line 154 "dtc-lexer.l"
1036 - yylval.literal = xstrdup(yytext);
1037 - DPRINT("Literal: '%s'\n", yylval.literal);
1039 + DPRINT("Integer Literal: '%s'\n", yytext);
1042 + yylval.integer = strtoull(yytext, &e, 0);
1044 + assert(!(*e) || !e[strspn(e, "UL")]);
1046 + if (errno == ERANGE)
1047 + lexical_error("Integer literal '%s' out of range",
1050 + /* ERANGE is the only strtoull error triggerable
1051 + * by strings matching the pattern */
1052 + assert(errno == 0);
1057 -/* rule 11 can match eol */
1059 +/* rule 12 can match eol */
1061 -#line 154 "dtc-lexer.l"
1062 +#line 173 "dtc-lexer.l"
1064 - yytext[yyleng-1] = '\0';
1065 - yylval.literal = xstrdup(yytext+1);
1066 - DPRINT("Character literal: %s\n", yylval.literal);
1068 + DPRINT("Character literal: %s\n", yytext);
1070 + d = data_copy_escape_string(yytext+1, yyleng-2);
1072 + lexical_error("Empty character literal");
1073 + yylval.integer = 0;
1074 + return DT_CHAR_LITERAL;
1077 + yylval.integer = (unsigned char)d.val[0];
1080 + lexical_error("Character literal has %d"
1081 + " characters instead of 1",
1084 return DT_CHAR_LITERAL;
1090 -#line 161 "dtc-lexer.l"
1091 +#line 194 "dtc-lexer.l"
1092 { /* label reference */
1093 DPRINT("Ref: %s\n", yytext+1);
1094 yylval.labelref = xstrdup(yytext+1);
1101 -#line 167 "dtc-lexer.l"
1102 +#line 200 "dtc-lexer.l"
1103 { /* new-style path reference */
1104 yytext[yyleng-1] = '\0';
1105 DPRINT("Ref: %s\n", yytext+2);
1106 @@ -1089,27 +1126,27 @@ YY_RULE_SETUP
1113 -#line 174 "dtc-lexer.l"
1114 +#line 207 "dtc-lexer.l"
1116 yylval.byte = strtol(yytext, NULL, 16);
1117 DPRINT("Byte: %02x\n", (int)yylval.byte);
1124 -#line 180 "dtc-lexer.l"
1125 +#line 213 "dtc-lexer.l"
1127 DPRINT("/BYTESTRING\n");
1135 -#line 186 "dtc-lexer.l"
1136 +#line 219 "dtc-lexer.l"
1138 DPRINT("PropNodeName: %s\n", yytext);
1139 yylval.propnodename = xstrdup((yytext[0] == '\\') ?
1140 @@ -1118,75 +1155,75 @@ YY_RULE_SETUP
1141 return DT_PROPNODENAME;
1147 -#line 194 "dtc-lexer.l"
1148 +#line 227 "dtc-lexer.l"
1150 DPRINT("Binary Include\n");
1155 -/* rule 18 can match eol */
1157 -#line 199 "dtc-lexer.l"
1158 -/* eat whitespace */
1161 /* rule 19 can match eol */
1163 -#line 200 "dtc-lexer.l"
1164 -/* eat C-style comments */
1165 +#line 232 "dtc-lexer.l"
1166 +/* eat whitespace */
1169 /* rule 20 can match eol */
1171 -#line 201 "dtc-lexer.l"
1172 -/* eat C++-style comments */
1173 +#line 233 "dtc-lexer.l"
1174 +/* eat C-style comments */
1177 +/* rule 21 can match eol */
1179 -#line 203 "dtc-lexer.l"
1180 -{ return DT_LSHIFT; };
1181 +#line 234 "dtc-lexer.l"
1182 +/* eat C++-style comments */
1186 -#line 204 "dtc-lexer.l"
1187 -{ return DT_RSHIFT; };
1188 +#line 236 "dtc-lexer.l"
1189 +{ return DT_LSHIFT; };
1193 -#line 205 "dtc-lexer.l"
1195 +#line 237 "dtc-lexer.l"
1196 +{ return DT_RSHIFT; };
1200 -#line 206 "dtc-lexer.l"
1202 +#line 238 "dtc-lexer.l"
1207 -#line 207 "dtc-lexer.l"
1209 +#line 239 "dtc-lexer.l"
1214 -#line 208 "dtc-lexer.l"
1216 +#line 240 "dtc-lexer.l"
1221 -#line 209 "dtc-lexer.l"
1222 -{ return DT_AND; };
1223 +#line 241 "dtc-lexer.l"
1228 -#line 210 "dtc-lexer.l"
1230 +#line 242 "dtc-lexer.l"
1231 +{ return DT_AND; };
1235 -#line 212 "dtc-lexer.l"
1236 +#line 243 "dtc-lexer.l"
1241 +#line 245 "dtc-lexer.l"
1243 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1244 (unsigned)yytext[0]);
1245 @@ -1202,12 +1239,12 @@ YY_RULE_SETUP
1252 -#line 227 "dtc-lexer.l"
1253 +#line 260 "dtc-lexer.l"
1256 -#line 1211 "dtc-lexer.lex.c"
1257 +#line 1248 "dtc-lexer.lex.c"
1259 case YY_END_OF_BUFFER:
1261 @@ -1499,7 +1536,7 @@ static int yy_get_next_buffer (void)
1262 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1264 yy_current_state = (int) yy_def[yy_current_state];
1265 - if ( yy_current_state >= 161 )
1266 + if ( yy_current_state >= 166 )
1267 yy_c = yy_meta[(unsigned int) yy_c];
1269 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1270 @@ -1527,11 +1564,11 @@ static int yy_get_next_buffer (void)
1271 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1273 yy_current_state = (int) yy_def[yy_current_state];
1274 - if ( yy_current_state >= 161 )
1275 + if ( yy_current_state >= 166 )
1276 yy_c = yy_meta[(unsigned int) yy_c];
1278 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1279 - yy_is_jam = (yy_current_state == 160);
1280 + yy_is_jam = (yy_current_state == 165);
1282 return yy_is_jam ? 0 : yy_current_state;
1284 @@ -2166,7 +2203,7 @@ void yyfree (void * ptr )
1286 #define YYTABLES_NAME "yytables"
1288 -#line 227 "dtc-lexer.l"
1289 +#line 260 "dtc-lexer.l"
1293 @@ -2182,14 +2219,25 @@ static void push_input_file(const char *filename)
1297 -static int pop_input_file(void)
1298 +static bool pop_input_file(void)
1300 if (srcfile_pop() == 0)
1304 yypop_buffer_state();
1305 yyin = current_srcfile->f;
1311 +static void lexical_error(const char *fmt, ...)
1315 + va_start(ap, fmt);
1316 + srcpos_verror(&yylloc, "Lexical error", fmt, ap);
1319 + treesource_error = true;
1322 diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped
1323 index c8769d5..1938d20 100644
1324 --- a/scripts/dtc/dtc-parser.tab.c_shipped
1325 +++ b/scripts/dtc/dtc-parser.tab.c_shipped
1327 -/* A Bison parser, made by GNU Bison 2.7.12-4996. */
1328 +/* A Bison parser, made by GNU Bison 3.0.2. */
1330 /* Bison implementation for Yacc-like parsers in C
1332 - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
1335 + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
1337 This program is free software: you can redistribute it and/or modify
1338 it under the terms of the GNU General Public License as published by
1339 the Free Software Foundation, either version 3 of the License, or
1340 (at your option) any later version.
1343 This program is distributed in the hope that it will be useful,
1344 but WITHOUT ANY WARRANTY; without even the implied warranty of
1345 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1346 GNU General Public License for more details.
1349 You should have received a copy of the GNU General Public License
1350 along with this program. If not, see <http://www.gnu.org/licenses/>. */
1353 special exception, which will cause the skeleton and the resulting
1354 Bison output files to be licensed under the GNU General Public
1355 License without this special exception.
1358 This special exception was added by the Free Software Foundation in
1359 version 2.2 of Bison. */
1364 /* Bison version. */
1365 -#define YYBISON_VERSION "2.7.12-4996"
1366 +#define YYBISON_VERSION "3.0.2"
1368 /* Skeleton name. */
1369 #define YYSKELETON_NAME "yacc.c"
1373 /* Copy the first part of user declarations. */
1374 -/* Line 371 of yacc.c */
1375 -#line 21 "dtc-parser.y"
1376 +#line 20 "dtc-parser.y" /* yacc.c:339 */
1379 +#include <inttypes.h>
1386 extern int yylex(void);
1387 -extern void print_error(char const *fmt, ...);
1388 extern void yyerror(char const *s);
1389 +#define ERROR(loc, ...) \
1391 + srcpos_error((loc), "Error", __VA_ARGS__); \
1392 + treesource_error = true; \
1395 extern struct boot_info *the_boot_info;
1396 -extern int treesource_error;
1398 -static unsigned long long eval_literal(const char *s, int base, int bits);
1399 -static unsigned char eval_char_literal(const char *s);
1400 +extern bool treesource_error;
1402 -/* Line 371 of yacc.c */
1403 -#line 87 "dtc-parser.tab.c"
1404 +#line 85 "dtc-parser.tab.c" /* yacc.c:339 */
1407 +# ifndef YY_NULLPTR
1408 # if defined __cplusplus && 201103L <= __cplusplus
1409 -# define YY_NULL nullptr
1410 +# define YY_NULLPTR nullptr
1413 +# define YY_NULLPTR 0
1417 @@ -105,7 +103,7 @@ static unsigned char eval_char_literal(const char *s);
1418 by #include "dtc-parser.tab.h". */
1419 #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED
1420 # define YY_YY_DTC_PARSER_TAB_H_INCLUDED
1421 -/* Enabling traces. */
1422 +/* Debug traces. */
1426 @@ -113,48 +111,45 @@ static unsigned char eval_char_literal(const char *s);
1433 # define YYTOKENTYPE
1434 - /* Put the tokens into the symbol table, so that GDB and other debuggers
1435 - know about them. */
1436 - enum yytokentype {
1438 - DT_MEMRESERVE = 259,
1448 - DT_DEL_PROP = 269,
1449 - DT_DEL_NODE = 270,
1450 - DT_PROPNODENAME = 271,
1452 - DT_CHAR_LITERAL = 273,
1464 + DT_MEMRESERVE = 260,
1474 + DT_DEL_PROP = 270,
1475 + DT_DEL_NODE = 271,
1476 + DT_PROPNODENAME = 272,
1478 + DT_CHAR_LITERAL = 274,
1489 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1490 -typedef union YYSTYPE
1491 +typedef union YYSTYPE YYSTYPE;
1494 -/* Line 387 of yacc.c */
1495 -#line 40 "dtc-parser.y"
1496 +#line 39 "dtc-parser.y" /* yacc.c:355 */
1501 - unsigned int cbase;
1505 @@ -169,38 +164,38 @@ typedef union YYSTYPE
1506 struct node *nodelist;
1507 struct reserve_info *re;
1512 -/* Line 387 of yacc.c */
1513 -#line 176 "dtc-parser.tab.c"
1515 +#line 170 "dtc-parser.tab.c" /* yacc.c:355 */
1517 # define YYSTYPE_IS_TRIVIAL 1
1518 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1519 # define YYSTYPE_IS_DECLARED 1
1522 -extern YYSTYPE yylval;
1524 -#ifdef YYPARSE_PARAM
1525 -#if defined __STDC__ || defined __cplusplus
1526 -int yyparse (void *YYPARSE_PARAM);
1529 +/* Location type. */
1530 +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
1531 +typedef struct YYLTYPE YYLTYPE;
1539 +# define YYLTYPE_IS_DECLARED 1
1540 +# define YYLTYPE_IS_TRIVIAL 1
1542 -#else /* ! YYPARSE_PARAM */
1543 -#if defined __STDC__ || defined __cplusplus
1546 +extern YYSTYPE yylval;
1547 +extern YYLTYPE yylloc;
1552 -#endif /* ! YYPARSE_PARAM */
1554 #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */
1556 /* Copy the second part of user declarations. */
1558 -/* Line 390 of yacc.c */
1559 -#line 204 "dtc-parser.tab.c"
1560 +#line 199 "dtc-parser.tab.c" /* yacc.c:358 */
1564 @@ -214,11 +209,8 @@ typedef unsigned char yytype_uint8;
1567 typedef YYTYPE_INT8 yytype_int8;
1568 -#elif (defined __STDC__ || defined __C99__FUNC__ \
1569 - || defined __cplusplus || defined _MSC_VER)
1570 -typedef signed char yytype_int8;
1572 -typedef short int yytype_int8;
1573 +typedef signed char yytype_int8;
1576 #ifdef YYTYPE_UINT16
1577 @@ -238,8 +230,7 @@ typedef short int yytype_int16;
1578 # define YYSIZE_T __SIZE_TYPE__
1579 # elif defined size_t
1580 # define YYSIZE_T size_t
1581 -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1582 - || defined __cplusplus || defined _MSC_VER)
1583 +# elif ! defined YYSIZE_T
1584 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1585 # define YYSIZE_T size_t
1587 @@ -261,11 +252,30 @@ typedef short int yytype_int16;
1591 -#ifndef __attribute__
1592 -/* This feature is available in gcc versions 2.5 and later. */
1593 -# if (! defined __GNUC__ || __GNUC__ < 2 \
1594 - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
1595 -# define __attribute__(Spec) /* empty */
1596 +#ifndef YY_ATTRIBUTE
1597 +# if (defined __GNUC__ \
1598 + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
1599 + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
1600 +# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
1602 +# define YY_ATTRIBUTE(Spec) /* empty */
1606 +#ifndef YY_ATTRIBUTE_PURE
1607 +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
1610 +#ifndef YY_ATTRIBUTE_UNUSED
1611 +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
1614 +#if !defined _Noreturn \
1615 + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
1616 +# if defined _MSC_VER && 1200 <= _MSC_VER
1617 +# define _Noreturn __declspec (noreturn)
1619 +# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
1623 @@ -276,25 +286,26 @@ typedef short int yytype_int16;
1624 # define YYUSE(E) /* empty */
1628 -/* Identity function, used to suppress warnings about constant conditions. */
1630 -# define YYID(N) (N)
1632 -#if (defined __STDC__ || defined __C99__FUNC__ \
1633 - || defined __cplusplus || defined _MSC_VER)
1636 +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
1637 +/* Suppress an incorrect diagnostic about yylval being uninitialized. */
1638 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
1639 + _Pragma ("GCC diagnostic push") \
1640 + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
1641 + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1642 +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
1643 + _Pragma ("GCC diagnostic pop")
1648 +# define YY_INITIAL_VALUE(Value) Value
1653 +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1654 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1655 +# define YY_IGNORE_MAYBE_UNINITIALIZED_END
1657 +#ifndef YY_INITIAL_VALUE
1658 +# define YY_INITIAL_VALUE(Value) /* Nothing. */
1662 #if ! defined yyoverflow || YYERROR_VERBOSE
1664 /* The parser invokes alloca or malloc; define the necessary symbols. */
1665 @@ -312,8 +323,7 @@ YYID (yyi)
1666 # define alloca _alloca
1668 # define YYSTACK_ALLOC alloca
1669 -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1670 - || defined __cplusplus || defined _MSC_VER)
1671 +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
1672 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1673 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
1674 # ifndef EXIT_SUCCESS
1675 @@ -325,8 +335,8 @@ YYID (yyi)
1678 # ifdef YYSTACK_ALLOC
1679 - /* Pacify GCC's `empty if-body' warning. */
1680 -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1681 + /* Pacify GCC's 'empty if-body' warning. */
1682 +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1683 # ifndef YYSTACK_ALLOC_MAXIMUM
1684 /* The OS might guarantee only one guard page at the bottom of the stack,
1685 and a page size can be as small as 4096 bytes. So we cannot safely
1686 @@ -342,7 +352,7 @@ YYID (yyi)
1688 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
1689 && ! ((defined YYMALLOC || defined malloc) \
1690 - && (defined YYFREE || defined free)))
1691 + && (defined YYFREE || defined free)))
1692 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1693 # ifndef EXIT_SUCCESS
1694 # define EXIT_SUCCESS 0
1695 @@ -350,15 +360,13 @@ YYID (yyi)
1698 # define YYMALLOC malloc
1699 -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1700 - || defined __cplusplus || defined _MSC_VER)
1701 +# if ! defined malloc && ! defined EXIT_SUCCESS
1702 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1706 # define YYFREE free
1707 -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1708 - || defined __cplusplus || defined _MSC_VER)
1709 +# if ! defined free && ! defined EXIT_SUCCESS
1710 void free (void *); /* INFRINGES ON USER NAME SPACE */
1713 @@ -368,13 +376,15 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
1715 #if (! defined yyoverflow \
1716 && (! defined __cplusplus \
1717 - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1718 + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
1719 + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1721 /* A type that is properly aligned for any stack member. */
1724 yytype_int16 yyss_alloc;
1726 + YYLTYPE yyls_alloc;
1729 /* The size of the maximum gap between one aligned stack and the next. */
1730 @@ -383,8 +393,8 @@ union yyalloc
1731 /* The size of an array large to enough to hold all stacks, each with
1733 # define YYSTACK_BYTES(N) \
1734 - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1735 - + YYSTACK_GAP_MAXIMUM)
1736 + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
1737 + + 2 * YYSTACK_GAP_MAXIMUM)
1739 # define YYCOPY_NEEDED 1
1741 @@ -393,16 +403,16 @@ union yyalloc
1742 elements in the stack, and YYPTR gives the new location of the
1743 stack. Advance YYPTR to a properly aligned location for the next
1745 -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
1748 - YYSIZE_T yynewbytes; \
1749 - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
1750 - Stack = &yyptr->Stack_alloc; \
1751 - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1752 - yyptr += yynewbytes / sizeof (*yyptr); \
1755 +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
1758 + YYSIZE_T yynewbytes; \
1759 + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
1760 + Stack = &yyptr->Stack_alloc; \
1761 + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1762 + yyptr += yynewbytes / sizeof (*yyptr); \
1768 @@ -421,7 +431,7 @@ union yyalloc
1769 for (yyi = 0; yyi < (Count); yyi++) \
1770 (Dst)[yyi] = (Src)[yyi]; \
1776 #endif /* !YYCOPY_NEEDED */
1777 @@ -429,25 +439,27 @@ union yyalloc
1778 /* YYFINAL -- State number of the termination state. */
1780 /* YYLAST -- Last index in YYTABLE. */
1784 /* YYNTOKENS -- Number of terminals. */
1785 #define YYNTOKENS 48
1786 /* YYNNTS -- Number of nonterminals. */
1789 /* YYNRULES -- Number of rules. */
1790 -#define YYNRULES 79
1791 -/* YYNRULES -- Number of states. */
1792 -#define YYNSTATES 141
1793 +#define YYNRULES 81
1794 +/* YYNSTATES -- Number of states. */
1795 +#define YYNSTATES 144
1797 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1798 +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
1799 + by yylex, with out-of-bounds checking. */
1800 #define YYUNDEFTOK 2
1801 #define YYMAXUTOK 279
1803 -#define YYTRANSLATE(YYX) \
1804 +#define YYTRANSLATE(YYX) \
1805 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1807 -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1808 +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
1809 + as returned by yylex, without out-of-bounds checking. */
1810 static const yytype_uint8 yytranslate[] =
1812 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1813 @@ -481,63 +493,18 @@ static const yytype_uint8 yytranslate[] =
1817 -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1819 -static const yytype_uint16 yyprhs[] =
1821 - 0, 0, 3, 8, 9, 12, 17, 20, 23, 27,
1822 - 31, 36, 42, 43, 46, 51, 54, 58, 61, 64,
1823 - 68, 73, 76, 86, 92, 95, 96, 99, 102, 106,
1824 - 108, 111, 114, 117, 119, 121, 125, 127, 129, 135,
1825 - 137, 141, 143, 147, 149, 153, 155, 159, 161, 165,
1826 - 167, 171, 175, 177, 181, 185, 189, 193, 197, 201,
1827 - 203, 207, 211, 213, 217, 221, 225, 227, 229, 232,
1828 - 235, 238, 239, 242, 245, 246, 249, 252, 255, 259
1831 -/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1832 -static const yytype_int8 yyrhs[] =
1834 - 49, 0, -1, 3, 25, 50, 52, -1, -1, 51,
1835 - 50, -1, 4, 59, 59, 25, -1, 22, 51, -1,
1836 - 26, 53, -1, 52, 26, 53, -1, 52, 23, 53,
1837 - -1, 52, 15, 23, 25, -1, 27, 54, 74, 28,
1838 - 25, -1, -1, 54, 55, -1, 16, 29, 56, 25,
1839 - -1, 16, 25, -1, 14, 16, 25, -1, 22, 55,
1840 - -1, 57, 21, -1, 57, 58, 30, -1, 57, 31,
1841 - 73, 32, -1, 57, 23, -1, 57, 24, 33, 21,
1842 - 34, 59, 34, 59, 35, -1, 57, 24, 33, 21,
1843 - 35, -1, 56, 22, -1, -1, 56, 34, -1, 57,
1844 - 22, -1, 13, 17, 36, -1, 36, -1, 58, 59,
1845 - -1, 58, 23, -1, 58, 22, -1, 17, -1, 18,
1846 - -1, 33, 60, 35, -1, 61, -1, 62, -1, 62,
1847 - 37, 60, 38, 61, -1, 63, -1, 62, 12, 63,
1848 - -1, 64, -1, 63, 11, 64, -1, 65, -1, 64,
1849 - 39, 65, -1, 66, -1, 65, 40, 66, -1, 67,
1850 - -1, 66, 41, 67, -1, 68, -1, 67, 9, 68,
1851 - -1, 67, 10, 68, -1, 69, -1, 68, 36, 69,
1852 - -1, 68, 30, 69, -1, 68, 7, 69, -1, 68,
1853 - 8, 69, -1, 69, 5, 70, -1, 69, 6, 70,
1854 - -1, 70, -1, 70, 42, 71, -1, 70, 43, 71,
1855 - -1, 71, -1, 71, 44, 72, -1, 71, 26, 72,
1856 - -1, 71, 45, 72, -1, 72, -1, 59, -1, 43,
1857 - 72, -1, 46, 72, -1, 47, 72, -1, -1, 73,
1858 - 20, -1, 73, 22, -1, -1, 75, 74, -1, 75,
1859 - 55, -1, 16, 53, -1, 15, 16, 25, -1, 22,
1863 -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1864 + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
1865 static const yytype_uint16 yyrline[] =
1867 - 0, 109, 109, 118, 121, 128, 132, 140, 144, 148,
1868 - 158, 172, 180, 183, 190, 194, 198, 202, 210, 214,
1869 - 218, 222, 226, 243, 253, 261, 264, 268, 275, 290,
1870 - 295, 315, 329, 336, 340, 344, 351, 355, 356, 360,
1871 - 361, 365, 366, 370, 371, 375, 376, 380, 381, 385,
1872 - 386, 387, 391, 392, 393, 394, 395, 399, 400, 401,
1873 - 405, 406, 407, 411, 412, 413, 414, 418, 419, 420,
1874 - 421, 426, 429, 433, 441, 444, 448, 456, 460, 464
1875 + 0, 108, 108, 119, 122, 130, 133, 140, 144, 152,
1876 + 156, 160, 170, 185, 193, 196, 203, 207, 211, 215,
1877 + 223, 227, 231, 235, 239, 255, 265, 273, 276, 280,
1878 + 287, 303, 308, 327, 341, 348, 349, 350, 357, 361,
1879 + 362, 366, 367, 371, 372, 376, 377, 381, 382, 386,
1880 + 387, 391, 392, 393, 397, 398, 399, 400, 401, 405,
1881 + 406, 407, 411, 412, 413, 417, 418, 419, 420, 424,
1882 + 425, 426, 427, 432, 435, 439, 447, 450, 454, 462,
1887 @@ -546,25 +513,25 @@ static const yytype_uint16 yyrline[] =
1888 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1889 static const char *const yytname[] =
1891 - "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT",
1892 - "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR",
1893 - "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL",
1894 - "DT_CHAR_LITERAL", "DT_BASE", "DT_BYTE", "DT_STRING", "DT_LABEL",
1895 + "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE",
1896 + "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND",
1897 + "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME",
1898 + "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL",
1899 "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['",
1900 "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'",
1901 "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile",
1902 - "memreserves", "memreserve", "devicetree", "nodedef", "proplist",
1903 - "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim",
1904 - "integer_expr", "integer_trinary", "integer_or", "integer_and",
1905 - "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq",
1906 - "integer_rela", "integer_shift", "integer_add", "integer_mul",
1907 - "integer_unary", "bytestring", "subnodes", "subnode", YY_NULL
1908 + "plugindecl", "memreserves", "memreserve", "devicetree", "nodedef",
1909 + "proplist", "propdef", "propdata", "propdataprefix", "arrayprefix",
1910 + "integer_prim", "integer_expr", "integer_trinary", "integer_or",
1911 + "integer_and", "integer_bitor", "integer_bitxor", "integer_bitand",
1912 + "integer_eq", "integer_rela", "integer_shift", "integer_add",
1913 + "integer_mul", "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR
1918 -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1919 - token YYLEX-NUM. */
1920 +/* YYTOKNUM[NUM] -- (External) token number corresponding to the
1921 + (internal) symbol number NUM (which must be that of a token). */
1922 static const yytype_uint16 yytoknum[] =
1924 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1925 @@ -575,183 +542,173 @@ static const yytype_uint16 yytoknum[] =
1929 -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1930 -static const yytype_uint8 yyr1[] =
1932 - 0, 48, 49, 50, 50, 51, 51, 52, 52, 52,
1933 - 52, 53, 54, 54, 55, 55, 55, 55, 56, 56,
1934 - 56, 56, 56, 56, 56, 57, 57, 57, 58, 58,
1935 - 58, 58, 58, 59, 59, 59, 60, 61, 61, 62,
1936 - 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
1937 - 67, 67, 68, 68, 68, 68, 68, 69, 69, 69,
1938 - 70, 70, 70, 71, 71, 71, 71, 72, 72, 72,
1939 - 72, 73, 73, 73, 74, 74, 74, 75, 75, 75
1941 +#define YYPACT_NINF -41
1943 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1944 -static const yytype_uint8 yyr2[] =
1945 +#define yypact_value_is_default(Yystate) \
1946 + (!!((Yystate) == (-41)))
1948 +#define YYTABLE_NINF -1
1950 +#define yytable_value_is_error(Yytable_value) \
1953 + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1955 +static const yytype_int8 yypact[] =
1957 - 0, 2, 4, 0, 2, 4, 2, 2, 3, 3,
1958 - 4, 5, 0, 2, 4, 2, 3, 2, 2, 3,
1959 - 4, 2, 9, 5, 2, 0, 2, 2, 3, 1,
1960 - 2, 2, 2, 1, 1, 3, 1, 1, 5, 1,
1961 - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
1962 - 3, 3, 1, 3, 3, 3, 3, 3, 3, 1,
1963 - 3, 3, 1, 3, 3, 3, 1, 1, 2, 2,
1964 - 2, 0, 2, 2, 0, 2, 2, 2, 3, 2
1965 + 37, 10, 24, 78, -41, 20, 9, -41, 8, 9,
1966 + 59, 9, -41, -41, -10, 8, -41, 60, 39, -41,
1967 + -10, -10, -10, -41, 51, -41, -7, 76, 50, 52,
1968 + 53, 49, 2, 65, 32, -1, -41, 66, -41, -41,
1969 + 67, 60, 60, -41, -41, -41, -41, -10, -10, -10,
1970 + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
1971 + -10, -10, -10, -10, -10, -10, -41, 41, 68, -41,
1972 + -41, 76, 57, 50, 52, 53, 49, 2, 2, 65,
1973 + 65, 65, 65, 32, 32, -1, -1, -41, -41, -41,
1974 + 79, 80, -12, 41, -41, 70, 41, -41, -10, 74,
1975 + 75, -41, -41, -41, -41, -41, 77, -41, -41, -41,
1976 + -41, -41, 17, -2, -41, -41, -41, -41, 83, -41,
1977 + -41, -41, 71, -41, -41, 31, 69, 82, -4, -41,
1978 + -41, -41, -41, -41, 42, -41, -41, -41, 8, -41,
1982 -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
1983 - Performed when YYTABLE doesn't specify something else to do. Zero
1984 - means the default is an error. */
1985 + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
1986 + Performed when YYTABLE does not specify something else to do. Zero
1987 + means the default is an error. */
1988 static const yytype_uint8 yydefact[] =
1990 - 0, 0, 0, 3, 1, 0, 0, 0, 3, 33,
1991 - 34, 0, 0, 6, 0, 2, 4, 0, 0, 0,
1992 - 67, 0, 36, 37, 39, 41, 43, 45, 47, 49,
1993 - 52, 59, 62, 66, 0, 12, 7, 0, 0, 0,
1994 - 68, 69, 70, 35, 0, 0, 0, 0, 0, 0,
1995 + 0, 0, 0, 3, 1, 0, 5, 4, 0, 0,
1996 + 0, 5, 35, 36, 0, 0, 8, 0, 2, 6,
1997 + 0, 0, 0, 69, 0, 38, 39, 41, 43, 45,
1998 + 47, 49, 51, 54, 61, 64, 68, 0, 14, 9,
1999 + 0, 0, 0, 70, 71, 72, 37, 0, 0, 0,
2000 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2001 - 0, 0, 0, 5, 74, 0, 9, 8, 40, 0,
2002 - 42, 44, 46, 48, 50, 51, 55, 56, 54, 53,
2003 - 57, 58, 60, 61, 64, 63, 65, 0, 0, 0,
2004 - 0, 13, 0, 74, 10, 0, 0, 0, 15, 25,
2005 - 77, 17, 79, 0, 76, 75, 38, 16, 78, 0,
2006 - 0, 11, 24, 14, 26, 0, 18, 27, 21, 0,
2007 - 71, 29, 0, 0, 0, 0, 32, 31, 19, 30,
2008 - 28, 0, 72, 73, 20, 0, 23, 0, 0, 0,
2010 + 0, 0, 0, 0, 0, 0, 7, 76, 0, 11,
2011 + 10, 42, 0, 44, 46, 48, 50, 52, 53, 57,
2012 + 58, 56, 55, 59, 60, 62, 63, 66, 65, 67,
2013 + 0, 0, 0, 0, 15, 0, 76, 12, 0, 0,
2014 + 0, 17, 27, 79, 19, 81, 0, 78, 77, 40,
2015 + 18, 80, 0, 0, 13, 26, 16, 28, 0, 20,
2016 + 29, 23, 0, 73, 31, 0, 0, 0, 0, 34,
2017 + 33, 21, 32, 30, 0, 74, 75, 22, 0, 25,
2021 -/* YYDEFGOTO[NTERM-NUM]. */
2022 -static const yytype_int8 yydefgoto[] =
2023 + /* YYPGOTO[NTERM-NUM]. */
2024 +static const yytype_int8 yypgoto[] =
2026 - -1, 2, 7, 8, 15, 36, 64, 91, 109, 110,
2027 - 122, 20, 21, 22, 23, 24, 25, 26, 27, 28,
2028 - 29, 30, 31, 32, 33, 125, 92, 93
2029 + -41, -41, -41, 96, 100, -41, -40, -41, -23, -41,
2030 + -41, -41, -8, 62, 13, -41, 81, 63, 64, 84,
2031 + 61, 25, 11, 21, 22, -17, -41, 19, 23
2034 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2036 -#define YYPACT_NINF -78
2037 -static const yytype_int8 yypact[] =
2038 + /* YYDEFGOTO[NTERM-NUM]. */
2039 +static const yytype_int16 yydefgoto[] =
2041 - 22, 11, 51, 10, -78, 23, 10, 2, 10, -78,
2042 - -78, -9, 23, -78, 30, 38, -78, -9, -9, -9,
2043 - -78, 35, -78, -6, 52, 29, 48, 49, 33, 3,
2044 - 71, 36, 0, -78, 64, -78, -78, 68, 30, 30,
2045 - -78, -78, -78, -78, -9, -9, -9, -9, -9, -9,
2046 - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
2047 - -9, -9, -9, -78, 44, 67, -78, -78, 52, 55,
2048 - 29, 48, 49, 33, 3, 3, 71, 71, 71, 71,
2049 - 36, 36, 0, 0, -78, -78, -78, 78, 79, 42,
2050 - 44, -78, 69, 44, -78, -9, 73, 74, -78, -78,
2051 - -78, -78, -78, 75, -78, -78, -78, -78, -78, -7,
2052 - -1, -78, -78, -78, -78, 84, -78, -78, -78, 63,
2053 - -78, -78, 32, 66, 82, -3, -78, -78, -78, -78,
2054 - -78, 46, -78, -78, -78, 23, -78, 70, 23, 72,
2056 + -1, 2, 6, 10, 11, 18, 39, 67, 94, 112,
2057 + 113, 125, 23, 24, 25, 26, 27, 28, 29, 30,
2058 + 31, 32, 33, 34, 35, 36, 128, 95, 96
2061 -/* YYPGOTO[NTERM-NUM]. */
2062 -static const yytype_int8 yypgoto[] =
2063 + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
2064 + positive, shift that token. If negative, reduce the rule whose
2065 + number is the opposite. If YYTABLE_NINF, syntax error. */
2066 +static const yytype_uint8 yytable[] =
2068 - -78, -78, 97, 100, -78, -37, -78, -77, -78, -78,
2069 - -78, -5, 65, 13, -78, 76, 77, 62, 80, 83,
2070 - 34, 20, 26, 28, -14, -78, 18, 24
2071 + 15, 69, 70, 43, 44, 45, 47, 37, 12, 13,
2072 + 55, 56, 118, 101, 8, 38, 135, 102, 136, 119,
2073 + 120, 121, 122, 14, 4, 63, 12, 13, 137, 123,
2074 + 48, 9, 57, 20, 124, 3, 21, 22, 58, 115,
2075 + 1, 14, 116, 64, 65, 7, 87, 88, 89, 12,
2076 + 13, 117, 103, 129, 130, 40, 90, 91, 92, 53,
2077 + 54, 131, 41, 93, 14, 42, 79, 80, 81, 82,
2078 + 104, 59, 60, 107, 61, 62, 138, 139, 77, 78,
2079 + 83, 84, 5, 85, 86, 17, 46, 38, 49, 50,
2080 + 68, 66, 51, 97, 52, 98, 99, 100, 106, 110,
2081 + 111, 126, 114, 134, 127, 133, 141, 19, 143, 16,
2082 + 72, 109, 73, 76, 74, 108, 105, 132, 0, 0,
2083 + 0, 0, 0, 0, 0, 0, 0, 0, 71, 0,
2084 + 140, 0, 0, 142, 0, 75
2087 -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2088 - positive, shift that token. If negative, reduce the rule which
2089 - number is the opposite. If YYTABLE_NINF, syntax error. */
2090 -#define YYTABLE_NINF -1
2091 -static const yytype_uint8 yytable[] =
2092 +static const yytype_int16 yycheck[] =
2094 - 12, 66, 67, 40, 41, 42, 44, 34, 9, 10,
2095 - 52, 53, 115, 101, 5, 112, 104, 132, 113, 133,
2096 - 116, 117, 118, 119, 11, 1, 60, 114, 14, 134,
2097 - 120, 45, 6, 54, 17, 121, 3, 18, 19, 55,
2098 - 9, 10, 50, 51, 61, 62, 84, 85, 86, 9,
2099 - 10, 4, 100, 37, 126, 127, 11, 35, 87, 88,
2100 - 89, 38, 128, 46, 39, 11, 90, 98, 47, 35,
2101 - 43, 99, 76, 77, 78, 79, 56, 57, 58, 59,
2102 - 135, 136, 80, 81, 74, 75, 82, 83, 48, 63,
2103 - 49, 65, 94, 95, 96, 97, 124, 103, 107, 108,
2104 - 111, 123, 130, 131, 138, 16, 13, 140, 106, 71,
2105 - 69, 105, 0, 0, 102, 0, 0, 129, 0, 0,
2106 - 68, 0, 0, 70, 0, 0, 0, 0, 72, 0,
2108 + 8, 41, 42, 20, 21, 22, 13, 15, 18, 19,
2109 + 8, 9, 14, 25, 5, 27, 20, 29, 22, 21,
2110 + 22, 23, 24, 33, 0, 26, 18, 19, 32, 31,
2111 + 37, 22, 30, 43, 36, 25, 46, 47, 36, 22,
2112 + 3, 33, 25, 44, 45, 25, 63, 64, 65, 18,
2113 + 19, 34, 92, 22, 23, 16, 15, 16, 17, 10,
2114 + 11, 30, 23, 22, 33, 26, 55, 56, 57, 58,
2115 + 93, 6, 7, 96, 42, 43, 34, 35, 53, 54,
2116 + 59, 60, 4, 61, 62, 26, 35, 27, 12, 39,
2117 + 23, 25, 40, 25, 41, 38, 17, 17, 28, 25,
2118 + 25, 18, 25, 21, 33, 36, 34, 11, 35, 9,
2119 + 48, 98, 49, 52, 50, 96, 93, 125, -1, -1,
2120 + -1, -1, -1, -1, -1, -1, -1, -1, 47, -1,
2121 + 138, -1, -1, 141, -1, 51
2124 -#define yypact_value_is_default(Yystate) \
2125 - (!!((Yystate) == (-78)))
2127 -#define yytable_value_is_error(Yytable_value) \
2129 + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2130 + symbol of state STATE-NUM. */
2131 +static const yytype_uint8 yystos[] =
2133 + 0, 3, 49, 25, 0, 4, 50, 25, 5, 22,
2134 + 51, 52, 18, 19, 33, 60, 52, 26, 53, 51,
2135 + 43, 46, 47, 60, 61, 62, 63, 64, 65, 66,
2136 + 67, 68, 69, 70, 71, 72, 73, 60, 27, 54,
2137 + 16, 23, 26, 73, 73, 73, 35, 13, 37, 12,
2138 + 39, 40, 41, 10, 11, 8, 9, 30, 36, 6,
2139 + 7, 42, 43, 26, 44, 45, 25, 55, 23, 54,
2140 + 54, 64, 61, 65, 66, 67, 68, 69, 69, 70,
2141 + 70, 70, 70, 71, 71, 72, 72, 73, 73, 73,
2142 + 15, 16, 17, 22, 56, 75, 76, 25, 38, 17,
2143 + 17, 25, 29, 54, 56, 76, 28, 56, 75, 62,
2144 + 25, 25, 57, 58, 25, 22, 25, 34, 14, 21,
2145 + 22, 23, 24, 31, 36, 59, 18, 33, 74, 22,
2146 + 23, 30, 60, 36, 21, 20, 22, 32, 34, 35,
2150 -static const yytype_int16 yycheck[] =
2151 + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
2152 +static const yytype_uint8 yyr1[] =
2154 - 5, 38, 39, 17, 18, 19, 12, 12, 17, 18,
2155 - 7, 8, 13, 90, 4, 22, 93, 20, 25, 22,
2156 - 21, 22, 23, 24, 33, 3, 26, 34, 26, 32,
2157 - 31, 37, 22, 30, 43, 36, 25, 46, 47, 36,
2158 - 17, 18, 9, 10, 44, 45, 60, 61, 62, 17,
2159 - 18, 0, 89, 15, 22, 23, 33, 27, 14, 15,
2160 - 16, 23, 30, 11, 26, 33, 22, 25, 39, 27,
2161 - 35, 29, 52, 53, 54, 55, 5, 6, 42, 43,
2162 - 34, 35, 56, 57, 50, 51, 58, 59, 40, 25,
2163 - 41, 23, 25, 38, 16, 16, 33, 28, 25, 25,
2164 - 25, 17, 36, 21, 34, 8, 6, 35, 95, 47,
2165 - 45, 93, -1, -1, 90, -1, -1, 122, -1, -1,
2166 - 44, -1, -1, 46, -1, -1, -1, -1, 48, -1,
2168 + 0, 48, 49, 50, 50, 51, 51, 52, 52, 53,
2169 + 53, 53, 53, 54, 55, 55, 56, 56, 56, 56,
2170 + 57, 57, 57, 57, 57, 57, 57, 58, 58, 58,
2171 + 59, 59, 59, 59, 59, 60, 60, 60, 61, 62,
2172 + 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
2173 + 67, 68, 68, 68, 69, 69, 69, 69, 69, 70,
2174 + 70, 70, 71, 71, 71, 72, 72, 72, 72, 73,
2175 + 73, 73, 73, 74, 74, 74, 75, 75, 75, 76,
2179 -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2180 - symbol of state STATE-NUM. */
2181 -static const yytype_uint8 yystos[] =
2182 + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
2183 +static const yytype_uint8 yyr2[] =
2185 - 0, 3, 49, 25, 0, 4, 22, 50, 51, 17,
2186 - 18, 33, 59, 51, 26, 52, 50, 43, 46, 47,
2187 - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
2188 - 69, 70, 71, 72, 59, 27, 53, 15, 23, 26,
2189 - 72, 72, 72, 35, 12, 37, 11, 39, 40, 41,
2190 - 9, 10, 7, 8, 30, 36, 5, 6, 42, 43,
2191 - 26, 44, 45, 25, 54, 23, 53, 53, 63, 60,
2192 - 64, 65, 66, 67, 68, 68, 69, 69, 69, 69,
2193 - 70, 70, 71, 71, 72, 72, 72, 14, 15, 16,
2194 - 22, 55, 74, 75, 25, 38, 16, 16, 25, 29,
2195 - 53, 55, 75, 28, 55, 74, 61, 25, 25, 56,
2196 - 57, 25, 22, 25, 34, 13, 21, 22, 23, 24,
2197 - 31, 36, 58, 17, 33, 73, 22, 23, 30, 59,
2198 - 36, 21, 20, 22, 32, 34, 35, 59, 34, 59,
2200 + 0, 2, 5, 0, 2, 0, 2, 4, 2, 2,
2201 + 3, 3, 4, 5, 0, 2, 4, 2, 3, 2,
2202 + 2, 3, 4, 2, 9, 5, 2, 0, 2, 2,
2203 + 3, 1, 2, 2, 2, 1, 1, 3, 1, 1,
2204 + 5, 1, 3, 1, 3, 1, 3, 1, 3, 1,
2205 + 3, 1, 3, 3, 1, 3, 3, 3, 3, 3,
2206 + 3, 1, 3, 3, 1, 3, 3, 3, 1, 1,
2207 + 2, 2, 2, 0, 2, 2, 0, 2, 2, 2,
2211 -#define yyerrok (yyerrstatus = 0)
2212 -#define yyclearin (yychar = YYEMPTY)
2213 -#define YYEMPTY (-2)
2216 -#define YYACCEPT goto yyacceptlab
2217 -#define YYABORT goto yyabortlab
2218 -#define YYERROR goto yyerrorlab
2221 -/* Like YYERROR except do call yyerror. This remains here temporarily
2222 - to ease the transition to the new meaning of YYERROR, for GCC.
2223 - Once GCC version 2 has supplanted version 1, this can go. However,
2224 - YYFAIL appears to be in use. Nevertheless, it is formally deprecated
2225 - in Bison 2.4.2's NEWS entry, where a plan to phase it out is
2228 -#define YYFAIL goto yyerrlab
2230 - /* This is here to suppress warnings from the GCC cpp's
2231 - -Wunused-macros. Normally we don't worry about that warning, but
2232 - some users do, and we want to make it easy for users to remove
2233 - YYFAIL uses, which will produce warnings from Bison 2.5. */
2236 +#define yyerrok (yyerrstatus = 0)
2237 +#define yyclearin (yychar = YYEMPTY)
2238 +#define YYEMPTY (-2)
2241 +#define YYACCEPT goto yyacceptlab
2242 +#define YYABORT goto yyabortlab
2243 +#define YYERROR goto yyerrorlab
2246 #define YYRECOVERING() (!!yyerrstatus)
2248 @@ -768,27 +725,41 @@ do \
2251 yyerror (YY_("syntax error: cannot back up")); \
2259 /* Error token number */
2261 -#define YYERRCODE 256
2264 -/* This macro is provided for backward compatibility. */
2265 -#ifndef YY_LOCATION_PRINT
2266 -# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2268 +#define YYERRCODE 256
2271 +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2272 + If N is 0, then set CURRENT to the empty location which ends
2273 + the previous symbol: RHS[0] (always defined). */
2275 +#ifndef YYLLOC_DEFAULT
2276 +# define YYLLOC_DEFAULT(Current, Rhs, N) \
2280 + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2281 + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2282 + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2283 + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2287 + (Current).first_line = (Current).last_line = \
2288 + YYRHSLOC (Rhs, 0).last_line; \
2289 + (Current).first_column = (Current).last_column = \
2290 + YYRHSLOC (Rhs, 0).last_column; \
2295 +#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2297 -/* YYLEX -- calling `yylex' with the right arguments. */
2299 -# define YYLEX yylex (YYLEX_PARAM)
2301 -# define YYLEX yylex ()
2304 /* Enable debugging if requested. */
2306 @@ -798,50 +769,84 @@ while (YYID (0))
2307 # define YYFPRINTF fprintf
2310 -# define YYDPRINTF(Args) \
2315 +# define YYDPRINTF(Args) \
2321 -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2325 - YYFPRINTF (stderr, "%s ", Title); \
2326 - yy_symbol_print (stderr, \
2328 - YYFPRINTF (stderr, "\n"); \
2332 +/* YY_LOCATION_PRINT -- Print the location on the stream.
2333 + This macro was not mandated originally: define only if we know
2334 + we won't break user code: when these are the locations we know. */
2336 -/*--------------------------------.
2337 -| Print this symbol on YYOUTPUT. |
2338 -`--------------------------------*/
2339 +#ifndef YY_LOCATION_PRINT
2340 +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2343 -#if (defined __STDC__ || defined __C99__FUNC__ \
2344 - || defined __cplusplus || defined _MSC_VER)
2346 -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2349 -yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2352 - YYSTYPE const * const yyvaluep;
2353 +/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
2355 +YY_ATTRIBUTE_UNUSED
2357 +yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
2360 + int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
2361 + if (0 <= yylocp->first_line)
2363 + res += YYFPRINTF (yyo, "%d", yylocp->first_line);
2364 + if (0 <= yylocp->first_column)
2365 + res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
2367 + if (0 <= yylocp->last_line)
2369 + if (yylocp->first_line < yylocp->last_line)
2371 + res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
2373 + res += YYFPRINTF (yyo, ".%d", end_col);
2375 + else if (0 <= end_col && yylocp->first_column < end_col)
2376 + res += YYFPRINTF (yyo, "-%d", end_col);
2381 +# define YY_LOCATION_PRINT(File, Loc) \
2382 + yy_location_print_ (File, &(Loc))
2385 +# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2390 +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2394 + YYFPRINTF (stderr, "%s ", Title); \
2395 + yy_symbol_print (stderr, \
2396 + Type, Value, Location); \
2397 + YYFPRINTF (stderr, "\n"); \
2402 +/*----------------------------------------.
2403 +| Print this symbol's value on YYOUTPUT. |
2404 +`----------------------------------------*/
2407 +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
2409 FILE *yyo = yyoutput;
2411 + YYUSE (yylocationp);
2415 if (yytype < YYNTOKENS)
2416 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2422 @@ -851,24 +856,15 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2423 | Print this symbol on YYOUTPUT. |
2424 `--------------------------------*/
2426 -#if (defined __STDC__ || defined __C99__FUNC__ \
2427 - || defined __cplusplus || defined _MSC_VER)
2429 -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2432 -yy_symbol_print (yyoutput, yytype, yyvaluep)
2435 - YYSTYPE const * const yyvaluep;
2437 +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
2439 - if (yytype < YYNTOKENS)
2440 - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2442 - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2443 + YYFPRINTF (yyoutput, "%s %s (",
2444 + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
2446 - yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2447 + YY_LOCATION_PRINT (yyoutput, *yylocationp);
2448 + YYFPRINTF (yyoutput, ": ");
2449 + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
2450 YYFPRINTF (yyoutput, ")");
2453 @@ -877,16 +873,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
2455 `------------------------------------------------------------------*/
2457 -#if (defined __STDC__ || defined __C99__FUNC__ \
2458 - || defined __cplusplus || defined _MSC_VER)
2460 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
2463 -yy_stack_print (yybottom, yytop)
2464 - yytype_int16 *yybottom;
2465 - yytype_int16 *yytop;
2468 YYFPRINTF (stderr, "Stack now");
2469 for (; yybottom <= yytop; yybottom++)
2470 @@ -897,49 +885,42 @@ yy_stack_print (yybottom, yytop)
2471 YYFPRINTF (stderr, "\n");
2474 -# define YY_STACK_PRINT(Bottom, Top) \
2477 - yy_stack_print ((Bottom), (Top)); \
2479 +# define YY_STACK_PRINT(Bottom, Top) \
2482 + yy_stack_print ((Bottom), (Top)); \
2486 /*------------------------------------------------.
2487 | Report that the YYRULE is going to be reduced. |
2488 `------------------------------------------------*/
2490 -#if (defined __STDC__ || defined __C99__FUNC__ \
2491 - || defined __cplusplus || defined _MSC_VER)
2493 -yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2496 -yy_reduce_print (yyvsp, yyrule)
2500 +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
2502 + unsigned long int yylno = yyrline[yyrule];
2503 int yynrhs = yyr2[yyrule];
2505 - unsigned long int yylno = yyrline[yyrule];
2506 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2507 - yyrule - 1, yylno);
2508 + yyrule - 1, yylno);
2509 /* The symbols being reduced. */
2510 for (yyi = 0; yyi < yynrhs; yyi++)
2512 YYFPRINTF (stderr, " $%d = ", yyi + 1);
2513 - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2514 - &(yyvsp[(yyi + 1) - (yynrhs)])
2516 + yy_symbol_print (stderr,
2517 + yystos[yyssp[yyi + 1 - yynrhs]],
2518 + &(yyvsp[(yyi + 1) - (yynrhs)])
2519 + , &(yylsp[(yyi + 1) - (yynrhs)]) );
2520 YYFPRINTF (stderr, "\n");
2524 -# define YY_REDUCE_PRINT(Rule) \
2527 - yy_reduce_print (yyvsp, Rule); \
2529 +# define YY_REDUCE_PRINT(Rule) \
2532 + yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
2535 /* Nonzero means print parse trace. It is left uninitialized so that
2536 multiple parsers can coexist. */
2537 @@ -953,7 +934,7 @@ int yydebug;
2540 /* YYINITDEPTH -- initial size of the parser's stacks. */
2541 -#ifndef YYINITDEPTH
2542 +#ifndef YYINITDEPTH
2543 # define YYINITDEPTH 200
2546 @@ -976,15 +957,8 @@ int yydebug;
2547 # define yystrlen strlen
2549 /* Return the length of YYSTR. */
2550 -#if (defined __STDC__ || defined __C99__FUNC__ \
2551 - || defined __cplusplus || defined _MSC_VER)
2553 yystrlen (const char *yystr)
2557 - const char *yystr;
2561 for (yylen = 0; yystr[yylen]; yylen++)
2562 @@ -1000,16 +974,8 @@ yystrlen (yystr)
2564 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2566 -#if (defined __STDC__ || defined __C99__FUNC__ \
2567 - || defined __cplusplus || defined _MSC_VER)
2569 yystpcpy (char *yydest, const char *yysrc)
2572 -yystpcpy (yydest, yysrc)
2574 - const char *yysrc;
2578 const char *yys = yysrc;
2579 @@ -1039,27 +1005,27 @@ yytnamerr (char *yyres, const char *yystr)
2580 char const *yyp = yystr;
2587 - goto do_not_strip_quotes;
2590 - if (*++yyp != '\\')
2591 - goto do_not_strip_quotes;
2592 - /* Fall through. */
2595 - yyres[yyn] = *yyp;
2601 - yyres[yyn] = '\0';
2608 + goto do_not_strip_quotes;
2611 + if (*++yyp != '\\')
2612 + goto do_not_strip_quotes;
2613 + /* Fall through. */
2616 + yyres[yyn] = *yyp;
2622 + yyres[yyn] = '\0';
2625 do_not_strip_quotes: ;
2628 @@ -1082,11 +1048,11 @@ static int
2629 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
2630 yytype_int16 *yyssp, int yytoken)
2632 - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
2633 + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
2634 YYSIZE_T yysize = yysize0;
2635 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
2636 /* Internationalized format string. */
2637 - const char *yyformat = YY_NULL;
2638 + const char *yyformat = YY_NULLPTR;
2639 /* Arguments of yyformat. */
2640 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
2641 /* Number of reported tokens (one for the "unexpected", one per
2642 @@ -1094,10 +1060,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
2645 /* There are many possibilities here to consider:
2646 - - Assume YYFAIL is not used. It's too flawed to consider. See
2647 - <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
2648 - for details. YYERROR is fine as it does not invoke this
2650 - If this state is a consistent state with a default action, then
2651 the only way this function was invoked is if the default action
2652 is an error action. In that case, don't check for expected
2653 @@ -1147,7 +1109,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
2655 yyarg[yycount++] = yytname[yyx];
2657 - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
2658 + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
2659 if (! (yysize <= yysize1
2660 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
2662 @@ -1214,26 +1176,18 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
2663 | Release the memory associated to this symbol. |
2664 `-----------------------------------------------*/
2667 -#if (defined __STDC__ || defined __C99__FUNC__ \
2668 - || defined __cplusplus || defined _MSC_VER)
2670 -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2673 -yydestruct (yymsg, yytype, yyvaluep)
2674 - const char *yymsg;
2676 - YYSTYPE *yyvaluep;
2678 +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
2682 + YYUSE (yylocationp);
2685 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2687 + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2689 + YY_IGNORE_MAYBE_UNINITIALIZED_END
2693 @@ -1242,18 +1196,14 @@ yydestruct (yymsg, yytype, yyvaluep)
2694 /* The lookahead symbol. */
2698 -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2699 -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2700 -# define YY_IGNORE_MAYBE_UNINITIALIZED_END
2702 -#ifndef YY_INITIAL_VALUE
2703 -# define YY_INITIAL_VALUE(Value) /* Nothing. */
2706 /* The semantic value of the lookahead symbol. */
2707 -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
2710 +/* Location data for the lookahead symbol. */
2712 +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2716 /* Number of syntax errors so far. */
2719 @@ -1262,35 +1212,17 @@ int yynerrs;
2723 -#ifdef YYPARSE_PARAM
2724 -#if (defined __STDC__ || defined __C99__FUNC__ \
2725 - || defined __cplusplus || defined _MSC_VER)
2727 -yyparse (void *YYPARSE_PARAM)
2730 -yyparse (YYPARSE_PARAM)
2731 - void *YYPARSE_PARAM;
2733 -#else /* ! YYPARSE_PARAM */
2734 -#if (defined __STDC__ || defined __C99__FUNC__ \
2735 - || defined __cplusplus || defined _MSC_VER)
2746 /* Number of tokens to shift before error messages enabled. */
2749 /* The stacks and their tools:
2750 - `yyss': related to states.
2751 - `yyvs': related to semantic values.
2752 + 'yyss': related to states.
2753 + 'yyvs': related to semantic values.
2754 + 'yyls': related to locations.
2756 Refer to the stacks through separate pointers, to allow yyoverflow
2757 to reallocate them elsewhere. */
2758 @@ -1305,6 +1237,14 @@ yyparse ()
2762 + /* The location stack. */
2763 + YYLTYPE yylsa[YYINITDEPTH];
2767 + /* The locations where the error started and ended. */
2768 + YYLTYPE yyerror_range[3];
2770 YYSIZE_T yystacksize;
2773 @@ -1314,6 +1254,7 @@ yyparse ()
2774 /* The variables used to return semantic value and location from the
2780 /* Buffer for error messages, and its allocated size. */
2781 @@ -1322,7 +1263,7 @@ yyparse ()
2782 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
2785 -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
2786 +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
2788 /* The number of symbols on the RHS of the reduced rule.
2789 Keep to zero when no symbol should be popped. */
2790 @@ -1330,6 +1271,7 @@ yyparse ()
2792 yyssp = yyss = yyssa;
2793 yyvsp = yyvs = yyvsa;
2794 + yylsp = yyls = yylsa;
2795 yystacksize = YYINITDEPTH;
2797 YYDPRINTF ((stderr, "Starting parse\n"));
2798 @@ -1338,6 +1280,7 @@ yyparse ()
2801 yychar = YYEMPTY; /* Cause a token to be read. */
2802 + yylsp[0] = yylloc;
2805 /*------------------------------------------------------------.
2806 @@ -1358,23 +1301,26 @@ yyparse ()
2810 - /* Give user a chance to reallocate the stack. Use copies of
2811 - these so that the &'s don't force the real ones into
2813 - YYSTYPE *yyvs1 = yyvs;
2814 - yytype_int16 *yyss1 = yyss;
2816 - /* Each stack pointer address is followed by the size of the
2817 - data in use in that stack, in bytes. This used to be a
2818 - conditional around just the two extra args, but that might
2819 - be undefined if yyoverflow is a macro. */
2820 - yyoverflow (YY_("memory exhausted"),
2821 - &yyss1, yysize * sizeof (*yyssp),
2822 - &yyvs1, yysize * sizeof (*yyvsp),
2827 + /* Give user a chance to reallocate the stack. Use copies of
2828 + these so that the &'s don't force the real ones into
2830 + YYSTYPE *yyvs1 = yyvs;
2831 + yytype_int16 *yyss1 = yyss;
2832 + YYLTYPE *yyls1 = yyls;
2834 + /* Each stack pointer address is followed by the size of the
2835 + data in use in that stack, in bytes. This used to be a
2836 + conditional around just the two extra args, but that might
2837 + be undefined if yyoverflow is a macro. */
2838 + yyoverflow (YY_("memory exhausted"),
2839 + &yyss1, yysize * sizeof (*yyssp),
2840 + &yyvs1, yysize * sizeof (*yyvsp),
2841 + &yyls1, yysize * sizeof (*yylsp),
2848 #else /* no yyoverflow */
2849 # ifndef YYSTACK_RELOCATE
2850 @@ -1382,34 +1328,36 @@ yyparse ()
2852 /* Extend the stack our own way. */
2853 if (YYMAXDEPTH <= yystacksize)
2854 - goto yyexhaustedlab;
2855 + goto yyexhaustedlab;
2857 if (YYMAXDEPTH < yystacksize)
2858 - yystacksize = YYMAXDEPTH;
2859 + yystacksize = YYMAXDEPTH;
2862 - yytype_int16 *yyss1 = yyss;
2863 - union yyalloc *yyptr =
2864 - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2866 - goto yyexhaustedlab;
2867 - YYSTACK_RELOCATE (yyss_alloc, yyss);
2868 - YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2869 + yytype_int16 *yyss1 = yyss;
2870 + union yyalloc *yyptr =
2871 + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2873 + goto yyexhaustedlab;
2874 + YYSTACK_RELOCATE (yyss_alloc, yyss);
2875 + YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2876 + YYSTACK_RELOCATE (yyls_alloc, yyls);
2877 # undef YYSTACK_RELOCATE
2878 - if (yyss1 != yyssa)
2879 - YYSTACK_FREE (yyss1);
2880 + if (yyss1 != yyssa)
2881 + YYSTACK_FREE (yyss1);
2884 #endif /* no yyoverflow */
2886 yyssp = yyss + yysize - 1;
2887 yyvsp = yyvs + yysize - 1;
2888 + yylsp = yyls + yysize - 1;
2890 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2891 - (unsigned long int) yystacksize));
2892 + (unsigned long int) yystacksize));
2894 if (yyss + yystacksize - 1 <= yyssp)
2899 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2900 @@ -1438,7 +1386,7 @@ yybackup:
2901 if (yychar == YYEMPTY)
2903 YYDPRINTF ((stderr, "Reading a token: "));
2905 + yychar = yylex ();
2908 if (yychar <= YYEOF)
2909 @@ -1481,7 +1429,7 @@ yybackup:
2910 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2912 YY_IGNORE_MAYBE_UNINITIALIZED_END
2914 + *++yylsp = yylloc;
2918 @@ -1503,7 +1451,7 @@ yyreduce:
2921 /* If YYLEN is nonzero, implement the default value of the action:
2925 Otherwise, the following line sets YYVAL to garbage.
2926 This behavior is undocumented and Bison
2927 @@ -1512,287 +1460,306 @@ yyreduce:
2928 GCC warning that YYVAL may be used uninitialized. */
2929 yyval = yyvsp[1-yylen];
2932 + /* Default location. */
2933 + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
2934 YY_REDUCE_PRINT (yyn);
2938 -/* Line 1787 of yacc.c */
2939 -#line 110 "dtc-parser.y"
2940 +#line 109 "dtc-parser.y" /* yacc.c:1646 */
2942 - the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node),
2943 - guess_boot_cpuid((yyvsp[(4) - (4)].node)));
2944 + (yyvsp[0].node)->is_plugin = (yyvsp[-2].is_plugin);
2945 + (yyvsp[0].node)->is_root = 1;
2946 + the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node),
2947 + guess_boot_cpuid((yyvsp[0].node)));
2949 +#line 1477 "dtc-parser.tab.c" /* yacc.c:1646 */
2953 -/* Line 1787 of yacc.c */
2954 -#line 118 "dtc-parser.y"
2955 +#line 119 "dtc-parser.y" /* yacc.c:1646 */
2957 - (yyval.re) = NULL;
2958 + (yyval.is_plugin) = 0;
2960 +#line 1485 "dtc-parser.tab.c" /* yacc.c:1646 */
2964 -/* Line 1787 of yacc.c */
2965 -#line 122 "dtc-parser.y"
2966 +#line 123 "dtc-parser.y" /* yacc.c:1646 */
2968 - (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
2969 + (yyval.is_plugin) = 1;
2971 +#line 1493 "dtc-parser.tab.c" /* yacc.c:1646 */
2975 -/* Line 1787 of yacc.c */
2976 -#line 129 "dtc-parser.y"
2977 +#line 130 "dtc-parser.y" /* yacc.c:1646 */
2979 - (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer));
2980 + (yyval.re) = NULL;
2982 +#line 1501 "dtc-parser.tab.c" /* yacc.c:1646 */
2986 -/* Line 1787 of yacc.c */
2987 -#line 133 "dtc-parser.y"
2988 +#line 134 "dtc-parser.y" /* yacc.c:1646 */
2990 - add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref));
2991 - (yyval.re) = (yyvsp[(2) - (2)].re);
2992 + (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re));
2994 +#line 1509 "dtc-parser.tab.c" /* yacc.c:1646 */
2998 -/* Line 1787 of yacc.c */
2999 -#line 141 "dtc-parser.y"
3000 +#line 141 "dtc-parser.y" /* yacc.c:1646 */
3002 - (yyval.node) = name_node((yyvsp[(2) - (2)].node), "");
3003 + (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer));
3005 +#line 1517 "dtc-parser.tab.c" /* yacc.c:1646 */
3009 -/* Line 1787 of yacc.c */
3010 -#line 145 "dtc-parser.y"
3011 +#line 145 "dtc-parser.y" /* yacc.c:1646 */
3013 - (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
3014 + add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref));
3015 + (yyval.re) = (yyvsp[0].re);
3017 +#line 1526 "dtc-parser.tab.c" /* yacc.c:1646 */
3021 -/* Line 1787 of yacc.c */
3022 -#line 149 "dtc-parser.y"
3023 +#line 153 "dtc-parser.y" /* yacc.c:1646 */
3025 - struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref));
3028 - merge_nodes(target, (yyvsp[(3) - (3)].node));
3030 - print_error("label or path, '%s', not found", (yyvsp[(2) - (3)].labelref));
3031 - (yyval.node) = (yyvsp[(1) - (3)].node);
3032 + (yyval.node) = name_node((yyvsp[0].node), "");
3034 +#line 1534 "dtc-parser.tab.c" /* yacc.c:1646 */
3038 -/* Line 1787 of yacc.c */
3039 -#line 159 "dtc-parser.y"
3040 +#line 157 "dtc-parser.y" /* yacc.c:1646 */
3042 - struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref));
3045 - print_error("label or path, '%s', not found", (yyvsp[(3) - (4)].labelref));
3047 - delete_node(target);
3049 - (yyval.node) = (yyvsp[(1) - (4)].node);
3050 + (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node));
3052 +#line 1542 "dtc-parser.tab.c" /* yacc.c:1646 */
3056 -/* Line 1787 of yacc.c */
3057 -#line 173 "dtc-parser.y"
3058 +#line 161 "dtc-parser.y" /* yacc.c:1646 */
3060 - (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist));
3061 + struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref));
3064 + merge_nodes(target, (yyvsp[0].node));
3066 + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
3067 + (yyval.node) = (yyvsp[-2].node);
3069 +#line 1556 "dtc-parser.tab.c" /* yacc.c:1646 */
3073 -/* Line 1787 of yacc.c */
3074 -#line 180 "dtc-parser.y"
3075 +#line 171 "dtc-parser.y" /* yacc.c:1646 */
3077 - (yyval.proplist) = NULL;
3078 + struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref));
3081 + delete_node(target);
3083 + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
3086 + (yyval.node) = (yyvsp[-3].node);
3088 +#line 1572 "dtc-parser.tab.c" /* yacc.c:1646 */
3092 -/* Line 1787 of yacc.c */
3093 -#line 184 "dtc-parser.y"
3094 +#line 186 "dtc-parser.y" /* yacc.c:1646 */
3096 - (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist));
3097 + (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist));
3099 +#line 1580 "dtc-parser.tab.c" /* yacc.c:1646 */
3103 -/* Line 1787 of yacc.c */
3104 -#line 191 "dtc-parser.y"
3105 +#line 193 "dtc-parser.y" /* yacc.c:1646 */
3107 - (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data));
3108 + (yyval.proplist) = NULL;
3110 +#line 1588 "dtc-parser.tab.c" /* yacc.c:1646 */
3114 -/* Line 1787 of yacc.c */
3115 -#line 195 "dtc-parser.y"
3116 +#line 197 "dtc-parser.y" /* yacc.c:1646 */
3118 - (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data);
3119 + (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist));
3121 +#line 1596 "dtc-parser.tab.c" /* yacc.c:1646 */
3125 -/* Line 1787 of yacc.c */
3126 -#line 199 "dtc-parser.y"
3127 +#line 204 "dtc-parser.y" /* yacc.c:1646 */
3129 - (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename));
3130 + (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data));
3132 +#line 1604 "dtc-parser.tab.c" /* yacc.c:1646 */
3136 -/* Line 1787 of yacc.c */
3137 -#line 203 "dtc-parser.y"
3138 +#line 208 "dtc-parser.y" /* yacc.c:1646 */
3140 - add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref));
3141 - (yyval.prop) = (yyvsp[(2) - (2)].prop);
3142 + (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data);
3144 +#line 1612 "dtc-parser.tab.c" /* yacc.c:1646 */
3148 -/* Line 1787 of yacc.c */
3149 -#line 211 "dtc-parser.y"
3150 +#line 212 "dtc-parser.y" /* yacc.c:1646 */
3152 - (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data));
3153 + (yyval.prop) = build_property_delete((yyvsp[-1].propnodename));
3155 +#line 1620 "dtc-parser.tab.c" /* yacc.c:1646 */
3159 -/* Line 1787 of yacc.c */
3160 -#line 215 "dtc-parser.y"
3161 +#line 216 "dtc-parser.y" /* yacc.c:1646 */
3163 - (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data);
3164 + add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref));
3165 + (yyval.prop) = (yyvsp[0].prop);
3167 +#line 1629 "dtc-parser.tab.c" /* yacc.c:1646 */
3171 -/* Line 1787 of yacc.c */
3172 -#line 219 "dtc-parser.y"
3173 +#line 224 "dtc-parser.y" /* yacc.c:1646 */
3175 - (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
3176 + (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data));
3178 +#line 1637 "dtc-parser.tab.c" /* yacc.c:1646 */
3182 -/* Line 1787 of yacc.c */
3183 -#line 223 "dtc-parser.y"
3184 +#line 228 "dtc-parser.y" /* yacc.c:1646 */
3186 - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref));
3187 + (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data);
3189 +#line 1645 "dtc-parser.tab.c" /* yacc.c:1646 */
3193 -/* Line 1787 of yacc.c */
3194 -#line 227 "dtc-parser.y"
3195 +#line 232 "dtc-parser.y" /* yacc.c:1646 */
3197 - FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL);
3198 + (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data));
3200 +#line 1653 "dtc-parser.tab.c" /* yacc.c:1646 */
3204 +#line 236 "dtc-parser.y" /* yacc.c:1646 */
3206 + (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref));
3208 +#line 1661 "dtc-parser.tab.c" /* yacc.c:1646 */
3212 +#line 240 "dtc-parser.y" /* yacc.c:1646 */
3214 + FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL);
3217 - if ((yyvsp[(6) - (9)].integer) != 0)
3218 - if (fseek(f, (yyvsp[(6) - (9)].integer), SEEK_SET) != 0)
3219 - print_error("Couldn't seek to offset %llu in \"%s\": %s",
3220 - (unsigned long long)(yyvsp[(6) - (9)].integer),
3221 - (yyvsp[(4) - (9)].data).val,
3223 + if ((yyvsp[-3].integer) != 0)
3224 + if (fseek(f, (yyvsp[-3].integer), SEEK_SET) != 0)
3225 + die("Couldn't seek to offset %llu in \"%s\": %s",
3226 + (unsigned long long)(yyvsp[-3].integer), (yyvsp[-5].data).val,
3229 - d = data_copy_file(f, (yyvsp[(8) - (9)].integer));
3230 + d = data_copy_file(f, (yyvsp[-1].integer));
3232 - (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d);
3233 + (yyval.data) = data_merge((yyvsp[-8].data), d);
3236 +#line 1681 "dtc-parser.tab.c" /* yacc.c:1646 */
3240 -/* Line 1787 of yacc.c */
3241 -#line 244 "dtc-parser.y"
3243 +#line 256 "dtc-parser.y" /* yacc.c:1646 */
3245 - FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL);
3246 + FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL);
3247 struct data d = empty_data;
3249 d = data_copy_file(f, -1);
3251 - (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d);
3252 + (yyval.data) = data_merge((yyvsp[-4].data), d);
3255 +#line 1695 "dtc-parser.tab.c" /* yacc.c:1646 */
3259 -/* Line 1787 of yacc.c */
3260 -#line 254 "dtc-parser.y"
3262 +#line 266 "dtc-parser.y" /* yacc.c:1646 */
3264 - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
3265 + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
3267 +#line 1703 "dtc-parser.tab.c" /* yacc.c:1646 */
3271 -/* Line 1787 of yacc.c */
3272 -#line 261 "dtc-parser.y"
3274 +#line 273 "dtc-parser.y" /* yacc.c:1646 */
3276 (yyval.data) = empty_data;
3278 +#line 1711 "dtc-parser.tab.c" /* yacc.c:1646 */
3282 -/* Line 1787 of yacc.c */
3283 -#line 265 "dtc-parser.y"
3285 +#line 277 "dtc-parser.y" /* yacc.c:1646 */
3287 - (yyval.data) = (yyvsp[(1) - (2)].data);
3288 + (yyval.data) = (yyvsp[-1].data);
3290 +#line 1719 "dtc-parser.tab.c" /* yacc.c:1646 */
3294 -/* Line 1787 of yacc.c */
3295 -#line 269 "dtc-parser.y"
3297 +#line 281 "dtc-parser.y" /* yacc.c:1646 */
3299 - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
3300 + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
3302 +#line 1727 "dtc-parser.tab.c" /* yacc.c:1646 */
3306 -/* Line 1787 of yacc.c */
3307 -#line 276 "dtc-parser.y"
3309 +#line 288 "dtc-parser.y" /* yacc.c:1646 */
3311 - (yyval.array).data = empty_data;
3312 - (yyval.array).bits = eval_literal((yyvsp[(2) - (3)].literal), 0, 7);
3314 - if (((yyval.array).bits != 8) &&
3315 - ((yyval.array).bits != 16) &&
3316 - ((yyval.array).bits != 32) &&
3317 - ((yyval.array).bits != 64))
3319 - print_error("Only 8, 16, 32 and 64-bit elements"
3320 - " are currently supported");
3321 - (yyval.array).bits = 32;
3322 + unsigned long long bits;
3324 + bits = (yyvsp[-1].integer);
3326 + if ((bits != 8) && (bits != 16) &&
3327 + (bits != 32) && (bits != 64)) {
3328 + ERROR(&(yylsp[-1]), "Array elements must be"
3329 + " 8, 16, 32 or 64-bits");
3333 + (yyval.array).data = empty_data;
3334 + (yyval.array).bits = bits;
3336 +#line 1747 "dtc-parser.tab.c" /* yacc.c:1646 */
3340 -/* Line 1787 of yacc.c */
3341 -#line 291 "dtc-parser.y"
3343 +#line 304 "dtc-parser.y" /* yacc.c:1646 */
3345 (yyval.array).data = empty_data;
3346 (yyval.array).bits = 32;
3348 +#line 1756 "dtc-parser.tab.c" /* yacc.c:1646 */
3352 -/* Line 1787 of yacc.c */
3353 -#line 296 "dtc-parser.y"
3355 +#line 309 "dtc-parser.y" /* yacc.c:1646 */
3357 - if ((yyvsp[(1) - (2)].array).bits < 64) {
3358 - uint64_t mask = (1ULL << (yyvsp[(1) - (2)].array).bits) - 1;
3359 + if ((yyvsp[-1].array).bits < 64) {
3360 + uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1;
3362 * Bits above mask must either be all zero
3363 * (positive within range of mask) or all one
3364 @@ -1801,275 +1768,258 @@ yyreduce:
3365 * within the mask to one (i.e. | in the
3366 * mask), all bits are one.
3368 - if (((yyvsp[(2) - (2)].integer) > mask) && (((yyvsp[(2) - (2)].integer) | mask) != -1ULL))
3370 - "integer value out of range "
3371 - "%016lx (%d bits)", (yyvsp[(1) - (2)].array).bits);
3372 + if (((yyvsp[0].integer) > mask) && (((yyvsp[0].integer) | mask) != -1ULL))
3373 + ERROR(&(yylsp[0]), "Value out of range for"
3374 + " %d-bit array element", (yyvsp[-1].array).bits);
3377 - (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits);
3378 + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits);
3380 +#line 1779 "dtc-parser.tab.c" /* yacc.c:1646 */
3384 -/* Line 1787 of yacc.c */
3385 -#line 316 "dtc-parser.y"
3387 +#line 328 "dtc-parser.y" /* yacc.c:1646 */
3389 - uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits);
3390 + uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits);
3392 - if ((yyvsp[(1) - (2)].array).bits == 32)
3393 - (yyvsp[(1) - (2)].array).data = data_add_marker((yyvsp[(1) - (2)].array).data,
3394 + if ((yyvsp[-1].array).bits == 32)
3395 + (yyvsp[-1].array).data = data_add_marker((yyvsp[-1].array).data,
3397 - (yyvsp[(2) - (2)].labelref));
3398 + (yyvsp[0].labelref));
3400 - print_error("References are only allowed in "
3401 + ERROR(&(yylsp[0]), "References are only allowed in "
3402 "arrays with 32-bit elements.");
3404 - (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits);
3409 -/* Line 1787 of yacc.c */
3410 -#line 330 "dtc-parser.y"
3412 - (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref));
3417 -/* Line 1787 of yacc.c */
3418 -#line 337 "dtc-parser.y"
3420 - (yyval.integer) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64);
3421 + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits);
3423 +#line 1797 "dtc-parser.tab.c" /* yacc.c:1646 */
3427 -/* Line 1787 of yacc.c */
3428 -#line 341 "dtc-parser.y"
3429 +#line 342 "dtc-parser.y" /* yacc.c:1646 */
3431 - (yyval.integer) = eval_char_literal((yyvsp[(1) - (1)].literal));
3432 + (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref));
3434 +#line 1805 "dtc-parser.tab.c" /* yacc.c:1646 */
3438 -/* Line 1787 of yacc.c */
3439 -#line 345 "dtc-parser.y"
3441 +#line 351 "dtc-parser.y" /* yacc.c:1646 */
3443 - (yyval.integer) = (yyvsp[(2) - (3)].integer);
3444 + (yyval.integer) = (yyvsp[-1].integer);
3449 -/* Line 1787 of yacc.c */
3450 -#line 356 "dtc-parser.y"
3451 - { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); }
3452 +#line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */
3456 -/* Line 1787 of yacc.c */
3457 -#line 361 "dtc-parser.y"
3458 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); }
3459 +#line 362 "dtc-parser.y" /* yacc.c:1646 */
3460 + { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); }
3461 +#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */
3465 -/* Line 1787 of yacc.c */
3466 -#line 366 "dtc-parser.y"
3467 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); }
3468 +#line 367 "dtc-parser.y" /* yacc.c:1646 */
3469 + { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); }
3470 +#line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */
3474 -/* Line 1787 of yacc.c */
3475 -#line 371 "dtc-parser.y"
3476 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); }
3477 +#line 372 "dtc-parser.y" /* yacc.c:1646 */
3478 + { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); }
3479 +#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */
3483 -/* Line 1787 of yacc.c */
3484 -#line 376 "dtc-parser.y"
3485 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); }
3486 +#line 377 "dtc-parser.y" /* yacc.c:1646 */
3487 + { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); }
3488 +#line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */
3492 -/* Line 1787 of yacc.c */
3493 -#line 381 "dtc-parser.y"
3494 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); }
3495 +#line 382 "dtc-parser.y" /* yacc.c:1646 */
3496 + { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); }
3497 +#line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */
3501 -/* Line 1787 of yacc.c */
3502 -#line 386 "dtc-parser.y"
3503 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); }
3504 +#line 387 "dtc-parser.y" /* yacc.c:1646 */
3505 + { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); }
3506 +#line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */
3510 -/* Line 1787 of yacc.c */
3511 -#line 387 "dtc-parser.y"
3512 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); }
3514 +#line 392 "dtc-parser.y" /* yacc.c:1646 */
3515 + { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); }
3516 +#line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */
3520 -/* Line 1787 of yacc.c */
3521 -#line 392 "dtc-parser.y"
3522 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); }
3526 -/* Line 1787 of yacc.c */
3527 -#line 393 "dtc-parser.y"
3528 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); }
3529 +#line 393 "dtc-parser.y" /* yacc.c:1646 */
3530 + { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); }
3531 +#line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */
3535 -/* Line 1787 of yacc.c */
3536 -#line 394 "dtc-parser.y"
3537 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); }
3538 +#line 398 "dtc-parser.y" /* yacc.c:1646 */
3539 + { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); }
3540 +#line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */
3544 -/* Line 1787 of yacc.c */
3545 -#line 395 "dtc-parser.y"
3546 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); }
3547 +#line 399 "dtc-parser.y" /* yacc.c:1646 */
3548 + { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); }
3549 +#line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */
3553 -/* Line 1787 of yacc.c */
3554 -#line 399 "dtc-parser.y"
3555 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); }
3556 +#line 400 "dtc-parser.y" /* yacc.c:1646 */
3557 + { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); }
3558 +#line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */
3562 -/* Line 1787 of yacc.c */
3563 -#line 400 "dtc-parser.y"
3564 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); }
3565 +#line 401 "dtc-parser.y" /* yacc.c:1646 */
3566 + { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); }
3567 +#line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */
3571 -/* Line 1787 of yacc.c */
3572 -#line 405 "dtc-parser.y"
3573 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); }
3575 +#line 405 "dtc-parser.y" /* yacc.c:1646 */
3576 + { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); }
3577 +#line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */
3581 -/* Line 1787 of yacc.c */
3582 -#line 406 "dtc-parser.y"
3583 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); }
3585 +#line 406 "dtc-parser.y" /* yacc.c:1646 */
3586 + { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); }
3587 +#line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */
3591 -/* Line 1787 of yacc.c */
3592 -#line 411 "dtc-parser.y"
3593 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); }
3595 +#line 411 "dtc-parser.y" /* yacc.c:1646 */
3596 + { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); }
3597 +#line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */
3601 -/* Line 1787 of yacc.c */
3602 -#line 412 "dtc-parser.y"
3603 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); }
3605 +#line 412 "dtc-parser.y" /* yacc.c:1646 */
3606 + { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); }
3607 +#line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */
3611 -/* Line 1787 of yacc.c */
3612 -#line 413 "dtc-parser.y"
3613 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); }
3614 +#line 417 "dtc-parser.y" /* yacc.c:1646 */
3615 + { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); }
3616 +#line 1915 "dtc-parser.tab.c" /* yacc.c:1646 */
3620 -/* Line 1787 of yacc.c */
3621 -#line 419 "dtc-parser.y"
3622 - { (yyval.integer) = -(yyvsp[(2) - (2)].integer); }
3624 +#line 418 "dtc-parser.y" /* yacc.c:1646 */
3625 + { (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); }
3626 +#line 1921 "dtc-parser.tab.c" /* yacc.c:1646 */
3630 -/* Line 1787 of yacc.c */
3631 -#line 420 "dtc-parser.y"
3632 - { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); }
3634 +#line 419 "dtc-parser.y" /* yacc.c:1646 */
3635 + { (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); }
3636 +#line 1927 "dtc-parser.tab.c" /* yacc.c:1646 */
3640 -/* Line 1787 of yacc.c */
3641 -#line 421 "dtc-parser.y"
3642 - { (yyval.integer) = !(yyvsp[(2) - (2)].integer); }
3643 +#line 425 "dtc-parser.y" /* yacc.c:1646 */
3644 + { (yyval.integer) = -(yyvsp[0].integer); }
3645 +#line 1933 "dtc-parser.tab.c" /* yacc.c:1646 */
3649 -/* Line 1787 of yacc.c */
3650 -#line 426 "dtc-parser.y"
3652 - (yyval.data) = empty_data;
3654 +#line 426 "dtc-parser.y" /* yacc.c:1646 */
3655 + { (yyval.integer) = ~(yyvsp[0].integer); }
3656 +#line 1939 "dtc-parser.tab.c" /* yacc.c:1646 */
3660 -/* Line 1787 of yacc.c */
3661 -#line 430 "dtc-parser.y"
3663 - (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte));
3665 +#line 427 "dtc-parser.y" /* yacc.c:1646 */
3666 + { (yyval.integer) = !(yyvsp[0].integer); }
3667 +#line 1945 "dtc-parser.tab.c" /* yacc.c:1646 */
3671 -/* Line 1787 of yacc.c */
3672 -#line 434 "dtc-parser.y"
3673 +#line 432 "dtc-parser.y" /* yacc.c:1646 */
3675 - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
3676 + (yyval.data) = empty_data;
3678 +#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */
3682 -/* Line 1787 of yacc.c */
3683 -#line 441 "dtc-parser.y"
3684 +#line 436 "dtc-parser.y" /* yacc.c:1646 */
3686 - (yyval.nodelist) = NULL;
3687 + (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte));
3689 +#line 1961 "dtc-parser.tab.c" /* yacc.c:1646 */
3693 -/* Line 1787 of yacc.c */
3694 -#line 445 "dtc-parser.y"
3695 +#line 440 "dtc-parser.y" /* yacc.c:1646 */
3697 - (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist));
3698 + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
3700 +#line 1969 "dtc-parser.tab.c" /* yacc.c:1646 */
3704 -/* Line 1787 of yacc.c */
3705 -#line 449 "dtc-parser.y"
3706 +#line 447 "dtc-parser.y" /* yacc.c:1646 */
3708 - print_error("syntax error: properties must precede subnodes");
3710 + (yyval.nodelist) = NULL;
3712 +#line 1977 "dtc-parser.tab.c" /* yacc.c:1646 */
3716 -/* Line 1787 of yacc.c */
3717 -#line 457 "dtc-parser.y"
3718 +#line 451 "dtc-parser.y" /* yacc.c:1646 */
3720 - (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename));
3721 + (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist));
3723 +#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */
3727 -/* Line 1787 of yacc.c */
3728 -#line 461 "dtc-parser.y"
3729 +#line 455 "dtc-parser.y" /* yacc.c:1646 */
3731 - (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename));
3732 + ERROR(&(yylsp[0]), "Properties must precede subnodes");
3735 +#line 1994 "dtc-parser.tab.c" /* yacc.c:1646 */
3739 -/* Line 1787 of yacc.c */
3740 -#line 465 "dtc-parser.y"
3741 +#line 463 "dtc-parser.y" /* yacc.c:1646 */
3743 - add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref));
3744 - (yyval.node) = (yyvsp[(2) - (2)].node);
3745 + (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename));
3747 +#line 2002 "dtc-parser.tab.c" /* yacc.c:1646 */
3751 +#line 467 "dtc-parser.y" /* yacc.c:1646 */
3753 + (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename));
3755 +#line 2010 "dtc-parser.tab.c" /* yacc.c:1646 */
3758 -/* Line 1787 of yacc.c */
3759 -#line 2073 "dtc-parser.tab.c"
3761 +#line 471 "dtc-parser.y" /* yacc.c:1646 */
3763 + add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref));
3764 + (yyval.node) = (yyvsp[0].node);
3766 +#line 2019 "dtc-parser.tab.c" /* yacc.c:1646 */
3770 +#line 2023 "dtc-parser.tab.c" /* yacc.c:1646 */
3773 /* User semantic actions sometimes alter yychar, and that requires
3774 @@ -2090,8 +2040,9 @@ yyreduce:
3775 YY_STACK_PRINT (yyss, yyssp);
3780 - /* Now `shift' the result of the reduction. Determine what state
3781 + /* Now 'shift' the result of the reduction. Determine what state
3782 that goes to, based on the state we popped back to and the rule
3783 number reduced by. */
3785 @@ -2106,9 +2057,9 @@ yyreduce:
3789 -/*------------------------------------.
3790 -| yyerrlab -- here on detecting error |
3791 -`------------------------------------*/
3792 +/*--------------------------------------.
3793 +| yyerrlab -- here on detecting error. |
3794 +`--------------------------------------*/
3796 /* Make sure we have latest lookahead translation. See comments at
3797 user semantic actions for why this is necessary. */
3798 @@ -2154,25 +2105,25 @@ yyerrlab:
3803 + yyerror_range[1] = yylloc;
3805 if (yyerrstatus == 3)
3807 /* If just tried and failed to reuse lookahead token after an
3808 - error, discard it. */
3809 + error, discard it. */
3811 if (yychar <= YYEOF)
3813 - /* Return failure if at end of input. */
3814 - if (yychar == YYEOF)
3818 + /* Return failure if at end of input. */
3819 + if (yychar == YYEOF)
3824 - yydestruct ("Error: discarding",
3825 - yytoken, &yylval);
3829 + yydestruct ("Error: discarding",
3830 + yytoken, &yylval, &yylloc);
3835 /* Else will try to reuse lookahead token after shifting the error
3836 @@ -2191,7 +2142,8 @@ yyerrorlab:
3837 if (/*CONSTCOND*/ 0)
3840 - /* Do not reclaim the symbols of the rule which action triggered
3841 + yyerror_range[1] = yylsp[1-yylen];
3842 + /* Do not reclaim the symbols of the rule whose action triggered
3846 @@ -2204,29 +2156,29 @@ yyerrorlab:
3847 | yyerrlab1 -- common code for both syntax error and YYERROR. |
3848 `-------------------------------------------------------------*/
3850 - yyerrstatus = 3; /* Each real token shifted decrements this. */
3851 + yyerrstatus = 3; /* Each real token shifted decrements this. */
3855 yyn = yypact[yystate];
3856 if (!yypact_value_is_default (yyn))
3859 - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3861 - yyn = yytable[yyn];
3868 + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3870 + yyn = yytable[yyn];
3876 /* Pop the current state because it cannot handle the error token. */
3882 + yyerror_range[1] = *yylsp;
3883 yydestruct ("Error: popping",
3884 - yystos[yystate], yyvsp);
3885 + yystos[yystate], yyvsp, yylsp);
3888 YY_STACK_PRINT (yyss, yyssp);
3889 @@ -2236,6 +2188,11 @@ yyerrlab1:
3891 YY_IGNORE_MAYBE_UNINITIALIZED_END
3893 + yyerror_range[2] = yylloc;
3894 + /* Using YYLLOC is tempting, but would change the location of
3895 + the lookahead. YYLOC is available though. */
3896 + YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
3899 /* Shift the error token. */
3900 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
3901 @@ -2275,16 +2232,16 @@ yyreturn:
3902 user semantic actions for why this is necessary. */
3903 yytoken = YYTRANSLATE (yychar);
3904 yydestruct ("Cleanup: discarding lookahead",
3905 - yytoken, &yylval);
3906 + yytoken, &yylval, &yylloc);
3908 - /* Do not reclaim the symbols of the rule which action triggered
3909 + /* Do not reclaim the symbols of the rule whose action triggered
3910 this YYABORT or YYACCEPT. */
3912 YY_STACK_PRINT (yyss, yyssp);
3913 while (yyssp != yyss)
3915 yydestruct ("Cleanup: popping",
3916 - yystos[*yyssp], yyvsp);
3917 + yystos[*yyssp], yyvsp, yylsp);
3921 @@ -2295,72 +2252,12 @@ yyreturn:
3922 if (yymsg != yymsgbuf)
3923 YYSTACK_FREE (yymsg);
3925 - /* Make sure YYID is used. */
3926 - return YYID (yyresult);
3929 +#line 477 "dtc-parser.y" /* yacc.c:1906 */
3932 -/* Line 2050 of yacc.c */
3933 -#line 471 "dtc-parser.y"
3936 -void print_error(char const *fmt, ...)
3940 - va_start(va, fmt);
3941 - srcpos_verror(&yylloc, fmt, va);
3944 - treesource_error = 1;
3947 -void yyerror(char const *s) {
3948 - print_error("%s", s);
3951 -static unsigned long long eval_literal(const char *s, int base, int bits)
3953 - unsigned long long val;
3957 - val = strtoull(s, &e, base);
3959 - size_t uls = strspn(e, "UL");
3961 - print_error("bad characters in literal");
3963 - if ((errno == ERANGE)
3964 - || ((bits < 64) && (val >= (1ULL << bits))))
3965 - print_error("literal out of range");
3966 - else if (errno != 0)
3967 - print_error("bad literal");
3971 -static unsigned char eval_char_literal(const char *s)
3972 +void yyerror(char const *s)
3979 - print_error("empty character literal");
3984 - * If the first character in the character literal is a \ then process
3985 - * the remaining characters as an escape encoding. If the first
3986 - * character is neither an escape or a terminator it should be the only
3987 - * character in the literal and will be returned.
3990 - c = get_escape_char(s, &i);
3993 - print_error("malformed character literal");
3996 + ERROR(&yylloc, "%s", s);
3998 diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped
3999 index b2e7a86..b497956 100644
4000 --- a/scripts/dtc/dtc-parser.tab.h_shipped
4001 +++ b/scripts/dtc/dtc-parser.tab.h_shipped
4003 -/* A Bison parser, made by GNU Bison 2.7.12-4996. */
4004 +/* A Bison parser, made by GNU Bison 3.0.2. */
4006 /* Bison interface for Yacc-like parsers in C
4008 - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
4011 + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
4013 This program is free software: you can redistribute it and/or modify
4014 it under the terms of the GNU General Public License as published by
4015 the Free Software Foundation, either version 3 of the License, or
4016 (at your option) any later version.
4019 This program is distributed in the hope that it will be useful,
4020 but WITHOUT ANY WARRANTY; without even the implied warranty of
4021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4022 GNU General Public License for more details.
4025 You should have received a copy of the GNU General Public License
4026 along with this program. If not, see <http://www.gnu.org/licenses/>. */
4029 special exception, which will cause the skeleton and the resulting
4030 Bison output files to be licensed under the GNU General Public
4031 License without this special exception.
4034 This special exception was added by the Free Software Foundation in
4035 version 2.2 of Bison. */
4037 #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED
4038 # define YY_YY_DTC_PARSER_TAB_H_INCLUDED
4039 -/* Enabling traces. */
4040 +/* Debug traces. */
4051 # define YYTOKENTYPE
4052 - /* Put the tokens into the symbol table, so that GDB and other debuggers
4053 - know about them. */
4054 - enum yytokentype {
4056 - DT_MEMRESERVE = 259,
4066 - DT_DEL_PROP = 269,
4067 - DT_DEL_NODE = 270,
4068 - DT_PROPNODENAME = 271,
4070 - DT_CHAR_LITERAL = 273,
4082 + DT_MEMRESERVE = 260,
4092 + DT_DEL_PROP = 270,
4093 + DT_DEL_NODE = 271,
4094 + DT_PROPNODENAME = 272,
4096 + DT_CHAR_LITERAL = 274,
4107 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
4108 -typedef union YYSTYPE
4109 +typedef union YYSTYPE YYSTYPE;
4112 -/* Line 2053 of yacc.c */
4113 -#line 40 "dtc-parser.y"
4114 +#line 39 "dtc-parser.y" /* yacc.c:1909 */
4119 - unsigned int cbase;
4123 @@ -96,30 +93,31 @@ typedef union YYSTYPE
4124 struct node *nodelist;
4125 struct reserve_info *re;
4130 -/* Line 2053 of yacc.c */
4131 -#line 103 "dtc-parser.tab.h"
4133 +#line 99 "dtc-parser.tab.h" /* yacc.c:1909 */
4135 # define YYSTYPE_IS_TRIVIAL 1
4136 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */
4137 # define YYSTYPE_IS_DECLARED 1
4140 -extern YYSTYPE yylval;
4142 -#ifdef YYPARSE_PARAM
4143 -#if defined __STDC__ || defined __cplusplus
4144 -int yyparse (void *YYPARSE_PARAM);
4147 +/* Location type. */
4148 +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
4149 +typedef struct YYLTYPE YYLTYPE;
4157 +# define YYLTYPE_IS_DECLARED 1
4158 +# define YYLTYPE_IS_TRIVIAL 1
4160 -#else /* ! YYPARSE_PARAM */
4161 -#if defined __STDC__ || defined __cplusplus
4164 +extern YYSTYPE yylval;
4165 +extern YYLTYPE yylloc;
4170 -#endif /* ! YYPARSE_PARAM */
4172 #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */
4173 diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y
4174 index f412460..687ccad 100644
4175 --- a/scripts/dtc/dtc-parser.y
4176 +++ b/scripts/dtc/dtc-parser.y
4178 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
4184 +#include <inttypes.h>
4191 extern int yylex(void);
4192 -extern void print_error(char const *fmt, ...);
4193 extern void yyerror(char const *s);
4194 +#define ERROR(loc, ...) \
4196 + srcpos_error((loc), "Error", __VA_ARGS__); \
4197 + treesource_error = true; \
4200 extern struct boot_info *the_boot_info;
4201 -extern int treesource_error;
4203 -static unsigned long long eval_literal(const char *s, int base, int bits);
4204 -static unsigned char eval_char_literal(const char *s);
4205 +extern bool treesource_error;
4212 - unsigned int cbase;
4216 @@ -56,18 +53,19 @@ static unsigned char eval_char_literal(const char *s);
4217 struct node *nodelist;
4218 struct reserve_info *re;
4225 %token DT_MEMRESERVE
4226 %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR
4230 %token <propnodename> DT_PROPNODENAME
4231 -%token <literal> DT_LITERAL
4232 -%token <literal> DT_CHAR_LITERAL
4233 -%token <cbase> DT_BASE
4234 +%token <integer> DT_LITERAL
4235 +%token <integer> DT_CHAR_LITERAL
4236 %token <byte> DT_BYTE
4237 %token <data> DT_STRING
4238 %token <labelref> DT_LABEL
4239 @@ -76,6 +74,7 @@ static unsigned char eval_char_literal(const char *s);
4241 %type <data> propdata
4242 %type <data> propdataprefix
4243 +%type <is_plugin> plugindecl
4244 %type <re> memreserve
4245 %type <re> memreserves
4246 %type <array> arrayprefix
4247 @@ -106,10 +105,23 @@ static unsigned char eval_char_literal(const char *s);
4251 - DT_V1 ';' memreserves devicetree
4252 + DT_V1 ';' plugindecl memreserves devicetree
4254 + $5->is_plugin = $3;
4256 + the_boot_info = build_boot_info($4, $5,
4257 + guess_boot_cpuid($5));
4268 - the_boot_info = build_boot_info($3, $4,
4269 - guess_boot_cpuid($4));
4274 @@ -152,17 +164,18 @@ devicetree:
4276 merge_nodes(target, $3);
4278 - print_error("label or path, '%s', not found", $2);
4279 + ERROR(&@2, "Label or path %s not found", $2);
4282 | devicetree DT_DEL_NODE DT_REF ';'
4284 struct node *target = get_node_by_ref($1, $3);
4287 - print_error("label or path, '%s', not found", $3);
4290 delete_node(target);
4292 + ERROR(&@3, "Label or path %s not found", $3);
4297 @@ -230,10 +243,9 @@ propdata:
4300 if (fseek(f, $6, SEEK_SET) != 0)
4301 - print_error("Couldn't seek to offset %llu in \"%s\": %s",
4302 - (unsigned long long)$6,
4305 + die("Couldn't seek to offset %llu in \"%s\": %s",
4306 + (unsigned long long)$6, $4.val,
4309 d = data_copy_file(f, $8);
4311 @@ -274,18 +286,19 @@ propdataprefix:
4313 DT_BITS DT_LITERAL '<'
4315 - $$.data = empty_data;
4316 - $$.bits = eval_literal($2, 0, 7);
4318 - if (($$.bits != 8) &&
4319 - ($$.bits != 16) &&
4320 - ($$.bits != 32) &&
4323 - print_error("Only 8, 16, 32 and 64-bit elements"
4324 - " are currently supported");
4326 + unsigned long long bits;
4330 + if ((bits != 8) && (bits != 16) &&
4331 + (bits != 32) && (bits != 64)) {
4332 + ERROR(&@2, "Array elements must be"
4333 + " 8, 16, 32 or 64-bits");
4337 + $$.data = empty_data;
4342 @@ -305,9 +318,8 @@ arrayprefix:
4343 * mask), all bits are one.
4345 if (($2 > mask) && (($2 | mask) != -1ULL))
4347 - "integer value out of range "
4348 - "%016lx (%d bits)", $1.bits);
4349 + ERROR(&@2, "Value out of range for"
4350 + " %d-bit array element", $1.bits);
4353 $$.data = data_append_integer($1.data, $2, $1.bits);
4354 @@ -321,7 +333,7 @@ arrayprefix:
4358 - print_error("References are only allowed in "
4359 + ERROR(&@2, "References are only allowed in "
4360 "arrays with 32-bit elements.");
4362 $$.data = data_append_integer($1.data, val, $1.bits);
4363 @@ -334,13 +346,7 @@ arrayprefix:
4368 - $$ = eval_literal($1, 0, 64);
4372 - $$ = eval_char_literal($1);
4374 | '(' integer_expr ')'
4377 @@ -447,7 +453,7 @@ subnodes:
4381 - print_error("syntax error: properties must precede subnodes");
4382 + ERROR(&@2, "Properties must precede subnodes");
4386 @@ -470,63 +476,7 @@ subnode:
4390 -void print_error(char const *fmt, ...)
4394 - va_start(va, fmt);
4395 - srcpos_verror(&yylloc, fmt, va);
4398 - treesource_error = 1;
4401 -void yyerror(char const *s) {
4402 - print_error("%s", s);
4405 -static unsigned long long eval_literal(const char *s, int base, int bits)
4407 - unsigned long long val;
4411 - val = strtoull(s, &e, base);
4413 - size_t uls = strspn(e, "UL");
4415 - print_error("bad characters in literal");
4417 - if ((errno == ERANGE)
4418 - || ((bits < 64) && (val >= (1ULL << bits))))
4419 - print_error("literal out of range");
4420 - else if (errno != 0)
4421 - print_error("bad literal");
4425 -static unsigned char eval_char_literal(const char *s)
4426 +void yyerror(char const *s)
4433 - print_error("empty character literal");
4438 - * If the first character in the character literal is a \ then process
4439 - * the remaining characters as an escape encoding. If the first
4440 - * character is neither an escape or a terminator it should be the only
4441 - * character in the literal and will be returned.
4444 - c = get_escape_char(s, &i);
4447 - print_error("malformed character literal");
4450 + ERROR(&yylloc, "%s", s);
4452 diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c
4453 index e3c9653..0cbb14c 100644
4454 --- a/scripts/dtc/dtc.c
4455 +++ b/scripts/dtc/dtc.c
4456 @@ -29,6 +29,7 @@ int reservenum; /* Number of memory reservation slots */
4457 int minsize; /* Minimum blob size */
4458 int padsize; /* Additional padding to blob */
4459 int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */
4460 +int symbol_fixup_support = 0;
4462 static void fill_fullpaths(struct node *tree, const char *prefix)
4464 @@ -48,8 +49,10 @@ static void fill_fullpaths(struct node *tree, const char *prefix)
4467 /* Usage related data. */
4468 +#define FDT_VERSION(version) _FDT_VERSION(version)
4469 +#define _FDT_VERSION(version) #version
4470 static const char usage_synopsis[] = "dtc [options] <input file>";
4471 -static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv";
4472 +static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv@";
4473 static struct option const usage_long_opts[] = {
4474 {"quiet", no_argument, NULL, 'q'},
4475 {"in-format", a_argument, NULL, 'I'},
4476 @@ -67,6 +70,7 @@ static struct option const usage_long_opts[] = {
4477 {"phandle", a_argument, NULL, 'H'},
4478 {"warning", a_argument, NULL, 'W'},
4479 {"error", a_argument, NULL, 'E'},
4480 + {"symbols", a_argument, NULL, '@'},
4481 {"help", no_argument, NULL, 'h'},
4482 {"version", no_argument, NULL, 'v'},
4483 {NULL, no_argument, NULL, 0x0},
4484 @@ -82,9 +86,9 @@ static const char * const usage_opts_help[] = {
4485 "\t\tdts - device tree source text\n"
4486 "\t\tdtb - device tree blob\n"
4487 "\t\tasm - assembler source",
4488 - "\n\tBlob version to produce, defaults to %d (for dtb and asm output)", //, DEFAULT_FDT_VERSION);
4489 + "\n\tBlob version to produce, defaults to "FDT_VERSION(DEFAULT_FDT_VERSION)" (for dtb and asm output)",
4490 "\n\tOutput dependency file",
4491 - "\n\ttMake space for <number> reserve map entries (for dtb and asm output)",
4492 + "\n\tMake space for <number> reserve map entries (for dtb and asm output)",
4493 "\n\tMake the blob at least <bytes> long (extra space)",
4494 "\n\tAdd padding to the blob of <bytes> long (extra space)",
4495 "\n\tSet the physical boot cpu",
4496 @@ -97,6 +101,7 @@ static const char * const usage_opts_help[] = {
4497 "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties",
4498 "\n\tEnable/disable warnings (prefix with \"no-\")",
4499 "\n\tEnable/disable errors (prefix with \"no-\")",
4500 + "\n\tSymbols and Fixups support",
4501 "\n\tPrint this help and exit",
4502 "\n\tPrint version and exit",
4504 @@ -109,7 +114,7 @@ int main(int argc, char *argv[])
4505 const char *outform = "dts";
4506 const char *outname = "-";
4507 const char *depname = NULL;
4508 - int force = 0, sort = 0;
4509 + bool force = false, sort = false;
4513 @@ -148,7 +153,7 @@ int main(int argc, char *argv[])
4514 padsize = strtol(optarg, NULL, 0);
4522 @@ -174,7 +179,7 @@ int main(int argc, char *argv[])
4531 @@ -184,7 +189,9 @@ int main(int argc, char *argv[])
4533 parse_checks_option(false, true, optarg);
4537 + symbol_fixup_support = 1;
4542 @@ -237,7 +244,7 @@ int main(int argc, char *argv[])
4543 if (streq(outname, "-")) {
4546 - outf = fopen(outname, "w");
4547 + outf = fopen(outname, "wb");
4549 die("Couldn't open output file %s: %s\n",
4550 outname, strerror(errno));
4551 diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h
4552 index 264a20c..fe45748 100644
4553 --- a/scripts/dtc/dtc.h
4554 +++ b/scripts/dtc/dtc.h
4559 -#define debug(fmt,args...) printf(fmt, ##args)
4560 +#define debug(...) printf(__VA_ARGS__)
4562 -#define debug(fmt,args...)
4567 @@ -54,6 +54,7 @@ extern int reservenum; /* Number of memory reservation slots */
4568 extern int minsize; /* Minimum blob size */
4569 extern int padsize; /* Additional padding to blob */
4570 extern int phandle_format; /* Use linux,phandle or phandle properties */
4571 +extern int symbol_fixup_support;/* enable symbols & fixup support */
4573 #define PHANDLE_LEGACY 0x1
4574 #define PHANDLE_EPAPR 0x2
4575 @@ -88,7 +89,7 @@ struct data {
4579 -#define empty_data ((struct data){ /* all .members = 0 or NULL */ })
4580 +#define empty_data ((struct data){ 0 /* all .members = 0 or NULL */ })
4582 #define for_each_marker(m) \
4583 for (; (m); (m) = (m)->next)
4584 @@ -118,7 +119,7 @@ struct data data_append_align(struct data d, int align);
4586 struct data data_add_marker(struct data d, enum markertype type, char *ref);
4588 -int data_is_one_string(struct data d);
4589 +bool data_is_one_string(struct data d);
4591 /* DT constraints */
4593 @@ -127,13 +128,32 @@ int data_is_one_string(struct data d);
4603 +struct fixup_entry {
4605 + struct node *node;
4606 + struct property *prop;
4607 + struct fixup_entry *next;
4612 + struct fixup_entry *entries;
4613 + struct fixup *next;
4617 + struct label *label;
4618 + struct node *node;
4619 + struct symbol *next;
4628 @@ -143,7 +163,7 @@ struct property {
4635 struct property *proplist;
4636 struct node *children;
4637 @@ -158,6 +178,12 @@ struct node {
4638 int addr_cells, size_cells;
4640 struct label *labels;
4644 + struct fixup *fixups;
4645 + struct symbol *symbols;
4646 + struct fixup_entry *local_fixups;
4649 #define for_each_label_withdel(l0, l) \
4650 @@ -181,6 +207,18 @@ struct node {
4651 for_each_child_withdel(n, c) \
4654 +#define for_each_fixup(n, f) \
4655 + for ((f) = (n)->fixups; (f); (f) = (f)->next)
4657 +#define for_each_fixup_entry(f, fe) \
4658 + for ((fe) = (f)->entries; (fe); (fe) = (fe)->next)
4660 +#define for_each_symbol(n, s) \
4661 + for ((s) = (n)->symbols; (s); (s) = (s)->next)
4663 +#define for_each_local_fixup_entry(n, fe) \
4664 + for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next)
4666 void add_label(struct label **labels, char *label);
4667 void delete_labels(struct label **labels);
4669 @@ -247,8 +285,8 @@ void sort_tree(struct boot_info *bi);
4673 -void parse_checks_option(bool warn, bool error, const char *optarg);
4674 -void process_checks(int force, struct boot_info *bi);
4675 +void parse_checks_option(bool warn, bool error, const char *arg);
4676 +void process_checks(bool force, struct boot_info *bi);
4678 /* Flattened trees */
4680 diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c
4681 index 665dad7..f439b40 100644
4682 --- a/scripts/dtc/flattree.c
4683 +++ b/scripts/dtc/flattree.c
4684 @@ -261,7 +261,13 @@ static void flatten_tree(struct node *tree, struct emitter *emit,
4686 struct property *prop;
4688 - int seen_name_prop = 0;
4689 + bool seen_name_prop = false;
4690 + struct symbol *sym;
4692 + struct fixup_entry *fe;
4694 + const char *fullpath;
4695 + int namesz, nameoff, vallen;
4699 @@ -276,10 +282,8 @@ static void flatten_tree(struct node *tree, struct emitter *emit,
4700 emit->align(etarget, sizeof(cell_t));
4702 for_each_property(tree, prop) {
4705 if (streq(prop->name, "name"))
4706 - seen_name_prop = 1;
4707 + seen_name_prop = true;
4709 nameoff = stringtable_insert(strbuf, prop->name);
4711 @@ -310,6 +314,139 @@ static void flatten_tree(struct node *tree, struct emitter *emit,
4712 flatten_tree(child, emit, etarget, strbuf, vi);
4715 + if (!symbol_fixup_support)
4718 + /* add the symbol nodes (if any) */
4719 + if (tree->symbols) {
4721 + emit->beginnode(etarget, NULL);
4722 + emit->string(etarget, "__symbols__", 0);
4723 + emit->align(etarget, sizeof(cell_t));
4725 + for_each_symbol(tree, sym) {
4727 + vallen = strlen(sym->node->fullpath);
4729 + nameoff = stringtable_insert(strbuf, sym->label->label);
4731 + emit->property(etarget, NULL);
4732 + emit->cell(etarget, vallen + 1);
4733 + emit->cell(etarget, nameoff);
4735 + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
4736 + emit->align(etarget, 8);
4738 + emit->string(etarget, sym->node->fullpath,
4739 + strlen(sym->node->fullpath));
4740 + emit->align(etarget, sizeof(cell_t));
4743 + emit->endnode(etarget, NULL);
4746 + /* add the fixup nodes */
4747 + if (tree->fixups) {
4749 + /* emit the external fixups */
4750 + emit->beginnode(etarget, NULL);
4751 + emit->string(etarget, "__fixups__", 0);
4752 + emit->align(etarget, sizeof(cell_t));
4754 + for_each_fixup(tree, f) {
4757 + for_each_fixup_entry(f, fe) {
4758 + fullpath = fe->node->fullpath;
4759 + if (fullpath[0] == '\0')
4761 + namesz += strlen(fullpath) + 1;
4762 + namesz += strlen(fe->prop->name) + 1;
4763 + namesz += 32; /* space for :<number> + '\0' */
4766 + name = xmalloc(namesz);
4769 + for_each_fixup_entry(f, fe) {
4770 + fullpath = fe->node->fullpath;
4771 + if (fullpath[0] == '\0')
4773 + snprintf(s, name + namesz - s, "%s:%s:%d",
4775 + fe->prop->name, fe->offset);
4776 + s += strlen(s) + 1;
4779 + nameoff = stringtable_insert(strbuf, f->ref);
4780 + vallen = s - name - 1;
4782 + emit->property(etarget, NULL);
4783 + emit->cell(etarget, vallen + 1);
4784 + emit->cell(etarget, nameoff);
4786 + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
4787 + emit->align(etarget, 8);
4789 + emit->string(etarget, name, vallen);
4790 + emit->align(etarget, sizeof(cell_t));
4795 + emit->endnode(etarget, tree->labels);
4798 + /* add the local fixup property */
4799 + if (tree->local_fixups) {
4801 + /* emit the external fixups */
4802 + emit->beginnode(etarget, NULL);
4803 + emit->string(etarget, "__local_fixups__", 0);
4804 + emit->align(etarget, sizeof(cell_t));
4807 + for_each_local_fixup_entry(tree, fe) {
4808 + fullpath = fe->node->fullpath;
4809 + if (fullpath[0] == '\0')
4811 + namesz += strlen(fullpath) + 1;
4812 + namesz += strlen(fe->prop->name) + 1;
4813 + namesz += 32; /* space for :<number> + '\0' */
4816 + name = xmalloc(namesz);
4819 + for_each_local_fixup_entry(tree, fe) {
4820 + fullpath = fe->node->fullpath;
4821 + if (fullpath[0] == '\0')
4823 + snprintf(s, name + namesz - s, "%s:%s:%d",
4824 + fullpath, fe->prop->name,
4826 + s += strlen(s) + 1;
4829 + nameoff = stringtable_insert(strbuf, "fixup");
4830 + vallen = s - name - 1;
4832 + emit->property(etarget, NULL);
4833 + emit->cell(etarget, vallen + 1);
4834 + emit->cell(etarget, nameoff);
4836 + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
4837 + emit->align(etarget, 8);
4839 + emit->string(etarget, name, vallen);
4840 + emit->align(etarget, sizeof(cell_t));
4844 + emit->endnode(etarget, tree->labels);
4848 emit->endnode(etarget, tree->labels);
4851 diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c
4852 index e464727..6e5878a 100644
4853 --- a/scripts/dtc/fstree.c
4854 +++ b/scripts/dtc/fstree.c
4855 @@ -37,26 +37,26 @@ static struct node *read_fstree(const char *dirname)
4856 tree = build_node(NULL, NULL);
4858 while ((de = readdir(d)) != NULL) {
4862 if (streq(de->d_name, ".")
4863 || streq(de->d_name, ".."))
4866 - tmpnam = join_path(dirname, de->d_name);
4867 + tmpname = join_path(dirname, de->d_name);
4869 - if (lstat(tmpnam, &st) < 0)
4870 - die("stat(%s): %s\n", tmpnam, strerror(errno));
4871 + if (lstat(tmpname, &st) < 0)
4872 + die("stat(%s): %s\n", tmpname, strerror(errno));
4874 if (S_ISREG(st.st_mode)) {
4875 struct property *prop;
4878 - pfile = fopen(tmpnam, "r");
4879 + pfile = fopen(tmpname, "rb");
4882 "WARNING: Cannot open %s: %s\n",
4883 - tmpnam, strerror(errno));
4884 + tmpname, strerror(errno));
4886 prop = build_property(xstrdup(de->d_name),
4887 data_copy_file(pfile,
4888 @@ -67,12 +67,12 @@ static struct node *read_fstree(const char *dirname)
4889 } else if (S_ISDIR(st.st_mode)) {
4890 struct node *newchild;
4892 - newchild = read_fstree(tmpnam);
4893 + newchild = read_fstree(tmpname);
4894 newchild = name_node(newchild, xstrdup(de->d_name));
4895 add_child(tree, newchild);
4903 diff --git a/scripts/dtc/livetree.c b/scripts/dtc/livetree.c
4904 index b61465f..e229b84 100644
4905 --- a/scripts/dtc/livetree.c
4906 +++ b/scripts/dtc/livetree.c
4907 @@ -511,7 +511,9 @@ struct node *get_node_by_phandle(struct node *tree, cell_t phandle)
4909 struct node *get_node_by_ref(struct node *tree, const char *ref)
4911 - if (ref[0] == '/')
4912 + if (streq(ref, "/"))
4914 + else if (ref[0] == '/')
4915 return get_node_by_path(tree, ref);
4917 return get_node_by_label(tree, ref);
4918 diff --git a/scripts/dtc/srcpos.c b/scripts/dtc/srcpos.c
4919 index c20bc53..f534c22 100644
4920 --- a/scripts/dtc/srcpos.c
4921 +++ b/scripts/dtc/srcpos.c
4922 @@ -34,7 +34,7 @@ struct search_path {
4923 static struct search_path *search_path_head, **search_path_tail;
4926 -static char *dirname(const char *path)
4927 +static char *get_dirname(const char *path)
4929 const char *slash = strrchr(path, '/');
4931 @@ -77,7 +77,7 @@ static char *try_open(const char *dirname, const char *fname, FILE **fp)
4933 fullname = join_path(dirname, fname);
4935 - *fp = fopen(fullname, "r");
4936 + *fp = fopen(fullname, "rb");
4940 @@ -150,7 +150,7 @@ void srcfile_push(const char *fname)
4941 srcfile = xmalloc(sizeof(*srcfile));
4943 srcfile->f = srcfile_relative_open(fname, &srcfile->name);
4944 - srcfile->dir = dirname(srcfile->name);
4945 + srcfile->dir = get_dirname(srcfile->name);
4946 srcfile->prev = current_srcfile;
4948 srcfile->lineno = 1;
4949 @@ -159,7 +159,7 @@ void srcfile_push(const char *fname)
4950 current_srcfile = srcfile;
4953 -int srcfile_pop(void)
4954 +bool srcfile_pop(void)
4956 struct srcfile_state *srcfile = current_srcfile;
4958 @@ -177,7 +177,7 @@ int srcfile_pop(void)
4959 * fix this we could either allocate all the files from a
4960 * table, or use a pool allocator. */
4962 - return current_srcfile ? 1 : 0;
4963 + return current_srcfile ? true : false;
4966 void srcfile_add_search_path(const char *dirname)
4967 @@ -290,42 +290,27 @@ srcpos_string(struct srcpos *pos)
4972 -srcpos_verror(struct srcpos *pos, char const *fmt, va_list va)
4973 +void srcpos_verror(struct srcpos *pos, const char *prefix,
4974 + const char *fmt, va_list va)
4976 - const char *srcstr;
4978 - srcstr = srcpos_string(pos);
4981 - fprintf(stderr, "Error: %s ", srcstr);
4982 - vfprintf(stderr, fmt, va);
4983 - fprintf(stderr, "\n");
4985 + srcstr = srcpos_string(pos);
4988 -srcpos_error(struct srcpos *pos, char const *fmt, ...)
4991 + fprintf(stderr, "%s: %s ", prefix, srcstr);
4992 + vfprintf(stderr, fmt, va);
4993 + fprintf(stderr, "\n");
4995 - va_start(va, fmt);
4996 - srcpos_verror(pos, fmt, va);
5003 -srcpos_warn(struct srcpos *pos, char const *fmt, ...)
5004 +void srcpos_error(struct srcpos *pos, const char *prefix,
5005 + const char *fmt, ...)
5007 - const char *srcstr;
5009 - va_start(va, fmt);
5011 - srcstr = srcpos_string(pos);
5013 - fprintf(stderr, "Warning: %s ", srcstr);
5014 - vfprintf(stderr, fmt, va);
5015 - fprintf(stderr, "\n");
5017 + va_start(va, fmt);
5018 + srcpos_verror(pos, prefix, fmt, va);
5022 diff --git a/scripts/dtc/srcpos.h b/scripts/dtc/srcpos.h
5023 index 93a2712..f81827b 100644
5024 --- a/scripts/dtc/srcpos.h
5025 +++ b/scripts/dtc/srcpos.h
5030 +#include <stdbool.h>
5032 struct srcfile_state {
5034 @@ -55,7 +56,7 @@ extern struct srcfile_state *current_srcfile; /* = NULL */
5035 FILE *srcfile_relative_open(const char *fname, char **fullnamep);
5037 void srcfile_push(const char *fname);
5038 -int srcfile_pop(void);
5039 +bool srcfile_pop(void);
5042 * Add a new directory to the search path for input files
5043 @@ -106,12 +107,12 @@ extern struct srcpos *srcpos_copy(struct srcpos *pos);
5044 extern char *srcpos_string(struct srcpos *pos);
5045 extern void srcpos_dump(struct srcpos *pos);
5047 -extern void srcpos_verror(struct srcpos *pos, char const *, va_list va)
5048 - __attribute__((format(printf, 2, 0)));
5049 -extern void srcpos_error(struct srcpos *pos, char const *, ...)
5050 - __attribute__((format(printf, 2, 3)));
5051 -extern void srcpos_warn(struct srcpos *pos, char const *, ...)
5052 - __attribute__((format(printf, 2, 3)));
5053 +extern void srcpos_verror(struct srcpos *pos, const char *prefix,
5054 + const char *fmt, va_list va)
5055 + __attribute__((format(printf, 3, 0)));
5056 +extern void srcpos_error(struct srcpos *pos, const char *prefix,
5057 + const char *fmt, ...)
5058 + __attribute__((format(printf, 3, 4)));
5060 extern void srcpos_set_line(char *f, int l);
5062 diff --git a/scripts/dtc/treesource.c b/scripts/dtc/treesource.c
5063 index 5740e69..a146f2d 100644
5064 --- a/scripts/dtc/treesource.c
5065 +++ b/scripts/dtc/treesource.c
5066 @@ -26,12 +26,12 @@ extern int yyparse(void);
5067 extern YYLTYPE yylloc;
5069 struct boot_info *the_boot_info;
5070 -int treesource_error;
5071 +bool treesource_error;
5073 struct boot_info *dt_from_source(const char *fname)
5075 the_boot_info = NULL;
5076 - treesource_error = 0;
5077 + treesource_error = false;
5079 srcfile_push(fname);
5080 yyin = current_srcfile->f;
5081 @@ -54,9 +54,9 @@ static void write_prefix(FILE *f, int level)
5085 -static int isstring(char c)
5086 +static bool isstring(char c)
5088 - return (isprint(c)
5089 + return (isprint((unsigned char)c)
5091 || strchr("\a\b\t\n\v\f\r", c));
5093 @@ -109,7 +109,7 @@ static void write_propval_string(FILE *f, struct data val)
5097 - while (m && (m->offset < i)) {
5098 + while (m && (m->offset <= (i + 1))) {
5099 if (m->type == LABEL) {
5100 assert(m->offset == (i+1));
5101 fprintf(f, "%s: ", m->ref);
5102 @@ -119,7 +119,7 @@ static void write_propval_string(FILE *f, struct data val)
5107 + if (isprint((unsigned char)c))
5108 fprintf(f, "%c", c);
5110 fprintf(f, "\\x%02hhx", c);
5111 @@ -178,7 +178,7 @@ static void write_propval_bytes(FILE *f, struct data val)
5115 - fprintf(f, "%02hhx", *bp++);
5116 + fprintf(f, "%02hhx", (unsigned char)(*bp++));
5117 if ((const void *)bp >= propend)
5120 diff --git a/scripts/dtc/util.c b/scripts/dtc/util.c
5121 index 3055c16..9d65226 100644
5122 --- a/scripts/dtc/util.c
5123 +++ b/scripts/dtc/util.c
5125 char *xstrdup(const char *s)
5127 int len = strlen(s) + 1;
5128 - char *dup = xmalloc(len);
5129 + char *d = xmalloc(len);
5131 - memcpy(dup, s, len);
5132 + memcpy(d, s, len);
5138 char *join_path(const char *path, const char *name)
5139 @@ -70,7 +70,7 @@ char *join_path(const char *path, const char *name)
5143 -int util_is_printable_string(const void *data, int len)
5144 +bool util_is_printable_string(const void *data, int len)
5146 const char *s = data;
5147 const char *ss, *se;
5148 @@ -87,7 +87,7 @@ int util_is_printable_string(const void *data, int len)
5152 - while (s < se && *s && isprint(*s))
5153 + while (s < se && *s && isprint((unsigned char)*s))
5156 /* not zero, or not done yet */
5157 @@ -219,10 +219,6 @@ int utilfdt_read_err_len(const char *filename, char **buffp, off_t *len)
5158 if (offset == bufsize) {
5160 buf = xrealloc(buf, bufsize);
5167 ret = read(fd, &buf[offset], bufsize - offset);
5168 @@ -375,9 +371,9 @@ void utilfdt_print_data(const char *data, int len)
5169 const uint32_t *cell = (const uint32_t *)data;
5172 - for (i = 0; i < len; i += 4)
5173 + for (i = 0, len /= 4; i < len; i++)
5174 printf("0x%08x%s", fdt32_to_cpu(cell[i]),
5175 - i < (len - 4) ? " " : "");
5176 + i < (len - 1) ? " " : "");
5180 diff --git a/scripts/dtc/util.h b/scripts/dtc/util.h
5181 index 8f40b44..f800b60 100644
5182 --- a/scripts/dtc/util.h
5183 +++ b/scripts/dtc/util.h
5188 +#include <stdbool.h>
5192 @@ -33,6 +34,7 @@ static inline void __attribute__((noreturn)) die(const char *str, ...)
5194 fprintf(stderr, "FATAL ERROR: ");
5195 vfprintf(stderr, str, ap);
5200 @@ -68,7 +70,7 @@ extern char *join_path(const char *path, const char *name);
5201 * @param len The string length including terminator
5202 * @return 1 if a valid printable string, 0 if not
5204 -int util_is_printable_string(const void *data, int len);
5205 +bool util_is_printable_string(const void *data, int len);
5208 * Parse an escaped character starting at index i in string s. The resulting
5209 diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h
5210 index 54d4e90..d644002 100644
5211 --- a/scripts/dtc/version_gen.h
5212 +++ b/scripts/dtc/version_gen.h
5214 -#define DTC_VERSION "DTC 1.4.0-dirty"
5215 +#define DTC_VERSION "DTC 1.4.1-g36c70742"