lantiq: Use the BAR0 base address in the ath PCI fixup code
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-3.18 / 0075-scripts-dtc-Update-to-upstream-version-with-overlay-.patch
1 From c0b05569c40e9a8817c2d655335251e2253428cd Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Fri, 23 Jan 2015 14:48:55 +0000
4 Subject: [PATCH 075/114] scripts/dtc: Update to upstream version with overlay
5 patches
6
7 ---
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(-)
27
28 --- a/scripts/dtc/checks.c
29 +++ b/scripts/dtc/checks.c
30 @@ -53,7 +53,7 @@ struct check {
31 void *data;
32 bool warn, error;
33 enum checkstatus status;
34 - int inprogress;
35 + bool inprogress;
36 int num_prereqs;
37 struct check **prereq;
38 };
39 @@ -113,6 +113,7 @@ static inline void check_msg(struct chec
40 vfprintf(stderr, fmt, ap);
41 fprintf(stderr, "\n");
42 }
43 + va_end(ap);
44 }
45
46 #define FAIL(c, ...) \
47 @@ -141,9 +142,9 @@ static void check_nodes_props(struct che
48 check_nodes_props(c, dt, child);
49 }
50
51 -static int run_check(struct check *c, struct node *dt)
52 +static bool run_check(struct check *c, struct node *dt)
53 {
54 - int error = 0;
55 + bool error = false;
56 int i;
57
58 assert(!c->inprogress);
59 @@ -151,11 +152,11 @@ static int run_check(struct check *c, st
60 if (c->status != UNCHECKED)
61 goto out;
62
63 - c->inprogress = 1;
64 + c->inprogress = true;
65
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) {
71 c->status = PREREQ;
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);
75
76 out:
77 - c->inprogress = 0;
78 + c->inprogress = false;
79 if ((c->status != PASSED) && (c->error))
80 - error = 1;
81 + error = true;
82 return error;
83 }
84
85 @@ -457,22 +458,93 @@ static void fixup_phandle_references(str
86 struct node *node, struct property *prop)
87 {
88 struct marker *m = prop->val.markers;
89 + struct fixup *f, **fp;
90 + struct fixup_entry *fe, **fep;
91 struct node *refnode;
92 cell_t phandle;
93 + int has_phandle_refs;
94 +
95 + has_phandle_refs = 0;
96 + for_each_marker_of_type(m, REF_PHANDLE) {
97 + has_phandle_refs = 1;
98 + break;
99 + }
100 +
101 + if (!has_phandle_refs)
102 + return;
103
104 for_each_marker_of_type(m, REF_PHANDLE) {
105 assert(m->offset + sizeof(cell_t) <= prop->val.len);
106
107 refnode = get_node_by_ref(dt, m->ref);
108 - if (! refnode) {
109 + if (!refnode && !symbol_fixup_support) {
110 FAIL(c, "Reference to non-existent node or label \"%s\"\n",
111 - m->ref);
112 + m->ref);
113 continue;
114 }
115
116 - phandle = get_node_phandle(dt, refnode);
117 - *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
118 + if (!refnode) {
119 + /* allocate fixup entry */
120 + fe = xmalloc(sizeof(*fe));
121 +
122 + fe->node = node;
123 + fe->prop = prop;
124 + fe->offset = m->offset;
125 + fe->next = NULL;
126 +
127 + /* search for an already existing fixup */
128 + for_each_fixup(dt, f)
129 + if (strcmp(f->ref, m->ref) == 0)
130 + break;
131 +
132 + /* no fixup found, add new */
133 + if (f == NULL) {
134 + f = xmalloc(sizeof(*f));
135 + f->ref = m->ref;
136 + f->entries = NULL;
137 + f->next = NULL;
138 +
139 + /* add it to the tree */
140 + fp = &dt->fixups;
141 + while (*fp)
142 + fp = &(*fp)->next;
143 + *fp = f;
144 + }
145 +
146 + /* and now append fixup entry */
147 + fep = &f->entries;
148 + while (*fep)
149 + fep = &(*fep)->next;
150 + *fep = fe;
151 +
152 + /* mark the entry as unresolved */
153 + phandle = 0xdeadbeef;
154 + } else {
155 + phandle = get_node_phandle(dt, refnode);
156 +
157 + /* if it's a plugin, we need to record it */
158 + if (symbol_fixup_support && dt->is_plugin) {
159 +
160 + /* allocate a new local fixup entry */
161 + fe = xmalloc(sizeof(*fe));
162 +
163 + fe->node = node;
164 + fe->prop = prop;
165 + fe->offset = m->offset;
166 + fe->next = NULL;
167 +
168 + /* append it to the local fixups */
169 + fep = &dt->local_fixups;
170 + while (*fep)
171 + fep = &(*fep)->next;
172 + *fep = fe;
173 + }
174 + }
175 +
176 + *((cell_t *)(prop->val.val + m->offset)) =
177 + cpu_to_fdt32(phandle);
178 }
179 +
180 }
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
184 if (!reg && !ranges)
185 return;
186
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",
190 node->fullpath);
191
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",
195 node->fullpath);
196 }
197 @@ -651,6 +723,45 @@ static void check_obsolete_chosen_interr
198 }
199 TREE_WARNING(obsolete_chosen_interrupt_controller, NULL);
200
201 +static void check_auto_label_phandles(struct check *c, struct node *dt,
202 + struct node *node)
203 +{
204 + struct label *l;
205 + struct symbol *s, **sp;
206 + int has_label;
207 +
208 + if (!symbol_fixup_support)
209 + return;
210 +
211 + has_label = 0;
212 + for_each_label(node->labels, l) {
213 + has_label = 1;
214 + break;
215 + }
216 +
217 + if (!has_label)
218 + return;
219 +
220 + /* force allocation of a phandle for this node */
221 + (void)get_node_phandle(dt, node);
222 +
223 + /* add the symbol */
224 + for_each_label(node->labels, l) {
225 +
226 + s = xmalloc(sizeof(*s));
227 + s->label = l;
228 + s->node = node;
229 + s->next = NULL;
230 +
231 + /* add it to the symbols list */
232 + sp = &dt->symbols;
233 + while (*sp)
234 + sp = &((*sp)->next);
235 + *sp = s;
236 + }
237 +}
238 +NODE_WARNING(auto_label_phandles, NULL);
239 +
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,
246
247 + &auto_label_phandles,
248 +
249 &always_fail,
250 };
251
252 @@ -706,15 +819,15 @@ static void disable_warning_error(struct
253 c->error = c->error && !error;
254 }
255
256 -void parse_checks_option(bool warn, bool error, const char *optarg)
257 +void parse_checks_option(bool warn, bool error, const char *arg)
258 {
259 int i;
260 - const char *name = optarg;
261 + const char *name = arg;
262 bool enable = true;
263
264 - if ((strncmp(optarg, "no-", 3) == 0)
265 - || (strncmp(optarg, "no_", 3) == 0)) {
266 - name = optarg + 3;
267 + if ((strncmp(arg, "no-", 3) == 0)
268 + || (strncmp(arg, "no_", 3) == 0)) {
269 + name = arg + 3;
270 enable = false;
271 }
272
273 @@ -733,7 +846,7 @@ void parse_checks_option(bool warn, bool
274 die("Unrecognized check name \"%s\"\n", name);
275 }
276
277 -void process_checks(int force, struct boot_info *bi)
278 +void process_checks(bool force, struct boot_info *bi)
279 {
280 struct node *dt = bi->dt;
281 int i;
282 --- a/scripts/dtc/data.c
283 +++ b/scripts/dtc/data.c
284 @@ -74,7 +74,7 @@ struct data data_copy_escape_string(cons
285 struct data d;
286 char *q;
287
288 - d = data_grow_for(empty_data, strlen(s)+1);
289 + d = data_grow_for(empty_data, len + 1);
290
291 q = d.val;
292 while (i < len) {
293 @@ -250,20 +250,20 @@ struct data data_add_marker(struct data
294 return data_append_markers(d, m);
295 }
296
297 -int data_is_one_string(struct data d)
298 +bool data_is_one_string(struct data d)
299 {
300 int i;
301 int len = d.len;
302
303 if (len == 0)
304 - return 0;
305 + return false;
306
307 for (i = 0; i < len-1; i++)
308 if (d.val[i] == '\0')
309 - return 0;
310 + return false;
311
312 if (d.val[len-1] != '\0')
313 - return 0;
314 + return false;
315
316 - return 1;
317 + return true;
318 }
319 --- a/scripts/dtc/dtc-lexer.l
320 +++ b/scripts/dtc/dtc-lexer.l
321 @@ -20,7 +20,6 @@
322
323 %option noyywrap nounput noinput never-interactive
324
325 -%x INCLUDE
326 %x BYTESTRING
327 %x PROPNODENAME
328 %s V1
329 @@ -40,6 +39,7 @@ LINECOMMENT "//".*\n
330 #include "dtc-parser.tab.h"
331
332 YYLTYPE yylloc;
333 +extern bool treesource_error;
334
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;
338 BEGIN(V1); \
339
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, ...);
344 %}
345
346 %%
347 @@ -75,11 +76,11 @@ static int pop_input_file(void);
348 char *line, *tmp, *fn;
349 /* skip text before line # */
350 line = yytext;
351 - while (!isdigit(*line))
352 + while (!isdigit((unsigned char)*line))
353 line++;
354 /* skip digits in line # */
355 tmp = line;
356 - while (!isspace(*tmp))
357 + while (!isspace((unsigned char)*tmp))
358 tmp++;
359 /* "NULL"-terminate line # */
360 *tmp = '\0';
361 @@ -112,6 +113,11 @@ static int pop_input_file(void);
362 return DT_V1;
363 }
364
365 +<*>"/plugin/" {
366 + DPRINT("Keyword: /plugin/\n");
367 + return DT_PLUGIN;
368 + }
369 +
370 <*>"/memreserve/" {
371 DPRINT("Keyword: /memreserve/\n");
372 BEGIN_DEFAULT();
373 @@ -146,15 +152,42 @@ static int pop_input_file(void);
374 }
375
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);
379 + char *e;
380 + DPRINT("Integer Literal: '%s'\n", yytext);
381 +
382 + errno = 0;
383 + yylval.integer = strtoull(yytext, &e, 0);
384 +
385 + assert(!(*e) || !e[strspn(e, "UL")]);
386 +
387 + if (errno == ERANGE)
388 + lexical_error("Integer literal '%s' out of range",
389 + yytext);
390 + else
391 + /* ERANGE is the only strtoull error triggerable
392 + * by strings matching the pattern */
393 + assert(errno == 0);
394 return DT_LITERAL;
395 }
396
397 <*>{CHAR_LITERAL} {
398 - yytext[yyleng-1] = '\0';
399 - yylval.literal = xstrdup(yytext+1);
400 - DPRINT("Character literal: %s\n", yylval.literal);
401 + struct data d;
402 + DPRINT("Character literal: %s\n", yytext);
403 +
404 + d = data_copy_escape_string(yytext+1, yyleng-2);
405 + if (d.len == 1) {
406 + lexical_error("Empty character literal");
407 + yylval.integer = 0;
408 + return DT_CHAR_LITERAL;
409 + }
410 +
411 + yylval.integer = (unsigned char)d.val[0];
412 +
413 + if (d.len > 2)
414 + lexical_error("Character literal has %d"
415 + " characters instead of 1",
416 + d.len - 1);
417 +
418 return DT_CHAR_LITERAL;
419 }
420
421 @@ -164,7 +197,7 @@ static int pop_input_file(void);
422 return DT_REF;
423 }
424
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 *
431 }
432
433
434 -static int pop_input_file(void)
435 +static bool pop_input_file(void)
436 {
437 if (srcfile_pop() == 0)
438 - return 0;
439 + return false;
440
441 yypop_buffer_state();
442 yyin = current_srcfile->f;
443
444 - return 1;
445 + return true;
446 +}
447 +
448 +static void lexical_error(const char *fmt, ...)
449 +{
450 + va_list ap;
451 +
452 + va_start(ap, fmt);
453 + srcpos_verror(&yylloc, "Lexical error", fmt, ap);
454 + va_end(ap);
455 +
456 + treesource_error = true;
457 }
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
461 *yy_cp = '\0'; \
462 (yy_c_buf_p) = yy_cp;
463
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. */
470 struct yy_trans_info
471 @@ -381,25 +381,26 @@ struct yy_trans_info
472 flex_int32_t yy_verify;
473 flex_int32_t yy_nxt;
474 };
475 -static yyconst flex_int16_t yy_accept[161] =
476 +static yyconst flex_int16_t yy_accept[166] =
477 { 0,
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,
488 +
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,
503 -
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,
511 + 0, 0, 0, 8, 0
512 } ;
513
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,
518
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] =
529 1, 1, 1, 1, 1
530 } ;
531
532 -static yyconst flex_int32_t yy_meta[47] =
533 +static yyconst flex_int32_t yy_meta[48] =
534 { 0,
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,
539 - 8, 8, 8, 3, 1, 1
540 + 8, 8, 8, 8, 3, 1, 4
541 } ;
542
543 -static yyconst flex_int16_t yy_base[175] =
544 +static yyconst flex_int16_t yy_base[180] =
545 { 0,
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,
556 -
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,
564 - 304, 310, 318, 326
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,
575 +
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
584 } ;
585
586 -static yyconst flex_int16_t yy_def[175] =
587 +static yyconst flex_int16_t yy_def[180] =
588 { 0,
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,
599 -
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,
607 - 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,
618 +
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
627 } ;
628
629 -static yyconst flex_int16_t yy_nxt[440] =
630 +static yyconst flex_int16_t yy_nxt[449] =
631 { 0,
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,
642 -
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,
653 -
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,
664 -
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,
675 -
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,
690 +
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,
701 +
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,
712 +
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,
723 +
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
729 } ;
730
731 -static yyconst flex_int16_t yy_chk[440] =
732 +static yyconst flex_int16_t yy_chk[449] =
733 { 0,
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,
744 -
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,
755 -
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,
766 -
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,
777 -
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,
788 +
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,
799 +
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,
810 +
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,
821 +
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
827 } ;
828
829 static yy_state_type yy_last_accepting_state;
830 @@ -631,13 +634,13 @@ char *yytext;
831
832
833
834 -
835 -#line 38 "dtc-lexer.l"
836 +#line 37 "dtc-lexer.l"
837 #include "dtc.h"
838 #include "srcpos.h"
839 #include "dtc-parser.tab.h"
840
841 YYLTYPE yylloc;
842 +extern bool treesource_error;
843
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;
847 BEGIN(V1); \
848
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"
855
856 #define INITIAL 0
857 -#define INCLUDE 1
858 -#define BYTESTRING 2
859 -#define PROPNODENAME 3
860 -#define V1 4
861 +#define BYTESTRING 1
862 +#define PROPNODENAME 2
863 +#define V1 3
864
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;
869 register int yy_act;
870
871 -#line 67 "dtc-lexer.l"
872 +#line 68 "dtc-lexer.l"
873
874 -#line 858 "dtc-lexer.lex.c"
875 +#line 861 "dtc-lexer.lex.c"
876
877 if ( !(yy_init) )
878 {
879 @@ -908,13 +911,13 @@ yy_match:
880 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
881 {
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];
886 }
887 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
888 ++yy_cp;
889 }
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);
894
895 @@ -937,7 +940,7 @@ do_action: /* This label is used only to
896 case 1:
897 /* rule 1 can match eol */
898 YY_RULE_SETUP
899 -#line 68 "dtc-lexer.l"
900 +#line 69 "dtc-lexer.l"
901 {
902 char *name = strchr(yytext, '\"') + 1;
903 yytext[yyleng-1] = '\0';
904 @@ -947,16 +950,16 @@ YY_RULE_SETUP
905 case 2:
906 /* rule 2 can match eol */
907 YY_RULE_SETUP
908 -#line 74 "dtc-lexer.l"
909 +#line 75 "dtc-lexer.l"
910 {
911 char *line, *tmp, *fn;
912 /* skip text before line # */
913 line = yytext;
914 - while (!isdigit(*line))
915 + while (!isdigit((unsigned char)*line))
916 line++;
917 /* skip digits in line # */
918 tmp = line;
919 - while (!isspace(*tmp))
920 + while (!isspace((unsigned char)*tmp))
921 tmp++;
922 /* "NULL"-terminate line # */
923 *tmp = '\0';
924 @@ -970,11 +973,10 @@ YY_RULE_SETUP
925 }
926 YY_BREAK
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"
934 {
935 if (!pop_input_file()) {
936 yyterminate();
937 @@ -984,7 +986,7 @@ case YY_STATE_EOF(V1):
938 case 3:
939 /* rule 3 can match eol */
940 YY_RULE_SETUP
941 -#line 101 "dtc-lexer.l"
942 +#line 102 "dtc-lexer.l"
943 {
944 DPRINT("String: %s\n", yytext);
945 yylval.data = data_copy_escape_string(yytext+1,
946 @@ -994,7 +996,7 @@ YY_RULE_SETUP
947 YY_BREAK
948 case 4:
949 YY_RULE_SETUP
950 -#line 108 "dtc-lexer.l"
951 +#line 109 "dtc-lexer.l"
952 {
953 DPRINT("Keyword: /dts-v1/\n");
954 dts_version = 1;
955 @@ -1004,25 +1006,33 @@ YY_RULE_SETUP
956 YY_BREAK
957 case 5:
958 YY_RULE_SETUP
959 -#line 115 "dtc-lexer.l"
960 +#line 116 "dtc-lexer.l"
961 +{
962 + DPRINT("Keyword: /plugin/\n");
963 + return DT_PLUGIN;
964 + }
965 + YY_BREAK
966 +case 6:
967 +YY_RULE_SETUP
968 +#line 121 "dtc-lexer.l"
969 {
970 DPRINT("Keyword: /memreserve/\n");
971 BEGIN_DEFAULT();
972 return DT_MEMRESERVE;
973 }
974 YY_BREAK
975 -case 6:
976 +case 7:
977 YY_RULE_SETUP
978 -#line 121 "dtc-lexer.l"
979 +#line 127 "dtc-lexer.l"
980 {
981 DPRINT("Keyword: /bits/\n");
982 BEGIN_DEFAULT();
983 return DT_BITS;
984 }
985 YY_BREAK
986 -case 7:
987 +case 8:
988 YY_RULE_SETUP
989 -#line 127 "dtc-lexer.l"
990 +#line 133 "dtc-lexer.l"
991 {
992 DPRINT("Keyword: /delete-property/\n");
993 DPRINT("<PROPNODENAME>\n");
994 @@ -1030,9 +1040,9 @@ YY_RULE_SETUP
995 return DT_DEL_PROP;
996 }
997 YY_BREAK
998 -case 8:
999 +case 9:
1000 YY_RULE_SETUP
1001 -#line 134 "dtc-lexer.l"
1002 +#line 140 "dtc-lexer.l"
1003 {
1004 DPRINT("Keyword: /delete-node/\n");
1005 DPRINT("<PROPNODENAME>\n");
1006 @@ -1040,9 +1050,9 @@ YY_RULE_SETUP
1007 return DT_DEL_NODE;
1008 }
1009 YY_BREAK
1010 -case 9:
1011 +case 10:
1012 YY_RULE_SETUP
1013 -#line 141 "dtc-lexer.l"
1014 +#line 147 "dtc-lexer.l"
1015 {
1016 DPRINT("Label: %s\n", yytext);
1017 yylval.labelref = xstrdup(yytext);
1018 @@ -1050,38 +1060,65 @@ YY_RULE_SETUP
1019 return DT_LABEL;
1020 }
1021 YY_BREAK
1022 -case 10:
1023 +case 11:
1024 YY_RULE_SETUP
1025 -#line 148 "dtc-lexer.l"
1026 +#line 154 "dtc-lexer.l"
1027 {
1028 - yylval.literal = xstrdup(yytext);
1029 - DPRINT("Literal: '%s'\n", yylval.literal);
1030 + char *e;
1031 + DPRINT("Integer Literal: '%s'\n", yytext);
1032 +
1033 + errno = 0;
1034 + yylval.integer = strtoull(yytext, &e, 0);
1035 +
1036 + assert(!(*e) || !e[strspn(e, "UL")]);
1037 +
1038 + if (errno == ERANGE)
1039 + lexical_error("Integer literal '%s' out of range",
1040 + yytext);
1041 + else
1042 + /* ERANGE is the only strtoull error triggerable
1043 + * by strings matching the pattern */
1044 + assert(errno == 0);
1045 return DT_LITERAL;
1046 }
1047 YY_BREAK
1048 -case 11:
1049 -/* rule 11 can match eol */
1050 +case 12:
1051 +/* rule 12 can match eol */
1052 YY_RULE_SETUP
1053 -#line 154 "dtc-lexer.l"
1054 +#line 173 "dtc-lexer.l"
1055 {
1056 - yytext[yyleng-1] = '\0';
1057 - yylval.literal = xstrdup(yytext+1);
1058 - DPRINT("Character literal: %s\n", yylval.literal);
1059 + struct data d;
1060 + DPRINT("Character literal: %s\n", yytext);
1061 +
1062 + d = data_copy_escape_string(yytext+1, yyleng-2);
1063 + if (d.len == 1) {
1064 + lexical_error("Empty character literal");
1065 + yylval.integer = 0;
1066 + return DT_CHAR_LITERAL;
1067 + }
1068 +
1069 + yylval.integer = (unsigned char)d.val[0];
1070 +
1071 + if (d.len > 2)
1072 + lexical_error("Character literal has %d"
1073 + " characters instead of 1",
1074 + d.len - 1);
1075 +
1076 return DT_CHAR_LITERAL;
1077 }
1078 YY_BREAK
1079 -case 12:
1080 +case 13:
1081 YY_RULE_SETUP
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);
1087 return DT_REF;
1088 }
1089 YY_BREAK
1090 -case 13:
1091 +case 14:
1092 YY_RULE_SETUP
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
1099 return DT_REF;
1100 }
1101 YY_BREAK
1102 -case 14:
1103 +case 15:
1104 YY_RULE_SETUP
1105 -#line 174 "dtc-lexer.l"
1106 +#line 207 "dtc-lexer.l"
1107 {
1108 yylval.byte = strtol(yytext, NULL, 16);
1109 DPRINT("Byte: %02x\n", (int)yylval.byte);
1110 return DT_BYTE;
1111 }
1112 YY_BREAK
1113 -case 15:
1114 +case 16:
1115 YY_RULE_SETUP
1116 -#line 180 "dtc-lexer.l"
1117 +#line 213 "dtc-lexer.l"
1118 {
1119 DPRINT("/BYTESTRING\n");
1120 BEGIN_DEFAULT();
1121 return ']';
1122 }
1123 YY_BREAK
1124 -case 16:
1125 +case 17:
1126 YY_RULE_SETUP
1127 -#line 186 "dtc-lexer.l"
1128 +#line 219 "dtc-lexer.l"
1129 {
1130 DPRINT("PropNodeName: %s\n", yytext);
1131 yylval.propnodename = xstrdup((yytext[0] == '\\') ?
1132 @@ -1118,75 +1155,75 @@ YY_RULE_SETUP
1133 return DT_PROPNODENAME;
1134 }
1135 YY_BREAK
1136 -case 17:
1137 +case 18:
1138 YY_RULE_SETUP
1139 -#line 194 "dtc-lexer.l"
1140 +#line 227 "dtc-lexer.l"
1141 {
1142 DPRINT("Binary Include\n");
1143 return DT_INCBIN;
1144 }
1145 YY_BREAK
1146 -case 18:
1147 -/* rule 18 can match eol */
1148 -YY_RULE_SETUP
1149 -#line 199 "dtc-lexer.l"
1150 -/* eat whitespace */
1151 - YY_BREAK
1152 case 19:
1153 /* rule 19 can match eol */
1154 YY_RULE_SETUP
1155 -#line 200 "dtc-lexer.l"
1156 -/* eat C-style comments */
1157 +#line 232 "dtc-lexer.l"
1158 +/* eat whitespace */
1159 YY_BREAK
1160 case 20:
1161 /* rule 20 can match eol */
1162 YY_RULE_SETUP
1163 -#line 201 "dtc-lexer.l"
1164 -/* eat C++-style comments */
1165 +#line 233 "dtc-lexer.l"
1166 +/* eat C-style comments */
1167 YY_BREAK
1168 case 21:
1169 +/* rule 21 can match eol */
1170 YY_RULE_SETUP
1171 -#line 203 "dtc-lexer.l"
1172 -{ return DT_LSHIFT; };
1173 +#line 234 "dtc-lexer.l"
1174 +/* eat C++-style comments */
1175 YY_BREAK
1176 case 22:
1177 YY_RULE_SETUP
1178 -#line 204 "dtc-lexer.l"
1179 -{ return DT_RSHIFT; };
1180 +#line 236 "dtc-lexer.l"
1181 +{ return DT_LSHIFT; };
1182 YY_BREAK
1183 case 23:
1184 YY_RULE_SETUP
1185 -#line 205 "dtc-lexer.l"
1186 -{ return DT_LE; };
1187 +#line 237 "dtc-lexer.l"
1188 +{ return DT_RSHIFT; };
1189 YY_BREAK
1190 case 24:
1191 YY_RULE_SETUP
1192 -#line 206 "dtc-lexer.l"
1193 -{ return DT_GE; };
1194 +#line 238 "dtc-lexer.l"
1195 +{ return DT_LE; };
1196 YY_BREAK
1197 case 25:
1198 YY_RULE_SETUP
1199 -#line 207 "dtc-lexer.l"
1200 -{ return DT_EQ; };
1201 +#line 239 "dtc-lexer.l"
1202 +{ return DT_GE; };
1203 YY_BREAK
1204 case 26:
1205 YY_RULE_SETUP
1206 -#line 208 "dtc-lexer.l"
1207 -{ return DT_NE; };
1208 +#line 240 "dtc-lexer.l"
1209 +{ return DT_EQ; };
1210 YY_BREAK
1211 case 27:
1212 YY_RULE_SETUP
1213 -#line 209 "dtc-lexer.l"
1214 -{ return DT_AND; };
1215 +#line 241 "dtc-lexer.l"
1216 +{ return DT_NE; };
1217 YY_BREAK
1218 case 28:
1219 YY_RULE_SETUP
1220 -#line 210 "dtc-lexer.l"
1221 -{ return DT_OR; };
1222 +#line 242 "dtc-lexer.l"
1223 +{ return DT_AND; };
1224 YY_BREAK
1225 case 29:
1226 YY_RULE_SETUP
1227 -#line 212 "dtc-lexer.l"
1228 +#line 243 "dtc-lexer.l"
1229 +{ return DT_OR; };
1230 + YY_BREAK
1231 +case 30:
1232 +YY_RULE_SETUP
1233 +#line 245 "dtc-lexer.l"
1234 {
1235 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1236 (unsigned)yytext[0]);
1237 @@ -1202,12 +1239,12 @@ YY_RULE_SETUP
1238 return yytext[0];
1239 }
1240 YY_BREAK
1241 -case 30:
1242 +case 31:
1243 YY_RULE_SETUP
1244 -#line 227 "dtc-lexer.l"
1245 +#line 260 "dtc-lexer.l"
1246 ECHO;
1247 YY_BREAK
1248 -#line 1211 "dtc-lexer.lex.c"
1249 +#line 1248 "dtc-lexer.lex.c"
1250
1251 case YY_END_OF_BUFFER:
1252 {
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 )
1255 {
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];
1260 }
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 )
1264 {
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];
1269 }
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);
1273
1274 return yy_is_jam ? 0 : yy_current_state;
1275 }
1276 @@ -2166,7 +2203,7 @@ void yyfree (void * ptr )
1277
1278 #define YYTABLES_NAME "yytables"
1279
1280 -#line 227 "dtc-lexer.l"
1281 +#line 260 "dtc-lexer.l"
1282
1283
1284
1285 @@ -2182,14 +2219,25 @@ static void push_input_file(const char *
1286 }
1287
1288
1289 -static int pop_input_file(void)
1290 +static bool pop_input_file(void)
1291 {
1292 if (srcfile_pop() == 0)
1293 - return 0;
1294 + return false;
1295
1296 yypop_buffer_state();
1297 yyin = current_srcfile->f;
1298
1299 - return 1;
1300 + return true;
1301 +}
1302 +
1303 +static void lexical_error(const char *fmt, ...)
1304 +{
1305 + va_list ap;
1306 +
1307 + va_start(ap, fmt);
1308 + srcpos_verror(&yylloc, "Lexical error", fmt, ap);
1309 + va_end(ap);
1310 +
1311 + treesource_error = true;
1312 }
1313
1314 --- a/scripts/dtc/dtc-parser.tab.c_shipped
1315 +++ b/scripts/dtc/dtc-parser.tab.c_shipped
1316 @@ -1,19 +1,19 @@
1317 -/* A Bison parser, made by GNU Bison 2.7.12-4996. */
1318 +/* A Bison parser, made by GNU Bison 3.0.2. */
1319
1320 /* Bison implementation for Yacc-like parsers in C
1321 -
1322 - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
1323 -
1324 +
1325 + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
1326 +
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.
1331 -
1332 +
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.
1337 -
1338 +
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/>. */
1341
1342 @@ -26,7 +26,7 @@
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.
1346 -
1347 +
1348 This special exception was added by the Free Software Foundation in
1349 version 2.2 of Bison. */
1350
1351 @@ -44,7 +44,7 @@
1352 #define YYBISON 1
1353
1354 /* Bison version. */
1355 -#define YYBISON_VERSION "2.7.12-4996"
1356 +#define YYBISON_VERSION "3.0.2"
1357
1358 /* Skeleton name. */
1359 #define YYSKELETON_NAME "yacc.c"
1360 @@ -62,34 +62,32 @@
1361
1362
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 */
1367
1368 #include <stdio.h>
1369 +#include <inttypes.h>
1370
1371 #include "dtc.h"
1372 #include "srcpos.h"
1373
1374 -YYLTYPE yylloc;
1375 -
1376 extern int yylex(void);
1377 -extern void print_error(char const *fmt, ...);
1378 extern void yyerror(char const *s);
1379 +#define ERROR(loc, ...) \
1380 + do { \
1381 + srcpos_error((loc), "Error", __VA_ARGS__); \
1382 + treesource_error = true; \
1383 + } while (0)
1384
1385 extern struct boot_info *the_boot_info;
1386 -extern int treesource_error;
1387 -
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;
1391
1392 -/* Line 371 of yacc.c */
1393 -#line 87 "dtc-parser.tab.c"
1394 +#line 85 "dtc-parser.tab.c" /* yacc.c:339 */
1395
1396 -# ifndef YY_NULL
1397 +# ifndef YY_NULLPTR
1398 # if defined __cplusplus && 201103L <= __cplusplus
1399 -# define YY_NULL nullptr
1400 +# define YY_NULLPTR nullptr
1401 # else
1402 -# define YY_NULL 0
1403 +# define YY_NULLPTR 0
1404 # endif
1405 # endif
1406
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. */
1413 #ifndef YYDEBUG
1414 # define YYDEBUG 0
1415 #endif
1416 @@ -113,48 +111,45 @@ static unsigned char eval_char_literal(c
1417 extern int yydebug;
1418 #endif
1419
1420 -/* Tokens. */
1421 +/* Token type. */
1422 #ifndef YYTOKENTYPE
1423 # define YYTOKENTYPE
1424 - /* Put the tokens into the symbol table, so that GDB and other debuggers
1425 - know about them. */
1426 - enum yytokentype {
1427 - DT_V1 = 258,
1428 - DT_MEMRESERVE = 259,
1429 - DT_LSHIFT = 260,
1430 - DT_RSHIFT = 261,
1431 - DT_LE = 262,
1432 - DT_GE = 263,
1433 - DT_EQ = 264,
1434 - DT_NE = 265,
1435 - DT_AND = 266,
1436 - DT_OR = 267,
1437 - DT_BITS = 268,
1438 - DT_DEL_PROP = 269,
1439 - DT_DEL_NODE = 270,
1440 - DT_PROPNODENAME = 271,
1441 - DT_LITERAL = 272,
1442 - DT_CHAR_LITERAL = 273,
1443 - DT_BASE = 274,
1444 - DT_BYTE = 275,
1445 - DT_STRING = 276,
1446 - DT_LABEL = 277,
1447 - DT_REF = 278,
1448 - DT_INCBIN = 279
1449 - };
1450 + enum yytokentype
1451 + {
1452 + DT_V1 = 258,
1453 + DT_PLUGIN = 259,
1454 + DT_MEMRESERVE = 260,
1455 + DT_LSHIFT = 261,
1456 + DT_RSHIFT = 262,
1457 + DT_LE = 263,
1458 + DT_GE = 264,
1459 + DT_EQ = 265,
1460 + DT_NE = 266,
1461 + DT_AND = 267,
1462 + DT_OR = 268,
1463 + DT_BITS = 269,
1464 + DT_DEL_PROP = 270,
1465 + DT_DEL_NODE = 271,
1466 + DT_PROPNODENAME = 272,
1467 + DT_LITERAL = 273,
1468 + DT_CHAR_LITERAL = 274,
1469 + DT_BYTE = 275,
1470 + DT_STRING = 276,
1471 + DT_LABEL = 277,
1472 + DT_REF = 278,
1473 + DT_INCBIN = 279
1474 + };
1475 #endif
1476
1477 -
1478 +/* Value type. */
1479 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1480 -typedef union YYSTYPE
1481 +typedef union YYSTYPE YYSTYPE;
1482 +union YYSTYPE
1483 {
1484 -/* Line 387 of yacc.c */
1485 -#line 40 "dtc-parser.y"
1486 +#line 39 "dtc-parser.y" /* yacc.c:355 */
1487
1488 char *propnodename;
1489 - char *literal;
1490 char *labelref;
1491 - unsigned int cbase;
1492 uint8_t byte;
1493 struct data data;
1494
1495 @@ -169,38 +164,38 @@ typedef union YYSTYPE
1496 struct node *nodelist;
1497 struct reserve_info *re;
1498 uint64_t integer;
1499 + int is_plugin;
1500
1501 -
1502 -/* Line 387 of yacc.c */
1503 -#line 176 "dtc-parser.tab.c"
1504 -} YYSTYPE;
1505 +#line 170 "dtc-parser.tab.c" /* yacc.c:355 */
1506 +};
1507 # define YYSTYPE_IS_TRIVIAL 1
1508 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1509 # define YYSTYPE_IS_DECLARED 1
1510 #endif
1511
1512 -extern YYSTYPE yylval;
1513 -
1514 -#ifdef YYPARSE_PARAM
1515 -#if defined __STDC__ || defined __cplusplus
1516 -int yyparse (void *YYPARSE_PARAM);
1517 -#else
1518 -int yyparse ();
1519 +/* Location type. */
1520 +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
1521 +typedef struct YYLTYPE YYLTYPE;
1522 +struct YYLTYPE
1523 +{
1524 + int first_line;
1525 + int first_column;
1526 + int last_line;
1527 + int last_column;
1528 +};
1529 +# define YYLTYPE_IS_DECLARED 1
1530 +# define YYLTYPE_IS_TRIVIAL 1
1531 #endif
1532 -#else /* ! YYPARSE_PARAM */
1533 -#if defined __STDC__ || defined __cplusplus
1534 +
1535 +
1536 +extern YYSTYPE yylval;
1537 +extern YYLTYPE yylloc;
1538 int yyparse (void);
1539 -#else
1540 -int yyparse ();
1541 -#endif
1542 -#endif /* ! YYPARSE_PARAM */
1543
1544 #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */
1545
1546 /* Copy the second part of user declarations. */
1547
1548 -/* Line 390 of yacc.c */
1549 -#line 204 "dtc-parser.tab.c"
1550 +#line 199 "dtc-parser.tab.c" /* yacc.c:358 */
1551
1552 #ifdef short
1553 # undef short
1554 @@ -214,11 +209,8 @@ typedef unsigned char yytype_uint8;
1555
1556 #ifdef YYTYPE_INT8
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;
1561 #else
1562 -typedef short int yytype_int8;
1563 +typedef signed char yytype_int8;
1564 #endif
1565
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
1576 # else
1577 @@ -261,11 +252,30 @@ typedef short int yytype_int16;
1578 # endif
1579 #endif
1580
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)
1591 +# else
1592 +# define YY_ATTRIBUTE(Spec) /* empty */
1593 +# endif
1594 +#endif
1595 +
1596 +#ifndef YY_ATTRIBUTE_PURE
1597 +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
1598 +#endif
1599 +
1600 +#ifndef YY_ATTRIBUTE_UNUSED
1601 +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
1602 +#endif
1603 +
1604 +#if !defined _Noreturn \
1605 + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
1606 +# if defined _MSC_VER && 1200 <= _MSC_VER
1607 +# define _Noreturn __declspec (noreturn)
1608 +# else
1609 +# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
1610 # endif
1611 #endif
1612
1613 @@ -276,24 +286,25 @@ typedef short int yytype_int16;
1614 # define YYUSE(E) /* empty */
1615 #endif
1616
1617 -
1618 -/* Identity function, used to suppress warnings about constant conditions. */
1619 -#ifndef lint
1620 -# define YYID(N) (N)
1621 -#else
1622 -#if (defined __STDC__ || defined __C99__FUNC__ \
1623 - || defined __cplusplus || defined _MSC_VER)
1624 -static int
1625 -YYID (int yyi)
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")
1634 #else
1635 -static int
1636 -YYID (yyi)
1637 - int yyi;
1638 +# define YY_INITIAL_VALUE(Value) Value
1639 #endif
1640 -{
1641 - return yyi;
1642 -}
1643 +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1644 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1645 +# define YY_IGNORE_MAYBE_UNINITIALIZED_END
1646 #endif
1647 +#ifndef YY_INITIAL_VALUE
1648 +# define YY_INITIAL_VALUE(Value) /* Nothing. */
1649 +#endif
1650 +
1651
1652 #if ! defined yyoverflow || YYERROR_VERBOSE
1653
1654 @@ -312,8 +323,7 @@ YYID (yyi)
1655 # define alloca _alloca
1656 # else
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)
1665 # endif
1666
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)
1676 # endif
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)
1685 # endif
1686 # ifndef YYMALLOC
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 */
1692 # endif
1693 # endif
1694 # ifndef YYFREE
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 */
1700 # endif
1701 # endif
1702 @@ -368,13 +376,15 @@ void free (void *); /* INFRINGES ON USER
1703
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)))
1709
1710 /* A type that is properly aligned for any stack member. */
1711 union yyalloc
1712 {
1713 yytype_int16 yyss_alloc;
1714 YYSTYPE yyvs_alloc;
1715 + YYLTYPE yyls_alloc;
1716 };
1717
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
1721 N elements. */
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)
1727
1728 # define YYCOPY_NEEDED 1
1729
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
1733 stack. */
1734 -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
1735 - do \
1736 - { \
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); \
1742 - } \
1743 - while (YYID (0))
1744 +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
1745 + do \
1746 + { \
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); \
1752 + } \
1753 + while (0)
1754
1755 #endif
1756
1757 @@ -421,7 +431,7 @@ union yyalloc
1758 for (yyi = 0; yyi < (Count); yyi++) \
1759 (Dst)[yyi] = (Src)[yyi]; \
1760 } \
1761 - while (YYID (0))
1762 + while (0)
1763 # endif
1764 # endif
1765 #endif /* !YYCOPY_NEEDED */
1766 @@ -429,25 +439,27 @@ union yyalloc
1767 /* YYFINAL -- State number of the termination state. */
1768 #define YYFINAL 4
1769 /* YYLAST -- Last index in YYTABLE. */
1770 -#define YYLAST 133
1771 +#define YYLAST 135
1772
1773 /* YYNTOKENS -- Number of terminals. */
1774 #define YYNTOKENS 48
1775 /* YYNNTS -- Number of nonterminals. */
1776 -#define YYNNTS 28
1777 +#define YYNNTS 29
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
1785
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
1791
1792 -#define YYTRANSLATE(YYX) \
1793 +#define YYTRANSLATE(YYX) \
1794 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1795
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[] =
1800 {
1801 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1802 @@ -481,63 +493,18 @@ static const yytype_uint8 yytranslate[]
1803 };
1804
1805 #if YYDEBUG
1806 -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1807 - YYRHS. */
1808 -static const yytype_uint16 yyprhs[] =
1809 -{
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
1818 -};
1819 -
1820 -/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1821 -static const yytype_int8 yyrhs[] =
1822 -{
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,
1849 - 75, -1
1850 -};
1851 -
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[] =
1855 {
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,
1872 + 466, 470
1873 };
1874 #endif
1875
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[] =
1879 {
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
1903 };
1904 #endif
1905
1906 # ifdef YYPRINT
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[] =
1912 {
1913 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1914 @@ -575,183 +542,173 @@ static const yytype_uint16 yytoknum[] =
1915 };
1916 # endif
1917
1918 -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1919 -static const yytype_uint8 yyr1[] =
1920 -{
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
1929 -};
1930 +#define YYPACT_NINF -41
1931
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)))
1936 +
1937 +#define YYTABLE_NINF -1
1938 +
1939 +#define yytable_value_is_error(Yytable_value) \
1940 + 0
1941 +
1942 + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1943 + STATE-NUM. */
1944 +static const yytype_int8 yypact[] =
1945 {
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,
1968 + 72, 8, 73, -41
1969 };
1970
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[] =
1978 {
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,
1998 - 22
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,
2007 + 0, 0, 0, 24
2008 };
2009
2010 -/* YYDEFGOTO[NTERM-NUM]. */
2011 -static const yytype_int8 yydefgoto[] =
2012 + /* YYPGOTO[NTERM-NUM]. */
2013 +static const yytype_int8 yypgoto[] =
2014 {
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
2021 };
2022
2023 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2024 - STATE-NUM. */
2025 -#define YYPACT_NINF -78
2026 -static const yytype_int8 yypact[] =
2027 + /* YYDEFGOTO[NTERM-NUM]. */
2028 +static const yytype_int16 yydefgoto[] =
2029 {
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,
2044 - -78
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
2048 };
2049
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[] =
2056 {
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
2074 };
2075
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[] =
2082 {
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,
2096 - 137, 0, 73, 139
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
2111 };
2112
2113 -#define yypact_value_is_default(Yystate) \
2114 - (!!((Yystate) == (-78)))
2115 -
2116 -#define yytable_value_is_error(Yytable_value) \
2117 - YYID (0)
2118 + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2119 + symbol of state STATE-NUM. */
2120 +static const yytype_uint8 yystos[] =
2121 +{
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,
2136 + 60, 34, 60, 35
2137 +};
2138
2139 -static const yytype_int16 yycheck[] =
2140 + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
2141 +static const yytype_uint8 yyr1[] =
2142 {
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,
2156 - 135, -1, 49, 138
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,
2165 + 76, 76
2166 };
2167
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[] =
2173 {
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,
2188 - 35
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,
2197 + 3, 2
2198 };
2199
2200 -#define yyerrok (yyerrstatus = 0)
2201 -#define yyclearin (yychar = YYEMPTY)
2202 -#define YYEMPTY (-2)
2203 -#define YYEOF 0
2204 -
2205 -#define YYACCEPT goto yyacceptlab
2206 -#define YYABORT goto yyabortlab
2207 -#define YYERROR goto yyerrorlab
2208 -
2209 -
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
2215 - discussed. */
2216 -
2217 -#define YYFAIL goto yyerrlab
2218 -#if defined YYFAIL
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. */
2223 -#endif
2224 +
2225 +#define yyerrok (yyerrstatus = 0)
2226 +#define yyclearin (yychar = YYEMPTY)
2227 +#define YYEMPTY (-2)
2228 +#define YYEOF 0
2229 +
2230 +#define YYACCEPT goto yyacceptlab
2231 +#define YYABORT goto yyabortlab
2232 +#define YYERROR goto yyerrorlab
2233 +
2234
2235 #define YYRECOVERING() (!!yyerrstatus)
2236
2237 @@ -768,27 +725,41 @@ do
2238 else \
2239 { \
2240 yyerror (YY_("syntax error: cannot back up")); \
2241 - YYERROR; \
2242 - } \
2243 -while (YYID (0))
2244 + YYERROR; \
2245 + } \
2246 +while (0)
2247
2248 /* Error token number */
2249 -#define YYTERROR 1
2250 -#define YYERRCODE 256
2251 +#define YYTERROR 1
2252 +#define YYERRCODE 256
2253
2254
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). */
2261 +
2262 +#ifndef YYLLOC_DEFAULT
2263 +# define YYLLOC_DEFAULT(Current, Rhs, N) \
2264 + do \
2265 + if (N) \
2266 + { \
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; \
2271 + } \
2272 + else \
2273 + { \
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; \
2278 + } \
2279 + while (0)
2280 #endif
2281
2282 +#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2283
2284 -/* YYLEX -- calling `yylex' with the right arguments. */
2285 -#ifdef YYLEX_PARAM
2286 -# define YYLEX yylex (YYLEX_PARAM)
2287 -#else
2288 -# define YYLEX yylex ()
2289 -#endif
2290
2291 /* Enable debugging if requested. */
2292 #if YYDEBUG
2293 @@ -798,50 +769,84 @@ while (YYID (0))
2294 # define YYFPRINTF fprintf
2295 # endif
2296
2297 -# define YYDPRINTF(Args) \
2298 -do { \
2299 - if (yydebug) \
2300 - YYFPRINTF Args; \
2301 -} while (YYID (0))
2302 -
2303 -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2304 -do { \
2305 - if (yydebug) \
2306 - { \
2307 - YYFPRINTF (stderr, "%s ", Title); \
2308 - yy_symbol_print (stderr, \
2309 - Type, Value); \
2310 - YYFPRINTF (stderr, "\n"); \
2311 - } \
2312 -} while (YYID (0))
2313 +# define YYDPRINTF(Args) \
2314 +do { \
2315 + if (yydebug) \
2316 + YYFPRINTF Args; \
2317 +} while (0)
2318
2319
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. */
2326
2327 -/*ARGSUSED*/
2328 -#if (defined __STDC__ || defined __C99__FUNC__ \
2329 - || defined __cplusplus || defined _MSC_VER)
2330 -static void
2331 -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2332 -#else
2333 -static void
2334 -yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2335 - FILE *yyoutput;
2336 - int yytype;
2337 - YYSTYPE const * const yyvaluep;
2338 +#ifndef YY_LOCATION_PRINT
2339 +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2340 +
2341 +/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
2342 +
2343 +YY_ATTRIBUTE_UNUSED
2344 +static unsigned
2345 +yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
2346 +{
2347 + unsigned res = 0;
2348 + int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
2349 + if (0 <= yylocp->first_line)
2350 + {
2351 + res += YYFPRINTF (yyo, "%d", yylocp->first_line);
2352 + if (0 <= yylocp->first_column)
2353 + res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
2354 + }
2355 + if (0 <= yylocp->last_line)
2356 + {
2357 + if (yylocp->first_line < yylocp->last_line)
2358 + {
2359 + res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
2360 + if (0 <= end_col)
2361 + res += YYFPRINTF (yyo, ".%d", end_col);
2362 + }
2363 + else if (0 <= end_col && yylocp->first_column < end_col)
2364 + res += YYFPRINTF (yyo, "-%d", end_col);
2365 + }
2366 + return res;
2367 + }
2368 +
2369 +# define YY_LOCATION_PRINT(File, Loc) \
2370 + yy_location_print_ (File, &(Loc))
2371 +
2372 +# else
2373 +# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2374 +# endif
2375 #endif
2376 +
2377 +
2378 +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2379 +do { \
2380 + if (yydebug) \
2381 + { \
2382 + YYFPRINTF (stderr, "%s ", Title); \
2383 + yy_symbol_print (stderr, \
2384 + Type, Value, Location); \
2385 + YYFPRINTF (stderr, "\n"); \
2386 + } \
2387 +} while (0)
2388 +
2389 +
2390 +/*----------------------------------------.
2391 +| Print this symbol's value on YYOUTPUT. |
2392 +`----------------------------------------*/
2393 +
2394 +static void
2395 +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
2396 {
2397 FILE *yyo = yyoutput;
2398 YYUSE (yyo);
2399 + YYUSE (yylocationp);
2400 if (!yyvaluep)
2401 return;
2402 # ifdef YYPRINT
2403 if (yytype < YYNTOKENS)
2404 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2405 -# else
2406 - YYUSE (yyoutput);
2407 # endif
2408 YYUSE (yytype);
2409 }
2410 @@ -851,24 +856,15 @@ yy_symbol_value_print (yyoutput, yytype,
2411 | Print this symbol on YYOUTPUT. |
2412 `--------------------------------*/
2413
2414 -#if (defined __STDC__ || defined __C99__FUNC__ \
2415 - || defined __cplusplus || defined _MSC_VER)
2416 -static void
2417 -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2418 -#else
2419 static void
2420 -yy_symbol_print (yyoutput, yytype, yyvaluep)
2421 - FILE *yyoutput;
2422 - int yytype;
2423 - YYSTYPE const * const yyvaluep;
2424 -#endif
2425 +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
2426 {
2427 - if (yytype < YYNTOKENS)
2428 - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2429 - else
2430 - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2431 + YYFPRINTF (yyoutput, "%s %s (",
2432 + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
2433
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, ")");
2439 }
2440
2441 @@ -877,16 +873,8 @@ yy_symbol_print (yyoutput, yytype, yyval
2442 | TOP (included). |
2443 `------------------------------------------------------------------*/
2444
2445 -#if (defined __STDC__ || defined __C99__FUNC__ \
2446 - || defined __cplusplus || defined _MSC_VER)
2447 static void
2448 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
2449 -#else
2450 -static void
2451 -yy_stack_print (yybottom, yytop)
2452 - yytype_int16 *yybottom;
2453 - yytype_int16 *yytop;
2454 -#endif
2455 {
2456 YYFPRINTF (stderr, "Stack now");
2457 for (; yybottom <= yytop; yybottom++)
2458 @@ -897,49 +885,42 @@ yy_stack_print (yybottom, yytop)
2459 YYFPRINTF (stderr, "\n");
2460 }
2461
2462 -# define YY_STACK_PRINT(Bottom, Top) \
2463 -do { \
2464 - if (yydebug) \
2465 - yy_stack_print ((Bottom), (Top)); \
2466 -} while (YYID (0))
2467 +# define YY_STACK_PRINT(Bottom, Top) \
2468 +do { \
2469 + if (yydebug) \
2470 + yy_stack_print ((Bottom), (Top)); \
2471 +} while (0)
2472
2473
2474 /*------------------------------------------------.
2475 | Report that the YYRULE is going to be reduced. |
2476 `------------------------------------------------*/
2477
2478 -#if (defined __STDC__ || defined __C99__FUNC__ \
2479 - || defined __cplusplus || defined _MSC_VER)
2480 -static void
2481 -yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2482 -#else
2483 static void
2484 -yy_reduce_print (yyvsp, yyrule)
2485 - YYSTYPE *yyvsp;
2486 - int yyrule;
2487 -#endif
2488 +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
2489 {
2490 + unsigned long int yylno = yyrline[yyrule];
2491 int yynrhs = yyr2[yyrule];
2492 int yyi;
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++)
2499 {
2500 YYFPRINTF (stderr, " $%d = ", yyi + 1);
2501 - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2502 - &(yyvsp[(yyi + 1) - (yynrhs)])
2503 - );
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");
2509 }
2510 }
2511
2512 -# define YY_REDUCE_PRINT(Rule) \
2513 -do { \
2514 - if (yydebug) \
2515 - yy_reduce_print (yyvsp, Rule); \
2516 -} while (YYID (0))
2517 +# define YY_REDUCE_PRINT(Rule) \
2518 +do { \
2519 + if (yydebug) \
2520 + yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
2521 +} while (0)
2522
2523 /* Nonzero means print parse trace. It is left uninitialized so that
2524 multiple parsers can coexist. */
2525 @@ -953,7 +934,7 @@ int yydebug;
2526
2527
2528 /* YYINITDEPTH -- initial size of the parser's stacks. */
2529 -#ifndef YYINITDEPTH
2530 +#ifndef YYINITDEPTH
2531 # define YYINITDEPTH 200
2532 #endif
2533
2534 @@ -976,15 +957,8 @@ int yydebug;
2535 # define yystrlen strlen
2536 # else
2537 /* Return the length of YYSTR. */
2538 -#if (defined __STDC__ || defined __C99__FUNC__ \
2539 - || defined __cplusplus || defined _MSC_VER)
2540 static YYSIZE_T
2541 yystrlen (const char *yystr)
2542 -#else
2543 -static YYSIZE_T
2544 -yystrlen (yystr)
2545 - const char *yystr;
2546 -#endif
2547 {
2548 YYSIZE_T yylen;
2549 for (yylen = 0; yystr[yylen]; yylen++)
2550 @@ -1000,16 +974,8 @@ yystrlen (yystr)
2551 # else
2552 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2553 YYDEST. */
2554 -#if (defined __STDC__ || defined __C99__FUNC__ \
2555 - || defined __cplusplus || defined _MSC_VER)
2556 static char *
2557 yystpcpy (char *yydest, const char *yysrc)
2558 -#else
2559 -static char *
2560 -yystpcpy (yydest, yysrc)
2561 - char *yydest;
2562 - const char *yysrc;
2563 -#endif
2564 {
2565 char *yyd = yydest;
2566 const char *yys = yysrc;
2567 @@ -1039,27 +1005,27 @@ yytnamerr (char *yyres, const char *yyst
2568 char const *yyp = yystr;
2569
2570 for (;;)
2571 - switch (*++yyp)
2572 - {
2573 - case '\'':
2574 - case ',':
2575 - goto do_not_strip_quotes;
2576 -
2577 - case '\\':
2578 - if (*++yyp != '\\')
2579 - goto do_not_strip_quotes;
2580 - /* Fall through. */
2581 - default:
2582 - if (yyres)
2583 - yyres[yyn] = *yyp;
2584 - yyn++;
2585 - break;
2586 -
2587 - case '"':
2588 - if (yyres)
2589 - yyres[yyn] = '\0';
2590 - return yyn;
2591 - }
2592 + switch (*++yyp)
2593 + {
2594 + case '\'':
2595 + case ',':
2596 + goto do_not_strip_quotes;
2597 +
2598 + case '\\':
2599 + if (*++yyp != '\\')
2600 + goto do_not_strip_quotes;
2601 + /* Fall through. */
2602 + default:
2603 + if (yyres)
2604 + yyres[yyn] = *yyp;
2605 + yyn++;
2606 + break;
2607 +
2608 + case '"':
2609 + if (yyres)
2610 + yyres[yyn] = '\0';
2611 + return yyn;
2612 + }
2613 do_not_strip_quotes: ;
2614 }
2615
2616 @@ -1082,11 +1048,11 @@ static int
2617 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
2618 yytype_int16 *yyssp, int yytoken)
2619 {
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
2631 int yycount = 0;
2632
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
2637 - function.
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
2642 }
2643 yyarg[yycount++] = yytname[yyx];
2644 {
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))
2649 return 2;
2650 @@ -1214,26 +1176,18 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, c
2651 | Release the memory associated to this symbol. |
2652 `-----------------------------------------------*/
2653
2654 -/*ARGSUSED*/
2655 -#if (defined __STDC__ || defined __C99__FUNC__ \
2656 - || defined __cplusplus || defined _MSC_VER)
2657 -static void
2658 -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2659 -#else
2660 static void
2661 -yydestruct (yymsg, yytype, yyvaluep)
2662 - const char *yymsg;
2663 - int yytype;
2664 - YYSTYPE *yyvaluep;
2665 -#endif
2666 +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
2667 {
2668 YYUSE (yyvaluep);
2669 -
2670 + YYUSE (yylocationp);
2671 if (!yymsg)
2672 yymsg = "Deleting";
2673 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2674
2675 + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2676 YYUSE (yytype);
2677 + YY_IGNORE_MAYBE_UNINITIALIZED_END
2678 }
2679
2680
2681 @@ -1242,18 +1196,14 @@ yydestruct (yymsg, yytype, yyvaluep)
2682 /* The lookahead symbol. */
2683 int yychar;
2684
2685 -
2686 -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2687 -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2688 -# define YY_IGNORE_MAYBE_UNINITIALIZED_END
2689 -#endif
2690 -#ifndef YY_INITIAL_VALUE
2691 -# define YY_INITIAL_VALUE(Value) /* Nothing. */
2692 -#endif
2693 -
2694 /* The semantic value of the lookahead symbol. */
2695 -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
2696 -
2697 +YYSTYPE yylval;
2698 +/* Location data for the lookahead symbol. */
2699 +YYLTYPE yylloc
2700 +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2701 + = { 1, 1, 1, 1 }
2702 +# endif
2703 +;
2704 /* Number of syntax errors so far. */
2705 int yynerrs;
2706
2707 @@ -1262,35 +1212,17 @@ int yynerrs;
2708 | yyparse. |
2709 `----------*/
2710
2711 -#ifdef YYPARSE_PARAM
2712 -#if (defined __STDC__ || defined __C99__FUNC__ \
2713 - || defined __cplusplus || defined _MSC_VER)
2714 -int
2715 -yyparse (void *YYPARSE_PARAM)
2716 -#else
2717 -int
2718 -yyparse (YYPARSE_PARAM)
2719 - void *YYPARSE_PARAM;
2720 -#endif
2721 -#else /* ! YYPARSE_PARAM */
2722 -#if (defined __STDC__ || defined __C99__FUNC__ \
2723 - || defined __cplusplus || defined _MSC_VER)
2724 int
2725 yyparse (void)
2726 -#else
2727 -int
2728 -yyparse ()
2729 -
2730 -#endif
2731 -#endif
2732 {
2733 int yystate;
2734 /* Number of tokens to shift before error messages enabled. */
2735 int yyerrstatus;
2736
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.
2743
2744 Refer to the stacks through separate pointers, to allow yyoverflow
2745 to reallocate them elsewhere. */
2746 @@ -1305,6 +1237,14 @@ yyparse ()
2747 YYSTYPE *yyvs;
2748 YYSTYPE *yyvsp;
2749
2750 + /* The location stack. */
2751 + YYLTYPE yylsa[YYINITDEPTH];
2752 + YYLTYPE *yyls;
2753 + YYLTYPE *yylsp;
2754 +
2755 + /* The locations where the error started and ended. */
2756 + YYLTYPE yyerror_range[3];
2757 +
2758 YYSIZE_T yystacksize;
2759
2760 int yyn;
2761 @@ -1314,6 +1254,7 @@ yyparse ()
2762 /* The variables used to return semantic value and location from the
2763 action routines. */
2764 YYSTYPE yyval;
2765 + YYLTYPE yyloc;
2766
2767 #if YYERROR_VERBOSE
2768 /* Buffer for error messages, and its allocated size. */
2769 @@ -1322,7 +1263,7 @@ yyparse ()
2770 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
2771 #endif
2772
2773 -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
2774 +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
2775
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 ()
2779
2780 yyssp = yyss = yyssa;
2781 yyvsp = yyvs = yyvsa;
2782 + yylsp = yyls = yylsa;
2783 yystacksize = YYINITDEPTH;
2784
2785 YYDPRINTF ((stderr, "Starting parse\n"));
2786 @@ -1338,6 +1280,7 @@ yyparse ()
2787 yyerrstatus = 0;
2788 yynerrs = 0;
2789 yychar = YYEMPTY; /* Cause a token to be read. */
2790 + yylsp[0] = yylloc;
2791 goto yysetstate;
2792
2793 /*------------------------------------------------------------.
2794 @@ -1358,23 +1301,26 @@ yyparse ()
2795
2796 #ifdef yyoverflow
2797 {
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
2800 - memory. */
2801 - YYSTYPE *yyvs1 = yyvs;
2802 - yytype_int16 *yyss1 = yyss;
2803 -
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),
2811 - &yystacksize);
2812 -
2813 - yyss = yyss1;
2814 - yyvs = yyvs1;
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
2817 + memory. */
2818 + YYSTYPE *yyvs1 = yyvs;
2819 + yytype_int16 *yyss1 = yyss;
2820 + YYLTYPE *yyls1 = yyls;
2821 +
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),
2830 + &yystacksize);
2831 +
2832 + yyls = yyls1;
2833 + yyss = yyss1;
2834 + yyvs = yyvs1;
2835 }
2836 #else /* no yyoverflow */
2837 # ifndef YYSTACK_RELOCATE
2838 @@ -1382,34 +1328,36 @@ yyparse ()
2839 # else
2840 /* Extend the stack our own way. */
2841 if (YYMAXDEPTH <= yystacksize)
2842 - goto yyexhaustedlab;
2843 + goto yyexhaustedlab;
2844 yystacksize *= 2;
2845 if (YYMAXDEPTH < yystacksize)
2846 - yystacksize = YYMAXDEPTH;
2847 + yystacksize = YYMAXDEPTH;
2848
2849 {
2850 - yytype_int16 *yyss1 = yyss;
2851 - union yyalloc *yyptr =
2852 - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2853 - if (! yyptr)
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));
2860 + if (! yyptr)
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);
2870 }
2871 # endif
2872 #endif /* no yyoverflow */
2873
2874 yyssp = yyss + yysize - 1;
2875 yyvsp = yyvs + yysize - 1;
2876 + yylsp = yyls + yysize - 1;
2877
2878 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2879 - (unsigned long int) yystacksize));
2880 + (unsigned long int) yystacksize));
2881
2882 if (yyss + yystacksize - 1 <= yyssp)
2883 - YYABORT;
2884 + YYABORT;
2885 }
2886
2887 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2888 @@ -1438,7 +1386,7 @@ yybackup:
2889 if (yychar == YYEMPTY)
2890 {
2891 YYDPRINTF ((stderr, "Reading a token: "));
2892 - yychar = YYLEX;
2893 + yychar = yylex ();
2894 }
2895
2896 if (yychar <= YYEOF)
2897 @@ -1481,7 +1429,7 @@ yybackup:
2898 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2899 *++yyvsp = yylval;
2900 YY_IGNORE_MAYBE_UNINITIALIZED_END
2901 -
2902 + *++yylsp = yylloc;
2903 goto yynewstate;
2904
2905
2906 @@ -1503,7 +1451,7 @@ yyreduce:
2907 yylen = yyr2[yyn];
2908
2909 /* If YYLEN is nonzero, implement the default value of the action:
2910 - `$$ = $1'.
2911 + '$$ = $1'.
2912
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];
2918
2919 -
2920 + /* Default location. */
2921 + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
2922 YY_REDUCE_PRINT (yyn);
2923 switch (yyn)
2924 {
2925 case 2:
2926 -/* Line 1787 of yacc.c */
2927 -#line 110 "dtc-parser.y"
2928 +#line 109 "dtc-parser.y" /* yacc.c:1646 */
2929 {
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)));
2936 }
2937 +#line 1477 "dtc-parser.tab.c" /* yacc.c:1646 */
2938 break;
2939
2940 case 3:
2941 -/* Line 1787 of yacc.c */
2942 -#line 118 "dtc-parser.y"
2943 +#line 119 "dtc-parser.y" /* yacc.c:1646 */
2944 {
2945 - (yyval.re) = NULL;
2946 + (yyval.is_plugin) = 0;
2947 }
2948 +#line 1485 "dtc-parser.tab.c" /* yacc.c:1646 */
2949 break;
2950
2951 case 4:
2952 -/* Line 1787 of yacc.c */
2953 -#line 122 "dtc-parser.y"
2954 +#line 123 "dtc-parser.y" /* yacc.c:1646 */
2955 {
2956 - (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
2957 + (yyval.is_plugin) = 1;
2958 }
2959 +#line 1493 "dtc-parser.tab.c" /* yacc.c:1646 */
2960 break;
2961
2962 case 5:
2963 -/* Line 1787 of yacc.c */
2964 -#line 129 "dtc-parser.y"
2965 +#line 130 "dtc-parser.y" /* yacc.c:1646 */
2966 {
2967 - (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer));
2968 + (yyval.re) = NULL;
2969 }
2970 +#line 1501 "dtc-parser.tab.c" /* yacc.c:1646 */
2971 break;
2972
2973 case 6:
2974 -/* Line 1787 of yacc.c */
2975 -#line 133 "dtc-parser.y"
2976 +#line 134 "dtc-parser.y" /* yacc.c:1646 */
2977 {
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));
2981 }
2982 +#line 1509 "dtc-parser.tab.c" /* yacc.c:1646 */
2983 break;
2984
2985 case 7:
2986 -/* Line 1787 of yacc.c */
2987 -#line 141 "dtc-parser.y"
2988 +#line 141 "dtc-parser.y" /* yacc.c:1646 */
2989 {
2990 - (yyval.node) = name_node((yyvsp[(2) - (2)].node), "");
2991 + (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer));
2992 }
2993 +#line 1517 "dtc-parser.tab.c" /* yacc.c:1646 */
2994 break;
2995
2996 case 8:
2997 -/* Line 1787 of yacc.c */
2998 -#line 145 "dtc-parser.y"
2999 +#line 145 "dtc-parser.y" /* yacc.c:1646 */
3000 {
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);
3004 }
3005 +#line 1526 "dtc-parser.tab.c" /* yacc.c:1646 */
3006 break;
3007
3008 case 9:
3009 -/* Line 1787 of yacc.c */
3010 -#line 149 "dtc-parser.y"
3011 +#line 153 "dtc-parser.y" /* yacc.c:1646 */
3012 {
3013 - struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref));
3014 -
3015 - if (target)
3016 - merge_nodes(target, (yyvsp[(3) - (3)].node));
3017 - else
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), "");
3021 }
3022 +#line 1534 "dtc-parser.tab.c" /* yacc.c:1646 */
3023 break;
3024
3025 case 10:
3026 -/* Line 1787 of yacc.c */
3027 -#line 159 "dtc-parser.y"
3028 +#line 157 "dtc-parser.y" /* yacc.c:1646 */
3029 {
3030 - struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref));
3031 -
3032 - if (!target)
3033 - print_error("label or path, '%s', not found", (yyvsp[(3) - (4)].labelref));
3034 - else
3035 - delete_node(target);
3036 -
3037 - (yyval.node) = (yyvsp[(1) - (4)].node);
3038 + (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node));
3039 }
3040 +#line 1542 "dtc-parser.tab.c" /* yacc.c:1646 */
3041 break;
3042
3043 case 11:
3044 -/* Line 1787 of yacc.c */
3045 -#line 173 "dtc-parser.y"
3046 +#line 161 "dtc-parser.y" /* yacc.c:1646 */
3047 {
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));
3050 +
3051 + if (target)
3052 + merge_nodes(target, (yyvsp[0].node));
3053 + else
3054 + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
3055 + (yyval.node) = (yyvsp[-2].node);
3056 }
3057 +#line 1556 "dtc-parser.tab.c" /* yacc.c:1646 */
3058 break;
3059
3060 case 12:
3061 -/* Line 1787 of yacc.c */
3062 -#line 180 "dtc-parser.y"
3063 +#line 171 "dtc-parser.y" /* yacc.c:1646 */
3064 {
3065 - (yyval.proplist) = NULL;
3066 + struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref));
3067 +
3068 + if (target)
3069 + delete_node(target);
3070 + else
3071 + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
3072 +
3073 +
3074 + (yyval.node) = (yyvsp[-3].node);
3075 }
3076 +#line 1572 "dtc-parser.tab.c" /* yacc.c:1646 */
3077 break;
3078
3079 case 13:
3080 -/* Line 1787 of yacc.c */
3081 -#line 184 "dtc-parser.y"
3082 +#line 186 "dtc-parser.y" /* yacc.c:1646 */
3083 {
3084 - (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist));
3085 + (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist));
3086 }
3087 +#line 1580 "dtc-parser.tab.c" /* yacc.c:1646 */
3088 break;
3089
3090 case 14:
3091 -/* Line 1787 of yacc.c */
3092 -#line 191 "dtc-parser.y"
3093 +#line 193 "dtc-parser.y" /* yacc.c:1646 */
3094 {
3095 - (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data));
3096 + (yyval.proplist) = NULL;
3097 }
3098 +#line 1588 "dtc-parser.tab.c" /* yacc.c:1646 */
3099 break;
3100
3101 case 15:
3102 -/* Line 1787 of yacc.c */
3103 -#line 195 "dtc-parser.y"
3104 +#line 197 "dtc-parser.y" /* yacc.c:1646 */
3105 {
3106 - (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data);
3107 + (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist));
3108 }
3109 +#line 1596 "dtc-parser.tab.c" /* yacc.c:1646 */
3110 break;
3111
3112 case 16:
3113 -/* Line 1787 of yacc.c */
3114 -#line 199 "dtc-parser.y"
3115 +#line 204 "dtc-parser.y" /* yacc.c:1646 */
3116 {
3117 - (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename));
3118 + (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data));
3119 }
3120 +#line 1604 "dtc-parser.tab.c" /* yacc.c:1646 */
3121 break;
3122
3123 case 17:
3124 -/* Line 1787 of yacc.c */
3125 -#line 203 "dtc-parser.y"
3126 +#line 208 "dtc-parser.y" /* yacc.c:1646 */
3127 {
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);
3131 }
3132 +#line 1612 "dtc-parser.tab.c" /* yacc.c:1646 */
3133 break;
3134
3135 case 18:
3136 -/* Line 1787 of yacc.c */
3137 -#line 211 "dtc-parser.y"
3138 +#line 212 "dtc-parser.y" /* yacc.c:1646 */
3139 {
3140 - (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data));
3141 + (yyval.prop) = build_property_delete((yyvsp[-1].propnodename));
3142 }
3143 +#line 1620 "dtc-parser.tab.c" /* yacc.c:1646 */
3144 break;
3145
3146 case 19:
3147 -/* Line 1787 of yacc.c */
3148 -#line 215 "dtc-parser.y"
3149 +#line 216 "dtc-parser.y" /* yacc.c:1646 */
3150 {
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);
3154 }
3155 +#line 1629 "dtc-parser.tab.c" /* yacc.c:1646 */
3156 break;
3157
3158 case 20:
3159 -/* Line 1787 of yacc.c */
3160 -#line 219 "dtc-parser.y"
3161 +#line 224 "dtc-parser.y" /* yacc.c:1646 */
3162 {
3163 - (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
3164 + (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data));
3165 }
3166 +#line 1637 "dtc-parser.tab.c" /* yacc.c:1646 */
3167 break;
3168
3169 case 21:
3170 -/* Line 1787 of yacc.c */
3171 -#line 223 "dtc-parser.y"
3172 +#line 228 "dtc-parser.y" /* yacc.c:1646 */
3173 {
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);
3176 }
3177 +#line 1645 "dtc-parser.tab.c" /* yacc.c:1646 */
3178 break;
3179
3180 case 22:
3181 -/* Line 1787 of yacc.c */
3182 -#line 227 "dtc-parser.y"
3183 +#line 232 "dtc-parser.y" /* yacc.c:1646 */
3184 {
3185 - FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL);
3186 + (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data));
3187 + }
3188 +#line 1653 "dtc-parser.tab.c" /* yacc.c:1646 */
3189 + break;
3190 +
3191 + case 23:
3192 +#line 236 "dtc-parser.y" /* yacc.c:1646 */
3193 + {
3194 + (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref));
3195 + }
3196 +#line 1661 "dtc-parser.tab.c" /* yacc.c:1646 */
3197 + break;
3198 +
3199 + case 24:
3200 +#line 240 "dtc-parser.y" /* yacc.c:1646 */
3201 + {
3202 + FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL);
3203 struct data d;
3204
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,
3210 - strerror(errno));
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,
3215 + strerror(errno));
3216
3217 - d = data_copy_file(f, (yyvsp[(8) - (9)].integer));
3218 + d = data_copy_file(f, (yyvsp[-1].integer));
3219
3220 - (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d);
3221 + (yyval.data) = data_merge((yyvsp[-8].data), d);
3222 fclose(f);
3223 }
3224 +#line 1681 "dtc-parser.tab.c" /* yacc.c:1646 */
3225 break;
3226
3227 - case 23:
3228 -/* Line 1787 of yacc.c */
3229 -#line 244 "dtc-parser.y"
3230 + case 25:
3231 +#line 256 "dtc-parser.y" /* yacc.c:1646 */
3232 {
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;
3236
3237 d = data_copy_file(f, -1);
3238
3239 - (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d);
3240 + (yyval.data) = data_merge((yyvsp[-4].data), d);
3241 fclose(f);
3242 }
3243 +#line 1695 "dtc-parser.tab.c" /* yacc.c:1646 */
3244 break;
3245
3246 - case 24:
3247 -/* Line 1787 of yacc.c */
3248 -#line 254 "dtc-parser.y"
3249 + case 26:
3250 +#line 266 "dtc-parser.y" /* yacc.c:1646 */
3251 {
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));
3254 }
3255 +#line 1703 "dtc-parser.tab.c" /* yacc.c:1646 */
3256 break;
3257
3258 - case 25:
3259 -/* Line 1787 of yacc.c */
3260 -#line 261 "dtc-parser.y"
3261 + case 27:
3262 +#line 273 "dtc-parser.y" /* yacc.c:1646 */
3263 {
3264 (yyval.data) = empty_data;
3265 }
3266 +#line 1711 "dtc-parser.tab.c" /* yacc.c:1646 */
3267 break;
3268
3269 - case 26:
3270 -/* Line 1787 of yacc.c */
3271 -#line 265 "dtc-parser.y"
3272 + case 28:
3273 +#line 277 "dtc-parser.y" /* yacc.c:1646 */
3274 {
3275 - (yyval.data) = (yyvsp[(1) - (2)].data);
3276 + (yyval.data) = (yyvsp[-1].data);
3277 }
3278 +#line 1719 "dtc-parser.tab.c" /* yacc.c:1646 */
3279 break;
3280
3281 - case 27:
3282 -/* Line 1787 of yacc.c */
3283 -#line 269 "dtc-parser.y"
3284 + case 29:
3285 +#line 281 "dtc-parser.y" /* yacc.c:1646 */
3286 {
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));
3289 }
3290 +#line 1727 "dtc-parser.tab.c" /* yacc.c:1646 */
3291 break;
3292
3293 - case 28:
3294 -/* Line 1787 of yacc.c */
3295 -#line 276 "dtc-parser.y"
3296 + case 30:
3297 +#line 288 "dtc-parser.y" /* yacc.c:1646 */
3298 {
3299 - (yyval.array).data = empty_data;
3300 - (yyval.array).bits = eval_literal((yyvsp[(2) - (3)].literal), 0, 7);
3301 + unsigned long long bits;
3302
3303 - if (((yyval.array).bits != 8) &&
3304 - ((yyval.array).bits != 16) &&
3305 - ((yyval.array).bits != 32) &&
3306 - ((yyval.array).bits != 64))
3307 - {
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);
3312 +
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");
3317 + bits = 32;
3318 }
3319 +
3320 + (yyval.array).data = empty_data;
3321 + (yyval.array).bits = bits;
3322 }
3323 +#line 1747 "dtc-parser.tab.c" /* yacc.c:1646 */
3324 break;
3325
3326 - case 29:
3327 -/* Line 1787 of yacc.c */
3328 -#line 291 "dtc-parser.y"
3329 + case 31:
3330 +#line 304 "dtc-parser.y" /* yacc.c:1646 */
3331 {
3332 (yyval.array).data = empty_data;
3333 (yyval.array).bits = 32;
3334 }
3335 +#line 1756 "dtc-parser.tab.c" /* yacc.c:1646 */
3336 break;
3337
3338 - case 30:
3339 -/* Line 1787 of yacc.c */
3340 -#line 296 "dtc-parser.y"
3341 + case 32:
3342 +#line 309 "dtc-parser.y" /* yacc.c:1646 */
3343 {
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;
3348 /*
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.
3354 */
3355 - if (((yyvsp[(2) - (2)].integer) > mask) && (((yyvsp[(2) - (2)].integer) | mask) != -1ULL))
3356 - print_error(
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);
3362 }
3363
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);
3366 }
3367 +#line 1779 "dtc-parser.tab.c" /* yacc.c:1646 */
3368 break;
3369
3370 - case 31:
3371 -/* Line 1787 of yacc.c */
3372 -#line 316 "dtc-parser.y"
3373 + case 33:
3374 +#line 328 "dtc-parser.y" /* yacc.c:1646 */
3375 {
3376 - uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits);
3377 + uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits);
3378
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,
3383 REF_PHANDLE,
3384 - (yyvsp[(2) - (2)].labelref));
3385 + (yyvsp[0].labelref));
3386 else
3387 - print_error("References are only allowed in "
3388 + ERROR(&(yylsp[0]), "References are only allowed in "
3389 "arrays with 32-bit elements.");
3390
3391 - (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits);
3392 - }
3393 - break;
3394 -
3395 - case 32:
3396 -/* Line 1787 of yacc.c */
3397 -#line 330 "dtc-parser.y"
3398 - {
3399 - (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref));
3400 - }
3401 - break;
3402 -
3403 - case 33:
3404 -/* Line 1787 of yacc.c */
3405 -#line 337 "dtc-parser.y"
3406 - {
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);
3409 }
3410 +#line 1797 "dtc-parser.tab.c" /* yacc.c:1646 */
3411 break;
3412
3413 case 34:
3414 -/* Line 1787 of yacc.c */
3415 -#line 341 "dtc-parser.y"
3416 +#line 342 "dtc-parser.y" /* yacc.c:1646 */
3417 {
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));
3420 }
3421 +#line 1805 "dtc-parser.tab.c" /* yacc.c:1646 */
3422 break;
3423
3424 - case 35:
3425 -/* Line 1787 of yacc.c */
3426 -#line 345 "dtc-parser.y"
3427 + case 37:
3428 +#line 351 "dtc-parser.y" /* yacc.c:1646 */
3429 {
3430 - (yyval.integer) = (yyvsp[(2) - (3)].integer);
3431 + (yyval.integer) = (yyvsp[-1].integer);
3432 }
3433 - break;
3434 -
3435 - case 38:
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 */
3440 break;
3441
3442 case 40:
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 */
3449 break;
3450
3451 case 42:
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 */
3458 break;
3459
3460 case 44:
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 */
3467 break;
3468
3469 case 46:
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 */
3476 break;
3477
3478 case 48:
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 */
3485 break;
3486
3487 case 50:
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 */
3494 break;
3495
3496 - case 51:
3497 -/* Line 1787 of yacc.c */
3498 -#line 387 "dtc-parser.y"
3499 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); }
3500 + case 52:
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 */
3504 break;
3505
3506 case 53:
3507 -/* Line 1787 of yacc.c */
3508 -#line 392 "dtc-parser.y"
3509 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); }
3510 - break;
3511 -
3512 - case 54:
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 */
3519 break;
3520
3521 case 55:
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 */
3528 break;
3529
3530 case 56:
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 */
3537 break;
3538
3539 case 57:
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 */
3546 break;
3547
3548 case 58:
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 */
3555 break;
3556
3557 - case 60:
3558 -/* Line 1787 of yacc.c */
3559 -#line 405 "dtc-parser.y"
3560 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); }
3561 + case 59:
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 */
3565 break;
3566
3567 - case 61:
3568 -/* Line 1787 of yacc.c */
3569 -#line 406 "dtc-parser.y"
3570 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); }
3571 + case 60:
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 */
3575 break;
3576
3577 - case 63:
3578 -/* Line 1787 of yacc.c */
3579 -#line 411 "dtc-parser.y"
3580 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); }
3581 + case 62:
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 */
3585 break;
3586
3587 - case 64:
3588 -/* Line 1787 of yacc.c */
3589 -#line 412 "dtc-parser.y"
3590 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); }
3591 + case 63:
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 */
3595 break;
3596
3597 case 65:
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 */
3604 break;
3605
3606 - case 68:
3607 -/* Line 1787 of yacc.c */
3608 -#line 419 "dtc-parser.y"
3609 - { (yyval.integer) = -(yyvsp[(2) - (2)].integer); }
3610 + case 66:
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 */
3614 break;
3615
3616 - case 69:
3617 -/* Line 1787 of yacc.c */
3618 -#line 420 "dtc-parser.y"
3619 - { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); }
3620 + case 67:
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 */
3624 break;
3625
3626 case 70:
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 */
3633 break;
3634
3635 case 71:
3636 -/* Line 1787 of yacc.c */
3637 -#line 426 "dtc-parser.y"
3638 - {
3639 - (yyval.data) = empty_data;
3640 - }
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 */
3644 break;
3645
3646 case 72:
3647 -/* Line 1787 of yacc.c */
3648 -#line 430 "dtc-parser.y"
3649 - {
3650 - (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte));
3651 - }
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 */
3655 break;
3656
3657 case 73:
3658 -/* Line 1787 of yacc.c */
3659 -#line 434 "dtc-parser.y"
3660 +#line 432 "dtc-parser.y" /* yacc.c:1646 */
3661 {
3662 - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
3663 + (yyval.data) = empty_data;
3664 }
3665 +#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */
3666 break;
3667
3668 case 74:
3669 -/* Line 1787 of yacc.c */
3670 -#line 441 "dtc-parser.y"
3671 +#line 436 "dtc-parser.y" /* yacc.c:1646 */
3672 {
3673 - (yyval.nodelist) = NULL;
3674 + (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte));
3675 }
3676 +#line 1961 "dtc-parser.tab.c" /* yacc.c:1646 */
3677 break;
3678
3679 case 75:
3680 -/* Line 1787 of yacc.c */
3681 -#line 445 "dtc-parser.y"
3682 +#line 440 "dtc-parser.y" /* yacc.c:1646 */
3683 {
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));
3686 }
3687 +#line 1969 "dtc-parser.tab.c" /* yacc.c:1646 */
3688 break;
3689
3690 case 76:
3691 -/* Line 1787 of yacc.c */
3692 -#line 449 "dtc-parser.y"
3693 +#line 447 "dtc-parser.y" /* yacc.c:1646 */
3694 {
3695 - print_error("syntax error: properties must precede subnodes");
3696 - YYERROR;
3697 + (yyval.nodelist) = NULL;
3698 }
3699 +#line 1977 "dtc-parser.tab.c" /* yacc.c:1646 */
3700 break;
3701
3702 case 77:
3703 -/* Line 1787 of yacc.c */
3704 -#line 457 "dtc-parser.y"
3705 +#line 451 "dtc-parser.y" /* yacc.c:1646 */
3706 {
3707 - (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename));
3708 + (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist));
3709 }
3710 +#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */
3711 break;
3712
3713 case 78:
3714 -/* Line 1787 of yacc.c */
3715 -#line 461 "dtc-parser.y"
3716 +#line 455 "dtc-parser.y" /* yacc.c:1646 */
3717 {
3718 - (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename));
3719 + ERROR(&(yylsp[0]), "Properties must precede subnodes");
3720 + YYERROR;
3721 }
3722 +#line 1994 "dtc-parser.tab.c" /* yacc.c:1646 */
3723 break;
3724
3725 case 79:
3726 -/* Line 1787 of yacc.c */
3727 -#line 465 "dtc-parser.y"
3728 +#line 463 "dtc-parser.y" /* yacc.c:1646 */
3729 {
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));
3733 }
3734 +#line 2002 "dtc-parser.tab.c" /* yacc.c:1646 */
3735 break;
3736
3737 + case 80:
3738 +#line 467 "dtc-parser.y" /* yacc.c:1646 */
3739 + {
3740 + (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename));
3741 + }
3742 +#line 2010 "dtc-parser.tab.c" /* yacc.c:1646 */
3743 + break;
3744 +
3745 + case 81:
3746 +#line 471 "dtc-parser.y" /* yacc.c:1646 */
3747 + {
3748 + add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref));
3749 + (yyval.node) = (yyvsp[0].node);
3750 + }
3751 +#line 2019 "dtc-parser.tab.c" /* yacc.c:1646 */
3752 + break;
3753
3754 -/* Line 1787 of yacc.c */
3755 -#line 2073 "dtc-parser.tab.c"
3756 +
3757 +#line 2023 "dtc-parser.tab.c" /* yacc.c:1646 */
3758 default: break;
3759 }
3760 /* User semantic actions sometimes alter yychar, and that requires
3761 @@ -2090,8 +2040,9 @@ yyreduce:
3762 YY_STACK_PRINT (yyss, yyssp);
3763
3764 *++yyvsp = yyval;
3765 + *++yylsp = yyloc;
3766
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. */
3771
3772 @@ -2106,9 +2057,9 @@ yyreduce:
3773 goto yynewstate;
3774
3775
3776 -/*------------------------------------.
3777 -| yyerrlab -- here on detecting error |
3778 -`------------------------------------*/
3779 +/*--------------------------------------.
3780 +| yyerrlab -- here on detecting error. |
3781 +`--------------------------------------*/
3782 yyerrlab:
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:
3786 #endif
3787 }
3788
3789 -
3790 + yyerror_range[1] = yylloc;
3791
3792 if (yyerrstatus == 3)
3793 {
3794 /* If just tried and failed to reuse lookahead token after an
3795 - error, discard it. */
3796 + error, discard it. */
3797
3798 if (yychar <= YYEOF)
3799 - {
3800 - /* Return failure if at end of input. */
3801 - if (yychar == YYEOF)
3802 - YYABORT;
3803 - }
3804 + {
3805 + /* Return failure if at end of input. */
3806 + if (yychar == YYEOF)
3807 + YYABORT;
3808 + }
3809 else
3810 - {
3811 - yydestruct ("Error: discarding",
3812 - yytoken, &yylval);
3813 - yychar = YYEMPTY;
3814 - }
3815 + {
3816 + yydestruct ("Error: discarding",
3817 + yytoken, &yylval, &yylloc);
3818 + yychar = YYEMPTY;
3819 + }
3820 }
3821
3822 /* Else will try to reuse lookahead token after shifting the error
3823 @@ -2191,7 +2142,8 @@ yyerrorlab:
3824 if (/*CONSTCOND*/ 0)
3825 goto yyerrorlab;
3826
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
3830 this YYERROR. */
3831 YYPOPSTACK (yylen);
3832 yylen = 0;
3833 @@ -2204,29 +2156,29 @@ yyerrorlab:
3834 | yyerrlab1 -- common code for both syntax error and YYERROR. |
3835 `-------------------------------------------------------------*/
3836 yyerrlab1:
3837 - yyerrstatus = 3; /* Each real token shifted decrements this. */
3838 + yyerrstatus = 3; /* Each real token shifted decrements this. */
3839
3840 for (;;)
3841 {
3842 yyn = yypact[yystate];
3843 if (!yypact_value_is_default (yyn))
3844 - {
3845 - yyn += YYTERROR;
3846 - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3847 - {
3848 - yyn = yytable[yyn];
3849 - if (0 < yyn)
3850 - break;
3851 - }
3852 - }
3853 + {
3854 + yyn += YYTERROR;
3855 + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3856 + {
3857 + yyn = yytable[yyn];
3858 + if (0 < yyn)
3859 + break;
3860 + }
3861 + }
3862
3863 /* Pop the current state because it cannot handle the error token. */
3864 if (yyssp == yyss)
3865 - YYABORT;
3866 -
3867 + YYABORT;
3868
3869 + yyerror_range[1] = *yylsp;
3870 yydestruct ("Error: popping",
3871 - yystos[yystate], yyvsp);
3872 + yystos[yystate], yyvsp, yylsp);
3873 YYPOPSTACK (1);
3874 yystate = *yyssp;
3875 YY_STACK_PRINT (yyss, yyssp);
3876 @@ -2236,6 +2188,11 @@ yyerrlab1:
3877 *++yyvsp = yylval;
3878 YY_IGNORE_MAYBE_UNINITIALIZED_END
3879
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);
3884 + *++yylsp = yyloc;
3885
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);
3894 }
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. */
3898 YYPOPSTACK (yylen);
3899 YY_STACK_PRINT (yyss, yyssp);
3900 while (yyssp != yyss)
3901 {
3902 yydestruct ("Cleanup: popping",
3903 - yystos[*yyssp], yyvsp);
3904 + yystos[*yyssp], yyvsp, yylsp);
3905 YYPOPSTACK (1);
3906 }
3907 #ifndef yyoverflow
3908 @@ -2295,72 +2252,12 @@ yyreturn:
3909 if (yymsg != yymsgbuf)
3910 YYSTACK_FREE (yymsg);
3911 #endif
3912 - /* Make sure YYID is used. */
3913 - return YYID (yyresult);
3914 + return yyresult;
3915 }
3916 +#line 477 "dtc-parser.y" /* yacc.c:1906 */
3917
3918
3919 -/* Line 2050 of yacc.c */
3920 -#line 471 "dtc-parser.y"
3921 -
3922 -
3923 -void print_error(char const *fmt, ...)
3924 +void yyerror(char const *s)
3925 {
3926 - va_list va;
3927 -
3928 - va_start(va, fmt);
3929 - srcpos_verror(&yylloc, fmt, va);
3930 - va_end(va);
3931 -
3932 - treesource_error = 1;
3933 -}
3934 -
3935 -void yyerror(char const *s) {
3936 - print_error("%s", s);
3937 -}
3938 -
3939 -static unsigned long long eval_literal(const char *s, int base, int bits)
3940 -{
3941 - unsigned long long val;
3942 - char *e;
3943 -
3944 - errno = 0;
3945 - val = strtoull(s, &e, base);
3946 - if (*e) {
3947 - size_t uls = strspn(e, "UL");
3948 - if (e[uls])
3949 - print_error("bad characters in literal");
3950 - }
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");
3956 - return val;
3957 -}
3958 -
3959 -static unsigned char eval_char_literal(const char *s)
3960 -{
3961 - int i = 1;
3962 - char c = s[0];
3963 -
3964 - if (c == '\0')
3965 - {
3966 - print_error("empty character literal");
3967 - return 0;
3968 - }
3969 -
3970 - /*
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.
3975 - */
3976 - if (c == '\\')
3977 - c = get_escape_char(s, &i);
3978 -
3979 - if (s[i] != '\0')
3980 - print_error("malformed character literal");
3981 -
3982 - return c;
3983 + ERROR(&yylloc, "%s", s);
3984 }
3985 --- a/scripts/dtc/dtc-parser.tab.h_shipped
3986 +++ b/scripts/dtc/dtc-parser.tab.h_shipped
3987 @@ -1,19 +1,19 @@
3988 -/* A Bison parser, made by GNU Bison 2.7.12-4996. */
3989 +/* A Bison parser, made by GNU Bison 3.0.2. */
3990
3991 /* Bison interface for Yacc-like parsers in C
3992 -
3993 - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
3994 -
3995 +
3996 + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
3997 +
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.
4002 -
4003 +
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.
4008 -
4009 +
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/>. */
4012
4013 @@ -26,13 +26,13 @@
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.
4017 -
4018 +
4019 This special exception was added by the Free Software Foundation in
4020 version 2.2 of Bison. */
4021
4022 #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED
4023 # define YY_YY_DTC_PARSER_TAB_H_INCLUDED
4024 -/* Enabling traces. */
4025 +/* Debug traces. */
4026 #ifndef YYDEBUG
4027 # define YYDEBUG 0
4028 #endif
4029 @@ -40,48 +40,45 @@
4030 extern int yydebug;
4031 #endif
4032
4033 -/* Tokens. */
4034 +/* Token type. */
4035 #ifndef YYTOKENTYPE
4036 # define YYTOKENTYPE
4037 - /* Put the tokens into the symbol table, so that GDB and other debuggers
4038 - know about them. */
4039 - enum yytokentype {
4040 - DT_V1 = 258,
4041 - DT_MEMRESERVE = 259,
4042 - DT_LSHIFT = 260,
4043 - DT_RSHIFT = 261,
4044 - DT_LE = 262,
4045 - DT_GE = 263,
4046 - DT_EQ = 264,
4047 - DT_NE = 265,
4048 - DT_AND = 266,
4049 - DT_OR = 267,
4050 - DT_BITS = 268,
4051 - DT_DEL_PROP = 269,
4052 - DT_DEL_NODE = 270,
4053 - DT_PROPNODENAME = 271,
4054 - DT_LITERAL = 272,
4055 - DT_CHAR_LITERAL = 273,
4056 - DT_BASE = 274,
4057 - DT_BYTE = 275,
4058 - DT_STRING = 276,
4059 - DT_LABEL = 277,
4060 - DT_REF = 278,
4061 - DT_INCBIN = 279
4062 - };
4063 + enum yytokentype
4064 + {
4065 + DT_V1 = 258,
4066 + DT_PLUGIN = 259,
4067 + DT_MEMRESERVE = 260,
4068 + DT_LSHIFT = 261,
4069 + DT_RSHIFT = 262,
4070 + DT_LE = 263,
4071 + DT_GE = 264,
4072 + DT_EQ = 265,
4073 + DT_NE = 266,
4074 + DT_AND = 267,
4075 + DT_OR = 268,
4076 + DT_BITS = 269,
4077 + DT_DEL_PROP = 270,
4078 + DT_DEL_NODE = 271,
4079 + DT_PROPNODENAME = 272,
4080 + DT_LITERAL = 273,
4081 + DT_CHAR_LITERAL = 274,
4082 + DT_BYTE = 275,
4083 + DT_STRING = 276,
4084 + DT_LABEL = 277,
4085 + DT_REF = 278,
4086 + DT_INCBIN = 279
4087 + };
4088 #endif
4089
4090 -
4091 +/* Value type. */
4092 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
4093 -typedef union YYSTYPE
4094 +typedef union YYSTYPE YYSTYPE;
4095 +union YYSTYPE
4096 {
4097 -/* Line 2053 of yacc.c */
4098 -#line 40 "dtc-parser.y"
4099 +#line 39 "dtc-parser.y" /* yacc.c:1909 */
4100
4101 char *propnodename;
4102 - char *literal;
4103 char *labelref;
4104 - unsigned int cbase;
4105 uint8_t byte;
4106 struct data data;
4107
4108 @@ -96,30 +93,31 @@ typedef union YYSTYPE
4109 struct node *nodelist;
4110 struct reserve_info *re;
4111 uint64_t integer;
4112 + int is_plugin;
4113
4114 -
4115 -/* Line 2053 of yacc.c */
4116 -#line 103 "dtc-parser.tab.h"
4117 -} YYSTYPE;
4118 +#line 99 "dtc-parser.tab.h" /* yacc.c:1909 */
4119 +};
4120 # define YYSTYPE_IS_TRIVIAL 1
4121 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */
4122 # define YYSTYPE_IS_DECLARED 1
4123 #endif
4124
4125 -extern YYSTYPE yylval;
4126 -
4127 -#ifdef YYPARSE_PARAM
4128 -#if defined __STDC__ || defined __cplusplus
4129 -int yyparse (void *YYPARSE_PARAM);
4130 -#else
4131 -int yyparse ();
4132 +/* Location type. */
4133 +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
4134 +typedef struct YYLTYPE YYLTYPE;
4135 +struct YYLTYPE
4136 +{
4137 + int first_line;
4138 + int first_column;
4139 + int last_line;
4140 + int last_column;
4141 +};
4142 +# define YYLTYPE_IS_DECLARED 1
4143 +# define YYLTYPE_IS_TRIVIAL 1
4144 #endif
4145 -#else /* ! YYPARSE_PARAM */
4146 -#if defined __STDC__ || defined __cplusplus
4147 +
4148 +
4149 +extern YYSTYPE yylval;
4150 +extern YYLTYPE yylloc;
4151 int yyparse (void);
4152 -#else
4153 -int yyparse ();
4154 -#endif
4155 -#endif /* ! YYPARSE_PARAM */
4156
4157 #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */
4158 --- a/scripts/dtc/dtc-parser.y
4159 +++ b/scripts/dtc/dtc-parser.y
4160 @@ -17,31 +17,28 @@
4161 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
4162 * USA
4163 */
4164 -
4165 %{
4166 #include <stdio.h>
4167 +#include <inttypes.h>
4168
4169 #include "dtc.h"
4170 #include "srcpos.h"
4171
4172 -YYLTYPE yylloc;
4173 -
4174 extern int yylex(void);
4175 -extern void print_error(char const *fmt, ...);
4176 extern void yyerror(char const *s);
4177 +#define ERROR(loc, ...) \
4178 + do { \
4179 + srcpos_error((loc), "Error", __VA_ARGS__); \
4180 + treesource_error = true; \
4181 + } while (0)
4182
4183 extern struct boot_info *the_boot_info;
4184 -extern int treesource_error;
4185 -
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;
4189 %}
4190
4191 %union {
4192 char *propnodename;
4193 - char *literal;
4194 char *labelref;
4195 - unsigned int cbase;
4196 uint8_t byte;
4197 struct data data;
4198
4199 @@ -56,18 +53,19 @@ static unsigned char eval_char_literal(c
4200 struct node *nodelist;
4201 struct reserve_info *re;
4202 uint64_t integer;
4203 + int is_plugin;
4204 }
4205
4206 %token DT_V1
4207 +%token DT_PLUGIN
4208 %token DT_MEMRESERVE
4209 %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR
4210 %token DT_BITS
4211 %token DT_DEL_PROP
4212 %token DT_DEL_NODE
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
4223
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
4231 %%
4232
4233 sourcefile:
4234 - DT_V1 ';' memreserves devicetree
4235 + DT_V1 ';' plugindecl memreserves devicetree
4236 + {
4237 + $5->is_plugin = $3;
4238 + $5->is_root = 1;
4239 + the_boot_info = build_boot_info($4, $5,
4240 + guess_boot_cpuid($5));
4241 + }
4242 + ;
4243 +
4244 +plugindecl:
4245 + /* empty */
4246 + {
4247 + $$ = 0;
4248 + }
4249 + | DT_PLUGIN ';'
4250 {
4251 - the_boot_info = build_boot_info($3, $4,
4252 - guess_boot_cpuid($4));
4253 + $$ = 1;
4254 }
4255 ;
4256
4257 @@ -152,17 +164,18 @@ devicetree:
4258 if (target)
4259 merge_nodes(target, $3);
4260 else
4261 - print_error("label or path, '%s', not found", $2);
4262 + ERROR(&@2, "Label or path %s not found", $2);
4263 $$ = $1;
4264 }
4265 | devicetree DT_DEL_NODE DT_REF ';'
4266 {
4267 struct node *target = get_node_by_ref($1, $3);
4268
4269 - if (!target)
4270 - print_error("label or path, '%s', not found", $3);
4271 - else
4272 + if (target)
4273 delete_node(target);
4274 + else
4275 + ERROR(&@3, "Label or path %s not found", $3);
4276 +
4277
4278 $$ = $1;
4279 }
4280 @@ -230,10 +243,9 @@ propdata:
4281
4282 if ($6 != 0)
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,
4286 - $4.val,
4287 - strerror(errno));
4288 + die("Couldn't seek to offset %llu in \"%s\": %s",
4289 + (unsigned long long)$6, $4.val,
4290 + strerror(errno));
4291
4292 d = data_copy_file(f, $8);
4293
4294 @@ -274,18 +286,19 @@ propdataprefix:
4295 arrayprefix:
4296 DT_BITS DT_LITERAL '<'
4297 {
4298 - $$.data = empty_data;
4299 - $$.bits = eval_literal($2, 0, 7);
4300 + unsigned long long bits;
4301
4302 - if (($$.bits != 8) &&
4303 - ($$.bits != 16) &&
4304 - ($$.bits != 32) &&
4305 - ($$.bits != 64))
4306 - {
4307 - print_error("Only 8, 16, 32 and 64-bit elements"
4308 - " are currently supported");
4309 - $$.bits = 32;
4310 + bits = $2;
4311 +
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");
4316 + bits = 32;
4317 }
4318 +
4319 + $$.data = empty_data;
4320 + $$.bits = bits;
4321 }
4322 | '<'
4323 {
4324 @@ -305,9 +318,8 @@ arrayprefix:
4325 * mask), all bits are one.
4326 */
4327 if (($2 > mask) && (($2 | mask) != -1ULL))
4328 - print_error(
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);
4333 }
4334
4335 $$.data = data_append_integer($1.data, $2, $1.bits);
4336 @@ -321,7 +333,7 @@ arrayprefix:
4337 REF_PHANDLE,
4338 $2);
4339 else
4340 - print_error("References are only allowed in "
4341 + ERROR(&@2, "References are only allowed in "
4342 "arrays with 32-bit elements.");
4343
4344 $$.data = data_append_integer($1.data, val, $1.bits);
4345 @@ -334,13 +346,7 @@ arrayprefix:
4346
4347 integer_prim:
4348 DT_LITERAL
4349 - {
4350 - $$ = eval_literal($1, 0, 64);
4351 - }
4352 | DT_CHAR_LITERAL
4353 - {
4354 - $$ = eval_char_literal($1);
4355 - }
4356 | '(' integer_expr ')'
4357 {
4358 $$ = $2;
4359 @@ -447,7 +453,7 @@ subnodes:
4360 }
4361 | subnode propdef
4362 {
4363 - print_error("syntax error: properties must precede subnodes");
4364 + ERROR(&@2, "Properties must precede subnodes");
4365 YYERROR;
4366 }
4367 ;
4368 @@ -470,63 +476,7 @@ subnode:
4369
4370 %%
4371
4372 -void print_error(char const *fmt, ...)
4373 +void yyerror(char const *s)
4374 {
4375 - va_list va;
4376 -
4377 - va_start(va, fmt);
4378 - srcpos_verror(&yylloc, fmt, va);
4379 - va_end(va);
4380 -
4381 - treesource_error = 1;
4382 -}
4383 -
4384 -void yyerror(char const *s) {
4385 - print_error("%s", s);
4386 -}
4387 -
4388 -static unsigned long long eval_literal(const char *s, int base, int bits)
4389 -{
4390 - unsigned long long val;
4391 - char *e;
4392 -
4393 - errno = 0;
4394 - val = strtoull(s, &e, base);
4395 - if (*e) {
4396 - size_t uls = strspn(e, "UL");
4397 - if (e[uls])
4398 - print_error("bad characters in literal");
4399 - }
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");
4405 - return val;
4406 -}
4407 -
4408 -static unsigned char eval_char_literal(const char *s)
4409 -{
4410 - int i = 1;
4411 - char c = s[0];
4412 -
4413 - if (c == '\0')
4414 - {
4415 - print_error("empty character literal");
4416 - return 0;
4417 - }
4418 -
4419 - /*
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.
4424 - */
4425 - if (c == '\\')
4426 - c = get_escape_char(s, &i);
4427 -
4428 - if (s[i] != '\0')
4429 - print_error("malformed character literal");
4430 -
4431 - return c;
4432 + ERROR(&yylloc, "%s", s);
4433 }
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;
4441
4442 static void fill_fullpaths(struct node *tree, const char *prefix)
4443 {
4444 @@ -48,8 +49,10 @@ static void fill_fullpaths(struct node *
4445 }
4446
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",
4483 NULL,
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;
4490 const char *arg;
4491 int opt;
4492 FILE *outf = NULL;
4493 @@ -148,7 +153,7 @@ int main(int argc, char *argv[])
4494 padsize = strtol(optarg, NULL, 0);
4495 break;
4496 case 'f':
4497 - force = 1;
4498 + force = true;
4499 break;
4500 case 'q':
4501 quiet++;
4502 @@ -174,7 +179,7 @@ int main(int argc, char *argv[])
4503 break;
4504
4505 case 's':
4506 - sort = 1;
4507 + sort = true;
4508 break;
4509
4510 case 'W':
4511 @@ -184,7 +189,9 @@ int main(int argc, char *argv[])
4512 case 'E':
4513 parse_checks_option(false, true, optarg);
4514 break;
4515 -
4516 + case '@':
4517 + symbol_fixup_support = 1;
4518 + break;
4519 case 'h':
4520 usage(NULL);
4521 default:
4522 @@ -237,7 +244,7 @@ int main(int argc, char *argv[])
4523 if (streq(outname, "-")) {
4524 outf = stdout;
4525 } else {
4526 - outf = fopen(outname, "w");
4527 + outf = fopen(outname, "wb");
4528 if (! outf)
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
4533 @@ -38,9 +38,9 @@
4534 #include "util.h"
4535
4536 #ifdef DEBUG
4537 -#define debug(fmt,args...) printf(fmt, ##args)
4538 +#define debug(...) printf(__VA_ARGS__)
4539 #else
4540 -#define debug(fmt,args...)
4541 +#define debug(...)
4542 #endif
4543
4544
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 */
4550
4551 #define PHANDLE_LEGACY 0x1
4552 #define PHANDLE_EPAPR 0x2
4553 @@ -88,7 +89,7 @@ struct data {
4554 };
4555
4556
4557 -#define empty_data ((struct data){ /* all .members = 0 or NULL */ })
4558 +#define empty_data ((struct data){ 0 /* all .members = 0 or NULL */ })
4559
4560 #define for_each_marker(m) \
4561 for (; (m); (m) = (m)->next)
4562 @@ -118,7 +119,7 @@ struct data data_append_align(struct dat
4563
4564 struct data data_add_marker(struct data d, enum markertype type, char *ref);
4565
4566 -int data_is_one_string(struct data d);
4567 +bool data_is_one_string(struct data d);
4568
4569 /* DT constraints */
4570
4571 @@ -127,13 +128,32 @@ int data_is_one_string(struct data d);
4572
4573 /* Live trees */
4574 struct label {
4575 - int deleted;
4576 + bool deleted;
4577 char *label;
4578 struct label *next;
4579 };
4580
4581 +struct fixup_entry {
4582 + int offset;
4583 + struct node *node;
4584 + struct property *prop;
4585 + struct fixup_entry *next;
4586 +};
4587 +
4588 +struct fixup {
4589 + char *ref;
4590 + struct fixup_entry *entries;
4591 + struct fixup *next;
4592 +};
4593 +
4594 +struct symbol {
4595 + struct label *label;
4596 + struct node *node;
4597 + struct symbol *next;
4598 +};
4599 +
4600 struct property {
4601 - int deleted;
4602 + bool deleted;
4603 char *name;
4604 struct data val;
4605
4606 @@ -143,7 +163,7 @@ struct property {
4607 };
4608
4609 struct node {
4610 - int deleted;
4611 + bool deleted;
4612 char *name;
4613 struct property *proplist;
4614 struct node *children;
4615 @@ -158,6 +178,12 @@ struct node {
4616 int addr_cells, size_cells;
4617
4618 struct label *labels;
4619 +
4620 + int is_root;
4621 + int is_plugin;
4622 + struct fixup *fixups;
4623 + struct symbol *symbols;
4624 + struct fixup_entry *local_fixups;
4625 };
4626
4627 #define for_each_label_withdel(l0, l) \
4628 @@ -181,6 +207,18 @@ struct node {
4629 for_each_child_withdel(n, c) \
4630 if (!(c)->deleted)
4631
4632 +#define for_each_fixup(n, f) \
4633 + for ((f) = (n)->fixups; (f); (f) = (f)->next)
4634 +
4635 +#define for_each_fixup_entry(f, fe) \
4636 + for ((fe) = (f)->entries; (fe); (fe) = (fe)->next)
4637 +
4638 +#define for_each_symbol(n, s) \
4639 + for ((s) = (n)->symbols; (s); (s) = (s)->next)
4640 +
4641 +#define for_each_local_fixup_entry(n, fe) \
4642 + for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next)
4643 +
4644 void add_label(struct label **labels, char *label);
4645 void delete_labels(struct label **labels);
4646
4647 @@ -247,8 +285,8 @@ void sort_tree(struct boot_info *bi);
4648
4649 /* Checks */
4650
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);
4655
4656 /* Flattened trees */
4657
4658 --- a/scripts/dtc/flattree.c
4659 +++ b/scripts/dtc/flattree.c
4660 @@ -261,7 +261,13 @@ static void flatten_tree(struct node *tr
4661 {
4662 struct property *prop;
4663 struct node *child;
4664 - int seen_name_prop = 0;
4665 + bool seen_name_prop = false;
4666 + struct symbol *sym;
4667 + struct fixup *f;
4668 + struct fixup_entry *fe;
4669 + char *name, *s;
4670 + const char *fullpath;
4671 + int namesz, nameoff, vallen;
4672
4673 if (tree->deleted)
4674 return;
4675 @@ -276,10 +282,8 @@ static void flatten_tree(struct node *tr
4676 emit->align(etarget, sizeof(cell_t));
4677
4678 for_each_property(tree, prop) {
4679 - int nameoff;
4680 -
4681 if (streq(prop->name, "name"))
4682 - seen_name_prop = 1;
4683 + seen_name_prop = true;
4684
4685 nameoff = stringtable_insert(strbuf, prop->name);
4686
4687 @@ -310,6 +314,139 @@ static void flatten_tree(struct node *tr
4688 flatten_tree(child, emit, etarget, strbuf, vi);
4689 }
4690
4691 + if (!symbol_fixup_support)
4692 + goto no_symbols;
4693 +
4694 + /* add the symbol nodes (if any) */
4695 + if (tree->symbols) {
4696 +
4697 + emit->beginnode(etarget, NULL);
4698 + emit->string(etarget, "__symbols__", 0);
4699 + emit->align(etarget, sizeof(cell_t));
4700 +
4701 + for_each_symbol(tree, sym) {
4702 +
4703 + vallen = strlen(sym->node->fullpath);
4704 +
4705 + nameoff = stringtable_insert(strbuf, sym->label->label);
4706 +
4707 + emit->property(etarget, NULL);
4708 + emit->cell(etarget, vallen + 1);
4709 + emit->cell(etarget, nameoff);
4710 +
4711 + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
4712 + emit->align(etarget, 8);
4713 +
4714 + emit->string(etarget, sym->node->fullpath,
4715 + strlen(sym->node->fullpath));
4716 + emit->align(etarget, sizeof(cell_t));
4717 + }
4718 +
4719 + emit->endnode(etarget, NULL);
4720 + }
4721 +
4722 + /* add the fixup nodes */
4723 + if (tree->fixups) {
4724 +
4725 + /* emit the external fixups */
4726 + emit->beginnode(etarget, NULL);
4727 + emit->string(etarget, "__fixups__", 0);
4728 + emit->align(etarget, sizeof(cell_t));
4729 +
4730 + for_each_fixup(tree, f) {
4731 +
4732 + namesz = 0;
4733 + for_each_fixup_entry(f, fe) {
4734 + fullpath = fe->node->fullpath;
4735 + if (fullpath[0] == '\0')
4736 + fullpath = "/";
4737 + namesz += strlen(fullpath) + 1;
4738 + namesz += strlen(fe->prop->name) + 1;
4739 + namesz += 32; /* space for :<number> + '\0' */
4740 + }
4741 +
4742 + name = xmalloc(namesz);
4743 +
4744 + s = name;
4745 + for_each_fixup_entry(f, fe) {
4746 + fullpath = fe->node->fullpath;
4747 + if (fullpath[0] == '\0')
4748 + fullpath = "/";
4749 + snprintf(s, name + namesz - s, "%s:%s:%d",
4750 + fullpath,
4751 + fe->prop->name, fe->offset);
4752 + s += strlen(s) + 1;
4753 + }
4754 +
4755 + nameoff = stringtable_insert(strbuf, f->ref);
4756 + vallen = s - name - 1;
4757 +
4758 + emit->property(etarget, NULL);
4759 + emit->cell(etarget, vallen + 1);
4760 + emit->cell(etarget, nameoff);
4761 +
4762 + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
4763 + emit->align(etarget, 8);
4764 +
4765 + emit->string(etarget, name, vallen);
4766 + emit->align(etarget, sizeof(cell_t));
4767 +
4768 + free(name);
4769 + }
4770 +
4771 + emit->endnode(etarget, tree->labels);
4772 + }
4773 +
4774 + /* add the local fixup property */
4775 + if (tree->local_fixups) {
4776 +
4777 + /* emit the external fixups */
4778 + emit->beginnode(etarget, NULL);
4779 + emit->string(etarget, "__local_fixups__", 0);
4780 + emit->align(etarget, sizeof(cell_t));
4781 +
4782 + namesz = 0;
4783 + for_each_local_fixup_entry(tree, fe) {
4784 + fullpath = fe->node->fullpath;
4785 + if (fullpath[0] == '\0')
4786 + fullpath = "/";
4787 + namesz += strlen(fullpath) + 1;
4788 + namesz += strlen(fe->prop->name) + 1;
4789 + namesz += 32; /* space for :<number> + '\0' */
4790 + }
4791 +
4792 + name = xmalloc(namesz);
4793 +
4794 + s = name;
4795 + for_each_local_fixup_entry(tree, fe) {
4796 + fullpath = fe->node->fullpath;
4797 + if (fullpath[0] == '\0')
4798 + fullpath = "/";
4799 + snprintf(s, name + namesz - s, "%s:%s:%d",
4800 + fullpath, fe->prop->name,
4801 + fe->offset);
4802 + s += strlen(s) + 1;
4803 + }
4804 +
4805 + nameoff = stringtable_insert(strbuf, "fixup");
4806 + vallen = s - name - 1;
4807 +
4808 + emit->property(etarget, NULL);
4809 + emit->cell(etarget, vallen + 1);
4810 + emit->cell(etarget, nameoff);
4811 +
4812 + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
4813 + emit->align(etarget, 8);
4814 +
4815 + emit->string(etarget, name, vallen);
4816 + emit->align(etarget, sizeof(cell_t));
4817 +
4818 + free(name);
4819 +
4820 + emit->endnode(etarget, tree->labels);
4821 + }
4822 +
4823 +no_symbols:
4824 emit->endnode(etarget, tree->labels);
4825 }
4826
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);
4831
4832 while ((de = readdir(d)) != NULL) {
4833 - char *tmpnam;
4834 + char *tmpname;
4835
4836 if (streq(de->d_name, ".")
4837 || streq(de->d_name, ".."))
4838 continue;
4839
4840 - tmpnam = join_path(dirname, de->d_name);
4841 + tmpname = join_path(dirname, de->d_name);
4842
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));
4847
4848 if (S_ISREG(st.st_mode)) {
4849 struct property *prop;
4850 FILE *pfile;
4851
4852 - pfile = fopen(tmpnam, "r");
4853 + pfile = fopen(tmpname, "rb");
4854 if (! pfile) {
4855 fprintf(stderr,
4856 "WARNING: Cannot open %s: %s\n",
4857 - tmpnam, strerror(errno));
4858 + tmpname, strerror(errno));
4859 } else {
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;
4865
4866 - newchild = read_fstree(tmpnam);
4867 + newchild = read_fstree(tmpname);
4868 newchild = name_node(newchild, xstrdup(de->d_name));
4869 add_child(tree, newchild);
4870 }
4871
4872 - free(tmpnam);
4873 + free(tmpname);
4874 }
4875
4876 closedir(d);
4877 --- a/scripts/dtc/livetree.c
4878 +++ b/scripts/dtc/livetree.c
4879 @@ -511,7 +511,9 @@ struct node *get_node_by_phandle(struct
4880
4881 struct node *get_node_by_ref(struct node *tree, const char *ref)
4882 {
4883 - if (ref[0] == '/')
4884 + if (streq(ref, "/"))
4885 + return tree;
4886 + else if (ref[0] == '/')
4887 return get_node_by_path(tree, ref);
4888 else
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;
4894
4895
4896 -static char *dirname(const char *path)
4897 +static char *get_dirname(const char *path)
4898 {
4899 const char *slash = strrchr(path, '/');
4900
4901 @@ -77,7 +77,7 @@ static char *try_open(const char *dirnam
4902 else
4903 fullname = join_path(dirname, fname);
4904
4905 - *fp = fopen(fullname, "r");
4906 + *fp = fopen(fullname, "rb");
4907 if (!*fp) {
4908 free(fullname);
4909 fullname = NULL;
4910 @@ -150,7 +150,7 @@ void srcfile_push(const char *fname)
4911 srcfile = xmalloc(sizeof(*srcfile));
4912
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;
4917
4918 srcfile->lineno = 1;
4919 @@ -159,7 +159,7 @@ void srcfile_push(const char *fname)
4920 current_srcfile = srcfile;
4921 }
4922
4923 -int srcfile_pop(void)
4924 +bool srcfile_pop(void)
4925 {
4926 struct srcfile_state *srcfile = current_srcfile;
4927
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. */
4931
4932 - return current_srcfile ? 1 : 0;
4933 + return current_srcfile ? true : false;
4934 }
4935
4936 void srcfile_add_search_path(const char *dirname)
4937 @@ -290,42 +290,27 @@ srcpos_string(struct srcpos *pos)
4938 return pos_str;
4939 }
4940
4941 -void
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)
4945 {
4946 - const char *srcstr;
4947 -
4948 - srcstr = srcpos_string(pos);
4949 + char *srcstr;
4950
4951 - fprintf(stderr, "Error: %s ", srcstr);
4952 - vfprintf(stderr, fmt, va);
4953 - fprintf(stderr, "\n");
4954 -}
4955 + srcstr = srcpos_string(pos);
4956
4957 -void
4958 -srcpos_error(struct srcpos *pos, char const *fmt, ...)
4959 -{
4960 - va_list va;
4961 + fprintf(stderr, "%s: %s ", prefix, srcstr);
4962 + vfprintf(stderr, fmt, va);
4963 + fprintf(stderr, "\n");
4964
4965 - va_start(va, fmt);
4966 - srcpos_verror(pos, fmt, va);
4967 - va_end(va);
4968 + free(srcstr);
4969 }
4970
4971 -
4972 -void
4973 -srcpos_warn(struct srcpos *pos, char const *fmt, ...)
4974 +void srcpos_error(struct srcpos *pos, const char *prefix,
4975 + const char *fmt, ...)
4976 {
4977 - const char *srcstr;
4978 va_list va;
4979 - va_start(va, fmt);
4980 -
4981 - srcstr = srcpos_string(pos);
4982 -
4983 - fprintf(stderr, "Warning: %s ", srcstr);
4984 - vfprintf(stderr, fmt, va);
4985 - fprintf(stderr, "\n");
4986
4987 + va_start(va, fmt);
4988 + srcpos_verror(pos, prefix, fmt, va);
4989 va_end(va);
4990 }
4991
4992 --- a/scripts/dtc/srcpos.h
4993 +++ b/scripts/dtc/srcpos.h
4994 @@ -21,6 +21,7 @@
4995 #define _SRCPOS_H_
4996
4997 #include <stdio.h>
4998 +#include <stdbool.h>
4999
5000 struct srcfile_state {
5001 FILE *f;
5002 @@ -55,7 +56,7 @@ extern struct srcfile_state *current_src
5003 FILE *srcfile_relative_open(const char *fname, char **fullnamep);
5004
5005 void srcfile_push(const char *fname);
5006 -int srcfile_pop(void);
5007 +bool srcfile_pop(void);
5008
5009 /**
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);
5014
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)));
5027
5028 extern void srcpos_set_line(char *f, int l);
5029
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;
5034
5035 struct boot_info *the_boot_info;
5036 -int treesource_error;
5037 +bool treesource_error;
5038
5039 struct boot_info *dt_from_source(const char *fname)
5040 {
5041 the_boot_info = NULL;
5042 - treesource_error = 0;
5043 + treesource_error = false;
5044
5045 srcfile_push(fname);
5046 yyin = current_srcfile->f;
5047 @@ -54,9 +54,9 @@ static void write_prefix(FILE *f, int le
5048 fputc('\t', f);
5049 }
5050
5051 -static int isstring(char c)
5052 +static bool isstring(char c)
5053 {
5054 - return (isprint(c)
5055 + return (isprint((unsigned char)c)
5056 || (c == '\0')
5057 || strchr("\a\b\t\n\v\f\r", c));
5058 }
5059 @@ -109,7 +109,7 @@ static void write_propval_string(FILE *f
5060 break;
5061 case '\0':
5062 fprintf(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
5069 fprintf(f, "\"");
5070 break;
5071 default:
5072 - if (isprint(c))
5073 + if (isprint((unsigned char)c))
5074 fprintf(f, "%c", c);
5075 else
5076 fprintf(f, "\\x%02hhx", c);
5077 @@ -178,7 +178,7 @@ static void write_propval_bytes(FILE *f,
5078 m = m->next;
5079 }
5080
5081 - fprintf(f, "%02hhx", *bp++);
5082 + fprintf(f, "%02hhx", (unsigned char)(*bp++));
5083 if ((const void *)bp >= propend)
5084 break;
5085 fprintf(f, " ");
5086 --- a/scripts/dtc/util.c
5087 +++ b/scripts/dtc/util.c
5088 @@ -39,11 +39,11 @@
5089 char *xstrdup(const char *s)
5090 {
5091 int len = strlen(s) + 1;
5092 - char *dup = xmalloc(len);
5093 + char *d = xmalloc(len);
5094
5095 - memcpy(dup, s, len);
5096 + memcpy(d, s, len);
5097
5098 - return dup;
5099 + return d;
5100 }
5101
5102 char *join_path(const char *path, const char *name)
5103 @@ -70,7 +70,7 @@ char *join_path(const char *path, const
5104 return str;
5105 }
5106
5107 -int util_is_printable_string(const void *data, int len)
5108 +bool util_is_printable_string(const void *data, int len)
5109 {
5110 const char *s = data;
5111 const char *ss, *se;
5112 @@ -87,7 +87,7 @@ int util_is_printable_string(const void
5113
5114 while (s < se) {
5115 ss = s;
5116 - while (s < se && *s && isprint(*s))
5117 + while (s < se && *s && isprint((unsigned char)*s))
5118 s++;
5119
5120 /* not zero, or not done yet */
5121 @@ -219,10 +219,6 @@ int utilfdt_read_err_len(const char *fil
5122 if (offset == bufsize) {
5123 bufsize *= 2;
5124 buf = xrealloc(buf, bufsize);
5125 - if (!buf) {
5126 - ret = ENOMEM;
5127 - break;
5128 - }
5129 }
5130
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;
5134
5135 printf(" = <");
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) ? " " : "");
5141 printf(">");
5142 } else {
5143 printf(" = [");
5144 --- a/scripts/dtc/util.h
5145 +++ b/scripts/dtc/util.h
5146 @@ -2,6 +2,7 @@
5147 #define _UTIL_H
5148
5149 #include <stdarg.h>
5150 +#include <stdbool.h>
5151 #include <getopt.h>
5152
5153 /*
5154 @@ -33,6 +34,7 @@ static inline void __attribute__((noretu
5155 va_start(ap, str);
5156 fprintf(stderr, "FATAL ERROR: ");
5157 vfprintf(stderr, str, ap);
5158 + va_end(ap);
5159 exit(1);
5160 }
5161
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
5165 */
5166 -int util_is_printable_string(const void *data, int len);
5167 +bool util_is_printable_string(const void *data, int len);
5168
5169 /*
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
5173 @@ -1 +1 @@
5174 -#define DTC_VERSION "DTC 1.4.0-dirty"
5175 +#define DTC_VERSION "DTC 1.4.1-g36c70742"