brcm2708: update to v3.18
[openwrt/staging/mkresin.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 diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c
29 index ee96a25..27f45f1 100644
30 --- a/scripts/dtc/checks.c
31 +++ b/scripts/dtc/checks.c
32 @@ -53,7 +53,7 @@ struct check {
33 void *data;
34 bool warn, error;
35 enum checkstatus status;
36 - int inprogress;
37 + bool inprogress;
38 int num_prereqs;
39 struct check **prereq;
40 };
41 @@ -113,6 +113,7 @@ static inline void check_msg(struct check *c, const char *fmt, ...)
42 vfprintf(stderr, fmt, ap);
43 fprintf(stderr, "\n");
44 }
45 + va_end(ap);
46 }
47
48 #define FAIL(c, ...) \
49 @@ -141,9 +142,9 @@ static void check_nodes_props(struct check *c, struct node *dt, struct node *nod
50 check_nodes_props(c, dt, child);
51 }
52
53 -static int run_check(struct check *c, struct node *dt)
54 +static bool run_check(struct check *c, struct node *dt)
55 {
56 - int error = 0;
57 + bool error = false;
58 int i;
59
60 assert(!c->inprogress);
61 @@ -151,11 +152,11 @@ static int run_check(struct check *c, struct node *dt)
62 if (c->status != UNCHECKED)
63 goto out;
64
65 - c->inprogress = 1;
66 + c->inprogress = true;
67
68 for (i = 0; i < c->num_prereqs; i++) {
69 struct check *prq = c->prereq[i];
70 - error |= run_check(prq, dt);
71 + error = error || run_check(prq, dt);
72 if (prq->status != PASSED) {
73 c->status = PREREQ;
74 check_msg(c, "Failed prerequisite '%s'",
75 @@ -177,9 +178,9 @@ static int run_check(struct check *c, struct node *dt)
76 TRACE(c, "\tCompleted, status %d", c->status);
77
78 out:
79 - c->inprogress = 0;
80 + c->inprogress = false;
81 if ((c->status != PASSED) && (c->error))
82 - error = 1;
83 + error = true;
84 return error;
85 }
86
87 @@ -457,22 +458,93 @@ static void fixup_phandle_references(struct check *c, struct node *dt,
88 struct node *node, struct property *prop)
89 {
90 struct marker *m = prop->val.markers;
91 + struct fixup *f, **fp;
92 + struct fixup_entry *fe, **fep;
93 struct node *refnode;
94 cell_t phandle;
95 + int has_phandle_refs;
96 +
97 + has_phandle_refs = 0;
98 + for_each_marker_of_type(m, REF_PHANDLE) {
99 + has_phandle_refs = 1;
100 + break;
101 + }
102 +
103 + if (!has_phandle_refs)
104 + return;
105
106 for_each_marker_of_type(m, REF_PHANDLE) {
107 assert(m->offset + sizeof(cell_t) <= prop->val.len);
108
109 refnode = get_node_by_ref(dt, m->ref);
110 - if (! refnode) {
111 + if (!refnode && !symbol_fixup_support) {
112 FAIL(c, "Reference to non-existent node or label \"%s\"\n",
113 - m->ref);
114 + m->ref);
115 continue;
116 }
117
118 - phandle = get_node_phandle(dt, refnode);
119 - *((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
120 + if (!refnode) {
121 + /* allocate fixup entry */
122 + fe = xmalloc(sizeof(*fe));
123 +
124 + fe->node = node;
125 + fe->prop = prop;
126 + fe->offset = m->offset;
127 + fe->next = NULL;
128 +
129 + /* search for an already existing fixup */
130 + for_each_fixup(dt, f)
131 + if (strcmp(f->ref, m->ref) == 0)
132 + break;
133 +
134 + /* no fixup found, add new */
135 + if (f == NULL) {
136 + f = xmalloc(sizeof(*f));
137 + f->ref = m->ref;
138 + f->entries = NULL;
139 + f->next = NULL;
140 +
141 + /* add it to the tree */
142 + fp = &dt->fixups;
143 + while (*fp)
144 + fp = &(*fp)->next;
145 + *fp = f;
146 + }
147 +
148 + /* and now append fixup entry */
149 + fep = &f->entries;
150 + while (*fep)
151 + fep = &(*fep)->next;
152 + *fep = fe;
153 +
154 + /* mark the entry as unresolved */
155 + phandle = 0xdeadbeef;
156 + } else {
157 + phandle = get_node_phandle(dt, refnode);
158 +
159 + /* if it's a plugin, we need to record it */
160 + if (symbol_fixup_support && dt->is_plugin) {
161 +
162 + /* allocate a new local fixup entry */
163 + fe = xmalloc(sizeof(*fe));
164 +
165 + fe->node = node;
166 + fe->prop = prop;
167 + fe->offset = m->offset;
168 + fe->next = NULL;
169 +
170 + /* append it to the local fixups */
171 + fep = &dt->local_fixups;
172 + while (*fep)
173 + fep = &(*fep)->next;
174 + *fep = fe;
175 + }
176 + }
177 +
178 + *((cell_t *)(prop->val.val + m->offset)) =
179 + cpu_to_fdt32(phandle);
180 }
181 +
182 }
183 ERROR(phandle_references, NULL, NULL, fixup_phandle_references, NULL,
184 &duplicate_node_names, &explicit_phandles);
185 @@ -624,11 +696,11 @@ static void check_avoid_default_addr_size(struct check *c, struct node *dt,
186 if (!reg && !ranges)
187 return;
188
189 - if ((node->parent->addr_cells == -1))
190 + if (node->parent->addr_cells == -1)
191 FAIL(c, "Relying on default #address-cells value for %s",
192 node->fullpath);
193
194 - if ((node->parent->size_cells == -1))
195 + if (node->parent->size_cells == -1)
196 FAIL(c, "Relying on default #size-cells value for %s",
197 node->fullpath);
198 }
199 @@ -651,6 +723,45 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c,
200 }
201 TREE_WARNING(obsolete_chosen_interrupt_controller, NULL);
202
203 +static void check_auto_label_phandles(struct check *c, struct node *dt,
204 + struct node *node)
205 +{
206 + struct label *l;
207 + struct symbol *s, **sp;
208 + int has_label;
209 +
210 + if (!symbol_fixup_support)
211 + return;
212 +
213 + has_label = 0;
214 + for_each_label(node->labels, l) {
215 + has_label = 1;
216 + break;
217 + }
218 +
219 + if (!has_label)
220 + return;
221 +
222 + /* force allocation of a phandle for this node */
223 + (void)get_node_phandle(dt, node);
224 +
225 + /* add the symbol */
226 + for_each_label(node->labels, l) {
227 +
228 + s = xmalloc(sizeof(*s));
229 + s->label = l;
230 + s->node = node;
231 + s->next = NULL;
232 +
233 + /* add it to the symbols list */
234 + sp = &dt->symbols;
235 + while (*sp)
236 + sp = &((*sp)->next);
237 + *sp = s;
238 + }
239 +}
240 +NODE_WARNING(auto_label_phandles, NULL);
241 +
242 static struct check *check_table[] = {
243 &duplicate_node_names, &duplicate_property_names,
244 &node_name_chars, &node_name_format, &property_name_chars,
245 @@ -669,6 +780,8 @@ static struct check *check_table[] = {
246 &avoid_default_addr_size,
247 &obsolete_chosen_interrupt_controller,
248
249 + &auto_label_phandles,
250 +
251 &always_fail,
252 };
253
254 @@ -706,15 +819,15 @@ static void disable_warning_error(struct check *c, bool warn, bool error)
255 c->error = c->error && !error;
256 }
257
258 -void parse_checks_option(bool warn, bool error, const char *optarg)
259 +void parse_checks_option(bool warn, bool error, const char *arg)
260 {
261 int i;
262 - const char *name = optarg;
263 + const char *name = arg;
264 bool enable = true;
265
266 - if ((strncmp(optarg, "no-", 3) == 0)
267 - || (strncmp(optarg, "no_", 3) == 0)) {
268 - name = optarg + 3;
269 + if ((strncmp(arg, "no-", 3) == 0)
270 + || (strncmp(arg, "no_", 3) == 0)) {
271 + name = arg + 3;
272 enable = false;
273 }
274
275 @@ -733,7 +846,7 @@ void parse_checks_option(bool warn, bool error, const char *optarg)
276 die("Unrecognized check name \"%s\"\n", name);
277 }
278
279 -void process_checks(int force, struct boot_info *bi)
280 +void process_checks(bool force, struct boot_info *bi)
281 {
282 struct node *dt = bi->dt;
283 int i;
284 diff --git a/scripts/dtc/data.c b/scripts/dtc/data.c
285 index 4a40c5b..8cae237 100644
286 --- a/scripts/dtc/data.c
287 +++ b/scripts/dtc/data.c
288 @@ -74,7 +74,7 @@ struct data data_copy_escape_string(const char *s, int len)
289 struct data d;
290 char *q;
291
292 - d = data_grow_for(empty_data, strlen(s)+1);
293 + d = data_grow_for(empty_data, len + 1);
294
295 q = d.val;
296 while (i < len) {
297 @@ -250,20 +250,20 @@ struct data data_add_marker(struct data d, enum markertype type, char *ref)
298 return data_append_markers(d, m);
299 }
300
301 -int data_is_one_string(struct data d)
302 +bool data_is_one_string(struct data d)
303 {
304 int i;
305 int len = d.len;
306
307 if (len == 0)
308 - return 0;
309 + return false;
310
311 for (i = 0; i < len-1; i++)
312 if (d.val[i] == '\0')
313 - return 0;
314 + return false;
315
316 if (d.val[len-1] != '\0')
317 - return 0;
318 + return false;
319
320 - return 1;
321 + return true;
322 }
323 diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
324 index 3b41bfc..dd44ba2 100644
325 --- a/scripts/dtc/dtc-lexer.l
326 +++ b/scripts/dtc/dtc-lexer.l
327 @@ -20,7 +20,6 @@
328
329 %option noyywrap nounput noinput never-interactive
330
331 -%x INCLUDE
332 %x BYTESTRING
333 %x PROPNODENAME
334 %s V1
335 @@ -40,6 +39,7 @@ LINECOMMENT "//".*\n
336 #include "dtc-parser.tab.h"
337
338 YYLTYPE yylloc;
339 +extern bool treesource_error;
340
341 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
342 #define YY_USER_ACTION \
343 @@ -61,7 +61,8 @@ static int dts_version = 1;
344 BEGIN(V1); \
345
346 static void push_input_file(const char *filename);
347 -static int pop_input_file(void);
348 +static bool pop_input_file(void);
349 +static void lexical_error(const char *fmt, ...);
350 %}
351
352 %%
353 @@ -75,11 +76,11 @@ static int pop_input_file(void);
354 char *line, *tmp, *fn;
355 /* skip text before line # */
356 line = yytext;
357 - while (!isdigit(*line))
358 + while (!isdigit((unsigned char)*line))
359 line++;
360 /* skip digits in line # */
361 tmp = line;
362 - while (!isspace(*tmp))
363 + while (!isspace((unsigned char)*tmp))
364 tmp++;
365 /* "NULL"-terminate line # */
366 *tmp = '\0';
367 @@ -112,6 +113,11 @@ static int pop_input_file(void);
368 return DT_V1;
369 }
370
371 +<*>"/plugin/" {
372 + DPRINT("Keyword: /plugin/\n");
373 + return DT_PLUGIN;
374 + }
375 +
376 <*>"/memreserve/" {
377 DPRINT("Keyword: /memreserve/\n");
378 BEGIN_DEFAULT();
379 @@ -146,15 +152,42 @@ static int pop_input_file(void);
380 }
381
382 <V1>([0-9]+|0[xX][0-9a-fA-F]+)(U|L|UL|LL|ULL)? {
383 - yylval.literal = xstrdup(yytext);
384 - DPRINT("Literal: '%s'\n", yylval.literal);
385 + char *e;
386 + DPRINT("Integer Literal: '%s'\n", yytext);
387 +
388 + errno = 0;
389 + yylval.integer = strtoull(yytext, &e, 0);
390 +
391 + assert(!(*e) || !e[strspn(e, "UL")]);
392 +
393 + if (errno == ERANGE)
394 + lexical_error("Integer literal '%s' out of range",
395 + yytext);
396 + else
397 + /* ERANGE is the only strtoull error triggerable
398 + * by strings matching the pattern */
399 + assert(errno == 0);
400 return DT_LITERAL;
401 }
402
403 <*>{CHAR_LITERAL} {
404 - yytext[yyleng-1] = '\0';
405 - yylval.literal = xstrdup(yytext+1);
406 - DPRINT("Character literal: %s\n", yylval.literal);
407 + struct data d;
408 + DPRINT("Character literal: %s\n", yytext);
409 +
410 + d = data_copy_escape_string(yytext+1, yyleng-2);
411 + if (d.len == 1) {
412 + lexical_error("Empty character literal");
413 + yylval.integer = 0;
414 + return DT_CHAR_LITERAL;
415 + }
416 +
417 + yylval.integer = (unsigned char)d.val[0];
418 +
419 + if (d.len > 2)
420 + lexical_error("Character literal has %d"
421 + " characters instead of 1",
422 + d.len - 1);
423 +
424 return DT_CHAR_LITERAL;
425 }
426
427 @@ -164,7 +197,7 @@ static int pop_input_file(void);
428 return DT_REF;
429 }
430
431 -<*>"&{/"{PATHCHAR}+\} { /* new-style path reference */
432 +<*>"&{/"{PATHCHAR}*\} { /* new-style path reference */
433 yytext[yyleng-1] = '\0';
434 DPRINT("Ref: %s\n", yytext+2);
435 yylval.labelref = xstrdup(yytext+2);
436 @@ -238,13 +271,24 @@ static void push_input_file(const char *filename)
437 }
438
439
440 -static int pop_input_file(void)
441 +static bool pop_input_file(void)
442 {
443 if (srcfile_pop() == 0)
444 - return 0;
445 + return false;
446
447 yypop_buffer_state();
448 yyin = current_srcfile->f;
449
450 - return 1;
451 + return true;
452 +}
453 +
454 +static void lexical_error(const char *fmt, ...)
455 +{
456 + va_list ap;
457 +
458 + va_start(ap, fmt);
459 + srcpos_verror(&yylloc, "Lexical error", fmt, ap);
460 + va_end(ap);
461 +
462 + treesource_error = true;
463 }
464 diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped
465 index 2d30f41..1518525 100644
466 --- a/scripts/dtc/dtc-lexer.lex.c_shipped
467 +++ b/scripts/dtc/dtc-lexer.lex.c_shipped
468 @@ -372,8 +372,8 @@ static void yy_fatal_error (yyconst char msg[] );
469 *yy_cp = '\0'; \
470 (yy_c_buf_p) = yy_cp;
471
472 -#define YY_NUM_RULES 30
473 -#define YY_END_OF_BUFFER 31
474 +#define YY_NUM_RULES 31
475 +#define YY_END_OF_BUFFER 32
476 /* This struct is not used in this scanner,
477 but its presence is necessary. */
478 struct yy_trans_info
479 @@ -381,25 +381,26 @@ struct yy_trans_info
480 flex_int32_t yy_verify;
481 flex_int32_t yy_nxt;
482 };
483 -static yyconst flex_int16_t yy_accept[161] =
484 +static yyconst flex_int16_t yy_accept[166] =
485 { 0,
486 + 0, 0, 0, 0, 0, 0, 0, 0, 32, 30,
487 + 19, 19, 30, 30, 30, 30, 30, 30, 30, 30,
488 + 30, 30, 30, 30, 30, 30, 16, 17, 17, 30,
489 + 17, 11, 11, 19, 27, 0, 3, 0, 28, 13,
490 + 0, 0, 12, 0, 0, 0, 0, 0, 0, 0,
491 + 0, 22, 24, 26, 25, 23, 0, 10, 29, 0,
492 + 0, 0, 15, 15, 17, 17, 17, 11, 11, 11,
493 + 0, 13, 0, 12, 0, 0, 0, 21, 0, 0,
494 + 0, 0, 0, 0, 0, 0, 0, 17, 11, 11,
495 + 11, 0, 14, 20, 0, 0, 0, 0, 0, 0,
496 +
497 + 0, 0, 0, 0, 17, 0, 0, 0, 0, 0,
498 + 0, 0, 0, 0, 0, 17, 7, 0, 0, 0,
499 + 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
500 + 0, 0, 0, 0, 4, 18, 0, 0, 5, 2,
501 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
502 - 31, 29, 18, 18, 29, 29, 29, 29, 29, 29,
503 - 29, 29, 29, 29, 29, 29, 29, 29, 15, 16,
504 - 16, 29, 16, 10, 10, 18, 26, 0, 3, 0,
505 - 27, 12, 0, 0, 11, 0, 0, 0, 0, 0,
506 - 0, 0, 21, 23, 25, 24, 22, 0, 9, 28,
507 - 0, 0, 0, 14, 14, 16, 16, 16, 10, 10,
508 - 10, 0, 12, 0, 11, 0, 0, 0, 20, 0,
509 - 0, 0, 0, 0, 0, 0, 0, 16, 10, 10,
510 - 10, 0, 19, 0, 0, 0, 0, 0, 0, 0,
511 -
512 - 0, 0, 16, 13, 0, 0, 0, 0, 0, 0,
513 - 0, 0, 0, 16, 6, 0, 0, 0, 0, 0,
514 - 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
515 - 4, 17, 0, 0, 2, 0, 0, 0, 0, 0,
516 - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
517 - 0, 0, 5, 8, 0, 0, 0, 0, 7, 0
518 + 0, 0, 1, 0, 0, 0, 0, 6, 9, 0,
519 + 0, 0, 0, 8, 0
520 } ;
521
522 static yyconst flex_int32_t yy_ec[256] =
523 @@ -415,9 +416,9 @@ static yyconst flex_int32_t yy_ec[256] =
524 22, 22, 22, 22, 24, 22, 22, 25, 22, 22,
525 1, 26, 27, 1, 22, 1, 21, 28, 29, 30,
526
527 - 31, 21, 22, 22, 32, 22, 22, 33, 34, 35,
528 - 36, 37, 22, 38, 39, 40, 41, 42, 22, 25,
529 - 43, 22, 44, 45, 46, 1, 1, 1, 1, 1,
530 + 31, 21, 32, 22, 33, 22, 22, 34, 35, 36,
531 + 37, 38, 22, 39, 40, 41, 42, 43, 22, 25,
532 + 44, 22, 45, 46, 47, 1, 1, 1, 1, 1,
533 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
534 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
535 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
536 @@ -434,163 +435,165 @@ static yyconst flex_int32_t yy_ec[256] =
537 1, 1, 1, 1, 1
538 } ;
539
540 -static yyconst flex_int32_t yy_meta[47] =
541 +static yyconst flex_int32_t yy_meta[48] =
542 { 0,
543 1, 1, 1, 1, 1, 1, 2, 3, 1, 2,
544 2, 2, 4, 5, 5, 5, 6, 1, 1, 1,
545 7, 8, 8, 8, 8, 1, 1, 7, 7, 7,
546 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
547 - 8, 8, 8, 3, 1, 1
548 + 8, 8, 8, 8, 3, 1, 4
549 } ;
550
551 -static yyconst flex_int16_t yy_base[175] =
552 +static yyconst flex_int16_t yy_base[180] =
553 { 0,
554 - 0, 385, 378, 40, 41, 383, 72, 382, 34, 44,
555 - 388, 393, 61, 117, 368, 116, 115, 115, 115, 48,
556 - 367, 107, 368, 339, 127, 120, 0, 147, 393, 0,
557 - 127, 0, 133, 156, 168, 153, 393, 125, 393, 380,
558 - 393, 0, 369, 127, 393, 160, 371, 377, 347, 21,
559 - 343, 346, 393, 393, 393, 393, 393, 359, 393, 393,
560 - 183, 343, 339, 393, 356, 0, 183, 340, 187, 348,
561 - 347, 0, 0, 0, 178, 359, 195, 365, 354, 326,
562 - 332, 325, 334, 328, 204, 326, 331, 324, 393, 335,
563 - 150, 311, 343, 342, 315, 322, 340, 179, 313, 207,
564 -
565 - 319, 316, 317, 393, 337, 333, 305, 302, 311, 301,
566 - 310, 190, 338, 337, 393, 307, 322, 301, 305, 277,
567 - 208, 311, 307, 278, 271, 270, 248, 246, 213, 130,
568 - 393, 393, 263, 235, 207, 221, 218, 229, 213, 213,
569 - 206, 234, 218, 210, 208, 193, 219, 393, 223, 204,
570 - 176, 157, 393, 393, 120, 106, 97, 119, 393, 393,
571 - 245, 251, 259, 263, 267, 273, 280, 284, 292, 300,
572 - 304, 310, 318, 326
573 + 0, 393, 35, 392, 66, 391, 38, 107, 397, 401,
574 + 55, 113, 377, 112, 111, 111, 114, 42, 376, 106,
575 + 377, 347, 126, 120, 0, 147, 401, 0, 124, 0,
576 + 137, 158, 170, 163, 401, 153, 401, 389, 401, 0,
577 + 378, 120, 401, 131, 380, 386, 355, 139, 351, 355,
578 + 351, 401, 401, 401, 401, 401, 367, 401, 401, 185,
579 + 350, 346, 401, 364, 0, 185, 347, 189, 356, 355,
580 + 0, 0, 330, 180, 366, 141, 372, 361, 332, 338,
581 + 331, 341, 334, 326, 205, 331, 337, 329, 401, 341,
582 + 167, 316, 401, 349, 348, 320, 328, 346, 180, 318,
583 +
584 + 324, 209, 324, 320, 322, 342, 338, 309, 306, 315,
585 + 305, 315, 312, 192, 342, 341, 401, 293, 306, 282,
586 + 268, 252, 255, 203, 285, 282, 272, 268, 252, 233,
587 + 232, 239, 208, 107, 401, 401, 238, 211, 401, 211,
588 + 212, 208, 228, 203, 215, 207, 233, 222, 212, 211,
589 + 203, 227, 401, 237, 225, 204, 185, 401, 401, 149,
590 + 128, 88, 42, 401, 401, 253, 259, 267, 271, 275,
591 + 281, 288, 292, 300, 308, 312, 318, 326, 334
592 } ;
593
594 -static yyconst flex_int16_t yy_def[175] =
595 +static yyconst flex_int16_t yy_def[180] =
596 { 0,
597 - 160, 1, 1, 1, 1, 5, 160, 7, 1, 1,
598 - 160, 160, 160, 160, 160, 161, 162, 163, 160, 160,
599 - 160, 160, 164, 160, 160, 160, 165, 164, 160, 166,
600 - 167, 166, 166, 160, 160, 160, 160, 161, 160, 161,
601 - 160, 168, 160, 163, 160, 163, 169, 170, 160, 160,
602 - 160, 160, 160, 160, 160, 160, 160, 164, 160, 160,
603 - 160, 160, 160, 160, 164, 166, 167, 166, 160, 160,
604 - 160, 171, 168, 172, 163, 169, 169, 170, 160, 160,
605 - 160, 160, 160, 160, 160, 160, 160, 166, 160, 160,
606 - 171, 172, 160, 160, 160, 160, 160, 160, 160, 160,
607 -
608 - 160, 160, 166, 160, 160, 160, 160, 160, 160, 160,
609 - 160, 173, 160, 166, 160, 160, 160, 160, 160, 160,
610 - 173, 160, 173, 160, 160, 160, 160, 160, 160, 160,
611 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
612 - 160, 160, 174, 160, 160, 160, 174, 160, 174, 160,
613 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 0,
614 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
615 - 160, 160, 160, 160
616 + 165, 1, 1, 3, 165, 5, 1, 1, 165, 165,
617 + 165, 165, 165, 166, 167, 168, 165, 165, 165, 165,
618 + 169, 165, 165, 165, 170, 169, 165, 171, 172, 171,
619 + 171, 165, 165, 165, 165, 166, 165, 166, 165, 173,
620 + 165, 168, 165, 168, 174, 175, 165, 165, 165, 165,
621 + 165, 165, 165, 165, 165, 165, 169, 165, 165, 165,
622 + 165, 165, 165, 169, 171, 172, 171, 165, 165, 165,
623 + 176, 173, 177, 168, 174, 174, 175, 165, 165, 165,
624 + 165, 165, 165, 165, 165, 165, 165, 171, 165, 165,
625 + 176, 177, 165, 165, 165, 165, 165, 165, 165, 165,
626 +
627 + 165, 165, 165, 165, 171, 165, 165, 165, 165, 165,
628 + 165, 165, 165, 178, 165, 171, 165, 165, 165, 165,
629 + 165, 165, 165, 178, 165, 178, 165, 165, 165, 165,
630 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
631 + 165, 165, 165, 165, 165, 165, 165, 179, 165, 165,
632 + 165, 179, 165, 179, 165, 165, 165, 165, 165, 165,
633 + 165, 165, 165, 165, 0, 165, 165, 165, 165, 165,
634 + 165, 165, 165, 165, 165, 165, 165, 165, 165
635 } ;
636
637 -static yyconst flex_int16_t yy_nxt[440] =
638 +static yyconst flex_int16_t yy_nxt[449] =
639 { 0,
640 - 12, 13, 14, 13, 15, 16, 12, 17, 18, 12,
641 - 12, 12, 19, 12, 12, 12, 12, 20, 21, 22,
642 - 23, 23, 23, 23, 23, 12, 12, 23, 23, 23,
643 - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
644 - 23, 23, 23, 12, 24, 12, 25, 34, 35, 35,
645 - 25, 81, 26, 26, 27, 27, 27, 34, 35, 35,
646 - 82, 28, 36, 36, 36, 53, 54, 29, 28, 28,
647 - 28, 28, 12, 13, 14, 13, 15, 16, 30, 17,
648 - 18, 30, 30, 30, 26, 30, 30, 30, 12, 20,
649 - 21, 22, 31, 31, 31, 31, 31, 32, 12, 31,
650 -
651 - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
652 - 31, 31, 31, 31, 31, 12, 24, 12, 36, 36,
653 - 36, 39, 41, 45, 47, 56, 57, 48, 61, 47,
654 - 39, 159, 48, 66, 61, 45, 66, 66, 66, 158,
655 - 46, 40, 49, 59, 50, 157, 51, 49, 52, 50,
656 - 40, 63, 46, 52, 36, 36, 36, 156, 43, 62,
657 - 65, 65, 65, 59, 136, 68, 137, 65, 75, 69,
658 - 69, 69, 70, 71, 65, 65, 65, 65, 70, 71,
659 - 72, 69, 69, 69, 61, 46, 45, 155, 154, 66,
660 - 70, 71, 66, 66, 66, 122, 85, 85, 85, 59,
661 -
662 - 69, 69, 69, 46, 77, 100, 109, 93, 100, 70,
663 - 71, 110, 112, 122, 129, 123, 153, 85, 85, 85,
664 - 135, 135, 135, 148, 148, 160, 135, 135, 135, 152,
665 - 142, 142, 142, 123, 143, 142, 142, 142, 151, 143,
666 - 150, 146, 145, 149, 149, 38, 38, 38, 38, 38,
667 - 38, 38, 38, 42, 144, 141, 140, 42, 42, 44,
668 - 44, 44, 44, 44, 44, 44, 44, 58, 58, 58,
669 - 58, 64, 139, 64, 66, 138, 134, 66, 133, 66,
670 - 66, 67, 132, 131, 67, 67, 67, 67, 73, 130,
671 - 73, 73, 76, 76, 76, 76, 76, 76, 76, 76,
672 -
673 - 78, 78, 78, 78, 78, 78, 78, 78, 91, 160,
674 - 91, 92, 129, 92, 92, 128, 92, 92, 121, 121,
675 - 121, 121, 121, 121, 121, 121, 147, 147, 147, 147,
676 - 147, 147, 147, 147, 127, 126, 125, 124, 61, 61,
677 - 120, 119, 118, 117, 116, 115, 47, 114, 110, 113,
678 - 111, 108, 107, 106, 48, 105, 104, 89, 103, 102,
679 - 101, 99, 98, 97, 96, 95, 94, 79, 77, 90,
680 - 89, 88, 59, 87, 86, 59, 84, 83, 80, 79,
681 - 77, 74, 160, 60, 59, 55, 37, 160, 33, 25,
682 - 26, 25, 11, 160, 160, 160, 160, 160, 160, 160,
683 -
684 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
685 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
686 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
687 - 160, 160, 160, 160, 160, 160, 160, 160, 160
688 + 10, 11, 12, 11, 13, 14, 10, 15, 16, 10,
689 + 10, 10, 17, 10, 10, 10, 10, 18, 19, 20,
690 + 21, 21, 21, 21, 21, 10, 10, 21, 21, 21,
691 + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
692 + 21, 21, 21, 21, 10, 22, 10, 24, 25, 25,
693 + 25, 32, 33, 33, 164, 26, 34, 34, 34, 52,
694 + 53, 27, 26, 26, 26, 26, 10, 11, 12, 11,
695 + 13, 14, 28, 15, 16, 28, 28, 28, 24, 28,
696 + 28, 28, 10, 18, 19, 20, 29, 29, 29, 29,
697 + 29, 30, 10, 29, 29, 29, 29, 29, 29, 29,
698 +
699 + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
700 + 10, 22, 10, 23, 34, 34, 34, 37, 39, 43,
701 + 32, 33, 33, 45, 55, 56, 46, 60, 43, 45,
702 + 65, 163, 46, 65, 65, 65, 44, 38, 60, 74,
703 + 58, 47, 141, 48, 142, 44, 49, 47, 50, 48,
704 + 76, 51, 62, 94, 50, 41, 44, 51, 37, 61,
705 + 64, 64, 64, 58, 34, 34, 34, 64, 162, 80,
706 + 67, 68, 68, 68, 64, 64, 64, 64, 38, 81,
707 + 69, 70, 71, 68, 68, 68, 60, 161, 43, 69,
708 + 70, 65, 69, 70, 65, 65, 65, 125, 85, 85,
709 +
710 + 85, 58, 68, 68, 68, 44, 102, 110, 125, 133,
711 + 102, 69, 70, 111, 114, 160, 159, 126, 85, 85,
712 + 85, 140, 140, 140, 140, 140, 140, 153, 126, 147,
713 + 147, 147, 153, 148, 147, 147, 147, 158, 148, 165,
714 + 157, 156, 155, 151, 150, 149, 146, 154, 145, 144,
715 + 143, 139, 154, 36, 36, 36, 36, 36, 36, 36,
716 + 36, 40, 138, 137, 136, 40, 40, 42, 42, 42,
717 + 42, 42, 42, 42, 42, 57, 57, 57, 57, 63,
718 + 135, 63, 65, 134, 165, 65, 133, 65, 65, 66,
719 + 132, 131, 66, 66, 66, 66, 72, 130, 72, 72,
720 +
721 + 75, 75, 75, 75, 75, 75, 75, 75, 77, 77,
722 + 77, 77, 77, 77, 77, 77, 91, 129, 91, 92,
723 + 128, 92, 92, 127, 92, 92, 124, 124, 124, 124,
724 + 124, 124, 124, 124, 152, 152, 152, 152, 152, 152,
725 + 152, 152, 60, 60, 123, 122, 121, 120, 119, 118,
726 + 117, 45, 116, 111, 115, 113, 112, 109, 108, 107,
727 + 46, 106, 93, 89, 105, 104, 103, 101, 100, 99,
728 + 98, 97, 96, 95, 78, 76, 93, 90, 89, 88,
729 + 58, 87, 86, 58, 84, 83, 82, 79, 78, 76,
730 + 73, 165, 59, 58, 54, 35, 165, 31, 23, 23,
731 +
732 + 9, 165, 165, 165, 165, 165, 165, 165, 165, 165,
733 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
734 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
735 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
736 + 165, 165, 165, 165, 165, 165, 165, 165
737 } ;
738
739 -static yyconst flex_int16_t yy_chk[440] =
740 +static yyconst flex_int16_t yy_chk[449] =
741 { 0,
742 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
743 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
744 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
745 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
746 - 1, 1, 1, 1, 1, 1, 4, 9, 9, 9,
747 - 10, 50, 4, 5, 5, 5, 5, 10, 10, 10,
748 - 50, 5, 13, 13, 13, 20, 20, 5, 5, 5,
749 - 5, 5, 7, 7, 7, 7, 7, 7, 7, 7,
750 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
751 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
752 -
753 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
754 - 7, 7, 7, 7, 7, 7, 7, 7, 14, 14,
755 - 14, 16, 17, 18, 19, 22, 22, 19, 25, 26,
756 - 38, 158, 26, 31, 33, 44, 31, 31, 31, 157,
757 - 18, 16, 19, 31, 19, 156, 19, 26, 19, 26,
758 - 38, 26, 44, 26, 36, 36, 36, 155, 17, 25,
759 - 28, 28, 28, 28, 130, 33, 130, 28, 46, 34,
760 - 34, 34, 91, 91, 28, 28, 28, 28, 34, 34,
761 - 34, 35, 35, 35, 61, 46, 75, 152, 151, 67,
762 - 35, 35, 67, 67, 67, 112, 61, 61, 61, 67,
763 -
764 - 69, 69, 69, 75, 77, 85, 98, 77, 100, 69,
765 - 69, 98, 100, 121, 129, 112, 150, 85, 85, 85,
766 - 135, 135, 135, 143, 147, 149, 129, 129, 129, 146,
767 - 138, 138, 138, 121, 138, 142, 142, 142, 145, 142,
768 - 144, 141, 140, 143, 147, 161, 161, 161, 161, 161,
769 - 161, 161, 161, 162, 139, 137, 136, 162, 162, 163,
770 - 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
771 - 164, 165, 134, 165, 166, 133, 128, 166, 127, 166,
772 - 166, 167, 126, 125, 167, 167, 167, 167, 168, 124,
773 - 168, 168, 169, 169, 169, 169, 169, 169, 169, 169,
774 -
775 - 170, 170, 170, 170, 170, 170, 170, 170, 171, 123,
776 - 171, 172, 122, 172, 172, 120, 172, 172, 173, 173,
777 - 173, 173, 173, 173, 173, 173, 174, 174, 174, 174,
778 - 174, 174, 174, 174, 119, 118, 117, 116, 114, 113,
779 - 111, 110, 109, 108, 107, 106, 105, 103, 102, 101,
780 - 99, 97, 96, 95, 94, 93, 92, 90, 88, 87,
781 - 86, 84, 83, 82, 81, 80, 79, 78, 76, 71,
782 - 70, 68, 65, 63, 62, 58, 52, 51, 49, 48,
783 - 47, 43, 40, 24, 23, 21, 15, 11, 8, 6,
784 - 3, 2, 160, 160, 160, 160, 160, 160, 160, 160,
785 -
786 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
787 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
788 - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
789 - 160, 160, 160, 160, 160, 160, 160, 160, 160
790 + 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
791 + 3, 7, 7, 7, 163, 3, 11, 11, 11, 18,
792 + 18, 3, 3, 3, 3, 3, 5, 5, 5, 5,
793 + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
794 + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
795 + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
796 +
797 + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
798 + 5, 5, 5, 8, 12, 12, 12, 14, 15, 16,
799 + 8, 8, 8, 17, 20, 20, 17, 23, 42, 24,
800 + 29, 162, 24, 29, 29, 29, 16, 14, 31, 44,
801 + 29, 17, 134, 17, 134, 42, 17, 24, 17, 24,
802 + 76, 17, 24, 76, 24, 15, 44, 24, 36, 23,
803 + 26, 26, 26, 26, 34, 34, 34, 26, 161, 48,
804 + 31, 32, 32, 32, 26, 26, 26, 26, 36, 48,
805 + 32, 32, 32, 33, 33, 33, 60, 160, 74, 91,
806 + 91, 66, 33, 33, 66, 66, 66, 114, 60, 60,
807 +
808 + 60, 66, 68, 68, 68, 74, 85, 99, 124, 133,
809 + 102, 68, 68, 99, 102, 157, 156, 114, 85, 85,
810 + 85, 133, 133, 133, 140, 140, 140, 148, 124, 143,
811 + 143, 143, 152, 143, 147, 147, 147, 155, 147, 154,
812 + 151, 150, 149, 146, 145, 144, 142, 148, 141, 138,
813 + 137, 132, 152, 166, 166, 166, 166, 166, 166, 166,
814 + 166, 167, 131, 130, 129, 167, 167, 168, 168, 168,
815 + 168, 168, 168, 168, 168, 169, 169, 169, 169, 170,
816 + 128, 170, 171, 127, 126, 171, 125, 171, 171, 172,
817 + 123, 122, 172, 172, 172, 172, 173, 121, 173, 173,
818 +
819 + 174, 174, 174, 174, 174, 174, 174, 174, 175, 175,
820 + 175, 175, 175, 175, 175, 175, 176, 120, 176, 177,
821 + 119, 177, 177, 118, 177, 177, 178, 178, 178, 178,
822 + 178, 178, 178, 178, 179, 179, 179, 179, 179, 179,
823 + 179, 179, 116, 115, 113, 112, 111, 110, 109, 108,
824 + 107, 106, 105, 104, 103, 101, 100, 98, 97, 96,
825 + 95, 94, 92, 90, 88, 87, 86, 84, 83, 82,
826 + 81, 80, 79, 78, 77, 75, 73, 70, 69, 67,
827 + 64, 62, 61, 57, 51, 50, 49, 47, 46, 45,
828 + 41, 38, 22, 21, 19, 13, 9, 6, 4, 2,
829 +
830 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
831 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
832 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
833 + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
834 + 165, 165, 165, 165, 165, 165, 165, 165
835 } ;
836
837 static yy_state_type yy_last_accepting_state;
838 @@ -631,13 +634,13 @@ char *yytext;
839
840
841
842 -
843 -#line 38 "dtc-lexer.l"
844 +#line 37 "dtc-lexer.l"
845 #include "dtc.h"
846 #include "srcpos.h"
847 #include "dtc-parser.tab.h"
848
849 YYLTYPE yylloc;
850 +extern bool treesource_error;
851
852 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
853 #define YY_USER_ACTION \
854 @@ -659,14 +662,14 @@ static int dts_version = 1;
855 BEGIN(V1); \
856
857 static void push_input_file(const char *filename);
858 -static int pop_input_file(void);
859 -#line 664 "dtc-lexer.lex.c"
860 +static bool pop_input_file(void);
861 +static void lexical_error(const char *fmt, ...);
862 +#line 668 "dtc-lexer.lex.c"
863
864 #define INITIAL 0
865 -#define INCLUDE 1
866 -#define BYTESTRING 2
867 -#define PROPNODENAME 3
868 -#define V1 4
869 +#define BYTESTRING 1
870 +#define PROPNODENAME 2
871 +#define V1 3
872
873 #ifndef YY_NO_UNISTD_H
874 /* Special case for "unistd.h", since it is non-ANSI. We include it way
875 @@ -852,9 +855,9 @@ YY_DECL
876 register char *yy_cp, *yy_bp;
877 register int yy_act;
878
879 -#line 67 "dtc-lexer.l"
880 +#line 68 "dtc-lexer.l"
881
882 -#line 858 "dtc-lexer.lex.c"
883 +#line 861 "dtc-lexer.lex.c"
884
885 if ( !(yy_init) )
886 {
887 @@ -908,13 +911,13 @@ yy_match:
888 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
889 {
890 yy_current_state = (int) yy_def[yy_current_state];
891 - if ( yy_current_state >= 161 )
892 + if ( yy_current_state >= 166 )
893 yy_c = yy_meta[(unsigned int) yy_c];
894 }
895 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
896 ++yy_cp;
897 }
898 - while ( yy_current_state != 160 );
899 + while ( yy_current_state != 165 );
900 yy_cp = (yy_last_accepting_cpos);
901 yy_current_state = (yy_last_accepting_state);
902
903 @@ -937,7 +940,7 @@ do_action: /* This label is used only to access EOF actions. */
904 case 1:
905 /* rule 1 can match eol */
906 YY_RULE_SETUP
907 -#line 68 "dtc-lexer.l"
908 +#line 69 "dtc-lexer.l"
909 {
910 char *name = strchr(yytext, '\"') + 1;
911 yytext[yyleng-1] = '\0';
912 @@ -947,16 +950,16 @@ YY_RULE_SETUP
913 case 2:
914 /* rule 2 can match eol */
915 YY_RULE_SETUP
916 -#line 74 "dtc-lexer.l"
917 +#line 75 "dtc-lexer.l"
918 {
919 char *line, *tmp, *fn;
920 /* skip text before line # */
921 line = yytext;
922 - while (!isdigit(*line))
923 + while (!isdigit((unsigned char)*line))
924 line++;
925 /* skip digits in line # */
926 tmp = line;
927 - while (!isspace(*tmp))
928 + while (!isspace((unsigned char)*tmp))
929 tmp++;
930 /* "NULL"-terminate line # */
931 *tmp = '\0';
932 @@ -970,11 +973,10 @@ YY_RULE_SETUP
933 }
934 YY_BREAK
935 case YY_STATE_EOF(INITIAL):
936 -case YY_STATE_EOF(INCLUDE):
937 case YY_STATE_EOF(BYTESTRING):
938 case YY_STATE_EOF(PROPNODENAME):
939 case YY_STATE_EOF(V1):
940 -#line 95 "dtc-lexer.l"
941 +#line 96 "dtc-lexer.l"
942 {
943 if (!pop_input_file()) {
944 yyterminate();
945 @@ -984,7 +986,7 @@ case YY_STATE_EOF(V1):
946 case 3:
947 /* rule 3 can match eol */
948 YY_RULE_SETUP
949 -#line 101 "dtc-lexer.l"
950 +#line 102 "dtc-lexer.l"
951 {
952 DPRINT("String: %s\n", yytext);
953 yylval.data = data_copy_escape_string(yytext+1,
954 @@ -994,7 +996,7 @@ YY_RULE_SETUP
955 YY_BREAK
956 case 4:
957 YY_RULE_SETUP
958 -#line 108 "dtc-lexer.l"
959 +#line 109 "dtc-lexer.l"
960 {
961 DPRINT("Keyword: /dts-v1/\n");
962 dts_version = 1;
963 @@ -1004,25 +1006,33 @@ YY_RULE_SETUP
964 YY_BREAK
965 case 5:
966 YY_RULE_SETUP
967 -#line 115 "dtc-lexer.l"
968 +#line 116 "dtc-lexer.l"
969 +{
970 + DPRINT("Keyword: /plugin/\n");
971 + return DT_PLUGIN;
972 + }
973 + YY_BREAK
974 +case 6:
975 +YY_RULE_SETUP
976 +#line 121 "dtc-lexer.l"
977 {
978 DPRINT("Keyword: /memreserve/\n");
979 BEGIN_DEFAULT();
980 return DT_MEMRESERVE;
981 }
982 YY_BREAK
983 -case 6:
984 +case 7:
985 YY_RULE_SETUP
986 -#line 121 "dtc-lexer.l"
987 +#line 127 "dtc-lexer.l"
988 {
989 DPRINT("Keyword: /bits/\n");
990 BEGIN_DEFAULT();
991 return DT_BITS;
992 }
993 YY_BREAK
994 -case 7:
995 +case 8:
996 YY_RULE_SETUP
997 -#line 127 "dtc-lexer.l"
998 +#line 133 "dtc-lexer.l"
999 {
1000 DPRINT("Keyword: /delete-property/\n");
1001 DPRINT("<PROPNODENAME>\n");
1002 @@ -1030,9 +1040,9 @@ YY_RULE_SETUP
1003 return DT_DEL_PROP;
1004 }
1005 YY_BREAK
1006 -case 8:
1007 +case 9:
1008 YY_RULE_SETUP
1009 -#line 134 "dtc-lexer.l"
1010 +#line 140 "dtc-lexer.l"
1011 {
1012 DPRINT("Keyword: /delete-node/\n");
1013 DPRINT("<PROPNODENAME>\n");
1014 @@ -1040,9 +1050,9 @@ YY_RULE_SETUP
1015 return DT_DEL_NODE;
1016 }
1017 YY_BREAK
1018 -case 9:
1019 +case 10:
1020 YY_RULE_SETUP
1021 -#line 141 "dtc-lexer.l"
1022 +#line 147 "dtc-lexer.l"
1023 {
1024 DPRINT("Label: %s\n", yytext);
1025 yylval.labelref = xstrdup(yytext);
1026 @@ -1050,38 +1060,65 @@ YY_RULE_SETUP
1027 return DT_LABEL;
1028 }
1029 YY_BREAK
1030 -case 10:
1031 +case 11:
1032 YY_RULE_SETUP
1033 -#line 148 "dtc-lexer.l"
1034 +#line 154 "dtc-lexer.l"
1035 {
1036 - yylval.literal = xstrdup(yytext);
1037 - DPRINT("Literal: '%s'\n", yylval.literal);
1038 + char *e;
1039 + DPRINT("Integer Literal: '%s'\n", yytext);
1040 +
1041 + errno = 0;
1042 + yylval.integer = strtoull(yytext, &e, 0);
1043 +
1044 + assert(!(*e) || !e[strspn(e, "UL")]);
1045 +
1046 + if (errno == ERANGE)
1047 + lexical_error("Integer literal '%s' out of range",
1048 + yytext);
1049 + else
1050 + /* ERANGE is the only strtoull error triggerable
1051 + * by strings matching the pattern */
1052 + assert(errno == 0);
1053 return DT_LITERAL;
1054 }
1055 YY_BREAK
1056 -case 11:
1057 -/* rule 11 can match eol */
1058 +case 12:
1059 +/* rule 12 can match eol */
1060 YY_RULE_SETUP
1061 -#line 154 "dtc-lexer.l"
1062 +#line 173 "dtc-lexer.l"
1063 {
1064 - yytext[yyleng-1] = '\0';
1065 - yylval.literal = xstrdup(yytext+1);
1066 - DPRINT("Character literal: %s\n", yylval.literal);
1067 + struct data d;
1068 + DPRINT("Character literal: %s\n", yytext);
1069 +
1070 + d = data_copy_escape_string(yytext+1, yyleng-2);
1071 + if (d.len == 1) {
1072 + lexical_error("Empty character literal");
1073 + yylval.integer = 0;
1074 + return DT_CHAR_LITERAL;
1075 + }
1076 +
1077 + yylval.integer = (unsigned char)d.val[0];
1078 +
1079 + if (d.len > 2)
1080 + lexical_error("Character literal has %d"
1081 + " characters instead of 1",
1082 + d.len - 1);
1083 +
1084 return DT_CHAR_LITERAL;
1085 }
1086 YY_BREAK
1087 -case 12:
1088 +case 13:
1089 YY_RULE_SETUP
1090 -#line 161 "dtc-lexer.l"
1091 +#line 194 "dtc-lexer.l"
1092 { /* label reference */
1093 DPRINT("Ref: %s\n", yytext+1);
1094 yylval.labelref = xstrdup(yytext+1);
1095 return DT_REF;
1096 }
1097 YY_BREAK
1098 -case 13:
1099 +case 14:
1100 YY_RULE_SETUP
1101 -#line 167 "dtc-lexer.l"
1102 +#line 200 "dtc-lexer.l"
1103 { /* new-style path reference */
1104 yytext[yyleng-1] = '\0';
1105 DPRINT("Ref: %s\n", yytext+2);
1106 @@ -1089,27 +1126,27 @@ YY_RULE_SETUP
1107 return DT_REF;
1108 }
1109 YY_BREAK
1110 -case 14:
1111 +case 15:
1112 YY_RULE_SETUP
1113 -#line 174 "dtc-lexer.l"
1114 +#line 207 "dtc-lexer.l"
1115 {
1116 yylval.byte = strtol(yytext, NULL, 16);
1117 DPRINT("Byte: %02x\n", (int)yylval.byte);
1118 return DT_BYTE;
1119 }
1120 YY_BREAK
1121 -case 15:
1122 +case 16:
1123 YY_RULE_SETUP
1124 -#line 180 "dtc-lexer.l"
1125 +#line 213 "dtc-lexer.l"
1126 {
1127 DPRINT("/BYTESTRING\n");
1128 BEGIN_DEFAULT();
1129 return ']';
1130 }
1131 YY_BREAK
1132 -case 16:
1133 +case 17:
1134 YY_RULE_SETUP
1135 -#line 186 "dtc-lexer.l"
1136 +#line 219 "dtc-lexer.l"
1137 {
1138 DPRINT("PropNodeName: %s\n", yytext);
1139 yylval.propnodename = xstrdup((yytext[0] == '\\') ?
1140 @@ -1118,75 +1155,75 @@ YY_RULE_SETUP
1141 return DT_PROPNODENAME;
1142 }
1143 YY_BREAK
1144 -case 17:
1145 +case 18:
1146 YY_RULE_SETUP
1147 -#line 194 "dtc-lexer.l"
1148 +#line 227 "dtc-lexer.l"
1149 {
1150 DPRINT("Binary Include\n");
1151 return DT_INCBIN;
1152 }
1153 YY_BREAK
1154 -case 18:
1155 -/* rule 18 can match eol */
1156 -YY_RULE_SETUP
1157 -#line 199 "dtc-lexer.l"
1158 -/* eat whitespace */
1159 - YY_BREAK
1160 case 19:
1161 /* rule 19 can match eol */
1162 YY_RULE_SETUP
1163 -#line 200 "dtc-lexer.l"
1164 -/* eat C-style comments */
1165 +#line 232 "dtc-lexer.l"
1166 +/* eat whitespace */
1167 YY_BREAK
1168 case 20:
1169 /* rule 20 can match eol */
1170 YY_RULE_SETUP
1171 -#line 201 "dtc-lexer.l"
1172 -/* eat C++-style comments */
1173 +#line 233 "dtc-lexer.l"
1174 +/* eat C-style comments */
1175 YY_BREAK
1176 case 21:
1177 +/* rule 21 can match eol */
1178 YY_RULE_SETUP
1179 -#line 203 "dtc-lexer.l"
1180 -{ return DT_LSHIFT; };
1181 +#line 234 "dtc-lexer.l"
1182 +/* eat C++-style comments */
1183 YY_BREAK
1184 case 22:
1185 YY_RULE_SETUP
1186 -#line 204 "dtc-lexer.l"
1187 -{ return DT_RSHIFT; };
1188 +#line 236 "dtc-lexer.l"
1189 +{ return DT_LSHIFT; };
1190 YY_BREAK
1191 case 23:
1192 YY_RULE_SETUP
1193 -#line 205 "dtc-lexer.l"
1194 -{ return DT_LE; };
1195 +#line 237 "dtc-lexer.l"
1196 +{ return DT_RSHIFT; };
1197 YY_BREAK
1198 case 24:
1199 YY_RULE_SETUP
1200 -#line 206 "dtc-lexer.l"
1201 -{ return DT_GE; };
1202 +#line 238 "dtc-lexer.l"
1203 +{ return DT_LE; };
1204 YY_BREAK
1205 case 25:
1206 YY_RULE_SETUP
1207 -#line 207 "dtc-lexer.l"
1208 -{ return DT_EQ; };
1209 +#line 239 "dtc-lexer.l"
1210 +{ return DT_GE; };
1211 YY_BREAK
1212 case 26:
1213 YY_RULE_SETUP
1214 -#line 208 "dtc-lexer.l"
1215 -{ return DT_NE; };
1216 +#line 240 "dtc-lexer.l"
1217 +{ return DT_EQ; };
1218 YY_BREAK
1219 case 27:
1220 YY_RULE_SETUP
1221 -#line 209 "dtc-lexer.l"
1222 -{ return DT_AND; };
1223 +#line 241 "dtc-lexer.l"
1224 +{ return DT_NE; };
1225 YY_BREAK
1226 case 28:
1227 YY_RULE_SETUP
1228 -#line 210 "dtc-lexer.l"
1229 -{ return DT_OR; };
1230 +#line 242 "dtc-lexer.l"
1231 +{ return DT_AND; };
1232 YY_BREAK
1233 case 29:
1234 YY_RULE_SETUP
1235 -#line 212 "dtc-lexer.l"
1236 +#line 243 "dtc-lexer.l"
1237 +{ return DT_OR; };
1238 + YY_BREAK
1239 +case 30:
1240 +YY_RULE_SETUP
1241 +#line 245 "dtc-lexer.l"
1242 {
1243 DPRINT("Char: %c (\\x%02x)\n", yytext[0],
1244 (unsigned)yytext[0]);
1245 @@ -1202,12 +1239,12 @@ YY_RULE_SETUP
1246 return yytext[0];
1247 }
1248 YY_BREAK
1249 -case 30:
1250 +case 31:
1251 YY_RULE_SETUP
1252 -#line 227 "dtc-lexer.l"
1253 +#line 260 "dtc-lexer.l"
1254 ECHO;
1255 YY_BREAK
1256 -#line 1211 "dtc-lexer.lex.c"
1257 +#line 1248 "dtc-lexer.lex.c"
1258
1259 case YY_END_OF_BUFFER:
1260 {
1261 @@ -1499,7 +1536,7 @@ static int yy_get_next_buffer (void)
1262 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1263 {
1264 yy_current_state = (int) yy_def[yy_current_state];
1265 - if ( yy_current_state >= 161 )
1266 + if ( yy_current_state >= 166 )
1267 yy_c = yy_meta[(unsigned int) yy_c];
1268 }
1269 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1270 @@ -1527,11 +1564,11 @@ static int yy_get_next_buffer (void)
1271 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1272 {
1273 yy_current_state = (int) yy_def[yy_current_state];
1274 - if ( yy_current_state >= 161 )
1275 + if ( yy_current_state >= 166 )
1276 yy_c = yy_meta[(unsigned int) yy_c];
1277 }
1278 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1279 - yy_is_jam = (yy_current_state == 160);
1280 + yy_is_jam = (yy_current_state == 165);
1281
1282 return yy_is_jam ? 0 : yy_current_state;
1283 }
1284 @@ -2166,7 +2203,7 @@ void yyfree (void * ptr )
1285
1286 #define YYTABLES_NAME "yytables"
1287
1288 -#line 227 "dtc-lexer.l"
1289 +#line 260 "dtc-lexer.l"
1290
1291
1292
1293 @@ -2182,14 +2219,25 @@ static void push_input_file(const char *filename)
1294 }
1295
1296
1297 -static int pop_input_file(void)
1298 +static bool pop_input_file(void)
1299 {
1300 if (srcfile_pop() == 0)
1301 - return 0;
1302 + return false;
1303
1304 yypop_buffer_state();
1305 yyin = current_srcfile->f;
1306
1307 - return 1;
1308 + return true;
1309 +}
1310 +
1311 +static void lexical_error(const char *fmt, ...)
1312 +{
1313 + va_list ap;
1314 +
1315 + va_start(ap, fmt);
1316 + srcpos_verror(&yylloc, "Lexical error", fmt, ap);
1317 + va_end(ap);
1318 +
1319 + treesource_error = true;
1320 }
1321
1322 diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped
1323 index c8769d5..1938d20 100644
1324 --- a/scripts/dtc/dtc-parser.tab.c_shipped
1325 +++ b/scripts/dtc/dtc-parser.tab.c_shipped
1326 @@ -1,19 +1,19 @@
1327 -/* A Bison parser, made by GNU Bison 2.7.12-4996. */
1328 +/* A Bison parser, made by GNU Bison 3.0.2. */
1329
1330 /* Bison implementation for Yacc-like parsers in C
1331 -
1332 - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
1333 -
1334 +
1335 + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
1336 +
1337 This program is free software: you can redistribute it and/or modify
1338 it under the terms of the GNU General Public License as published by
1339 the Free Software Foundation, either version 3 of the License, or
1340 (at your option) any later version.
1341 -
1342 +
1343 This program is distributed in the hope that it will be useful,
1344 but WITHOUT ANY WARRANTY; without even the implied warranty of
1345 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1346 GNU General Public License for more details.
1347 -
1348 +
1349 You should have received a copy of the GNU General Public License
1350 along with this program. If not, see <http://www.gnu.org/licenses/>. */
1351
1352 @@ -26,7 +26,7 @@
1353 special exception, which will cause the skeleton and the resulting
1354 Bison output files to be licensed under the GNU General Public
1355 License without this special exception.
1356 -
1357 +
1358 This special exception was added by the Free Software Foundation in
1359 version 2.2 of Bison. */
1360
1361 @@ -44,7 +44,7 @@
1362 #define YYBISON 1
1363
1364 /* Bison version. */
1365 -#define YYBISON_VERSION "2.7.12-4996"
1366 +#define YYBISON_VERSION "3.0.2"
1367
1368 /* Skeleton name. */
1369 #define YYSKELETON_NAME "yacc.c"
1370 @@ -62,34 +62,32 @@
1371
1372
1373 /* Copy the first part of user declarations. */
1374 -/* Line 371 of yacc.c */
1375 -#line 21 "dtc-parser.y"
1376 +#line 20 "dtc-parser.y" /* yacc.c:339 */
1377
1378 #include <stdio.h>
1379 +#include <inttypes.h>
1380
1381 #include "dtc.h"
1382 #include "srcpos.h"
1383
1384 -YYLTYPE yylloc;
1385 -
1386 extern int yylex(void);
1387 -extern void print_error(char const *fmt, ...);
1388 extern void yyerror(char const *s);
1389 +#define ERROR(loc, ...) \
1390 + do { \
1391 + srcpos_error((loc), "Error", __VA_ARGS__); \
1392 + treesource_error = true; \
1393 + } while (0)
1394
1395 extern struct boot_info *the_boot_info;
1396 -extern int treesource_error;
1397 -
1398 -static unsigned long long eval_literal(const char *s, int base, int bits);
1399 -static unsigned char eval_char_literal(const char *s);
1400 +extern bool treesource_error;
1401
1402 -/* Line 371 of yacc.c */
1403 -#line 87 "dtc-parser.tab.c"
1404 +#line 85 "dtc-parser.tab.c" /* yacc.c:339 */
1405
1406 -# ifndef YY_NULL
1407 +# ifndef YY_NULLPTR
1408 # if defined __cplusplus && 201103L <= __cplusplus
1409 -# define YY_NULL nullptr
1410 +# define YY_NULLPTR nullptr
1411 # else
1412 -# define YY_NULL 0
1413 +# define YY_NULLPTR 0
1414 # endif
1415 # endif
1416
1417 @@ -105,7 +103,7 @@ static unsigned char eval_char_literal(const char *s);
1418 by #include "dtc-parser.tab.h". */
1419 #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED
1420 # define YY_YY_DTC_PARSER_TAB_H_INCLUDED
1421 -/* Enabling traces. */
1422 +/* Debug traces. */
1423 #ifndef YYDEBUG
1424 # define YYDEBUG 0
1425 #endif
1426 @@ -113,48 +111,45 @@ static unsigned char eval_char_literal(const char *s);
1427 extern int yydebug;
1428 #endif
1429
1430 -/* Tokens. */
1431 +/* Token type. */
1432 #ifndef YYTOKENTYPE
1433 # define YYTOKENTYPE
1434 - /* Put the tokens into the symbol table, so that GDB and other debuggers
1435 - know about them. */
1436 - enum yytokentype {
1437 - DT_V1 = 258,
1438 - DT_MEMRESERVE = 259,
1439 - DT_LSHIFT = 260,
1440 - DT_RSHIFT = 261,
1441 - DT_LE = 262,
1442 - DT_GE = 263,
1443 - DT_EQ = 264,
1444 - DT_NE = 265,
1445 - DT_AND = 266,
1446 - DT_OR = 267,
1447 - DT_BITS = 268,
1448 - DT_DEL_PROP = 269,
1449 - DT_DEL_NODE = 270,
1450 - DT_PROPNODENAME = 271,
1451 - DT_LITERAL = 272,
1452 - DT_CHAR_LITERAL = 273,
1453 - DT_BASE = 274,
1454 - DT_BYTE = 275,
1455 - DT_STRING = 276,
1456 - DT_LABEL = 277,
1457 - DT_REF = 278,
1458 - DT_INCBIN = 279
1459 - };
1460 + enum yytokentype
1461 + {
1462 + DT_V1 = 258,
1463 + DT_PLUGIN = 259,
1464 + DT_MEMRESERVE = 260,
1465 + DT_LSHIFT = 261,
1466 + DT_RSHIFT = 262,
1467 + DT_LE = 263,
1468 + DT_GE = 264,
1469 + DT_EQ = 265,
1470 + DT_NE = 266,
1471 + DT_AND = 267,
1472 + DT_OR = 268,
1473 + DT_BITS = 269,
1474 + DT_DEL_PROP = 270,
1475 + DT_DEL_NODE = 271,
1476 + DT_PROPNODENAME = 272,
1477 + DT_LITERAL = 273,
1478 + DT_CHAR_LITERAL = 274,
1479 + DT_BYTE = 275,
1480 + DT_STRING = 276,
1481 + DT_LABEL = 277,
1482 + DT_REF = 278,
1483 + DT_INCBIN = 279
1484 + };
1485 #endif
1486
1487 -
1488 +/* Value type. */
1489 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1490 -typedef union YYSTYPE
1491 +typedef union YYSTYPE YYSTYPE;
1492 +union YYSTYPE
1493 {
1494 -/* Line 387 of yacc.c */
1495 -#line 40 "dtc-parser.y"
1496 +#line 39 "dtc-parser.y" /* yacc.c:355 */
1497
1498 char *propnodename;
1499 - char *literal;
1500 char *labelref;
1501 - unsigned int cbase;
1502 uint8_t byte;
1503 struct data data;
1504
1505 @@ -169,38 +164,38 @@ typedef union YYSTYPE
1506 struct node *nodelist;
1507 struct reserve_info *re;
1508 uint64_t integer;
1509 + int is_plugin;
1510
1511 -
1512 -/* Line 387 of yacc.c */
1513 -#line 176 "dtc-parser.tab.c"
1514 -} YYSTYPE;
1515 +#line 170 "dtc-parser.tab.c" /* yacc.c:355 */
1516 +};
1517 # define YYSTYPE_IS_TRIVIAL 1
1518 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1519 # define YYSTYPE_IS_DECLARED 1
1520 #endif
1521
1522 -extern YYSTYPE yylval;
1523 -
1524 -#ifdef YYPARSE_PARAM
1525 -#if defined __STDC__ || defined __cplusplus
1526 -int yyparse (void *YYPARSE_PARAM);
1527 -#else
1528 -int yyparse ();
1529 +/* Location type. */
1530 +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
1531 +typedef struct YYLTYPE YYLTYPE;
1532 +struct YYLTYPE
1533 +{
1534 + int first_line;
1535 + int first_column;
1536 + int last_line;
1537 + int last_column;
1538 +};
1539 +# define YYLTYPE_IS_DECLARED 1
1540 +# define YYLTYPE_IS_TRIVIAL 1
1541 #endif
1542 -#else /* ! YYPARSE_PARAM */
1543 -#if defined __STDC__ || defined __cplusplus
1544 +
1545 +
1546 +extern YYSTYPE yylval;
1547 +extern YYLTYPE yylloc;
1548 int yyparse (void);
1549 -#else
1550 -int yyparse ();
1551 -#endif
1552 -#endif /* ! YYPARSE_PARAM */
1553
1554 #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */
1555
1556 /* Copy the second part of user declarations. */
1557
1558 -/* Line 390 of yacc.c */
1559 -#line 204 "dtc-parser.tab.c"
1560 +#line 199 "dtc-parser.tab.c" /* yacc.c:358 */
1561
1562 #ifdef short
1563 # undef short
1564 @@ -214,11 +209,8 @@ typedef unsigned char yytype_uint8;
1565
1566 #ifdef YYTYPE_INT8
1567 typedef YYTYPE_INT8 yytype_int8;
1568 -#elif (defined __STDC__ || defined __C99__FUNC__ \
1569 - || defined __cplusplus || defined _MSC_VER)
1570 -typedef signed char yytype_int8;
1571 #else
1572 -typedef short int yytype_int8;
1573 +typedef signed char yytype_int8;
1574 #endif
1575
1576 #ifdef YYTYPE_UINT16
1577 @@ -238,8 +230,7 @@ typedef short int yytype_int16;
1578 # define YYSIZE_T __SIZE_TYPE__
1579 # elif defined size_t
1580 # define YYSIZE_T size_t
1581 -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1582 - || defined __cplusplus || defined _MSC_VER)
1583 +# elif ! defined YYSIZE_T
1584 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1585 # define YYSIZE_T size_t
1586 # else
1587 @@ -261,11 +252,30 @@ typedef short int yytype_int16;
1588 # endif
1589 #endif
1590
1591 -#ifndef __attribute__
1592 -/* This feature is available in gcc versions 2.5 and later. */
1593 -# if (! defined __GNUC__ || __GNUC__ < 2 \
1594 - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
1595 -# define __attribute__(Spec) /* empty */
1596 +#ifndef YY_ATTRIBUTE
1597 +# if (defined __GNUC__ \
1598 + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
1599 + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
1600 +# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
1601 +# else
1602 +# define YY_ATTRIBUTE(Spec) /* empty */
1603 +# endif
1604 +#endif
1605 +
1606 +#ifndef YY_ATTRIBUTE_PURE
1607 +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
1608 +#endif
1609 +
1610 +#ifndef YY_ATTRIBUTE_UNUSED
1611 +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
1612 +#endif
1613 +
1614 +#if !defined _Noreturn \
1615 + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
1616 +# if defined _MSC_VER && 1200 <= _MSC_VER
1617 +# define _Noreturn __declspec (noreturn)
1618 +# else
1619 +# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
1620 # endif
1621 #endif
1622
1623 @@ -276,25 +286,26 @@ typedef short int yytype_int16;
1624 # define YYUSE(E) /* empty */
1625 #endif
1626
1627 -
1628 -/* Identity function, used to suppress warnings about constant conditions. */
1629 -#ifndef lint
1630 -# define YYID(N) (N)
1631 -#else
1632 -#if (defined __STDC__ || defined __C99__FUNC__ \
1633 - || defined __cplusplus || defined _MSC_VER)
1634 -static int
1635 -YYID (int yyi)
1636 +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
1637 +/* Suppress an incorrect diagnostic about yylval being uninitialized. */
1638 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
1639 + _Pragma ("GCC diagnostic push") \
1640 + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
1641 + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1642 +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
1643 + _Pragma ("GCC diagnostic pop")
1644 #else
1645 -static int
1646 -YYID (yyi)
1647 - int yyi;
1648 +# define YY_INITIAL_VALUE(Value) Value
1649 #endif
1650 -{
1651 - return yyi;
1652 -}
1653 +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1654 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1655 +# define YY_IGNORE_MAYBE_UNINITIALIZED_END
1656 +#endif
1657 +#ifndef YY_INITIAL_VALUE
1658 +# define YY_INITIAL_VALUE(Value) /* Nothing. */
1659 #endif
1660
1661 +
1662 #if ! defined yyoverflow || YYERROR_VERBOSE
1663
1664 /* The parser invokes alloca or malloc; define the necessary symbols. */
1665 @@ -312,8 +323,7 @@ YYID (yyi)
1666 # define alloca _alloca
1667 # else
1668 # define YYSTACK_ALLOC alloca
1669 -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1670 - || defined __cplusplus || defined _MSC_VER)
1671 +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
1672 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1673 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
1674 # ifndef EXIT_SUCCESS
1675 @@ -325,8 +335,8 @@ YYID (yyi)
1676 # endif
1677
1678 # ifdef YYSTACK_ALLOC
1679 - /* Pacify GCC's `empty if-body' warning. */
1680 -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1681 + /* Pacify GCC's 'empty if-body' warning. */
1682 +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1683 # ifndef YYSTACK_ALLOC_MAXIMUM
1684 /* The OS might guarantee only one guard page at the bottom of the stack,
1685 and a page size can be as small as 4096 bytes. So we cannot safely
1686 @@ -342,7 +352,7 @@ YYID (yyi)
1687 # endif
1688 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
1689 && ! ((defined YYMALLOC || defined malloc) \
1690 - && (defined YYFREE || defined free)))
1691 + && (defined YYFREE || defined free)))
1692 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1693 # ifndef EXIT_SUCCESS
1694 # define EXIT_SUCCESS 0
1695 @@ -350,15 +360,13 @@ YYID (yyi)
1696 # endif
1697 # ifndef YYMALLOC
1698 # define YYMALLOC malloc
1699 -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1700 - || defined __cplusplus || defined _MSC_VER)
1701 +# if ! defined malloc && ! defined EXIT_SUCCESS
1702 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1703 # endif
1704 # endif
1705 # ifndef YYFREE
1706 # define YYFREE free
1707 -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
1708 - || defined __cplusplus || defined _MSC_VER)
1709 +# if ! defined free && ! defined EXIT_SUCCESS
1710 void free (void *); /* INFRINGES ON USER NAME SPACE */
1711 # endif
1712 # endif
1713 @@ -368,13 +376,15 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
1714
1715 #if (! defined yyoverflow \
1716 && (! defined __cplusplus \
1717 - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1718 + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
1719 + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1720
1721 /* A type that is properly aligned for any stack member. */
1722 union yyalloc
1723 {
1724 yytype_int16 yyss_alloc;
1725 YYSTYPE yyvs_alloc;
1726 + YYLTYPE yyls_alloc;
1727 };
1728
1729 /* The size of the maximum gap between one aligned stack and the next. */
1730 @@ -383,8 +393,8 @@ union yyalloc
1731 /* The size of an array large to enough to hold all stacks, each with
1732 N elements. */
1733 # define YYSTACK_BYTES(N) \
1734 - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1735 - + YYSTACK_GAP_MAXIMUM)
1736 + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
1737 + + 2 * YYSTACK_GAP_MAXIMUM)
1738
1739 # define YYCOPY_NEEDED 1
1740
1741 @@ -393,16 +403,16 @@ union yyalloc
1742 elements in the stack, and YYPTR gives the new location of the
1743 stack. Advance YYPTR to a properly aligned location for the next
1744 stack. */
1745 -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
1746 - do \
1747 - { \
1748 - YYSIZE_T yynewbytes; \
1749 - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
1750 - Stack = &yyptr->Stack_alloc; \
1751 - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1752 - yyptr += yynewbytes / sizeof (*yyptr); \
1753 - } \
1754 - while (YYID (0))
1755 +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
1756 + do \
1757 + { \
1758 + YYSIZE_T yynewbytes; \
1759 + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
1760 + Stack = &yyptr->Stack_alloc; \
1761 + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1762 + yyptr += yynewbytes / sizeof (*yyptr); \
1763 + } \
1764 + while (0)
1765
1766 #endif
1767
1768 @@ -421,7 +431,7 @@ union yyalloc
1769 for (yyi = 0; yyi < (Count); yyi++) \
1770 (Dst)[yyi] = (Src)[yyi]; \
1771 } \
1772 - while (YYID (0))
1773 + while (0)
1774 # endif
1775 # endif
1776 #endif /* !YYCOPY_NEEDED */
1777 @@ -429,25 +439,27 @@ union yyalloc
1778 /* YYFINAL -- State number of the termination state. */
1779 #define YYFINAL 4
1780 /* YYLAST -- Last index in YYTABLE. */
1781 -#define YYLAST 133
1782 +#define YYLAST 135
1783
1784 /* YYNTOKENS -- Number of terminals. */
1785 #define YYNTOKENS 48
1786 /* YYNNTS -- Number of nonterminals. */
1787 -#define YYNNTS 28
1788 +#define YYNNTS 29
1789 /* YYNRULES -- Number of rules. */
1790 -#define YYNRULES 79
1791 -/* YYNRULES -- Number of states. */
1792 -#define YYNSTATES 141
1793 +#define YYNRULES 81
1794 +/* YYNSTATES -- Number of states. */
1795 +#define YYNSTATES 144
1796
1797 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1798 +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
1799 + by yylex, with out-of-bounds checking. */
1800 #define YYUNDEFTOK 2
1801 #define YYMAXUTOK 279
1802
1803 -#define YYTRANSLATE(YYX) \
1804 +#define YYTRANSLATE(YYX) \
1805 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1806
1807 -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1808 +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
1809 + as returned by yylex, without out-of-bounds checking. */
1810 static const yytype_uint8 yytranslate[] =
1811 {
1812 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1813 @@ -481,63 +493,18 @@ static const yytype_uint8 yytranslate[] =
1814 };
1815
1816 #if YYDEBUG
1817 -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1818 - YYRHS. */
1819 -static const yytype_uint16 yyprhs[] =
1820 -{
1821 - 0, 0, 3, 8, 9, 12, 17, 20, 23, 27,
1822 - 31, 36, 42, 43, 46, 51, 54, 58, 61, 64,
1823 - 68, 73, 76, 86, 92, 95, 96, 99, 102, 106,
1824 - 108, 111, 114, 117, 119, 121, 125, 127, 129, 135,
1825 - 137, 141, 143, 147, 149, 153, 155, 159, 161, 165,
1826 - 167, 171, 175, 177, 181, 185, 189, 193, 197, 201,
1827 - 203, 207, 211, 213, 217, 221, 225, 227, 229, 232,
1828 - 235, 238, 239, 242, 245, 246, 249, 252, 255, 259
1829 -};
1830 -
1831 -/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1832 -static const yytype_int8 yyrhs[] =
1833 -{
1834 - 49, 0, -1, 3, 25, 50, 52, -1, -1, 51,
1835 - 50, -1, 4, 59, 59, 25, -1, 22, 51, -1,
1836 - 26, 53, -1, 52, 26, 53, -1, 52, 23, 53,
1837 - -1, 52, 15, 23, 25, -1, 27, 54, 74, 28,
1838 - 25, -1, -1, 54, 55, -1, 16, 29, 56, 25,
1839 - -1, 16, 25, -1, 14, 16, 25, -1, 22, 55,
1840 - -1, 57, 21, -1, 57, 58, 30, -1, 57, 31,
1841 - 73, 32, -1, 57, 23, -1, 57, 24, 33, 21,
1842 - 34, 59, 34, 59, 35, -1, 57, 24, 33, 21,
1843 - 35, -1, 56, 22, -1, -1, 56, 34, -1, 57,
1844 - 22, -1, 13, 17, 36, -1, 36, -1, 58, 59,
1845 - -1, 58, 23, -1, 58, 22, -1, 17, -1, 18,
1846 - -1, 33, 60, 35, -1, 61, -1, 62, -1, 62,
1847 - 37, 60, 38, 61, -1, 63, -1, 62, 12, 63,
1848 - -1, 64, -1, 63, 11, 64, -1, 65, -1, 64,
1849 - 39, 65, -1, 66, -1, 65, 40, 66, -1, 67,
1850 - -1, 66, 41, 67, -1, 68, -1, 67, 9, 68,
1851 - -1, 67, 10, 68, -1, 69, -1, 68, 36, 69,
1852 - -1, 68, 30, 69, -1, 68, 7, 69, -1, 68,
1853 - 8, 69, -1, 69, 5, 70, -1, 69, 6, 70,
1854 - -1, 70, -1, 70, 42, 71, -1, 70, 43, 71,
1855 - -1, 71, -1, 71, 44, 72, -1, 71, 26, 72,
1856 - -1, 71, 45, 72, -1, 72, -1, 59, -1, 43,
1857 - 72, -1, 46, 72, -1, 47, 72, -1, -1, 73,
1858 - 20, -1, 73, 22, -1, -1, 75, 74, -1, 75,
1859 - 55, -1, 16, 53, -1, 15, 16, 25, -1, 22,
1860 - 75, -1
1861 -};
1862 -
1863 -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1864 + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
1865 static const yytype_uint16 yyrline[] =
1866 {
1867 - 0, 109, 109, 118, 121, 128, 132, 140, 144, 148,
1868 - 158, 172, 180, 183, 190, 194, 198, 202, 210, 214,
1869 - 218, 222, 226, 243, 253, 261, 264, 268, 275, 290,
1870 - 295, 315, 329, 336, 340, 344, 351, 355, 356, 360,
1871 - 361, 365, 366, 370, 371, 375, 376, 380, 381, 385,
1872 - 386, 387, 391, 392, 393, 394, 395, 399, 400, 401,
1873 - 405, 406, 407, 411, 412, 413, 414, 418, 419, 420,
1874 - 421, 426, 429, 433, 441, 444, 448, 456, 460, 464
1875 + 0, 108, 108, 119, 122, 130, 133, 140, 144, 152,
1876 + 156, 160, 170, 185, 193, 196, 203, 207, 211, 215,
1877 + 223, 227, 231, 235, 239, 255, 265, 273, 276, 280,
1878 + 287, 303, 308, 327, 341, 348, 349, 350, 357, 361,
1879 + 362, 366, 367, 371, 372, 376, 377, 381, 382, 386,
1880 + 387, 391, 392, 393, 397, 398, 399, 400, 401, 405,
1881 + 406, 407, 411, 412, 413, 417, 418, 419, 420, 424,
1882 + 425, 426, 427, 432, 435, 439, 447, 450, 454, 462,
1883 + 466, 470
1884 };
1885 #endif
1886
1887 @@ -546,25 +513,25 @@ static const yytype_uint16 yyrline[] =
1888 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1889 static const char *const yytname[] =
1890 {
1891 - "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT",
1892 - "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR",
1893 - "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL",
1894 - "DT_CHAR_LITERAL", "DT_BASE", "DT_BYTE", "DT_STRING", "DT_LABEL",
1895 + "$end", "error", "$undefined", "DT_V1", "DT_PLUGIN", "DT_MEMRESERVE",
1896 + "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND",
1897 + "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME",
1898 + "DT_LITERAL", "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL",
1899 "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['",
1900 "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'",
1901 "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile",
1902 - "memreserves", "memreserve", "devicetree", "nodedef", "proplist",
1903 - "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim",
1904 - "integer_expr", "integer_trinary", "integer_or", "integer_and",
1905 - "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq",
1906 - "integer_rela", "integer_shift", "integer_add", "integer_mul",
1907 - "integer_unary", "bytestring", "subnodes", "subnode", YY_NULL
1908 + "plugindecl", "memreserves", "memreserve", "devicetree", "nodedef",
1909 + "proplist", "propdef", "propdata", "propdataprefix", "arrayprefix",
1910 + "integer_prim", "integer_expr", "integer_trinary", "integer_or",
1911 + "integer_and", "integer_bitor", "integer_bitxor", "integer_bitand",
1912 + "integer_eq", "integer_rela", "integer_shift", "integer_add",
1913 + "integer_mul", "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR
1914 };
1915 #endif
1916
1917 # ifdef YYPRINT
1918 -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1919 - token YYLEX-NUM. */
1920 +/* YYTOKNUM[NUM] -- (External) token number corresponding to the
1921 + (internal) symbol number NUM (which must be that of a token). */
1922 static const yytype_uint16 yytoknum[] =
1923 {
1924 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1925 @@ -575,183 +542,173 @@ static const yytype_uint16 yytoknum[] =
1926 };
1927 # endif
1928
1929 -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1930 -static const yytype_uint8 yyr1[] =
1931 -{
1932 - 0, 48, 49, 50, 50, 51, 51, 52, 52, 52,
1933 - 52, 53, 54, 54, 55, 55, 55, 55, 56, 56,
1934 - 56, 56, 56, 56, 56, 57, 57, 57, 58, 58,
1935 - 58, 58, 58, 59, 59, 59, 60, 61, 61, 62,
1936 - 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
1937 - 67, 67, 68, 68, 68, 68, 68, 69, 69, 69,
1938 - 70, 70, 70, 71, 71, 71, 71, 72, 72, 72,
1939 - 72, 73, 73, 73, 74, 74, 74, 75, 75, 75
1940 -};
1941 +#define YYPACT_NINF -41
1942
1943 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1944 -static const yytype_uint8 yyr2[] =
1945 +#define yypact_value_is_default(Yystate) \
1946 + (!!((Yystate) == (-41)))
1947 +
1948 +#define YYTABLE_NINF -1
1949 +
1950 +#define yytable_value_is_error(Yytable_value) \
1951 + 0
1952 +
1953 + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1954 + STATE-NUM. */
1955 +static const yytype_int8 yypact[] =
1956 {
1957 - 0, 2, 4, 0, 2, 4, 2, 2, 3, 3,
1958 - 4, 5, 0, 2, 4, 2, 3, 2, 2, 3,
1959 - 4, 2, 9, 5, 2, 0, 2, 2, 3, 1,
1960 - 2, 2, 2, 1, 1, 3, 1, 1, 5, 1,
1961 - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
1962 - 3, 3, 1, 3, 3, 3, 3, 3, 3, 1,
1963 - 3, 3, 1, 3, 3, 3, 1, 1, 2, 2,
1964 - 2, 0, 2, 2, 0, 2, 2, 2, 3, 2
1965 + 37, 10, 24, 78, -41, 20, 9, -41, 8, 9,
1966 + 59, 9, -41, -41, -10, 8, -41, 60, 39, -41,
1967 + -10, -10, -10, -41, 51, -41, -7, 76, 50, 52,
1968 + 53, 49, 2, 65, 32, -1, -41, 66, -41, -41,
1969 + 67, 60, 60, -41, -41, -41, -41, -10, -10, -10,
1970 + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10,
1971 + -10, -10, -10, -10, -10, -10, -41, 41, 68, -41,
1972 + -41, 76, 57, 50, 52, 53, 49, 2, 2, 65,
1973 + 65, 65, 65, 32, 32, -1, -1, -41, -41, -41,
1974 + 79, 80, -12, 41, -41, 70, 41, -41, -10, 74,
1975 + 75, -41, -41, -41, -41, -41, 77, -41, -41, -41,
1976 + -41, -41, 17, -2, -41, -41, -41, -41, 83, -41,
1977 + -41, -41, 71, -41, -41, 31, 69, 82, -4, -41,
1978 + -41, -41, -41, -41, 42, -41, -41, -41, 8, -41,
1979 + 72, 8, 73, -41
1980 };
1981
1982 -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
1983 - Performed when YYTABLE doesn't specify something else to do. Zero
1984 - means the default is an error. */
1985 + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
1986 + Performed when YYTABLE does not specify something else to do. Zero
1987 + means the default is an error. */
1988 static const yytype_uint8 yydefact[] =
1989 {
1990 - 0, 0, 0, 3, 1, 0, 0, 0, 3, 33,
1991 - 34, 0, 0, 6, 0, 2, 4, 0, 0, 0,
1992 - 67, 0, 36, 37, 39, 41, 43, 45, 47, 49,
1993 - 52, 59, 62, 66, 0, 12, 7, 0, 0, 0,
1994 - 68, 69, 70, 35, 0, 0, 0, 0, 0, 0,
1995 + 0, 0, 0, 3, 1, 0, 5, 4, 0, 0,
1996 + 0, 5, 35, 36, 0, 0, 8, 0, 2, 6,
1997 + 0, 0, 0, 69, 0, 38, 39, 41, 43, 45,
1998 + 47, 49, 51, 54, 61, 64, 68, 0, 14, 9,
1999 + 0, 0, 0, 70, 71, 72, 37, 0, 0, 0,
2000 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2001 - 0, 0, 0, 5, 74, 0, 9, 8, 40, 0,
2002 - 42, 44, 46, 48, 50, 51, 55, 56, 54, 53,
2003 - 57, 58, 60, 61, 64, 63, 65, 0, 0, 0,
2004 - 0, 13, 0, 74, 10, 0, 0, 0, 15, 25,
2005 - 77, 17, 79, 0, 76, 75, 38, 16, 78, 0,
2006 - 0, 11, 24, 14, 26, 0, 18, 27, 21, 0,
2007 - 71, 29, 0, 0, 0, 0, 32, 31, 19, 30,
2008 - 28, 0, 72, 73, 20, 0, 23, 0, 0, 0,
2009 - 22
2010 + 0, 0, 0, 0, 0, 0, 7, 76, 0, 11,
2011 + 10, 42, 0, 44, 46, 48, 50, 52, 53, 57,
2012 + 58, 56, 55, 59, 60, 62, 63, 66, 65, 67,
2013 + 0, 0, 0, 0, 15, 0, 76, 12, 0, 0,
2014 + 0, 17, 27, 79, 19, 81, 0, 78, 77, 40,
2015 + 18, 80, 0, 0, 13, 26, 16, 28, 0, 20,
2016 + 29, 23, 0, 73, 31, 0, 0, 0, 0, 34,
2017 + 33, 21, 32, 30, 0, 74, 75, 22, 0, 25,
2018 + 0, 0, 0, 24
2019 };
2020
2021 -/* YYDEFGOTO[NTERM-NUM]. */
2022 -static const yytype_int8 yydefgoto[] =
2023 + /* YYPGOTO[NTERM-NUM]. */
2024 +static const yytype_int8 yypgoto[] =
2025 {
2026 - -1, 2, 7, 8, 15, 36, 64, 91, 109, 110,
2027 - 122, 20, 21, 22, 23, 24, 25, 26, 27, 28,
2028 - 29, 30, 31, 32, 33, 125, 92, 93
2029 + -41, -41, -41, 96, 100, -41, -40, -41, -23, -41,
2030 + -41, -41, -8, 62, 13, -41, 81, 63, 64, 84,
2031 + 61, 25, 11, 21, 22, -17, -41, 19, 23
2032 };
2033
2034 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2035 - STATE-NUM. */
2036 -#define YYPACT_NINF -78
2037 -static const yytype_int8 yypact[] =
2038 + /* YYDEFGOTO[NTERM-NUM]. */
2039 +static const yytype_int16 yydefgoto[] =
2040 {
2041 - 22, 11, 51, 10, -78, 23, 10, 2, 10, -78,
2042 - -78, -9, 23, -78, 30, 38, -78, -9, -9, -9,
2043 - -78, 35, -78, -6, 52, 29, 48, 49, 33, 3,
2044 - 71, 36, 0, -78, 64, -78, -78, 68, 30, 30,
2045 - -78, -78, -78, -78, -9, -9, -9, -9, -9, -9,
2046 - -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
2047 - -9, -9, -9, -78, 44, 67, -78, -78, 52, 55,
2048 - 29, 48, 49, 33, 3, 3, 71, 71, 71, 71,
2049 - 36, 36, 0, 0, -78, -78, -78, 78, 79, 42,
2050 - 44, -78, 69, 44, -78, -9, 73, 74, -78, -78,
2051 - -78, -78, -78, 75, -78, -78, -78, -78, -78, -7,
2052 - -1, -78, -78, -78, -78, 84, -78, -78, -78, 63,
2053 - -78, -78, 32, 66, 82, -3, -78, -78, -78, -78,
2054 - -78, 46, -78, -78, -78, 23, -78, 70, 23, 72,
2055 - -78
2056 + -1, 2, 6, 10, 11, 18, 39, 67, 94, 112,
2057 + 113, 125, 23, 24, 25, 26, 27, 28, 29, 30,
2058 + 31, 32, 33, 34, 35, 36, 128, 95, 96
2059 };
2060
2061 -/* YYPGOTO[NTERM-NUM]. */
2062 -static const yytype_int8 yypgoto[] =
2063 + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
2064 + positive, shift that token. If negative, reduce the rule whose
2065 + number is the opposite. If YYTABLE_NINF, syntax error. */
2066 +static const yytype_uint8 yytable[] =
2067 {
2068 - -78, -78, 97, 100, -78, -37, -78, -77, -78, -78,
2069 - -78, -5, 65, 13, -78, 76, 77, 62, 80, 83,
2070 - 34, 20, 26, 28, -14, -78, 18, 24
2071 + 15, 69, 70, 43, 44, 45, 47, 37, 12, 13,
2072 + 55, 56, 118, 101, 8, 38, 135, 102, 136, 119,
2073 + 120, 121, 122, 14, 4, 63, 12, 13, 137, 123,
2074 + 48, 9, 57, 20, 124, 3, 21, 22, 58, 115,
2075 + 1, 14, 116, 64, 65, 7, 87, 88, 89, 12,
2076 + 13, 117, 103, 129, 130, 40, 90, 91, 92, 53,
2077 + 54, 131, 41, 93, 14, 42, 79, 80, 81, 82,
2078 + 104, 59, 60, 107, 61, 62, 138, 139, 77, 78,
2079 + 83, 84, 5, 85, 86, 17, 46, 38, 49, 50,
2080 + 68, 66, 51, 97, 52, 98, 99, 100, 106, 110,
2081 + 111, 126, 114, 134, 127, 133, 141, 19, 143, 16,
2082 + 72, 109, 73, 76, 74, 108, 105, 132, 0, 0,
2083 + 0, 0, 0, 0, 0, 0, 0, 0, 71, 0,
2084 + 140, 0, 0, 142, 0, 75
2085 };
2086
2087 -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2088 - positive, shift that token. If negative, reduce the rule which
2089 - number is the opposite. If YYTABLE_NINF, syntax error. */
2090 -#define YYTABLE_NINF -1
2091 -static const yytype_uint8 yytable[] =
2092 +static const yytype_int16 yycheck[] =
2093 {
2094 - 12, 66, 67, 40, 41, 42, 44, 34, 9, 10,
2095 - 52, 53, 115, 101, 5, 112, 104, 132, 113, 133,
2096 - 116, 117, 118, 119, 11, 1, 60, 114, 14, 134,
2097 - 120, 45, 6, 54, 17, 121, 3, 18, 19, 55,
2098 - 9, 10, 50, 51, 61, 62, 84, 85, 86, 9,
2099 - 10, 4, 100, 37, 126, 127, 11, 35, 87, 88,
2100 - 89, 38, 128, 46, 39, 11, 90, 98, 47, 35,
2101 - 43, 99, 76, 77, 78, 79, 56, 57, 58, 59,
2102 - 135, 136, 80, 81, 74, 75, 82, 83, 48, 63,
2103 - 49, 65, 94, 95, 96, 97, 124, 103, 107, 108,
2104 - 111, 123, 130, 131, 138, 16, 13, 140, 106, 71,
2105 - 69, 105, 0, 0, 102, 0, 0, 129, 0, 0,
2106 - 68, 0, 0, 70, 0, 0, 0, 0, 72, 0,
2107 - 137, 0, 73, 139
2108 + 8, 41, 42, 20, 21, 22, 13, 15, 18, 19,
2109 + 8, 9, 14, 25, 5, 27, 20, 29, 22, 21,
2110 + 22, 23, 24, 33, 0, 26, 18, 19, 32, 31,
2111 + 37, 22, 30, 43, 36, 25, 46, 47, 36, 22,
2112 + 3, 33, 25, 44, 45, 25, 63, 64, 65, 18,
2113 + 19, 34, 92, 22, 23, 16, 15, 16, 17, 10,
2114 + 11, 30, 23, 22, 33, 26, 55, 56, 57, 58,
2115 + 93, 6, 7, 96, 42, 43, 34, 35, 53, 54,
2116 + 59, 60, 4, 61, 62, 26, 35, 27, 12, 39,
2117 + 23, 25, 40, 25, 41, 38, 17, 17, 28, 25,
2118 + 25, 18, 25, 21, 33, 36, 34, 11, 35, 9,
2119 + 48, 98, 49, 52, 50, 96, 93, 125, -1, -1,
2120 + -1, -1, -1, -1, -1, -1, -1, -1, 47, -1,
2121 + 138, -1, -1, 141, -1, 51
2122 };
2123
2124 -#define yypact_value_is_default(Yystate) \
2125 - (!!((Yystate) == (-78)))
2126 -
2127 -#define yytable_value_is_error(Yytable_value) \
2128 - YYID (0)
2129 + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2130 + symbol of state STATE-NUM. */
2131 +static const yytype_uint8 yystos[] =
2132 +{
2133 + 0, 3, 49, 25, 0, 4, 50, 25, 5, 22,
2134 + 51, 52, 18, 19, 33, 60, 52, 26, 53, 51,
2135 + 43, 46, 47, 60, 61, 62, 63, 64, 65, 66,
2136 + 67, 68, 69, 70, 71, 72, 73, 60, 27, 54,
2137 + 16, 23, 26, 73, 73, 73, 35, 13, 37, 12,
2138 + 39, 40, 41, 10, 11, 8, 9, 30, 36, 6,
2139 + 7, 42, 43, 26, 44, 45, 25, 55, 23, 54,
2140 + 54, 64, 61, 65, 66, 67, 68, 69, 69, 70,
2141 + 70, 70, 70, 71, 71, 72, 72, 73, 73, 73,
2142 + 15, 16, 17, 22, 56, 75, 76, 25, 38, 17,
2143 + 17, 25, 29, 54, 56, 76, 28, 56, 75, 62,
2144 + 25, 25, 57, 58, 25, 22, 25, 34, 14, 21,
2145 + 22, 23, 24, 31, 36, 59, 18, 33, 74, 22,
2146 + 23, 30, 60, 36, 21, 20, 22, 32, 34, 35,
2147 + 60, 34, 60, 35
2148 +};
2149
2150 -static const yytype_int16 yycheck[] =
2151 + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
2152 +static const yytype_uint8 yyr1[] =
2153 {
2154 - 5, 38, 39, 17, 18, 19, 12, 12, 17, 18,
2155 - 7, 8, 13, 90, 4, 22, 93, 20, 25, 22,
2156 - 21, 22, 23, 24, 33, 3, 26, 34, 26, 32,
2157 - 31, 37, 22, 30, 43, 36, 25, 46, 47, 36,
2158 - 17, 18, 9, 10, 44, 45, 60, 61, 62, 17,
2159 - 18, 0, 89, 15, 22, 23, 33, 27, 14, 15,
2160 - 16, 23, 30, 11, 26, 33, 22, 25, 39, 27,
2161 - 35, 29, 52, 53, 54, 55, 5, 6, 42, 43,
2162 - 34, 35, 56, 57, 50, 51, 58, 59, 40, 25,
2163 - 41, 23, 25, 38, 16, 16, 33, 28, 25, 25,
2164 - 25, 17, 36, 21, 34, 8, 6, 35, 95, 47,
2165 - 45, 93, -1, -1, 90, -1, -1, 122, -1, -1,
2166 - 44, -1, -1, 46, -1, -1, -1, -1, 48, -1,
2167 - 135, -1, 49, 138
2168 + 0, 48, 49, 50, 50, 51, 51, 52, 52, 53,
2169 + 53, 53, 53, 54, 55, 55, 56, 56, 56, 56,
2170 + 57, 57, 57, 57, 57, 57, 57, 58, 58, 58,
2171 + 59, 59, 59, 59, 59, 60, 60, 60, 61, 62,
2172 + 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
2173 + 67, 68, 68, 68, 69, 69, 69, 69, 69, 70,
2174 + 70, 70, 71, 71, 71, 72, 72, 72, 72, 73,
2175 + 73, 73, 73, 74, 74, 74, 75, 75, 75, 76,
2176 + 76, 76
2177 };
2178
2179 -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2180 - symbol of state STATE-NUM. */
2181 -static const yytype_uint8 yystos[] =
2182 + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
2183 +static const yytype_uint8 yyr2[] =
2184 {
2185 - 0, 3, 49, 25, 0, 4, 22, 50, 51, 17,
2186 - 18, 33, 59, 51, 26, 52, 50, 43, 46, 47,
2187 - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
2188 - 69, 70, 71, 72, 59, 27, 53, 15, 23, 26,
2189 - 72, 72, 72, 35, 12, 37, 11, 39, 40, 41,
2190 - 9, 10, 7, 8, 30, 36, 5, 6, 42, 43,
2191 - 26, 44, 45, 25, 54, 23, 53, 53, 63, 60,
2192 - 64, 65, 66, 67, 68, 68, 69, 69, 69, 69,
2193 - 70, 70, 71, 71, 72, 72, 72, 14, 15, 16,
2194 - 22, 55, 74, 75, 25, 38, 16, 16, 25, 29,
2195 - 53, 55, 75, 28, 55, 74, 61, 25, 25, 56,
2196 - 57, 25, 22, 25, 34, 13, 21, 22, 23, 24,
2197 - 31, 36, 58, 17, 33, 73, 22, 23, 30, 59,
2198 - 36, 21, 20, 22, 32, 34, 35, 59, 34, 59,
2199 - 35
2200 + 0, 2, 5, 0, 2, 0, 2, 4, 2, 2,
2201 + 3, 3, 4, 5, 0, 2, 4, 2, 3, 2,
2202 + 2, 3, 4, 2, 9, 5, 2, 0, 2, 2,
2203 + 3, 1, 2, 2, 2, 1, 1, 3, 1, 1,
2204 + 5, 1, 3, 1, 3, 1, 3, 1, 3, 1,
2205 + 3, 1, 3, 3, 1, 3, 3, 3, 3, 3,
2206 + 3, 1, 3, 3, 1, 3, 3, 3, 1, 1,
2207 + 2, 2, 2, 0, 2, 2, 0, 2, 2, 2,
2208 + 3, 2
2209 };
2210
2211 -#define yyerrok (yyerrstatus = 0)
2212 -#define yyclearin (yychar = YYEMPTY)
2213 -#define YYEMPTY (-2)
2214 -#define YYEOF 0
2215 -
2216 -#define YYACCEPT goto yyacceptlab
2217 -#define YYABORT goto yyabortlab
2218 -#define YYERROR goto yyerrorlab
2219 -
2220 -
2221 -/* Like YYERROR except do call yyerror. This remains here temporarily
2222 - to ease the transition to the new meaning of YYERROR, for GCC.
2223 - Once GCC version 2 has supplanted version 1, this can go. However,
2224 - YYFAIL appears to be in use. Nevertheless, it is formally deprecated
2225 - in Bison 2.4.2's NEWS entry, where a plan to phase it out is
2226 - discussed. */
2227 -
2228 -#define YYFAIL goto yyerrlab
2229 -#if defined YYFAIL
2230 - /* This is here to suppress warnings from the GCC cpp's
2231 - -Wunused-macros. Normally we don't worry about that warning, but
2232 - some users do, and we want to make it easy for users to remove
2233 - YYFAIL uses, which will produce warnings from Bison 2.5. */
2234 -#endif
2235 +
2236 +#define yyerrok (yyerrstatus = 0)
2237 +#define yyclearin (yychar = YYEMPTY)
2238 +#define YYEMPTY (-2)
2239 +#define YYEOF 0
2240 +
2241 +#define YYACCEPT goto yyacceptlab
2242 +#define YYABORT goto yyabortlab
2243 +#define YYERROR goto yyerrorlab
2244 +
2245
2246 #define YYRECOVERING() (!!yyerrstatus)
2247
2248 @@ -768,27 +725,41 @@ do \
2249 else \
2250 { \
2251 yyerror (YY_("syntax error: cannot back up")); \
2252 - YYERROR; \
2253 - } \
2254 -while (YYID (0))
2255 + YYERROR; \
2256 + } \
2257 +while (0)
2258
2259 /* Error token number */
2260 -#define YYTERROR 1
2261 -#define YYERRCODE 256
2262 -
2263 -
2264 -/* This macro is provided for backward compatibility. */
2265 -#ifndef YY_LOCATION_PRINT
2266 -# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2267 +#define YYTERROR 1
2268 +#define YYERRCODE 256
2269 +
2270 +
2271 +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2272 + If N is 0, then set CURRENT to the empty location which ends
2273 + the previous symbol: RHS[0] (always defined). */
2274 +
2275 +#ifndef YYLLOC_DEFAULT
2276 +# define YYLLOC_DEFAULT(Current, Rhs, N) \
2277 + do \
2278 + if (N) \
2279 + { \
2280 + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2281 + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2282 + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2283 + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2284 + } \
2285 + else \
2286 + { \
2287 + (Current).first_line = (Current).last_line = \
2288 + YYRHSLOC (Rhs, 0).last_line; \
2289 + (Current).first_column = (Current).last_column = \
2290 + YYRHSLOC (Rhs, 0).last_column; \
2291 + } \
2292 + while (0)
2293 #endif
2294
2295 +#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2296
2297 -/* YYLEX -- calling `yylex' with the right arguments. */
2298 -#ifdef YYLEX_PARAM
2299 -# define YYLEX yylex (YYLEX_PARAM)
2300 -#else
2301 -# define YYLEX yylex ()
2302 -#endif
2303
2304 /* Enable debugging if requested. */
2305 #if YYDEBUG
2306 @@ -798,50 +769,84 @@ while (YYID (0))
2307 # define YYFPRINTF fprintf
2308 # endif
2309
2310 -# define YYDPRINTF(Args) \
2311 -do { \
2312 - if (yydebug) \
2313 - YYFPRINTF Args; \
2314 -} while (YYID (0))
2315 +# define YYDPRINTF(Args) \
2316 +do { \
2317 + if (yydebug) \
2318 + YYFPRINTF Args; \
2319 +} while (0)
2320
2321 -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2322 -do { \
2323 - if (yydebug) \
2324 - { \
2325 - YYFPRINTF (stderr, "%s ", Title); \
2326 - yy_symbol_print (stderr, \
2327 - Type, Value); \
2328 - YYFPRINTF (stderr, "\n"); \
2329 - } \
2330 -} while (YYID (0))
2331
2332 +/* YY_LOCATION_PRINT -- Print the location on the stream.
2333 + This macro was not mandated originally: define only if we know
2334 + we won't break user code: when these are the locations we know. */
2335
2336 -/*--------------------------------.
2337 -| Print this symbol on YYOUTPUT. |
2338 -`--------------------------------*/
2339 +#ifndef YY_LOCATION_PRINT
2340 +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2341
2342 -/*ARGSUSED*/
2343 -#if (defined __STDC__ || defined __C99__FUNC__ \
2344 - || defined __cplusplus || defined _MSC_VER)
2345 -static void
2346 -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2347 -#else
2348 -static void
2349 -yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2350 - FILE *yyoutput;
2351 - int yytype;
2352 - YYSTYPE const * const yyvaluep;
2353 +/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
2354 +
2355 +YY_ATTRIBUTE_UNUSED
2356 +static unsigned
2357 +yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
2358 +{
2359 + unsigned res = 0;
2360 + int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
2361 + if (0 <= yylocp->first_line)
2362 + {
2363 + res += YYFPRINTF (yyo, "%d", yylocp->first_line);
2364 + if (0 <= yylocp->first_column)
2365 + res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
2366 + }
2367 + if (0 <= yylocp->last_line)
2368 + {
2369 + if (yylocp->first_line < yylocp->last_line)
2370 + {
2371 + res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
2372 + if (0 <= end_col)
2373 + res += YYFPRINTF (yyo, ".%d", end_col);
2374 + }
2375 + else if (0 <= end_col && yylocp->first_column < end_col)
2376 + res += YYFPRINTF (yyo, "-%d", end_col);
2377 + }
2378 + return res;
2379 + }
2380 +
2381 +# define YY_LOCATION_PRINT(File, Loc) \
2382 + yy_location_print_ (File, &(Loc))
2383 +
2384 +# else
2385 +# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2386 +# endif
2387 #endif
2388 +
2389 +
2390 +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2391 +do { \
2392 + if (yydebug) \
2393 + { \
2394 + YYFPRINTF (stderr, "%s ", Title); \
2395 + yy_symbol_print (stderr, \
2396 + Type, Value, Location); \
2397 + YYFPRINTF (stderr, "\n"); \
2398 + } \
2399 +} while (0)
2400 +
2401 +
2402 +/*----------------------------------------.
2403 +| Print this symbol's value on YYOUTPUT. |
2404 +`----------------------------------------*/
2405 +
2406 +static void
2407 +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
2408 {
2409 FILE *yyo = yyoutput;
2410 YYUSE (yyo);
2411 + YYUSE (yylocationp);
2412 if (!yyvaluep)
2413 return;
2414 # ifdef YYPRINT
2415 if (yytype < YYNTOKENS)
2416 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2417 -# else
2418 - YYUSE (yyoutput);
2419 # endif
2420 YYUSE (yytype);
2421 }
2422 @@ -851,24 +856,15 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2423 | Print this symbol on YYOUTPUT. |
2424 `--------------------------------*/
2425
2426 -#if (defined __STDC__ || defined __C99__FUNC__ \
2427 - || defined __cplusplus || defined _MSC_VER)
2428 -static void
2429 -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2430 -#else
2431 static void
2432 -yy_symbol_print (yyoutput, yytype, yyvaluep)
2433 - FILE *yyoutput;
2434 - int yytype;
2435 - YYSTYPE const * const yyvaluep;
2436 -#endif
2437 +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
2438 {
2439 - if (yytype < YYNTOKENS)
2440 - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2441 - else
2442 - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2443 + YYFPRINTF (yyoutput, "%s %s (",
2444 + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
2445
2446 - yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2447 + YY_LOCATION_PRINT (yyoutput, *yylocationp);
2448 + YYFPRINTF (yyoutput, ": ");
2449 + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
2450 YYFPRINTF (yyoutput, ")");
2451 }
2452
2453 @@ -877,16 +873,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
2454 | TOP (included). |
2455 `------------------------------------------------------------------*/
2456
2457 -#if (defined __STDC__ || defined __C99__FUNC__ \
2458 - || defined __cplusplus || defined _MSC_VER)
2459 static void
2460 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
2461 -#else
2462 -static void
2463 -yy_stack_print (yybottom, yytop)
2464 - yytype_int16 *yybottom;
2465 - yytype_int16 *yytop;
2466 -#endif
2467 {
2468 YYFPRINTF (stderr, "Stack now");
2469 for (; yybottom <= yytop; yybottom++)
2470 @@ -897,49 +885,42 @@ yy_stack_print (yybottom, yytop)
2471 YYFPRINTF (stderr, "\n");
2472 }
2473
2474 -# define YY_STACK_PRINT(Bottom, Top) \
2475 -do { \
2476 - if (yydebug) \
2477 - yy_stack_print ((Bottom), (Top)); \
2478 -} while (YYID (0))
2479 +# define YY_STACK_PRINT(Bottom, Top) \
2480 +do { \
2481 + if (yydebug) \
2482 + yy_stack_print ((Bottom), (Top)); \
2483 +} while (0)
2484
2485
2486 /*------------------------------------------------.
2487 | Report that the YYRULE is going to be reduced. |
2488 `------------------------------------------------*/
2489
2490 -#if (defined __STDC__ || defined __C99__FUNC__ \
2491 - || defined __cplusplus || defined _MSC_VER)
2492 static void
2493 -yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2494 -#else
2495 -static void
2496 -yy_reduce_print (yyvsp, yyrule)
2497 - YYSTYPE *yyvsp;
2498 - int yyrule;
2499 -#endif
2500 +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
2501 {
2502 + unsigned long int yylno = yyrline[yyrule];
2503 int yynrhs = yyr2[yyrule];
2504 int yyi;
2505 - unsigned long int yylno = yyrline[yyrule];
2506 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2507 - yyrule - 1, yylno);
2508 + yyrule - 1, yylno);
2509 /* The symbols being reduced. */
2510 for (yyi = 0; yyi < yynrhs; yyi++)
2511 {
2512 YYFPRINTF (stderr, " $%d = ", yyi + 1);
2513 - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2514 - &(yyvsp[(yyi + 1) - (yynrhs)])
2515 - );
2516 + yy_symbol_print (stderr,
2517 + yystos[yyssp[yyi + 1 - yynrhs]],
2518 + &(yyvsp[(yyi + 1) - (yynrhs)])
2519 + , &(yylsp[(yyi + 1) - (yynrhs)]) );
2520 YYFPRINTF (stderr, "\n");
2521 }
2522 }
2523
2524 -# define YY_REDUCE_PRINT(Rule) \
2525 -do { \
2526 - if (yydebug) \
2527 - yy_reduce_print (yyvsp, Rule); \
2528 -} while (YYID (0))
2529 +# define YY_REDUCE_PRINT(Rule) \
2530 +do { \
2531 + if (yydebug) \
2532 + yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
2533 +} while (0)
2534
2535 /* Nonzero means print parse trace. It is left uninitialized so that
2536 multiple parsers can coexist. */
2537 @@ -953,7 +934,7 @@ int yydebug;
2538
2539
2540 /* YYINITDEPTH -- initial size of the parser's stacks. */
2541 -#ifndef YYINITDEPTH
2542 +#ifndef YYINITDEPTH
2543 # define YYINITDEPTH 200
2544 #endif
2545
2546 @@ -976,15 +957,8 @@ int yydebug;
2547 # define yystrlen strlen
2548 # else
2549 /* Return the length of YYSTR. */
2550 -#if (defined __STDC__ || defined __C99__FUNC__ \
2551 - || defined __cplusplus || defined _MSC_VER)
2552 static YYSIZE_T
2553 yystrlen (const char *yystr)
2554 -#else
2555 -static YYSIZE_T
2556 -yystrlen (yystr)
2557 - const char *yystr;
2558 -#endif
2559 {
2560 YYSIZE_T yylen;
2561 for (yylen = 0; yystr[yylen]; yylen++)
2562 @@ -1000,16 +974,8 @@ yystrlen (yystr)
2563 # else
2564 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2565 YYDEST. */
2566 -#if (defined __STDC__ || defined __C99__FUNC__ \
2567 - || defined __cplusplus || defined _MSC_VER)
2568 static char *
2569 yystpcpy (char *yydest, const char *yysrc)
2570 -#else
2571 -static char *
2572 -yystpcpy (yydest, yysrc)
2573 - char *yydest;
2574 - const char *yysrc;
2575 -#endif
2576 {
2577 char *yyd = yydest;
2578 const char *yys = yysrc;
2579 @@ -1039,27 +1005,27 @@ yytnamerr (char *yyres, const char *yystr)
2580 char const *yyp = yystr;
2581
2582 for (;;)
2583 - switch (*++yyp)
2584 - {
2585 - case '\'':
2586 - case ',':
2587 - goto do_not_strip_quotes;
2588 -
2589 - case '\\':
2590 - if (*++yyp != '\\')
2591 - goto do_not_strip_quotes;
2592 - /* Fall through. */
2593 - default:
2594 - if (yyres)
2595 - yyres[yyn] = *yyp;
2596 - yyn++;
2597 - break;
2598 -
2599 - case '"':
2600 - if (yyres)
2601 - yyres[yyn] = '\0';
2602 - return yyn;
2603 - }
2604 + switch (*++yyp)
2605 + {
2606 + case '\'':
2607 + case ',':
2608 + goto do_not_strip_quotes;
2609 +
2610 + case '\\':
2611 + if (*++yyp != '\\')
2612 + goto do_not_strip_quotes;
2613 + /* Fall through. */
2614 + default:
2615 + if (yyres)
2616 + yyres[yyn] = *yyp;
2617 + yyn++;
2618 + break;
2619 +
2620 + case '"':
2621 + if (yyres)
2622 + yyres[yyn] = '\0';
2623 + return yyn;
2624 + }
2625 do_not_strip_quotes: ;
2626 }
2627
2628 @@ -1082,11 +1048,11 @@ static int
2629 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
2630 yytype_int16 *yyssp, int yytoken)
2631 {
2632 - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
2633 + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
2634 YYSIZE_T yysize = yysize0;
2635 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
2636 /* Internationalized format string. */
2637 - const char *yyformat = YY_NULL;
2638 + const char *yyformat = YY_NULLPTR;
2639 /* Arguments of yyformat. */
2640 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
2641 /* Number of reported tokens (one for the "unexpected", one per
2642 @@ -1094,10 +1060,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
2643 int yycount = 0;
2644
2645 /* There are many possibilities here to consider:
2646 - - Assume YYFAIL is not used. It's too flawed to consider. See
2647 - <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
2648 - for details. YYERROR is fine as it does not invoke this
2649 - function.
2650 - If this state is a consistent state with a default action, then
2651 the only way this function was invoked is if the default action
2652 is an error action. In that case, don't check for expected
2653 @@ -1147,7 +1109,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
2654 }
2655 yyarg[yycount++] = yytname[yyx];
2656 {
2657 - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
2658 + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
2659 if (! (yysize <= yysize1
2660 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
2661 return 2;
2662 @@ -1214,26 +1176,18 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
2663 | Release the memory associated to this symbol. |
2664 `-----------------------------------------------*/
2665
2666 -/*ARGSUSED*/
2667 -#if (defined __STDC__ || defined __C99__FUNC__ \
2668 - || defined __cplusplus || defined _MSC_VER)
2669 static void
2670 -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2671 -#else
2672 -static void
2673 -yydestruct (yymsg, yytype, yyvaluep)
2674 - const char *yymsg;
2675 - int yytype;
2676 - YYSTYPE *yyvaluep;
2677 -#endif
2678 +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
2679 {
2680 YYUSE (yyvaluep);
2681 -
2682 + YYUSE (yylocationp);
2683 if (!yymsg)
2684 yymsg = "Deleting";
2685 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2686
2687 + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2688 YYUSE (yytype);
2689 + YY_IGNORE_MAYBE_UNINITIALIZED_END
2690 }
2691
2692
2693 @@ -1242,18 +1196,14 @@ yydestruct (yymsg, yytype, yyvaluep)
2694 /* The lookahead symbol. */
2695 int yychar;
2696
2697 -
2698 -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2699 -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2700 -# define YY_IGNORE_MAYBE_UNINITIALIZED_END
2701 -#endif
2702 -#ifndef YY_INITIAL_VALUE
2703 -# define YY_INITIAL_VALUE(Value) /* Nothing. */
2704 -#endif
2705 -
2706 /* The semantic value of the lookahead symbol. */
2707 -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
2708 -
2709 +YYSTYPE yylval;
2710 +/* Location data for the lookahead symbol. */
2711 +YYLTYPE yylloc
2712 +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2713 + = { 1, 1, 1, 1 }
2714 +# endif
2715 +;
2716 /* Number of syntax errors so far. */
2717 int yynerrs;
2718
2719 @@ -1262,35 +1212,17 @@ int yynerrs;
2720 | yyparse. |
2721 `----------*/
2722
2723 -#ifdef YYPARSE_PARAM
2724 -#if (defined __STDC__ || defined __C99__FUNC__ \
2725 - || defined __cplusplus || defined _MSC_VER)
2726 -int
2727 -yyparse (void *YYPARSE_PARAM)
2728 -#else
2729 -int
2730 -yyparse (YYPARSE_PARAM)
2731 - void *YYPARSE_PARAM;
2732 -#endif
2733 -#else /* ! YYPARSE_PARAM */
2734 -#if (defined __STDC__ || defined __C99__FUNC__ \
2735 - || defined __cplusplus || defined _MSC_VER)
2736 int
2737 yyparse (void)
2738 -#else
2739 -int
2740 -yyparse ()
2741 -
2742 -#endif
2743 -#endif
2744 {
2745 int yystate;
2746 /* Number of tokens to shift before error messages enabled. */
2747 int yyerrstatus;
2748
2749 /* The stacks and their tools:
2750 - `yyss': related to states.
2751 - `yyvs': related to semantic values.
2752 + 'yyss': related to states.
2753 + 'yyvs': related to semantic values.
2754 + 'yyls': related to locations.
2755
2756 Refer to the stacks through separate pointers, to allow yyoverflow
2757 to reallocate them elsewhere. */
2758 @@ -1305,6 +1237,14 @@ yyparse ()
2759 YYSTYPE *yyvs;
2760 YYSTYPE *yyvsp;
2761
2762 + /* The location stack. */
2763 + YYLTYPE yylsa[YYINITDEPTH];
2764 + YYLTYPE *yyls;
2765 + YYLTYPE *yylsp;
2766 +
2767 + /* The locations where the error started and ended. */
2768 + YYLTYPE yyerror_range[3];
2769 +
2770 YYSIZE_T yystacksize;
2771
2772 int yyn;
2773 @@ -1314,6 +1254,7 @@ yyparse ()
2774 /* The variables used to return semantic value and location from the
2775 action routines. */
2776 YYSTYPE yyval;
2777 + YYLTYPE yyloc;
2778
2779 #if YYERROR_VERBOSE
2780 /* Buffer for error messages, and its allocated size. */
2781 @@ -1322,7 +1263,7 @@ yyparse ()
2782 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
2783 #endif
2784
2785 -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
2786 +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
2787
2788 /* The number of symbols on the RHS of the reduced rule.
2789 Keep to zero when no symbol should be popped. */
2790 @@ -1330,6 +1271,7 @@ yyparse ()
2791
2792 yyssp = yyss = yyssa;
2793 yyvsp = yyvs = yyvsa;
2794 + yylsp = yyls = yylsa;
2795 yystacksize = YYINITDEPTH;
2796
2797 YYDPRINTF ((stderr, "Starting parse\n"));
2798 @@ -1338,6 +1280,7 @@ yyparse ()
2799 yyerrstatus = 0;
2800 yynerrs = 0;
2801 yychar = YYEMPTY; /* Cause a token to be read. */
2802 + yylsp[0] = yylloc;
2803 goto yysetstate;
2804
2805 /*------------------------------------------------------------.
2806 @@ -1358,23 +1301,26 @@ yyparse ()
2807
2808 #ifdef yyoverflow
2809 {
2810 - /* Give user a chance to reallocate the stack. Use copies of
2811 - these so that the &'s don't force the real ones into
2812 - memory. */
2813 - YYSTYPE *yyvs1 = yyvs;
2814 - yytype_int16 *yyss1 = yyss;
2815 -
2816 - /* Each stack pointer address is followed by the size of the
2817 - data in use in that stack, in bytes. This used to be a
2818 - conditional around just the two extra args, but that might
2819 - be undefined if yyoverflow is a macro. */
2820 - yyoverflow (YY_("memory exhausted"),
2821 - &yyss1, yysize * sizeof (*yyssp),
2822 - &yyvs1, yysize * sizeof (*yyvsp),
2823 - &yystacksize);
2824 -
2825 - yyss = yyss1;
2826 - yyvs = yyvs1;
2827 + /* Give user a chance to reallocate the stack. Use copies of
2828 + these so that the &'s don't force the real ones into
2829 + memory. */
2830 + YYSTYPE *yyvs1 = yyvs;
2831 + yytype_int16 *yyss1 = yyss;
2832 + YYLTYPE *yyls1 = yyls;
2833 +
2834 + /* Each stack pointer address is followed by the size of the
2835 + data in use in that stack, in bytes. This used to be a
2836 + conditional around just the two extra args, but that might
2837 + be undefined if yyoverflow is a macro. */
2838 + yyoverflow (YY_("memory exhausted"),
2839 + &yyss1, yysize * sizeof (*yyssp),
2840 + &yyvs1, yysize * sizeof (*yyvsp),
2841 + &yyls1, yysize * sizeof (*yylsp),
2842 + &yystacksize);
2843 +
2844 + yyls = yyls1;
2845 + yyss = yyss1;
2846 + yyvs = yyvs1;
2847 }
2848 #else /* no yyoverflow */
2849 # ifndef YYSTACK_RELOCATE
2850 @@ -1382,34 +1328,36 @@ yyparse ()
2851 # else
2852 /* Extend the stack our own way. */
2853 if (YYMAXDEPTH <= yystacksize)
2854 - goto yyexhaustedlab;
2855 + goto yyexhaustedlab;
2856 yystacksize *= 2;
2857 if (YYMAXDEPTH < yystacksize)
2858 - yystacksize = YYMAXDEPTH;
2859 + yystacksize = YYMAXDEPTH;
2860
2861 {
2862 - yytype_int16 *yyss1 = yyss;
2863 - union yyalloc *yyptr =
2864 - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2865 - if (! yyptr)
2866 - goto yyexhaustedlab;
2867 - YYSTACK_RELOCATE (yyss_alloc, yyss);
2868 - YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2869 + yytype_int16 *yyss1 = yyss;
2870 + union yyalloc *yyptr =
2871 + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2872 + if (! yyptr)
2873 + goto yyexhaustedlab;
2874 + YYSTACK_RELOCATE (yyss_alloc, yyss);
2875 + YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2876 + YYSTACK_RELOCATE (yyls_alloc, yyls);
2877 # undef YYSTACK_RELOCATE
2878 - if (yyss1 != yyssa)
2879 - YYSTACK_FREE (yyss1);
2880 + if (yyss1 != yyssa)
2881 + YYSTACK_FREE (yyss1);
2882 }
2883 # endif
2884 #endif /* no yyoverflow */
2885
2886 yyssp = yyss + yysize - 1;
2887 yyvsp = yyvs + yysize - 1;
2888 + yylsp = yyls + yysize - 1;
2889
2890 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2891 - (unsigned long int) yystacksize));
2892 + (unsigned long int) yystacksize));
2893
2894 if (yyss + yystacksize - 1 <= yyssp)
2895 - YYABORT;
2896 + YYABORT;
2897 }
2898
2899 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2900 @@ -1438,7 +1386,7 @@ yybackup:
2901 if (yychar == YYEMPTY)
2902 {
2903 YYDPRINTF ((stderr, "Reading a token: "));
2904 - yychar = YYLEX;
2905 + yychar = yylex ();
2906 }
2907
2908 if (yychar <= YYEOF)
2909 @@ -1481,7 +1429,7 @@ yybackup:
2910 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2911 *++yyvsp = yylval;
2912 YY_IGNORE_MAYBE_UNINITIALIZED_END
2913 -
2914 + *++yylsp = yylloc;
2915 goto yynewstate;
2916
2917
2918 @@ -1503,7 +1451,7 @@ yyreduce:
2919 yylen = yyr2[yyn];
2920
2921 /* If YYLEN is nonzero, implement the default value of the action:
2922 - `$$ = $1'.
2923 + '$$ = $1'.
2924
2925 Otherwise, the following line sets YYVAL to garbage.
2926 This behavior is undocumented and Bison
2927 @@ -1512,287 +1460,306 @@ yyreduce:
2928 GCC warning that YYVAL may be used uninitialized. */
2929 yyval = yyvsp[1-yylen];
2930
2931 -
2932 + /* Default location. */
2933 + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
2934 YY_REDUCE_PRINT (yyn);
2935 switch (yyn)
2936 {
2937 case 2:
2938 -/* Line 1787 of yacc.c */
2939 -#line 110 "dtc-parser.y"
2940 +#line 109 "dtc-parser.y" /* yacc.c:1646 */
2941 {
2942 - the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node),
2943 - guess_boot_cpuid((yyvsp[(4) - (4)].node)));
2944 + (yyvsp[0].node)->is_plugin = (yyvsp[-2].is_plugin);
2945 + (yyvsp[0].node)->is_root = 1;
2946 + the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node),
2947 + guess_boot_cpuid((yyvsp[0].node)));
2948 }
2949 +#line 1477 "dtc-parser.tab.c" /* yacc.c:1646 */
2950 break;
2951
2952 case 3:
2953 -/* Line 1787 of yacc.c */
2954 -#line 118 "dtc-parser.y"
2955 +#line 119 "dtc-parser.y" /* yacc.c:1646 */
2956 {
2957 - (yyval.re) = NULL;
2958 + (yyval.is_plugin) = 0;
2959 }
2960 +#line 1485 "dtc-parser.tab.c" /* yacc.c:1646 */
2961 break;
2962
2963 case 4:
2964 -/* Line 1787 of yacc.c */
2965 -#line 122 "dtc-parser.y"
2966 +#line 123 "dtc-parser.y" /* yacc.c:1646 */
2967 {
2968 - (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
2969 + (yyval.is_plugin) = 1;
2970 }
2971 +#line 1493 "dtc-parser.tab.c" /* yacc.c:1646 */
2972 break;
2973
2974 case 5:
2975 -/* Line 1787 of yacc.c */
2976 -#line 129 "dtc-parser.y"
2977 +#line 130 "dtc-parser.y" /* yacc.c:1646 */
2978 {
2979 - (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer));
2980 + (yyval.re) = NULL;
2981 }
2982 +#line 1501 "dtc-parser.tab.c" /* yacc.c:1646 */
2983 break;
2984
2985 case 6:
2986 -/* Line 1787 of yacc.c */
2987 -#line 133 "dtc-parser.y"
2988 +#line 134 "dtc-parser.y" /* yacc.c:1646 */
2989 {
2990 - add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref));
2991 - (yyval.re) = (yyvsp[(2) - (2)].re);
2992 + (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re));
2993 }
2994 +#line 1509 "dtc-parser.tab.c" /* yacc.c:1646 */
2995 break;
2996
2997 case 7:
2998 -/* Line 1787 of yacc.c */
2999 -#line 141 "dtc-parser.y"
3000 +#line 141 "dtc-parser.y" /* yacc.c:1646 */
3001 {
3002 - (yyval.node) = name_node((yyvsp[(2) - (2)].node), "");
3003 + (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer));
3004 }
3005 +#line 1517 "dtc-parser.tab.c" /* yacc.c:1646 */
3006 break;
3007
3008 case 8:
3009 -/* Line 1787 of yacc.c */
3010 -#line 145 "dtc-parser.y"
3011 +#line 145 "dtc-parser.y" /* yacc.c:1646 */
3012 {
3013 - (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
3014 + add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref));
3015 + (yyval.re) = (yyvsp[0].re);
3016 }
3017 +#line 1526 "dtc-parser.tab.c" /* yacc.c:1646 */
3018 break;
3019
3020 case 9:
3021 -/* Line 1787 of yacc.c */
3022 -#line 149 "dtc-parser.y"
3023 +#line 153 "dtc-parser.y" /* yacc.c:1646 */
3024 {
3025 - struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref));
3026 -
3027 - if (target)
3028 - merge_nodes(target, (yyvsp[(3) - (3)].node));
3029 - else
3030 - print_error("label or path, '%s', not found", (yyvsp[(2) - (3)].labelref));
3031 - (yyval.node) = (yyvsp[(1) - (3)].node);
3032 + (yyval.node) = name_node((yyvsp[0].node), "");
3033 }
3034 +#line 1534 "dtc-parser.tab.c" /* yacc.c:1646 */
3035 break;
3036
3037 case 10:
3038 -/* Line 1787 of yacc.c */
3039 -#line 159 "dtc-parser.y"
3040 +#line 157 "dtc-parser.y" /* yacc.c:1646 */
3041 {
3042 - struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref));
3043 -
3044 - if (!target)
3045 - print_error("label or path, '%s', not found", (yyvsp[(3) - (4)].labelref));
3046 - else
3047 - delete_node(target);
3048 -
3049 - (yyval.node) = (yyvsp[(1) - (4)].node);
3050 + (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node));
3051 }
3052 +#line 1542 "dtc-parser.tab.c" /* yacc.c:1646 */
3053 break;
3054
3055 case 11:
3056 -/* Line 1787 of yacc.c */
3057 -#line 173 "dtc-parser.y"
3058 +#line 161 "dtc-parser.y" /* yacc.c:1646 */
3059 {
3060 - (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist));
3061 + struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref));
3062 +
3063 + if (target)
3064 + merge_nodes(target, (yyvsp[0].node));
3065 + else
3066 + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
3067 + (yyval.node) = (yyvsp[-2].node);
3068 }
3069 +#line 1556 "dtc-parser.tab.c" /* yacc.c:1646 */
3070 break;
3071
3072 case 12:
3073 -/* Line 1787 of yacc.c */
3074 -#line 180 "dtc-parser.y"
3075 +#line 171 "dtc-parser.y" /* yacc.c:1646 */
3076 {
3077 - (yyval.proplist) = NULL;
3078 + struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref));
3079 +
3080 + if (target)
3081 + delete_node(target);
3082 + else
3083 + ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
3084 +
3085 +
3086 + (yyval.node) = (yyvsp[-3].node);
3087 }
3088 +#line 1572 "dtc-parser.tab.c" /* yacc.c:1646 */
3089 break;
3090
3091 case 13:
3092 -/* Line 1787 of yacc.c */
3093 -#line 184 "dtc-parser.y"
3094 +#line 186 "dtc-parser.y" /* yacc.c:1646 */
3095 {
3096 - (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist));
3097 + (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist));
3098 }
3099 +#line 1580 "dtc-parser.tab.c" /* yacc.c:1646 */
3100 break;
3101
3102 case 14:
3103 -/* Line 1787 of yacc.c */
3104 -#line 191 "dtc-parser.y"
3105 +#line 193 "dtc-parser.y" /* yacc.c:1646 */
3106 {
3107 - (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data));
3108 + (yyval.proplist) = NULL;
3109 }
3110 +#line 1588 "dtc-parser.tab.c" /* yacc.c:1646 */
3111 break;
3112
3113 case 15:
3114 -/* Line 1787 of yacc.c */
3115 -#line 195 "dtc-parser.y"
3116 +#line 197 "dtc-parser.y" /* yacc.c:1646 */
3117 {
3118 - (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data);
3119 + (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist));
3120 }
3121 +#line 1596 "dtc-parser.tab.c" /* yacc.c:1646 */
3122 break;
3123
3124 case 16:
3125 -/* Line 1787 of yacc.c */
3126 -#line 199 "dtc-parser.y"
3127 +#line 204 "dtc-parser.y" /* yacc.c:1646 */
3128 {
3129 - (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename));
3130 + (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data));
3131 }
3132 +#line 1604 "dtc-parser.tab.c" /* yacc.c:1646 */
3133 break;
3134
3135 case 17:
3136 -/* Line 1787 of yacc.c */
3137 -#line 203 "dtc-parser.y"
3138 +#line 208 "dtc-parser.y" /* yacc.c:1646 */
3139 {
3140 - add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref));
3141 - (yyval.prop) = (yyvsp[(2) - (2)].prop);
3142 + (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data);
3143 }
3144 +#line 1612 "dtc-parser.tab.c" /* yacc.c:1646 */
3145 break;
3146
3147 case 18:
3148 -/* Line 1787 of yacc.c */
3149 -#line 211 "dtc-parser.y"
3150 +#line 212 "dtc-parser.y" /* yacc.c:1646 */
3151 {
3152 - (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data));
3153 + (yyval.prop) = build_property_delete((yyvsp[-1].propnodename));
3154 }
3155 +#line 1620 "dtc-parser.tab.c" /* yacc.c:1646 */
3156 break;
3157
3158 case 19:
3159 -/* Line 1787 of yacc.c */
3160 -#line 215 "dtc-parser.y"
3161 +#line 216 "dtc-parser.y" /* yacc.c:1646 */
3162 {
3163 - (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data);
3164 + add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref));
3165 + (yyval.prop) = (yyvsp[0].prop);
3166 }
3167 +#line 1629 "dtc-parser.tab.c" /* yacc.c:1646 */
3168 break;
3169
3170 case 20:
3171 -/* Line 1787 of yacc.c */
3172 -#line 219 "dtc-parser.y"
3173 +#line 224 "dtc-parser.y" /* yacc.c:1646 */
3174 {
3175 - (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
3176 + (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data));
3177 }
3178 +#line 1637 "dtc-parser.tab.c" /* yacc.c:1646 */
3179 break;
3180
3181 case 21:
3182 -/* Line 1787 of yacc.c */
3183 -#line 223 "dtc-parser.y"
3184 +#line 228 "dtc-parser.y" /* yacc.c:1646 */
3185 {
3186 - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref));
3187 + (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data);
3188 }
3189 +#line 1645 "dtc-parser.tab.c" /* yacc.c:1646 */
3190 break;
3191
3192 case 22:
3193 -/* Line 1787 of yacc.c */
3194 -#line 227 "dtc-parser.y"
3195 +#line 232 "dtc-parser.y" /* yacc.c:1646 */
3196 {
3197 - FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL);
3198 + (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data));
3199 + }
3200 +#line 1653 "dtc-parser.tab.c" /* yacc.c:1646 */
3201 + break;
3202 +
3203 + case 23:
3204 +#line 236 "dtc-parser.y" /* yacc.c:1646 */
3205 + {
3206 + (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref));
3207 + }
3208 +#line 1661 "dtc-parser.tab.c" /* yacc.c:1646 */
3209 + break;
3210 +
3211 + case 24:
3212 +#line 240 "dtc-parser.y" /* yacc.c:1646 */
3213 + {
3214 + FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL);
3215 struct data d;
3216
3217 - if ((yyvsp[(6) - (9)].integer) != 0)
3218 - if (fseek(f, (yyvsp[(6) - (9)].integer), SEEK_SET) != 0)
3219 - print_error("Couldn't seek to offset %llu in \"%s\": %s",
3220 - (unsigned long long)(yyvsp[(6) - (9)].integer),
3221 - (yyvsp[(4) - (9)].data).val,
3222 - strerror(errno));
3223 + if ((yyvsp[-3].integer) != 0)
3224 + if (fseek(f, (yyvsp[-3].integer), SEEK_SET) != 0)
3225 + die("Couldn't seek to offset %llu in \"%s\": %s",
3226 + (unsigned long long)(yyvsp[-3].integer), (yyvsp[-5].data).val,
3227 + strerror(errno));
3228
3229 - d = data_copy_file(f, (yyvsp[(8) - (9)].integer));
3230 + d = data_copy_file(f, (yyvsp[-1].integer));
3231
3232 - (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d);
3233 + (yyval.data) = data_merge((yyvsp[-8].data), d);
3234 fclose(f);
3235 }
3236 +#line 1681 "dtc-parser.tab.c" /* yacc.c:1646 */
3237 break;
3238
3239 - case 23:
3240 -/* Line 1787 of yacc.c */
3241 -#line 244 "dtc-parser.y"
3242 + case 25:
3243 +#line 256 "dtc-parser.y" /* yacc.c:1646 */
3244 {
3245 - FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL);
3246 + FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL);
3247 struct data d = empty_data;
3248
3249 d = data_copy_file(f, -1);
3250
3251 - (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d);
3252 + (yyval.data) = data_merge((yyvsp[-4].data), d);
3253 fclose(f);
3254 }
3255 +#line 1695 "dtc-parser.tab.c" /* yacc.c:1646 */
3256 break;
3257
3258 - case 24:
3259 -/* Line 1787 of yacc.c */
3260 -#line 254 "dtc-parser.y"
3261 + case 26:
3262 +#line 266 "dtc-parser.y" /* yacc.c:1646 */
3263 {
3264 - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
3265 + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
3266 }
3267 +#line 1703 "dtc-parser.tab.c" /* yacc.c:1646 */
3268 break;
3269
3270 - case 25:
3271 -/* Line 1787 of yacc.c */
3272 -#line 261 "dtc-parser.y"
3273 + case 27:
3274 +#line 273 "dtc-parser.y" /* yacc.c:1646 */
3275 {
3276 (yyval.data) = empty_data;
3277 }
3278 +#line 1711 "dtc-parser.tab.c" /* yacc.c:1646 */
3279 break;
3280
3281 - case 26:
3282 -/* Line 1787 of yacc.c */
3283 -#line 265 "dtc-parser.y"
3284 + case 28:
3285 +#line 277 "dtc-parser.y" /* yacc.c:1646 */
3286 {
3287 - (yyval.data) = (yyvsp[(1) - (2)].data);
3288 + (yyval.data) = (yyvsp[-1].data);
3289 }
3290 +#line 1719 "dtc-parser.tab.c" /* yacc.c:1646 */
3291 break;
3292
3293 - case 27:
3294 -/* Line 1787 of yacc.c */
3295 -#line 269 "dtc-parser.y"
3296 + case 29:
3297 +#line 281 "dtc-parser.y" /* yacc.c:1646 */
3298 {
3299 - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
3300 + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
3301 }
3302 +#line 1727 "dtc-parser.tab.c" /* yacc.c:1646 */
3303 break;
3304
3305 - case 28:
3306 -/* Line 1787 of yacc.c */
3307 -#line 276 "dtc-parser.y"
3308 + case 30:
3309 +#line 288 "dtc-parser.y" /* yacc.c:1646 */
3310 {
3311 - (yyval.array).data = empty_data;
3312 - (yyval.array).bits = eval_literal((yyvsp[(2) - (3)].literal), 0, 7);
3313 -
3314 - if (((yyval.array).bits != 8) &&
3315 - ((yyval.array).bits != 16) &&
3316 - ((yyval.array).bits != 32) &&
3317 - ((yyval.array).bits != 64))
3318 - {
3319 - print_error("Only 8, 16, 32 and 64-bit elements"
3320 - " are currently supported");
3321 - (yyval.array).bits = 32;
3322 + unsigned long long bits;
3323 +
3324 + bits = (yyvsp[-1].integer);
3325 +
3326 + if ((bits != 8) && (bits != 16) &&
3327 + (bits != 32) && (bits != 64)) {
3328 + ERROR(&(yylsp[-1]), "Array elements must be"
3329 + " 8, 16, 32 or 64-bits");
3330 + bits = 32;
3331 }
3332 +
3333 + (yyval.array).data = empty_data;
3334 + (yyval.array).bits = bits;
3335 }
3336 +#line 1747 "dtc-parser.tab.c" /* yacc.c:1646 */
3337 break;
3338
3339 - case 29:
3340 -/* Line 1787 of yacc.c */
3341 -#line 291 "dtc-parser.y"
3342 + case 31:
3343 +#line 304 "dtc-parser.y" /* yacc.c:1646 */
3344 {
3345 (yyval.array).data = empty_data;
3346 (yyval.array).bits = 32;
3347 }
3348 +#line 1756 "dtc-parser.tab.c" /* yacc.c:1646 */
3349 break;
3350
3351 - case 30:
3352 -/* Line 1787 of yacc.c */
3353 -#line 296 "dtc-parser.y"
3354 + case 32:
3355 +#line 309 "dtc-parser.y" /* yacc.c:1646 */
3356 {
3357 - if ((yyvsp[(1) - (2)].array).bits < 64) {
3358 - uint64_t mask = (1ULL << (yyvsp[(1) - (2)].array).bits) - 1;
3359 + if ((yyvsp[-1].array).bits < 64) {
3360 + uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1;
3361 /*
3362 * Bits above mask must either be all zero
3363 * (positive within range of mask) or all one
3364 @@ -1801,275 +1768,258 @@ yyreduce:
3365 * within the mask to one (i.e. | in the
3366 * mask), all bits are one.
3367 */
3368 - if (((yyvsp[(2) - (2)].integer) > mask) && (((yyvsp[(2) - (2)].integer) | mask) != -1ULL))
3369 - print_error(
3370 - "integer value out of range "
3371 - "%016lx (%d bits)", (yyvsp[(1) - (2)].array).bits);
3372 + if (((yyvsp[0].integer) > mask) && (((yyvsp[0].integer) | mask) != -1ULL))
3373 + ERROR(&(yylsp[0]), "Value out of range for"
3374 + " %d-bit array element", (yyvsp[-1].array).bits);
3375 }
3376
3377 - (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits);
3378 + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits);
3379 }
3380 +#line 1779 "dtc-parser.tab.c" /* yacc.c:1646 */
3381 break;
3382
3383 - case 31:
3384 -/* Line 1787 of yacc.c */
3385 -#line 316 "dtc-parser.y"
3386 + case 33:
3387 +#line 328 "dtc-parser.y" /* yacc.c:1646 */
3388 {
3389 - uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits);
3390 + uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits);
3391
3392 - if ((yyvsp[(1) - (2)].array).bits == 32)
3393 - (yyvsp[(1) - (2)].array).data = data_add_marker((yyvsp[(1) - (2)].array).data,
3394 + if ((yyvsp[-1].array).bits == 32)
3395 + (yyvsp[-1].array).data = data_add_marker((yyvsp[-1].array).data,
3396 REF_PHANDLE,
3397 - (yyvsp[(2) - (2)].labelref));
3398 + (yyvsp[0].labelref));
3399 else
3400 - print_error("References are only allowed in "
3401 + ERROR(&(yylsp[0]), "References are only allowed in "
3402 "arrays with 32-bit elements.");
3403
3404 - (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits);
3405 - }
3406 - break;
3407 -
3408 - case 32:
3409 -/* Line 1787 of yacc.c */
3410 -#line 330 "dtc-parser.y"
3411 - {
3412 - (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref));
3413 - }
3414 - break;
3415 -
3416 - case 33:
3417 -/* Line 1787 of yacc.c */
3418 -#line 337 "dtc-parser.y"
3419 - {
3420 - (yyval.integer) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64);
3421 + (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits);
3422 }
3423 +#line 1797 "dtc-parser.tab.c" /* yacc.c:1646 */
3424 break;
3425
3426 case 34:
3427 -/* Line 1787 of yacc.c */
3428 -#line 341 "dtc-parser.y"
3429 +#line 342 "dtc-parser.y" /* yacc.c:1646 */
3430 {
3431 - (yyval.integer) = eval_char_literal((yyvsp[(1) - (1)].literal));
3432 + (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref));
3433 }
3434 +#line 1805 "dtc-parser.tab.c" /* yacc.c:1646 */
3435 break;
3436
3437 - case 35:
3438 -/* Line 1787 of yacc.c */
3439 -#line 345 "dtc-parser.y"
3440 + case 37:
3441 +#line 351 "dtc-parser.y" /* yacc.c:1646 */
3442 {
3443 - (yyval.integer) = (yyvsp[(2) - (3)].integer);
3444 + (yyval.integer) = (yyvsp[-1].integer);
3445 }
3446 - break;
3447 -
3448 - case 38:
3449 -/* Line 1787 of yacc.c */
3450 -#line 356 "dtc-parser.y"
3451 - { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); }
3452 +#line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */
3453 break;
3454
3455 case 40:
3456 -/* Line 1787 of yacc.c */
3457 -#line 361 "dtc-parser.y"
3458 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); }
3459 +#line 362 "dtc-parser.y" /* yacc.c:1646 */
3460 + { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); }
3461 +#line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */
3462 break;
3463
3464 case 42:
3465 -/* Line 1787 of yacc.c */
3466 -#line 366 "dtc-parser.y"
3467 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); }
3468 +#line 367 "dtc-parser.y" /* yacc.c:1646 */
3469 + { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); }
3470 +#line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */
3471 break;
3472
3473 case 44:
3474 -/* Line 1787 of yacc.c */
3475 -#line 371 "dtc-parser.y"
3476 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); }
3477 +#line 372 "dtc-parser.y" /* yacc.c:1646 */
3478 + { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); }
3479 +#line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */
3480 break;
3481
3482 case 46:
3483 -/* Line 1787 of yacc.c */
3484 -#line 376 "dtc-parser.y"
3485 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); }
3486 +#line 377 "dtc-parser.y" /* yacc.c:1646 */
3487 + { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); }
3488 +#line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */
3489 break;
3490
3491 case 48:
3492 -/* Line 1787 of yacc.c */
3493 -#line 381 "dtc-parser.y"
3494 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); }
3495 +#line 382 "dtc-parser.y" /* yacc.c:1646 */
3496 + { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); }
3497 +#line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */
3498 break;
3499
3500 case 50:
3501 -/* Line 1787 of yacc.c */
3502 -#line 386 "dtc-parser.y"
3503 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); }
3504 +#line 387 "dtc-parser.y" /* yacc.c:1646 */
3505 + { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); }
3506 +#line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */
3507 break;
3508
3509 - case 51:
3510 -/* Line 1787 of yacc.c */
3511 -#line 387 "dtc-parser.y"
3512 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); }
3513 + case 52:
3514 +#line 392 "dtc-parser.y" /* yacc.c:1646 */
3515 + { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); }
3516 +#line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */
3517 break;
3518
3519 case 53:
3520 -/* Line 1787 of yacc.c */
3521 -#line 392 "dtc-parser.y"
3522 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); }
3523 - break;
3524 -
3525 - case 54:
3526 -/* Line 1787 of yacc.c */
3527 -#line 393 "dtc-parser.y"
3528 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); }
3529 +#line 393 "dtc-parser.y" /* yacc.c:1646 */
3530 + { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); }
3531 +#line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */
3532 break;
3533
3534 case 55:
3535 -/* Line 1787 of yacc.c */
3536 -#line 394 "dtc-parser.y"
3537 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); }
3538 +#line 398 "dtc-parser.y" /* yacc.c:1646 */
3539 + { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); }
3540 +#line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */
3541 break;
3542
3543 case 56:
3544 -/* Line 1787 of yacc.c */
3545 -#line 395 "dtc-parser.y"
3546 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); }
3547 +#line 399 "dtc-parser.y" /* yacc.c:1646 */
3548 + { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); }
3549 +#line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */
3550 break;
3551
3552 case 57:
3553 -/* Line 1787 of yacc.c */
3554 -#line 399 "dtc-parser.y"
3555 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); }
3556 +#line 400 "dtc-parser.y" /* yacc.c:1646 */
3557 + { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); }
3558 +#line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */
3559 break;
3560
3561 case 58:
3562 -/* Line 1787 of yacc.c */
3563 -#line 400 "dtc-parser.y"
3564 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); }
3565 +#line 401 "dtc-parser.y" /* yacc.c:1646 */
3566 + { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); }
3567 +#line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */
3568 break;
3569
3570 - case 60:
3571 -/* Line 1787 of yacc.c */
3572 -#line 405 "dtc-parser.y"
3573 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); }
3574 + case 59:
3575 +#line 405 "dtc-parser.y" /* yacc.c:1646 */
3576 + { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); }
3577 +#line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */
3578 break;
3579
3580 - case 61:
3581 -/* Line 1787 of yacc.c */
3582 -#line 406 "dtc-parser.y"
3583 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); }
3584 + case 60:
3585 +#line 406 "dtc-parser.y" /* yacc.c:1646 */
3586 + { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); }
3587 +#line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */
3588 break;
3589
3590 - case 63:
3591 -/* Line 1787 of yacc.c */
3592 -#line 411 "dtc-parser.y"
3593 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); }
3594 + case 62:
3595 +#line 411 "dtc-parser.y" /* yacc.c:1646 */
3596 + { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); }
3597 +#line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */
3598 break;
3599
3600 - case 64:
3601 -/* Line 1787 of yacc.c */
3602 -#line 412 "dtc-parser.y"
3603 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); }
3604 + case 63:
3605 +#line 412 "dtc-parser.y" /* yacc.c:1646 */
3606 + { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); }
3607 +#line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */
3608 break;
3609
3610 case 65:
3611 -/* Line 1787 of yacc.c */
3612 -#line 413 "dtc-parser.y"
3613 - { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); }
3614 +#line 417 "dtc-parser.y" /* yacc.c:1646 */
3615 + { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); }
3616 +#line 1915 "dtc-parser.tab.c" /* yacc.c:1646 */
3617 break;
3618
3619 - case 68:
3620 -/* Line 1787 of yacc.c */
3621 -#line 419 "dtc-parser.y"
3622 - { (yyval.integer) = -(yyvsp[(2) - (2)].integer); }
3623 + case 66:
3624 +#line 418 "dtc-parser.y" /* yacc.c:1646 */
3625 + { (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); }
3626 +#line 1921 "dtc-parser.tab.c" /* yacc.c:1646 */
3627 break;
3628
3629 - case 69:
3630 -/* Line 1787 of yacc.c */
3631 -#line 420 "dtc-parser.y"
3632 - { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); }
3633 + case 67:
3634 +#line 419 "dtc-parser.y" /* yacc.c:1646 */
3635 + { (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); }
3636 +#line 1927 "dtc-parser.tab.c" /* yacc.c:1646 */
3637 break;
3638
3639 case 70:
3640 -/* Line 1787 of yacc.c */
3641 -#line 421 "dtc-parser.y"
3642 - { (yyval.integer) = !(yyvsp[(2) - (2)].integer); }
3643 +#line 425 "dtc-parser.y" /* yacc.c:1646 */
3644 + { (yyval.integer) = -(yyvsp[0].integer); }
3645 +#line 1933 "dtc-parser.tab.c" /* yacc.c:1646 */
3646 break;
3647
3648 case 71:
3649 -/* Line 1787 of yacc.c */
3650 -#line 426 "dtc-parser.y"
3651 - {
3652 - (yyval.data) = empty_data;
3653 - }
3654 +#line 426 "dtc-parser.y" /* yacc.c:1646 */
3655 + { (yyval.integer) = ~(yyvsp[0].integer); }
3656 +#line 1939 "dtc-parser.tab.c" /* yacc.c:1646 */
3657 break;
3658
3659 case 72:
3660 -/* Line 1787 of yacc.c */
3661 -#line 430 "dtc-parser.y"
3662 - {
3663 - (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte));
3664 - }
3665 +#line 427 "dtc-parser.y" /* yacc.c:1646 */
3666 + { (yyval.integer) = !(yyvsp[0].integer); }
3667 +#line 1945 "dtc-parser.tab.c" /* yacc.c:1646 */
3668 break;
3669
3670 case 73:
3671 -/* Line 1787 of yacc.c */
3672 -#line 434 "dtc-parser.y"
3673 +#line 432 "dtc-parser.y" /* yacc.c:1646 */
3674 {
3675 - (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
3676 + (yyval.data) = empty_data;
3677 }
3678 +#line 1953 "dtc-parser.tab.c" /* yacc.c:1646 */
3679 break;
3680
3681 case 74:
3682 -/* Line 1787 of yacc.c */
3683 -#line 441 "dtc-parser.y"
3684 +#line 436 "dtc-parser.y" /* yacc.c:1646 */
3685 {
3686 - (yyval.nodelist) = NULL;
3687 + (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte));
3688 }
3689 +#line 1961 "dtc-parser.tab.c" /* yacc.c:1646 */
3690 break;
3691
3692 case 75:
3693 -/* Line 1787 of yacc.c */
3694 -#line 445 "dtc-parser.y"
3695 +#line 440 "dtc-parser.y" /* yacc.c:1646 */
3696 {
3697 - (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist));
3698 + (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
3699 }
3700 +#line 1969 "dtc-parser.tab.c" /* yacc.c:1646 */
3701 break;
3702
3703 case 76:
3704 -/* Line 1787 of yacc.c */
3705 -#line 449 "dtc-parser.y"
3706 +#line 447 "dtc-parser.y" /* yacc.c:1646 */
3707 {
3708 - print_error("syntax error: properties must precede subnodes");
3709 - YYERROR;
3710 + (yyval.nodelist) = NULL;
3711 }
3712 +#line 1977 "dtc-parser.tab.c" /* yacc.c:1646 */
3713 break;
3714
3715 case 77:
3716 -/* Line 1787 of yacc.c */
3717 -#line 457 "dtc-parser.y"
3718 +#line 451 "dtc-parser.y" /* yacc.c:1646 */
3719 {
3720 - (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename));
3721 + (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist));
3722 }
3723 +#line 1985 "dtc-parser.tab.c" /* yacc.c:1646 */
3724 break;
3725
3726 case 78:
3727 -/* Line 1787 of yacc.c */
3728 -#line 461 "dtc-parser.y"
3729 +#line 455 "dtc-parser.y" /* yacc.c:1646 */
3730 {
3731 - (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename));
3732 + ERROR(&(yylsp[0]), "Properties must precede subnodes");
3733 + YYERROR;
3734 }
3735 +#line 1994 "dtc-parser.tab.c" /* yacc.c:1646 */
3736 break;
3737
3738 case 79:
3739 -/* Line 1787 of yacc.c */
3740 -#line 465 "dtc-parser.y"
3741 +#line 463 "dtc-parser.y" /* yacc.c:1646 */
3742 {
3743 - add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref));
3744 - (yyval.node) = (yyvsp[(2) - (2)].node);
3745 + (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename));
3746 }
3747 +#line 2002 "dtc-parser.tab.c" /* yacc.c:1646 */
3748 break;
3749
3750 + case 80:
3751 +#line 467 "dtc-parser.y" /* yacc.c:1646 */
3752 + {
3753 + (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename));
3754 + }
3755 +#line 2010 "dtc-parser.tab.c" /* yacc.c:1646 */
3756 + break;
3757
3758 -/* Line 1787 of yacc.c */
3759 -#line 2073 "dtc-parser.tab.c"
3760 + case 81:
3761 +#line 471 "dtc-parser.y" /* yacc.c:1646 */
3762 + {
3763 + add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref));
3764 + (yyval.node) = (yyvsp[0].node);
3765 + }
3766 +#line 2019 "dtc-parser.tab.c" /* yacc.c:1646 */
3767 + break;
3768 +
3769 +
3770 +#line 2023 "dtc-parser.tab.c" /* yacc.c:1646 */
3771 default: break;
3772 }
3773 /* User semantic actions sometimes alter yychar, and that requires
3774 @@ -2090,8 +2040,9 @@ yyreduce:
3775 YY_STACK_PRINT (yyss, yyssp);
3776
3777 *++yyvsp = yyval;
3778 + *++yylsp = yyloc;
3779
3780 - /* Now `shift' the result of the reduction. Determine what state
3781 + /* Now 'shift' the result of the reduction. Determine what state
3782 that goes to, based on the state we popped back to and the rule
3783 number reduced by. */
3784
3785 @@ -2106,9 +2057,9 @@ yyreduce:
3786 goto yynewstate;
3787
3788
3789 -/*------------------------------------.
3790 -| yyerrlab -- here on detecting error |
3791 -`------------------------------------*/
3792 +/*--------------------------------------.
3793 +| yyerrlab -- here on detecting error. |
3794 +`--------------------------------------*/
3795 yyerrlab:
3796 /* Make sure we have latest lookahead translation. See comments at
3797 user semantic actions for why this is necessary. */
3798 @@ -2154,25 +2105,25 @@ yyerrlab:
3799 #endif
3800 }
3801
3802 -
3803 + yyerror_range[1] = yylloc;
3804
3805 if (yyerrstatus == 3)
3806 {
3807 /* If just tried and failed to reuse lookahead token after an
3808 - error, discard it. */
3809 + error, discard it. */
3810
3811 if (yychar <= YYEOF)
3812 - {
3813 - /* Return failure if at end of input. */
3814 - if (yychar == YYEOF)
3815 - YYABORT;
3816 - }
3817 + {
3818 + /* Return failure if at end of input. */
3819 + if (yychar == YYEOF)
3820 + YYABORT;
3821 + }
3822 else
3823 - {
3824 - yydestruct ("Error: discarding",
3825 - yytoken, &yylval);
3826 - yychar = YYEMPTY;
3827 - }
3828 + {
3829 + yydestruct ("Error: discarding",
3830 + yytoken, &yylval, &yylloc);
3831 + yychar = YYEMPTY;
3832 + }
3833 }
3834
3835 /* Else will try to reuse lookahead token after shifting the error
3836 @@ -2191,7 +2142,8 @@ yyerrorlab:
3837 if (/*CONSTCOND*/ 0)
3838 goto yyerrorlab;
3839
3840 - /* Do not reclaim the symbols of the rule which action triggered
3841 + yyerror_range[1] = yylsp[1-yylen];
3842 + /* Do not reclaim the symbols of the rule whose action triggered
3843 this YYERROR. */
3844 YYPOPSTACK (yylen);
3845 yylen = 0;
3846 @@ -2204,29 +2156,29 @@ yyerrorlab:
3847 | yyerrlab1 -- common code for both syntax error and YYERROR. |
3848 `-------------------------------------------------------------*/
3849 yyerrlab1:
3850 - yyerrstatus = 3; /* Each real token shifted decrements this. */
3851 + yyerrstatus = 3; /* Each real token shifted decrements this. */
3852
3853 for (;;)
3854 {
3855 yyn = yypact[yystate];
3856 if (!yypact_value_is_default (yyn))
3857 - {
3858 - yyn += YYTERROR;
3859 - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3860 - {
3861 - yyn = yytable[yyn];
3862 - if (0 < yyn)
3863 - break;
3864 - }
3865 - }
3866 + {
3867 + yyn += YYTERROR;
3868 + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3869 + {
3870 + yyn = yytable[yyn];
3871 + if (0 < yyn)
3872 + break;
3873 + }
3874 + }
3875
3876 /* Pop the current state because it cannot handle the error token. */
3877 if (yyssp == yyss)
3878 - YYABORT;
3879 -
3880 + YYABORT;
3881
3882 + yyerror_range[1] = *yylsp;
3883 yydestruct ("Error: popping",
3884 - yystos[yystate], yyvsp);
3885 + yystos[yystate], yyvsp, yylsp);
3886 YYPOPSTACK (1);
3887 yystate = *yyssp;
3888 YY_STACK_PRINT (yyss, yyssp);
3889 @@ -2236,6 +2188,11 @@ yyerrlab1:
3890 *++yyvsp = yylval;
3891 YY_IGNORE_MAYBE_UNINITIALIZED_END
3892
3893 + yyerror_range[2] = yylloc;
3894 + /* Using YYLLOC is tempting, but would change the location of
3895 + the lookahead. YYLOC is available though. */
3896 + YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
3897 + *++yylsp = yyloc;
3898
3899 /* Shift the error token. */
3900 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
3901 @@ -2275,16 +2232,16 @@ yyreturn:
3902 user semantic actions for why this is necessary. */
3903 yytoken = YYTRANSLATE (yychar);
3904 yydestruct ("Cleanup: discarding lookahead",
3905 - yytoken, &yylval);
3906 + yytoken, &yylval, &yylloc);
3907 }
3908 - /* Do not reclaim the symbols of the rule which action triggered
3909 + /* Do not reclaim the symbols of the rule whose action triggered
3910 this YYABORT or YYACCEPT. */
3911 YYPOPSTACK (yylen);
3912 YY_STACK_PRINT (yyss, yyssp);
3913 while (yyssp != yyss)
3914 {
3915 yydestruct ("Cleanup: popping",
3916 - yystos[*yyssp], yyvsp);
3917 + yystos[*yyssp], yyvsp, yylsp);
3918 YYPOPSTACK (1);
3919 }
3920 #ifndef yyoverflow
3921 @@ -2295,72 +2252,12 @@ yyreturn:
3922 if (yymsg != yymsgbuf)
3923 YYSTACK_FREE (yymsg);
3924 #endif
3925 - /* Make sure YYID is used. */
3926 - return YYID (yyresult);
3927 + return yyresult;
3928 }
3929 +#line 477 "dtc-parser.y" /* yacc.c:1906 */
3930
3931
3932 -/* Line 2050 of yacc.c */
3933 -#line 471 "dtc-parser.y"
3934 -
3935 -
3936 -void print_error(char const *fmt, ...)
3937 -{
3938 - va_list va;
3939 -
3940 - va_start(va, fmt);
3941 - srcpos_verror(&yylloc, fmt, va);
3942 - va_end(va);
3943 -
3944 - treesource_error = 1;
3945 -}
3946 -
3947 -void yyerror(char const *s) {
3948 - print_error("%s", s);
3949 -}
3950 -
3951 -static unsigned long long eval_literal(const char *s, int base, int bits)
3952 -{
3953 - unsigned long long val;
3954 - char *e;
3955 -
3956 - errno = 0;
3957 - val = strtoull(s, &e, base);
3958 - if (*e) {
3959 - size_t uls = strspn(e, "UL");
3960 - if (e[uls])
3961 - print_error("bad characters in literal");
3962 - }
3963 - if ((errno == ERANGE)
3964 - || ((bits < 64) && (val >= (1ULL << bits))))
3965 - print_error("literal out of range");
3966 - else if (errno != 0)
3967 - print_error("bad literal");
3968 - return val;
3969 -}
3970 -
3971 -static unsigned char eval_char_literal(const char *s)
3972 +void yyerror(char const *s)
3973 {
3974 - int i = 1;
3975 - char c = s[0];
3976 -
3977 - if (c == '\0')
3978 - {
3979 - print_error("empty character literal");
3980 - return 0;
3981 - }
3982 -
3983 - /*
3984 - * If the first character in the character literal is a \ then process
3985 - * the remaining characters as an escape encoding. If the first
3986 - * character is neither an escape or a terminator it should be the only
3987 - * character in the literal and will be returned.
3988 - */
3989 - if (c == '\\')
3990 - c = get_escape_char(s, &i);
3991 -
3992 - if (s[i] != '\0')
3993 - print_error("malformed character literal");
3994 -
3995 - return c;
3996 + ERROR(&yylloc, "%s", s);
3997 }
3998 diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped
3999 index b2e7a86..b497956 100644
4000 --- a/scripts/dtc/dtc-parser.tab.h_shipped
4001 +++ b/scripts/dtc/dtc-parser.tab.h_shipped
4002 @@ -1,19 +1,19 @@
4003 -/* A Bison parser, made by GNU Bison 2.7.12-4996. */
4004 +/* A Bison parser, made by GNU Bison 3.0.2. */
4005
4006 /* Bison interface for Yacc-like parsers in C
4007 -
4008 - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
4009 -
4010 +
4011 + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
4012 +
4013 This program is free software: you can redistribute it and/or modify
4014 it under the terms of the GNU General Public License as published by
4015 the Free Software Foundation, either version 3 of the License, or
4016 (at your option) any later version.
4017 -
4018 +
4019 This program is distributed in the hope that it will be useful,
4020 but WITHOUT ANY WARRANTY; without even the implied warranty of
4021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4022 GNU General Public License for more details.
4023 -
4024 +
4025 You should have received a copy of the GNU General Public License
4026 along with this program. If not, see <http://www.gnu.org/licenses/>. */
4027
4028 @@ -26,13 +26,13 @@
4029 special exception, which will cause the skeleton and the resulting
4030 Bison output files to be licensed under the GNU General Public
4031 License without this special exception.
4032 -
4033 +
4034 This special exception was added by the Free Software Foundation in
4035 version 2.2 of Bison. */
4036
4037 #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED
4038 # define YY_YY_DTC_PARSER_TAB_H_INCLUDED
4039 -/* Enabling traces. */
4040 +/* Debug traces. */
4041 #ifndef YYDEBUG
4042 # define YYDEBUG 0
4043 #endif
4044 @@ -40,48 +40,45 @@
4045 extern int yydebug;
4046 #endif
4047
4048 -/* Tokens. */
4049 +/* Token type. */
4050 #ifndef YYTOKENTYPE
4051 # define YYTOKENTYPE
4052 - /* Put the tokens into the symbol table, so that GDB and other debuggers
4053 - know about them. */
4054 - enum yytokentype {
4055 - DT_V1 = 258,
4056 - DT_MEMRESERVE = 259,
4057 - DT_LSHIFT = 260,
4058 - DT_RSHIFT = 261,
4059 - DT_LE = 262,
4060 - DT_GE = 263,
4061 - DT_EQ = 264,
4062 - DT_NE = 265,
4063 - DT_AND = 266,
4064 - DT_OR = 267,
4065 - DT_BITS = 268,
4066 - DT_DEL_PROP = 269,
4067 - DT_DEL_NODE = 270,
4068 - DT_PROPNODENAME = 271,
4069 - DT_LITERAL = 272,
4070 - DT_CHAR_LITERAL = 273,
4071 - DT_BASE = 274,
4072 - DT_BYTE = 275,
4073 - DT_STRING = 276,
4074 - DT_LABEL = 277,
4075 - DT_REF = 278,
4076 - DT_INCBIN = 279
4077 - };
4078 + enum yytokentype
4079 + {
4080 + DT_V1 = 258,
4081 + DT_PLUGIN = 259,
4082 + DT_MEMRESERVE = 260,
4083 + DT_LSHIFT = 261,
4084 + DT_RSHIFT = 262,
4085 + DT_LE = 263,
4086 + DT_GE = 264,
4087 + DT_EQ = 265,
4088 + DT_NE = 266,
4089 + DT_AND = 267,
4090 + DT_OR = 268,
4091 + DT_BITS = 269,
4092 + DT_DEL_PROP = 270,
4093 + DT_DEL_NODE = 271,
4094 + DT_PROPNODENAME = 272,
4095 + DT_LITERAL = 273,
4096 + DT_CHAR_LITERAL = 274,
4097 + DT_BYTE = 275,
4098 + DT_STRING = 276,
4099 + DT_LABEL = 277,
4100 + DT_REF = 278,
4101 + DT_INCBIN = 279
4102 + };
4103 #endif
4104
4105 -
4106 +/* Value type. */
4107 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
4108 -typedef union YYSTYPE
4109 +typedef union YYSTYPE YYSTYPE;
4110 +union YYSTYPE
4111 {
4112 -/* Line 2053 of yacc.c */
4113 -#line 40 "dtc-parser.y"
4114 +#line 39 "dtc-parser.y" /* yacc.c:1909 */
4115
4116 char *propnodename;
4117 - char *literal;
4118 char *labelref;
4119 - unsigned int cbase;
4120 uint8_t byte;
4121 struct data data;
4122
4123 @@ -96,30 +93,31 @@ typedef union YYSTYPE
4124 struct node *nodelist;
4125 struct reserve_info *re;
4126 uint64_t integer;
4127 + int is_plugin;
4128
4129 -
4130 -/* Line 2053 of yacc.c */
4131 -#line 103 "dtc-parser.tab.h"
4132 -} YYSTYPE;
4133 +#line 99 "dtc-parser.tab.h" /* yacc.c:1909 */
4134 +};
4135 # define YYSTYPE_IS_TRIVIAL 1
4136 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */
4137 # define YYSTYPE_IS_DECLARED 1
4138 #endif
4139
4140 -extern YYSTYPE yylval;
4141 -
4142 -#ifdef YYPARSE_PARAM
4143 -#if defined __STDC__ || defined __cplusplus
4144 -int yyparse (void *YYPARSE_PARAM);
4145 -#else
4146 -int yyparse ();
4147 +/* Location type. */
4148 +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
4149 +typedef struct YYLTYPE YYLTYPE;
4150 +struct YYLTYPE
4151 +{
4152 + int first_line;
4153 + int first_column;
4154 + int last_line;
4155 + int last_column;
4156 +};
4157 +# define YYLTYPE_IS_DECLARED 1
4158 +# define YYLTYPE_IS_TRIVIAL 1
4159 #endif
4160 -#else /* ! YYPARSE_PARAM */
4161 -#if defined __STDC__ || defined __cplusplus
4162 +
4163 +
4164 +extern YYSTYPE yylval;
4165 +extern YYLTYPE yylloc;
4166 int yyparse (void);
4167 -#else
4168 -int yyparse ();
4169 -#endif
4170 -#endif /* ! YYPARSE_PARAM */
4171
4172 #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */
4173 diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y
4174 index f412460..687ccad 100644
4175 --- a/scripts/dtc/dtc-parser.y
4176 +++ b/scripts/dtc/dtc-parser.y
4177 @@ -17,31 +17,28 @@
4178 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
4179 * USA
4180 */
4181 -
4182 %{
4183 #include <stdio.h>
4184 +#include <inttypes.h>
4185
4186 #include "dtc.h"
4187 #include "srcpos.h"
4188
4189 -YYLTYPE yylloc;
4190 -
4191 extern int yylex(void);
4192 -extern void print_error(char const *fmt, ...);
4193 extern void yyerror(char const *s);
4194 +#define ERROR(loc, ...) \
4195 + do { \
4196 + srcpos_error((loc), "Error", __VA_ARGS__); \
4197 + treesource_error = true; \
4198 + } while (0)
4199
4200 extern struct boot_info *the_boot_info;
4201 -extern int treesource_error;
4202 -
4203 -static unsigned long long eval_literal(const char *s, int base, int bits);
4204 -static unsigned char eval_char_literal(const char *s);
4205 +extern bool treesource_error;
4206 %}
4207
4208 %union {
4209 char *propnodename;
4210 - char *literal;
4211 char *labelref;
4212 - unsigned int cbase;
4213 uint8_t byte;
4214 struct data data;
4215
4216 @@ -56,18 +53,19 @@ static unsigned char eval_char_literal(const char *s);
4217 struct node *nodelist;
4218 struct reserve_info *re;
4219 uint64_t integer;
4220 + int is_plugin;
4221 }
4222
4223 %token DT_V1
4224 +%token DT_PLUGIN
4225 %token DT_MEMRESERVE
4226 %token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR
4227 %token DT_BITS
4228 %token DT_DEL_PROP
4229 %token DT_DEL_NODE
4230 %token <propnodename> DT_PROPNODENAME
4231 -%token <literal> DT_LITERAL
4232 -%token <literal> DT_CHAR_LITERAL
4233 -%token <cbase> DT_BASE
4234 +%token <integer> DT_LITERAL
4235 +%token <integer> DT_CHAR_LITERAL
4236 %token <byte> DT_BYTE
4237 %token <data> DT_STRING
4238 %token <labelref> DT_LABEL
4239 @@ -76,6 +74,7 @@ static unsigned char eval_char_literal(const char *s);
4240
4241 %type <data> propdata
4242 %type <data> propdataprefix
4243 +%type <is_plugin> plugindecl
4244 %type <re> memreserve
4245 %type <re> memreserves
4246 %type <array> arrayprefix
4247 @@ -106,10 +105,23 @@ static unsigned char eval_char_literal(const char *s);
4248 %%
4249
4250 sourcefile:
4251 - DT_V1 ';' memreserves devicetree
4252 + DT_V1 ';' plugindecl memreserves devicetree
4253 + {
4254 + $5->is_plugin = $3;
4255 + $5->is_root = 1;
4256 + the_boot_info = build_boot_info($4, $5,
4257 + guess_boot_cpuid($5));
4258 + }
4259 + ;
4260 +
4261 +plugindecl:
4262 + /* empty */
4263 + {
4264 + $$ = 0;
4265 + }
4266 + | DT_PLUGIN ';'
4267 {
4268 - the_boot_info = build_boot_info($3, $4,
4269 - guess_boot_cpuid($4));
4270 + $$ = 1;
4271 }
4272 ;
4273
4274 @@ -152,17 +164,18 @@ devicetree:
4275 if (target)
4276 merge_nodes(target, $3);
4277 else
4278 - print_error("label or path, '%s', not found", $2);
4279 + ERROR(&@2, "Label or path %s not found", $2);
4280 $$ = $1;
4281 }
4282 | devicetree DT_DEL_NODE DT_REF ';'
4283 {
4284 struct node *target = get_node_by_ref($1, $3);
4285
4286 - if (!target)
4287 - print_error("label or path, '%s', not found", $3);
4288 - else
4289 + if (target)
4290 delete_node(target);
4291 + else
4292 + ERROR(&@3, "Label or path %s not found", $3);
4293 +
4294
4295 $$ = $1;
4296 }
4297 @@ -230,10 +243,9 @@ propdata:
4298
4299 if ($6 != 0)
4300 if (fseek(f, $6, SEEK_SET) != 0)
4301 - print_error("Couldn't seek to offset %llu in \"%s\": %s",
4302 - (unsigned long long)$6,
4303 - $4.val,
4304 - strerror(errno));
4305 + die("Couldn't seek to offset %llu in \"%s\": %s",
4306 + (unsigned long long)$6, $4.val,
4307 + strerror(errno));
4308
4309 d = data_copy_file(f, $8);
4310
4311 @@ -274,18 +286,19 @@ propdataprefix:
4312 arrayprefix:
4313 DT_BITS DT_LITERAL '<'
4314 {
4315 - $$.data = empty_data;
4316 - $$.bits = eval_literal($2, 0, 7);
4317 -
4318 - if (($$.bits != 8) &&
4319 - ($$.bits != 16) &&
4320 - ($$.bits != 32) &&
4321 - ($$.bits != 64))
4322 - {
4323 - print_error("Only 8, 16, 32 and 64-bit elements"
4324 - " are currently supported");
4325 - $$.bits = 32;
4326 + unsigned long long bits;
4327 +
4328 + bits = $2;
4329 +
4330 + if ((bits != 8) && (bits != 16) &&
4331 + (bits != 32) && (bits != 64)) {
4332 + ERROR(&@2, "Array elements must be"
4333 + " 8, 16, 32 or 64-bits");
4334 + bits = 32;
4335 }
4336 +
4337 + $$.data = empty_data;
4338 + $$.bits = bits;
4339 }
4340 | '<'
4341 {
4342 @@ -305,9 +318,8 @@ arrayprefix:
4343 * mask), all bits are one.
4344 */
4345 if (($2 > mask) && (($2 | mask) != -1ULL))
4346 - print_error(
4347 - "integer value out of range "
4348 - "%016lx (%d bits)", $1.bits);
4349 + ERROR(&@2, "Value out of range for"
4350 + " %d-bit array element", $1.bits);
4351 }
4352
4353 $$.data = data_append_integer($1.data, $2, $1.bits);
4354 @@ -321,7 +333,7 @@ arrayprefix:
4355 REF_PHANDLE,
4356 $2);
4357 else
4358 - print_error("References are only allowed in "
4359 + ERROR(&@2, "References are only allowed in "
4360 "arrays with 32-bit elements.");
4361
4362 $$.data = data_append_integer($1.data, val, $1.bits);
4363 @@ -334,13 +346,7 @@ arrayprefix:
4364
4365 integer_prim:
4366 DT_LITERAL
4367 - {
4368 - $$ = eval_literal($1, 0, 64);
4369 - }
4370 | DT_CHAR_LITERAL
4371 - {
4372 - $$ = eval_char_literal($1);
4373 - }
4374 | '(' integer_expr ')'
4375 {
4376 $$ = $2;
4377 @@ -447,7 +453,7 @@ subnodes:
4378 }
4379 | subnode propdef
4380 {
4381 - print_error("syntax error: properties must precede subnodes");
4382 + ERROR(&@2, "Properties must precede subnodes");
4383 YYERROR;
4384 }
4385 ;
4386 @@ -470,63 +476,7 @@ subnode:
4387
4388 %%
4389
4390 -void print_error(char const *fmt, ...)
4391 -{
4392 - va_list va;
4393 -
4394 - va_start(va, fmt);
4395 - srcpos_verror(&yylloc, fmt, va);
4396 - va_end(va);
4397 -
4398 - treesource_error = 1;
4399 -}
4400 -
4401 -void yyerror(char const *s) {
4402 - print_error("%s", s);
4403 -}
4404 -
4405 -static unsigned long long eval_literal(const char *s, int base, int bits)
4406 -{
4407 - unsigned long long val;
4408 - char *e;
4409 -
4410 - errno = 0;
4411 - val = strtoull(s, &e, base);
4412 - if (*e) {
4413 - size_t uls = strspn(e, "UL");
4414 - if (e[uls])
4415 - print_error("bad characters in literal");
4416 - }
4417 - if ((errno == ERANGE)
4418 - || ((bits < 64) && (val >= (1ULL << bits))))
4419 - print_error("literal out of range");
4420 - else if (errno != 0)
4421 - print_error("bad literal");
4422 - return val;
4423 -}
4424 -
4425 -static unsigned char eval_char_literal(const char *s)
4426 +void yyerror(char const *s)
4427 {
4428 - int i = 1;
4429 - char c = s[0];
4430 -
4431 - if (c == '\0')
4432 - {
4433 - print_error("empty character literal");
4434 - return 0;
4435 - }
4436 -
4437 - /*
4438 - * If the first character in the character literal is a \ then process
4439 - * the remaining characters as an escape encoding. If the first
4440 - * character is neither an escape or a terminator it should be the only
4441 - * character in the literal and will be returned.
4442 - */
4443 - if (c == '\\')
4444 - c = get_escape_char(s, &i);
4445 -
4446 - if (s[i] != '\0')
4447 - print_error("malformed character literal");
4448 -
4449 - return c;
4450 + ERROR(&yylloc, "%s", s);
4451 }
4452 diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c
4453 index e3c9653..0cbb14c 100644
4454 --- a/scripts/dtc/dtc.c
4455 +++ b/scripts/dtc/dtc.c
4456 @@ -29,6 +29,7 @@ int reservenum; /* Number of memory reservation slots */
4457 int minsize; /* Minimum blob size */
4458 int padsize; /* Additional padding to blob */
4459 int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */
4460 +int symbol_fixup_support = 0;
4461
4462 static void fill_fullpaths(struct node *tree, const char *prefix)
4463 {
4464 @@ -48,8 +49,10 @@ static void fill_fullpaths(struct node *tree, const char *prefix)
4465 }
4466
4467 /* Usage related data. */
4468 +#define FDT_VERSION(version) _FDT_VERSION(version)
4469 +#define _FDT_VERSION(version) #version
4470 static const char usage_synopsis[] = "dtc [options] <input file>";
4471 -static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv";
4472 +static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv@";
4473 static struct option const usage_long_opts[] = {
4474 {"quiet", no_argument, NULL, 'q'},
4475 {"in-format", a_argument, NULL, 'I'},
4476 @@ -67,6 +70,7 @@ static struct option const usage_long_opts[] = {
4477 {"phandle", a_argument, NULL, 'H'},
4478 {"warning", a_argument, NULL, 'W'},
4479 {"error", a_argument, NULL, 'E'},
4480 + {"symbols", a_argument, NULL, '@'},
4481 {"help", no_argument, NULL, 'h'},
4482 {"version", no_argument, NULL, 'v'},
4483 {NULL, no_argument, NULL, 0x0},
4484 @@ -82,9 +86,9 @@ static const char * const usage_opts_help[] = {
4485 "\t\tdts - device tree source text\n"
4486 "\t\tdtb - device tree blob\n"
4487 "\t\tasm - assembler source",
4488 - "\n\tBlob version to produce, defaults to %d (for dtb and asm output)", //, DEFAULT_FDT_VERSION);
4489 + "\n\tBlob version to produce, defaults to "FDT_VERSION(DEFAULT_FDT_VERSION)" (for dtb and asm output)",
4490 "\n\tOutput dependency file",
4491 - "\n\ttMake space for <number> reserve map entries (for dtb and asm output)",
4492 + "\n\tMake space for <number> reserve map entries (for dtb and asm output)",
4493 "\n\tMake the blob at least <bytes> long (extra space)",
4494 "\n\tAdd padding to the blob of <bytes> long (extra space)",
4495 "\n\tSet the physical boot cpu",
4496 @@ -97,6 +101,7 @@ static const char * const usage_opts_help[] = {
4497 "\t\tboth - Both \"linux,phandle\" and \"phandle\" properties",
4498 "\n\tEnable/disable warnings (prefix with \"no-\")",
4499 "\n\tEnable/disable errors (prefix with \"no-\")",
4500 + "\n\tSymbols and Fixups support",
4501 "\n\tPrint this help and exit",
4502 "\n\tPrint version and exit",
4503 NULL,
4504 @@ -109,7 +114,7 @@ int main(int argc, char *argv[])
4505 const char *outform = "dts";
4506 const char *outname = "-";
4507 const char *depname = NULL;
4508 - int force = 0, sort = 0;
4509 + bool force = false, sort = false;
4510 const char *arg;
4511 int opt;
4512 FILE *outf = NULL;
4513 @@ -148,7 +153,7 @@ int main(int argc, char *argv[])
4514 padsize = strtol(optarg, NULL, 0);
4515 break;
4516 case 'f':
4517 - force = 1;
4518 + force = true;
4519 break;
4520 case 'q':
4521 quiet++;
4522 @@ -174,7 +179,7 @@ int main(int argc, char *argv[])
4523 break;
4524
4525 case 's':
4526 - sort = 1;
4527 + sort = true;
4528 break;
4529
4530 case 'W':
4531 @@ -184,7 +189,9 @@ int main(int argc, char *argv[])
4532 case 'E':
4533 parse_checks_option(false, true, optarg);
4534 break;
4535 -
4536 + case '@':
4537 + symbol_fixup_support = 1;
4538 + break;
4539 case 'h':
4540 usage(NULL);
4541 default:
4542 @@ -237,7 +244,7 @@ int main(int argc, char *argv[])
4543 if (streq(outname, "-")) {
4544 outf = stdout;
4545 } else {
4546 - outf = fopen(outname, "w");
4547 + outf = fopen(outname, "wb");
4548 if (! outf)
4549 die("Couldn't open output file %s: %s\n",
4550 outname, strerror(errno));
4551 diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h
4552 index 264a20c..fe45748 100644
4553 --- a/scripts/dtc/dtc.h
4554 +++ b/scripts/dtc/dtc.h
4555 @@ -38,9 +38,9 @@
4556 #include "util.h"
4557
4558 #ifdef DEBUG
4559 -#define debug(fmt,args...) printf(fmt, ##args)
4560 +#define debug(...) printf(__VA_ARGS__)
4561 #else
4562 -#define debug(fmt,args...)
4563 +#define debug(...)
4564 #endif
4565
4566
4567 @@ -54,6 +54,7 @@ extern int reservenum; /* Number of memory reservation slots */
4568 extern int minsize; /* Minimum blob size */
4569 extern int padsize; /* Additional padding to blob */
4570 extern int phandle_format; /* Use linux,phandle or phandle properties */
4571 +extern int symbol_fixup_support;/* enable symbols & fixup support */
4572
4573 #define PHANDLE_LEGACY 0x1
4574 #define PHANDLE_EPAPR 0x2
4575 @@ -88,7 +89,7 @@ struct data {
4576 };
4577
4578
4579 -#define empty_data ((struct data){ /* all .members = 0 or NULL */ })
4580 +#define empty_data ((struct data){ 0 /* all .members = 0 or NULL */ })
4581
4582 #define for_each_marker(m) \
4583 for (; (m); (m) = (m)->next)
4584 @@ -118,7 +119,7 @@ struct data data_append_align(struct data d, int align);
4585
4586 struct data data_add_marker(struct data d, enum markertype type, char *ref);
4587
4588 -int data_is_one_string(struct data d);
4589 +bool data_is_one_string(struct data d);
4590
4591 /* DT constraints */
4592
4593 @@ -127,13 +128,32 @@ int data_is_one_string(struct data d);
4594
4595 /* Live trees */
4596 struct label {
4597 - int deleted;
4598 + bool deleted;
4599 char *label;
4600 struct label *next;
4601 };
4602
4603 +struct fixup_entry {
4604 + int offset;
4605 + struct node *node;
4606 + struct property *prop;
4607 + struct fixup_entry *next;
4608 +};
4609 +
4610 +struct fixup {
4611 + char *ref;
4612 + struct fixup_entry *entries;
4613 + struct fixup *next;
4614 +};
4615 +
4616 +struct symbol {
4617 + struct label *label;
4618 + struct node *node;
4619 + struct symbol *next;
4620 +};
4621 +
4622 struct property {
4623 - int deleted;
4624 + bool deleted;
4625 char *name;
4626 struct data val;
4627
4628 @@ -143,7 +163,7 @@ struct property {
4629 };
4630
4631 struct node {
4632 - int deleted;
4633 + bool deleted;
4634 char *name;
4635 struct property *proplist;
4636 struct node *children;
4637 @@ -158,6 +178,12 @@ struct node {
4638 int addr_cells, size_cells;
4639
4640 struct label *labels;
4641 +
4642 + int is_root;
4643 + int is_plugin;
4644 + struct fixup *fixups;
4645 + struct symbol *symbols;
4646 + struct fixup_entry *local_fixups;
4647 };
4648
4649 #define for_each_label_withdel(l0, l) \
4650 @@ -181,6 +207,18 @@ struct node {
4651 for_each_child_withdel(n, c) \
4652 if (!(c)->deleted)
4653
4654 +#define for_each_fixup(n, f) \
4655 + for ((f) = (n)->fixups; (f); (f) = (f)->next)
4656 +
4657 +#define for_each_fixup_entry(f, fe) \
4658 + for ((fe) = (f)->entries; (fe); (fe) = (fe)->next)
4659 +
4660 +#define for_each_symbol(n, s) \
4661 + for ((s) = (n)->symbols; (s); (s) = (s)->next)
4662 +
4663 +#define for_each_local_fixup_entry(n, fe) \
4664 + for ((fe) = (n)->local_fixups; (fe); (fe) = (fe)->next)
4665 +
4666 void add_label(struct label **labels, char *label);
4667 void delete_labels(struct label **labels);
4668
4669 @@ -247,8 +285,8 @@ void sort_tree(struct boot_info *bi);
4670
4671 /* Checks */
4672
4673 -void parse_checks_option(bool warn, bool error, const char *optarg);
4674 -void process_checks(int force, struct boot_info *bi);
4675 +void parse_checks_option(bool warn, bool error, const char *arg);
4676 +void process_checks(bool force, struct boot_info *bi);
4677
4678 /* Flattened trees */
4679
4680 diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c
4681 index 665dad7..f439b40 100644
4682 --- a/scripts/dtc/flattree.c
4683 +++ b/scripts/dtc/flattree.c
4684 @@ -261,7 +261,13 @@ static void flatten_tree(struct node *tree, struct emitter *emit,
4685 {
4686 struct property *prop;
4687 struct node *child;
4688 - int seen_name_prop = 0;
4689 + bool seen_name_prop = false;
4690 + struct symbol *sym;
4691 + struct fixup *f;
4692 + struct fixup_entry *fe;
4693 + char *name, *s;
4694 + const char *fullpath;
4695 + int namesz, nameoff, vallen;
4696
4697 if (tree->deleted)
4698 return;
4699 @@ -276,10 +282,8 @@ static void flatten_tree(struct node *tree, struct emitter *emit,
4700 emit->align(etarget, sizeof(cell_t));
4701
4702 for_each_property(tree, prop) {
4703 - int nameoff;
4704 -
4705 if (streq(prop->name, "name"))
4706 - seen_name_prop = 1;
4707 + seen_name_prop = true;
4708
4709 nameoff = stringtable_insert(strbuf, prop->name);
4710
4711 @@ -310,6 +314,139 @@ static void flatten_tree(struct node *tree, struct emitter *emit,
4712 flatten_tree(child, emit, etarget, strbuf, vi);
4713 }
4714
4715 + if (!symbol_fixup_support)
4716 + goto no_symbols;
4717 +
4718 + /* add the symbol nodes (if any) */
4719 + if (tree->symbols) {
4720 +
4721 + emit->beginnode(etarget, NULL);
4722 + emit->string(etarget, "__symbols__", 0);
4723 + emit->align(etarget, sizeof(cell_t));
4724 +
4725 + for_each_symbol(tree, sym) {
4726 +
4727 + vallen = strlen(sym->node->fullpath);
4728 +
4729 + nameoff = stringtable_insert(strbuf, sym->label->label);
4730 +
4731 + emit->property(etarget, NULL);
4732 + emit->cell(etarget, vallen + 1);
4733 + emit->cell(etarget, nameoff);
4734 +
4735 + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
4736 + emit->align(etarget, 8);
4737 +
4738 + emit->string(etarget, sym->node->fullpath,
4739 + strlen(sym->node->fullpath));
4740 + emit->align(etarget, sizeof(cell_t));
4741 + }
4742 +
4743 + emit->endnode(etarget, NULL);
4744 + }
4745 +
4746 + /* add the fixup nodes */
4747 + if (tree->fixups) {
4748 +
4749 + /* emit the external fixups */
4750 + emit->beginnode(etarget, NULL);
4751 + emit->string(etarget, "__fixups__", 0);
4752 + emit->align(etarget, sizeof(cell_t));
4753 +
4754 + for_each_fixup(tree, f) {
4755 +
4756 + namesz = 0;
4757 + for_each_fixup_entry(f, fe) {
4758 + fullpath = fe->node->fullpath;
4759 + if (fullpath[0] == '\0')
4760 + fullpath = "/";
4761 + namesz += strlen(fullpath) + 1;
4762 + namesz += strlen(fe->prop->name) + 1;
4763 + namesz += 32; /* space for :<number> + '\0' */
4764 + }
4765 +
4766 + name = xmalloc(namesz);
4767 +
4768 + s = name;
4769 + for_each_fixup_entry(f, fe) {
4770 + fullpath = fe->node->fullpath;
4771 + if (fullpath[0] == '\0')
4772 + fullpath = "/";
4773 + snprintf(s, name + namesz - s, "%s:%s:%d",
4774 + fullpath,
4775 + fe->prop->name, fe->offset);
4776 + s += strlen(s) + 1;
4777 + }
4778 +
4779 + nameoff = stringtable_insert(strbuf, f->ref);
4780 + vallen = s - name - 1;
4781 +
4782 + emit->property(etarget, NULL);
4783 + emit->cell(etarget, vallen + 1);
4784 + emit->cell(etarget, nameoff);
4785 +
4786 + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
4787 + emit->align(etarget, 8);
4788 +
4789 + emit->string(etarget, name, vallen);
4790 + emit->align(etarget, sizeof(cell_t));
4791 +
4792 + free(name);
4793 + }
4794 +
4795 + emit->endnode(etarget, tree->labels);
4796 + }
4797 +
4798 + /* add the local fixup property */
4799 + if (tree->local_fixups) {
4800 +
4801 + /* emit the external fixups */
4802 + emit->beginnode(etarget, NULL);
4803 + emit->string(etarget, "__local_fixups__", 0);
4804 + emit->align(etarget, sizeof(cell_t));
4805 +
4806 + namesz = 0;
4807 + for_each_local_fixup_entry(tree, fe) {
4808 + fullpath = fe->node->fullpath;
4809 + if (fullpath[0] == '\0')
4810 + fullpath = "/";
4811 + namesz += strlen(fullpath) + 1;
4812 + namesz += strlen(fe->prop->name) + 1;
4813 + namesz += 32; /* space for :<number> + '\0' */
4814 + }
4815 +
4816 + name = xmalloc(namesz);
4817 +
4818 + s = name;
4819 + for_each_local_fixup_entry(tree, fe) {
4820 + fullpath = fe->node->fullpath;
4821 + if (fullpath[0] == '\0')
4822 + fullpath = "/";
4823 + snprintf(s, name + namesz - s, "%s:%s:%d",
4824 + fullpath, fe->prop->name,
4825 + fe->offset);
4826 + s += strlen(s) + 1;
4827 + }
4828 +
4829 + nameoff = stringtable_insert(strbuf, "fixup");
4830 + vallen = s - name - 1;
4831 +
4832 + emit->property(etarget, NULL);
4833 + emit->cell(etarget, vallen + 1);
4834 + emit->cell(etarget, nameoff);
4835 +
4836 + if ((vi->flags & FTF_VARALIGN) && vallen >= 8)
4837 + emit->align(etarget, 8);
4838 +
4839 + emit->string(etarget, name, vallen);
4840 + emit->align(etarget, sizeof(cell_t));
4841 +
4842 + free(name);
4843 +
4844 + emit->endnode(etarget, tree->labels);
4845 + }
4846 +
4847 +no_symbols:
4848 emit->endnode(etarget, tree->labels);
4849 }
4850
4851 diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c
4852 index e464727..6e5878a 100644
4853 --- a/scripts/dtc/fstree.c
4854 +++ b/scripts/dtc/fstree.c
4855 @@ -37,26 +37,26 @@ static struct node *read_fstree(const char *dirname)
4856 tree = build_node(NULL, NULL);
4857
4858 while ((de = readdir(d)) != NULL) {
4859 - char *tmpnam;
4860 + char *tmpname;
4861
4862 if (streq(de->d_name, ".")
4863 || streq(de->d_name, ".."))
4864 continue;
4865
4866 - tmpnam = join_path(dirname, de->d_name);
4867 + tmpname = join_path(dirname, de->d_name);
4868
4869 - if (lstat(tmpnam, &st) < 0)
4870 - die("stat(%s): %s\n", tmpnam, strerror(errno));
4871 + if (lstat(tmpname, &st) < 0)
4872 + die("stat(%s): %s\n", tmpname, strerror(errno));
4873
4874 if (S_ISREG(st.st_mode)) {
4875 struct property *prop;
4876 FILE *pfile;
4877
4878 - pfile = fopen(tmpnam, "r");
4879 + pfile = fopen(tmpname, "rb");
4880 if (! pfile) {
4881 fprintf(stderr,
4882 "WARNING: Cannot open %s: %s\n",
4883 - tmpnam, strerror(errno));
4884 + tmpname, strerror(errno));
4885 } else {
4886 prop = build_property(xstrdup(de->d_name),
4887 data_copy_file(pfile,
4888 @@ -67,12 +67,12 @@ static struct node *read_fstree(const char *dirname)
4889 } else if (S_ISDIR(st.st_mode)) {
4890 struct node *newchild;
4891
4892 - newchild = read_fstree(tmpnam);
4893 + newchild = read_fstree(tmpname);
4894 newchild = name_node(newchild, xstrdup(de->d_name));
4895 add_child(tree, newchild);
4896 }
4897
4898 - free(tmpnam);
4899 + free(tmpname);
4900 }
4901
4902 closedir(d);
4903 diff --git a/scripts/dtc/livetree.c b/scripts/dtc/livetree.c
4904 index b61465f..e229b84 100644
4905 --- a/scripts/dtc/livetree.c
4906 +++ b/scripts/dtc/livetree.c
4907 @@ -511,7 +511,9 @@ struct node *get_node_by_phandle(struct node *tree, cell_t phandle)
4908
4909 struct node *get_node_by_ref(struct node *tree, const char *ref)
4910 {
4911 - if (ref[0] == '/')
4912 + if (streq(ref, "/"))
4913 + return tree;
4914 + else if (ref[0] == '/')
4915 return get_node_by_path(tree, ref);
4916 else
4917 return get_node_by_label(tree, ref);
4918 diff --git a/scripts/dtc/srcpos.c b/scripts/dtc/srcpos.c
4919 index c20bc53..f534c22 100644
4920 --- a/scripts/dtc/srcpos.c
4921 +++ b/scripts/dtc/srcpos.c
4922 @@ -34,7 +34,7 @@ struct search_path {
4923 static struct search_path *search_path_head, **search_path_tail;
4924
4925
4926 -static char *dirname(const char *path)
4927 +static char *get_dirname(const char *path)
4928 {
4929 const char *slash = strrchr(path, '/');
4930
4931 @@ -77,7 +77,7 @@ static char *try_open(const char *dirname, const char *fname, FILE **fp)
4932 else
4933 fullname = join_path(dirname, fname);
4934
4935 - *fp = fopen(fullname, "r");
4936 + *fp = fopen(fullname, "rb");
4937 if (!*fp) {
4938 free(fullname);
4939 fullname = NULL;
4940 @@ -150,7 +150,7 @@ void srcfile_push(const char *fname)
4941 srcfile = xmalloc(sizeof(*srcfile));
4942
4943 srcfile->f = srcfile_relative_open(fname, &srcfile->name);
4944 - srcfile->dir = dirname(srcfile->name);
4945 + srcfile->dir = get_dirname(srcfile->name);
4946 srcfile->prev = current_srcfile;
4947
4948 srcfile->lineno = 1;
4949 @@ -159,7 +159,7 @@ void srcfile_push(const char *fname)
4950 current_srcfile = srcfile;
4951 }
4952
4953 -int srcfile_pop(void)
4954 +bool srcfile_pop(void)
4955 {
4956 struct srcfile_state *srcfile = current_srcfile;
4957
4958 @@ -177,7 +177,7 @@ int srcfile_pop(void)
4959 * fix this we could either allocate all the files from a
4960 * table, or use a pool allocator. */
4961
4962 - return current_srcfile ? 1 : 0;
4963 + return current_srcfile ? true : false;
4964 }
4965
4966 void srcfile_add_search_path(const char *dirname)
4967 @@ -290,42 +290,27 @@ srcpos_string(struct srcpos *pos)
4968 return pos_str;
4969 }
4970
4971 -void
4972 -srcpos_verror(struct srcpos *pos, char const *fmt, va_list va)
4973 +void srcpos_verror(struct srcpos *pos, const char *prefix,
4974 + const char *fmt, va_list va)
4975 {
4976 - const char *srcstr;
4977 -
4978 - srcstr = srcpos_string(pos);
4979 + char *srcstr;
4980
4981 - fprintf(stderr, "Error: %s ", srcstr);
4982 - vfprintf(stderr, fmt, va);
4983 - fprintf(stderr, "\n");
4984 -}
4985 + srcstr = srcpos_string(pos);
4986
4987 -void
4988 -srcpos_error(struct srcpos *pos, char const *fmt, ...)
4989 -{
4990 - va_list va;
4991 + fprintf(stderr, "%s: %s ", prefix, srcstr);
4992 + vfprintf(stderr, fmt, va);
4993 + fprintf(stderr, "\n");
4994
4995 - va_start(va, fmt);
4996 - srcpos_verror(pos, fmt, va);
4997 - va_end(va);
4998 + free(srcstr);
4999 }
5000
5001 -
5002 -void
5003 -srcpos_warn(struct srcpos *pos, char const *fmt, ...)
5004 +void srcpos_error(struct srcpos *pos, const char *prefix,
5005 + const char *fmt, ...)
5006 {
5007 - const char *srcstr;
5008 va_list va;
5009 - va_start(va, fmt);
5010 -
5011 - srcstr = srcpos_string(pos);
5012 -
5013 - fprintf(stderr, "Warning: %s ", srcstr);
5014 - vfprintf(stderr, fmt, va);
5015 - fprintf(stderr, "\n");
5016
5017 + va_start(va, fmt);
5018 + srcpos_verror(pos, prefix, fmt, va);
5019 va_end(va);
5020 }
5021
5022 diff --git a/scripts/dtc/srcpos.h b/scripts/dtc/srcpos.h
5023 index 93a2712..f81827b 100644
5024 --- a/scripts/dtc/srcpos.h
5025 +++ b/scripts/dtc/srcpos.h
5026 @@ -21,6 +21,7 @@
5027 #define _SRCPOS_H_
5028
5029 #include <stdio.h>
5030 +#include <stdbool.h>
5031
5032 struct srcfile_state {
5033 FILE *f;
5034 @@ -55,7 +56,7 @@ extern struct srcfile_state *current_srcfile; /* = NULL */
5035 FILE *srcfile_relative_open(const char *fname, char **fullnamep);
5036
5037 void srcfile_push(const char *fname);
5038 -int srcfile_pop(void);
5039 +bool srcfile_pop(void);
5040
5041 /**
5042 * Add a new directory to the search path for input files
5043 @@ -106,12 +107,12 @@ extern struct srcpos *srcpos_copy(struct srcpos *pos);
5044 extern char *srcpos_string(struct srcpos *pos);
5045 extern void srcpos_dump(struct srcpos *pos);
5046
5047 -extern void srcpos_verror(struct srcpos *pos, char const *, va_list va)
5048 - __attribute__((format(printf, 2, 0)));
5049 -extern void srcpos_error(struct srcpos *pos, char const *, ...)
5050 - __attribute__((format(printf, 2, 3)));
5051 -extern void srcpos_warn(struct srcpos *pos, char const *, ...)
5052 - __attribute__((format(printf, 2, 3)));
5053 +extern void srcpos_verror(struct srcpos *pos, const char *prefix,
5054 + const char *fmt, va_list va)
5055 + __attribute__((format(printf, 3, 0)));
5056 +extern void srcpos_error(struct srcpos *pos, const char *prefix,
5057 + const char *fmt, ...)
5058 + __attribute__((format(printf, 3, 4)));
5059
5060 extern void srcpos_set_line(char *f, int l);
5061
5062 diff --git a/scripts/dtc/treesource.c b/scripts/dtc/treesource.c
5063 index 5740e69..a146f2d 100644
5064 --- a/scripts/dtc/treesource.c
5065 +++ b/scripts/dtc/treesource.c
5066 @@ -26,12 +26,12 @@ extern int yyparse(void);
5067 extern YYLTYPE yylloc;
5068
5069 struct boot_info *the_boot_info;
5070 -int treesource_error;
5071 +bool treesource_error;
5072
5073 struct boot_info *dt_from_source(const char *fname)
5074 {
5075 the_boot_info = NULL;
5076 - treesource_error = 0;
5077 + treesource_error = false;
5078
5079 srcfile_push(fname);
5080 yyin = current_srcfile->f;
5081 @@ -54,9 +54,9 @@ static void write_prefix(FILE *f, int level)
5082 fputc('\t', f);
5083 }
5084
5085 -static int isstring(char c)
5086 +static bool isstring(char c)
5087 {
5088 - return (isprint(c)
5089 + return (isprint((unsigned char)c)
5090 || (c == '\0')
5091 || strchr("\a\b\t\n\v\f\r", c));
5092 }
5093 @@ -109,7 +109,7 @@ static void write_propval_string(FILE *f, struct data val)
5094 break;
5095 case '\0':
5096 fprintf(f, "\", ");
5097 - while (m && (m->offset < i)) {
5098 + while (m && (m->offset <= (i + 1))) {
5099 if (m->type == LABEL) {
5100 assert(m->offset == (i+1));
5101 fprintf(f, "%s: ", m->ref);
5102 @@ -119,7 +119,7 @@ static void write_propval_string(FILE *f, struct data val)
5103 fprintf(f, "\"");
5104 break;
5105 default:
5106 - if (isprint(c))
5107 + if (isprint((unsigned char)c))
5108 fprintf(f, "%c", c);
5109 else
5110 fprintf(f, "\\x%02hhx", c);
5111 @@ -178,7 +178,7 @@ static void write_propval_bytes(FILE *f, struct data val)
5112 m = m->next;
5113 }
5114
5115 - fprintf(f, "%02hhx", *bp++);
5116 + fprintf(f, "%02hhx", (unsigned char)(*bp++));
5117 if ((const void *)bp >= propend)
5118 break;
5119 fprintf(f, " ");
5120 diff --git a/scripts/dtc/util.c b/scripts/dtc/util.c
5121 index 3055c16..9d65226 100644
5122 --- a/scripts/dtc/util.c
5123 +++ b/scripts/dtc/util.c
5124 @@ -39,11 +39,11 @@
5125 char *xstrdup(const char *s)
5126 {
5127 int len = strlen(s) + 1;
5128 - char *dup = xmalloc(len);
5129 + char *d = xmalloc(len);
5130
5131 - memcpy(dup, s, len);
5132 + memcpy(d, s, len);
5133
5134 - return dup;
5135 + return d;
5136 }
5137
5138 char *join_path(const char *path, const char *name)
5139 @@ -70,7 +70,7 @@ char *join_path(const char *path, const char *name)
5140 return str;
5141 }
5142
5143 -int util_is_printable_string(const void *data, int len)
5144 +bool util_is_printable_string(const void *data, int len)
5145 {
5146 const char *s = data;
5147 const char *ss, *se;
5148 @@ -87,7 +87,7 @@ int util_is_printable_string(const void *data, int len)
5149
5150 while (s < se) {
5151 ss = s;
5152 - while (s < se && *s && isprint(*s))
5153 + while (s < se && *s && isprint((unsigned char)*s))
5154 s++;
5155
5156 /* not zero, or not done yet */
5157 @@ -219,10 +219,6 @@ int utilfdt_read_err_len(const char *filename, char **buffp, off_t *len)
5158 if (offset == bufsize) {
5159 bufsize *= 2;
5160 buf = xrealloc(buf, bufsize);
5161 - if (!buf) {
5162 - ret = ENOMEM;
5163 - break;
5164 - }
5165 }
5166
5167 ret = read(fd, &buf[offset], bufsize - offset);
5168 @@ -375,9 +371,9 @@ void utilfdt_print_data(const char *data, int len)
5169 const uint32_t *cell = (const uint32_t *)data;
5170
5171 printf(" = <");
5172 - for (i = 0; i < len; i += 4)
5173 + for (i = 0, len /= 4; i < len; i++)
5174 printf("0x%08x%s", fdt32_to_cpu(cell[i]),
5175 - i < (len - 4) ? " " : "");
5176 + i < (len - 1) ? " " : "");
5177 printf(">");
5178 } else {
5179 printf(" = [");
5180 diff --git a/scripts/dtc/util.h b/scripts/dtc/util.h
5181 index 8f40b44..f800b60 100644
5182 --- a/scripts/dtc/util.h
5183 +++ b/scripts/dtc/util.h
5184 @@ -2,6 +2,7 @@
5185 #define _UTIL_H
5186
5187 #include <stdarg.h>
5188 +#include <stdbool.h>
5189 #include <getopt.h>
5190
5191 /*
5192 @@ -33,6 +34,7 @@ static inline void __attribute__((noreturn)) die(const char *str, ...)
5193 va_start(ap, str);
5194 fprintf(stderr, "FATAL ERROR: ");
5195 vfprintf(stderr, str, ap);
5196 + va_end(ap);
5197 exit(1);
5198 }
5199
5200 @@ -68,7 +70,7 @@ extern char *join_path(const char *path, const char *name);
5201 * @param len The string length including terminator
5202 * @return 1 if a valid printable string, 0 if not
5203 */
5204 -int util_is_printable_string(const void *data, int len);
5205 +bool util_is_printable_string(const void *data, int len);
5206
5207 /*
5208 * Parse an escaped character starting at index i in string s. The resulting
5209 diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h
5210 index 54d4e90..d644002 100644
5211 --- a/scripts/dtc/version_gen.h
5212 +++ b/scripts/dtc/version_gen.h
5213 @@ -1 +1 @@
5214 -#define DTC_VERSION "DTC 1.4.0-dirty"
5215 +#define DTC_VERSION "DTC 1.4.1-g36c70742"
5216 --
5217 1.8.3.2
5218