1 From dc3b7a37d88e3072e1aa50569f8d565325450886 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 022/171] 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 --- a/scripts/dtc/checks.c
29 +++ b/scripts/dtc/checks.c
30 @@ -53,7 +53,7 @@ struct check {
33 enum checkstatus status;
37 struct check **prereq;
39 @@ -113,6 +113,7 @@ static inline void check_msg(struct chec
40 vfprintf(stderr, fmt, ap);
41 fprintf(stderr, "\n");
46 #define FAIL(c, ...) \
47 @@ -141,9 +142,9 @@ static void check_nodes_props(struct che
48 check_nodes_props(c, dt, child);
51 -static int run_check(struct check *c, struct node *dt)
52 +static bool run_check(struct check *c, struct node *dt)
58 assert(!c->inprogress);
59 @@ -151,11 +152,11 @@ static int run_check(struct check *c, st
60 if (c->status != UNCHECKED)
64 + c->inprogress = true;
66 for (i = 0; i < c->num_prereqs; i++) {
67 struct check *prq = c->prereq[i];
68 - error |= run_check(prq, dt);
69 + error = error || run_check(prq, dt);
70 if (prq->status != PASSED) {
72 check_msg(c, "Failed prerequisite '%s'",
73 @@ -177,9 +178,9 @@ static int run_check(struct check *c, st
74 TRACE(c, "\tCompleted, status %d", c->status);
78 + c->inprogress = false;
79 if ((c->status != PASSED) && (c->error))
85 @@ -457,22 +458,93 @@ static void fixup_phandle_references(str
86 struct node *node, struct property *prop)
88 struct marker *m = prop->val.markers;
89 + struct fixup *f, **fp;
90 + struct fixup_entry *fe, **fep;
93 + int has_phandle_refs;
95 + has_phandle_refs = 0;
96 + for_each_marker_of_type(m, REF_PHANDLE) {
97 + has_phandle_refs = 1;
101 + if (!has_phandle_refs)
104 for_each_marker_of_type(m, REF_PHANDLE) {
105 assert(m->offset + sizeof(cell_t) <= prop->val.len);
107 refnode = get_node_by_ref(dt, m->ref);
109 + if (!refnode && !symbol_fixup_support) {
110 FAIL(c, "Reference to non-existent node or label \"%s\"\n",
116 - phandle = get_node_phandle(dt, refnode);
117 - *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
119 + /* allocate fixup entry */
120 + fe = xmalloc(sizeof(*fe));
124 + fe->offset = m->offset;
127 + /* search for an already existing fixup */
128 + for_each_fixup(dt, f)
129 + if (strcmp(f->ref, m->ref) == 0)
132 + /* no fixup found, add new */
134 + f = xmalloc(sizeof(*f));
139 + /* add it to the tree */
146 + /* and now append fixup entry */
149 + fep = &(*fep)->next;
152 + /* mark the entry as unresolved */
153 + phandle = 0xdeadbeef;
155 + phandle = get_node_phandle(dt, refnode);
157 + /* if it's a plugin, we need to record it */
158 + if (symbol_fixup_support && dt->is_plugin) {
160 + /* allocate a new local fixup entry */
161 + fe = xmalloc(sizeof(*fe));
165 + fe->offset = m->offset;
168 + /* append it to the local fixups */
169 + fep = &dt->local_fixups;
171 + fep = &(*fep)->next;
176 + *((cell_t *)(prop->val.val + m->offset)) =
177 + cpu_to_fdt32(phandle);
181 ERROR(phandle_references, NULL, NULL, fixup_phandle_references, NULL,
182 &duplicate_node_names, &explicit_phandles);
183 @@ -624,11 +696,11 @@ static void check_avoid_default_addr_siz
187 - if ((node->parent->addr_cells == -1))
188 + if (node->parent->addr_cells == -1)
189 FAIL(c, "Relying on default #address-cells value for %s",
192 - if ((node->parent->size_cells == -1))
193 + if (node->parent->size_cells == -1)
194 FAIL(c, "Relying on default #size-cells value for %s",
197 @@ -651,6 +723,45 @@ static void check_obsolete_chosen_interr
199 TREE_WARNING(obsolete_chosen_interrupt_controller, NULL);
201 +static void check_auto_label_phandles(struct check *c, struct node *dt,
205 + struct symbol *s, **sp;
208 + if (!symbol_fixup_support)
212 + for_each_label(node->labels, l) {
220 + /* force allocation of a phandle for this node */
221 + (void)get_node_phandle(dt, node);
223 + /* add the symbol */
224 + for_each_label(node->labels, l) {
226 + s = xmalloc(sizeof(*s));
231 + /* add it to the symbols list */
234 + sp = &((*sp)->next);
238 +NODE_WARNING(auto_label_phandles, NULL);
240 static struct check *check_table[] = {
241 &duplicate_node_names, &duplicate_property_names,
242 &node_name_chars, &node_name_format, &property_name_chars,
243 @@ -669,6 +780,8 @@ static struct check *check_table[] = {
244 &avoid_default_addr_size,
245 &obsolete_chosen_interrupt_controller,
247 + &auto_label_phandles,
252 @@ -706,15 +819,15 @@ static void disable_warning_error(struct
253 c->error = c->error && !error;
256 -void parse_checks_option(bool warn, bool error, const char *optarg)
257 +void parse_checks_option(bool warn, bool error, const char *arg)
260 - const char *name = optarg;
261 + const char *name = arg;
264 - if ((strncmp(optarg, "no-", 3) == 0)
265 - || (strncmp(optarg, "no_", 3) == 0)) {
267 + if ((strncmp(arg, "no-", 3) == 0)
268 + || (strncmp(arg, "no_", 3) == 0)) {
273 @@ -733,7 +846,7 @@ void parse_checks_option(bool warn, bool
274 die("Unrecognized check name \"%s\"\n", name);
277 -void process_checks(int force, struct boot_info *bi)
278 +void process_checks(bool force, struct boot_info *bi)
280 struct node *dt = bi->dt;
282 --- a/scripts/dtc/data.c
283 +++ b/scripts/dtc/data.c
284 @@ -74,7 +74,7 @@ struct data data_copy_escape_string(cons
288 - d = data_grow_for(empty_data, strlen(s)+1);
289 + d = data_grow_for(empty_data, len + 1);
293 @@ -250,20 +250,20 @@ struct data data_add_marker(struct data
294 return data_append_markers(d, m);
297 -int data_is_one_string(struct data d)
298 +bool data_is_one_string(struct data d)
307 for (i = 0; i < len-1; i++)
308 if (d.val[i] == '\0')
312 if (d.val[len-1] != '\0')
319 --- a/scripts/dtc/dtc-lexer.l
320 +++ b/scripts/dtc/dtc-lexer.l
323 %option noyywrap nounput noinput never-interactive
329 @@ -40,6 +39,7 @@ LINECOMMENT "//".*\n
330 #include "dtc-parser.tab.h"
333 +extern bool treesource_error;
335 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
336 #define YY_USER_ACTION \
337 @@ -61,7 +61,8 @@ static int dts_version = 1;
340 static void push_input_file(const char *filename);
341 -static int pop_input_file(void);
342 +static bool pop_input_file(void);
343 +static void lexical_error(const char *fmt, ...);
347 @@ -75,11 +76,11 @@ static int pop_input_file(void);
348 char *line, *tmp, *fn;
349 /* skip text before line # */
351 - while (!isdigit(*line))
352 + while (!isdigit((unsigned char)*line))
354 /* skip digits in line # */
356 - while (!isspace(*tmp))
357 + while (!isspace((unsigned char)*tmp))
359 /* "NULL"-terminate line # */
361 @@ -112,6 +113,11 @@ static int pop_input_file(void);
366 + DPRINT("Keyword: /plugin/\n");
371 DPRINT("Keyword: /memreserve/\n");
373 @@ -146,15 +152,42 @@ static int pop_input_file(void);
376 <V1>([0-9]+|0[xX][0-9a-fA-F]+)(U|L|UL|LL|ULL)? {
377 - yylval.literal = xstrdup(yytext);
378 - DPRINT("Literal: '%s'\n", yylval.literal);
380 + DPRINT("Integer Literal: '%s'\n", yytext);
383 + yylval.integer = strtoull(yytext, &e, 0);
385 + assert(!(*e) || !e[strspn(e, "UL")]);
387 + if (errno == ERANGE)
388 + lexical_error("Integer literal '%s' out of range",
391 + /* ERANGE is the only strtoull error triggerable
392 + * by strings matching the pattern */
393 + assert(errno == 0);
398 - yytext[yyleng-1] = '\0';
399 - yylval.literal = xstrdup(yytext+1);
400 - DPRINT("Character literal: %s\n", yylval.literal);
402 + DPRINT("Character literal: %s\n", yytext);
404 + d = data_copy_escape_string(yytext+1, yyleng-2);
406 + lexical_error("Empty character literal");
407 + yylval.integer = 0;
408 + return DT_CHAR_LITERAL;
411 + yylval.integer = (unsigned char)d.val[0];
414 + lexical_error("Character literal has %d"
415 + " characters instead of 1",
418 return DT_CHAR_LITERAL;
421 @@ -164,7 +197,7 @@ static int pop_input_file(void);
425 -<*>"&{/"{PATHCHAR}+\} { /* new-style path reference */
426 +<*>"&{/"{PATHCHAR}*\} { /* new-style path reference */
427 yytext[yyleng-1] = '\0';
428 DPRINT("Ref: %s\n", yytext+2);
429 yylval.labelref = xstrdup(yytext+2);
430 @@ -238,13 +271,24 @@ static void push_input_file(const char *
434 -static int pop_input_file(void)
435 +static bool pop_input_file(void)
437 if (srcfile_pop() == 0)
441 yypop_buffer_state();
442 yyin = current_srcfile->f;
448 +static void lexical_error(const char *fmt, ...)
453 + srcpos_verror(&yylloc, "Lexical error", fmt, ap);
456 + treesource_error = true;
458 --- a/scripts/dtc/dtc-lexer.lex.c_shipped
459 +++ b/scripts/dtc/dtc-lexer.lex.c_shipped
460 @@ -372,8 +372,8 @@ static void yy_fatal_error (yyconst char
462 (yy_c_buf_p) = yy_cp;
464 -#define YY_NUM_RULES 30
465 -#define YY_END_OF_BUFFER 31
466 +#define YY_NUM_RULES 31
467 +#define YY_END_OF_BUFFER 32
468 /* This struct is not used in this scanner,
469 but its presence is necessary. */
471 @@ -381,25 +381,26 @@ struct yy_trans_info
472 flex_int32_t yy_verify;
475 -static yyconst flex_int16_t yy_accept[161] =
476 +static yyconst flex_int16_t yy_accept[166] =
478 + 0, 0, 0, 0, 0, 0, 0, 0, 32, 30,
479 + 19, 19, 30, 30, 30, 30, 30, 30, 30, 30,
480 + 30, 30, 30, 30, 30, 30, 16, 17, 17, 30,
481 + 17, 11, 11, 19, 27, 0, 3, 0, 28, 13,
482 + 0, 0, 12, 0, 0, 0, 0, 0, 0, 0,
483 + 0, 22, 24, 26, 25, 23, 0, 10, 29, 0,
484 + 0, 0, 15, 15, 17, 17, 17, 11, 11, 11,
485 + 0, 13, 0, 12, 0, 0, 0, 21, 0, 0,
486 + 0, 0, 0, 0, 0, 0, 0, 17, 11, 11,
487 + 11, 0, 14, 20, 0, 0, 0, 0, 0, 0,
489 + 0, 0, 0, 0, 17, 0, 0, 0, 0, 0,
490 + 0, 0, 0, 0, 0, 17, 7, 0, 0, 0,
491 + 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
492 + 0, 0, 0, 0, 4, 18, 0, 0, 5, 2,
493 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
494 - 31, 29, 18, 18, 29, 29, 29, 29, 29, 29,
495 - 29, 29, 29, 29, 29, 29, 29, 29, 15, 16,
496 - 16, 29, 16, 10, 10, 18, 26, 0, 3, 0,
497 - 27, 12, 0, 0, 11, 0, 0, 0, 0, 0,
498 - 0, 0, 21, 23, 25, 24, 22, 0, 9, 28,
499 - 0, 0, 0, 14, 14, 16, 16, 16, 10, 10,
500 - 10, 0, 12, 0, 11, 0, 0, 0, 20, 0,
501 - 0, 0, 0, 0, 0, 0, 0, 16, 10, 10,
502 - 10, 0, 19, 0, 0, 0, 0, 0, 0, 0,
504 - 0, 0, 16, 13, 0, 0, 0, 0, 0, 0,
505 - 0, 0, 0, 16, 6, 0, 0, 0, 0, 0,
506 - 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
507 - 4, 17, 0, 0, 2, 0, 0, 0, 0, 0,
508 - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
509 - 0, 0, 5, 8, 0, 0, 0, 0, 7, 0
510 + 0, 0, 1, 0, 0, 0, 0, 6, 9, 0,
514 static yyconst flex_int32_t yy_ec[256] =
515 @@ -415,9 +416,9 @@ static yyconst flex_int32_t yy_ec[256] =
516 22, 22, 22, 22, 24, 22, 22, 25, 22, 22,
517 1, 26, 27, 1, 22, 1, 21, 28, 29, 30,
519 - 31, 21, 22, 22, 32, 22, 22, 33, 34, 35,
520 - 36, 37, 22, 38, 39, 40, 41, 42, 22, 25,
521 - 43, 22, 44, 45, 46, 1, 1, 1, 1, 1,
522 + 31, 21, 32, 22, 33, 22, 22, 34, 35, 36,
523 + 37, 38, 22, 39, 40, 41, 42, 43, 22, 25,
524 + 44, 22, 45, 46, 47, 1, 1, 1, 1, 1,
525 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
526 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
527 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
528 @@ -434,163 +435,165 @@ static yyconst flex_int32_t yy_ec[256] =
532 -static yyconst flex_int32_t yy_meta[47] =
533 +static yyconst flex_int32_t yy_meta[48] =
535 1, 1, 1, 1, 1, 1, 2, 3, 1, 2,
536 2, 2, 4, 5, 5, 5, 6, 1, 1, 1,
537 7, 8, 8, 8, 8, 1, 1, 7, 7, 7,
538 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
540 + 8, 8, 8, 8, 3, 1, 4
543 -static yyconst flex_int16_t yy_base[175] =
544 +static yyconst flex_int16_t yy_base[180] =
546 - 0, 385, 378, 40, 41, 383, 72, 382, 34, 44,
547 - 388, 393, 61, 117, 368, 116, 115, 115, 115, 48,
548 - 367, 107, 368, 339, 127, 120, 0, 147, 393, 0,
549 - 127, 0, 133, 156, 168, 153, 393, 125, 393, 380,
550 - 393, 0, 369, 127, 393, 160, 371, 377, 347, 21,
551 - 343, 346, 393, 393, 393, 393, 393, 359, 393, 393,
552 - 183, 343, 339, 393, 356, 0, 183, 340, 187, 348,
553 - 347, 0, 0, 0, 178, 359, 195, 365, 354, 326,
554 - 332, 325, 334, 328, 204, 326, 331, 324, 393, 335,
555 - 150, 311, 343, 342, 315, 322, 340, 179, 313, 207,
557 - 319, 316, 317, 393, 337, 333, 305, 302, 311, 301,
558 - 310, 190, 338, 337, 393, 307, 322, 301, 305, 277,
559 - 208, 311, 307, 278, 271, 270, 248, 246, 213, 130,
560 - 393, 393, 263, 235, 207, 221, 218, 229, 213, 213,
561 - 206, 234, 218, 210, 208, 193, 219, 393, 223, 204,
562 - 176, 157, 393, 393, 120, 106, 97, 119, 393, 393,
563 - 245, 251, 259, 263, 267, 273, 280, 284, 292, 300,
565 + 0, 393, 35, 392, 66, 391, 38, 107, 397, 401,
566 + 55, 113, 377, 112, 111, 111, 114, 42, 376, 106,
567 + 377, 347, 126, 120, 0, 147, 401, 0, 124, 0,
568 + 137, 158, 170, 163, 401, 153, 401, 389, 401, 0,
569 + 378, 120, 401, 131, 380, 386, 355, 139, 351, 355,
570 + 351, 401, 401, 401, 401, 401, 367, 401, 401, 185,
571 + 350, 346, 401, 364, 0, 185, 347, 189, 356, 355,
572 + 0, 0, 330, 180, 366, 141, 372, 361, 332, 338,
573 + 331, 341, 334, 326, 205, 331, 337, 329, 401, 341,
574 + 167, 316, 401, 349, 348, 320, 328, 346, 180, 318,
576 + 324, 209, 324, 320, 322, 342, 338, 309, 306, 315,
577 + 305, 315, 312, 192, 342, 341, 401, 293, 306, 282,
578 + 268, 252, 255, 203, 285, 282, 272, 268, 252, 233,
579 + 232, 239, 208, 107, 401, 401, 238, 211, 401, 211,
580 + 212, 208, 228, 203, 215, 207, 233, 222, 212, 211,
581 + 203, 227, 401, 237, 225, 204, 185, 401, 401, 149,
582 + 128, 88, 42, 401, 401, 253, 259, 267, 271, 275,
583 + 281, 288, 292, 300, 308, 312, 318, 326, 334
586 -static yyconst flex_int16_t yy_def[175] =
587 +static yyconst flex_int16_t yy_def[180] =
589 - 160, 1, 1, 1, 1, 5, 160, 7, 1, 1,
590 - 160, 160, 160, 160, 160, 161, 162, 163, 160, 160,
591 - 160, 160, 164, 160, 160, 160, 165, 164, 160, 166,
592 - 167, 166, 166, 160, 160, 160, 160, 161, 160, 161,
593 - 160, 168, 160, 163, 160, 163, 169, 170, 160, 160,
594 - 160, 160, 160, 160, 160, 160, 160, 164, 160, 160,
595 - 160, 160, 160, 160, 164, 166, 167, 166, 160, 160,
596 - 160, 171, 168, 172, 163, 169, 169, 170, 160, 160,
597 - 160, 160, 160, 160, 160, 160, 160, 166, 160, 160,
598 - 171, 172, 160, 160, 160, 160, 160, 160, 160, 160,
600 - 160, 160, 166, 160, 160, 160, 160, 160, 160, 160,
601 - 160, 173, 160, 166, 160, 160, 160, 160, 160, 160,
602 - 173, 160, 173, 160, 160, 160, 160, 160, 160, 160,
603 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
604 - 160, 160, 174, 160, 160, 160, 174, 160, 174, 160,
605 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 0,
606 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
608 + 165, 1, 1, 3, 165, 5, 1, 1, 165, 165,
609 + 165, 165, 165, 166, 167, 168, 165, 165, 165, 165,
610 + 169, 165, 165, 165, 170, 169, 165, 171, 172, 171,
611 + 171, 165, 165, 165, 165, 166, 165, 166, 165, 173,
612 + 165, 168, 165, 168, 174, 175, 165, 165, 165, 165,
613 + 165, 165, 165, 165, 165, 165, 169, 165, 165, 165,
614 + 165, 165, 165, 169, 171, 172, 171, 165, 165, 165,
615 + 176, 173, 177, 168, 174, 174, 175, 165, 165, 165,
616 + 165, 165, 165, 165, 165, 165, 165, 171, 165, 165,
617 + 176, 177, 165, 165, 165, 165, 165, 165, 165, 165,
619 + 165, 165, 165, 165, 171, 165, 165, 165, 165, 165,
620 + 165, 165, 165, 178, 165, 171, 165, 165, 165, 165,
621 + 165, 165, 165, 178, 165, 178, 165, 165, 165, 165,
622 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
623 + 165, 165, 165, 165, 165, 165, 165, 179, 165, 165,
624 + 165, 179, 165, 179, 165, 165, 165, 165, 165, 165,
625 + 165, 165, 165, 165, 0, 165, 165, 165, 165, 165,
626 + 165, 165, 165, 165, 165, 165, 165, 165, 165
629 -static yyconst flex_int16_t yy_nxt[440] =
630 +static yyconst flex_int16_t yy_nxt[449] =
632 - 12, 13, 14, 13, 15, 16, 12, 17, 18, 12,
633 - 12, 12, 19, 12, 12, 12, 12, 20, 21, 22,
634 - 23, 23, 23, 23, 23, 12, 12, 23, 23, 23,
635 - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
636 - 23, 23, 23, 12, 24, 12, 25, 34, 35, 35,
637 - 25, 81, 26, 26, 27, 27, 27, 34, 35, 35,
638 - 82, 28, 36, 36, 36, 53, 54, 29, 28, 28,
639 - 28, 28, 12, 13, 14, 13, 15, 16, 30, 17,
640 - 18, 30, 30, 30, 26, 30, 30, 30, 12, 20,
641 - 21, 22, 31, 31, 31, 31, 31, 32, 12, 31,
643 - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
644 - 31, 31, 31, 31, 31, 12, 24, 12, 36, 36,
645 - 36, 39, 41, 45, 47, 56, 57, 48, 61, 47,
646 - 39, 159, 48, 66, 61, 45, 66, 66, 66, 158,
647 - 46, 40, 49, 59, 50, 157, 51, 49, 52, 50,
648 - 40, 63, 46, 52, 36, 36, 36, 156, 43, 62,
649 - 65, 65, 65, 59, 136, 68, 137, 65, 75, 69,
650 - 69, 69, 70, 71, 65, 65, 65, 65, 70, 71,
651 - 72, 69, 69, 69, 61, 46, 45, 155, 154, 66,
652 - 70, 71, 66, 66, 66, 122, 85, 85, 85, 59,
654 - 69, 69, 69, 46, 77, 100, 109, 93, 100, 70,
655 - 71, 110, 112, 122, 129, 123, 153, 85, 85, 85,
656 - 135, 135, 135, 148, 148, 160, 135, 135, 135, 152,
657 - 142, 142, 142, 123, 143, 142, 142, 142, 151, 143,
658 - 150, 146, 145, 149, 149, 38, 38, 38, 38, 38,
659 - 38, 38, 38, 42, 144, 141, 140, 42, 42, 44,
660 - 44, 44, 44, 44, 44, 44, 44, 58, 58, 58,
661 - 58, 64, 139, 64, 66, 138, 134, 66, 133, 66,
662 - 66, 67, 132, 131, 67, 67, 67, 67, 73, 130,
663 - 73, 73, 76, 76, 76, 76, 76, 76, 76, 76,
665 - 78, 78, 78, 78, 78, 78, 78, 78, 91, 160,
666 - 91, 92, 129, 92, 92, 128, 92, 92, 121, 121,
667 - 121, 121, 121, 121, 121, 121, 147, 147, 147, 147,
668 - 147, 147, 147, 147, 127, 126, 125, 124, 61, 61,
669 - 120, 119, 118, 117, 116, 115, 47, 114, 110, 113,
670 - 111, 108, 107, 106, 48, 105, 104, 89, 103, 102,
671 - 101, 99, 98, 97, 96, 95, 94, 79, 77, 90,
672 - 89, 88, 59, 87, 86, 59, 84, 83, 80, 79,
673 - 77, 74, 160, 60, 59, 55, 37, 160, 33, 25,
674 - 26, 25, 11, 160, 160, 160, 160, 160, 160, 160,
676 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
677 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
678 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
679 - 160, 160, 160, 160, 160, 160, 160, 160, 160
680 + 10, 11, 12, 11, 13, 14, 10, 15, 16, 10,
681 + 10, 10, 17, 10, 10, 10, 10, 18, 19, 20,
682 + 21, 21, 21, 21, 21, 10, 10, 21, 21, 21,
683 + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
684 + 21, 21, 21, 21, 10, 22, 10, 24, 25, 25,
685 + 25, 32, 33, 33, 164, 26, 34, 34, 34, 52,
686 + 53, 27, 26, 26, 26, 26, 10, 11, 12, 11,
687 + 13, 14, 28, 15, 16, 28, 28, 28, 24, 28,
688 + 28, 28, 10, 18, 19, 20, 29, 29, 29, 29,
689 + 29, 30, 10, 29, 29, 29, 29, 29, 29, 29,
691 + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
692 + 10, 22, 10, 23, 34, 34, 34, 37, 39, 43,
693 + 32, 33, 33, 45, 55, 56, 46, 60, 43, 45,
694 + 65, 163, 46, 65, 65, 65, 44, 38, 60, 74,
695 + 58, 47, 141, 48, 142, 44, 49, 47, 50, 48,
696 + 76, 51, 62, 94, 50, 41, 44, 51, 37, 61,
697 + 64, 64, 64, 58, 34, 34, 34, 64, 162, 80,
698 + 67, 68, 68, 68, 64, 64, 64, 64, 38, 81,
699 + 69, 70, 71, 68, 68, 68, 60, 161, 43, 69,
700 + 70, 65, 69, 70, 65, 65, 65, 125, 85, 85,
702 + 85, 58, 68, 68, 68, 44, 102, 110, 125, 133,
703 + 102, 69, 70, 111, 114, 160, 159, 126, 85, 85,
704 + 85, 140, 140, 140, 140, 140, 140, 153, 126, 147,
705 + 147, 147, 153, 148, 147, 147, 147, 158, 148, 165,
706 + 157, 156, 155, 151, 150, 149, 146, 154, 145, 144,
707 + 143, 139, 154, 36, 36, 36, 36, 36, 36, 36,
708 + 36, 40, 138, 137, 136, 40, 40, 42, 42, 42,
709 + 42, 42, 42, 42, 42, 57, 57, 57, 57, 63,
710 + 135, 63, 65, 134, 165, 65, 133, 65, 65, 66,
711 + 132, 131, 66, 66, 66, 66, 72, 130, 72, 72,
713 + 75, 75, 75, 75, 75, 75, 75, 75, 77, 77,
714 + 77, 77, 77, 77, 77, 77, 91, 129, 91, 92,
715 + 128, 92, 92, 127, 92, 92, 124, 124, 124, 124,
716 + 124, 124, 124, 124, 152, 152, 152, 152, 152, 152,
717 + 152, 152, 60, 60, 123, 122, 121, 120, 119, 118,
718 + 117, 45, 116, 111, 115, 113, 112, 109, 108, 107,
719 + 46, 106, 93, 89, 105, 104, 103, 101, 100, 99,
720 + 98, 97, 96, 95, 78, 76, 93, 90, 89, 88,
721 + 58, 87, 86, 58, 84, 83, 82, 79, 78, 76,
722 + 73, 165, 59, 58, 54, 35, 165, 31, 23, 23,
724 + 9, 165, 165, 165, 165, 165, 165, 165, 165, 165,
725 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
726 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
727 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
728 + 165, 165, 165, 165, 165, 165, 165, 165
731 -static yyconst flex_int16_t yy_chk[440] =
732 +static yyconst flex_int16_t yy_chk[449] =
734 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
735 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
736 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
737 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
738 - 1, 1, 1, 1, 1, 1, 4, 9, 9, 9,
739 - 10, 50, 4, 5, 5, 5, 5, 10, 10, 10,
740 - 50, 5, 13, 13, 13, 20, 20, 5, 5, 5,
741 - 5, 5, 7, 7, 7, 7, 7, 7, 7, 7,
742 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
743 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
745 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
746 - 7, 7, 7, 7, 7, 7, 7, 7, 14, 14,
747 - 14, 16, 17, 18, 19, 22, 22, 19, 25, 26,
748 - 38, 158, 26, 31, 33, 44, 31, 31, 31, 157,
749 - 18, 16, 19, 31, 19, 156, 19, 26, 19, 26,
750 - 38, 26, 44, 26, 36, 36, 36, 155, 17, 25,
751 - 28, 28, 28, 28, 130, 33, 130, 28, 46, 34,
752 - 34, 34, 91, 91, 28, 28, 28, 28, 34, 34,
753 - 34, 35, 35, 35, 61, 46, 75, 152, 151, 67,
754 - 35, 35, 67, 67, 67, 112, 61, 61, 61, 67,
756 - 69, 69, 69, 75, 77, 85, 98, 77, 100, 69,
757 - 69, 98, 100, 121, 129, 112, 150, 85, 85, 85,
758 - 135, 135, 135, 143, 147, 149, 129, 129, 129, 146,
759 - 138, 138, 138, 121, 138, 142, 142, 142, 145, 142,
760 - 144, 141, 140, 143, 147, 161, 161, 161, 161, 161,
761 - 161, 161, 161, 162, 139, 137, 136, 162, 162, 163,
762 - 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
763 - 164, 165, 134, 165, 166, 133, 128, 166, 127, 166,
764 - 166, 167, 126, 125, 167, 167, 167, 167, 168, 124,
765 - 168, 168, 169, 169, 169, 169, 169, 169, 169, 169,
767 - 170, 170, 170, 170, 170, 170, 170, 170, 171, 123,
768 - 171, 172, 122, 172, 172, 120, 172, 172, 173, 173,
769 - 173, 173, 173, 173, 173, 173, 174, 174, 174, 174,
770 - 174, 174, 174, 174, 119, 118, 117, 116, 114, 113,
771 - 111, 110, 109, 108, 107, 106, 105, 103, 102, 101,
772 - 99, 97, 96, 95, 94, 93, 92, 90, 88, 87,
773 - 86, 84, 83, 82, 81, 80, 79, 78, 76, 71,
774 - 70, 68, 65, 63, 62, 58, 52, 51, 49, 48,
775 - 47, 43, 40, 24, 23, 21, 15, 11, 8, 6,
776 - 3, 2, 160, 160, 160, 160, 160, 160, 160, 160,
778 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
779 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
780 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
781 - 160, 160, 160, 160, 160, 160, 160, 160, 160
782 + 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
783 + 3, 7, 7, 7, 163, 3, 11, 11, 11, 18,
784 + 18, 3, 3, 3, 3, 3, 5, 5, 5, 5,
785 + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
786 + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
787 + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
789 + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
790 + 5, 5, 5, 8, 12, 12, 12, 14, 15, 16,
791 + 8, 8, 8, 17, 20, 20, 17, 23, 42, 24,
792 + 29, 162, 24, 29, 29, 29, 16, 14, 31, 44,
793 + 29, 17, 134, 17, 134, 42, 17, 24, 17, 24,
794 + 76, 17, 24, 76, 24, 15, 44, 24, 36, 23,
795 + 26, 26, 26, 26, 34, 34, 34, 26, 161, 48,
796 + 31, 32, 32, 32, 26, 26, 26, 26, 36, 48,
797 + 32, 32, 32, 33, 33, 33, 60, 160, 74, 91,
798 + 91, 66, 33, 33, 66, 66, 66, 114, 60, 60,
800 + 60, 66, 68, 68, 68, 74, 85, 99, 124, 133,
801 + 102, 68, 68, 99, 102, 157, 156, 114, 85, 85,
802 + 85, 133, 133, 133, 140, 140, 140, 148, 124, 143,
803 + 143, 143, 152, 143, 147, 147, 147, 155, 147, 154,
804 + 151, 150, 149, 146, 145, 144, 142, 148, 141, 138,
805 + 137, 132, 152, 166, 166, 166, 166, 166, 166, 166,
806 + 166, 167, 131, 130, 129, 167, 167, 168, 168, 168,
807 + 168, 168, 168, 168, 168, 169, 169, 169, 169, 170,
808 + 128, 170, 171, 127, 126, 171, 125, 171, 171, 172,
809 + 123, 122, 172, 172, 172, 172, 173, 121, 173, 173,
811 + 174, 174, 174, 174, 174, 174, 174, 174, 175, 175,
812 + 175, 175, 175, 175, 175, 175, 176, 120, 176, 177,
813 + 119, 177, 177, 118, 177, 177, 178, 178, 178, 178,
814 + 178, 178, 178, 178, 179, 179, 179, 179, 179, 179,
815 + 179, 179, 116, 115, 113, 112, 111, 110, 109, 108,
816 + 107, 106, 105, 104, 103, 101, 100, 98, 97, 96,
817 + 95, 94, 92, 90, 88, 87, 86, 84, 83, 82,
818 + 81, 80, 79, 78, 77, 75, 73, 70, 69, 67,
819 + 64, 62, 61, 57, 51, 50, 49, 47, 46, 45,
820 + 41, 38, 22, 21, 19, 13, 9, 6, 4, 2,
822 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
823 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
824 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
825 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
826 + 165, 165, 165, 165, 165, 165, 165, 165
829 static yy_state_type yy_last_accepting_state;
830 @@ -631,13 +634,13 @@ char *yytext;
835 -#line 38 "dtc-lexer.l"
836 +#line 37 "dtc-lexer.l"
839 #include "dtc-parser.tab.h"
842 +extern bool treesource_error;
844 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
845 #define YY_USER_ACTION \
846 @@ -659,14 +662,14 @@ static int dts_version = 1;
849 static void push_input_file(const char *filename);
850 -static int pop_input_file(void);
851 -#line 664 "dtc-lexer.lex.c"
852 +static bool pop_input_file(void);
853 +static void lexical_error(const char *fmt, ...);
854 +#line 668 "dtc-lexer.lex.c"
858 -#define BYTESTRING 2
859 -#define PROPNODENAME 3
861 +#define BYTESTRING 1
862 +#define PROPNODENAME 2
865 #ifndef YY_NO_UNISTD_H
866 /* Special case for "unistd.h", since it is non-ANSI. We include it way
867 @@ -852,9 +855,9 @@ YY_DECL
868 register char *yy_cp, *yy_bp;
871 -#line 67 "dtc-lexer.l"
872 +#line 68 "dtc-lexer.l"
874 -#line 858 "dtc-lexer.lex.c"
875 +#line 861 "dtc-lexer.lex.c"
879 @@ -908,13 +911,13 @@ yy_match:
880 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
882 yy_current_state = (int) yy_def[yy_current_state];
883 - if ( yy_current_state >= 161 )
884 + if ( yy_current_state >= 166 )
885 yy_c = yy_meta[(unsigned int) yy_c];
887 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
890 - while ( yy_current_state != 160 );
891 + while ( yy_current_state != 165 );
892 yy_cp = (yy_last_accepting_cpos);
893 yy_current_state = (yy_last_accepting_state);
895 @@ -937,7 +940,7 @@ do_action: /* This label is used only to
897 /* rule 1 can match eol */
899 -#line 68 "dtc-lexer.l"
900 +#line 69 "dtc-lexer.l"
902 char *name = strchr(yytext, '\"') + 1;
903 yytext[yyleng-1] = '\0';
904 @@ -947,16 +950,16 @@ YY_RULE_SETUP
906 /* rule 2 can match eol */
908 -#line 74 "dtc-lexer.l"
909 +#line 75 "dtc-lexer.l"
911 char *line, *tmp, *fn;
912 /* skip text before line # */
914 - while (!isdigit(*line))
915 + while (!isdigit((unsigned char)*line))
917 /* skip digits in line # */
919 - while (!isspace(*tmp))
920 + while (!isspace((unsigned char)*tmp))
922 /* "NULL"-terminate line # */
924 @@ -970,11 +973,10 @@ YY_RULE_SETUP
927 case YY_STATE_EOF(INITIAL):
928 -case YY_STATE_EOF(INCLUDE):
929 case YY_STATE_EOF(BYTESTRING):
930 case YY_STATE_EOF(PROPNODENAME):
931 case YY_STATE_EOF(V1):
932 -#line 95 "dtc-lexer.l"
933 +#line 96 "dtc-lexer.l"
935 if (!pop_input_file()) {
937 @@ -984,7 +986,7 @@ case YY_STATE_EOF(V1):
939 /* rule 3 can match eol */
941 -#line 101 "dtc-lexer.l"
942 +#line 102 "dtc-lexer.l"
944 DPRINT("String: %s\n", yytext);
945 yylval.data = data_copy_escape_string(yytext+1,
946 @@ -994,7 +996,7 @@ YY_RULE_SETUP
950 -#line 108 "dtc-lexer.l"
951 +#line 109 "dtc-lexer.l"
953 DPRINT("Keyword: /dts-v1/\n");
955 @@ -1004,25 +1006,33 @@ YY_RULE_SETUP
959 -#line 115 "dtc-lexer.l"
960 +#line 116 "dtc-lexer.l"
962 + DPRINT("Keyword: /plugin/\n");
968 +#line 121 "dtc-lexer.l"
970 DPRINT("Keyword: /memreserve/\n");
972 return DT_MEMRESERVE;
978 -#line 121 "dtc-lexer.l"
979 +#line 127 "dtc-lexer.l"
981 DPRINT("Keyword: /bits/\n");
989 -#line 127 "dtc-lexer.l"
990 +#line 133 "dtc-lexer.l"
992 DPRINT("Keyword: /delete-property/\n");
993 DPRINT("<PROPNODENAME>\n");
994 @@ -1030,9 +1040,9 @@ YY_RULE_SETUP
1001 -#line 134 "dtc-lexer.l"
1002 +#line 140 "dtc-lexer.l"
1004 DPRINT("Keyword: /delete-node/\n");
1005 DPRINT("<PROPNODENAME>\n");
1006 @@ -1040,9 +1050,9 @@ YY_RULE_SETUP
1013 -#line 141 "dtc-lexer.l"
1014 +#line 147 "dtc-lexer.l"
1016 DPRINT("Label: %s\n", yytext);
1017 yylval.labelref = xstrdup(yytext);
1018 @@ -1050,38 +1060,65 @@ YY_RULE_SETUP
1025 -#line 148 "dtc-lexer.l"
1026 +#line 154 "dtc-lexer.l"
1028 - yylval.literal = xstrdup(yytext);
1029 - DPRINT("Literal: '%s'\n", yylval.literal);
1031 + DPRINT("Integer Literal: '%s'\n", yytext);
1034 + yylval.integer = strtoull(yytext, &e, 0);
1036 + assert(!(*e) || !e[strspn(e, "UL")]);
1038 + if (errno == ERANGE)
1039 + lexical_error("Integer literal '%s' out of range",
1042 + /* ERANGE is the only strtoull error triggerable
1043 + * by strings matching the pattern */
1044 + assert(errno == 0);
1049 -/* rule 11 can match eol */
1051 +/* rule 12 can match eol */
1053 -#line 154 "dtc-lexer.l"
1054 +#line 173 "dtc-lexer.l"
1056 - yytext[yyleng-1] = '\0';
1057 - yylval.literal = xstrdup(yytext+1);
1058 - DPRINT("Character literal: %s\n", yylval.literal);
1060 + DPRINT("Character literal: %s\n", yytext);
1062 + d = data_copy_escape_string(yytext+1, yyleng-2);
1064 + lexical_error("Empty character literal");
1065 + yylval.integer = 0;
1066 + return DT_CHAR_LITERAL;
1069 + yylval.integer = (unsigned char)d.val[0];
1072 + lexical_error("Character literal has %d"
1073 + " characters instead of 1",
1076 return DT_CHAR_LITERAL;
1082 -#line 161 "dtc-lexer.l"
1083 +#line 194 "dtc-lexer.l"
1084 { /* label reference */
1085 DPRINT("Ref: %s\n", yytext+1);
1086 yylval.labelref = xstrdup(yytext+1);
1093 -#line 167 "dtc-lexer.l"
1094 +#line 200 "dtc-lexer.l"
1095 { /* new-style path reference */
1096 yytext[yyleng-1] = '\0';
1097 DPRINT("Ref: %s\n", yytext+2);
1098 @@ -1089,27 +1126,27 @@ YY_RULE_SETUP
1105 -#line 174 "dtc-lexer.l"
1106 +#line 207 "dtc-lexer.l"
1108 yylval.byte = strtol(yytext, NULL, 16);
1109 DPRINT("Byte: %02x\n", (int)yylval.byte);
1116 -#line 180 "dtc-lexer.l"
1117 +#line 213 "dtc-lexer.l"
1119 DPRINT("/BYTESTRING\n");
1127 -#line 186 "dtc-lexer.l"
1128 +#line 219 "dtc-lexer.l"
1130 DPRINT("PropNodeName: %s\n", yytext);
1131 yylval.propnodename = xstrdup((yytext[0] == '\\') ?
1132 @@ -1118,75 +1155,75 @@ YY_RULE_SETUP
1133 return DT_PROPNODENAME;
1139 -#line 194 "dtc-lexer.l"
1140 +#line 227 "dtc-lexer.l"
1142 DPRINT("Binary Include\n");
1147 -/* rule 18 can match eol */
1149 -#line 199 "dtc-lexer.l"
1150 -/* eat whitespace */
1153 /* rule 19 can match eol */
1155 -#line 200 "dtc-lexer.l"
1156 -/* eat C-style comments */
1157 +#line 232 "dtc-lexer.l"
1158 +/* eat whitespace */
1161 /* rule 20 can match eol */
1163 -#line 201 "dtc-lexer.l"
1164 -/* eat C++-style comments */
1165 +#line 233 "dtc-lexer.l"
1166 +/* eat C-style comments */
1169 +/* rule 21 can match eol */
1171 -#line 203 "dtc-lexer.l"
1172 -{ return DT_LSHIFT; };
1173 +#line 234 "dtc-lexer.l"
1174 +/* eat C++-style comments */
1178 -#line 204 "dtc-lexer.l"
1179 -{ return DT_RSHIFT; };
1180 +#line 236 "dtc-lexer.l"
1181 +{ return DT_LSHIFT; };
1185 -#line 205 "dtc-lexer.l"
1187 +#line 237 "dtc-lexer.l"
1188 +{ return DT_RSHIFT; };
1192 -#line 206 "dtc-lexer.l"
1194 +#line 238 "dtc-lexer.l"
1199 -#line 207 "dtc-lexer.l"
1201 +#line 239 "dtc-lexer.l"
1206 -#line 208 "dtc-lexer.l"
1208 +#line 240 "dtc-lexer.l"
1213 -#line 209 "dtc-lexer.l"
1214 -{ return DT_AND; };
1215 +#line 241 "dtc-lexer.l"
1220 -#line 210 "dtc-lexer.l"
1222 +#line 242 "dtc-lexer.l"
1223 +{ return DT_AND; };
1227 -#line 212 "dtc-lexer.l"
1228 +#line 243 "dtc-lexer.l"
1233 +#line 245 "dtc-lexer.l"
1235 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1236 (unsigned)yytext[0]);
1237 @@ -1202,12 +1239,12 @@ YY_RULE_SETUP
1244 -#line 227 "dtc-lexer.l"
1245 +#line 260 "dtc-lexer.l"
1248 -#line 1211 "dtc-lexer.lex.c"
1249 +#line 1248 "dtc-lexer.lex.c"
1251 case YY_END_OF_BUFFER:
1253 @@ -1499,7 +1536,7 @@ static int yy_get_next_buffer (void)
1254 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1256 yy_current_state = (int) yy_def[yy_current_state];
1257 - if ( yy_current_state >= 161 )
1258 + if ( yy_current_state >= 166 )
1259 yy_c = yy_meta[(unsigned int) yy_c];
1261 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1262 @@ -1527,11 +1564,11 @@ static int yy_get_next_buffer (void)
1263 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1265 yy_current_state = (int) yy_def[yy_current_state];
1266 - if ( yy_current_state >= 161 )
1267 + if ( yy_current_state >= 166 )
1268 yy_c = yy_meta[(unsigned int) yy_c];
1270 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1271 - yy_is_jam = (yy_current_state == 160);
1272 + yy_is_jam = (yy_current_state == 165);
1274 return yy_is_jam ? 0 : yy_current_state;
1276 @@ -2166,7 +2203,7 @@ void yyfree (void * ptr )
1278 #define YYTABLES_NAME "yytables"
1280 -#line 227 "dtc-lexer.l"
1281 +#line 260 "dtc-lexer.l"
1285 @@ -2182,14 +2219,25 @@ static void push_input_file(const char *
1289 -static int pop_input_file(void)
1290 +static bool pop_input_file(void)
1292 if (srcfile_pop() == 0)
1296 yypop_buffer_state();
1297 yyin = current_srcfile->f;
1303 +static void lexical_error(const char *fmt, ...)
1307 + va_start(ap, fmt);
1308 + srcpos_verror(&yylloc, "Lexical error", fmt, ap);
1311 + treesource_error = true;
1314 --- a/scripts/dtc/dtc-parser.tab.c_shipped
1315 +++ b/scripts/dtc/dtc-parser.tab.c_shipped
1317 -/* A Bison parser, made by GNU Bison 2.7.12-4996. */
1318 +/* A Bison parser, made by GNU Bison 3.0.2. */
1320 /* Bison implementation for Yacc-like parsers in C
1322 - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
1325 + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
1327 This program is free software: you can redistribute it and/or modify
1328 it under the terms of the GNU General Public License as published by
1329 the Free Software Foundation, either version 3 of the License, or
1330 (at your option) any later version.
1333 This program is distributed in the hope that it will be useful,
1334 but WITHOUT ANY WARRANTY; without even the implied warranty of
1335 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1336 GNU General Public License for more details.
1339 You should have received a copy of the GNU General Public License
1340 along with this program. If not, see <http://www.gnu.org/licenses/>. */
1343 special exception, which will cause the skeleton and the resulting
1344 Bison output files to be licensed under the GNU General Public
1345 License without this special exception.
1348 This special exception was added by the Free Software Foundation in
1349 version 2.2 of Bison. */
1354 /* Bison version. */
1355 -#define YYBISON_VERSION "2.7.12-4996"
1356 +#define YYBISON_VERSION "3.0.2"
1358 /* Skeleton name. */
1359 #define YYSKELETON_NAME "yacc.c"
1363 /* Copy the first part of user declarations. */
1364 -/* Line 371 of yacc.c */
1365 -#line 21 "dtc-parser.y"
1366 +#line 20 "dtc-parser.y" /* yacc.c:339 */
1369 +#include <inttypes.h>
1376 extern int yylex(void);
1377 -extern void print_error(char const *fmt, ...);
1378 extern void yyerror(char const *s);
1379 +#define ERROR(loc, ...) \
1381 + srcpos_error((loc), "Error", __VA_ARGS__); \
1382 + treesource_error = true; \
1385 extern struct boot_info *the_boot_info;
1386 -extern int treesource_error;
1388 -static unsigned long long eval_literal(const char *s, int base, int bits);
1389 -static unsigned char eval_char_literal(const char *s);
1390 +extern bool treesource_error;
1392 -/* Line 371 of yacc.c */
1393 -#line 87 "dtc-parser.tab.c"
1394 +#line 85 "dtc-parser.tab.c" /* yacc.c:339 */
1397 +# ifndef YY_NULLPTR
1398 # if defined __cplusplus && 201103L <= __cplusplus
1399 -# define YY_NULL nullptr
1400 +# define YY_NULLPTR nullptr
1403 +# define YY_NULLPTR 0
1407 @@ -105,7 +103,7 @@ static unsigned char eval_char_literal(c
1408 by #include "dtc-parser.tab.h". */
1409 #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED
1410 # define YY_YY_DTC_PARSER_TAB_H_INCLUDED
1411 -/* Enabling traces. */
1412 +/* Debug traces. */
1416 @@ -113,48 +111,45 @@ static unsigned char eval_char_literal(c
1423 # define YYTOKENTYPE
1424 - /* Put the tokens into the symbol table, so that GDB and other debuggers
1425 - know about them. */
1426 - enum yytokentype {
1428 - DT_MEMRESERVE = 259,
1438 - DT_DEL_PROP = 269,
1439 - DT_DEL_NODE = 270,
1440 - DT_PROPNODENAME = 271,
1442 - DT_CHAR_LITERAL = 273,
1454 + DT_MEMRESERVE = 260,
1464 + DT_DEL_PROP = 270,
1465 + DT_DEL_NODE = 271,
1466 + DT_PROPNODENAME = 272,
1468 + DT_CHAR_LITERAL = 274,
1479 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1480 -typedef union YYSTYPE
1481 +typedef union YYSTYPE YYSTYPE;
1484 -/* Line 387 of yacc.c */
1485 -#line 40 "dtc-parser.y"
1486 +#line 39 "dtc-parser.y" /* yacc.c:355 */
1491 - unsigned int cbase;
1495 @@ -169,38 +164,38 @@ typedef union YYSTYPE
1496 struct node *nodelist;
1497 struct reserve_info *re;
1502 -/* Line 387 of yacc.c */
1503 -#line 176 "dtc-parser.tab.c"
1505 +#line 170 "dtc-parser.tab.c" /* yacc.c:355 */
1507 # define YYSTYPE_IS_TRIVIAL 1
1508 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1509 # define YYSTYPE_IS_DECLARED 1
1512 -extern YYSTYPE yylval;
1514 -#ifdef YYPARSE_PARAM
1515 -#if defined __STDC__ || defined __cplusplus
1516 -int yyparse (void *YYPARSE_PARAM);
1519 +/* Location type. */
1520 +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
1521 +typedef struct YYLTYPE YYLTYPE;
1529 +# define YYLTYPE_IS_DECLARED 1
1530 +# define YYLTYPE_IS_TRIVIAL 1
1532 -#else /* ! YYPARSE_PARAM */
1533 -#if defined __STDC__ || defined __cplusplus
1536 +extern YYSTYPE yylval;
1537 +extern YYLTYPE yylloc;
1542 -#endif /* ! YYPARSE_PARAM */
1544 #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */
1546 /* Copy the second part of user declarations. */
1548 -/* Line 390 of yacc.c */
1549 -#line 204 "dtc-parser.tab.c"
1550 +#line 199 "dtc-parser.tab.c" /* yacc.c:358 */
1554 @@ -214,11 +209,8 @@ typedef unsigned char yytype_uint8;
1557 typedef YYTYPE_INT8 yytype_int8;
1558 -#elif (defined __STDC__ || defined __C99__FUNC__ \
1559 - || defined __cplusplus || defined _MSC_VER)
1560 -typedef signed char yytype_int8;
1562 -typedef short int yytype_int8;
1563 +typedef signed char yytype_int8;
1566 #ifdef YYTYPE_UINT16
1567 @@ -238,8 +230,7 @@ typedef short int yytype_int16;
1568 # define YYSIZE_T __SIZE_TYPE__
1569 # elif defined size_t
1570 # define YYSIZE_T size_t
1571 -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1572 - || defined __cplusplus || defined _MSC_VER)
1573 +# elif ! defined YYSIZE_T
1574 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1575 # define YYSIZE_T size_t
1577 @@ -261,11 +252,30 @@ typedef short int yytype_int16;
1581 -#ifndef __attribute__
1582 -/* This feature is available in gcc versions 2.5 and later. */
1583 -# if (! defined __GNUC__ || __GNUC__ < 2 \
1584 - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
1585 -# define __attribute__(Spec) /* empty */
1586 +#ifndef YY_ATTRIBUTE
1587 +# if (defined __GNUC__ \
1588 + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
1589 + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
1590 +# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
1592 +# define YY_ATTRIBUTE(Spec) /* empty */
1596 +#ifndef YY_ATTRIBUTE_PURE
1597 +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
1600 +#ifndef YY_ATTRIBUTE_UNUSED
1601 +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
1604 +#if !defined _Noreturn \
1605 + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
1606 +# if defined _MSC_VER && 1200 <= _MSC_VER
1607 +# define _Noreturn __declspec (noreturn)
1609 +# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
1613 @@ -276,24 +286,25 @@ typedef short int yytype_int16;
1614 # define YYUSE(E) /* empty */
1618 -/* Identity function, used to suppress warnings about constant conditions. */
1620 -# define YYID(N) (N)
1622 -#if (defined __STDC__ || defined __C99__FUNC__ \
1623 - || defined __cplusplus || defined _MSC_VER)
1626 +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
1627 +/* Suppress an incorrect diagnostic about yylval being uninitialized. */
1628 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
1629 + _Pragma ("GCC diagnostic push") \
1630 + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
1631 + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1632 +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
1633 + _Pragma ("GCC diagnostic pop")
1638 +# define YY_INITIAL_VALUE(Value) Value
1643 +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1644 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1645 +# define YY_IGNORE_MAYBE_UNINITIALIZED_END
1647 +#ifndef YY_INITIAL_VALUE
1648 +# define YY_INITIAL_VALUE(Value) /* Nothing. */
1652 #if ! defined yyoverflow || YYERROR_VERBOSE
1654 @@ -312,8 +323,7 @@ YYID (yyi)
1655 # define alloca _alloca
1657 # define YYSTACK_ALLOC alloca
1658 -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1659 - || defined __cplusplus || defined _MSC_VER)
1660 +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
1661 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1662 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
1663 # ifndef EXIT_SUCCESS
1664 @@ -325,8 +335,8 @@ YYID (yyi)
1667 # ifdef YYSTACK_ALLOC
1668 - /* Pacify GCC's `empty if-body' warning. */
1669 -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1670 + /* Pacify GCC's 'empty if-body' warning. */
1671 +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1672 # ifndef YYSTACK_ALLOC_MAXIMUM
1673 /* The OS might guarantee only one guard page at the bottom of the stack,
1674 and a page size can be as small as 4096 bytes. So we cannot safely
1675 @@ -342,7 +352,7 @@ YYID (yyi)
1677 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
1678 && ! ((defined YYMALLOC || defined malloc) \
1679 - && (defined YYFREE || defined free)))
1680 + && (defined YYFREE || defined free)))
1681 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1682 # ifndef EXIT_SUCCESS
1683 # define EXIT_SUCCESS 0
1684 @@ -350,15 +360,13 @@ YYID (yyi)
1687 # define YYMALLOC malloc
1688 -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1689 - || defined __cplusplus || defined _MSC_VER)
1690 +# if ! defined malloc && ! defined EXIT_SUCCESS
1691 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1695 # define YYFREE free
1696 -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1697 - || defined __cplusplus || defined _MSC_VER)
1698 +# if ! defined free && ! defined EXIT_SUCCESS
1699 void free (void *); /* INFRINGES ON USER NAME SPACE */
1702 @@ -368,13 +376,15 @@ void free (void *); /* INFRINGES ON USER
1704 #if (! defined yyoverflow \
1705 && (! defined __cplusplus \
1706 - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1707 + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
1708 + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1710 /* A type that is properly aligned for any stack member. */
1713 yytype_int16 yyss_alloc;
1715 + YYLTYPE yyls_alloc;
1718 /* The size of the maximum gap between one aligned stack and the next. */
1719 @@ -383,8 +393,8 @@ union yyalloc
1720 /* The size of an array large to enough to hold all stacks, each with
1722 # define YYSTACK_BYTES(N) \
1723 - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1724 - + YYSTACK_GAP_MAXIMUM)
1725 + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
1726 + + 2 * YYSTACK_GAP_MAXIMUM)
1728 # define YYCOPY_NEEDED 1
1730 @@ -393,16 +403,16 @@ union yyalloc
1731 elements in the stack, and YYPTR gives the new location of the
1732 stack. Advance YYPTR to a properly aligned location for the next
1734 -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
1737 - YYSIZE_T yynewbytes; \
1738 - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
1739 - Stack = &yyptr->Stack_alloc; \
1740 - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1741 - yyptr += yynewbytes / sizeof (*yyptr); \
1744 +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
1747 + YYSIZE_T yynewbytes; \
1748 + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
1749 + Stack = &yyptr->Stack_alloc; \
1750 + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1751 + yyptr += yynewbytes / sizeof (*yyptr); \
1757 @@ -421,7 +431,7 @@ union yyalloc
1758 for (yyi = 0; yyi < (Count); yyi++) \
1759 (Dst)[yyi] = (Src)[yyi]; \
1765 #endif /* !YYCOPY_NEEDED */
1766 @@ -429,25 +439,27 @@ union yyalloc
1767 /* YYFINAL -- State number of the termination state. */
1769 /* YYLAST -- Last index in YYTABLE. */
1773 /* YYNTOKENS -- Number of terminals. */
1774 #define YYNTOKENS 48
1775 /* YYNNTS -- Number of nonterminals. */
1778 /* YYNRULES -- Number of rules. */
1779 -#define YYNRULES 79
1780 -/* YYNRULES -- Number of states. */
1781 -#define YYNSTATES 141
1782 +#define YYNRULES 81
1783 +/* YYNSTATES -- Number of states. */
1784 +#define YYNSTATES 144
1786 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1787 +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
1788 + by yylex, with out-of-bounds checking. */
1789 #define YYUNDEFTOK 2
1790 #define YYMAXUTOK 279
1792 -#define YYTRANSLATE(YYX) \
1793 +#define YYTRANSLATE(YYX) \
1794 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1796 -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1797 +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
1798 + as returned by yylex, without out-of-bounds checking. */
1799 static const yytype_uint8 yytranslate[] =
1801 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1802 @@ -481,63 +493,18 @@ static const yytype_uint8 yytranslate[]
1806 -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1808 -static const yytype_uint16 yyprhs[] =
1810 - 0, 0, 3, 8, 9, 12, 17, 20, 23, 27,
1811 - 31, 36, 42, 43, 46, 51, 54, 58, 61, 64,
1812 - 68, 73, 76, 86, 92, 95, 96, 99, 102, 106,
1813 - 108, 111, 114, 117, 119, 121, 125, 127, 129, 135,
1814 - 137, 141, 143, 147, 149, 153, 155, 159, 161, 165,
1815 - 167, 171, 175, 177, 181, 185, 189, 193, 197, 201,
1816 - 203, 207, 211, 213, 217, 221, 225, 227, 229, 232,
1817 - 235, 238, 239, 242, 245, 246, 249, 252, 255, 259
1820 -/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1821 -static const yytype_int8 yyrhs[] =
1823 - 49, 0, -1, 3, 25, 50, 52, -1, -1, 51,
1824 - 50, -1, 4, 59, 59, 25, -1, 22, 51, -1,
1825 - 26, 53, -1, 52, 26, 53, -1, 52, 23, 53,
1826 - -1, 52, 15, 23, 25, -1, 27, 54, 74, 28,
1827 - 25, -1, -1, 54, 55, -1, 16, 29, 56, 25,
1828 - -1, 16, 25, -1, 14, 16, 25, -1, 22, 55,
1829 - -1, 57, 21, -1, 57, 58, 30, -1, 57, 31,
1830 - 73, 32, -1, 57, 23, -1, 57, 24, 33, 21,
1831 - 34, 59, 34, 59, 35, -1, 57, 24, 33, 21,
1832 - 35, -1, 56, 22, -1, -1, 56, 34, -1, 57,
1833 - 22, -1, 13, 17, 36, -1, 36, -1, 58, 59,
1834 - -1, 58, 23, -1, 58, 22, -1, 17, -1, 18,
1835 - -1, 33, 60, 35, -1, 61, -1, 62, -1, 62,
1836 - 37, 60, 38, 61, -1, 63, -1, 62, 12, 63,
1837 - -1, 64, -1, 63, 11, 64, -1, 65, -1, 64,
1838 - 39, 65, -1, 66, -1, 65, 40, 66, -1, 67,
1839 - -1, 66, 41, 67, -1, 68, -1, 67, 9, 68,
1840 - -1, 67, 10, 68, -1, 69, -1, 68, 36, 69,
1841 - -1, 68, 30, 69, -1, 68, 7, 69, -1, 68,
1842 - 8, 69, -1, 69, 5, 70, -1, 69, 6, 70,
1843 - -1, 70, -1, 70, 42, 71, -1, 70, 43, 71,
1844 - -1, 71, -1, 71, 44, 72, -1, 71, 26, 72,
1845 - -1, 71, 45, 72, -1, 72, -1, 59, -1, 43,
1846 - 72, -1, 46, 72, -1, 47, 72, -1, -1, 73,
1847 - 20, -1, 73, 22, -1, -1, 75, 74, -1, 75,
1848 - 55, -1, 16, 53, -1, 15, 16, 25, -1, 22,
1852 -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1853 + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
1854 static const yytype_uint16 yyrline[] =
1856 - 0, 109, 109, 118, 121, 128, 132, 140, 144, 148,
1857 - 158, 172, 180, 183, 190, 194, 198, 202, 210, 214,
1858 - 218, 222, 226, 243, 253, 261, 264, 268, 275, 290,
1859 - 295, 315, 329, 336, 340, 344, 351, 355, 356, 360,
1860 - 361, 365, 366, 370, 371, 375, 376, 380, 381, 385,
1861 - 386, 387, 391, 392, 393, 394, 395, 399, 400, 401,
1862 - 405, 406, 407, 411, 412, 413, 414, 418, 419, 420,
1863 - 421, 426, 429, 433, 441, 444, 448, 456, 460, 464
1864 + 0, 108, 108, 119, 122, 130, 133, 140, 144, 152,
1865 + 156, 160, 170, 185, 193, 196, 203, 207, 211, 215,
1866 + 223, 227, 231, 235, 239, 255, 265, 273, 276, 280,
1867 + 287, 303, 308, 327, 341, 348, 349, 350, 357, 361,
1868 + 362, 366, 367, 371, 372, 376, 377, 381, 382, 386,
1869 + 387, 391, 392, 393, 397, 398, 399, 400, 401, 405,
1870 + 406, 407, 411, 412, 413, 417, 418, 419, 420, 424,
1871 + 425, 426, 427, 432, 435, 439, 447, 450, 454, 462,
1876 @@ -546,25 +513,25 @@ static const yytype_uint16 yyrline[] =
1877 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1878 static const char *const yytname[] =
1880 - "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT",
1881 - "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR",
1882 - "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL",
1883 - "DT_CHAR_LITERAL", "DT_BASE", "DT_BYTE", "DT_STRING", "DT_LABEL",
1884 + "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE",
1885 + "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND",
1886 + "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME",
1887 + "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL",
1888 "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['",
1889 "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'",
1890 "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile",
1891 - "memreserves", "memreserve", "devicetree", "nodedef", "proplist",
1892 - "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim",
1893 - "integer_expr", "integer_trinary", "integer_or", "integer_and",
1894 - "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq",
1895 - "integer_rela", "integer_shift", "integer_add", "integer_mul",
1896 - "integer_unary", "bytestring", "subnodes", "subnode", YY_NULL
1897 + "plugindecl", "memreserves", "memreserve", "devicetree", "nodedef",
1898 + "proplist", "propdef", "propdata", "propdataprefix", "arrayprefix",
1899 + "integer_prim", "integer_expr", "integer_trinary", "integer_or",
1900 + "integer_and", "integer_bitor", "integer_bitxor", "integer_bitand",
1901 + "integer_eq", "integer_rela", "integer_shift", "integer_add",
1902 + "integer_mul", "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR
1907 -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1908 - token YYLEX-NUM. */
1909 +/* YYTOKNUM[NUM] -- (External) token number corresponding to the
1910 + (internal) symbol number NUM (which must be that of a token). */
1911 static const yytype_uint16 yytoknum[] =
1913 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1914 @@ -575,183 +542,173 @@ static const yytype_uint16 yytoknum[] =
1918 -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1919 -static const yytype_uint8 yyr1[] =
1921 - 0, 48, 49, 50, 50, 51, 51, 52, 52, 52,
1922 - 52, 53, 54, 54, 55, 55, 55, 55, 56, 56,
1923 - 56, 56, 56, 56, 56, 57, 57, 57, 58, 58,
1924 - 58, 58, 58, 59, 59, 59, 60, 61, 61, 62,
1925 - 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
1926 - 67, 67, 68, 68, 68, 68, 68, 69, 69, 69,
1927 - 70, 70, 70, 71, 71, 71, 71, 72, 72, 72,
1928 - 72, 73, 73, 73, 74, 74, 74, 75, 75, 75
1930 +#define YYPACT_NINF -41
1932 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1933 -static const yytype_uint8 yyr2[] =
1934 +#define yypact_value_is_default(Yystate) \
1935 + (!!((Yystate) == (-41)))
1937 +#define YYTABLE_NINF -1
1939 +#define yytable_value_is_error(Yytable_value) \
1942 + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1944 +static const yytype_int8 yypact[] =
1946 - 0, 2, 4, 0, 2, 4, 2, 2, 3, 3,
1947 - 4, 5, 0, 2, 4, 2, 3, 2, 2, 3,
1948 - 4, 2, 9, 5, 2, 0, 2, 2, 3, 1,
1949 - 2, 2, 2, 1, 1, 3, 1, 1, 5, 1,
1950 - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
1951 - 3, 3, 1, 3, 3, 3, 3, 3, 3, 1,
1952 - 3, 3, 1, 3, 3, 3, 1, 1, 2, 2,
1953 - 2, 0, 2, 2, 0, 2, 2, 2, 3, 2
1954 + 37, 10, 24, 78, -41, 20, 9, -41, 8, 9,
1955 + 59, 9, -41, -41, -10, 8, -41, 60, 39, -41,
1956 + -10, -10, -10, -41, 51, -41, -7, 76, 50, 52,
1957 + 53, 49, 2, 65, 32, -1, -41, 66, -41, -41,
1958 + 67, 60, 60, -41, -41, -41, -41, -10, -10, -10,
1959 + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
1960 + -10, -10, -10, -10, -10, -10, -41, 41, 68, -41,
1961 + -41, 76, 57, 50, 52, 53, 49, 2, 2, 65,
1962 + 65, 65, 65, 32, 32, -1, -1, -41, -41, -41,
1963 + 79, 80, -12, 41, -41, 70, 41, -41, -10, 74,
1964 + 75, -41, -41, -41, -41, -41, 77, -41, -41, -41,
1965 + -41, -41, 17, -2, -41, -41, -41, -41, 83, -41,
1966 + -41, -41, 71, -41, -41, 31, 69, 82, -4, -41,
1967 + -41, -41, -41, -41, 42, -41, -41, -41, 8, -41,
1971 -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
1972 - Performed when YYTABLE doesn't specify something else to do. Zero
1973 - means the default is an error. */
1974 + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
1975 + Performed when YYTABLE does not specify something else to do. Zero
1976 + means the default is an error. */
1977 static const yytype_uint8 yydefact[] =
1979 - 0, 0, 0, 3, 1, 0, 0, 0, 3, 33,
1980 - 34, 0, 0, 6, 0, 2, 4, 0, 0, 0,
1981 - 67, 0, 36, 37, 39, 41, 43, 45, 47, 49,
1982 - 52, 59, 62, 66, 0, 12, 7, 0, 0, 0,
1983 - 68, 69, 70, 35, 0, 0, 0, 0, 0, 0,
1984 + 0, 0, 0, 3, 1, 0, 5, 4, 0, 0,
1985 + 0, 5, 35, 36, 0, 0, 8, 0, 2, 6,
1986 + 0, 0, 0, 69, 0, 38, 39, 41, 43, 45,
1987 + 47, 49, 51, 54, 61, 64, 68, 0, 14, 9,
1988 + 0, 0, 0, 70, 71, 72, 37, 0, 0, 0,
1989 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1990 - 0, 0, 0, 5, 74, 0, 9, 8, 40, 0,
1991 - 42, 44, 46, 48, 50, 51, 55, 56, 54, 53,
1992 - 57, 58, 60, 61, 64, 63, 65, 0, 0, 0,
1993 - 0, 13, 0, 74, 10, 0, 0, 0, 15, 25,
1994 - 77, 17, 79, 0, 76, 75, 38, 16, 78, 0,
1995 - 0, 11, 24, 14, 26, 0, 18, 27, 21, 0,
1996 - 71, 29, 0, 0, 0, 0, 32, 31, 19, 30,
1997 - 28, 0, 72, 73, 20, 0, 23, 0, 0, 0,
1999 + 0, 0, 0, 0, 0, 0, 7, 76, 0, 11,
2000 + 10, 42, 0, 44, 46, 48, 50, 52, 53, 57,
2001 + 58, 56, 55, 59, 60, 62, 63, 66, 65, 67,
2002 + 0, 0, 0, 0, 15, 0, 76, 12, 0, 0,
2003 + 0, 17, 27, 79, 19, 81, 0, 78, 77, 40,
2004 + 18, 80, 0, 0, 13, 26, 16, 28, 0, 20,
2005 + 29, 23, 0, 73, 31, 0, 0, 0, 0, 34,
2006 + 33, 21, 32, 30, 0, 74, 75, 22, 0, 25,
2010 -/* YYDEFGOTO[NTERM-NUM]. */
2011 -static const yytype_int8 yydefgoto[] =
2012 + /* YYPGOTO[NTERM-NUM]. */
2013 +static const yytype_int8 yypgoto[] =
2015 - -1, 2, 7, 8, 15, 36, 64, 91, 109, 110,
2016 - 122, 20, 21, 22, 23, 24, 25, 26, 27, 28,
2017 - 29, 30, 31, 32, 33, 125, 92, 93
2018 + -41, -41, -41, 96, 100, -41, -40, -41, -23, -41,
2019 + -41, -41, -8, 62, 13, -41, 81, 63, 64, 84,
2020 + 61, 25, 11, 21, 22, -17, -41, 19, 23
2023 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2025 -#define YYPACT_NINF -78
2026 -static const yytype_int8 yypact[] =
2027 + /* YYDEFGOTO[NTERM-NUM]. */
2028 +static const yytype_int16 yydefgoto[] =
2030 - 22, 11, 51, 10, -78, 23, 10, 2, 10, -78,
2031 - -78, -9, 23, -78, 30, 38, -78, -9, -9, -9,
2032 - -78, 35, -78, -6, 52, 29, 48, 49, 33, 3,
2033 - 71, 36, 0, -78, 64, -78, -78, 68, 30, 30,
2034 - -78, -78, -78, -78, -9, -9, -9, -9, -9, -9,
2035 - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
2036 - -9, -9, -9, -78, 44, 67, -78, -78, 52, 55,
2037 - 29, 48, 49, 33, 3, 3, 71, 71, 71, 71,
2038 - 36, 36, 0, 0, -78, -78, -78, 78, 79, 42,
2039 - 44, -78, 69, 44, -78, -9, 73, 74, -78, -78,
2040 - -78, -78, -78, 75, -78, -78, -78, -78, -78, -7,
2041 - -1, -78, -78, -78, -78, 84, -78, -78, -78, 63,
2042 - -78, -78, 32, 66, 82, -3, -78, -78, -78, -78,
2043 - -78, 46, -78, -78, -78, 23, -78, 70, 23, 72,
2045 + -1, 2, 6, 10, 11, 18, 39, 67, 94, 112,
2046 + 113, 125, 23, 24, 25, 26, 27, 28, 29, 30,
2047 + 31, 32, 33, 34, 35, 36, 128, 95, 96
2050 -/* YYPGOTO[NTERM-NUM]. */
2051 -static const yytype_int8 yypgoto[] =
2052 + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
2053 + positive, shift that token. If negative, reduce the rule whose
2054 + number is the opposite. If YYTABLE_NINF, syntax error. */
2055 +static const yytype_uint8 yytable[] =
2057 - -78, -78, 97, 100, -78, -37, -78, -77, -78, -78,
2058 - -78, -5, 65, 13, -78, 76, 77, 62, 80, 83,
2059 - 34, 20, 26, 28, -14, -78, 18, 24
2060 + 15, 69, 70, 43, 44, 45, 47, 37, 12, 13,
2061 + 55, 56, 118, 101, 8, 38, 135, 102, 136, 119,
2062 + 120, 121, 122, 14, 4, 63, 12, 13, 137, 123,
2063 + 48, 9, 57, 20, 124, 3, 21, 22, 58, 115,
2064 + 1, 14, 116, 64, 65, 7, 87, 88, 89, 12,
2065 + 13, 117, 103, 129, 130, 40, 90, 91, 92, 53,
2066 + 54, 131, 41, 93, 14, 42, 79, 80, 81, 82,
2067 + 104, 59, 60, 107, 61, 62, 138, 139, 77, 78,
2068 + 83, 84, 5, 85, 86, 17, 46, 38, 49, 50,
2069 + 68, 66, 51, 97, 52, 98, 99, 100, 106, 110,
2070 + 111, 126, 114, 134, 127, 133, 141, 19, 143, 16,
2071 + 72, 109, 73, 76, 74, 108, 105, 132, 0, 0,
2072 + 0, 0, 0, 0, 0, 0, 0, 0, 71, 0,
2073 + 140, 0, 0, 142, 0, 75
2076 -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2077 - positive, shift that token. If negative, reduce the rule which
2078 - number is the opposite. If YYTABLE_NINF, syntax error. */
2079 -#define YYTABLE_NINF -1
2080 -static const yytype_uint8 yytable[] =
2081 +static const yytype_int16 yycheck[] =
2083 - 12, 66, 67, 40, 41, 42, 44, 34, 9, 10,
2084 - 52, 53, 115, 101, 5, 112, 104, 132, 113, 133,
2085 - 116, 117, 118, 119, 11, 1, 60, 114, 14, 134,
2086 - 120, 45, 6, 54, 17, 121, 3, 18, 19, 55,
2087 - 9, 10, 50, 51, 61, 62, 84, 85, 86, 9,
2088 - 10, 4, 100, 37, 126, 127, 11, 35, 87, 88,
2089 - 89, 38, 128, 46, 39, 11, 90, 98, 47, 35,
2090 - 43, 99, 76, 77, 78, 79, 56, 57, 58, 59,
2091 - 135, 136, 80, 81, 74, 75, 82, 83, 48, 63,
2092 - 49, 65, 94, 95, 96, 97, 124, 103, 107, 108,
2093 - 111, 123, 130, 131, 138, 16, 13, 140, 106, 71,
2094 - 69, 105, 0, 0, 102, 0, 0, 129, 0, 0,
2095 - 68, 0, 0, 70, 0, 0, 0, 0, 72, 0,
2097 + 8, 41, 42, 20, 21, 22, 13, 15, 18, 19,
2098 + 8, 9, 14, 25, 5, 27, 20, 29, 22, 21,
2099 + 22, 23, 24, 33, 0, 26, 18, 19, 32, 31,
2100 + 37, 22, 30, 43, 36, 25, 46, 47, 36, 22,
2101 + 3, 33, 25, 44, 45, 25, 63, 64, 65, 18,
2102 + 19, 34, 92, 22, 23, 16, 15, 16, 17, 10,
2103 + 11, 30, 23, 22, 33, 26, 55, 56, 57, 58,
2104 + 93, 6, 7, 96, 42, 43, 34, 35, 53, 54,
2105 + 59, 60, 4, 61, 62, 26, 35, 27, 12, 39,
2106 + 23, 25, 40, 25, 41, 38, 17, 17, 28, 25,
2107 + 25, 18, 25, 21, 33, 36, 34, 11, 35, 9,
2108 + 48, 98, 49, 52, 50, 96, 93, 125, -1, -1,
2109 + -1, -1, -1, -1, -1, -1, -1, -1, 47, -1,
2110 + 138, -1, -1, 141, -1, 51
2113 -#define yypact_value_is_default(Yystate) \
2114 - (!!((Yystate) == (-78)))
2116 -#define yytable_value_is_error(Yytable_value) \
2118 + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2119 + symbol of state STATE-NUM. */
2120 +static const yytype_uint8 yystos[] =
2122 + 0, 3, 49, 25, 0, 4, 50, 25, 5, 22,
2123 + 51, 52, 18, 19, 33, 60, 52, 26, 53, 51,
2124 + 43, 46, 47, 60, 61, 62, 63, 64, 65, 66,
2125 + 67, 68, 69, 70, 71, 72, 73, 60, 27, 54,
2126 + 16, 23, 26, 73, 73, 73, 35, 13, 37, 12,
2127 + 39, 40, 41, 10, 11, 8, 9, 30, 36, 6,
2128 + 7, 42, 43, 26, 44, 45, 25, 55, 23, 54,
2129 + 54, 64, 61, 65, 66, 67, 68, 69, 69, 70,
2130 + 70, 70, 70, 71, 71, 72, 72, 73, 73, 73,
2131 + 15, 16, 17, 22, 56, 75, 76, 25, 38, 17,
2132 + 17, 25, 29, 54, 56, 76, 28, 56, 75, 62,
2133 + 25, 25, 57, 58, 25, 22, 25, 34, 14, 21,
2134 + 22, 23, 24, 31, 36, 59, 18, 33, 74, 22,
2135 + 23, 30, 60, 36, 21, 20, 22, 32, 34, 35,
2139 -static const yytype_int16 yycheck[] =
2140 + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
2141 +static const yytype_uint8 yyr1[] =
2143 - 5, 38, 39, 17, 18, 19, 12, 12, 17, 18,
2144 - 7, 8, 13, 90, 4, 22, 93, 20, 25, 22,
2145 - 21, 22, 23, 24, 33, 3, 26, 34, 26, 32,
2146 - 31, 37, 22, 30, 43, 36, 25, 46, 47, 36,
2147 - 17, 18, 9, 10, 44, 45, 60, 61, 62, 17,
2148 - 18, 0, 89, 15, 22, 23, 33, 27, 14, 15,
2149 - 16, 23, 30, 11, 26, 33, 22, 25, 39, 27,
2150 - 35, 29, 52, 53, 54, 55, 5, 6, 42, 43,
2151 - 34, 35, 56, 57, 50, 51, 58, 59, 40, 25,
2152 - 41, 23, 25, 38, 16, 16, 33, 28, 25, 25,
2153 - 25, 17, 36, 21, 34, 8, 6, 35, 95, 47,
2154 - 45, 93, -1, -1, 90, -1, -1, 122, -1, -1,
2155 - 44, -1, -1, 46, -1, -1, -1, -1, 48, -1,
2157 + 0, 48, 49, 50, 50, 51, 51, 52, 52, 53,
2158 + 53, 53, 53, 54, 55, 55, 56, 56, 56, 56,
2159 + 57, 57, 57, 57, 57, 57, 57, 58, 58, 58,
2160 + 59, 59, 59, 59, 59, 60, 60, 60, 61, 62,
2161 + 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
2162 + 67, 68, 68, 68, 69, 69, 69, 69, 69, 70,
2163 + 70, 70, 71, 71, 71, 72, 72, 72, 72, 73,
2164 + 73, 73, 73, 74, 74, 74, 75, 75, 75, 76,
2168 -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2169 - symbol of state STATE-NUM. */
2170 -static const yytype_uint8 yystos[] =
2171 + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
2172 +static const yytype_uint8 yyr2[] =
2174 - 0, 3, 49, 25, 0, 4, 22, 50, 51, 17,
2175 - 18, 33, 59, 51, 26, 52, 50, 43, 46, 47,
2176 - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
2177 - 69, 70, 71, 72, 59, 27, 53, 15, 23, 26,
2178 - 72, 72, 72, 35, 12, 37, 11, 39, 40, 41,
2179 - 9, 10, 7, 8, 30, 36, 5, 6, 42, 43,
2180 - 26, 44, 45, 25, 54, 23, 53, 53, 63, 60,
2181 - 64, 65, 66, 67, 68, 68, 69, 69, 69, 69,
2182 - 70, 70, 71, 71, 72, 72, 72, 14, 15, 16,
2183 - 22, 55, 74, 75, 25, 38, 16, 16, 25, 29,
2184 - 53, 55, 75, 28, 55, 74, 61, 25, 25, 56,
2185 - 57, 25, 22, 25, 34, 13, 21, 22, 23, 24,
2186 - 31, 36, 58, 17, 33, 73, 22, 23, 30, 59,
2187 - 36, 21, 20, 22, 32, 34, 35, 59, 34, 59,
2189 + 0, 2, 5, 0, 2, 0, 2, 4, 2, 2,
2190 + 3, 3, 4, 5, 0, 2, 4, 2, 3, 2,
2191 + 2, 3, 4, 2, 9, 5, 2, 0, 2, 2,
2192 + 3, 1, 2, 2, 2, 1, 1, 3, 1, 1,
2193 + 5, 1, 3, 1, 3, 1, 3, 1, 3, 1,
2194 + 3, 1, 3, 3, 1, 3, 3, 3, 3, 3,
2195 + 3, 1, 3, 3, 1, 3, 3, 3, 1, 1,
2196 + 2, 2, 2, 0, 2, 2, 0, 2, 2, 2,
2200 -#define yyerrok (yyerrstatus = 0)
2201 -#define yyclearin (yychar = YYEMPTY)
2202 -#define YYEMPTY (-2)
2205 -#define YYACCEPT goto yyacceptlab
2206 -#define YYABORT goto yyabortlab
2207 -#define YYERROR goto yyerrorlab
2210 -/* Like YYERROR except do call yyerror. This remains here temporarily
2211 - to ease the transition to the new meaning of YYERROR, for GCC.
2212 - Once GCC version 2 has supplanted version 1, this can go. However,
2213 - YYFAIL appears to be in use. Nevertheless, it is formally deprecated
2214 - in Bison 2.4.2's NEWS entry, where a plan to phase it out is
2217 -#define YYFAIL goto yyerrlab
2219 - /* This is here to suppress warnings from the GCC cpp's
2220 - -Wunused-macros. Normally we don't worry about that warning, but
2221 - some users do, and we want to make it easy for users to remove
2222 - YYFAIL uses, which will produce warnings from Bison 2.5. */
2225 +#define yyerrok (yyerrstatus = 0)
2226 +#define yyclearin (yychar = YYEMPTY)
2227 +#define YYEMPTY (-2)
2230 +#define YYACCEPT goto yyacceptlab
2231 +#define YYABORT goto yyabortlab
2232 +#define YYERROR goto yyerrorlab
2235 #define YYRECOVERING() (!!yyerrstatus)
2237 @@ -768,27 +725,41 @@ do
2240 yyerror (YY_("syntax error: cannot back up")); \
2248 /* Error token number */
2250 -#define YYERRCODE 256
2252 +#define YYERRCODE 256
2255 -/* This macro is provided for backward compatibility. */
2256 -#ifndef YY_LOCATION_PRINT
2257 -# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2258 +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2259 + If N is 0, then set CURRENT to the empty location which ends
2260 + the previous symbol: RHS[0] (always defined). */
2262 +#ifndef YYLLOC_DEFAULT
2263 +# define YYLLOC_DEFAULT(Current, Rhs, N) \
2267 + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2268 + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2269 + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2270 + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2274 + (Current).first_line = (Current).last_line = \
2275 + YYRHSLOC (Rhs, 0).last_line; \
2276 + (Current).first_column = (Current).last_column = \
2277 + YYRHSLOC (Rhs, 0).last_column; \
2282 +#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2284 -/* YYLEX -- calling `yylex' with the right arguments. */
2286 -# define YYLEX yylex (YYLEX_PARAM)
2288 -# define YYLEX yylex ()
2291 /* Enable debugging if requested. */
2293 @@ -798,50 +769,84 @@ while (YYID (0))
2294 # define YYFPRINTF fprintf
2297 -# define YYDPRINTF(Args) \
2303 -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2307 - YYFPRINTF (stderr, "%s ", Title); \
2308 - yy_symbol_print (stderr, \
2310 - YYFPRINTF (stderr, "\n"); \
2313 +# define YYDPRINTF(Args) \
2320 -/*--------------------------------.
2321 -| Print this symbol on YYOUTPUT. |
2322 -`--------------------------------*/
2323 +/* YY_LOCATION_PRINT -- Print the location on the stream.
2324 + This macro was not mandated originally: define only if we know
2325 + we won't break user code: when these are the locations we know. */
2328 -#if (defined __STDC__ || defined __C99__FUNC__ \
2329 - || defined __cplusplus || defined _MSC_VER)
2331 -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2334 -yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2337 - YYSTYPE const * const yyvaluep;
2338 +#ifndef YY_LOCATION_PRINT
2339 +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2341 +/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
2343 +YY_ATTRIBUTE_UNUSED
2345 +yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
2348 + int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
2349 + if (0 <= yylocp->first_line)
2351 + res += YYFPRINTF (yyo, "%d", yylocp->first_line);
2352 + if (0 <= yylocp->first_column)
2353 + res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
2355 + if (0 <= yylocp->last_line)
2357 + if (yylocp->first_line < yylocp->last_line)
2359 + res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
2361 + res += YYFPRINTF (yyo, ".%d", end_col);
2363 + else if (0 <= end_col && yylocp->first_column < end_col)
2364 + res += YYFPRINTF (yyo, "-%d", end_col);
2369 +# define YY_LOCATION_PRINT(File, Loc) \
2370 + yy_location_print_ (File, &(Loc))
2373 +# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2378 +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2382 + YYFPRINTF (stderr, "%s ", Title); \
2383 + yy_symbol_print (stderr, \
2384 + Type, Value, Location); \
2385 + YYFPRINTF (stderr, "\n"); \
2390 +/*----------------------------------------.
2391 +| Print this symbol's value on YYOUTPUT. |
2392 +`----------------------------------------*/
2395 +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
2397 FILE *yyo = yyoutput;
2399 + YYUSE (yylocationp);
2403 if (yytype < YYNTOKENS)
2404 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2410 @@ -851,24 +856,15 @@ yy_symbol_value_print (yyoutput, yytype,
2411 | Print this symbol on YYOUTPUT. |
2412 `--------------------------------*/
2414 -#if (defined __STDC__ || defined __C99__FUNC__ \
2415 - || defined __cplusplus || defined _MSC_VER)
2417 -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2420 -yy_symbol_print (yyoutput, yytype, yyvaluep)
2423 - YYSTYPE const * const yyvaluep;
2425 +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
2427 - if (yytype < YYNTOKENS)
2428 - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2430 - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2431 + YYFPRINTF (yyoutput, "%s %s (",
2432 + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
2434 - yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2435 + YY_LOCATION_PRINT (yyoutput, *yylocationp);
2436 + YYFPRINTF (yyoutput, ": ");
2437 + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
2438 YYFPRINTF (yyoutput, ")");
2441 @@ -877,16 +873,8 @@ yy_symbol_print (yyoutput, yytype, yyval
2443 `------------------------------------------------------------------*/
2445 -#if (defined __STDC__ || defined __C99__FUNC__ \
2446 - || defined __cplusplus || defined _MSC_VER)
2448 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
2451 -yy_stack_print (yybottom, yytop)
2452 - yytype_int16 *yybottom;
2453 - yytype_int16 *yytop;
2456 YYFPRINTF (stderr, "Stack now");
2457 for (; yybottom <= yytop; yybottom++)
2458 @@ -897,49 +885,42 @@ yy_stack_print (yybottom, yytop)
2459 YYFPRINTF (stderr, "\n");
2462 -# define YY_STACK_PRINT(Bottom, Top) \
2465 - yy_stack_print ((Bottom), (Top)); \
2467 +# define YY_STACK_PRINT(Bottom, Top) \
2470 + yy_stack_print ((Bottom), (Top)); \
2474 /*------------------------------------------------.
2475 | Report that the YYRULE is going to be reduced. |
2476 `------------------------------------------------*/
2478 -#if (defined __STDC__ || defined __C99__FUNC__ \
2479 - || defined __cplusplus || defined _MSC_VER)
2481 -yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2484 -yy_reduce_print (yyvsp, yyrule)
2488 +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
2490 + unsigned long int yylno = yyrline[yyrule];
2491 int yynrhs = yyr2[yyrule];
2493 - unsigned long int yylno = yyrline[yyrule];
2494 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2495 - yyrule - 1, yylno);
2496 + yyrule - 1, yylno);
2497 /* The symbols being reduced. */
2498 for (yyi = 0; yyi < yynrhs; yyi++)
2500 YYFPRINTF (stderr, " $%d = ", yyi + 1);
2501 - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2502 - &(yyvsp[(yyi + 1) - (yynrhs)])
2504 + yy_symbol_print (stderr,
2505 + yystos[yyssp[yyi + 1 - yynrhs]],
2506 + &(yyvsp[(yyi + 1) - (yynrhs)])
2507 + , &(yylsp[(yyi + 1) - (yynrhs)]) );
2508 YYFPRINTF (stderr, "\n");
2512 -# define YY_REDUCE_PRINT(Rule) \
2515 - yy_reduce_print (yyvsp, Rule); \
2517 +# define YY_REDUCE_PRINT(Rule) \
2520 + yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
2523 /* Nonzero means print parse trace. It is left uninitialized so that
2524 multiple parsers can coexist. */
2525 @@ -953,7 +934,7 @@ int yydebug;
2528 /* YYINITDEPTH -- initial size of the parser's stacks. */
2529 -#ifndef YYINITDEPTH
2530 +#ifndef YYINITDEPTH
2531 # define YYINITDEPTH 200
2534 @@ -976,15 +957,8 @@ int yydebug;
2535 # define yystrlen strlen
2537 /* Return the length of YYSTR. */
2538 -#if (defined __STDC__ || defined __C99__FUNC__ \
2539 - || defined __cplusplus || defined _MSC_VER)
2541 yystrlen (const char *yystr)
2545 - const char *yystr;
2549 for (yylen = 0; yystr[yylen]; yylen++)
2550 @@ -1000,16 +974,8 @@ yystrlen (yystr)
2552 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2554 -#if (defined __STDC__ || defined __C99__FUNC__ \
2555 - || defined __cplusplus || defined _MSC_VER)
2557 yystpcpy (char *yydest, const char *yysrc)
2560 -yystpcpy (yydest, yysrc)
2562 - const char *yysrc;
2566 const char *yys = yysrc;
2567 @@ -1039,27 +1005,27 @@ yytnamerr (char *yyres, const char *yyst
2568 char const *yyp = yystr;
2575 - goto do_not_strip_quotes;
2578 - if (*++yyp != '\\')
2579 - goto do_not_strip_quotes;
2580 - /* Fall through. */
2583 - yyres[yyn] = *yyp;
2589 - yyres[yyn] = '\0';
2596 + goto do_not_strip_quotes;
2599 + if (*++yyp != '\\')
2600 + goto do_not_strip_quotes;
2601 + /* Fall through. */
2604 + yyres[yyn] = *yyp;
2610 + yyres[yyn] = '\0';
2613 do_not_strip_quotes: ;
2616 @@ -1082,11 +1048,11 @@ static int
2617 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
2618 yytype_int16 *yyssp, int yytoken)
2620 - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
2621 + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
2622 YYSIZE_T yysize = yysize0;
2623 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
2624 /* Internationalized format string. */
2625 - const char *yyformat = YY_NULL;
2626 + const char *yyformat = YY_NULLPTR;
2627 /* Arguments of yyformat. */
2628 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
2629 /* Number of reported tokens (one for the "unexpected", one per
2630 @@ -1094,10 +1060,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, c
2633 /* There are many possibilities here to consider:
2634 - - Assume YYFAIL is not used. It's too flawed to consider. See
2635 - <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
2636 - for details. YYERROR is fine as it does not invoke this
2638 - If this state is a consistent state with a default action, then
2639 the only way this function was invoked is if the default action
2640 is an error action. In that case, don't check for expected
2641 @@ -1147,7 +1109,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, c
2643 yyarg[yycount++] = yytname[yyx];
2645 - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
2646 + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
2647 if (! (yysize <= yysize1
2648 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
2650 @@ -1214,26 +1176,18 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, c
2651 | Release the memory associated to this symbol. |
2652 `-----------------------------------------------*/
2655 -#if (defined __STDC__ || defined __C99__FUNC__ \
2656 - || defined __cplusplus || defined _MSC_VER)
2658 -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2661 -yydestruct (yymsg, yytype, yyvaluep)
2662 - const char *yymsg;
2664 - YYSTYPE *yyvaluep;
2666 +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
2670 + YYUSE (yylocationp);
2673 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2675 + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2677 + YY_IGNORE_MAYBE_UNINITIALIZED_END
2681 @@ -1242,18 +1196,14 @@ yydestruct (yymsg, yytype, yyvaluep)
2682 /* The lookahead symbol. */
2686 -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2687 -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2688 -# define YY_IGNORE_MAYBE_UNINITIALIZED_END
2690 -#ifndef YY_INITIAL_VALUE
2691 -# define YY_INITIAL_VALUE(Value) /* Nothing. */
2694 /* The semantic value of the lookahead symbol. */
2695 -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
2698 +/* Location data for the lookahead symbol. */
2700 +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2704 /* Number of syntax errors so far. */
2707 @@ -1262,35 +1212,17 @@ int yynerrs;
2711 -#ifdef YYPARSE_PARAM
2712 -#if (defined __STDC__ || defined __C99__FUNC__ \
2713 - || defined __cplusplus || defined _MSC_VER)
2715 -yyparse (void *YYPARSE_PARAM)
2718 -yyparse (YYPARSE_PARAM)
2719 - void *YYPARSE_PARAM;
2721 -#else /* ! YYPARSE_PARAM */
2722 -#if (defined __STDC__ || defined __C99__FUNC__ \
2723 - || defined __cplusplus || defined _MSC_VER)
2734 /* Number of tokens to shift before error messages enabled. */
2737 /* The stacks and their tools:
2738 - `yyss': related to states.
2739 - `yyvs': related to semantic values.
2740 + 'yyss': related to states.
2741 + 'yyvs': related to semantic values.
2742 + 'yyls': related to locations.
2744 Refer to the stacks through separate pointers, to allow yyoverflow
2745 to reallocate them elsewhere. */
2746 @@ -1305,6 +1237,14 @@ yyparse ()
2750 + /* The location stack. */
2751 + YYLTYPE yylsa[YYINITDEPTH];
2755 + /* The locations where the error started and ended. */
2756 + YYLTYPE yyerror_range[3];
2758 YYSIZE_T yystacksize;
2761 @@ -1314,6 +1254,7 @@ yyparse ()
2762 /* The variables used to return semantic value and location from the
2768 /* Buffer for error messages, and its allocated size. */
2769 @@ -1322,7 +1263,7 @@ yyparse ()
2770 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
2773 -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
2774 +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
2776 /* The number of symbols on the RHS of the reduced rule.
2777 Keep to zero when no symbol should be popped. */
2778 @@ -1330,6 +1271,7 @@ yyparse ()
2780 yyssp = yyss = yyssa;
2781 yyvsp = yyvs = yyvsa;
2782 + yylsp = yyls = yylsa;
2783 yystacksize = YYINITDEPTH;
2785 YYDPRINTF ((stderr, "Starting parse\n"));
2786 @@ -1338,6 +1280,7 @@ yyparse ()
2789 yychar = YYEMPTY; /* Cause a token to be read. */
2790 + yylsp[0] = yylloc;
2793 /*------------------------------------------------------------.
2794 @@ -1358,23 +1301,26 @@ yyparse ()
2798 - /* Give user a chance to reallocate the stack. Use copies of
2799 - these so that the &'s don't force the real ones into
2801 - YYSTYPE *yyvs1 = yyvs;
2802 - yytype_int16 *yyss1 = yyss;
2804 - /* Each stack pointer address is followed by the size of the
2805 - data in use in that stack, in bytes. This used to be a
2806 - conditional around just the two extra args, but that might
2807 - be undefined if yyoverflow is a macro. */
2808 - yyoverflow (YY_("memory exhausted"),
2809 - &yyss1, yysize * sizeof (*yyssp),
2810 - &yyvs1, yysize * sizeof (*yyvsp),
2815 + /* Give user a chance to reallocate the stack. Use copies of
2816 + these so that the &'s don't force the real ones into
2818 + YYSTYPE *yyvs1 = yyvs;
2819 + yytype_int16 *yyss1 = yyss;
2820 + YYLTYPE *yyls1 = yyls;
2822 + /* Each stack pointer address is followed by the size of the
2823 + data in use in that stack, in bytes. This used to be a
2824 + conditional around just the two extra args, but that might
2825 + be undefined if yyoverflow is a macro. */
2826 + yyoverflow (YY_("memory exhausted"),
2827 + &yyss1, yysize * sizeof (*yyssp),
2828 + &yyvs1, yysize * sizeof (*yyvsp),
2829 + &yyls1, yysize * sizeof (*yylsp),
2836 #else /* no yyoverflow */
2837 # ifndef YYSTACK_RELOCATE
2838 @@ -1382,34 +1328,36 @@ yyparse ()
2840 /* Extend the stack our own way. */
2841 if (YYMAXDEPTH <= yystacksize)
2842 - goto yyexhaustedlab;
2843 + goto yyexhaustedlab;
2845 if (YYMAXDEPTH < yystacksize)
2846 - yystacksize = YYMAXDEPTH;
2847 + yystacksize = YYMAXDEPTH;
2850 - yytype_int16 *yyss1 = yyss;
2851 - union yyalloc *yyptr =
2852 - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2854 - goto yyexhaustedlab;
2855 - YYSTACK_RELOCATE (yyss_alloc, yyss);
2856 - YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2857 + yytype_int16 *yyss1 = yyss;
2858 + union yyalloc *yyptr =
2859 + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2861 + goto yyexhaustedlab;
2862 + YYSTACK_RELOCATE (yyss_alloc, yyss);
2863 + YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2864 + YYSTACK_RELOCATE (yyls_alloc, yyls);
2865 # undef YYSTACK_RELOCATE
2866 - if (yyss1 != yyssa)
2867 - YYSTACK_FREE (yyss1);
2868 + if (yyss1 != yyssa)
2869 + YYSTACK_FREE (yyss1);
2872 #endif /* no yyoverflow */
2874 yyssp = yyss + yysize - 1;
2875 yyvsp = yyvs + yysize - 1;
2876 + yylsp = yyls + yysize - 1;
2878 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2879 - (unsigned long int) yystacksize));
2880 + (unsigned long int) yystacksize));
2882 if (yyss + yystacksize - 1 <= yyssp)
2887 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2888 @@ -1438,7 +1386,7 @@ yybackup:
2889 if (yychar == YYEMPTY)
2891 YYDPRINTF ((stderr, "Reading a token: "));
2893 + yychar = yylex ();
2896 if (yychar <= YYEOF)
2897 @@ -1481,7 +1429,7 @@ yybackup:
2898 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2900 YY_IGNORE_MAYBE_UNINITIALIZED_END
2902 + *++yylsp = yylloc;
2906 @@ -1503,7 +1451,7 @@ yyreduce:
2909 /* If YYLEN is nonzero, implement the default value of the action:
2913 Otherwise, the following line sets YYVAL to garbage.
2914 This behavior is undocumented and Bison
2915 @@ -1512,287 +1460,306 @@ yyreduce:
2916 GCC warning that YYVAL may be used uninitialized. */
2917 yyval = yyvsp[1-yylen];
2920 + /* Default location. */
2921 + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
2922 YY_REDUCE_PRINT (yyn);
2926 -/* Line 1787 of yacc.c */
2927 -#line 110 "dtc-parser.y"
2928 +#line 109 "dtc-parser.y" /* yacc.c:1646 */
2930 - the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node),
2931 - guess_boot_cpuid((yyvsp[(4) - (4)].node)));
2932 + (yyvsp[0].node)->is_plugin = (yyvsp[-2].is_plugin);
2933 + (yyvsp[0].node)->is_root = 1;
2934 + the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node),
2935 + guess_boot_cpuid((yyvsp[0].node)));
2937 +#line 1477 "dtc-parser.tab.c" /* yacc.c:1646 */
2941 -/* Line 1787 of yacc.c */
2942 -#line 118 "dtc-parser.y"
2943 +#line 119 "dtc-parser.y" /* yacc.c:1646 */
2945 - (yyval.re) = NULL;
2946 + (yyval.is_plugin) = 0;
2948 +#line 1485 "dtc-parser.tab.c" /* yacc.c:1646 */
2952 -/* Line 1787 of yacc.c */
2953 -#line 122 "dtc-parser.y"
2954 +#line 123 "dtc-parser.y" /* yacc.c:1646 */
2956 - (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
2957 + (yyval.is_plugin) = 1;
2959 +#line 1493 "dtc-parser.tab.c" /* yacc.c:1646 */
2963 -/* Line 1787 of yacc.c */
2964 -#line 129 "dtc-parser.y"
2965 +#line 130 "dtc-parser.y" /* yacc.c:1646 */
2967 - (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer));
2968 + (yyval.re) = NULL;
2970 +#line 1501 "dtc-parser.tab.c" /* yacc.c:1646 */
2974 -/* Line 1787 of yacc.c */
2975 -#line 133 "dtc-parser.y"
2976 +#line 134 "dtc-parser.y" /* yacc.c:1646 */
2978 - add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref));
2979 - (yyval.re) = (yyvsp[(2) - (2)].re);
2980 + (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re));
2982 +#line 1509 "dtc-parser.tab.c" /* yacc.c:1646 */
2986 -/* Line 1787 of yacc.c */
2987 -#line 141 "dtc-parser.y"
2988 +#line 141 "dtc-parser.y" /* yacc.c:1646 */
2990 - (yyval.node) = name_node((yyvsp[(2) - (2)].node), "");
2991 + (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer));
2993 +#line 1517 "dtc-parser.tab.c" /* yacc.c:1646 */
2997 -/* Line 1787 of yacc.c */
2998 -#line 145 "dtc-parser.y"
2999 +#line 145 "dtc-parser.y" /* yacc.c:1646 */
3001 - (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
3002 + add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref));
3003 + (yyval.re) = (yyvsp[0].re);
3005 +#line 1526 "dtc-parser.tab.c" /* yacc.c:1646 */
3009 -/* Line 1787 of yacc.c */
3010 -#line 149 "dtc-parser.y"
3011 +#line 153 "dtc-parser.y" /* yacc.c:1646 */
3013 - struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref));
3016 - merge_nodes(target, (yyvsp[(3) - (3)].node));
3018 - print_error("label or path, '%s', not found", (yyvsp[(2) - (3)].labelref));
3019 - (yyval.node) = (yyvsp[(1) - (3)].node);
3020 + (yyval.node) = name_node((yyvsp[0].node), "");
3022 +#line 1534 "dtc-parser.tab.c" /* yacc.c:1646 */
3026 -/* Line 1787 of yacc.c */
3027 -#line 159 "dtc-parser.y"
3028 +#line 157 "dtc-parser.y" /* yacc.c:1646 */
3030 - struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref));
3033 - print_error("label or path, '%s', not found", (yyvsp[(3) - (4)].labelref));
3035 - delete_node(target);
3037 - (yyval.node) = (yyvsp[(1) - (4)].node);
3038 + (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node));
3040 +#line 1542 "dtc-parser.tab.c" /* yacc.c:1646 */
3044 -/* Line 1787 of yacc.c */
3045 -#line 173 "dtc-parser.y"
3046 +#line 161 "dtc-parser.y" /* yacc.c:1646 */
3048 - (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist));
3049 + struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref));
3052 + merge_nodes(target, (yyvsp[0].node));
3054 + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
3055 + (yyval.node) = (yyvsp[-2].node);
3057 +#line 1556 "dtc-parser.tab.c" /* yacc.c:1646 */
3061 -/* Line 1787 of yacc.c */
3062 -#line 180 "dtc-parser.y"
3063 +#line 171 "dtc-parser.y" /* yacc.c:1646 */
3065 - (yyval.proplist) = NULL;
3066 + struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref));
3069 + delete_node(target);
3071 + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
3074 + (yyval.node) = (yyvsp[-3].node);
3076 +#line 1572 "dtc-parser.tab.c" /* yacc.c:1646 */
3080 -/* Line 1787 of yacc.c */
3081 -#line 184 "dtc-parser.y"
3082 +#line 186 "dtc-parser.y" /* yacc.c:1646 */
3084 - (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist));
3085 + (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist));
3087 +#line 1580 "dtc-parser.tab.c" /* yacc.c:1646 */
3091 -/* Line 1787 of yacc.c */
3092 -#line 191 "dtc-parser.y"
3093 +#line 193 "dtc-parser.y" /* yacc.c:1646 */
3095 - (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data));
3096 + (yyval.proplist) = NULL;
3098 +#line 1588 "dtc-parser.tab.c" /* yacc.c:1646 */
3102 -/* Line 1787 of yacc.c */
3103 -#line 195 "dtc-parser.y"
3104 +#line 197 "dtc-parser.y" /* yacc.c:1646 */
3106 - (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data);
3107 + (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist));
3109 +#line 1596 "dtc-parser.tab.c" /* yacc.c:1646 */
3113 -/* Line 1787 of yacc.c */
3114 -#line 199 "dtc-parser.y"
3115 +#line 204 "dtc-parser.y" /* yacc.c:1646 */
3117 - (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename));
3118 + (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data));
3120 +#line 1604 "dtc-parser.tab.c" /* yacc.c:1646 */
3124 -/* Line 1787 of yacc.c */
3125 -#line 203 "dtc-parser.y"
3126 +#line 208 "dtc-parser.y" /* yacc.c:1646 */
3128 - add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref));
3129 - (yyval.prop) = (yyvsp[(2) - (2)].prop);
3130 + (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data);
3132 +#line 1612 "dtc-parser.tab.c" /* yacc.c:1646 */
3136 -/* Line 1787 of yacc.c */
3137 -#line 211 "dtc-parser.y"
3138 +#line 212 "dtc-parser.y" /* yacc.c:1646 */
3140 - (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data));
3141 + (yyval.prop) = build_property_delete((yyvsp[-1].propnodename));
3143 +#line 1620 "dtc-parser.tab.c" /* yacc.c:1646 */
3147 -/* Line 1787 of yacc.c */
3148 -#line 215 "dtc-parser.y"
3149 +#line 216 "dtc-parser.y" /* yacc.c:1646 */
3151 - (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data);
3152 + add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref));
3153 + (yyval.prop) = (yyvsp[0].prop);
3155 +#line 1629 "dtc-parser.tab.c" /* yacc.c:1646 */
3159 -/* Line 1787 of yacc.c */
3160 -#line 219 "dtc-parser.y"
3161 +#line 224 "dtc-parser.y" /* yacc.c:1646 */
3163 - (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
3164 + (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data));
3166 +#line 1637 "dtc-parser.tab.c" /* yacc.c:1646 */
3170 -/* Line 1787 of yacc.c */
3171 -#line 223 "dtc-parser.y"
3172 +#line 228 "dtc-parser.y" /* yacc.c:1646 */
3174 - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref));
3175 + (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data);
3177 +#line 1645 "dtc-parser.tab.c" /* yacc.c:1646 */
3181 -/* Line 1787 of yacc.c */
3182 -#line 227 "dtc-parser.y"
3183 +#line 232 "dtc-parser.y" /* yacc.c:1646 */
3185 - FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL);
3186 + (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data));
3188 +#line 1653 "dtc-parser.tab.c" /* yacc.c:1646 */
3192 +#line 236 "dtc-parser.y" /* yacc.c:1646 */
3194 + (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref));
3196 +#line 1661 "dtc-parser.tab.c" /* yacc.c:1646 */
3200 +#line 240 "dtc-parser.y" /* yacc.c:1646 */
3202 + FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL);
3205 - if ((yyvsp[(6) - (9)].integer) != 0)
3206 - if (fseek(f, (yyvsp[(6) - (9)].integer), SEEK_SET) != 0)
3207 - print_error("Couldn't seek to offset %llu in \"%s\": %s",
3208 - (unsigned long long)(yyvsp[(6) - (9)].integer),
3209 - (yyvsp[(4) - (9)].data).val,
3211 + if ((yyvsp[-3].integer) != 0)
3212 + if (fseek(f, (yyvsp[-3].integer), SEEK_SET) != 0)
3213 + die("Couldn't seek to offset %llu in \"%s\": %s",
3214 + (unsigned long long)(yyvsp[-3].integer), (yyvsp[-5].data).val,
3217 - d = data_copy_file(f, (yyvsp[(8) - (9)].integer));
3218 + d = data_copy_file(f, (yyvsp[-1].integer));
3220 - (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d);
3221 + (yyval.data) = data_merge((yyvsp[-8].data), d);
3224 +#line 1681 "dtc-parser.tab.c" /* yacc.c:1646 */
3228 -/* Line 1787 of yacc.c */
3229 -#line 244 "dtc-parser.y"
3231 +#line 256 "dtc-parser.y" /* yacc.c:1646 */
3233 - FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL);
3234 + FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL);
3235 struct data d = empty_data;
3237 d = data_copy_file(f, -1);
3239 - (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d);
3240 + (yyval.data) = data_merge((yyvsp[-4].data), d);
3243 +#line 1695 "dtc-parser.tab.c" /* yacc.c:1646 */
3247 -/* Line 1787 of yacc.c */
3248 -#line 254 "dtc-parser.y"
3250 +#line 266 "dtc-parser.y" /* yacc.c:1646 */
3252 - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
3253 + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
3255 +#line 1703 "dtc-parser.tab.c" /* yacc.c:1646 */
3259 -/* Line 1787 of yacc.c */
3260 -#line 261 "dtc-parser.y"
3262 +#line 273 "dtc-parser.y" /* yacc.c:1646 */
3264 (yyval.data) = empty_data;
3266 +#line 1711 "dtc-parser.tab.c" /* yacc.c:1646 */
3270 -/* Line 1787 of yacc.c */
3271 -#line 265 "dtc-parser.y"
3273 +#line 277 "dtc-parser.y" /* yacc.c:1646 */
3275 - (yyval.data) = (yyvsp[(1) - (2)].data);
3276 + (yyval.data) = (yyvsp[-1].data);
3278 +#line 1719 "dtc-parser.tab.c" /* yacc.c:1646 */
3282 -/* Line 1787 of yacc.c */
3283 -#line 269 "dtc-parser.y"
3285 +#line 281 "dtc-parser.y" /* yacc.c:1646 */
3287 - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
3288 + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
3290 +#line 1727 "dtc-parser.tab.c" /* yacc.c:1646 */
3294 -/* Line 1787 of yacc.c */
3295 -#line 276 "dtc-parser.y"
3297 +#line 288 "dtc-parser.y" /* yacc.c:1646 */
3299 - (yyval.array).data = empty_data;
3300 - (yyval.array).bits = eval_literal((yyvsp[(2) - (3)].literal), 0, 7);
3301 + unsigned long long bits;
3303 - if (((yyval.array).bits != 8) &&
3304 - ((yyval.array).bits != 16) &&
3305 - ((yyval.array).bits != 32) &&
3306 - ((yyval.array).bits != 64))
3308 - print_error("Only 8, 16, 32 and 64-bit elements"
3309 - " are currently supported");
3310 - (yyval.array).bits = 32;
3311 + bits = (yyvsp[-1].integer);
3313 + if ((bits != 8) && (bits != 16) &&
3314 + (bits != 32) && (bits != 64)) {
3315 + ERROR(&(yylsp[-1]), "Array elements must be"
3316 + " 8, 16, 32 or 64-bits");
3320 + (yyval.array).data = empty_data;
3321 + (yyval.array).bits = bits;
3323 +#line 1747 "dtc-parser.tab.c" /* yacc.c:1646 */
3327 -/* Line 1787 of yacc.c */
3328 -#line 291 "dtc-parser.y"
3330 +#line 304 "dtc-parser.y" /* yacc.c:1646 */
3332 (yyval.array).data = empty_data;
3333 (yyval.array).bits = 32;
3335 +#line 1756 "dtc-parser.tab.c" /* yacc.c:1646 */
3339 -/* Line 1787 of yacc.c */
3340 -#line 296 "dtc-parser.y"
3342 +#line 309 "dtc-parser.y" /* yacc.c:1646 */
3344 - if ((yyvsp[(1) - (2)].array).bits < 64) {
3345 - uint64_t mask = (1ULL << (yyvsp[(1) - (2)].array).bits) - 1;
3346 + if ((yyvsp[-1].array).bits < 64) {
3347 + uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1;
3349 * Bits above mask must either be all zero
3350 * (positive within range of mask) or all one
3351 @@ -1801,275 +1768,258 @@ yyreduce:
3352 * within the mask to one (i.e. | in the
3353 * mask), all bits are one.
3355 - if (((yyvsp[(2) - (2)].integer) > mask) && (((yyvsp[(2) - (2)].integer) | mask) != -1ULL))
3357 - "integer value out of range "
3358 - "%016lx (%d bits)", (yyvsp[(1) - (2)].array).bits);
3359 + if (((yyvsp[0].integer) > mask) && (((yyvsp[0].integer) | mask) != -1ULL))
3360 + ERROR(&(yylsp[0]), "Value out of range for"
3361 + " %d-bit array element", (yyvsp[-1].array).bits);
3364 - (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits);
3365 + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits);
3367 +#line 1779 "dtc-parser.tab.c" /* yacc.c:1646 */
3371 -/* Line 1787 of yacc.c */
3372 -#line 316 "dtc-parser.y"
3374 +#line 328 "dtc-parser.y" /* yacc.c:1646 */
3376 - uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits);
3377 + uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits);
3379 - if ((yyvsp[(1) - (2)].array).bits == 32)
3380 - (yyvsp[(1) - (2)].array).data = data_add_marker((yyvsp[(1) - (2)].array).data,
3381 + if ((yyvsp[-1].array).bits == 32)
3382 + (yyvsp[-1].array).data = data_add_marker((yyvsp[-1].array).data,
3384 - (yyvsp[(2) - (2)].labelref));
3385 + (yyvsp[0].labelref));
3387 - print_error("References are only allowed in "
3388 + ERROR(&(yylsp[0]), "References are only allowed in "
3389 "arrays with 32-bit elements.");
3391 - (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits);
3396 -/* Line 1787 of yacc.c */
3397 -#line 330 "dtc-parser.y"
3399 - (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref));
3404 -/* Line 1787 of yacc.c */
3405 -#line 337 "dtc-parser.y"
3407 - (yyval.integer) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64);
3408 + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits);
3410 +#line 1797 "dtc-parser.tab.c" /* yacc.c:1646 */
3414 -/* Line 1787 of yacc.c */
3415 -#line 341 "dtc-parser.y"
3416 +#line 342 "dtc-parser.y" /* yacc.c:1646 */
3418 - (yyval.integer) = eval_char_literal((yyvsp[(1) - (1)].literal));
3419 + (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref));
3421 +#line 1805 "dtc-parser.tab.c" /* yacc.c:1646 */
3425 -/* Line 1787 of yacc.c */
3426 -#line 345 "dtc-parser.y"
3428 +#line 351 "dtc-parser.y" /* yacc.c:1646 */
3430 - (yyval.integer) = (yyvsp[(2) - (3)].integer);
3431 + (yyval.integer) = (yyvsp[-1].integer);
3436 -/* Line 1787 of yacc.c */
3437 -#line 356 "dtc-parser.y"
3438 - { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); }
3439 +#line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */
3443 -/* Line 1787 of yacc.c */
3444 -#line 361 "dtc-parser.y"
3445 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); }
3446 +#line 362 "dtc-parser.y" /* yacc.c:1646 */
3447 + { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); }
3448 +#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */
3452 -/* Line 1787 of yacc.c */
3453 -#line 366 "dtc-parser.y"
3454 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); }
3455 +#line 367 "dtc-parser.y" /* yacc.c:1646 */
3456 + { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); }
3457 +#line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */
3461 -/* Line 1787 of yacc.c */
3462 -#line 371 "dtc-parser.y"
3463 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); }
3464 +#line 372 "dtc-parser.y" /* yacc.c:1646 */
3465 + { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); }
3466 +#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */
3470 -/* Line 1787 of yacc.c */
3471 -#line 376 "dtc-parser.y"
3472 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); }
3473 +#line 377 "dtc-parser.y" /* yacc.c:1646 */
3474 + { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); }
3475 +#line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */
3479 -/* Line 1787 of yacc.c */
3480 -#line 381 "dtc-parser.y"
3481 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); }
3482 +#line 382 "dtc-parser.y" /* yacc.c:1646 */
3483 + { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); }
3484 +#line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */
3488 -/* Line 1787 of yacc.c */
3489 -#line 386 "dtc-parser.y"
3490 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); }
3491 +#line 387 "dtc-parser.y" /* yacc.c:1646 */
3492 + { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); }
3493 +#line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */
3497 -/* Line 1787 of yacc.c */
3498 -#line 387 "dtc-parser.y"
3499 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); }
3501 +#line 392 "dtc-parser.y" /* yacc.c:1646 */
3502 + { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); }
3503 +#line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */
3507 -/* Line 1787 of yacc.c */
3508 -#line 392 "dtc-parser.y"
3509 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); }
3513 -/* Line 1787 of yacc.c */
3514 -#line 393 "dtc-parser.y"
3515 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); }
3516 +#line 393 "dtc-parser.y" /* yacc.c:1646 */
3517 + { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); }
3518 +#line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */
3522 -/* Line 1787 of yacc.c */
3523 -#line 394 "dtc-parser.y"
3524 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); }
3525 +#line 398 "dtc-parser.y" /* yacc.c:1646 */
3526 + { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); }
3527 +#line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */
3531 -/* Line 1787 of yacc.c */
3532 -#line 395 "dtc-parser.y"
3533 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); }
3534 +#line 399 "dtc-parser.y" /* yacc.c:1646 */
3535 + { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); }
3536 +#line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */
3540 -/* Line 1787 of yacc.c */
3541 -#line 399 "dtc-parser.y"
3542 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); }
3543 +#line 400 "dtc-parser.y" /* yacc.c:1646 */
3544 + { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); }
3545 +#line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */
3549 -/* Line 1787 of yacc.c */
3550 -#line 400 "dtc-parser.y"
3551 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); }
3552 +#line 401 "dtc-parser.y" /* yacc.c:1646 */
3553 + { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); }
3554 +#line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */
3558 -/* Line 1787 of yacc.c */
3559 -#line 405 "dtc-parser.y"
3560 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); }
3562 +#line 405 "dtc-parser.y" /* yacc.c:1646 */
3563 + { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); }
3564 +#line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */
3568 -/* Line 1787 of yacc.c */
3569 -#line 406 "dtc-parser.y"
3570 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); }
3572 +#line 406 "dtc-parser.y" /* yacc.c:1646 */
3573 + { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); }
3574 +#line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */
3578 -/* Line 1787 of yacc.c */
3579 -#line 411 "dtc-parser.y"
3580 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); }
3582 +#line 411 "dtc-parser.y" /* yacc.c:1646 */
3583 + { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); }
3584 +#line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */
3588 -/* Line 1787 of yacc.c */
3589 -#line 412 "dtc-parser.y"
3590 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); }
3592 +#line 412 "dtc-parser.y" /* yacc.c:1646 */
3593 + { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); }
3594 +#line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */
3598 -/* Line 1787 of yacc.c */
3599 -#line 413 "dtc-parser.y"
3600 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); }
3601 +#line 417 "dtc-parser.y" /* yacc.c:1646 */
3602 + { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); }
3603 +#line 1915 "dtc-parser.tab.c" /* yacc.c:1646 */
3607 -/* Line 1787 of yacc.c */
3608 -#line 419 "dtc-parser.y"
3609 - { (yyval.integer) = -(yyvsp[(2) - (2)].integer); }
3611 +#line 418 "dtc-parser.y" /* yacc.c:1646 */
3612 + { (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); }
3613 +#line 1921 "dtc-parser.tab.c" /* yacc.c:1646 */
3617 -/* Line 1787 of yacc.c */
3618 -#line 420 "dtc-parser.y"
3619 - { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); }
3621 +#line 419 "dtc-parser.y" /* yacc.c:1646 */
3622 + { (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); }
3623 +#line 1927 "dtc-parser.tab.c" /* yacc.c:1646 */
3627 -/* Line 1787 of yacc.c */
3628 -#line 421 "dtc-parser.y"
3629 - { (yyval.integer) = !(yyvsp[(2) - (2)].integer); }
3630 +#line 425 "dtc-parser.y" /* yacc.c:1646 */
3631 + { (yyval.integer) = -(yyvsp[0].integer); }
3632 +#line 1933 "dtc-parser.tab.c" /* yacc.c:1646 */
3636 -/* Line 1787 of yacc.c */
3637 -#line 426 "dtc-parser.y"
3639 - (yyval.data) = empty_data;
3641 +#line 426 "dtc-parser.y" /* yacc.c:1646 */
3642 + { (yyval.integer) = ~(yyvsp[0].integer); }
3643 +#line 1939 "dtc-parser.tab.c" /* yacc.c:1646 */
3647 -/* Line 1787 of yacc.c */
3648 -#line 430 "dtc-parser.y"
3650 - (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte));
3652 +#line 427 "dtc-parser.y" /* yacc.c:1646 */
3653 + { (yyval.integer) = !(yyvsp[0].integer); }
3654 +#line 1945 "dtc-parser.tab.c" /* yacc.c:1646 */
3658 -/* Line 1787 of yacc.c */
3659 -#line 434 "dtc-parser.y"
3660 +#line 432 "dtc-parser.y" /* yacc.c:1646 */
3662 - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
3663 + (yyval.data) = empty_data;
3665 +#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */
3669 -/* Line 1787 of yacc.c */
3670 -#line 441 "dtc-parser.y"
3671 +#line 436 "dtc-parser.y" /* yacc.c:1646 */
3673 - (yyval.nodelist) = NULL;
3674 + (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte));
3676 +#line 1961 "dtc-parser.tab.c" /* yacc.c:1646 */
3680 -/* Line 1787 of yacc.c */
3681 -#line 445 "dtc-parser.y"
3682 +#line 440 "dtc-parser.y" /* yacc.c:1646 */
3684 - (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist));
3685 + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
3687 +#line 1969 "dtc-parser.tab.c" /* yacc.c:1646 */
3691 -/* Line 1787 of yacc.c */
3692 -#line 449 "dtc-parser.y"
3693 +#line 447 "dtc-parser.y" /* yacc.c:1646 */
3695 - print_error("syntax error: properties must precede subnodes");
3697 + (yyval.nodelist) = NULL;
3699 +#line 1977 "dtc-parser.tab.c" /* yacc.c:1646 */
3703 -/* Line 1787 of yacc.c */
3704 -#line 457 "dtc-parser.y"
3705 +#line 451 "dtc-parser.y" /* yacc.c:1646 */
3707 - (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename));
3708 + (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist));
3710 +#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */
3714 -/* Line 1787 of yacc.c */
3715 -#line 461 "dtc-parser.y"
3716 +#line 455 "dtc-parser.y" /* yacc.c:1646 */
3718 - (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename));
3719 + ERROR(&(yylsp[0]), "Properties must precede subnodes");
3722 +#line 1994 "dtc-parser.tab.c" /* yacc.c:1646 */
3726 -/* Line 1787 of yacc.c */
3727 -#line 465 "dtc-parser.y"
3728 +#line 463 "dtc-parser.y" /* yacc.c:1646 */
3730 - add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref));
3731 - (yyval.node) = (yyvsp[(2) - (2)].node);
3732 + (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename));
3734 +#line 2002 "dtc-parser.tab.c" /* yacc.c:1646 */
3738 +#line 467 "dtc-parser.y" /* yacc.c:1646 */
3740 + (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename));
3742 +#line 2010 "dtc-parser.tab.c" /* yacc.c:1646 */
3746 +#line 471 "dtc-parser.y" /* yacc.c:1646 */
3748 + add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref));
3749 + (yyval.node) = (yyvsp[0].node);
3751 +#line 2019 "dtc-parser.tab.c" /* yacc.c:1646 */
3754 -/* Line 1787 of yacc.c */
3755 -#line 2073 "dtc-parser.tab.c"
3757 +#line 2023 "dtc-parser.tab.c" /* yacc.c:1646 */
3760 /* User semantic actions sometimes alter yychar, and that requires
3761 @@ -2090,8 +2040,9 @@ yyreduce:
3762 YY_STACK_PRINT (yyss, yyssp);
3767 - /* Now `shift' the result of the reduction. Determine what state
3768 + /* Now 'shift' the result of the reduction. Determine what state
3769 that goes to, based on the state we popped back to and the rule
3770 number reduced by. */
3772 @@ -2106,9 +2057,9 @@ yyreduce:
3776 -/*------------------------------------.
3777 -| yyerrlab -- here on detecting error |
3778 -`------------------------------------*/
3779 +/*--------------------------------------.
3780 +| yyerrlab -- here on detecting error. |
3781 +`--------------------------------------*/
3783 /* Make sure we have latest lookahead translation. See comments at
3784 user semantic actions for why this is necessary. */
3785 @@ -2154,25 +2105,25 @@ yyerrlab:
3790 + yyerror_range[1] = yylloc;
3792 if (yyerrstatus == 3)
3794 /* If just tried and failed to reuse lookahead token after an
3795 - error, discard it. */
3796 + error, discard it. */
3798 if (yychar <= YYEOF)
3800 - /* Return failure if at end of input. */
3801 - if (yychar == YYEOF)
3805 + /* Return failure if at end of input. */
3806 + if (yychar == YYEOF)
3811 - yydestruct ("Error: discarding",
3812 - yytoken, &yylval);
3816 + yydestruct ("Error: discarding",
3817 + yytoken, &yylval, &yylloc);
3822 /* Else will try to reuse lookahead token after shifting the error
3823 @@ -2191,7 +2142,8 @@ yyerrorlab:
3824 if (/*CONSTCOND*/ 0)
3827 - /* Do not reclaim the symbols of the rule which action triggered
3828 + yyerror_range[1] = yylsp[1-yylen];
3829 + /* Do not reclaim the symbols of the rule whose action triggered
3833 @@ -2204,29 +2156,29 @@ yyerrorlab:
3834 | yyerrlab1 -- common code for both syntax error and YYERROR. |
3835 `-------------------------------------------------------------*/
3837 - yyerrstatus = 3; /* Each real token shifted decrements this. */
3838 + yyerrstatus = 3; /* Each real token shifted decrements this. */
3842 yyn = yypact[yystate];
3843 if (!yypact_value_is_default (yyn))
3846 - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3848 - yyn = yytable[yyn];
3855 + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3857 + yyn = yytable[yyn];
3863 /* Pop the current state because it cannot handle the error token. */
3869 + yyerror_range[1] = *yylsp;
3870 yydestruct ("Error: popping",
3871 - yystos[yystate], yyvsp);
3872 + yystos[yystate], yyvsp, yylsp);
3875 YY_STACK_PRINT (yyss, yyssp);
3876 @@ -2236,6 +2188,11 @@ yyerrlab1:
3878 YY_IGNORE_MAYBE_UNINITIALIZED_END
3880 + yyerror_range[2] = yylloc;
3881 + /* Using YYLLOC is tempting, but would change the location of
3882 + the lookahead. YYLOC is available though. */
3883 + YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
3886 /* Shift the error token. */
3887 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
3888 @@ -2275,16 +2232,16 @@ yyreturn:
3889 user semantic actions for why this is necessary. */
3890 yytoken = YYTRANSLATE (yychar);
3891 yydestruct ("Cleanup: discarding lookahead",
3892 - yytoken, &yylval);
3893 + yytoken, &yylval, &yylloc);
3895 - /* Do not reclaim the symbols of the rule which action triggered
3896 + /* Do not reclaim the symbols of the rule whose action triggered
3897 this YYABORT or YYACCEPT. */
3899 YY_STACK_PRINT (yyss, yyssp);
3900 while (yyssp != yyss)
3902 yydestruct ("Cleanup: popping",
3903 - yystos[*yyssp], yyvsp);
3904 + yystos[*yyssp], yyvsp, yylsp);
3908 @@ -2295,72 +2252,12 @@ yyreturn:
3909 if (yymsg != yymsgbuf)
3910 YYSTACK_FREE (yymsg);
3912 - /* Make sure YYID is used. */
3913 - return YYID (yyresult);
3916 +#line 477 "dtc-parser.y" /* yacc.c:1906 */
3919 -/* Line 2050 of yacc.c */
3920 -#line 471 "dtc-parser.y"
3923 -void print_error(char const *fmt, ...)
3924 +void yyerror(char const *s)
3928 - va_start(va, fmt);
3929 - srcpos_verror(&yylloc, fmt, va);
3932 - treesource_error = 1;
3935 -void yyerror(char const *s) {
3936 - print_error("%s", s);
3939 -static unsigned long long eval_literal(const char *s, int base, int bits)
3941 - unsigned long long val;
3945 - val = strtoull(s, &e, base);
3947 - size_t uls = strspn(e, "UL");
3949 - print_error("bad characters in literal");
3951 - if ((errno == ERANGE)
3952 - || ((bits < 64) && (val >= (1ULL << bits))))
3953 - print_error("literal out of range");
3954 - else if (errno != 0)
3955 - print_error("bad literal");
3959 -static unsigned char eval_char_literal(const char *s)
3966 - print_error("empty character literal");
3971 - * If the first character in the character literal is a \ then process
3972 - * the remaining characters as an escape encoding. If the first
3973 - * character is neither an escape or a terminator it should be the only
3974 - * character in the literal and will be returned.
3977 - c = get_escape_char(s, &i);
3980 - print_error("malformed character literal");
3983 + ERROR(&yylloc, "%s", s);
3985 --- a/scripts/dtc/dtc-parser.tab.h_shipped
3986 +++ b/scripts/dtc/dtc-parser.tab.h_shipped
3988 -/* A Bison parser, made by GNU Bison 2.7.12-4996. */
3989 +/* A Bison parser, made by GNU Bison 3.0.2. */
3991 /* Bison interface for Yacc-like parsers in C
3993 - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
3996 + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
3998 This program is free software: you can redistribute it and/or modify
3999 it under the terms of the GNU General Public License as published by
4000 the Free Software Foundation, either version 3 of the License, or
4001 (at your option) any later version.
4004 This program is distributed in the hope that it will be useful,
4005 but WITHOUT ANY WARRANTY; without even the implied warranty of
4006 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4007 GNU General Public License for more details.
4010 You should have received a copy of the GNU General Public License
4011 along with this program. If not, see <http://www.gnu.org/licenses/>. */
4014 special exception, which will cause the skeleton and the resulting
4015 Bison output files to be licensed under the GNU General Public
4016 License without this special exception.
4019 This special exception was added by the Free Software Foundation in
4020 version 2.2 of Bison. */
4022 #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED
4023 # define YY_YY_DTC_PARSER_TAB_H_INCLUDED
4024 -/* Enabling traces. */
4025 +/* Debug traces. */
4036 # define YYTOKENTYPE
4037 - /* Put the tokens into the symbol table, so that GDB and other debuggers
4038 - know about them. */
4039 - enum yytokentype {
4041 - DT_MEMRESERVE = 259,
4051 - DT_DEL_PROP = 269,
4052 - DT_DEL_NODE = 270,
4053 - DT_PROPNODENAME = 271,
4055 - DT_CHAR_LITERAL = 273,
4067 + DT_MEMRESERVE = 260,
4077 + DT_DEL_PROP = 270,
4078 + DT_DEL_NODE = 271,
4079 + DT_PROPNODENAME = 272,
4081 + DT_CHAR_LITERAL = 274,
4092 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
4093 -typedef union YYSTYPE
4094 +typedef union YYSTYPE YYSTYPE;
4097 -/* Line 2053 of yacc.c */
4098 -#line 40 "dtc-parser.y"
4099 +#line 39 "dtc-parser.y" /* yacc.c:1909 */
4104 - unsigned int cbase;
4108 @@ -96,30 +93,31 @@ typedef union YYSTYPE
4109 struct node *nodelist;
4110 struct reserve_info *re;
4115 -/* Line 2053 of yacc.c */
4116 -#line 103 "dtc-parser.tab.h"
4118 +#line 99 "dtc-parser.tab.h" /* yacc.c:1909 */
4120 # define YYSTYPE_IS_TRIVIAL 1
4121 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */
4122 # define YYSTYPE_IS_DECLARED 1
4125 -extern YYSTYPE yylval;
4127 -#ifdef YYPARSE_PARAM
4128 -#if defined __STDC__ || defined __cplusplus
4129 -int yyparse (void *YYPARSE_PARAM);
4132 +/* Location type. */
4133 +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
4134 +typedef struct YYLTYPE YYLTYPE;
4142 +# define YYLTYPE_IS_DECLARED 1
4143 +# define YYLTYPE_IS_TRIVIAL 1
4145 -#else /* ! YYPARSE_PARAM */
4146 -#if defined __STDC__ || defined __cplusplus
4149 +extern YYSTYPE yylval;
4150 +extern YYLTYPE yylloc;
4155 -#endif /* ! YYPARSE_PARAM */
4157 #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */
4158 --- a/scripts/dtc/dtc-parser.y
4159 +++ b/scripts/dtc/dtc-parser.y
4161 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
4167 +#include <inttypes.h>
4174 extern int yylex(void);
4175 -extern void print_error(char const *fmt, ...);
4176 extern void yyerror(char const *s);
4177 +#define ERROR(loc, ...) \
4179 + srcpos_error((loc), "Error", __VA_ARGS__); \
4180 + treesource_error = true; \
4183 extern struct boot_info *the_boot_info;
4184 -extern int treesource_error;
4186 -static unsigned long long eval_literal(const char *s, int base, int bits);
4187 -static unsigned char eval_char_literal(const char *s);
4188 +extern bool treesource_error;
4195 - unsigned int cbase;
4199 @@ -56,18 +53,19 @@ static unsigned char eval_char_literal(c
4200 struct node *nodelist;
4201 struct reserve_info *re;
4208 %token DT_MEMRESERVE
4209 %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR
4213 %token <propnodename> DT_PROPNODENAME
4214 -%token <literal> DT_LITERAL
4215 -%token <literal> DT_CHAR_LITERAL
4216 -%token <cbase> DT_BASE
4217 +%token <integer> DT_LITERAL
4218 +%token <integer> DT_CHAR_LITERAL
4219 %token <byte> DT_BYTE
4220 %token <data> DT_STRING
4221 %token <labelref> DT_LABEL
4222 @@ -76,6 +74,7 @@ static unsigned char eval_char_literal(c
4224 %type <data> propdata
4225 %type <data> propdataprefix
4226 +%type <is_plugin> plugindecl
4227 %type <re> memreserve
4228 %type <re> memreserves
4229 %type <array> arrayprefix
4230 @@ -106,10 +105,23 @@ static unsigned char eval_char_literal(c
4234 - DT_V1 ';' memreserves devicetree
4235 + DT_V1 ';' plugindecl memreserves devicetree
4237 + $5->is_plugin = $3;
4239 + the_boot_info = build_boot_info($4, $5,
4240 + guess_boot_cpuid($5));
4251 - the_boot_info = build_boot_info($3, $4,
4252 - guess_boot_cpuid($4));
4257 @@ -152,17 +164,18 @@ devicetree:
4259 merge_nodes(target, $3);
4261 - print_error("label or path, '%s', not found", $2);
4262 + ERROR(&@2, "Label or path %s not found", $2);
4265 | devicetree DT_DEL_NODE DT_REF ';'
4267 struct node *target = get_node_by_ref($1, $3);
4270 - print_error("label or path, '%s', not found", $3);
4273 delete_node(target);
4275 + ERROR(&@3, "Label or path %s not found", $3);
4280 @@ -230,10 +243,9 @@ propdata:
4283 if (fseek(f, $6, SEEK_SET) != 0)
4284 - print_error("Couldn't seek to offset %llu in \"%s\": %s",
4285 - (unsigned long long)$6,
4288 + die("Couldn't seek to offset %llu in \"%s\": %s",
4289 + (unsigned long long)$6, $4.val,
4292 d = data_copy_file(f, $8);
4294 @@ -274,18 +286,19 @@ propdataprefix:
4296 DT_BITS DT_LITERAL '<'
4298 - $$.data = empty_data;
4299 - $$.bits = eval_literal($2, 0, 7);
4300 + unsigned long long bits;
4302 - if (($$.bits != 8) &&
4303 - ($$.bits != 16) &&
4304 - ($$.bits != 32) &&
4307 - print_error("Only 8, 16, 32 and 64-bit elements"
4308 - " are currently supported");
4312 + if ((bits != 8) && (bits != 16) &&
4313 + (bits != 32) && (bits != 64)) {
4314 + ERROR(&@2, "Array elements must be"
4315 + " 8, 16, 32 or 64-bits");
4319 + $$.data = empty_data;
4324 @@ -305,9 +318,8 @@ arrayprefix:
4325 * mask), all bits are one.
4327 if (($2 > mask) && (($2 | mask) != -1ULL))
4329 - "integer value out of range "
4330 - "%016lx (%d bits)", $1.bits);
4331 + ERROR(&@2, "Value out of range for"
4332 + " %d-bit array element", $1.bits);
4335 $$.data = data_append_integer($1.data, $2, $1.bits);
4336 @@ -321,7 +333,7 @@ arrayprefix:
4340 - print_error("References are only allowed in "
4341 + ERROR(&@2, "References are only allowed in "
4342 "arrays with 32-bit elements.");
4344 $$.data = data_append_integer($1.data, val, $1.bits);
4345 @@ -334,13 +346,7 @@ arrayprefix:
4350 - $$ = eval_literal($1, 0, 64);
4354 - $$ = eval_char_literal($1);
4356 | '(' integer_expr ')'
4359 @@ -447,7 +453,7 @@ subnodes:
4363 - print_error("syntax error: properties must precede subnodes");
4364 + ERROR(&@2, "Properties must precede subnodes");
4368 @@ -470,63 +476,7 @@ subnode:
4372 -void print_error(char const *fmt, ...)
4373 +void yyerror(char const *s)
4377 - va_start(va, fmt);
4378 - srcpos_verror(&yylloc, fmt, va);
4381 - treesource_error = 1;
4384 -void yyerror(char const *s) {
4385 - print_error("%s", s);
4388 -static unsigned long long eval_literal(const char *s, int base, int bits)
4390 - unsigned long long val;
4394 - val = strtoull(s, &e, base);
4396 - size_t uls = strspn(e, "UL");
4398 - print_error("bad characters in literal");
4400 - if ((errno == ERANGE)
4401 - || ((bits < 64) && (val >= (1ULL << bits))))
4402 - print_error("literal out of range");
4403 - else if (errno != 0)
4404 - print_error("bad literal");
4408 -static unsigned char eval_char_literal(const char *s)
4415 - print_error("empty character literal");
4420 - * If the first character in the character literal is a \ then process
4421 - * the remaining characters as an escape encoding. If the first
4422 - * character is neither an escape or a terminator it should be the only
4423 - * character in the literal and will be returned.
4426 - c = get_escape_char(s, &i);
4429 - print_error("malformed character literal");
4432 + ERROR(&yylloc, "%s", s);
4434 --- a/scripts/dtc/dtc.c
4435 +++ b/scripts/dtc/dtc.c
4436 @@ -29,6 +29,7 @@ int reservenum; /* Number of memory res
4437 int minsize; /* Minimum blob size */
4438 int padsize; /* Additional padding to blob */
4439 int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */
4440 +int symbol_fixup_support = 0;
4442 static void fill_fullpaths(struct node *tree, const char *prefix)
4444 @@ -48,8 +49,10 @@ static void fill_fullpaths(struct node *
4447 /* Usage related data. */
4448 +#define FDT_VERSION(version) _FDT_VERSION(version)
4449 +#define _FDT_VERSION(version) #version
4450 static const char usage_synopsis[] = "dtc [options] <input file>";
4451 -static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv";
4452 +static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv@";
4453 static struct option const usage_long_opts[] = {
4454 {"quiet", no_argument, NULL, 'q'},
4455 {"in-format", a_argument, NULL, 'I'},
4456 @@ -67,6 +70,7 @@ static struct option const usage_long_op
4457 {"phandle", a_argument, NULL, 'H'},
4458 {"warning", a_argument, NULL, 'W'},
4459 {"error", a_argument, NULL, 'E'},
4460 + {"symbols", a_argument, NULL, '@'},
4461 {"help", no_argument, NULL, 'h'},
4462 {"version", no_argument, NULL, 'v'},
4463 {NULL, no_argument, NULL, 0x0},
4464 @@ -82,9 +86,9 @@ static const char * const usage_opts_hel
4465 "\t\tdts - device tree source text\n"
4466 "\t\tdtb - device tree blob\n"
4467 "\t\tasm - assembler source",
4468 - "\n\tBlob version to produce, defaults to %d (for dtb and asm output)", //, DEFAULT_FDT_VERSION);
4469 + "\n\tBlob version to produce, defaults to "FDT_VERSION(DEFAULT_FDT_VERSION)" (for dtb and asm output)",
4470 "\n\tOutput dependency file",
4471 - "\n\ttMake space for <number> reserve map entries (for dtb and asm output)",
4472 + "\n\tMake space for <number> reserve map entries (for dtb and asm output)",
4473 "\n\tMake the blob at least <bytes> long (extra space)",
4474 "\n\tAdd padding to the blob of <bytes> long (extra space)",
4475 "\n\tSet the physical boot cpu",
4476 @@ -97,6 +101,7 @@ static const char * const usage_opts_hel
4477 "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties",
4478 "\n\tEnable/disable warnings (prefix with \"no-\")",
4479 "\n\tEnable/disable errors (prefix with \"no-\")",
4480 + "\n\tSymbols and Fixups support",
4481 "\n\tPrint this help and exit",
4482 "\n\tPrint version and exit",
4484 @@ -109,7 +114,7 @@ int main(int argc, char *argv[])
4485 const char *outform = "dts";
4486 const char *outname = "-";
4487 const char *depname = NULL;
4488 - int force = 0, sort = 0;
4489 + bool force = false, sort = false;
4493 @@ -148,7 +153,7 @@ int main(int argc, char *argv[])
4494 padsize = strtol(optarg, NULL, 0);
4502 @@ -174,7 +179,7 @@ int main(int argc, char *argv[])
4511 @@ -184,7 +189,9 @@ int main(int argc, char *argv[])
4513 parse_checks_option(false, true, optarg);
4517 + symbol_fixup_support = 1;
4522 @@ -237,7 +244,7 @@ int main(int argc, char *argv[])
4523 if (streq(outname, "-")) {
4526 - outf = fopen(outname, "w");
4527 + outf = fopen(outname, "wb");
4529 die("Couldn't open output file %s: %s\n",
4530 outname, strerror(errno));
4531 --- a/scripts/dtc/dtc.h
4532 +++ b/scripts/dtc/dtc.h
4537 -#define debug(fmt,args...) printf(fmt, ##args)
4538 +#define debug(...) printf(__VA_ARGS__)
4540 -#define debug(fmt,args...)
4545 @@ -54,6 +54,7 @@ extern int reservenum; /* Number of mem
4546 extern int minsize; /* Minimum blob size */
4547 extern int padsize; /* Additional padding to blob */
4548 extern int phandle_format; /* Use linux,phandle or phandle properties */
4549 +extern int symbol_fixup_support;/* enable symbols & fixup support */
4551 #define PHANDLE_LEGACY 0x1
4552 #define PHANDLE_EPAPR 0x2
4553 @@ -88,7 +89,7 @@ struct data {
4557 -#define empty_data ((struct data){ /* all .members = 0 or NULL */ })
4558 +#define empty_data ((struct data){ 0 /* all .members = 0 or NULL */ })
4560 #define for_each_marker(m) \
4561 for (; (m); (m) = (m)->next)
4562 @@ -118,7 +119,7 @@ struct data data_append_align(struct dat
4564 struct data data_add_marker(struct data d, enum markertype type, char *ref);
4566 -int data_is_one_string(struct data d);
4567 +bool data_is_one_string(struct data d);
4569 /* DT constraints */
4571 @@ -127,13 +128,32 @@ int data_is_one_string(struct data d);
4581 +struct fixup_entry {
4583 + struct node *node;
4584 + struct property *prop;
4585 + struct fixup_entry *next;
4590 + struct fixup_entry *entries;
4591 + struct fixup *next;
4595 + struct label *label;
4596 + struct node *node;
4597 + struct symbol *next;
4606 @@ -143,7 +163,7 @@ struct property {
4613 struct property *proplist;
4614 struct node *children;
4615 @@ -158,6 +178,12 @@ struct node {
4616 int addr_cells, size_cells;
4618 struct label *labels;
4622 + struct fixup *fixups;
4623 + struct symbol *symbols;
4624 + struct fixup_entry *local_fixups;
4627 #define for_each_label_withdel(l0, l) \
4628 @@ -181,6 +207,18 @@ struct node {
4629 for_each_child_withdel(n, c) \
4632 +#define for_each_fixup(n, f) \
4633 + for ((f) = (n)->fixups; (f); (f) = (f)->next)
4635 +#define for_each_fixup_entry(f, fe) \
4636 + for ((fe) = (f)->entries; (fe); (fe) = (fe)->next)
4638 +#define for_each_symbol(n, s) \
4639 + for ((s) = (n)->symbols; (s); (s) = (s)->next)
4641 +#define for_each_local_fixup_entry(n, fe) \
4642 + for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next)
4644 void add_label(struct label **labels, char *label);
4645 void delete_labels(struct label **labels);
4647 @@ -247,8 +285,8 @@ void sort_tree(struct boot_info *bi);
4651 -void parse_checks_option(bool warn, bool error, const char *optarg);
4652 -void process_checks(int force, struct boot_info *bi);
4653 +void parse_checks_option(bool warn, bool error, const char *arg);
4654 +void process_checks(bool force, struct boot_info *bi);
4656 /* Flattened trees */
4658 --- a/scripts/dtc/flattree.c
4659 +++ b/scripts/dtc/flattree.c
4660 @@ -261,7 +261,13 @@ static void flatten_tree(struct node *tr
4662 struct property *prop;
4664 - int seen_name_prop = 0;
4665 + bool seen_name_prop = false;
4666 + struct symbol *sym;
4668 + struct fixup_entry *fe;
4670 + const char *fullpath;
4671 + int namesz, nameoff, vallen;
4675 @@ -276,10 +282,8 @@ static void flatten_tree(struct node *tr
4676 emit->align(etarget, sizeof(cell_t));
4678 for_each_property(tree, prop) {
4681 if (streq(prop->name, "name"))
4682 - seen_name_prop = 1;
4683 + seen_name_prop = true;
4685 nameoff = stringtable_insert(strbuf, prop->name);
4687 @@ -310,6 +314,139 @@ static void flatten_tree(struct node *tr
4688 flatten_tree(child, emit, etarget, strbuf, vi);
4691 + if (!symbol_fixup_support)
4694 + /* add the symbol nodes (if any) */
4695 + if (tree->symbols) {
4697 + emit->beginnode(etarget, NULL);
4698 + emit->string(etarget, "__symbols__", 0);
4699 + emit->align(etarget, sizeof(cell_t));
4701 + for_each_symbol(tree, sym) {
4703 + vallen = strlen(sym->node->fullpath);
4705 + nameoff = stringtable_insert(strbuf, sym->label->label);
4707 + emit->property(etarget, NULL);
4708 + emit->cell(etarget, vallen + 1);
4709 + emit->cell(etarget, nameoff);
4711 + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
4712 + emit->align(etarget, 8);
4714 + emit->string(etarget, sym->node->fullpath,
4715 + strlen(sym->node->fullpath));
4716 + emit->align(etarget, sizeof(cell_t));
4719 + emit->endnode(etarget, NULL);
4722 + /* add the fixup nodes */
4723 + if (tree->fixups) {
4725 + /* emit the external fixups */
4726 + emit->beginnode(etarget, NULL);
4727 + emit->string(etarget, "__fixups__", 0);
4728 + emit->align(etarget, sizeof(cell_t));
4730 + for_each_fixup(tree, f) {
4733 + for_each_fixup_entry(f, fe) {
4734 + fullpath = fe->node->fullpath;
4735 + if (fullpath[0] == '\0')
4737 + namesz += strlen(fullpath) + 1;
4738 + namesz += strlen(fe->prop->name) + 1;
4739 + namesz += 32; /* space for :<number> + '\0' */
4742 + name = xmalloc(namesz);
4745 + for_each_fixup_entry(f, fe) {
4746 + fullpath = fe->node->fullpath;
4747 + if (fullpath[0] == '\0')
4749 + snprintf(s, name + namesz - s, "%s:%s:%d",
4751 + fe->prop->name, fe->offset);
4752 + s += strlen(s) + 1;
4755 + nameoff = stringtable_insert(strbuf, f->ref);
4756 + vallen = s - name - 1;
4758 + emit->property(etarget, NULL);
4759 + emit->cell(etarget, vallen + 1);
4760 + emit->cell(etarget, nameoff);
4762 + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
4763 + emit->align(etarget, 8);
4765 + emit->string(etarget, name, vallen);
4766 + emit->align(etarget, sizeof(cell_t));
4771 + emit->endnode(etarget, tree->labels);
4774 + /* add the local fixup property */
4775 + if (tree->local_fixups) {
4777 + /* emit the external fixups */
4778 + emit->beginnode(etarget, NULL);
4779 + emit->string(etarget, "__local_fixups__", 0);
4780 + emit->align(etarget, sizeof(cell_t));
4783 + for_each_local_fixup_entry(tree, fe) {
4784 + fullpath = fe->node->fullpath;
4785 + if (fullpath[0] == '\0')
4787 + namesz += strlen(fullpath) + 1;
4788 + namesz += strlen(fe->prop->name) + 1;
4789 + namesz += 32; /* space for :<number> + '\0' */
4792 + name = xmalloc(namesz);
4795 + for_each_local_fixup_entry(tree, fe) {
4796 + fullpath = fe->node->fullpath;
4797 + if (fullpath[0] == '\0')
4799 + snprintf(s, name + namesz - s, "%s:%s:%d",
4800 + fullpath, fe->prop->name,
4802 + s += strlen(s) + 1;
4805 + nameoff = stringtable_insert(strbuf, "fixup");
4806 + vallen = s - name - 1;
4808 + emit->property(etarget, NULL);
4809 + emit->cell(etarget, vallen + 1);
4810 + emit->cell(etarget, nameoff);
4812 + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
4813 + emit->align(etarget, 8);
4815 + emit->string(etarget, name, vallen);
4816 + emit->align(etarget, sizeof(cell_t));
4820 + emit->endnode(etarget, tree->labels);
4824 emit->endnode(etarget, tree->labels);
4827 --- a/scripts/dtc/fstree.c
4828 +++ b/scripts/dtc/fstree.c
4829 @@ -37,26 +37,26 @@ static struct node *read_fstree(const ch
4830 tree = build_node(NULL, NULL);
4832 while ((de = readdir(d)) != NULL) {
4836 if (streq(de->d_name, ".")
4837 || streq(de->d_name, ".."))
4840 - tmpnam = join_path(dirname, de->d_name);
4841 + tmpname = join_path(dirname, de->d_name);
4843 - if (lstat(tmpnam, &st) < 0)
4844 - die("stat(%s): %s\n", tmpnam, strerror(errno));
4845 + if (lstat(tmpname, &st) < 0)
4846 + die("stat(%s): %s\n", tmpname, strerror(errno));
4848 if (S_ISREG(st.st_mode)) {
4849 struct property *prop;
4852 - pfile = fopen(tmpnam, "r");
4853 + pfile = fopen(tmpname, "rb");
4856 "WARNING: Cannot open %s: %s\n",
4857 - tmpnam, strerror(errno));
4858 + tmpname, strerror(errno));
4860 prop = build_property(xstrdup(de->d_name),
4861 data_copy_file(pfile,
4862 @@ -67,12 +67,12 @@ static struct node *read_fstree(const ch
4863 } else if (S_ISDIR(st.st_mode)) {
4864 struct node *newchild;
4866 - newchild = read_fstree(tmpnam);
4867 + newchild = read_fstree(tmpname);
4868 newchild = name_node(newchild, xstrdup(de->d_name));
4869 add_child(tree, newchild);
4877 --- a/scripts/dtc/livetree.c
4878 +++ b/scripts/dtc/livetree.c
4879 @@ -511,7 +511,9 @@ struct node *get_node_by_phandle(struct
4881 struct node *get_node_by_ref(struct node *tree, const char *ref)
4883 - if (ref[0] == '/')
4884 + if (streq(ref, "/"))
4886 + else if (ref[0] == '/')
4887 return get_node_by_path(tree, ref);
4889 return get_node_by_label(tree, ref);
4890 --- a/scripts/dtc/srcpos.c
4891 +++ b/scripts/dtc/srcpos.c
4892 @@ -34,7 +34,7 @@ struct search_path {
4893 static struct search_path *search_path_head, **search_path_tail;
4896 -static char *dirname(const char *path)
4897 +static char *get_dirname(const char *path)
4899 const char *slash = strrchr(path, '/');
4901 @@ -77,7 +77,7 @@ static char *try_open(const char *dirnam
4903 fullname = join_path(dirname, fname);
4905 - *fp = fopen(fullname, "r");
4906 + *fp = fopen(fullname, "rb");
4910 @@ -150,7 +150,7 @@ void srcfile_push(const char *fname)
4911 srcfile = xmalloc(sizeof(*srcfile));
4913 srcfile->f = srcfile_relative_open(fname, &srcfile->name);
4914 - srcfile->dir = dirname(srcfile->name);
4915 + srcfile->dir = get_dirname(srcfile->name);
4916 srcfile->prev = current_srcfile;
4918 srcfile->lineno = 1;
4919 @@ -159,7 +159,7 @@ void srcfile_push(const char *fname)
4920 current_srcfile = srcfile;
4923 -int srcfile_pop(void)
4924 +bool srcfile_pop(void)
4926 struct srcfile_state *srcfile = current_srcfile;
4928 @@ -177,7 +177,7 @@ int srcfile_pop(void)
4929 * fix this we could either allocate all the files from a
4930 * table, or use a pool allocator. */
4932 - return current_srcfile ? 1 : 0;
4933 + return current_srcfile ? true : false;
4936 void srcfile_add_search_path(const char *dirname)
4937 @@ -290,42 +290,27 @@ srcpos_string(struct srcpos *pos)
4942 -srcpos_verror(struct srcpos *pos, char const *fmt, va_list va)
4943 +void srcpos_verror(struct srcpos *pos, const char *prefix,
4944 + const char *fmt, va_list va)
4946 - const char *srcstr;
4948 - srcstr = srcpos_string(pos);
4951 - fprintf(stderr, "Error: %s ", srcstr);
4952 - vfprintf(stderr, fmt, va);
4953 - fprintf(stderr, "\n");
4955 + srcstr = srcpos_string(pos);
4958 -srcpos_error(struct srcpos *pos, char const *fmt, ...)
4961 + fprintf(stderr, "%s: %s ", prefix, srcstr);
4962 + vfprintf(stderr, fmt, va);
4963 + fprintf(stderr, "\n");
4965 - va_start(va, fmt);
4966 - srcpos_verror(pos, fmt, va);
4973 -srcpos_warn(struct srcpos *pos, char const *fmt, ...)
4974 +void srcpos_error(struct srcpos *pos, const char *prefix,
4975 + const char *fmt, ...)
4977 - const char *srcstr;
4979 - va_start(va, fmt);
4981 - srcstr = srcpos_string(pos);
4983 - fprintf(stderr, "Warning: %s ", srcstr);
4984 - vfprintf(stderr, fmt, va);
4985 - fprintf(stderr, "\n");
4987 + va_start(va, fmt);
4988 + srcpos_verror(pos, prefix, fmt, va);
4992 --- a/scripts/dtc/srcpos.h
4993 +++ b/scripts/dtc/srcpos.h
4998 +#include <stdbool.h>
5000 struct srcfile_state {
5002 @@ -55,7 +56,7 @@ extern struct srcfile_state *current_src
5003 FILE *srcfile_relative_open(const char *fname, char **fullnamep);
5005 void srcfile_push(const char *fname);
5006 -int srcfile_pop(void);
5007 +bool srcfile_pop(void);
5010 * Add a new directory to the search path for input files
5011 @@ -106,12 +107,12 @@ extern struct srcpos *srcpos_copy(struct
5012 extern char *srcpos_string(struct srcpos *pos);
5013 extern void srcpos_dump(struct srcpos *pos);
5015 -extern void srcpos_verror(struct srcpos *pos, char const *, va_list va)
5016 - __attribute__((format(printf, 2, 0)));
5017 -extern void srcpos_error(struct srcpos *pos, char const *, ...)
5018 - __attribute__((format(printf, 2, 3)));
5019 -extern void srcpos_warn(struct srcpos *pos, char const *, ...)
5020 - __attribute__((format(printf, 2, 3)));
5021 +extern void srcpos_verror(struct srcpos *pos, const char *prefix,
5022 + const char *fmt, va_list va)
5023 + __attribute__((format(printf, 3, 0)));
5024 +extern void srcpos_error(struct srcpos *pos, const char *prefix,
5025 + const char *fmt, ...)
5026 + __attribute__((format(printf, 3, 4)));
5028 extern void srcpos_set_line(char *f, int l);
5030 --- a/scripts/dtc/treesource.c
5031 +++ b/scripts/dtc/treesource.c
5032 @@ -26,12 +26,12 @@ extern int yyparse(void);
5033 extern YYLTYPE yylloc;
5035 struct boot_info *the_boot_info;
5036 -int treesource_error;
5037 +bool treesource_error;
5039 struct boot_info *dt_from_source(const char *fname)
5041 the_boot_info = NULL;
5042 - treesource_error = 0;
5043 + treesource_error = false;
5045 srcfile_push(fname);
5046 yyin = current_srcfile->f;
5047 @@ -54,9 +54,9 @@ static void write_prefix(FILE *f, int le
5051 -static int isstring(char c)
5052 +static bool isstring(char c)
5054 - return (isprint(c)
5055 + return (isprint((unsigned char)c)
5057 || strchr("\a\b\t\n\v\f\r", c));
5059 @@ -109,7 +109,7 @@ static void write_propval_string(FILE *f
5063 - while (m && (m->offset < i)) {
5064 + while (m && (m->offset <= (i + 1))) {
5065 if (m->type == LABEL) {
5066 assert(m->offset == (i+1));
5067 fprintf(f, "%s: ", m->ref);
5068 @@ -119,7 +119,7 @@ static void write_propval_string(FILE *f
5073 + if (isprint((unsigned char)c))
5074 fprintf(f, "%c", c);
5076 fprintf(f, "\\x%02hhx", c);
5077 @@ -178,7 +178,7 @@ static void write_propval_bytes(FILE *f,
5081 - fprintf(f, "%02hhx", *bp++);
5082 + fprintf(f, "%02hhx", (unsigned char)(*bp++));
5083 if ((const void *)bp >= propend)
5086 --- a/scripts/dtc/util.c
5087 +++ b/scripts/dtc/util.c
5089 char *xstrdup(const char *s)
5091 int len = strlen(s) + 1;
5092 - char *dup = xmalloc(len);
5093 + char *d = xmalloc(len);
5095 - memcpy(dup, s, len);
5096 + memcpy(d, s, len);
5102 char *join_path(const char *path, const char *name)
5103 @@ -70,7 +70,7 @@ char *join_path(const char *path, const
5107 -int util_is_printable_string(const void *data, int len)
5108 +bool util_is_printable_string(const void *data, int len)
5110 const char *s = data;
5111 const char *ss, *se;
5112 @@ -87,7 +87,7 @@ int util_is_printable_string(const void
5116 - while (s < se && *s && isprint(*s))
5117 + while (s < se && *s && isprint((unsigned char)*s))
5120 /* not zero, or not done yet */
5121 @@ -219,10 +219,6 @@ int utilfdt_read_err_len(const char *fil
5122 if (offset == bufsize) {
5124 buf = xrealloc(buf, bufsize);
5131 ret = read(fd, &buf[offset], bufsize - offset);
5132 @@ -375,9 +371,9 @@ void utilfdt_print_data(const char *data
5133 const uint32_t *cell = (const uint32_t *)data;
5136 - for (i = 0; i < len; i += 4)
5137 + for (i = 0, len /= 4; i < len; i++)
5138 printf("0x%08x%s", fdt32_to_cpu(cell[i]),
5139 - i < (len - 4) ? " " : "");
5140 + i < (len - 1) ? " " : "");
5144 --- a/scripts/dtc/util.h
5145 +++ b/scripts/dtc/util.h
5150 +#include <stdbool.h>
5154 @@ -33,6 +34,7 @@ static inline void __attribute__((noretu
5156 fprintf(stderr, "FATAL ERROR: ");
5157 vfprintf(stderr, str, ap);
5162 @@ -68,7 +70,7 @@ extern char *join_path(const char *path,
5163 * @param len The string length including terminator
5164 * @return 1 if a valid printable string, 0 if not
5166 -int util_is_printable_string(const void *data, int len);
5167 +bool util_is_printable_string(const void *data, int len);
5170 * Parse an escaped character starting at index i in string s. The resulting
5171 --- a/scripts/dtc/version_gen.h
5172 +++ b/scripts/dtc/version_gen.h
5174 -#define DTC_VERSION "DTC 1.4.0-dirty"
5175 +#define DTC_VERSION "DTC 1.4.1-g36c70742"