aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/dtc/dtc-parser.tab.c_shipped
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-09-28 17:25:59 -0400
committerRob Herring <rob.herring@calxeda.com>2012-10-01 12:11:35 -0400
commitcd296721a9645f9f28800a072490fa15458d1fb7 (patch)
tree492b9a268a48af07844fbbd39519f95676ee73fe /scripts/dtc/dtc-parser.tab.c_shipped
parentacc2097934b5403b97f95763fe99fc115b818061 (diff)
dtc: import latest upstream dtc
This updates scripts/dtc to commit 317a5d9 "dtc: zero out new label objects" from git://git.jdl.com/software/dtc.git. This adds features such as: * /bits/ syntax for cell data. * Math expressions within cell data. * The ability to delete properties or nodes. * Support for #line directives in the input file, which allows the use of cpp on *.dts. * -i command-line option (/include/ path) * -W/-E command-line options for error/warning control. * Removal of spew to STDOUT containing the filename being compiled. * Many additions to the libfdt API. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Jon Loeliger <jdl@jdl.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'scripts/dtc/dtc-parser.tab.c_shipped')
-rw-r--r--scripts/dtc/dtc-parser.tab.c_shipped780
1 files changed, 616 insertions, 164 deletions
diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped
index b05921e1e848..4af55900a15b 100644
--- a/scripts/dtc/dtc-parser.tab.c_shipped
+++ b/scripts/dtc/dtc-parser.tab.c_shipped
@@ -1,9 +1,10 @@
1/* A Bison parser, made by GNU Bison 2.4.3. */ 1
2/* A Bison parser, made by GNU Bison 2.4.1. */
2 3
3/* Skeleton implementation for Bison's Yacc-like parsers in C 4/* Skeleton implementation for Bison's Yacc-like parsers in C
4 5
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 2009, 2010 Free Software Foundation, Inc. 7 Free Software Foundation, Inc.
7 8
8 This program is free software: you can redistribute it and/or modify 9 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
@@ -45,7 +46,7 @@
45#define YYBISON 1 46#define YYBISON 1
46 47
47/* Bison version. */ 48/* Bison version. */
48#define YYBISON_VERSION "2.4.3" 49#define YYBISON_VERSION "2.4.1"
49 50
50/* Skeleton name. */ 51/* Skeleton name. */
51#define YYSKELETON_NAME "yacc.c" 52#define YYSKELETON_NAME "yacc.c"
@@ -66,6 +67,8 @@
66 67
67/* Copy the first part of user declarations. */ 68/* Copy the first part of user declarations. */
68 69
70/* Line 189 of yacc.c */
71#line 21 "dtc-parser.y"
69 72
70#include <stdio.h> 73#include <stdio.h>
71 74
@@ -82,12 +85,15 @@ extern struct boot_info *the_boot_info;
82extern int treesource_error; 85extern int treesource_error;
83 86
84static unsigned long long eval_literal(const char *s, int base, int bits); 87static unsigned long long eval_literal(const char *s, int base, int bits);
88static unsigned char eval_char_literal(const char *s);
85 89
86 90
91/* Line 189 of yacc.c */
92#line 93 "dtc-parser.tab.c"
87 93
88/* Enabling traces. */ 94/* Enabling traces. */
89#ifndef YYDEBUG 95#ifndef YYDEBUG
90# define YYDEBUG 1 96# define YYDEBUG 0
91#endif 97#endif
92 98
93/* Enabling verbose error messages. */ 99/* Enabling verbose error messages. */
@@ -112,14 +118,26 @@ static unsigned long long eval_literal(const char *s, int base, int bits);
112 enum yytokentype { 118 enum yytokentype {
113 DT_V1 = 258, 119 DT_V1 = 258,
114 DT_MEMRESERVE = 259, 120 DT_MEMRESERVE = 259,
115 DT_PROPNODENAME = 260, 121 DT_LSHIFT = 260,
116 DT_LITERAL = 261, 122 DT_RSHIFT = 261,
117 DT_BASE = 262, 123 DT_LE = 262,
118 DT_BYTE = 263, 124 DT_GE = 263,
119 DT_STRING = 264, 125 DT_EQ = 264,
120 DT_LABEL = 265, 126 DT_NE = 265,
121 DT_REF = 266, 127 DT_AND = 266,
122 DT_INCBIN = 267 128 DT_OR = 267,
129 DT_BITS = 268,
130 DT_DEL_PROP = 269,
131 DT_DEL_NODE = 270,
132 DT_PROPNODENAME = 271,
133 DT_LITERAL = 272,
134 DT_CHAR_LITERAL = 273,
135 DT_BASE = 274,
136 DT_BYTE = 275,
137 DT_STRING = 276,
138 DT_LABEL = 277,
139 DT_REF = 278,
140 DT_INCBIN = 279
123 }; 141 };
124#endif 142#endif
125 143
@@ -129,6 +147,8 @@ static unsigned long long eval_literal(const char *s, int base, int bits);
129typedef union YYSTYPE 147typedef union YYSTYPE
130{ 148{
131 149
150/* Line 214 of yacc.c */
151#line 40 "dtc-parser.y"
132 152
133 char *propnodename; 153 char *propnodename;
134 char *literal; 154 char *literal;
@@ -137,16 +157,22 @@ typedef union YYSTYPE
137 uint8_t byte; 157 uint8_t byte;
138 struct data data; 158 struct data data;
139 159
140 uint64_t addr; 160 struct {
141 cell_t cell; 161 struct data data;
162 int bits;
163 } array;
164
142 struct property *prop; 165 struct property *prop;
143 struct property *proplist; 166 struct property *proplist;
144 struct node *node; 167 struct node *node;
145 struct node *nodelist; 168 struct node *nodelist;
146 struct reserve_info *re; 169 struct reserve_info *re;
170 uint64_t integer;
147 171
148 172
149 173
174/* Line 214 of yacc.c */
175#line 176 "dtc-parser.tab.c"
150} YYSTYPE; 176} YYSTYPE;
151# define YYSTYPE_IS_TRIVIAL 1 177# define YYSTYPE_IS_TRIVIAL 1
152# define yystype YYSTYPE /* obsolescent; will be withdrawn */ 178# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -157,6 +183,8 @@ typedef union YYSTYPE
157/* Copy the second part of user declarations. */ 183/* Copy the second part of user declarations. */
158 184
159 185
186/* Line 264 of yacc.c */
187#line 188 "dtc-parser.tab.c"
160 188
161#ifdef short 189#ifdef short
162# undef short 190# undef short
@@ -206,7 +234,7 @@ typedef short int yytype_int16;
206#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 234#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
207 235
208#ifndef YY_ 236#ifndef YY_
209# if defined YYENABLE_NLS && YYENABLE_NLS 237# if YYENABLE_NLS
210# if ENABLE_NLS 238# if ENABLE_NLS
211# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 239# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
212# define YY_(msgid) dgettext ("bison-runtime", msgid) 240# define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -371,20 +399,20 @@ union yyalloc
371/* YYFINAL -- State number of the termination state. */ 399/* YYFINAL -- State number of the termination state. */
372#define YYFINAL 4 400#define YYFINAL 4
373/* YYLAST -- Last index in YYTABLE. */ 401/* YYLAST -- Last index in YYTABLE. */
374#define YYLAST 56 402#define YYLAST 133
375 403
376/* YYNTOKENS -- Number of terminals. */ 404/* YYNTOKENS -- Number of terminals. */
377#define YYNTOKENS 25 405#define YYNTOKENS 48
378/* YYNNTS -- Number of nonterminals. */ 406/* YYNNTS -- Number of nonterminals. */
379#define YYNNTS 16 407#define YYNNTS 28
380/* YYNRULES -- Number of rules. */ 408/* YYNRULES -- Number of rules. */
381#define YYNRULES 39 409#define YYNRULES 79
382/* YYNRULES -- Number of states. */ 410/* YYNRULES -- Number of states. */
383#define YYNSTATES 67 411#define YYNSTATES 141
384 412
385/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 413/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
386#define YYUNDEFTOK 2 414#define YYUNDEFTOK 2
387#define YYMAXUTOK 267 415#define YYMAXUTOK 279
388 416
389#define YYTRANSLATE(YYX) \ 417#define YYTRANSLATE(YYX) \
390 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 418 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -395,16 +423,16 @@ static const yytype_uint8 yytranslate[] =
395 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 423 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 426 2, 2, 2, 47, 2, 2, 2, 45, 41, 2,
399 22, 24, 2, 2, 23, 2, 2, 14, 2, 2, 427 33, 35, 44, 42, 34, 43, 2, 26, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 428 2, 2, 2, 2, 2, 2, 2, 2, 38, 25,
401 18, 17, 19, 2, 2, 2, 2, 2, 2, 2, 429 36, 29, 30, 37, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 20, 2, 21, 2, 2, 2, 2, 2, 2, 432 2, 31, 2, 32, 40, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 15, 2, 16, 2, 2, 2, 2, 435 2, 2, 2, 27, 39, 28, 46, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -418,45 +446,68 @@ static const yytype_uint8 yytranslate[] =
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 448 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
421 5, 6, 7, 8, 9, 10, 11, 12 449 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
450 15, 16, 17, 18, 19, 20, 21, 22, 23, 24
422}; 451};
423 452
424#if YYDEBUG 453#if YYDEBUG
425/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 454/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
426 YYRHS. */ 455 YYRHS. */
427static const yytype_uint8 yyprhs[] = 456static const yytype_uint16 yyprhs[] =
428{ 457{
429 0, 0, 3, 8, 9, 12, 17, 20, 22, 25, 458 0, 0, 3, 8, 9, 12, 17, 20, 23, 27,
430 29, 33, 39, 40, 43, 48, 51, 54, 57, 62, 459 31, 36, 42, 43, 46, 51, 54, 58, 61, 64,
431 67, 70, 80, 86, 89, 90, 93, 96, 97, 100, 460 68, 73, 76, 86, 92, 95, 96, 99, 102, 106,
432 103, 106, 108, 109, 112, 115, 116, 119, 122, 125 461 108, 111, 114, 117, 119, 121, 125, 127, 129, 135,
462 137, 141, 143, 147, 149, 153, 155, 159, 161, 165,
463 167, 171, 175, 177, 181, 185, 189, 193, 197, 201,
464 203, 207, 211, 213, 217, 221, 225, 227, 229, 232,
465 235, 238, 239, 242, 245, 246, 249, 252, 255, 259
433}; 466};
434 467
435/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 468/* YYRHS -- A `-1'-separated list of the rules' RHS. */
436static const yytype_int8 yyrhs[] = 469static const yytype_int8 yyrhs[] =
437{ 470{
438 26, 0, -1, 3, 13, 27, 30, -1, -1, 28, 471 49, 0, -1, 3, 25, 50, 52, -1, -1, 51,
439 27, -1, 4, 29, 29, 13, -1, 10, 28, -1, 472 50, -1, 4, 59, 59, 25, -1, 22, 51, -1,
440 6, -1, 14, 31, -1, 30, 14, 31, -1, 30, 473 26, 53, -1, 52, 26, 53, -1, 52, 23, 53,
441 11, 31, -1, 15, 32, 39, 16, 13, -1, -1, 474 -1, 52, 15, 23, 25, -1, 27, 54, 74, 28,
442 32, 33, -1, 5, 17, 34, 13, -1, 5, 13, 475 25, -1, -1, 54, 55, -1, 16, 29, 56, 25,
443 -1, 10, 33, -1, 35, 9, -1, 35, 18, 36, 476 -1, 16, 25, -1, 14, 16, 25, -1, 22, 55,
444 19, -1, 35, 20, 38, 21, -1, 35, 11, -1, 477 -1, 57, 21, -1, 57, 58, 30, -1, 57, 31,
445 35, 12, 22, 9, 23, 29, 23, 29, 24, -1, 478 73, 32, -1, 57, 23, -1, 57, 24, 33, 21,
446 35, 12, 22, 9, 24, -1, 34, 10, -1, -1, 479 34, 59, 34, 59, 35, -1, 57, 24, 33, 21,
447 34, 23, -1, 35, 10, -1, -1, 36, 37, -1, 480 35, -1, 56, 22, -1, -1, 56, 34, -1, 57,
448 36, 11, -1, 36, 10, -1, 6, -1, -1, 38, 481 22, -1, 13, 17, 36, -1, 36, -1, 58, 59,
449 8, -1, 38, 10, -1, -1, 40, 39, -1, 40, 482 -1, 58, 23, -1, 58, 22, -1, 17, -1, 18,
450 33, -1, 5, 31, -1, 10, 40, -1 483 -1, 33, 60, 35, -1, 61, -1, 62, -1, 62,
484 37, 60, 38, 61, -1, 63, -1, 62, 12, 63,
485 -1, 64, -1, 63, 11, 64, -1, 65, -1, 64,
486 39, 65, -1, 66, -1, 65, 40, 66, -1, 67,
487 -1, 66, 41, 67, -1, 68, -1, 67, 9, 68,
488 -1, 67, 10, 68, -1, 69, -1, 68, 36, 69,
489 -1, 68, 30, 69, -1, 68, 7, 69, -1, 68,
490 8, 69, -1, 69, 5, 70, -1, 69, 6, 70,
491 -1, 70, -1, 70, 42, 71, -1, 70, 43, 71,
492 -1, 71, -1, 71, 44, 72, -1, 71, 26, 72,
493 -1, 71, 45, 72, -1, 72, -1, 59, -1, 43,
494 72, -1, 46, 72, -1, 47, 72, -1, -1, 73,
495 20, -1, 73, 22, -1, -1, 75, 74, -1, 75,
496 55, -1, 16, 53, -1, 15, 16, 25, -1, 22,
497 75, -1
451}; 498};
452 499
453/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 500/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
454static const yytype_uint16 yyrline[] = 501static const yytype_uint16 yyrline[] =
455{ 502{
456 0, 86, 86, 95, 98, 105, 109, 117, 124, 128, 503 0, 109, 109, 118, 121, 128, 132, 140, 144, 148,
457 132, 145, 153, 156, 163, 167, 171, 179, 183, 187, 504 158, 172, 180, 183, 190, 194, 198, 202, 210, 214,
458 191, 195, 212, 222, 230, 233, 237, 245, 248, 252, 505 218, 222, 226, 243, 253, 261, 264, 268, 275, 290,
459 257, 264, 272, 275, 279, 287, 290, 294, 302, 306 506 295, 315, 329, 336, 340, 344, 351, 355, 356, 360,
507 361, 365, 366, 370, 371, 375, 376, 380, 381, 385,
508 386, 387, 391, 392, 393, 394, 395, 399, 400, 401,
509 405, 406, 407, 411, 412, 413, 414, 418, 419, 420,
510 421, 426, 429, 433, 441, 444, 448, 456, 460, 464
460}; 511};
461#endif 512#endif
462 513
@@ -465,13 +516,19 @@ static const yytype_uint16 yyrline[] =
465 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 516 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
466static const char *const yytname[] = 517static const char *const yytname[] =
467{ 518{
468 "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", 519 "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT",
469 "DT_PROPNODENAME", "DT_LITERAL", "DT_BASE", "DT_BYTE", "DT_STRING", 520 "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR",
470 "DT_LABEL", "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", 521 "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL",
471 "'<'", "'>'", "'['", "']'", "'('", "','", "')'", "$accept", "sourcefile", 522 "DT_CHAR_LITERAL", "DT_BASE", "DT_BYTE", "DT_STRING", "DT_LABEL",
472 "memreserves", "memreserve", "addr", "devicetree", "nodedef", "proplist", 523 "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['",
473 "propdef", "propdata", "propdataprefix", "celllist", "cellval", 524 "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'",
474 "bytestring", "subnodes", "subnode", 0 525 "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile",
526 "memreserves", "memreserve", "devicetree", "nodedef", "proplist",
527 "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim",
528 "integer_expr", "integer_trinary", "integer_or", "integer_and",
529 "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq",
530 "integer_rela", "integer_shift", "integer_add", "integer_mul",
531 "integer_unary", "bytestring", "subnodes", "subnode", 0
475}; 532};
476#endif 533#endif
477 534
@@ -481,27 +538,37 @@ static const char *const yytname[] =
481static const yytype_uint16 yytoknum[] = 538static const yytype_uint16 yytoknum[] =
482{ 539{
483 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 540 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
484 265, 266, 267, 59, 47, 123, 125, 61, 60, 62, 541 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
485 91, 93, 40, 44, 41 542 275, 276, 277, 278, 279, 59, 47, 123, 125, 61,
543 62, 91, 93, 40, 44, 41, 60, 63, 58, 124,
544 94, 38, 43, 45, 42, 37, 126, 33
486}; 545};
487# endif 546# endif
488 547
489/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 548/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
490static const yytype_uint8 yyr1[] = 549static const yytype_uint8 yyr1[] =
491{ 550{
492 0, 25, 26, 27, 27, 28, 28, 29, 30, 30, 551 0, 48, 49, 50, 50, 51, 51, 52, 52, 52,
493 30, 31, 32, 32, 33, 33, 33, 34, 34, 34, 552 52, 53, 54, 54, 55, 55, 55, 55, 56, 56,
494 34, 34, 34, 34, 35, 35, 35, 36, 36, 36, 553 56, 56, 56, 56, 56, 57, 57, 57, 58, 58,
495 36, 37, 38, 38, 38, 39, 39, 39, 40, 40 554 58, 58, 58, 59, 59, 59, 60, 61, 61, 62,
555 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
556 67, 67, 68, 68, 68, 68, 68, 69, 69, 69,
557 70, 70, 70, 71, 71, 71, 71, 72, 72, 72,
558 72, 73, 73, 73, 74, 74, 74, 75, 75, 75
496}; 559};
497 560
498/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 561/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
499static const yytype_uint8 yyr2[] = 562static const yytype_uint8 yyr2[] =
500{ 563{
501 0, 2, 4, 0, 2, 4, 2, 1, 2, 3, 564 0, 2, 4, 0, 2, 4, 2, 2, 3, 3,
502 3, 5, 0, 2, 4, 2, 2, 2, 4, 4, 565 4, 5, 0, 2, 4, 2, 3, 2, 2, 3,
503 2, 9, 5, 2, 0, 2, 2, 0, 2, 2, 566 4, 2, 9, 5, 2, 0, 2, 2, 3, 1,
504 2, 1, 0, 2, 2, 0, 2, 2, 2, 2 567 2, 2, 2, 1, 1, 3, 1, 1, 5, 1,
568 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
569 3, 3, 1, 3, 3, 3, 3, 3, 3, 1,
570 3, 3, 1, 3, 3, 3, 1, 1, 2, 2,
571 2, 0, 2, 2, 0, 2, 2, 2, 3, 2
505}; 572};
506 573
507/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 574/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -509,41 +576,59 @@ static const yytype_uint8 yyr2[] =
509 means the default is an error. */ 576 means the default is an error. */
510static const yytype_uint8 yydefact[] = 577static const yytype_uint8 yydefact[] =
511{ 578{
512 0, 0, 0, 3, 1, 0, 0, 0, 3, 7, 579 0, 0, 0, 3, 1, 0, 0, 0, 3, 33,
513 0, 6, 0, 2, 4, 0, 12, 8, 0, 0, 580 34, 0, 0, 6, 0, 2, 4, 0, 0, 0,
514 5, 35, 10, 9, 0, 0, 13, 0, 35, 15, 581 67, 0, 36, 37, 39, 41, 43, 45, 47, 49,
515 24, 38, 16, 39, 0, 37, 36, 0, 0, 11, 582 52, 59, 62, 66, 0, 12, 7, 0, 0, 0,
516 23, 14, 25, 17, 26, 20, 0, 27, 32, 0, 583 68, 69, 70, 35, 0, 0, 0, 0, 0, 0,
517 0, 0, 0, 31, 30, 29, 18, 28, 33, 34, 584 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
518 19, 0, 22, 0, 0, 0, 21 585 0, 0, 0, 5, 74, 0, 9, 8, 40, 0,
586 42, 44, 46, 48, 50, 51, 55, 56, 54, 53,
587 57, 58, 60, 61, 64, 63, 65, 0, 0, 0,
588 0, 13, 0, 74, 10, 0, 0, 0, 15, 25,
589 77, 17, 79, 0, 76, 75, 38, 16, 78, 0,
590 0, 11, 24, 14, 26, 0, 18, 27, 21, 0,
591 71, 29, 0, 0, 0, 0, 32, 31, 19, 30,
592 28, 0, 72, 73, 20, 0, 23, 0, 0, 0,
593 22
519}; 594};
520 595
521/* YYDEFGOTO[NTERM-NUM]. */ 596/* YYDEFGOTO[NTERM-NUM]. */
522static const yytype_int8 yydefgoto[] = 597static const yytype_int8 yydefgoto[] =
523{ 598{
524 -1, 2, 7, 8, 10, 13, 17, 21, 26, 37, 599 -1, 2, 7, 8, 15, 36, 64, 91, 109, 110,
525 38, 50, 57, 51, 27, 28 600 122, 20, 21, 22, 23, 24, 25, 26, 27, 28,
601 29, 30, 31, 32, 33, 125, 92, 93
526}; 602};
527 603
528/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 604/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
529 STATE-NUM. */ 605 STATE-NUM. */
530#define YYPACT_NINF -12 606#define YYPACT_NINF -78
531static const yytype_int8 yypact[] = 607static const yytype_int8 yypact[] =
532{ 608{
533 10, -11, 18, -1, -12, 22, -1, 15, -1, -12, 609 22, 11, 51, 10, -78, 23, 10, 2, 10, -78,
534 22, -12, 20, 1, -12, 17, -12, -12, 20, 20, 610 -78, -9, 23, -78, 30, 38, -78, -9, -9, -9,
535 -12, 6, -12, -12, 21, 6, -12, 23, 6, -12, 611 -78, 35, -78, -6, 52, 29, 48, 49, 33, 3,
536 -12, -12, -12, -12, 28, -12, -12, -6, 13, -12, 612 71, 36, 0, -78, 64, -78, -78, 68, 30, 30,
537 -12, -12, -12, -12, -12, -12, 24, -12, -12, 33, 613 -78, -78, -78, -78, -9, -9, -9, -9, -9, -9,
538 -5, 0, -4, -12, -12, -12, -12, -12, -12, -12, 614 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
539 -12, 22, -12, 25, 22, 19, -12 615 -9, -9, -9, -78, 44, 67, -78, -78, 52, 55,
616 29, 48, 49, 33, 3, 3, 71, 71, 71, 71,
617 36, 36, 0, 0, -78, -78, -78, 78, 79, 42,
618 44, -78, 69, 44, -78, -9, 73, 74, -78, -78,
619 -78, -78, -78, 75, -78, -78, -78, -78, -78, -7,
620 -1, -78, -78, -78, -78, 84, -78, -78, -78, 63,
621 -78, -78, 32, 66, 82, -3, -78, -78, -78, -78,
622 -78, 46, -78, -78, -78, 23, -78, 70, 23, 72,
623 -78
540}; 624};
541 625
542/* YYPGOTO[NTERM-NUM]. */ 626/* YYPGOTO[NTERM-NUM]. */
543static const yytype_int8 yypgoto[] = 627static const yytype_int8 yypgoto[] =
544{ 628{
545 -12, -12, 36, 39, -10, -12, 8, -12, 12, -12, 629 -78, -78, 97, 100, -78, -37, -78, -77, -78, -78,
546 -12, -12, -12, -12, 27, 31 630 -78, -5, 65, 13, -78, 76, 77, 62, 80, 83,
631 34, 20, 26, 28, -14, -78, 18, 24
547}; 632};
548 633
549/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 634/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -553,35 +638,59 @@ static const yytype_int8 yypgoto[] =
553#define YYTABLE_NINF -1 638#define YYTABLE_NINF -1
554static const yytype_uint8 yytable[] = 639static const yytype_uint8 yytable[] =
555{ 640{
556 15, 53, 3, 5, 40, 54, 55, 41, 58, 6, 641 12, 66, 67, 40, 41, 42, 44, 34, 9, 10,
557 59, 24, 18, 1, 56, 19, 25, 42, 4, 61, 642 52, 53, 115, 101, 5, 112, 104, 132, 113, 133,
558 62, 60, 43, 44, 45, 46, 22, 23, 9, 12, 643 116, 117, 118, 119, 11, 1, 60, 114, 14, 134,
559 20, 47, 31, 48, 29, 16, 16, 32, 30, 34, 644 120, 45, 6, 54, 17, 121, 3, 18, 19, 55,
560 35, 39, 52, 66, 14, 11, 49, 0, 64, 0, 645 9, 10, 50, 51, 61, 62, 84, 85, 86, 9,
561 0, 63, 0, 0, 65, 36, 33 646 10, 4, 100, 37, 126, 127, 11, 35, 87, 88,
647 89, 38, 128, 46, 39, 11, 90, 98, 47, 35,
648 43, 99, 76, 77, 78, 79, 56, 57, 58, 59,
649 135, 136, 80, 81, 74, 75, 82, 83, 48, 63,
650 49, 65, 94, 95, 96, 97, 124, 103, 107, 108,
651 111, 123, 130, 131, 138, 16, 13, 140, 106, 71,
652 69, 105, 0, 0, 102, 0, 0, 129, 0, 0,
653 68, 0, 0, 70, 0, 0, 0, 0, 72, 0,
654 137, 0, 73, 139
562}; 655};
563 656
564static const yytype_int8 yycheck[] = 657static const yytype_int16 yycheck[] =
565{ 658{
566 10, 6, 13, 4, 10, 10, 11, 13, 8, 10, 659 5, 38, 39, 17, 18, 19, 12, 12, 17, 18,
567 10, 5, 11, 3, 19, 14, 10, 23, 0, 23, 660 7, 8, 13, 90, 4, 22, 93, 20, 25, 22,
568 24, 21, 9, 10, 11, 12, 18, 19, 6, 14, 661 21, 22, 23, 24, 33, 3, 26, 34, 26, 32,
569 13, 18, 24, 20, 13, 15, 15, 25, 17, 16, 662 31, 37, 22, 30, 43, 36, 25, 46, 47, 36,
570 28, 13, 9, 24, 8, 6, 22, -1, 23, -1, 663 17, 18, 9, 10, 44, 45, 60, 61, 62, 17,
571 -1, 61, -1, -1, 64, 28, 25 664 18, 0, 89, 15, 22, 23, 33, 27, 14, 15,
665 16, 23, 30, 11, 26, 33, 22, 25, 39, 27,
666 35, 29, 52, 53, 54, 55, 5, 6, 42, 43,
667 34, 35, 56, 57, 50, 51, 58, 59, 40, 25,
668 41, 23, 25, 38, 16, 16, 33, 28, 25, 25,
669 25, 17, 36, 21, 34, 8, 6, 35, 95, 47,
670 45, 93, -1, -1, 90, -1, -1, 122, -1, -1,
671 44, -1, -1, 46, -1, -1, -1, -1, 48, -1,
672 135, -1, 49, 138
572}; 673};
573 674
574/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 675/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
575 symbol of state STATE-NUM. */ 676 symbol of state STATE-NUM. */
576static const yytype_uint8 yystos[] = 677static const yytype_uint8 yystos[] =
577{ 678{
578 0, 3, 26, 13, 0, 4, 10, 27, 28, 6, 679 0, 3, 49, 25, 0, 4, 22, 50, 51, 17,
579 29, 28, 14, 30, 27, 29, 15, 31, 11, 14, 680 18, 33, 59, 51, 26, 52, 50, 43, 46, 47,
580 13, 32, 31, 31, 5, 10, 33, 39, 40, 13, 681 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
581 17, 31, 33, 40, 16, 33, 39, 34, 35, 13, 682 69, 70, 71, 72, 59, 27, 53, 15, 23, 26,
582 10, 13, 23, 9, 10, 11, 12, 18, 20, 22, 683 72, 72, 72, 35, 12, 37, 11, 39, 40, 41,
583 36, 38, 9, 6, 10, 11, 19, 37, 8, 10, 684 9, 10, 7, 8, 30, 36, 5, 6, 42, 43,
584 21, 23, 24, 29, 23, 29, 24 685 26, 44, 45, 25, 54, 23, 53, 53, 63, 60,
686 64, 65, 66, 67, 68, 68, 69, 69, 69, 69,
687 70, 70, 71, 71, 72, 72, 72, 14, 15, 16,
688 22, 55, 74, 75, 25, 38, 16, 16, 25, 29,
689 53, 55, 75, 28, 55, 74, 61, 25, 25, 56,
690 57, 25, 22, 25, 34, 13, 21, 22, 23, 24,
691 31, 36, 58, 17, 33, 73, 22, 23, 30, 59,
692 36, 21, 20, 22, 32, 34, 35, 59, 34, 59,
693 35
585}; 694};
586 695
587#define yyerrok (yyerrstatus = 0) 696#define yyerrok (yyerrstatus = 0)
@@ -596,18 +705,9 @@ static const yytype_uint8 yystos[] =
596 705
597/* Like YYERROR except do call yyerror. This remains here temporarily 706/* Like YYERROR except do call yyerror. This remains here temporarily
598 to ease the transition to the new meaning of YYERROR, for GCC. 707 to ease the transition to the new meaning of YYERROR, for GCC.
599 Once GCC version 2 has supplanted version 1, this can go. However, 708 Once GCC version 2 has supplanted version 1, this can go. */
600 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
601 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
602 discussed. */
603 709
604#define YYFAIL goto yyerrlab 710#define YYFAIL goto yyerrlab
605#if defined YYFAIL
606 /* This is here to suppress warnings from the GCC cpp's
607 -Wunused-macros. Normally we don't worry about that warning, but
608 some users do, and we want to make it easy for users to remove
609 YYFAIL uses, which will produce warnings from Bison 2.5. */
610#endif
611 711
612#define YYRECOVERING() (!!yyerrstatus) 712#define YYRECOVERING() (!!yyerrstatus)
613 713
@@ -664,7 +764,7 @@ while (YYID (0))
664 we won't break user code: when these are the locations we know. */ 764 we won't break user code: when these are the locations we know. */
665 765
666#ifndef YY_LOCATION_PRINT 766#ifndef YY_LOCATION_PRINT
667# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL 767# if YYLTYPE_IS_TRIVIAL
668# define YY_LOCATION_PRINT(File, Loc) \ 768# define YY_LOCATION_PRINT(File, Loc) \
669 fprintf (File, "%d.%d-%d.%d", \ 769 fprintf (File, "%d.%d-%d.%d", \
670 (Loc).first_line, (Loc).first_column, \ 770 (Loc).first_line, (Loc).first_column, \
@@ -1403,6 +1503,8 @@ yyreduce:
1403 { 1503 {
1404 case 2: 1504 case 2:
1405 1505
1506/* Line 1455 of yacc.c */
1507#line 110 "dtc-parser.y"
1406 { 1508 {
1407 the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), 1509 the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node),
1408 guess_boot_cpuid((yyvsp[(4) - (4)].node))); 1510 guess_boot_cpuid((yyvsp[(4) - (4)].node)));
@@ -1411,6 +1513,8 @@ yyreduce:
1411 1513
1412 case 3: 1514 case 3:
1413 1515
1516/* Line 1455 of yacc.c */
1517#line 118 "dtc-parser.y"
1414 { 1518 {
1415 (yyval.re) = NULL; 1519 (yyval.re) = NULL;
1416 ;} 1520 ;}
@@ -1418,6 +1522,8 @@ yyreduce:
1418 1522
1419 case 4: 1523 case 4:
1420 1524
1525/* Line 1455 of yacc.c */
1526#line 122 "dtc-parser.y"
1421 { 1527 {
1422 (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); 1528 (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
1423 ;} 1529 ;}
@@ -1425,13 +1531,17 @@ yyreduce:
1425 1531
1426 case 5: 1532 case 5:
1427 1533
1534/* Line 1455 of yacc.c */
1535#line 129 "dtc-parser.y"
1428 { 1536 {
1429 (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].addr), (yyvsp[(3) - (4)].addr)); 1537 (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer));
1430 ;} 1538 ;}
1431 break; 1539 break;
1432 1540
1433 case 6: 1541 case 6:
1434 1542
1543/* Line 1455 of yacc.c */
1544#line 133 "dtc-parser.y"
1435 { 1545 {
1436 add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref)); 1546 add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref));
1437 (yyval.re) = (yyvsp[(2) - (2)].re); 1547 (yyval.re) = (yyvsp[(2) - (2)].re);
@@ -1440,40 +1550,57 @@ yyreduce:
1440 1550
1441 case 7: 1551 case 7:
1442 1552
1553/* Line 1455 of yacc.c */
1554#line 141 "dtc-parser.y"
1443 { 1555 {
1444 (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64); 1556 (yyval.node) = name_node((yyvsp[(2) - (2)].node), "");
1445 ;} 1557 ;}
1446 break; 1558 break;
1447 1559
1448 case 8: 1560 case 8:
1449 1561
1562/* Line 1455 of yacc.c */
1563#line 145 "dtc-parser.y"
1450 { 1564 {
1451 (yyval.node) = name_node((yyvsp[(2) - (2)].node), ""); 1565 (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
1452 ;} 1566 ;}
1453 break; 1567 break;
1454 1568
1455 case 9: 1569 case 9:
1456 1570
1571/* Line 1455 of yacc.c */
1572#line 149 "dtc-parser.y"
1457 { 1573 {
1458 (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); 1574 struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref));
1575
1576 if (target)
1577 merge_nodes(target, (yyvsp[(3) - (3)].node));
1578 else
1579 print_error("label or path, '%s', not found", (yyvsp[(2) - (3)].labelref));
1580 (yyval.node) = (yyvsp[(1) - (3)].node);
1459 ;} 1581 ;}
1460 break; 1582 break;
1461 1583
1462 case 10: 1584 case 10:
1463 1585
1586/* Line 1455 of yacc.c */
1587#line 159 "dtc-parser.y"
1464 { 1588 {
1465 struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref)); 1589 struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref));
1466 1590
1467 if (target) 1591 if (!target)
1468 merge_nodes(target, (yyvsp[(3) - (3)].node)); 1592 print_error("label or path, '%s', not found", (yyvsp[(3) - (4)].labelref));
1469 else 1593 else
1470 print_error("label or path, '%s', not found", (yyvsp[(2) - (3)].labelref)); 1594 delete_node(target);
1471 (yyval.node) = (yyvsp[(1) - (3)].node); 1595
1596 (yyval.node) = (yyvsp[(1) - (4)].node);
1472 ;} 1597 ;}
1473 break; 1598 break;
1474 1599
1475 case 11: 1600 case 11:
1476 1601
1602/* Line 1455 of yacc.c */
1603#line 173 "dtc-parser.y"
1477 { 1604 {
1478 (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); 1605 (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist));
1479 ;} 1606 ;}
@@ -1481,6 +1608,8 @@ yyreduce:
1481 1608
1482 case 12: 1609 case 12:
1483 1610
1611/* Line 1455 of yacc.c */
1612#line 180 "dtc-parser.y"
1484 { 1613 {
1485 (yyval.proplist) = NULL; 1614 (yyval.proplist) = NULL;
1486 ;} 1615 ;}
@@ -1488,6 +1617,8 @@ yyreduce:
1488 1617
1489 case 13: 1618 case 13:
1490 1619
1620/* Line 1455 of yacc.c */
1621#line 184 "dtc-parser.y"
1491 { 1622 {
1492 (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); 1623 (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist));
1493 ;} 1624 ;}
@@ -1495,6 +1626,8 @@ yyreduce:
1495 1626
1496 case 14: 1627 case 14:
1497 1628
1629/* Line 1455 of yacc.c */
1630#line 191 "dtc-parser.y"
1498 { 1631 {
1499 (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data)); 1632 (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data));
1500 ;} 1633 ;}
@@ -1502,6 +1635,8 @@ yyreduce:
1502 1635
1503 case 15: 1636 case 15:
1504 1637
1638/* Line 1455 of yacc.c */
1639#line 195 "dtc-parser.y"
1505 { 1640 {
1506 (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data); 1641 (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data);
1507 ;} 1642 ;}
@@ -1509,62 +1644,85 @@ yyreduce:
1509 1644
1510 case 16: 1645 case 16:
1511 1646
1647/* Line 1455 of yacc.c */
1648#line 199 "dtc-parser.y"
1512 { 1649 {
1513 add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref)); 1650 (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename));
1514 (yyval.prop) = (yyvsp[(2) - (2)].prop);
1515 ;} 1651 ;}
1516 break; 1652 break;
1517 1653
1518 case 17: 1654 case 17:
1519 1655
1656/* Line 1455 of yacc.c */
1657#line 203 "dtc-parser.y"
1520 { 1658 {
1521 (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); 1659 add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref));
1660 (yyval.prop) = (yyvsp[(2) - (2)].prop);
1522 ;} 1661 ;}
1523 break; 1662 break;
1524 1663
1525 case 18: 1664 case 18:
1526 1665
1666/* Line 1455 of yacc.c */
1667#line 211 "dtc-parser.y"
1527 { 1668 {
1528 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); 1669 (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data));
1529 ;} 1670 ;}
1530 break; 1671 break;
1531 1672
1532 case 19: 1673 case 19:
1533 1674
1675/* Line 1455 of yacc.c */
1676#line 215 "dtc-parser.y"
1534 { 1677 {
1535 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); 1678 (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data);
1536 ;} 1679 ;}
1537 break; 1680 break;
1538 1681
1539 case 20: 1682 case 20:
1540 1683
1684/* Line 1455 of yacc.c */
1685#line 219 "dtc-parser.y"
1541 { 1686 {
1542 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); 1687 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
1543 ;} 1688 ;}
1544 break; 1689 break;
1545 1690
1546 case 21: 1691 case 21:
1547 1692
1693/* Line 1455 of yacc.c */
1694#line 223 "dtc-parser.y"
1695 {
1696 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref));
1697 ;}
1698 break;
1699
1700 case 22:
1701
1702/* Line 1455 of yacc.c */
1703#line 227 "dtc-parser.y"
1548 { 1704 {
1549 FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL); 1705 FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL);
1550 struct data d; 1706 struct data d;
1551 1707
1552 if ((yyvsp[(6) - (9)].addr) != 0) 1708 if ((yyvsp[(6) - (9)].integer) != 0)
1553 if (fseek(f, (yyvsp[(6) - (9)].addr), SEEK_SET) != 0) 1709 if (fseek(f, (yyvsp[(6) - (9)].integer), SEEK_SET) != 0)
1554 print_error("Couldn't seek to offset %llu in \"%s\": %s", 1710 print_error("Couldn't seek to offset %llu in \"%s\": %s",
1555 (unsigned long long)(yyvsp[(6) - (9)].addr), 1711 (unsigned long long)(yyvsp[(6) - (9)].integer),
1556 (yyvsp[(4) - (9)].data).val, 1712 (yyvsp[(4) - (9)].data).val,
1557 strerror(errno)); 1713 strerror(errno));
1558 1714
1559 d = data_copy_file(f, (yyvsp[(8) - (9)].addr)); 1715 d = data_copy_file(f, (yyvsp[(8) - (9)].integer));
1560 1716
1561 (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d); 1717 (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d);
1562 fclose(f); 1718 fclose(f);
1563 ;} 1719 ;}
1564 break; 1720 break;
1565 1721
1566 case 22: 1722 case 23:
1567 1723
1724/* Line 1455 of yacc.c */
1725#line 244 "dtc-parser.y"
1568 { 1726 {
1569 FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL); 1727 FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL);
1570 struct data d = empty_data; 1728 struct data d = empty_data;
@@ -1576,122 +1734,383 @@ yyreduce:
1576 ;} 1734 ;}
1577 break; 1735 break;
1578 1736
1579 case 23:
1580
1581 {
1582 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1583 ;}
1584 break;
1585
1586 case 24: 1737 case 24:
1587 1738
1739/* Line 1455 of yacc.c */
1740#line 254 "dtc-parser.y"
1588 { 1741 {
1589 (yyval.data) = empty_data; 1742 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1590 ;} 1743 ;}
1591 break; 1744 break;
1592 1745
1593 case 25: 1746 case 25:
1594 1747
1748/* Line 1455 of yacc.c */
1749#line 261 "dtc-parser.y"
1595 { 1750 {
1596 (yyval.data) = (yyvsp[(1) - (2)].data); 1751 (yyval.data) = empty_data;
1597 ;} 1752 ;}
1598 break; 1753 break;
1599 1754
1600 case 26: 1755 case 26:
1601 1756
1757/* Line 1455 of yacc.c */
1758#line 265 "dtc-parser.y"
1602 { 1759 {
1603 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); 1760 (yyval.data) = (yyvsp[(1) - (2)].data);
1604 ;} 1761 ;}
1605 break; 1762 break;
1606 1763
1607 case 27: 1764 case 27:
1608 1765
1766/* Line 1455 of yacc.c */
1767#line 269 "dtc-parser.y"
1609 { 1768 {
1610 (yyval.data) = empty_data; 1769 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1611 ;} 1770 ;}
1612 break; 1771 break;
1613 1772
1614 case 28: 1773 case 28:
1615 1774
1775/* Line 1455 of yacc.c */
1776#line 276 "dtc-parser.y"
1616 { 1777 {
1617 (yyval.data) = data_append_cell((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].cell)); 1778 (yyval.array).data = empty_data;
1779 (yyval.array).bits = eval_literal((yyvsp[(2) - (3)].literal), 0, 7);
1780
1781 if (((yyval.array).bits != 8) &&
1782 ((yyval.array).bits != 16) &&
1783 ((yyval.array).bits != 32) &&
1784 ((yyval.array).bits != 64))
1785 {
1786 print_error("Only 8, 16, 32 and 64-bit elements"
1787 " are currently supported");
1788 (yyval.array).bits = 32;
1789 }
1618 ;} 1790 ;}
1619 break; 1791 break;
1620 1792
1621 case 29: 1793 case 29:
1622 1794
1795/* Line 1455 of yacc.c */
1796#line 291 "dtc-parser.y"
1623 { 1797 {
1624 (yyval.data) = data_append_cell(data_add_marker((yyvsp[(1) - (2)].data), REF_PHANDLE, 1798 (yyval.array).data = empty_data;
1625 (yyvsp[(2) - (2)].labelref)), -1); 1799 (yyval.array).bits = 32;
1626 ;} 1800 ;}
1627 break; 1801 break;
1628 1802
1629 case 30: 1803 case 30:
1630 1804
1805/* Line 1455 of yacc.c */
1806#line 296 "dtc-parser.y"
1631 { 1807 {
1632 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); 1808 if ((yyvsp[(1) - (2)].array).bits < 64) {
1809 uint64_t mask = (1ULL << (yyvsp[(1) - (2)].array).bits) - 1;
1810 /*
1811 * Bits above mask must either be all zero
1812 * (positive within range of mask) or all one
1813 * (negative and sign-extended). The second
1814 * condition is true if when we set all bits
1815 * within the mask to one (i.e. | in the
1816 * mask), all bits are one.
1817 */
1818 if (((yyvsp[(2) - (2)].integer) > mask) && (((yyvsp[(2) - (2)].integer) | mask) != -1ULL))
1819 print_error(
1820 "integer value out of range "
1821 "%016lx (%d bits)", (yyvsp[(1) - (2)].array).bits);
1822 }
1823
1824 (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits);
1633 ;} 1825 ;}
1634 break; 1826 break;
1635 1827
1636 case 31: 1828 case 31:
1637 1829
1830/* Line 1455 of yacc.c */
1831#line 316 "dtc-parser.y"
1638 { 1832 {
1639 (yyval.cell) = eval_literal((yyvsp[(1) - (1)].literal), 0, 32); 1833 uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits);
1834
1835 if ((yyvsp[(1) - (2)].array).bits == 32)
1836 (yyvsp[(1) - (2)].array).data = data_add_marker((yyvsp[(1) - (2)].array).data,
1837 REF_PHANDLE,
1838 (yyvsp[(2) - (2)].labelref));
1839 else
1840 print_error("References are only allowed in "
1841 "arrays with 32-bit elements.");
1842
1843 (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits);
1640 ;} 1844 ;}
1641 break; 1845 break;
1642 1846
1643 case 32: 1847 case 32:
1644 1848
1849/* Line 1455 of yacc.c */
1850#line 330 "dtc-parser.y"
1645 { 1851 {
1646 (yyval.data) = empty_data; 1852 (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref));
1647 ;} 1853 ;}
1648 break; 1854 break;
1649 1855
1650 case 33: 1856 case 33:
1651 1857
1858/* Line 1455 of yacc.c */
1859#line 337 "dtc-parser.y"
1652 { 1860 {
1653 (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); 1861 (yyval.integer) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64);
1654 ;} 1862 ;}
1655 break; 1863 break;
1656 1864
1657 case 34: 1865 case 34:
1658 1866
1867/* Line 1455 of yacc.c */
1868#line 341 "dtc-parser.y"
1659 { 1869 {
1660 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); 1870 (yyval.integer) = eval_char_literal((yyvsp[(1) - (1)].literal));
1661 ;} 1871 ;}
1662 break; 1872 break;
1663 1873
1664 case 35: 1874 case 35:
1665 1875
1876/* Line 1455 of yacc.c */
1877#line 345 "dtc-parser.y"
1878 {
1879 (yyval.integer) = (yyvsp[(2) - (3)].integer);
1880 ;}
1881 break;
1882
1883 case 38:
1884
1885/* Line 1455 of yacc.c */
1886#line 356 "dtc-parser.y"
1887 { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); ;}
1888 break;
1889
1890 case 40:
1891
1892/* Line 1455 of yacc.c */
1893#line 361 "dtc-parser.y"
1894 { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); ;}
1895 break;
1896
1897 case 42:
1898
1899/* Line 1455 of yacc.c */
1900#line 366 "dtc-parser.y"
1901 { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); ;}
1902 break;
1903
1904 case 44:
1905
1906/* Line 1455 of yacc.c */
1907#line 371 "dtc-parser.y"
1908 { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); ;}
1909 break;
1910
1911 case 46:
1912
1913/* Line 1455 of yacc.c */
1914#line 376 "dtc-parser.y"
1915 { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); ;}
1916 break;
1917
1918 case 48:
1919
1920/* Line 1455 of yacc.c */
1921#line 381 "dtc-parser.y"
1922 { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); ;}
1923 break;
1924
1925 case 50:
1926
1927/* Line 1455 of yacc.c */
1928#line 386 "dtc-parser.y"
1929 { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); ;}
1930 break;
1931
1932 case 51:
1933
1934/* Line 1455 of yacc.c */
1935#line 387 "dtc-parser.y"
1936 { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); ;}
1937 break;
1938
1939 case 53:
1940
1941/* Line 1455 of yacc.c */
1942#line 392 "dtc-parser.y"
1943 { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); ;}
1944 break;
1945
1946 case 54:
1947
1948/* Line 1455 of yacc.c */
1949#line 393 "dtc-parser.y"
1950 { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); ;}
1951 break;
1952
1953 case 55:
1954
1955/* Line 1455 of yacc.c */
1956#line 394 "dtc-parser.y"
1957 { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); ;}
1958 break;
1959
1960 case 56:
1961
1962/* Line 1455 of yacc.c */
1963#line 395 "dtc-parser.y"
1964 { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); ;}
1965 break;
1966
1967 case 57:
1968
1969/* Line 1455 of yacc.c */
1970#line 399 "dtc-parser.y"
1971 { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); ;}
1972 break;
1973
1974 case 58:
1975
1976/* Line 1455 of yacc.c */
1977#line 400 "dtc-parser.y"
1978 { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); ;}
1979 break;
1980
1981 case 60:
1982
1983/* Line 1455 of yacc.c */
1984#line 405 "dtc-parser.y"
1985 { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;}
1986 break;
1987
1988 case 61:
1989
1990/* Line 1455 of yacc.c */
1991#line 406 "dtc-parser.y"
1992 { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); ;}
1993 break;
1994
1995 case 63:
1996
1997/* Line 1455 of yacc.c */
1998#line 411 "dtc-parser.y"
1999 { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); ;}
2000 break;
2001
2002 case 64:
2003
2004/* Line 1455 of yacc.c */
2005#line 412 "dtc-parser.y"
2006 { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); ;}
2007 break;
2008
2009 case 65:
2010
2011/* Line 1455 of yacc.c */
2012#line 413 "dtc-parser.y"
2013 { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); ;}
2014 break;
2015
2016 case 68:
2017
2018/* Line 1455 of yacc.c */
2019#line 419 "dtc-parser.y"
2020 { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;}
2021 break;
2022
2023 case 69:
2024
2025/* Line 1455 of yacc.c */
2026#line 420 "dtc-parser.y"
2027 { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); ;}
2028 break;
2029
2030 case 70:
2031
2032/* Line 1455 of yacc.c */
2033#line 421 "dtc-parser.y"
2034 { (yyval.integer) = !(yyvsp[(2) - (2)].integer); ;}
2035 break;
2036
2037 case 71:
2038
2039/* Line 1455 of yacc.c */
2040#line 426 "dtc-parser.y"
2041 {
2042 (yyval.data) = empty_data;
2043 ;}
2044 break;
2045
2046 case 72:
2047
2048/* Line 1455 of yacc.c */
2049#line 430 "dtc-parser.y"
2050 {
2051 (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte));
2052 ;}
2053 break;
2054
2055 case 73:
2056
2057/* Line 1455 of yacc.c */
2058#line 434 "dtc-parser.y"
2059 {
2060 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
2061 ;}
2062 break;
2063
2064 case 74:
2065
2066/* Line 1455 of yacc.c */
2067#line 441 "dtc-parser.y"
1666 { 2068 {
1667 (yyval.nodelist) = NULL; 2069 (yyval.nodelist) = NULL;
1668 ;} 2070 ;}
1669 break; 2071 break;
1670 2072
1671 case 36: 2073 case 75:
1672 2074
2075/* Line 1455 of yacc.c */
2076#line 445 "dtc-parser.y"
1673 { 2077 {
1674 (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); 2078 (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist));
1675 ;} 2079 ;}
1676 break; 2080 break;
1677 2081
1678 case 37: 2082 case 76:
1679 2083
2084/* Line 1455 of yacc.c */
2085#line 449 "dtc-parser.y"
1680 { 2086 {
1681 print_error("syntax error: properties must precede subnodes"); 2087 print_error("syntax error: properties must precede subnodes");
1682 YYERROR; 2088 YYERROR;
1683 ;} 2089 ;}
1684 break; 2090 break;
1685 2091
1686 case 38: 2092 case 77:
1687 2093
2094/* Line 1455 of yacc.c */
2095#line 457 "dtc-parser.y"
1688 { 2096 {
1689 (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename)); 2097 (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename));
1690 ;} 2098 ;}
1691 break; 2099 break;
1692 2100
1693 case 39: 2101 case 78:
2102
2103/* Line 1455 of yacc.c */
2104#line 461 "dtc-parser.y"
2105 {
2106 (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename));
2107 ;}
2108 break;
2109
2110 case 79:
1694 2111
2112/* Line 1455 of yacc.c */
2113#line 465 "dtc-parser.y"
1695 { 2114 {
1696 add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref)); 2115 add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref));
1697 (yyval.node) = (yyvsp[(2) - (2)].node); 2116 (yyval.node) = (yyvsp[(2) - (2)].node);
@@ -1700,6 +2119,8 @@ yyreduce:
1700 2119
1701 2120
1702 2121
2122/* Line 1455 of yacc.c */
2123#line 2124 "dtc-parser.tab.c"
1703 default: break; 2124 default: break;
1704 } 2125 }
1705 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 2126 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1910,6 +2331,8 @@ yyreturn:
1910 2331
1911 2332
1912 2333
2334/* Line 1675 of yacc.c */
2335#line 471 "dtc-parser.y"
1913 2336
1914 2337
1915void print_error(char const *fmt, ...) 2338void print_error(char const *fmt, ...)
@@ -1934,9 +2357,12 @@ static unsigned long long eval_literal(const char *s, int base, int bits)
1934 2357
1935 errno = 0; 2358 errno = 0;
1936 val = strtoull(s, &e, base); 2359 val = strtoull(s, &e, base);
1937 if (*e) 2360 if (*e) {
1938 print_error("bad characters in literal"); 2361 size_t uls = strspn(e, "UL");
1939 else if ((errno == ERANGE) 2362 if (e[uls])
2363 print_error("bad characters in literal");
2364 }
2365 if ((errno == ERANGE)
1940 || ((bits < 64) && (val >= (1ULL << bits)))) 2366 || ((bits < 64) && (val >= (1ULL << bits))))
1941 print_error("literal out of range"); 2367 print_error("literal out of range");
1942 else if (errno != 0) 2368 else if (errno != 0)
@@ -1944,3 +2370,29 @@ static unsigned long long eval_literal(const char *s, int base, int bits)
1944 return val; 2370 return val;
1945} 2371}
1946 2372
2373static unsigned char eval_char_literal(const char *s)
2374{
2375 int i = 1;
2376 char c = s[0];
2377
2378 if (c == '\0')
2379 {
2380 print_error("empty character literal");
2381 return 0;
2382 }
2383
2384 /*
2385 * If the first character in the character literal is a \ then process
2386 * the remaining characters as an escape encoding. If the first
2387 * character is neither an escape or a terminator it should be the only
2388 * character in the literal and will be returned.
2389 */
2390 if (c == '\\')
2391 c = get_escape_char(s, &i);
2392
2393 if (s[i] != '\0')
2394 print_error("malformed character literal");
2395
2396 return c;
2397}
2398