diff options
author | Rob Herring <robh@kernel.org> | 2015-04-29 17:00:05 -0400 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2015-04-29 18:17:27 -0400 |
commit | 4760597116e34bd58f670d008ae7323653268fb4 (patch) | |
tree | 2b27799a1dfc5171c7d502cb2ffe094d93ecf7f8 | |
parent | f1ec7187167ce225d2744b20a90afef5f10fd6cd (diff) |
scripts/dtc: Update to upstream version 9d3649bd3be245c9
Sync dtc with upstream as of commit 9d3649bd3be2 (Add testcases for
fdt_path_offset_namelen()).
Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: devicetree@vger.kernel.org
29 files changed, 1745 insertions, 1535 deletions
diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c index ee96a2519eff..e81a8c74b8d2 100644 --- a/scripts/dtc/checks.c +++ b/scripts/dtc/checks.c | |||
@@ -53,7 +53,7 @@ struct check { | |||
53 | void *data; | 53 | void *data; |
54 | bool warn, error; | 54 | bool warn, error; |
55 | enum checkstatus status; | 55 | enum checkstatus status; |
56 | int inprogress; | 56 | bool inprogress; |
57 | int num_prereqs; | 57 | int num_prereqs; |
58 | struct check **prereq; | 58 | struct check **prereq; |
59 | }; | 59 | }; |
@@ -113,6 +113,7 @@ static inline void check_msg(struct check *c, const char *fmt, ...) | |||
113 | vfprintf(stderr, fmt, ap); | 113 | vfprintf(stderr, fmt, ap); |
114 | fprintf(stderr, "\n"); | 114 | fprintf(stderr, "\n"); |
115 | } | 115 | } |
116 | va_end(ap); | ||
116 | } | 117 | } |
117 | 118 | ||
118 | #define FAIL(c, ...) \ | 119 | #define FAIL(c, ...) \ |
@@ -141,9 +142,9 @@ static void check_nodes_props(struct check *c, struct node *dt, struct node *nod | |||
141 | check_nodes_props(c, dt, child); | 142 | check_nodes_props(c, dt, child); |
142 | } | 143 | } |
143 | 144 | ||
144 | static int run_check(struct check *c, struct node *dt) | 145 | static bool run_check(struct check *c, struct node *dt) |
145 | { | 146 | { |
146 | int error = 0; | 147 | bool error = false; |
147 | int i; | 148 | int i; |
148 | 149 | ||
149 | assert(!c->inprogress); | 150 | assert(!c->inprogress); |
@@ -151,11 +152,11 @@ static int run_check(struct check *c, struct node *dt) | |||
151 | if (c->status != UNCHECKED) | 152 | if (c->status != UNCHECKED) |
152 | goto out; | 153 | goto out; |
153 | 154 | ||
154 | c->inprogress = 1; | 155 | c->inprogress = true; |
155 | 156 | ||
156 | for (i = 0; i < c->num_prereqs; i++) { | 157 | for (i = 0; i < c->num_prereqs; i++) { |
157 | struct check *prq = c->prereq[i]; | 158 | struct check *prq = c->prereq[i]; |
158 | error |= run_check(prq, dt); | 159 | error = error || run_check(prq, dt); |
159 | if (prq->status != PASSED) { | 160 | if (prq->status != PASSED) { |
160 | c->status = PREREQ; | 161 | c->status = PREREQ; |
161 | check_msg(c, "Failed prerequisite '%s'", | 162 | check_msg(c, "Failed prerequisite '%s'", |
@@ -177,9 +178,9 @@ static int run_check(struct check *c, struct node *dt) | |||
177 | TRACE(c, "\tCompleted, status %d", c->status); | 178 | TRACE(c, "\tCompleted, status %d", c->status); |
178 | 179 | ||
179 | out: | 180 | out: |
180 | c->inprogress = 0; | 181 | c->inprogress = false; |
181 | if ((c->status != PASSED) && (c->error)) | 182 | if ((c->status != PASSED) && (c->error)) |
182 | error = 1; | 183 | error = true; |
183 | return error; | 184 | return error; |
184 | } | 185 | } |
185 | 186 | ||
@@ -624,11 +625,11 @@ static void check_avoid_default_addr_size(struct check *c, struct node *dt, | |||
624 | if (!reg && !ranges) | 625 | if (!reg && !ranges) |
625 | return; | 626 | return; |
626 | 627 | ||
627 | if ((node->parent->addr_cells == -1)) | 628 | if (node->parent->addr_cells == -1) |
628 | FAIL(c, "Relying on default #address-cells value for %s", | 629 | FAIL(c, "Relying on default #address-cells value for %s", |
629 | node->fullpath); | 630 | node->fullpath); |
630 | 631 | ||
631 | if ((node->parent->size_cells == -1)) | 632 | if (node->parent->size_cells == -1) |
632 | FAIL(c, "Relying on default #size-cells value for %s", | 633 | FAIL(c, "Relying on default #size-cells value for %s", |
633 | node->fullpath); | 634 | node->fullpath); |
634 | } | 635 | } |
@@ -706,15 +707,15 @@ static void disable_warning_error(struct check *c, bool warn, bool error) | |||
706 | c->error = c->error && !error; | 707 | c->error = c->error && !error; |
707 | } | 708 | } |
708 | 709 | ||
709 | void parse_checks_option(bool warn, bool error, const char *optarg) | 710 | void parse_checks_option(bool warn, bool error, const char *arg) |
710 | { | 711 | { |
711 | int i; | 712 | int i; |
712 | const char *name = optarg; | 713 | const char *name = arg; |
713 | bool enable = true; | 714 | bool enable = true; |
714 | 715 | ||
715 | if ((strncmp(optarg, "no-", 3) == 0) | 716 | if ((strncmp(arg, "no-", 3) == 0) |
716 | || (strncmp(optarg, "no_", 3) == 0)) { | 717 | || (strncmp(arg, "no_", 3) == 0)) { |
717 | name = optarg + 3; | 718 | name = arg + 3; |
718 | enable = false; | 719 | enable = false; |
719 | } | 720 | } |
720 | 721 | ||
@@ -733,7 +734,7 @@ void parse_checks_option(bool warn, bool error, const char *optarg) | |||
733 | die("Unrecognized check name \"%s\"\n", name); | 734 | die("Unrecognized check name \"%s\"\n", name); |
734 | } | 735 | } |
735 | 736 | ||
736 | void process_checks(int force, struct boot_info *bi) | 737 | void process_checks(bool force, struct boot_info *bi) |
737 | { | 738 | { |
738 | struct node *dt = bi->dt; | 739 | struct node *dt = bi->dt; |
739 | int i; | 740 | int i; |
diff --git a/scripts/dtc/data.c b/scripts/dtc/data.c index 4a40c5b92474..8cae23746882 100644 --- a/scripts/dtc/data.c +++ b/scripts/dtc/data.c | |||
@@ -74,7 +74,7 @@ struct data data_copy_escape_string(const char *s, int len) | |||
74 | struct data d; | 74 | struct data d; |
75 | char *q; | 75 | char *q; |
76 | 76 | ||
77 | d = data_grow_for(empty_data, strlen(s)+1); | 77 | d = data_grow_for(empty_data, len + 1); |
78 | 78 | ||
79 | q = d.val; | 79 | q = d.val; |
80 | while (i < len) { | 80 | while (i < len) { |
@@ -250,20 +250,20 @@ struct data data_add_marker(struct data d, enum markertype type, char *ref) | |||
250 | return data_append_markers(d, m); | 250 | return data_append_markers(d, m); |
251 | } | 251 | } |
252 | 252 | ||
253 | int data_is_one_string(struct data d) | 253 | bool data_is_one_string(struct data d) |
254 | { | 254 | { |
255 | int i; | 255 | int i; |
256 | int len = d.len; | 256 | int len = d.len; |
257 | 257 | ||
258 | if (len == 0) | 258 | if (len == 0) |
259 | return 0; | 259 | return false; |
260 | 260 | ||
261 | for (i = 0; i < len-1; i++) | 261 | for (i = 0; i < len-1; i++) |
262 | if (d.val[i] == '\0') | 262 | if (d.val[i] == '\0') |
263 | return 0; | 263 | return false; |
264 | 264 | ||
265 | if (d.val[len-1] != '\0') | 265 | if (d.val[len-1] != '\0') |
266 | return 0; | 266 | return false; |
267 | 267 | ||
268 | return 1; | 268 | return true; |
269 | } | 269 | } |
diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l index 3b41bfca636c..0ee1caf03dd0 100644 --- a/scripts/dtc/dtc-lexer.l +++ b/scripts/dtc/dtc-lexer.l | |||
@@ -20,7 +20,6 @@ | |||
20 | 20 | ||
21 | %option noyywrap nounput noinput never-interactive | 21 | %option noyywrap nounput noinput never-interactive |
22 | 22 | ||
23 | %x INCLUDE | ||
24 | %x BYTESTRING | 23 | %x BYTESTRING |
25 | %x PROPNODENAME | 24 | %x PROPNODENAME |
26 | %s V1 | 25 | %s V1 |
@@ -40,6 +39,7 @@ LINECOMMENT "//".*\n | |||
40 | #include "dtc-parser.tab.h" | 39 | #include "dtc-parser.tab.h" |
41 | 40 | ||
42 | YYLTYPE yylloc; | 41 | YYLTYPE yylloc; |
42 | extern bool treesource_error; | ||
43 | 43 | ||
44 | /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ | 44 | /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ |
45 | #define YY_USER_ACTION \ | 45 | #define YY_USER_ACTION \ |
@@ -61,7 +61,8 @@ static int dts_version = 1; | |||
61 | BEGIN(V1); \ | 61 | BEGIN(V1); \ |
62 | 62 | ||
63 | static void push_input_file(const char *filename); | 63 | static void push_input_file(const char *filename); |
64 | static int pop_input_file(void); | 64 | static bool pop_input_file(void); |
65 | static void lexical_error(const char *fmt, ...); | ||
65 | %} | 66 | %} |
66 | 67 | ||
67 | %% | 68 | %% |
@@ -75,11 +76,11 @@ static int pop_input_file(void); | |||
75 | char *line, *tmp, *fn; | 76 | char *line, *tmp, *fn; |
76 | /* skip text before line # */ | 77 | /* skip text before line # */ |
77 | line = yytext; | 78 | line = yytext; |
78 | while (!isdigit(*line)) | 79 | while (!isdigit((unsigned char)*line)) |
79 | line++; | 80 | line++; |
80 | /* skip digits in line # */ | 81 | /* skip digits in line # */ |
81 | tmp = line; | 82 | tmp = line; |
82 | while (!isspace(*tmp)) | 83 | while (!isspace((unsigned char)*tmp)) |
83 | tmp++; | 84 | tmp++; |
84 | /* "NULL"-terminate line # */ | 85 | /* "NULL"-terminate line # */ |
85 | *tmp = '\0'; | 86 | *tmp = '\0'; |
@@ -146,15 +147,42 @@ static int pop_input_file(void); | |||
146 | } | 147 | } |
147 | 148 | ||
148 | <V1>([0-9]+|0[xX][0-9a-fA-F]+)(U|L|UL|LL|ULL)? { | 149 | <V1>([0-9]+|0[xX][0-9a-fA-F]+)(U|L|UL|LL|ULL)? { |
149 | yylval.literal = xstrdup(yytext); | 150 | char *e; |
150 | DPRINT("Literal: '%s'\n", yylval.literal); | 151 | DPRINT("Integer Literal: '%s'\n", yytext); |
152 | |||
153 | errno = 0; | ||
154 | yylval.integer = strtoull(yytext, &e, 0); | ||
155 | |||
156 | assert(!(*e) || !e[strspn(e, "UL")]); | ||
157 | |||
158 | if (errno == ERANGE) | ||
159 | lexical_error("Integer literal '%s' out of range", | ||
160 | yytext); | ||
161 | else | ||
162 | /* ERANGE is the only strtoull error triggerable | ||
163 | * by strings matching the pattern */ | ||
164 | assert(errno == 0); | ||
151 | return DT_LITERAL; | 165 | return DT_LITERAL; |
152 | } | 166 | } |
153 | 167 | ||
154 | <*>{CHAR_LITERAL} { | 168 | <*>{CHAR_LITERAL} { |
155 | yytext[yyleng-1] = '\0'; | 169 | struct data d; |
156 | yylval.literal = xstrdup(yytext+1); | 170 | DPRINT("Character literal: %s\n", yytext); |
157 | DPRINT("Character literal: %s\n", yylval.literal); | 171 | |
172 | d = data_copy_escape_string(yytext+1, yyleng-2); | ||
173 | if (d.len == 1) { | ||
174 | lexical_error("Empty character literal"); | ||
175 | yylval.integer = 0; | ||
176 | return DT_CHAR_LITERAL; | ||
177 | } | ||
178 | |||
179 | yylval.integer = (unsigned char)d.val[0]; | ||
180 | |||
181 | if (d.len > 2) | ||
182 | lexical_error("Character literal has %d" | ||
183 | " characters instead of 1", | ||
184 | d.len - 1); | ||
185 | |||
158 | return DT_CHAR_LITERAL; | 186 | return DT_CHAR_LITERAL; |
159 | } | 187 | } |
160 | 188 | ||
@@ -164,7 +192,7 @@ static int pop_input_file(void); | |||
164 | return DT_REF; | 192 | return DT_REF; |
165 | } | 193 | } |
166 | 194 | ||
167 | <*>"&{/"{PATHCHAR}+\} { /* new-style path reference */ | 195 | <*>"&{/"{PATHCHAR}*\} { /* new-style path reference */ |
168 | yytext[yyleng-1] = '\0'; | 196 | yytext[yyleng-1] = '\0'; |
169 | DPRINT("Ref: %s\n", yytext+2); | 197 | DPRINT("Ref: %s\n", yytext+2); |
170 | yylval.labelref = xstrdup(yytext+2); | 198 | yylval.labelref = xstrdup(yytext+2); |
@@ -238,13 +266,24 @@ static void push_input_file(const char *filename) | |||
238 | } | 266 | } |
239 | 267 | ||
240 | 268 | ||
241 | static int pop_input_file(void) | 269 | static bool pop_input_file(void) |
242 | { | 270 | { |
243 | if (srcfile_pop() == 0) | 271 | if (srcfile_pop() == 0) |
244 | return 0; | 272 | return false; |
245 | 273 | ||
246 | yypop_buffer_state(); | 274 | yypop_buffer_state(); |
247 | yyin = current_srcfile->f; | 275 | yyin = current_srcfile->f; |
248 | 276 | ||
249 | return 1; | 277 | return true; |
278 | } | ||
279 | |||
280 | static void lexical_error(const char *fmt, ...) | ||
281 | { | ||
282 | va_list ap; | ||
283 | |||
284 | va_start(ap, fmt); | ||
285 | srcpos_verror(&yylloc, "Lexical error", fmt, ap); | ||
286 | va_end(ap); | ||
287 | |||
288 | treesource_error = true; | ||
250 | } | 289 | } |
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped index 2d30f41778b7..11cd78e72305 100644 --- a/scripts/dtc/dtc-lexer.lex.c_shipped +++ b/scripts/dtc/dtc-lexer.lex.c_shipped | |||
@@ -9,7 +9,7 @@ | |||
9 | #define FLEX_SCANNER | 9 | #define FLEX_SCANNER |
10 | #define YY_FLEX_MAJOR_VERSION 2 | 10 | #define YY_FLEX_MAJOR_VERSION 2 |
11 | #define YY_FLEX_MINOR_VERSION 5 | 11 | #define YY_FLEX_MINOR_VERSION 5 |
12 | #define YY_FLEX_SUBMINOR_VERSION 35 | 12 | #define YY_FLEX_SUBMINOR_VERSION 39 |
13 | #if YY_FLEX_SUBMINOR_VERSION > 0 | 13 | #if YY_FLEX_SUBMINOR_VERSION > 0 |
14 | #define FLEX_BETA | 14 | #define FLEX_BETA |
15 | #endif | 15 | #endif |
@@ -162,7 +162,12 @@ typedef unsigned int flex_uint32_t; | |||
162 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | 162 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
163 | #endif | 163 | #endif |
164 | 164 | ||
165 | extern int yyleng; | 165 | #ifndef YY_TYPEDEF_YY_SIZE_T |
166 | #define YY_TYPEDEF_YY_SIZE_T | ||
167 | typedef size_t yy_size_t; | ||
168 | #endif | ||
169 | |||
170 | extern yy_size_t yyleng; | ||
166 | 171 | ||
167 | extern FILE *yyin, *yyout; | 172 | extern FILE *yyin, *yyout; |
168 | 173 | ||
@@ -171,6 +176,7 @@ extern FILE *yyin, *yyout; | |||
171 | #define EOB_ACT_LAST_MATCH 2 | 176 | #define EOB_ACT_LAST_MATCH 2 |
172 | 177 | ||
173 | #define YY_LESS_LINENO(n) | 178 | #define YY_LESS_LINENO(n) |
179 | #define YY_LINENO_REWIND_TO(ptr) | ||
174 | 180 | ||
175 | /* Return all but the first "n" matched characters back to the input stream. */ | 181 | /* Return all but the first "n" matched characters back to the input stream. */ |
176 | #define yyless(n) \ | 182 | #define yyless(n) \ |
@@ -188,11 +194,6 @@ extern FILE *yyin, *yyout; | |||
188 | 194 | ||
189 | #define unput(c) yyunput( c, (yytext_ptr) ) | 195 | #define unput(c) yyunput( c, (yytext_ptr) ) |
190 | 196 | ||
191 | #ifndef YY_TYPEDEF_YY_SIZE_T | ||
192 | #define YY_TYPEDEF_YY_SIZE_T | ||
193 | typedef size_t yy_size_t; | ||
194 | #endif | ||
195 | |||
196 | #ifndef YY_STRUCT_YY_BUFFER_STATE | 197 | #ifndef YY_STRUCT_YY_BUFFER_STATE |
197 | #define YY_STRUCT_YY_BUFFER_STATE | 198 | #define YY_STRUCT_YY_BUFFER_STATE |
198 | struct yy_buffer_state | 199 | struct yy_buffer_state |
@@ -210,7 +211,7 @@ struct yy_buffer_state | |||
210 | /* Number of characters read into yy_ch_buf, not including EOB | 211 | /* Number of characters read into yy_ch_buf, not including EOB |
211 | * characters. | 212 | * characters. |
212 | */ | 213 | */ |
213 | int yy_n_chars; | 214 | yy_size_t yy_n_chars; |
214 | 215 | ||
215 | /* Whether we "own" the buffer - i.e., we know we created it, | 216 | /* Whether we "own" the buffer - i.e., we know we created it, |
216 | * and can realloc() it to grow it, and should free() it to | 217 | * and can realloc() it to grow it, and should free() it to |
@@ -280,8 +281,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ | |||
280 | 281 | ||
281 | /* yy_hold_char holds the character lost when yytext is formed. */ | 282 | /* yy_hold_char holds the character lost when yytext is formed. */ |
282 | static char yy_hold_char; | 283 | static char yy_hold_char; |
283 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ | 284 | static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ |
284 | int yyleng; | 285 | yy_size_t yyleng; |
285 | 286 | ||
286 | /* Points to current character in buffer. */ | 287 | /* Points to current character in buffer. */ |
287 | static char *yy_c_buf_p = (char *) 0; | 288 | static char *yy_c_buf_p = (char *) 0; |
@@ -309,7 +310,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); | |||
309 | 310 | ||
310 | YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); | 311 | YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); |
311 | YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); | 312 | YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); |
312 | YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); | 313 | YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); |
313 | 314 | ||
314 | void *yyalloc (yy_size_t ); | 315 | void *yyalloc (yy_size_t ); |
315 | void *yyrealloc (void *,yy_size_t ); | 316 | void *yyrealloc (void *,yy_size_t ); |
@@ -341,7 +342,7 @@ void yyfree (void * ); | |||
341 | 342 | ||
342 | /* Begin user sect3 */ | 343 | /* Begin user sect3 */ |
343 | 344 | ||
344 | #define yywrap(n) 1 | 345 | #define yywrap() 1 |
345 | #define YY_SKIP_YYWRAP | 346 | #define YY_SKIP_YYWRAP |
346 | 347 | ||
347 | typedef unsigned char YY_CHAR; | 348 | typedef unsigned char YY_CHAR; |
@@ -381,25 +382,25 @@ struct yy_trans_info | |||
381 | flex_int32_t yy_verify; | 382 | flex_int32_t yy_verify; |
382 | flex_int32_t yy_nxt; | 383 | flex_int32_t yy_nxt; |
383 | }; | 384 | }; |
384 | static yyconst flex_int16_t yy_accept[161] = | 385 | static yyconst flex_int16_t yy_accept[159] = |
385 | { 0, | 386 | { 0, |
386 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 387 | 0, 0, 0, 0, 0, 0, 0, 0, 31, 29, |
387 | 31, 29, 18, 18, 29, 29, 29, 29, 29, 29, | 388 | 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, |
388 | 29, 29, 29, 29, 29, 29, 29, 29, 15, 16, | 389 | 29, 29, 29, 29, 29, 29, 15, 16, 16, 29, |
389 | 16, 29, 16, 10, 10, 18, 26, 0, 3, 0, | 390 | 16, 10, 10, 18, 26, 0, 3, 0, 27, 12, |
390 | 27, 12, 0, 0, 11, 0, 0, 0, 0, 0, | 391 | 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, |
391 | 0, 0, 21, 23, 25, 24, 22, 0, 9, 28, | 392 | 21, 23, 25, 24, 22, 0, 9, 28, 0, 0, |
392 | 0, 0, 0, 14, 14, 16, 16, 16, 10, 10, | 393 | 0, 14, 14, 16, 16, 16, 10, 10, 10, 0, |
393 | 10, 0, 12, 0, 11, 0, 0, 0, 20, 0, | 394 | 12, 0, 11, 0, 0, 0, 20, 0, 0, 0, |
394 | 0, 0, 0, 0, 0, 0, 0, 16, 10, 10, | 395 | 0, 0, 0, 0, 0, 16, 10, 10, 10, 0, |
395 | 10, 0, 19, 0, 0, 0, 0, 0, 0, 0, | 396 | 13, 19, 0, 0, 0, 0, 0, 0, 0, 0, |
396 | 397 | ||
397 | 0, 0, 16, 13, 0, 0, 0, 0, 0, 0, | 398 | 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, |
398 | 0, 0, 0, 16, 6, 0, 0, 0, 0, 0, | 399 | 0, 16, 6, 0, 0, 0, 0, 0, 0, 2, |
399 | 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, | 400 | 0, 0, 0, 0, 0, 0, 0, 0, 4, 17, |
400 | 4, 17, 0, 0, 2, 0, 0, 0, 0, 0, | 401 | 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, |
401 | 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, | 402 | 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, |
402 | 0, 0, 5, 8, 0, 0, 0, 0, 7, 0 | 403 | 5, 8, 0, 0, 0, 0, 7, 0 |
403 | } ; | 404 | } ; |
404 | 405 | ||
405 | static yyconst flex_int32_t yy_ec[256] = | 406 | static yyconst flex_int32_t yy_ec[256] = |
@@ -440,157 +441,157 @@ static yyconst flex_int32_t yy_meta[47] = | |||
440 | 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, | 441 | 2, 2, 4, 5, 5, 5, 6, 1, 1, 1, |
441 | 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, | 442 | 7, 8, 8, 8, 8, 1, 1, 7, 7, 7, |
442 | 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, | 443 | 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, |
443 | 8, 8, 8, 3, 1, 1 | 444 | 8, 8, 8, 3, 1, 4 |
444 | } ; | 445 | } ; |
445 | 446 | ||
446 | static yyconst flex_int16_t yy_base[175] = | 447 | static yyconst flex_int16_t yy_base[173] = |
447 | { 0, | 448 | { 0, |
448 | 0, 385, 378, 40, 41, 383, 72, 382, 34, 44, | 449 | 0, 383, 34, 382, 65, 381, 37, 105, 387, 391, |
449 | 388, 393, 61, 117, 368, 116, 115, 115, 115, 48, | 450 | 54, 111, 367, 110, 109, 109, 112, 41, 366, 104, |
450 | 367, 107, 368, 339, 127, 120, 0, 147, 393, 0, | 451 | 367, 338, 124, 117, 0, 144, 391, 0, 121, 0, |
451 | 127, 0, 133, 156, 168, 153, 393, 125, 393, 380, | 452 | 135, 155, 140, 179, 391, 160, 391, 379, 391, 0, |
452 | 393, 0, 369, 127, 393, 160, 371, 377, 347, 21, | 453 | 368, 141, 391, 167, 370, 376, 346, 103, 342, 345, |
453 | 343, 346, 393, 393, 393, 393, 393, 359, 393, 393, | 454 | 391, 391, 391, 391, 391, 358, 391, 391, 175, 342, |
454 | 183, 343, 339, 393, 356, 0, 183, 340, 187, 348, | 455 | 338, 391, 355, 0, 185, 339, 184, 347, 346, 0, |
455 | 347, 0, 0, 0, 178, 359, 195, 365, 354, 326, | 456 | 0, 322, 175, 357, 175, 363, 352, 324, 330, 323, |
456 | 332, 325, 334, 328, 204, 326, 331, 324, 393, 335, | 457 | 332, 326, 201, 324, 329, 322, 391, 333, 181, 309, |
457 | 150, 311, 343, 342, 315, 322, 340, 179, 313, 207, | 458 | 391, 341, 340, 313, 320, 338, 178, 311, 146, 317, |
458 | 459 | ||
459 | 319, 316, 317, 393, 337, 333, 305, 302, 311, 301, | 460 | 314, 315, 335, 331, 303, 300, 309, 299, 308, 188, |
460 | 310, 190, 338, 337, 393, 307, 322, 301, 305, 277, | 461 | 336, 335, 391, 305, 320, 281, 283, 271, 203, 288, |
461 | 208, 311, 307, 278, 271, 270, 248, 246, 213, 130, | 462 | 281, 271, 266, 264, 245, 242, 208, 104, 391, 391, |
462 | 393, 393, 263, 235, 207, 221, 218, 229, 213, 213, | 463 | 244, 218, 204, 219, 206, 224, 201, 212, 204, 229, |
463 | 206, 234, 218, 210, 208, 193, 219, 393, 223, 204, | 464 | 215, 208, 207, 200, 219, 391, 233, 221, 200, 181, |
464 | 176, 157, 393, 393, 120, 106, 97, 119, 393, 393, | 465 | 391, 391, 149, 122, 86, 41, 391, 391, 245, 251, |
465 | 245, 251, 259, 263, 267, 273, 280, 284, 292, 300, | 466 | 259, 263, 267, 273, 280, 284, 292, 300, 304, 310, |
466 | 304, 310, 318, 326 | 467 | 318, 326 |
467 | } ; | 468 | } ; |
468 | 469 | ||
469 | static yyconst flex_int16_t yy_def[175] = | 470 | static yyconst flex_int16_t yy_def[173] = |
470 | { 0, | 471 | { 0, |
471 | 160, 1, 1, 1, 1, 5, 160, 7, 1, 1, | 472 | 158, 1, 1, 3, 158, 5, 1, 1, 158, 158, |
472 | 160, 160, 160, 160, 160, 161, 162, 163, 160, 160, | 473 | 158, 158, 158, 159, 160, 161, 158, 158, 158, 158, |
473 | 160, 160, 164, 160, 160, 160, 165, 164, 160, 166, | 474 | 162, 158, 158, 158, 163, 162, 158, 164, 165, 164, |
474 | 167, 166, 166, 160, 160, 160, 160, 161, 160, 161, | 475 | 164, 158, 158, 158, 158, 159, 158, 159, 158, 166, |
475 | 160, 168, 160, 163, 160, 163, 169, 170, 160, 160, | 476 | 158, 161, 158, 161, 167, 168, 158, 158, 158, 158, |
476 | 160, 160, 160, 160, 160, 160, 160, 164, 160, 160, | 477 | 158, 158, 158, 158, 158, 162, 158, 158, 158, 158, |
477 | 160, 160, 160, 160, 164, 166, 167, 166, 160, 160, | 478 | 158, 158, 162, 164, 165, 164, 158, 158, 158, 169, |
478 | 160, 171, 168, 172, 163, 169, 169, 170, 160, 160, | 479 | 166, 170, 161, 167, 167, 168, 158, 158, 158, 158, |
479 | 160, 160, 160, 160, 160, 160, 160, 166, 160, 160, | 480 | 158, 158, 158, 158, 158, 164, 158, 158, 169, 170, |
480 | 171, 172, 160, 160, 160, 160, 160, 160, 160, 160, | 481 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
481 | 482 | ||
482 | 160, 160, 166, 160, 160, 160, 160, 160, 160, 160, | 483 | 158, 164, 158, 158, 158, 158, 158, 158, 158, 171, |
483 | 160, 173, 160, 166, 160, 160, 160, 160, 160, 160, | 484 | 158, 164, 158, 158, 158, 158, 158, 158, 171, 158, |
484 | 173, 160, 173, 160, 160, 160, 160, 160, 160, 160, | 485 | 171, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
485 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 486 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
486 | 160, 160, 174, 160, 160, 160, 174, 160, 174, 160, | 487 | 172, 158, 158, 158, 172, 158, 172, 158, 158, 158, |
487 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 0, | 488 | 158, 158, 158, 158, 158, 158, 158, 0, 158, 158, |
488 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 489 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
489 | 160, 160, 160, 160 | 490 | 158, 158 |
490 | } ; | 491 | } ; |
491 | 492 | ||
492 | static yyconst flex_int16_t yy_nxt[440] = | 493 | static yyconst flex_int16_t yy_nxt[438] = |
493 | { 0, | 494 | { 0, |
494 | 12, 13, 14, 13, 15, 16, 12, 17, 18, 12, | 495 | 10, 11, 12, 11, 13, 14, 10, 15, 16, 10, |
495 | 12, 12, 19, 12, 12, 12, 12, 20, 21, 22, | 496 | 10, 10, 17, 10, 10, 10, 10, 18, 19, 20, |
496 | 23, 23, 23, 23, 23, 12, 12, 23, 23, 23, | 497 | 21, 21, 21, 21, 21, 10, 10, 21, 21, 21, |
497 | 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, | 498 | 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, |
498 | 23, 23, 23, 12, 24, 12, 25, 34, 35, 35, | 499 | 21, 21, 21, 10, 22, 10, 24, 25, 25, 25, |
499 | 25, 81, 26, 26, 27, 27, 27, 34, 35, 35, | 500 | 32, 33, 33, 157, 26, 34, 34, 34, 51, 52, |
500 | 82, 28, 36, 36, 36, 53, 54, 29, 28, 28, | 501 | 27, 26, 26, 26, 26, 10, 11, 12, 11, 13, |
501 | 28, 28, 12, 13, 14, 13, 15, 16, 30, 17, | 502 | 14, 28, 15, 16, 28, 28, 28, 24, 28, 28, |
502 | 18, 30, 30, 30, 26, 30, 30, 30, 12, 20, | 503 | 28, 10, 18, 19, 20, 29, 29, 29, 29, 29, |
503 | 21, 22, 31, 31, 31, 31, 31, 32, 12, 31, | 504 | 30, 10, 29, 29, 29, 29, 29, 29, 29, 29, |
504 | 505 | ||
505 | 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, | 506 | 29, 29, 29, 29, 29, 29, 29, 29, 10, 22, |
506 | 31, 31, 31, 31, 31, 12, 24, 12, 36, 36, | 507 | 10, 23, 34, 34, 34, 37, 39, 43, 32, 33, |
507 | 36, 39, 41, 45, 47, 56, 57, 48, 61, 47, | 508 | 33, 45, 54, 55, 46, 59, 45, 64, 156, 46, |
508 | 39, 159, 48, 66, 61, 45, 66, 66, 66, 158, | 509 | 64, 64, 64, 79, 44, 38, 59, 57, 134, 47, |
509 | 46, 40, 49, 59, 50, 157, 51, 49, 52, 50, | 510 | 135, 48, 80, 49, 47, 50, 48, 99, 61, 43, |
510 | 40, 63, 46, 52, 36, 36, 36, 156, 43, 62, | 511 | 50, 110, 41, 67, 67, 67, 60, 63, 63, 63, |
511 | 65, 65, 65, 59, 136, 68, 137, 65, 75, 69, | 512 | 57, 155, 68, 69, 63, 37, 44, 66, 67, 67, |
512 | 69, 69, 70, 71, 65, 65, 65, 65, 70, 71, | 513 | 67, 63, 63, 63, 63, 73, 59, 68, 69, 70, |
513 | 72, 69, 69, 69, 61, 46, 45, 155, 154, 66, | 514 | 34, 34, 34, 43, 75, 38, 154, 92, 83, 83, |
514 | 70, 71, 66, 66, 66, 122, 85, 85, 85, 59, | 515 | 83, 64, 44, 120, 64, 64, 64, 67, 67, 67, |
515 | 516 | ||
516 | 69, 69, 69, 46, 77, 100, 109, 93, 100, 70, | 517 | 44, 57, 99, 68, 69, 107, 68, 69, 120, 127, |
517 | 71, 110, 112, 122, 129, 123, 153, 85, 85, 85, | 518 | 108, 153, 152, 121, 83, 83, 83, 133, 133, 133, |
518 | 135, 135, 135, 148, 148, 160, 135, 135, 135, 152, | 519 | 146, 133, 133, 133, 146, 140, 140, 140, 121, 141, |
519 | 142, 142, 142, 123, 143, 142, 142, 142, 151, 143, | 520 | 140, 140, 140, 151, 141, 158, 150, 149, 148, 144, |
520 | 150, 146, 145, 149, 149, 38, 38, 38, 38, 38, | 521 | 147, 143, 142, 139, 147, 36, 36, 36, 36, 36, |
521 | 38, 38, 38, 42, 144, 141, 140, 42, 42, 44, | 522 | 36, 36, 36, 40, 138, 137, 136, 40, 40, 42, |
522 | 44, 44, 44, 44, 44, 44, 44, 58, 58, 58, | 523 | 42, 42, 42, 42, 42, 42, 42, 56, 56, 56, |
523 | 58, 64, 139, 64, 66, 138, 134, 66, 133, 66, | 524 | 56, 62, 132, 62, 64, 131, 130, 64, 129, 64, |
524 | 66, 67, 132, 131, 67, 67, 67, 67, 73, 130, | 525 | 64, 65, 128, 158, 65, 65, 65, 65, 71, 127, |
525 | 73, 73, 76, 76, 76, 76, 76, 76, 76, 76, | 526 | 71, 71, 74, 74, 74, 74, 74, 74, 74, 74, |
526 | 527 | ||
527 | 78, 78, 78, 78, 78, 78, 78, 78, 91, 160, | 528 | 76, 76, 76, 76, 76, 76, 76, 76, 89, 126, |
528 | 91, 92, 129, 92, 92, 128, 92, 92, 121, 121, | 529 | 89, 90, 125, 90, 90, 124, 90, 90, 119, 119, |
529 | 121, 121, 121, 121, 121, 121, 147, 147, 147, 147, | 530 | 119, 119, 119, 119, 119, 119, 145, 145, 145, 145, |
530 | 147, 147, 147, 147, 127, 126, 125, 124, 61, 61, | 531 | 145, 145, 145, 145, 123, 122, 59, 59, 118, 117, |
531 | 120, 119, 118, 117, 116, 115, 47, 114, 110, 113, | 532 | 116, 115, 114, 113, 45, 112, 108, 111, 109, 106, |
532 | 111, 108, 107, 106, 48, 105, 104, 89, 103, 102, | 533 | 105, 104, 46, 103, 91, 87, 102, 101, 100, 98, |
533 | 101, 99, 98, 97, 96, 95, 94, 79, 77, 90, | 534 | 97, 96, 95, 94, 93, 77, 75, 91, 88, 87, |
534 | 89, 88, 59, 87, 86, 59, 84, 83, 80, 79, | 535 | 86, 57, 85, 84, 57, 82, 81, 78, 77, 75, |
535 | 77, 74, 160, 60, 59, 55, 37, 160, 33, 25, | 536 | 72, 158, 58, 57, 53, 35, 158, 31, 23, 23, |
536 | 26, 25, 11, 160, 160, 160, 160, 160, 160, 160, | 537 | 9, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
537 | 538 | ||
538 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 539 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
539 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 540 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
540 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 541 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
541 | 160, 160, 160, 160, 160, 160, 160, 160, 160 | 542 | 158, 158, 158, 158, 158, 158, 158 |
542 | } ; | 543 | } ; |
543 | 544 | ||
544 | static yyconst flex_int16_t yy_chk[440] = | 545 | static yyconst flex_int16_t yy_chk[438] = |
545 | { 0, | 546 | { 0, |
546 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 547 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
547 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 548 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
548 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 549 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
549 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 550 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
550 | 1, 1, 1, 1, 1, 1, 4, 9, 9, 9, | 551 | 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, |
551 | 10, 50, 4, 5, 5, 5, 5, 10, 10, 10, | 552 | 7, 7, 7, 156, 3, 11, 11, 11, 18, 18, |
552 | 50, 5, 13, 13, 13, 20, 20, 5, 5, 5, | 553 | 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, |
553 | 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, | 554 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
554 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 555 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
555 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 556 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
556 | 557 | ||
557 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 558 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
558 | 7, 7, 7, 7, 7, 7, 7, 7, 14, 14, | 559 | 5, 8, 12, 12, 12, 14, 15, 16, 8, 8, |
559 | 14, 16, 17, 18, 19, 22, 22, 19, 25, 26, | 560 | 8, 17, 20, 20, 17, 23, 24, 29, 155, 24, |
560 | 38, 158, 26, 31, 33, 44, 31, 31, 31, 157, | 561 | 29, 29, 29, 48, 16, 14, 31, 29, 128, 17, |
561 | 18, 16, 19, 31, 19, 156, 19, 26, 19, 26, | 562 | 128, 17, 48, 17, 24, 17, 24, 99, 24, 42, |
562 | 38, 26, 44, 26, 36, 36, 36, 155, 17, 25, | 563 | 24, 99, 15, 33, 33, 33, 23, 26, 26, 26, |
563 | 28, 28, 28, 28, 130, 33, 130, 28, 46, 34, | 564 | 26, 154, 33, 33, 26, 36, 42, 31, 32, 32, |
564 | 34, 34, 91, 91, 28, 28, 28, 28, 34, 34, | 565 | 32, 26, 26, 26, 26, 44, 59, 32, 32, 32, |
565 | 34, 35, 35, 35, 61, 46, 75, 152, 151, 67, | 566 | 34, 34, 34, 73, 75, 36, 153, 75, 59, 59, |
566 | 35, 35, 67, 67, 67, 112, 61, 61, 61, 67, | 567 | 59, 65, 44, 110, 65, 65, 65, 67, 67, 67, |
567 | 568 | ||
568 | 69, 69, 69, 75, 77, 85, 98, 77, 100, 69, | 569 | 73, 65, 83, 89, 89, 97, 67, 67, 119, 127, |
569 | 69, 98, 100, 121, 129, 112, 150, 85, 85, 85, | 570 | 97, 150, 149, 110, 83, 83, 83, 133, 133, 133, |
570 | 135, 135, 135, 143, 147, 149, 129, 129, 129, 146, | 571 | 141, 127, 127, 127, 145, 136, 136, 136, 119, 136, |
571 | 138, 138, 138, 121, 138, 142, 142, 142, 145, 142, | 572 | 140, 140, 140, 148, 140, 147, 144, 143, 142, 139, |
572 | 144, 141, 140, 143, 147, 161, 161, 161, 161, 161, | 573 | 141, 138, 137, 135, 145, 159, 159, 159, 159, 159, |
573 | 161, 161, 161, 162, 139, 137, 136, 162, 162, 163, | 574 | 159, 159, 159, 160, 134, 132, 131, 160, 160, 161, |
574 | 163, 163, 163, 163, 163, 163, 163, 164, 164, 164, | 575 | 161, 161, 161, 161, 161, 161, 161, 162, 162, 162, |
575 | 164, 165, 134, 165, 166, 133, 128, 166, 127, 166, | 576 | 162, 163, 126, 163, 164, 125, 124, 164, 123, 164, |
576 | 166, 167, 126, 125, 167, 167, 167, 167, 168, 124, | 577 | 164, 165, 122, 121, 165, 165, 165, 165, 166, 120, |
577 | 168, 168, 169, 169, 169, 169, 169, 169, 169, 169, | 578 | 166, 166, 167, 167, 167, 167, 167, 167, 167, 167, |
578 | 579 | ||
579 | 170, 170, 170, 170, 170, 170, 170, 170, 171, 123, | 580 | 168, 168, 168, 168, 168, 168, 168, 168, 169, 118, |
580 | 171, 172, 122, 172, 172, 120, 172, 172, 173, 173, | 581 | 169, 170, 117, 170, 170, 116, 170, 170, 171, 171, |
581 | 173, 173, 173, 173, 173, 173, 174, 174, 174, 174, | 582 | 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, |
582 | 174, 174, 174, 174, 119, 118, 117, 116, 114, 113, | 583 | 172, 172, 172, 172, 115, 114, 112, 111, 109, 108, |
583 | 111, 110, 109, 108, 107, 106, 105, 103, 102, 101, | 584 | 107, 106, 105, 104, 103, 102, 101, 100, 98, 96, |
584 | 99, 97, 96, 95, 94, 93, 92, 90, 88, 87, | 585 | 95, 94, 93, 92, 90, 88, 86, 85, 84, 82, |
585 | 86, 84, 83, 82, 81, 80, 79, 78, 76, 71, | 586 | 81, 80, 79, 78, 77, 76, 74, 72, 69, 68, |
586 | 70, 68, 65, 63, 62, 58, 52, 51, 49, 48, | 587 | 66, 63, 61, 60, 56, 50, 49, 47, 46, 45, |
587 | 47, 43, 40, 24, 23, 21, 15, 11, 8, 6, | 588 | 41, 38, 22, 21, 19, 13, 9, 6, 4, 2, |
588 | 3, 2, 160, 160, 160, 160, 160, 160, 160, 160, | 589 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
589 | 590 | ||
590 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 591 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
591 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 592 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
592 | 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, | 593 | 158, 158, 158, 158, 158, 158, 158, 158, 158, 158, |
593 | 160, 160, 160, 160, 160, 160, 160, 160, 160 | 594 | 158, 158, 158, 158, 158, 158, 158 |
594 | } ; | 595 | } ; |
595 | 596 | ||
596 | static yy_state_type yy_last_accepting_state; | 597 | static yy_state_type yy_last_accepting_state; |
@@ -631,13 +632,13 @@ char *yytext; | |||
631 | 632 | ||
632 | 633 | ||
633 | 634 | ||
634 | 635 | #line 37 "dtc-lexer.l" | |
635 | #line 38 "dtc-lexer.l" | ||
636 | #include "dtc.h" | 636 | #include "dtc.h" |
637 | #include "srcpos.h" | 637 | #include "srcpos.h" |
638 | #include "dtc-parser.tab.h" | 638 | #include "dtc-parser.tab.h" |
639 | 639 | ||
640 | YYLTYPE yylloc; | 640 | YYLTYPE yylloc; |
641 | extern bool treesource_error; | ||
641 | 642 | ||
642 | /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ | 643 | /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ |
643 | #define YY_USER_ACTION \ | 644 | #define YY_USER_ACTION \ |
@@ -659,14 +660,14 @@ static int dts_version = 1; | |||
659 | BEGIN(V1); \ | 660 | BEGIN(V1); \ |
660 | 661 | ||
661 | static void push_input_file(const char *filename); | 662 | static void push_input_file(const char *filename); |
662 | static int pop_input_file(void); | 663 | static bool pop_input_file(void); |
663 | #line 664 "dtc-lexer.lex.c" | 664 | static void lexical_error(const char *fmt, ...); |
665 | #line 666 "dtc-lexer.lex.c" | ||
664 | 666 | ||
665 | #define INITIAL 0 | 667 | #define INITIAL 0 |
666 | #define INCLUDE 1 | 668 | #define BYTESTRING 1 |
667 | #define BYTESTRING 2 | 669 | #define PROPNODENAME 2 |
668 | #define PROPNODENAME 3 | 670 | #define V1 3 |
669 | #define V1 4 | ||
670 | 671 | ||
671 | #ifndef YY_NO_UNISTD_H | 672 | #ifndef YY_NO_UNISTD_H |
672 | /* Special case for "unistd.h", since it is non-ANSI. We include it way | 673 | /* Special case for "unistd.h", since it is non-ANSI. We include it way |
@@ -703,7 +704,7 @@ FILE *yyget_out (void ); | |||
703 | 704 | ||
704 | void yyset_out (FILE * out_str ); | 705 | void yyset_out (FILE * out_str ); |
705 | 706 | ||
706 | int yyget_leng (void ); | 707 | yy_size_t yyget_leng (void ); |
707 | 708 | ||
708 | char *yyget_text (void ); | 709 | char *yyget_text (void ); |
709 | 710 | ||
@@ -852,10 +853,6 @@ YY_DECL | |||
852 | register char *yy_cp, *yy_bp; | 853 | register char *yy_cp, *yy_bp; |
853 | register int yy_act; | 854 | register int yy_act; |
854 | 855 | ||
855 | #line 67 "dtc-lexer.l" | ||
856 | |||
857 | #line 858 "dtc-lexer.lex.c" | ||
858 | |||
859 | if ( !(yy_init) ) | 856 | if ( !(yy_init) ) |
860 | { | 857 | { |
861 | (yy_init) = 1; | 858 | (yy_init) = 1; |
@@ -882,6 +879,11 @@ YY_DECL | |||
882 | yy_load_buffer_state( ); | 879 | yy_load_buffer_state( ); |
883 | } | 880 | } |
884 | 881 | ||
882 | { | ||
883 | #line 68 "dtc-lexer.l" | ||
884 | |||
885 | #line 886 "dtc-lexer.lex.c" | ||
886 | |||
885 | while ( 1 ) /* loops until end-of-file is reached */ | 887 | while ( 1 ) /* loops until end-of-file is reached */ |
886 | { | 888 | { |
887 | yy_cp = (yy_c_buf_p); | 889 | yy_cp = (yy_c_buf_p); |
@@ -899,7 +901,7 @@ YY_DECL | |||
899 | yy_match: | 901 | yy_match: |
900 | do | 902 | do |
901 | { | 903 | { |
902 | register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; | 904 | register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; |
903 | if ( yy_accept[yy_current_state] ) | 905 | if ( yy_accept[yy_current_state] ) |
904 | { | 906 | { |
905 | (yy_last_accepting_state) = yy_current_state; | 907 | (yy_last_accepting_state) = yy_current_state; |
@@ -908,13 +910,13 @@ yy_match: | |||
908 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 910 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
909 | { | 911 | { |
910 | yy_current_state = (int) yy_def[yy_current_state]; | 912 | yy_current_state = (int) yy_def[yy_current_state]; |
911 | if ( yy_current_state >= 161 ) | 913 | if ( yy_current_state >= 159 ) |
912 | yy_c = yy_meta[(unsigned int) yy_c]; | 914 | yy_c = yy_meta[(unsigned int) yy_c]; |
913 | } | 915 | } |
914 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 916 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
915 | ++yy_cp; | 917 | ++yy_cp; |
916 | } | 918 | } |
917 | while ( yy_current_state != 160 ); | 919 | while ( yy_current_state != 158 ); |
918 | yy_cp = (yy_last_accepting_cpos); | 920 | yy_cp = (yy_last_accepting_cpos); |
919 | yy_current_state = (yy_last_accepting_state); | 921 | yy_current_state = (yy_last_accepting_state); |
920 | 922 | ||
@@ -937,7 +939,7 @@ do_action: /* This label is used only to access EOF actions. */ | |||
937 | case 1: | 939 | case 1: |
938 | /* rule 1 can match eol */ | 940 | /* rule 1 can match eol */ |
939 | YY_RULE_SETUP | 941 | YY_RULE_SETUP |
940 | #line 68 "dtc-lexer.l" | 942 | #line 69 "dtc-lexer.l" |
941 | { | 943 | { |
942 | char *name = strchr(yytext, '\"') + 1; | 944 | char *name = strchr(yytext, '\"') + 1; |
943 | yytext[yyleng-1] = '\0'; | 945 | yytext[yyleng-1] = '\0'; |
@@ -947,16 +949,16 @@ YY_RULE_SETUP | |||
947 | case 2: | 949 | case 2: |
948 | /* rule 2 can match eol */ | 950 | /* rule 2 can match eol */ |
949 | YY_RULE_SETUP | 951 | YY_RULE_SETUP |
950 | #line 74 "dtc-lexer.l" | 952 | #line 75 "dtc-lexer.l" |
951 | { | 953 | { |
952 | char *line, *tmp, *fn; | 954 | char *line, *tmp, *fn; |
953 | /* skip text before line # */ | 955 | /* skip text before line # */ |
954 | line = yytext; | 956 | line = yytext; |
955 | while (!isdigit(*line)) | 957 | while (!isdigit((unsigned char)*line)) |
956 | line++; | 958 | line++; |
957 | /* skip digits in line # */ | 959 | /* skip digits in line # */ |
958 | tmp = line; | 960 | tmp = line; |
959 | while (!isspace(*tmp)) | 961 | while (!isspace((unsigned char)*tmp)) |
960 | tmp++; | 962 | tmp++; |
961 | /* "NULL"-terminate line # */ | 963 | /* "NULL"-terminate line # */ |
962 | *tmp = '\0'; | 964 | *tmp = '\0'; |
@@ -970,11 +972,10 @@ YY_RULE_SETUP | |||
970 | } | 972 | } |
971 | YY_BREAK | 973 | YY_BREAK |
972 | case YY_STATE_EOF(INITIAL): | 974 | case YY_STATE_EOF(INITIAL): |
973 | case YY_STATE_EOF(INCLUDE): | ||
974 | case YY_STATE_EOF(BYTESTRING): | 975 | case YY_STATE_EOF(BYTESTRING): |
975 | case YY_STATE_EOF(PROPNODENAME): | 976 | case YY_STATE_EOF(PROPNODENAME): |
976 | case YY_STATE_EOF(V1): | 977 | case YY_STATE_EOF(V1): |
977 | #line 95 "dtc-lexer.l" | 978 | #line 96 "dtc-lexer.l" |
978 | { | 979 | { |
979 | if (!pop_input_file()) { | 980 | if (!pop_input_file()) { |
980 | yyterminate(); | 981 | yyterminate(); |
@@ -984,7 +985,7 @@ case YY_STATE_EOF(V1): | |||
984 | case 3: | 985 | case 3: |
985 | /* rule 3 can match eol */ | 986 | /* rule 3 can match eol */ |
986 | YY_RULE_SETUP | 987 | YY_RULE_SETUP |
987 | #line 101 "dtc-lexer.l" | 988 | #line 102 "dtc-lexer.l" |
988 | { | 989 | { |
989 | DPRINT("String: %s\n", yytext); | 990 | DPRINT("String: %s\n", yytext); |
990 | yylval.data = data_copy_escape_string(yytext+1, | 991 | yylval.data = data_copy_escape_string(yytext+1, |
@@ -994,7 +995,7 @@ YY_RULE_SETUP | |||
994 | YY_BREAK | 995 | YY_BREAK |
995 | case 4: | 996 | case 4: |
996 | YY_RULE_SETUP | 997 | YY_RULE_SETUP |
997 | #line 108 "dtc-lexer.l" | 998 | #line 109 "dtc-lexer.l" |
998 | { | 999 | { |
999 | DPRINT("Keyword: /dts-v1/\n"); | 1000 | DPRINT("Keyword: /dts-v1/\n"); |
1000 | dts_version = 1; | 1001 | dts_version = 1; |
@@ -1004,7 +1005,7 @@ YY_RULE_SETUP | |||
1004 | YY_BREAK | 1005 | YY_BREAK |
1005 | case 5: | 1006 | case 5: |
1006 | YY_RULE_SETUP | 1007 | YY_RULE_SETUP |
1007 | #line 115 "dtc-lexer.l" | 1008 | #line 116 "dtc-lexer.l" |
1008 | { | 1009 | { |
1009 | DPRINT("Keyword: /memreserve/\n"); | 1010 | DPRINT("Keyword: /memreserve/\n"); |
1010 | BEGIN_DEFAULT(); | 1011 | BEGIN_DEFAULT(); |
@@ -1013,7 +1014,7 @@ YY_RULE_SETUP | |||
1013 | YY_BREAK | 1014 | YY_BREAK |
1014 | case 6: | 1015 | case 6: |
1015 | YY_RULE_SETUP | 1016 | YY_RULE_SETUP |
1016 | #line 121 "dtc-lexer.l" | 1017 | #line 122 "dtc-lexer.l" |
1017 | { | 1018 | { |
1018 | DPRINT("Keyword: /bits/\n"); | 1019 | DPRINT("Keyword: /bits/\n"); |
1019 | BEGIN_DEFAULT(); | 1020 | BEGIN_DEFAULT(); |
@@ -1022,7 +1023,7 @@ YY_RULE_SETUP | |||
1022 | YY_BREAK | 1023 | YY_BREAK |
1023 | case 7: | 1024 | case 7: |
1024 | YY_RULE_SETUP | 1025 | YY_RULE_SETUP |
1025 | #line 127 "dtc-lexer.l" | 1026 | #line 128 "dtc-lexer.l" |
1026 | { | 1027 | { |
1027 | DPRINT("Keyword: /delete-property/\n"); | 1028 | DPRINT("Keyword: /delete-property/\n"); |
1028 | DPRINT("<PROPNODENAME>\n"); | 1029 | DPRINT("<PROPNODENAME>\n"); |
@@ -1032,7 +1033,7 @@ YY_RULE_SETUP | |||
1032 | YY_BREAK | 1033 | YY_BREAK |
1033 | case 8: | 1034 | case 8: |
1034 | YY_RULE_SETUP | 1035 | YY_RULE_SETUP |
1035 | #line 134 "dtc-lexer.l" | 1036 | #line 135 "dtc-lexer.l" |
1036 | { | 1037 | { |
1037 | DPRINT("Keyword: /delete-node/\n"); | 1038 | DPRINT("Keyword: /delete-node/\n"); |
1038 | DPRINT("<PROPNODENAME>\n"); | 1039 | DPRINT("<PROPNODENAME>\n"); |
@@ -1042,7 +1043,7 @@ YY_RULE_SETUP | |||
1042 | YY_BREAK | 1043 | YY_BREAK |
1043 | case 9: | 1044 | case 9: |
1044 | YY_RULE_SETUP | 1045 | YY_RULE_SETUP |
1045 | #line 141 "dtc-lexer.l" | 1046 | #line 142 "dtc-lexer.l" |
1046 | { | 1047 | { |
1047 | DPRINT("Label: %s\n", yytext); | 1048 | DPRINT("Label: %s\n", yytext); |
1048 | yylval.labelref = xstrdup(yytext); | 1049 | yylval.labelref = xstrdup(yytext); |
@@ -1052,27 +1053,54 @@ YY_RULE_SETUP | |||
1052 | YY_BREAK | 1053 | YY_BREAK |
1053 | case 10: | 1054 | case 10: |
1054 | YY_RULE_SETUP | 1055 | YY_RULE_SETUP |
1055 | #line 148 "dtc-lexer.l" | 1056 | #line 149 "dtc-lexer.l" |
1056 | { | 1057 | { |
1057 | yylval.literal = xstrdup(yytext); | 1058 | char *e; |
1058 | DPRINT("Literal: '%s'\n", yylval.literal); | 1059 | DPRINT("Integer Literal: '%s'\n", yytext); |
1060 | |||
1061 | errno = 0; | ||
1062 | yylval.integer = strtoull(yytext, &e, 0); | ||
1063 | |||
1064 | assert(!(*e) || !e[strspn(e, "UL")]); | ||
1065 | |||
1066 | if (errno == ERANGE) | ||
1067 | lexical_error("Integer literal '%s' out of range", | ||
1068 | yytext); | ||
1069 | else | ||
1070 | /* ERANGE is the only strtoull error triggerable | ||
1071 | * by strings matching the pattern */ | ||
1072 | assert(errno == 0); | ||
1059 | return DT_LITERAL; | 1073 | return DT_LITERAL; |
1060 | } | 1074 | } |
1061 | YY_BREAK | 1075 | YY_BREAK |
1062 | case 11: | 1076 | case 11: |
1063 | /* rule 11 can match eol */ | 1077 | /* rule 11 can match eol */ |
1064 | YY_RULE_SETUP | 1078 | YY_RULE_SETUP |
1065 | #line 154 "dtc-lexer.l" | 1079 | #line 168 "dtc-lexer.l" |
1066 | { | 1080 | { |
1067 | yytext[yyleng-1] = '\0'; | 1081 | struct data d; |
1068 | yylval.literal = xstrdup(yytext+1); | 1082 | DPRINT("Character literal: %s\n", yytext); |
1069 | DPRINT("Character literal: %s\n", yylval.literal); | 1083 | |
1084 | d = data_copy_escape_string(yytext+1, yyleng-2); | ||
1085 | if (d.len == 1) { | ||
1086 | lexical_error("Empty character literal"); | ||
1087 | yylval.integer = 0; | ||
1088 | return DT_CHAR_LITERAL; | ||
1089 | } | ||
1090 | |||
1091 | yylval.integer = (unsigned char)d.val[0]; | ||
1092 | |||
1093 | if (d.len > 2) | ||
1094 | lexical_error("Character literal has %d" | ||
1095 | " characters instead of 1", | ||
1096 | d.len - 1); | ||
1097 | |||
1070 | return DT_CHAR_LITERAL; | 1098 | return DT_CHAR_LITERAL; |
1071 | } | 1099 | } |
1072 | YY_BREAK | 1100 | YY_BREAK |
1073 | case 12: | 1101 | case 12: |
1074 | YY_RULE_SETUP | 1102 | YY_RULE_SETUP |
1075 | #line 161 "dtc-lexer.l" | 1103 | #line 189 "dtc-lexer.l" |
1076 | { /* label reference */ | 1104 | { /* label reference */ |
1077 | DPRINT("Ref: %s\n", yytext+1); | 1105 | DPRINT("Ref: %s\n", yytext+1); |
1078 | yylval.labelref = xstrdup(yytext+1); | 1106 | yylval.labelref = xstrdup(yytext+1); |
@@ -1081,7 +1109,7 @@ YY_RULE_SETUP | |||
1081 | YY_BREAK | 1109 | YY_BREAK |
1082 | case 13: | 1110 | case 13: |
1083 | YY_RULE_SETUP | 1111 | YY_RULE_SETUP |
1084 | #line 167 "dtc-lexer.l" | 1112 | #line 195 "dtc-lexer.l" |
1085 | { /* new-style path reference */ | 1113 | { /* new-style path reference */ |
1086 | yytext[yyleng-1] = '\0'; | 1114 | yytext[yyleng-1] = '\0'; |
1087 | DPRINT("Ref: %s\n", yytext+2); | 1115 | DPRINT("Ref: %s\n", yytext+2); |
@@ -1091,7 +1119,7 @@ YY_RULE_SETUP | |||
1091 | YY_BREAK | 1119 | YY_BREAK |
1092 | case 14: | 1120 | case 14: |
1093 | YY_RULE_SETUP | 1121 | YY_RULE_SETUP |
1094 | #line 174 "dtc-lexer.l" | 1122 | #line 202 "dtc-lexer.l" |
1095 | { | 1123 | { |
1096 | yylval.byte = strtol(yytext, NULL, 16); | 1124 | yylval.byte = strtol(yytext, NULL, 16); |
1097 | DPRINT("Byte: %02x\n", (int)yylval.byte); | 1125 | DPRINT("Byte: %02x\n", (int)yylval.byte); |
@@ -1100,7 +1128,7 @@ YY_RULE_SETUP | |||
1100 | YY_BREAK | 1128 | YY_BREAK |
1101 | case 15: | 1129 | case 15: |
1102 | YY_RULE_SETUP | 1130 | YY_RULE_SETUP |
1103 | #line 180 "dtc-lexer.l" | 1131 | #line 208 "dtc-lexer.l" |
1104 | { | 1132 | { |
1105 | DPRINT("/BYTESTRING\n"); | 1133 | DPRINT("/BYTESTRING\n"); |
1106 | BEGIN_DEFAULT(); | 1134 | BEGIN_DEFAULT(); |
@@ -1109,7 +1137,7 @@ YY_RULE_SETUP | |||
1109 | YY_BREAK | 1137 | YY_BREAK |
1110 | case 16: | 1138 | case 16: |
1111 | YY_RULE_SETUP | 1139 | YY_RULE_SETUP |
1112 | #line 186 "dtc-lexer.l" | 1140 | #line 214 "dtc-lexer.l" |
1113 | { | 1141 | { |
1114 | DPRINT("PropNodeName: %s\n", yytext); | 1142 | DPRINT("PropNodeName: %s\n", yytext); |
1115 | yylval.propnodename = xstrdup((yytext[0] == '\\') ? | 1143 | yylval.propnodename = xstrdup((yytext[0] == '\\') ? |
@@ -1120,7 +1148,7 @@ YY_RULE_SETUP | |||
1120 | YY_BREAK | 1148 | YY_BREAK |
1121 | case 17: | 1149 | case 17: |
1122 | YY_RULE_SETUP | 1150 | YY_RULE_SETUP |
1123 | #line 194 "dtc-lexer.l" | 1151 | #line 222 "dtc-lexer.l" |
1124 | { | 1152 | { |
1125 | DPRINT("Binary Include\n"); | 1153 | DPRINT("Binary Include\n"); |
1126 | return DT_INCBIN; | 1154 | return DT_INCBIN; |
@@ -1129,64 +1157,64 @@ YY_RULE_SETUP | |||
1129 | case 18: | 1157 | case 18: |
1130 | /* rule 18 can match eol */ | 1158 | /* rule 18 can match eol */ |
1131 | YY_RULE_SETUP | 1159 | YY_RULE_SETUP |
1132 | #line 199 "dtc-lexer.l" | 1160 | #line 227 "dtc-lexer.l" |
1133 | /* eat whitespace */ | 1161 | /* eat whitespace */ |
1134 | YY_BREAK | 1162 | YY_BREAK |
1135 | case 19: | 1163 | case 19: |
1136 | /* rule 19 can match eol */ | 1164 | /* rule 19 can match eol */ |
1137 | YY_RULE_SETUP | 1165 | YY_RULE_SETUP |
1138 | #line 200 "dtc-lexer.l" | 1166 | #line 228 "dtc-lexer.l" |
1139 | /* eat C-style comments */ | 1167 | /* eat C-style comments */ |
1140 | YY_BREAK | 1168 | YY_BREAK |
1141 | case 20: | 1169 | case 20: |
1142 | /* rule 20 can match eol */ | 1170 | /* rule 20 can match eol */ |
1143 | YY_RULE_SETUP | 1171 | YY_RULE_SETUP |
1144 | #line 201 "dtc-lexer.l" | 1172 | #line 229 "dtc-lexer.l" |
1145 | /* eat C++-style comments */ | 1173 | /* eat C++-style comments */ |
1146 | YY_BREAK | 1174 | YY_BREAK |
1147 | case 21: | 1175 | case 21: |
1148 | YY_RULE_SETUP | 1176 | YY_RULE_SETUP |
1149 | #line 203 "dtc-lexer.l" | 1177 | #line 231 "dtc-lexer.l" |
1150 | { return DT_LSHIFT; }; | 1178 | { return DT_LSHIFT; }; |
1151 | YY_BREAK | 1179 | YY_BREAK |
1152 | case 22: | 1180 | case 22: |
1153 | YY_RULE_SETUP | 1181 | YY_RULE_SETUP |
1154 | #line 204 "dtc-lexer.l" | 1182 | #line 232 "dtc-lexer.l" |
1155 | { return DT_RSHIFT; }; | 1183 | { return DT_RSHIFT; }; |
1156 | YY_BREAK | 1184 | YY_BREAK |
1157 | case 23: | 1185 | case 23: |
1158 | YY_RULE_SETUP | 1186 | YY_RULE_SETUP |
1159 | #line 205 "dtc-lexer.l" | 1187 | #line 233 "dtc-lexer.l" |
1160 | { return DT_LE; }; | 1188 | { return DT_LE; }; |
1161 | YY_BREAK | 1189 | YY_BREAK |
1162 | case 24: | 1190 | case 24: |
1163 | YY_RULE_SETUP | 1191 | YY_RULE_SETUP |
1164 | #line 206 "dtc-lexer.l" | 1192 | #line 234 "dtc-lexer.l" |
1165 | { return DT_GE; }; | 1193 | { return DT_GE; }; |
1166 | YY_BREAK | 1194 | YY_BREAK |
1167 | case 25: | 1195 | case 25: |
1168 | YY_RULE_SETUP | 1196 | YY_RULE_SETUP |
1169 | #line 207 "dtc-lexer.l" | 1197 | #line 235 "dtc-lexer.l" |
1170 | { return DT_EQ; }; | 1198 | { return DT_EQ; }; |
1171 | YY_BREAK | 1199 | YY_BREAK |
1172 | case 26: | 1200 | case 26: |
1173 | YY_RULE_SETUP | 1201 | YY_RULE_SETUP |
1174 | #line 208 "dtc-lexer.l" | 1202 | #line 236 "dtc-lexer.l" |
1175 | { return DT_NE; }; | 1203 | { return DT_NE; }; |
1176 | YY_BREAK | 1204 | YY_BREAK |
1177 | case 27: | 1205 | case 27: |
1178 | YY_RULE_SETUP | 1206 | YY_RULE_SETUP |
1179 | #line 209 "dtc-lexer.l" | 1207 | #line 237 "dtc-lexer.l" |
1180 | { return DT_AND; }; | 1208 | { return DT_AND; }; |
1181 | YY_BREAK | 1209 | YY_BREAK |
1182 | case 28: | 1210 | case 28: |
1183 | YY_RULE_SETUP | 1211 | YY_RULE_SETUP |
1184 | #line 210 "dtc-lexer.l" | 1212 | #line 238 "dtc-lexer.l" |
1185 | { return DT_OR; }; | 1213 | { return DT_OR; }; |
1186 | YY_BREAK | 1214 | YY_BREAK |
1187 | case 29: | 1215 | case 29: |
1188 | YY_RULE_SETUP | 1216 | YY_RULE_SETUP |
1189 | #line 212 "dtc-lexer.l" | 1217 | #line 240 "dtc-lexer.l" |
1190 | { | 1218 | { |
1191 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], | 1219 | DPRINT("Char: %c (\\x%02x)\n", yytext[0], |
1192 | (unsigned)yytext[0]); | 1220 | (unsigned)yytext[0]); |
@@ -1204,10 +1232,10 @@ YY_RULE_SETUP | |||
1204 | YY_BREAK | 1232 | YY_BREAK |
1205 | case 30: | 1233 | case 30: |
1206 | YY_RULE_SETUP | 1234 | YY_RULE_SETUP |
1207 | #line 227 "dtc-lexer.l" | 1235 | #line 255 "dtc-lexer.l" |
1208 | ECHO; | 1236 | ECHO; |
1209 | YY_BREAK | 1237 | YY_BREAK |
1210 | #line 1211 "dtc-lexer.lex.c" | 1238 | #line 1239 "dtc-lexer.lex.c" |
1211 | 1239 | ||
1212 | case YY_END_OF_BUFFER: | 1240 | case YY_END_OF_BUFFER: |
1213 | { | 1241 | { |
@@ -1337,6 +1365,7 @@ ECHO; | |||
1337 | "fatal flex scanner internal error--no action found" ); | 1365 | "fatal flex scanner internal error--no action found" ); |
1338 | } /* end of action switch */ | 1366 | } /* end of action switch */ |
1339 | } /* end of scanning one token */ | 1367 | } /* end of scanning one token */ |
1368 | } /* end of user's declarations */ | ||
1340 | } /* end of yylex */ | 1369 | } /* end of yylex */ |
1341 | 1370 | ||
1342 | /* yy_get_next_buffer - try to read in a new buffer | 1371 | /* yy_get_next_buffer - try to read in a new buffer |
@@ -1392,21 +1421,21 @@ static int yy_get_next_buffer (void) | |||
1392 | 1421 | ||
1393 | else | 1422 | else |
1394 | { | 1423 | { |
1395 | int num_to_read = | 1424 | yy_size_t num_to_read = |
1396 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; | 1425 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
1397 | 1426 | ||
1398 | while ( num_to_read <= 0 ) | 1427 | while ( num_to_read <= 0 ) |
1399 | { /* Not enough room in the buffer - grow it. */ | 1428 | { /* Not enough room in the buffer - grow it. */ |
1400 | 1429 | ||
1401 | /* just a shorter name for the current buffer */ | 1430 | /* just a shorter name for the current buffer */ |
1402 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER; | 1431 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; |
1403 | 1432 | ||
1404 | int yy_c_buf_p_offset = | 1433 | int yy_c_buf_p_offset = |
1405 | (int) ((yy_c_buf_p) - b->yy_ch_buf); | 1434 | (int) ((yy_c_buf_p) - b->yy_ch_buf); |
1406 | 1435 | ||
1407 | if ( b->yy_is_our_buffer ) | 1436 | if ( b->yy_is_our_buffer ) |
1408 | { | 1437 | { |
1409 | int new_size = b->yy_buf_size * 2; | 1438 | yy_size_t new_size = b->yy_buf_size * 2; |
1410 | 1439 | ||
1411 | if ( new_size <= 0 ) | 1440 | if ( new_size <= 0 ) |
1412 | b->yy_buf_size += b->yy_buf_size / 8; | 1441 | b->yy_buf_size += b->yy_buf_size / 8; |
@@ -1437,7 +1466,7 @@ static int yy_get_next_buffer (void) | |||
1437 | 1466 | ||
1438 | /* Read in more data. */ | 1467 | /* Read in more data. */ |
1439 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), | 1468 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), |
1440 | (yy_n_chars), (size_t) num_to_read ); | 1469 | (yy_n_chars), num_to_read ); |
1441 | 1470 | ||
1442 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | 1471 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); |
1443 | } | 1472 | } |
@@ -1499,7 +1528,7 @@ static int yy_get_next_buffer (void) | |||
1499 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 1528 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1500 | { | 1529 | { |
1501 | yy_current_state = (int) yy_def[yy_current_state]; | 1530 | yy_current_state = (int) yy_def[yy_current_state]; |
1502 | if ( yy_current_state >= 161 ) | 1531 | if ( yy_current_state >= 159 ) |
1503 | yy_c = yy_meta[(unsigned int) yy_c]; | 1532 | yy_c = yy_meta[(unsigned int) yy_c]; |
1504 | } | 1533 | } |
1505 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 1534 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
@@ -1527,13 +1556,13 @@ static int yy_get_next_buffer (void) | |||
1527 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 1556 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1528 | { | 1557 | { |
1529 | yy_current_state = (int) yy_def[yy_current_state]; | 1558 | yy_current_state = (int) yy_def[yy_current_state]; |
1530 | if ( yy_current_state >= 161 ) | 1559 | if ( yy_current_state >= 159 ) |
1531 | yy_c = yy_meta[(unsigned int) yy_c]; | 1560 | yy_c = yy_meta[(unsigned int) yy_c]; |
1532 | } | 1561 | } |
1533 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 1562 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
1534 | yy_is_jam = (yy_current_state == 160); | 1563 | yy_is_jam = (yy_current_state == 158); |
1535 | 1564 | ||
1536 | return yy_is_jam ? 0 : yy_current_state; | 1565 | return yy_is_jam ? 0 : yy_current_state; |
1537 | } | 1566 | } |
1538 | 1567 | ||
1539 | #ifndef YY_NO_INPUT | 1568 | #ifndef YY_NO_INPUT |
@@ -1560,7 +1589,7 @@ static int yy_get_next_buffer (void) | |||
1560 | 1589 | ||
1561 | else | 1590 | else |
1562 | { /* need more input */ | 1591 | { /* need more input */ |
1563 | int offset = (yy_c_buf_p) - (yytext_ptr); | 1592 | yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); |
1564 | ++(yy_c_buf_p); | 1593 | ++(yy_c_buf_p); |
1565 | 1594 | ||
1566 | switch ( yy_get_next_buffer( ) ) | 1595 | switch ( yy_get_next_buffer( ) ) |
@@ -1834,7 +1863,7 @@ void yypop_buffer_state (void) | |||
1834 | */ | 1863 | */ |
1835 | static void yyensure_buffer_stack (void) | 1864 | static void yyensure_buffer_stack (void) |
1836 | { | 1865 | { |
1837 | int num_to_alloc; | 1866 | yy_size_t num_to_alloc; |
1838 | 1867 | ||
1839 | if (!(yy_buffer_stack)) { | 1868 | if (!(yy_buffer_stack)) { |
1840 | 1869 | ||
@@ -1931,12 +1960,12 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) | |||
1931 | * | 1960 | * |
1932 | * @return the newly allocated buffer state object. | 1961 | * @return the newly allocated buffer state object. |
1933 | */ | 1962 | */ |
1934 | YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) | 1963 | YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) |
1935 | { | 1964 | { |
1936 | YY_BUFFER_STATE b; | 1965 | YY_BUFFER_STATE b; |
1937 | char *buf; | 1966 | char *buf; |
1938 | yy_size_t n; | 1967 | yy_size_t n; |
1939 | int i; | 1968 | yy_size_t i; |
1940 | 1969 | ||
1941 | /* Get memory for full buffer, including space for trailing EOB's. */ | 1970 | /* Get memory for full buffer, including space for trailing EOB's. */ |
1942 | n = _yybytes_len + 2; | 1971 | n = _yybytes_len + 2; |
@@ -2018,7 +2047,7 @@ FILE *yyget_out (void) | |||
2018 | /** Get the length of the current token. | 2047 | /** Get the length of the current token. |
2019 | * | 2048 | * |
2020 | */ | 2049 | */ |
2021 | int yyget_leng (void) | 2050 | yy_size_t yyget_leng (void) |
2022 | { | 2051 | { |
2023 | return yyleng; | 2052 | return yyleng; |
2024 | } | 2053 | } |
@@ -2166,7 +2195,7 @@ void yyfree (void * ptr ) | |||
2166 | 2195 | ||
2167 | #define YYTABLES_NAME "yytables" | 2196 | #define YYTABLES_NAME "yytables" |
2168 | 2197 | ||
2169 | #line 227 "dtc-lexer.l" | 2198 | #line 254 "dtc-lexer.l" |
2170 | 2199 | ||
2171 | 2200 | ||
2172 | 2201 | ||
@@ -2182,14 +2211,25 @@ static void push_input_file(const char *filename) | |||
2182 | } | 2211 | } |
2183 | 2212 | ||
2184 | 2213 | ||
2185 | static int pop_input_file(void) | 2214 | static bool pop_input_file(void) |
2186 | { | 2215 | { |
2187 | if (srcfile_pop() == 0) | 2216 | if (srcfile_pop() == 0) |
2188 | return 0; | 2217 | return false; |
2189 | 2218 | ||
2190 | yypop_buffer_state(); | 2219 | yypop_buffer_state(); |
2191 | yyin = current_srcfile->f; | 2220 | yyin = current_srcfile->f; |
2192 | 2221 | ||
2193 | return 1; | 2222 | return true; |
2223 | } | ||
2224 | |||
2225 | static void lexical_error(const char *fmt, ...) | ||
2226 | { | ||
2227 | va_list ap; | ||
2228 | |||
2229 | va_start(ap, fmt); | ||
2230 | srcpos_verror(&yylloc, "Lexical error", fmt, ap); | ||
2231 | va_end(ap); | ||
2232 | |||
2233 | treesource_error = true; | ||
2194 | } | 2234 | } |
2195 | 2235 | ||
diff --git a/scripts/dtc/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped index c8769d550cfb..116458c8dfc4 100644 --- a/scripts/dtc/dtc-parser.tab.c_shipped +++ b/scripts/dtc/dtc-parser.tab.c_shipped | |||
@@ -1,19 +1,19 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.7.12-4996. */ | 1 | /* A Bison parser, made by GNU Bison 3.0.2. */ |
2 | 2 | ||
3 | /* Bison implementation for Yacc-like parsers in C | 3 | /* Bison implementation for Yacc-like parsers in C |
4 | 4 | ||
5 | Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. | 5 | Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. |
6 | 6 | ||
7 | This program is free software: you can redistribute it and/or modify | 7 | This program is free software: you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation, either version 3 of the License, or | 9 | the Free Software Foundation, either version 3 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
19 | 19 | ||
@@ -26,7 +26,7 @@ | |||
26 | special exception, which will cause the skeleton and the resulting | 26 | special exception, which will cause the skeleton and the resulting |
27 | Bison output files to be licensed under the GNU General Public | 27 | Bison output files to be licensed under the GNU General Public |
28 | License without this special exception. | 28 | License without this special exception. |
29 | 29 | ||
30 | This special exception was added by the Free Software Foundation in | 30 | This special exception was added by the Free Software Foundation in |
31 | version 2.2 of Bison. */ | 31 | version 2.2 of Bison. */ |
32 | 32 | ||
@@ -44,7 +44,7 @@ | |||
44 | #define YYBISON 1 | 44 | #define YYBISON 1 |
45 | 45 | ||
46 | /* Bison version. */ | 46 | /* Bison version. */ |
47 | #define YYBISON_VERSION "2.7.12-4996" | 47 | #define YYBISON_VERSION "3.0.2" |
48 | 48 | ||
49 | /* Skeleton name. */ | 49 | /* Skeleton name. */ |
50 | #define YYSKELETON_NAME "yacc.c" | 50 | #define YYSKELETON_NAME "yacc.c" |
@@ -62,34 +62,31 @@ | |||
62 | 62 | ||
63 | 63 | ||
64 | /* Copy the first part of user declarations. */ | 64 | /* Copy the first part of user declarations. */ |
65 | /* Line 371 of yacc.c */ | 65 | #line 20 "dtc-parser.y" /* yacc.c:339 */ |
66 | #line 21 "dtc-parser.y" | ||
67 | 66 | ||
68 | #include <stdio.h> | 67 | #include <stdio.h> |
69 | 68 | ||
70 | #include "dtc.h" | 69 | #include "dtc.h" |
71 | #include "srcpos.h" | 70 | #include "srcpos.h" |
72 | 71 | ||
73 | YYLTYPE yylloc; | ||
74 | |||
75 | extern int yylex(void); | 72 | extern int yylex(void); |
76 | extern void print_error(char const *fmt, ...); | ||
77 | extern void yyerror(char const *s); | 73 | extern void yyerror(char const *s); |
74 | #define ERROR(loc, ...) \ | ||
75 | do { \ | ||
76 | srcpos_error((loc), "Error", __VA_ARGS__); \ | ||
77 | treesource_error = true; \ | ||
78 | } while (0) | ||
78 | 79 | ||
79 | extern struct boot_info *the_boot_info; | 80 | extern struct boot_info *the_boot_info; |
80 | extern int treesource_error; | 81 | extern bool treesource_error; |
81 | 82 | ||
82 | static unsigned long long eval_literal(const char *s, int base, int bits); | 83 | #line 84 "dtc-parser.tab.c" /* yacc.c:339 */ |
83 | static unsigned char eval_char_literal(const char *s); | ||
84 | 84 | ||
85 | /* Line 371 of yacc.c */ | 85 | # ifndef YY_NULLPTR |
86 | #line 87 "dtc-parser.tab.c" | ||
87 | |||
88 | # ifndef YY_NULL | ||
89 | # if defined __cplusplus && 201103L <= __cplusplus | 86 | # if defined __cplusplus && 201103L <= __cplusplus |
90 | # define YY_NULL nullptr | 87 | # define YY_NULLPTR nullptr |
91 | # else | 88 | # else |
92 | # define YY_NULL 0 | 89 | # define YY_NULLPTR 0 |
93 | # endif | 90 | # endif |
94 | # endif | 91 | # endif |
95 | 92 | ||
@@ -105,7 +102,7 @@ static unsigned char eval_char_literal(const char *s); | |||
105 | by #include "dtc-parser.tab.h". */ | 102 | by #include "dtc-parser.tab.h". */ |
106 | #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED | 103 | #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED |
107 | # define YY_YY_DTC_PARSER_TAB_H_INCLUDED | 104 | # define YY_YY_DTC_PARSER_TAB_H_INCLUDED |
108 | /* Enabling traces. */ | 105 | /* Debug traces. */ |
109 | #ifndef YYDEBUG | 106 | #ifndef YYDEBUG |
110 | # define YYDEBUG 0 | 107 | # define YYDEBUG 0 |
111 | #endif | 108 | #endif |
@@ -113,48 +110,44 @@ static unsigned char eval_char_literal(const char *s); | |||
113 | extern int yydebug; | 110 | extern int yydebug; |
114 | #endif | 111 | #endif |
115 | 112 | ||
116 | /* Tokens. */ | 113 | /* Token type. */ |
117 | #ifndef YYTOKENTYPE | 114 | #ifndef YYTOKENTYPE |
118 | # define YYTOKENTYPE | 115 | # define YYTOKENTYPE |
119 | /* Put the tokens into the symbol table, so that GDB and other debuggers | 116 | enum yytokentype |
120 | know about them. */ | 117 | { |
121 | enum yytokentype { | 118 | DT_V1 = 258, |
122 | DT_V1 = 258, | 119 | DT_MEMRESERVE = 259, |
123 | DT_MEMRESERVE = 259, | 120 | DT_LSHIFT = 260, |
124 | DT_LSHIFT = 260, | 121 | DT_RSHIFT = 261, |
125 | DT_RSHIFT = 261, | 122 | DT_LE = 262, |
126 | DT_LE = 262, | 123 | DT_GE = 263, |
127 | DT_GE = 263, | 124 | DT_EQ = 264, |
128 | DT_EQ = 264, | 125 | DT_NE = 265, |
129 | DT_NE = 265, | 126 | DT_AND = 266, |
130 | DT_AND = 266, | 127 | DT_OR = 267, |
131 | DT_OR = 267, | 128 | DT_BITS = 268, |
132 | DT_BITS = 268, | 129 | DT_DEL_PROP = 269, |
133 | DT_DEL_PROP = 269, | 130 | DT_DEL_NODE = 270, |
134 | DT_DEL_NODE = 270, | 131 | DT_PROPNODENAME = 271, |
135 | DT_PROPNODENAME = 271, | 132 | DT_LITERAL = 272, |
136 | DT_LITERAL = 272, | 133 | DT_CHAR_LITERAL = 273, |
137 | DT_CHAR_LITERAL = 273, | 134 | DT_BYTE = 274, |
138 | DT_BASE = 274, | 135 | DT_STRING = 275, |
139 | DT_BYTE = 275, | 136 | DT_LABEL = 276, |
140 | DT_STRING = 276, | 137 | DT_REF = 277, |
141 | DT_LABEL = 277, | 138 | DT_INCBIN = 278 |
142 | DT_REF = 278, | 139 | }; |
143 | DT_INCBIN = 279 | ||
144 | }; | ||
145 | #endif | 140 | #endif |
146 | 141 | ||
147 | 142 | /* Value type. */ | |
148 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | 143 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
149 | typedef union YYSTYPE | 144 | typedef union YYSTYPE YYSTYPE; |
145 | union YYSTYPE | ||
150 | { | 146 | { |
151 | /* Line 387 of yacc.c */ | 147 | #line 38 "dtc-parser.y" /* yacc.c:355 */ |
152 | #line 40 "dtc-parser.y" | ||
153 | 148 | ||
154 | char *propnodename; | 149 | char *propnodename; |
155 | char *literal; | ||
156 | char *labelref; | 150 | char *labelref; |
157 | unsigned int cbase; | ||
158 | uint8_t byte; | 151 | uint8_t byte; |
159 | struct data data; | 152 | struct data data; |
160 | 153 | ||
@@ -170,37 +163,36 @@ typedef union YYSTYPE | |||
170 | struct reserve_info *re; | 163 | struct reserve_info *re; |
171 | uint64_t integer; | 164 | uint64_t integer; |
172 | 165 | ||
173 | 166 | #line 167 "dtc-parser.tab.c" /* yacc.c:355 */ | |
174 | /* Line 387 of yacc.c */ | 167 | }; |
175 | #line 176 "dtc-parser.tab.c" | ||
176 | } YYSTYPE; | ||
177 | # define YYSTYPE_IS_TRIVIAL 1 | 168 | # define YYSTYPE_IS_TRIVIAL 1 |
178 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||
179 | # define YYSTYPE_IS_DECLARED 1 | 169 | # define YYSTYPE_IS_DECLARED 1 |
180 | #endif | 170 | #endif |
181 | 171 | ||
182 | extern YYSTYPE yylval; | 172 | /* Location type. */ |
183 | 173 | #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED | |
184 | #ifdef YYPARSE_PARAM | 174 | typedef struct YYLTYPE YYLTYPE; |
185 | #if defined __STDC__ || defined __cplusplus | 175 | struct YYLTYPE |
186 | int yyparse (void *YYPARSE_PARAM); | 176 | { |
187 | #else | 177 | int first_line; |
188 | int yyparse (); | 178 | int first_column; |
179 | int last_line; | ||
180 | int last_column; | ||
181 | }; | ||
182 | # define YYLTYPE_IS_DECLARED 1 | ||
183 | # define YYLTYPE_IS_TRIVIAL 1 | ||
189 | #endif | 184 | #endif |
190 | #else /* ! YYPARSE_PARAM */ | 185 | |
191 | #if defined __STDC__ || defined __cplusplus | 186 | |
187 | extern YYSTYPE yylval; | ||
188 | extern YYLTYPE yylloc; | ||
192 | int yyparse (void); | 189 | int yyparse (void); |
193 | #else | ||
194 | int yyparse (); | ||
195 | #endif | ||
196 | #endif /* ! YYPARSE_PARAM */ | ||
197 | 190 | ||
198 | #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ | 191 | #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ |
199 | 192 | ||
200 | /* Copy the second part of user declarations. */ | 193 | /* Copy the second part of user declarations. */ |
201 | 194 | ||
202 | /* Line 390 of yacc.c */ | 195 | #line 196 "dtc-parser.tab.c" /* yacc.c:358 */ |
203 | #line 204 "dtc-parser.tab.c" | ||
204 | 196 | ||
205 | #ifdef short | 197 | #ifdef short |
206 | # undef short | 198 | # undef short |
@@ -214,11 +206,8 @@ typedef unsigned char yytype_uint8; | |||
214 | 206 | ||
215 | #ifdef YYTYPE_INT8 | 207 | #ifdef YYTYPE_INT8 |
216 | typedef YYTYPE_INT8 yytype_int8; | 208 | typedef YYTYPE_INT8 yytype_int8; |
217 | #elif (defined __STDC__ || defined __C99__FUNC__ \ | ||
218 | || defined __cplusplus || defined _MSC_VER) | ||
219 | typedef signed char yytype_int8; | ||
220 | #else | 209 | #else |
221 | typedef short int yytype_int8; | 210 | typedef signed char yytype_int8; |
222 | #endif | 211 | #endif |
223 | 212 | ||
224 | #ifdef YYTYPE_UINT16 | 213 | #ifdef YYTYPE_UINT16 |
@@ -238,8 +227,7 @@ typedef short int yytype_int16; | |||
238 | # define YYSIZE_T __SIZE_TYPE__ | 227 | # define YYSIZE_T __SIZE_TYPE__ |
239 | # elif defined size_t | 228 | # elif defined size_t |
240 | # define YYSIZE_T size_t | 229 | # define YYSIZE_T size_t |
241 | # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ | 230 | # elif ! defined YYSIZE_T |
242 | || defined __cplusplus || defined _MSC_VER) | ||
243 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | 231 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
244 | # define YYSIZE_T size_t | 232 | # define YYSIZE_T size_t |
245 | # else | 233 | # else |
@@ -261,11 +249,30 @@ typedef short int yytype_int16; | |||
261 | # endif | 249 | # endif |
262 | #endif | 250 | #endif |
263 | 251 | ||
264 | #ifndef __attribute__ | 252 | #ifndef YY_ATTRIBUTE |
265 | /* This feature is available in gcc versions 2.5 and later. */ | 253 | # if (defined __GNUC__ \ |
266 | # if (! defined __GNUC__ || __GNUC__ < 2 \ | 254 | && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ |
267 | || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) | 255 | || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C |
268 | # define __attribute__(Spec) /* empty */ | 256 | # define YY_ATTRIBUTE(Spec) __attribute__(Spec) |
257 | # else | ||
258 | # define YY_ATTRIBUTE(Spec) /* empty */ | ||
259 | # endif | ||
260 | #endif | ||
261 | |||
262 | #ifndef YY_ATTRIBUTE_PURE | ||
263 | # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) | ||
264 | #endif | ||
265 | |||
266 | #ifndef YY_ATTRIBUTE_UNUSED | ||
267 | # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) | ||
268 | #endif | ||
269 | |||
270 | #if !defined _Noreturn \ | ||
271 | && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) | ||
272 | # if defined _MSC_VER && 1200 <= _MSC_VER | ||
273 | # define _Noreturn __declspec (noreturn) | ||
274 | # else | ||
275 | # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) | ||
269 | # endif | 276 | # endif |
270 | #endif | 277 | #endif |
271 | 278 | ||
@@ -276,25 +283,26 @@ typedef short int yytype_int16; | |||
276 | # define YYUSE(E) /* empty */ | 283 | # define YYUSE(E) /* empty */ |
277 | #endif | 284 | #endif |
278 | 285 | ||
279 | 286 | #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ | |
280 | /* Identity function, used to suppress warnings about constant conditions. */ | 287 | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
281 | #ifndef lint | 288 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
282 | # define YYID(N) (N) | 289 | _Pragma ("GCC diagnostic push") \ |
283 | #else | 290 | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ |
284 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 291 | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
285 | || defined __cplusplus || defined _MSC_VER) | 292 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ |
286 | static int | 293 | _Pragma ("GCC diagnostic pop") |
287 | YYID (int yyi) | ||
288 | #else | 294 | #else |
289 | static int | 295 | # define YY_INITIAL_VALUE(Value) Value |
290 | YYID (yyi) | ||
291 | int yyi; | ||
292 | #endif | 296 | #endif |
293 | { | 297 | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
294 | return yyi; | 298 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
295 | } | 299 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END |
300 | #endif | ||
301 | #ifndef YY_INITIAL_VALUE | ||
302 | # define YY_INITIAL_VALUE(Value) /* Nothing. */ | ||
296 | #endif | 303 | #endif |
297 | 304 | ||
305 | |||
298 | #if ! defined yyoverflow || YYERROR_VERBOSE | 306 | #if ! defined yyoverflow || YYERROR_VERBOSE |
299 | 307 | ||
300 | /* The parser invokes alloca or malloc; define the necessary symbols. */ | 308 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
@@ -312,8 +320,7 @@ YYID (yyi) | |||
312 | # define alloca _alloca | 320 | # define alloca _alloca |
313 | # else | 321 | # else |
314 | # define YYSTACK_ALLOC alloca | 322 | # define YYSTACK_ALLOC alloca |
315 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ | 323 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS |
316 | || defined __cplusplus || defined _MSC_VER) | ||
317 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | 324 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
318 | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ | 325 | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
319 | # ifndef EXIT_SUCCESS | 326 | # ifndef EXIT_SUCCESS |
@@ -325,8 +332,8 @@ YYID (yyi) | |||
325 | # endif | 332 | # endif |
326 | 333 | ||
327 | # ifdef YYSTACK_ALLOC | 334 | # ifdef YYSTACK_ALLOC |
328 | /* Pacify GCC's `empty if-body' warning. */ | 335 | /* Pacify GCC's 'empty if-body' warning. */ |
329 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) | 336 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
330 | # ifndef YYSTACK_ALLOC_MAXIMUM | 337 | # ifndef YYSTACK_ALLOC_MAXIMUM |
331 | /* The OS might guarantee only one guard page at the bottom of the stack, | 338 | /* The OS might guarantee only one guard page at the bottom of the stack, |
332 | and a page size can be as small as 4096 bytes. So we cannot safely | 339 | and a page size can be as small as 4096 bytes. So we cannot safely |
@@ -342,7 +349,7 @@ YYID (yyi) | |||
342 | # endif | 349 | # endif |
343 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ | 350 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
344 | && ! ((defined YYMALLOC || defined malloc) \ | 351 | && ! ((defined YYMALLOC || defined malloc) \ |
345 | && (defined YYFREE || defined free))) | 352 | && (defined YYFREE || defined free))) |
346 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | 353 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
347 | # ifndef EXIT_SUCCESS | 354 | # ifndef EXIT_SUCCESS |
348 | # define EXIT_SUCCESS 0 | 355 | # define EXIT_SUCCESS 0 |
@@ -350,15 +357,13 @@ YYID (yyi) | |||
350 | # endif | 357 | # endif |
351 | # ifndef YYMALLOC | 358 | # ifndef YYMALLOC |
352 | # define YYMALLOC malloc | 359 | # define YYMALLOC malloc |
353 | # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ | 360 | # if ! defined malloc && ! defined EXIT_SUCCESS |
354 | || defined __cplusplus || defined _MSC_VER) | ||
355 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ | 361 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
356 | # endif | 362 | # endif |
357 | # endif | 363 | # endif |
358 | # ifndef YYFREE | 364 | # ifndef YYFREE |
359 | # define YYFREE free | 365 | # define YYFREE free |
360 | # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ | 366 | # if ! defined free && ! defined EXIT_SUCCESS |
361 | || defined __cplusplus || defined _MSC_VER) | ||
362 | void free (void *); /* INFRINGES ON USER NAME SPACE */ | 367 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
363 | # endif | 368 | # endif |
364 | # endif | 369 | # endif |
@@ -368,13 +373,15 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ | |||
368 | 373 | ||
369 | #if (! defined yyoverflow \ | 374 | #if (! defined yyoverflow \ |
370 | && (! defined __cplusplus \ | 375 | && (! defined __cplusplus \ |
371 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) | 376 | || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ |
377 | && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) | ||
372 | 378 | ||
373 | /* A type that is properly aligned for any stack member. */ | 379 | /* A type that is properly aligned for any stack member. */ |
374 | union yyalloc | 380 | union yyalloc |
375 | { | 381 | { |
376 | yytype_int16 yyss_alloc; | 382 | yytype_int16 yyss_alloc; |
377 | YYSTYPE yyvs_alloc; | 383 | YYSTYPE yyvs_alloc; |
384 | YYLTYPE yyls_alloc; | ||
378 | }; | 385 | }; |
379 | 386 | ||
380 | /* The size of the maximum gap between one aligned stack and the next. */ | 387 | /* The size of the maximum gap between one aligned stack and the next. */ |
@@ -383,8 +390,8 @@ union yyalloc | |||
383 | /* The size of an array large to enough to hold all stacks, each with | 390 | /* The size of an array large to enough to hold all stacks, each with |
384 | N elements. */ | 391 | N elements. */ |
385 | # define YYSTACK_BYTES(N) \ | 392 | # define YYSTACK_BYTES(N) \ |
386 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ | 393 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ |
387 | + YYSTACK_GAP_MAXIMUM) | 394 | + 2 * YYSTACK_GAP_MAXIMUM) |
388 | 395 | ||
389 | # define YYCOPY_NEEDED 1 | 396 | # define YYCOPY_NEEDED 1 |
390 | 397 | ||
@@ -393,16 +400,16 @@ union yyalloc | |||
393 | elements in the stack, and YYPTR gives the new location of the | 400 | elements in the stack, and YYPTR gives the new location of the |
394 | stack. Advance YYPTR to a properly aligned location for the next | 401 | stack. Advance YYPTR to a properly aligned location for the next |
395 | stack. */ | 402 | stack. */ |
396 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ | 403 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
397 | do \ | 404 | do \ |
398 | { \ | 405 | { \ |
399 | YYSIZE_T yynewbytes; \ | 406 | YYSIZE_T yynewbytes; \ |
400 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ | 407 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
401 | Stack = &yyptr->Stack_alloc; \ | 408 | Stack = &yyptr->Stack_alloc; \ |
402 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | 409 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
403 | yyptr += yynewbytes / sizeof (*yyptr); \ | 410 | yyptr += yynewbytes / sizeof (*yyptr); \ |
404 | } \ | 411 | } \ |
405 | while (YYID (0)) | 412 | while (0) |
406 | 413 | ||
407 | #endif | 414 | #endif |
408 | 415 | ||
@@ -421,7 +428,7 @@ union yyalloc | |||
421 | for (yyi = 0; yyi < (Count); yyi++) \ | 428 | for (yyi = 0; yyi < (Count); yyi++) \ |
422 | (Dst)[yyi] = (Src)[yyi]; \ | 429 | (Dst)[yyi] = (Src)[yyi]; \ |
423 | } \ | 430 | } \ |
424 | while (YYID (0)) | 431 | while (0) |
425 | # endif | 432 | # endif |
426 | # endif | 433 | # endif |
427 | #endif /* !YYCOPY_NEEDED */ | 434 | #endif /* !YYCOPY_NEEDED */ |
@@ -429,40 +436,42 @@ union yyalloc | |||
429 | /* YYFINAL -- State number of the termination state. */ | 436 | /* YYFINAL -- State number of the termination state. */ |
430 | #define YYFINAL 4 | 437 | #define YYFINAL 4 |
431 | /* YYLAST -- Last index in YYTABLE. */ | 438 | /* YYLAST -- Last index in YYTABLE. */ |
432 | #define YYLAST 133 | 439 | #define YYLAST 136 |
433 | 440 | ||
434 | /* YYNTOKENS -- Number of terminals. */ | 441 | /* YYNTOKENS -- Number of terminals. */ |
435 | #define YYNTOKENS 48 | 442 | #define YYNTOKENS 47 |
436 | /* YYNNTS -- Number of nonterminals. */ | 443 | /* YYNNTS -- Number of nonterminals. */ |
437 | #define YYNNTS 28 | 444 | #define YYNNTS 28 |
438 | /* YYNRULES -- Number of rules. */ | 445 | /* YYNRULES -- Number of rules. */ |
439 | #define YYNRULES 79 | 446 | #define YYNRULES 80 |
440 | /* YYNRULES -- Number of states. */ | 447 | /* YYNSTATES -- Number of states. */ |
441 | #define YYNSTATES 141 | 448 | #define YYNSTATES 144 |
442 | 449 | ||
443 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | 450 | /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned |
451 | by yylex, with out-of-bounds checking. */ | ||
444 | #define YYUNDEFTOK 2 | 452 | #define YYUNDEFTOK 2 |
445 | #define YYMAXUTOK 279 | 453 | #define YYMAXUTOK 278 |
446 | 454 | ||
447 | #define YYTRANSLATE(YYX) \ | 455 | #define YYTRANSLATE(YYX) \ |
448 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | 456 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
449 | 457 | ||
450 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ | 458 | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
459 | as returned by yylex, without out-of-bounds checking. */ | ||
451 | static const yytype_uint8 yytranslate[] = | 460 | static const yytype_uint8 yytranslate[] = |
452 | { | 461 | { |
453 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 462 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
454 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 463 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
455 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 464 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
456 | 2, 2, 2, 47, 2, 2, 2, 45, 41, 2, | 465 | 2, 2, 2, 46, 2, 2, 2, 44, 40, 2, |
457 | 33, 35, 44, 42, 34, 43, 2, 26, 2, 2, | 466 | 32, 34, 43, 41, 33, 42, 2, 25, 2, 2, |
458 | 2, 2, 2, 2, 2, 2, 2, 2, 38, 25, | 467 | 2, 2, 2, 2, 2, 2, 2, 2, 37, 24, |
459 | 36, 29, 30, 37, 2, 2, 2, 2, 2, 2, | 468 | 35, 28, 29, 36, 2, 2, 2, 2, 2, 2, |
460 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 469 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
461 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 470 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
462 | 2, 31, 2, 32, 40, 2, 2, 2, 2, 2, | 471 | 2, 30, 2, 31, 39, 2, 2, 2, 2, 2, |
463 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 472 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
464 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 473 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
465 | 2, 2, 2, 27, 39, 28, 46, 2, 2, 2, | 474 | 2, 2, 2, 26, 38, 27, 45, 2, 2, 2, |
466 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 475 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
467 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 476 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
468 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 477 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
@@ -477,67 +486,22 @@ static const yytype_uint8 yytranslate[] = | |||
477 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 486 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
478 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | 487 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
479 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | 488 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
480 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 | 489 | 15, 16, 17, 18, 19, 20, 21, 22, 23 |
481 | }; | 490 | }; |
482 | 491 | ||
483 | #if YYDEBUG | 492 | #if YYDEBUG |
484 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in | 493 | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
485 | YYRHS. */ | ||
486 | static const yytype_uint16 yyprhs[] = | ||
487 | { | ||
488 | 0, 0, 3, 8, 9, 12, 17, 20, 23, 27, | ||
489 | 31, 36, 42, 43, 46, 51, 54, 58, 61, 64, | ||
490 | 68, 73, 76, 86, 92, 95, 96, 99, 102, 106, | ||
491 | 108, 111, 114, 117, 119, 121, 125, 127, 129, 135, | ||
492 | 137, 141, 143, 147, 149, 153, 155, 159, 161, 165, | ||
493 | 167, 171, 175, 177, 181, 185, 189, 193, 197, 201, | ||
494 | 203, 207, 211, 213, 217, 221, 225, 227, 229, 232, | ||
495 | 235, 238, 239, 242, 245, 246, 249, 252, 255, 259 | ||
496 | }; | ||
497 | |||
498 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | ||
499 | static const yytype_int8 yyrhs[] = | ||
500 | { | ||
501 | 49, 0, -1, 3, 25, 50, 52, -1, -1, 51, | ||
502 | 50, -1, 4, 59, 59, 25, -1, 22, 51, -1, | ||
503 | 26, 53, -1, 52, 26, 53, -1, 52, 23, 53, | ||
504 | -1, 52, 15, 23, 25, -1, 27, 54, 74, 28, | ||
505 | 25, -1, -1, 54, 55, -1, 16, 29, 56, 25, | ||
506 | -1, 16, 25, -1, 14, 16, 25, -1, 22, 55, | ||
507 | -1, 57, 21, -1, 57, 58, 30, -1, 57, 31, | ||
508 | 73, 32, -1, 57, 23, -1, 57, 24, 33, 21, | ||
509 | 34, 59, 34, 59, 35, -1, 57, 24, 33, 21, | ||
510 | 35, -1, 56, 22, -1, -1, 56, 34, -1, 57, | ||
511 | 22, -1, 13, 17, 36, -1, 36, -1, 58, 59, | ||
512 | -1, 58, 23, -1, 58, 22, -1, 17, -1, 18, | ||
513 | -1, 33, 60, 35, -1, 61, -1, 62, -1, 62, | ||
514 | 37, 60, 38, 61, -1, 63, -1, 62, 12, 63, | ||
515 | -1, 64, -1, 63, 11, 64, -1, 65, -1, 64, | ||
516 | 39, 65, -1, 66, -1, 65, 40, 66, -1, 67, | ||
517 | -1, 66, 41, 67, -1, 68, -1, 67, 9, 68, | ||
518 | -1, 67, 10, 68, -1, 69, -1, 68, 36, 69, | ||
519 | -1, 68, 30, 69, -1, 68, 7, 69, -1, 68, | ||
520 | 8, 69, -1, 69, 5, 70, -1, 69, 6, 70, | ||
521 | -1, 70, -1, 70, 42, 71, -1, 70, 43, 71, | ||
522 | -1, 71, -1, 71, 44, 72, -1, 71, 26, 72, | ||
523 | -1, 71, 45, 72, -1, 72, -1, 59, -1, 43, | ||
524 | 72, -1, 46, 72, -1, 47, 72, -1, -1, 73, | ||
525 | 20, -1, 73, 22, -1, -1, 75, 74, -1, 75, | ||
526 | 55, -1, 16, 53, -1, 15, 16, 25, -1, 22, | ||
527 | 75, -1 | ||
528 | }; | ||
529 | |||
530 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | ||
531 | static const yytype_uint16 yyrline[] = | 494 | static const yytype_uint16 yyrline[] = |
532 | { | 495 | { |
533 | 0, 109, 109, 118, 121, 128, 132, 140, 144, 148, | 496 | 0, 104, 104, 113, 116, 123, 127, 135, 139, 144, |
534 | 158, 172, 180, 183, 190, 194, 198, 202, 210, 214, | 497 | 155, 165, 180, 188, 191, 198, 202, 206, 210, 218, |
535 | 218, 222, 226, 243, 253, 261, 264, 268, 275, 290, | 498 | 222, 226, 230, 234, 250, 260, 268, 271, 275, 282, |
536 | 295, 315, 329, 336, 340, 344, 351, 355, 356, 360, | 499 | 298, 303, 322, 336, 343, 344, 345, 352, 356, 357, |
537 | 361, 365, 366, 370, 371, 375, 376, 380, 381, 385, | 500 | 361, 362, 366, 367, 371, 372, 376, 377, 381, 382, |
538 | 386, 387, 391, 392, 393, 394, 395, 399, 400, 401, | 501 | 386, 387, 388, 392, 393, 394, 395, 396, 400, 401, |
539 | 405, 406, 407, 411, 412, 413, 414, 418, 419, 420, | 502 | 402, 406, 407, 408, 412, 413, 414, 415, 419, 420, |
540 | 421, 426, 429, 433, 441, 444, 448, 456, 460, 464 | 503 | 421, 422, 427, 430, 434, 442, 445, 449, 457, 461, |
504 | 465 | ||
541 | }; | 505 | }; |
542 | #endif | 506 | #endif |
543 | 507 | ||
@@ -549,209 +513,199 @@ static const char *const yytname[] = | |||
549 | "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT", | 513 | "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT", |
550 | "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR", | 514 | "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR", |
551 | "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL", | 515 | "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL", |
552 | "DT_CHAR_LITERAL", "DT_BASE", "DT_BYTE", "DT_STRING", "DT_LABEL", | 516 | "DT_CHAR_LITERAL", "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", |
553 | "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", | 517 | "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", "']'", |
554 | "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", | 518 | "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", "'+'", |
555 | "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", | 519 | "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", |
556 | "memreserves", "memreserve", "devicetree", "nodedef", "proplist", | 520 | "memreserves", "memreserve", "devicetree", "nodedef", "proplist", |
557 | "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim", | 521 | "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim", |
558 | "integer_expr", "integer_trinary", "integer_or", "integer_and", | 522 | "integer_expr", "integer_trinary", "integer_or", "integer_and", |
559 | "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq", | 523 | "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq", |
560 | "integer_rela", "integer_shift", "integer_add", "integer_mul", | 524 | "integer_rela", "integer_shift", "integer_add", "integer_mul", |
561 | "integer_unary", "bytestring", "subnodes", "subnode", YY_NULL | 525 | "integer_unary", "bytestring", "subnodes", "subnode", YY_NULLPTR |
562 | }; | 526 | }; |
563 | #endif | 527 | #endif |
564 | 528 | ||
565 | # ifdef YYPRINT | 529 | # ifdef YYPRINT |
566 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to | 530 | /* YYTOKNUM[NUM] -- (External) token number corresponding to the |
567 | token YYLEX-NUM. */ | 531 | (internal) symbol number NUM (which must be that of a token). */ |
568 | static const yytype_uint16 yytoknum[] = | 532 | static const yytype_uint16 yytoknum[] = |
569 | { | 533 | { |
570 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | 534 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
571 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | 535 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
572 | 275, 276, 277, 278, 279, 59, 47, 123, 125, 61, | 536 | 275, 276, 277, 278, 59, 47, 123, 125, 61, 62, |
573 | 62, 91, 93, 40, 44, 41, 60, 63, 58, 124, | 537 | 91, 93, 40, 44, 41, 60, 63, 58, 124, 94, |
574 | 94, 38, 43, 45, 42, 37, 126, 33 | 538 | 38, 43, 45, 42, 37, 126, 33 |
575 | }; | 539 | }; |
576 | # endif | 540 | # endif |
577 | 541 | ||
578 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | 542 | #define YYPACT_NINF -81 |
579 | static const yytype_uint8 yyr1[] = | ||
580 | { | ||
581 | 0, 48, 49, 50, 50, 51, 51, 52, 52, 52, | ||
582 | 52, 53, 54, 54, 55, 55, 55, 55, 56, 56, | ||
583 | 56, 56, 56, 56, 56, 57, 57, 57, 58, 58, | ||
584 | 58, 58, 58, 59, 59, 59, 60, 61, 61, 62, | ||
585 | 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, | ||
586 | 67, 67, 68, 68, 68, 68, 68, 69, 69, 69, | ||
587 | 70, 70, 70, 71, 71, 71, 71, 72, 72, 72, | ||
588 | 72, 73, 73, 73, 74, 74, 74, 75, 75, 75 | ||
589 | }; | ||
590 | 543 | ||
591 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | 544 | #define yypact_value_is_default(Yystate) \ |
592 | static const yytype_uint8 yyr2[] = | 545 | (!!((Yystate) == (-81))) |
546 | |||
547 | #define YYTABLE_NINF -1 | ||
548 | |||
549 | #define yytable_value_is_error(Yytable_value) \ | ||
550 | 0 | ||
551 | |||
552 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | ||
553 | STATE-NUM. */ | ||
554 | static const yytype_int8 yypact[] = | ||
593 | { | 555 | { |
594 | 0, 2, 4, 0, 2, 4, 2, 2, 3, 3, | 556 | 16, -11, 21, 10, -81, 25, 10, 19, 10, -81, |
595 | 4, 5, 0, 2, 4, 2, 3, 2, 2, 3, | 557 | -81, -9, 25, -81, 2, 51, -81, -9, -9, -9, |
596 | 4, 2, 9, 5, 2, 0, 2, 2, 3, 1, | 558 | -81, 1, -81, -6, 50, 14, 28, 29, 36, 3, |
597 | 2, 2, 2, 1, 1, 3, 1, 1, 5, 1, | 559 | 58, 44, -3, -81, 47, -81, -81, 65, 68, 2, |
598 | 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, | 560 | 2, -81, -81, -81, -81, -9, -9, -9, -9, -9, |
599 | 3, 3, 1, 3, 3, 3, 3, 3, 3, 1, | 561 | -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, |
600 | 3, 3, 1, 3, 3, 3, 1, 1, 2, 2, | 562 | -9, -9, -9, -9, -81, 63, 69, 2, -81, -81, |
601 | 2, 0, 2, 2, 0, 2, 2, 2, 3, 2 | 563 | 50, 57, 14, 28, 29, 36, 3, 3, 58, 58, |
564 | 58, 58, 44, 44, -3, -3, -81, -81, -81, 79, | ||
565 | 80, -8, 63, -81, 72, 63, -81, -81, -9, 76, | ||
566 | 77, -81, -81, -81, -81, -81, 78, -81, -81, -81, | ||
567 | -81, -81, 35, 4, -81, -81, -81, -81, 86, -81, | ||
568 | -81, -81, 73, -81, -81, 33, 71, 84, 39, -81, | ||
569 | -81, -81, -81, -81, 41, -81, -81, -81, 25, -81, | ||
570 | 74, 25, 75, -81 | ||
602 | }; | 571 | }; |
603 | 572 | ||
604 | /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. | 573 | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
605 | Performed when YYTABLE doesn't specify something else to do. Zero | 574 | Performed when YYTABLE does not specify something else to do. Zero |
606 | means the default is an error. */ | 575 | means the default is an error. */ |
607 | static const yytype_uint8 yydefact[] = | 576 | static const yytype_uint8 yydefact[] = |
608 | { | 577 | { |
609 | 0, 0, 0, 3, 1, 0, 0, 0, 3, 33, | 578 | 0, 0, 0, 3, 1, 0, 0, 0, 3, 34, |
610 | 34, 0, 0, 6, 0, 2, 4, 0, 0, 0, | 579 | 35, 0, 0, 6, 0, 2, 4, 0, 0, 0, |
611 | 67, 0, 36, 37, 39, 41, 43, 45, 47, 49, | 580 | 68, 0, 37, 38, 40, 42, 44, 46, 48, 50, |
612 | 52, 59, 62, 66, 0, 12, 7, 0, 0, 0, | 581 | 53, 60, 63, 67, 0, 13, 7, 0, 0, 0, |
613 | 68, 69, 70, 35, 0, 0, 0, 0, 0, 0, | 582 | 0, 69, 70, 71, 36, 0, 0, 0, 0, 0, |
614 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 583 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
615 | 0, 0, 0, 5, 74, 0, 9, 8, 40, 0, | 584 | 0, 0, 0, 0, 5, 75, 0, 0, 10, 8, |
616 | 42, 44, 46, 48, 50, 51, 55, 56, 54, 53, | 585 | 41, 0, 43, 45, 47, 49, 51, 52, 56, 57, |
617 | 57, 58, 60, 61, 64, 63, 65, 0, 0, 0, | 586 | 55, 54, 58, 59, 61, 62, 65, 64, 66, 0, |
618 | 0, 13, 0, 74, 10, 0, 0, 0, 15, 25, | 587 | 0, 0, 0, 14, 0, 75, 11, 9, 0, 0, |
619 | 77, 17, 79, 0, 76, 75, 38, 16, 78, 0, | 588 | 0, 16, 26, 78, 18, 80, 0, 77, 76, 39, |
620 | 0, 11, 24, 14, 26, 0, 18, 27, 21, 0, | 589 | 17, 79, 0, 0, 12, 25, 15, 27, 0, 19, |
621 | 71, 29, 0, 0, 0, 0, 32, 31, 19, 30, | 590 | 28, 22, 0, 72, 30, 0, 0, 0, 0, 33, |
622 | 28, 0, 72, 73, 20, 0, 23, 0, 0, 0, | 591 | 32, 20, 31, 29, 0, 73, 74, 21, 0, 24, |
623 | 22 | 592 | 0, 0, 0, 23 |
624 | }; | 593 | }; |
625 | 594 | ||
626 | /* YYDEFGOTO[NTERM-NUM]. */ | 595 | /* YYPGOTO[NTERM-NUM]. */ |
627 | static const yytype_int8 yydefgoto[] = | 596 | static const yytype_int8 yypgoto[] = |
628 | { | 597 | { |
629 | -1, 2, 7, 8, 15, 36, 64, 91, 109, 110, | 598 | -81, -81, 100, 104, -81, -38, -81, -80, -81, -81, |
630 | 122, 20, 21, 22, 23, 24, 25, 26, 27, 28, | 599 | -81, -5, 66, 13, -81, 70, 67, 81, 64, 82, |
631 | 29, 30, 31, 32, 33, 125, 92, 93 | 600 | 37, 27, 34, 38, -14, -81, 22, 24 |
632 | }; | 601 | }; |
633 | 602 | ||
634 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | 603 | /* YYDEFGOTO[NTERM-NUM]. */ |
635 | STATE-NUM. */ | 604 | static const yytype_int16 yydefgoto[] = |
636 | #define YYPACT_NINF -78 | ||
637 | static const yytype_int8 yypact[] = | ||
638 | { | 605 | { |
639 | 22, 11, 51, 10, -78, 23, 10, 2, 10, -78, | 606 | -1, 2, 7, 8, 15, 36, 65, 93, 112, 113, |
640 | -78, -9, 23, -78, 30, 38, -78, -9, -9, -9, | 607 | 125, 20, 21, 22, 23, 24, 25, 26, 27, 28, |
641 | -78, 35, -78, -6, 52, 29, 48, 49, 33, 3, | 608 | 29, 30, 31, 32, 33, 128, 94, 95 |
642 | 71, 36, 0, -78, 64, -78, -78, 68, 30, 30, | ||
643 | -78, -78, -78, -78, -9, -9, -9, -9, -9, -9, | ||
644 | -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, | ||
645 | -9, -9, -9, -78, 44, 67, -78, -78, 52, 55, | ||
646 | 29, 48, 49, 33, 3, 3, 71, 71, 71, 71, | ||
647 | 36, 36, 0, 0, -78, -78, -78, 78, 79, 42, | ||
648 | 44, -78, 69, 44, -78, -9, 73, 74, -78, -78, | ||
649 | -78, -78, -78, 75, -78, -78, -78, -78, -78, -7, | ||
650 | -1, -78, -78, -78, -78, 84, -78, -78, -78, 63, | ||
651 | -78, -78, 32, 66, 82, -3, -78, -78, -78, -78, | ||
652 | -78, 46, -78, -78, -78, 23, -78, 70, 23, 72, | ||
653 | -78 | ||
654 | }; | 609 | }; |
655 | 610 | ||
656 | /* YYPGOTO[NTERM-NUM]. */ | 611 | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
657 | static const yytype_int8 yypgoto[] = | 612 | positive, shift that token. If negative, reduce the rule whose |
613 | number is the opposite. If YYTABLE_NINF, syntax error. */ | ||
614 | static const yytype_uint8 yytable[] = | ||
658 | { | 615 | { |
659 | -78, -78, 97, 100, -78, -37, -78, -77, -78, -78, | 616 | 12, 68, 69, 41, 42, 43, 45, 34, 9, 10, |
660 | -78, -5, 65, 13, -78, 76, 77, 62, 80, 83, | 617 | 53, 54, 104, 3, 5, 107, 101, 118, 35, 1, |
661 | 34, 20, 26, 28, -14, -78, 18, 24 | 618 | 102, 4, 61, 11, 119, 120, 121, 122, 35, 97, |
619 | 46, 6, 55, 17, 123, 44, 18, 19, 56, 124, | ||
620 | 62, 63, 9, 10, 14, 51, 52, 86, 87, 88, | ||
621 | 9, 10, 48, 103, 129, 130, 115, 11, 135, 116, | ||
622 | 136, 47, 131, 57, 58, 11, 37, 49, 117, 50, | ||
623 | 137, 64, 38, 39, 138, 139, 40, 89, 90, 91, | ||
624 | 78, 79, 80, 81, 92, 59, 60, 66, 76, 77, | ||
625 | 67, 82, 83, 96, 98, 99, 100, 84, 85, 106, | ||
626 | 110, 111, 114, 126, 134, 127, 133, 141, 16, 143, | ||
627 | 13, 109, 71, 74, 72, 70, 105, 108, 0, 0, | ||
628 | 132, 0, 0, 0, 0, 0, 0, 0, 0, 73, | ||
629 | 0, 0, 75, 140, 0, 0, 142 | ||
662 | }; | 630 | }; |
663 | 631 | ||
664 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | 632 | static const yytype_int16 yycheck[] = |
665 | positive, shift that token. If negative, reduce the rule which | ||
666 | number is the opposite. If YYTABLE_NINF, syntax error. */ | ||
667 | #define YYTABLE_NINF -1 | ||
668 | static const yytype_uint8 yytable[] = | ||
669 | { | 633 | { |
670 | 12, 66, 67, 40, 41, 42, 44, 34, 9, 10, | 634 | 5, 39, 40, 17, 18, 19, 12, 12, 17, 18, |
671 | 52, 53, 115, 101, 5, 112, 104, 132, 113, 133, | 635 | 7, 8, 92, 24, 4, 95, 24, 13, 26, 3, |
672 | 116, 117, 118, 119, 11, 1, 60, 114, 14, 134, | 636 | 28, 0, 25, 32, 20, 21, 22, 23, 26, 67, |
673 | 120, 45, 6, 54, 17, 121, 3, 18, 19, 55, | 637 | 36, 21, 29, 42, 30, 34, 45, 46, 35, 35, |
674 | 9, 10, 50, 51, 61, 62, 84, 85, 86, 9, | 638 | 43, 44, 17, 18, 25, 9, 10, 61, 62, 63, |
675 | 10, 4, 100, 37, 126, 127, 11, 35, 87, 88, | 639 | 17, 18, 38, 91, 21, 22, 21, 32, 19, 24, |
676 | 89, 38, 128, 46, 39, 11, 90, 98, 47, 35, | 640 | 21, 11, 29, 5, 6, 32, 15, 39, 33, 40, |
677 | 43, 99, 76, 77, 78, 79, 56, 57, 58, 59, | 641 | 31, 24, 21, 22, 33, 34, 25, 14, 15, 16, |
678 | 135, 136, 80, 81, 74, 75, 82, 83, 48, 63, | 642 | 53, 54, 55, 56, 21, 41, 42, 22, 51, 52, |
679 | 49, 65, 94, 95, 96, 97, 124, 103, 107, 108, | 643 | 22, 57, 58, 24, 37, 16, 16, 59, 60, 27, |
680 | 111, 123, 130, 131, 138, 16, 13, 140, 106, 71, | 644 | 24, 24, 24, 17, 20, 32, 35, 33, 8, 34, |
681 | 69, 105, 0, 0, 102, 0, 0, 129, 0, 0, | 645 | 6, 98, 46, 49, 47, 45, 92, 95, -1, -1, |
682 | 68, 0, 0, 70, 0, 0, 0, 0, 72, 0, | 646 | 125, -1, -1, -1, -1, -1, -1, -1, -1, 48, |
683 | 137, 0, 73, 139 | 647 | -1, -1, 50, 138, -1, -1, 141 |
684 | }; | 648 | }; |
685 | 649 | ||
686 | #define yypact_value_is_default(Yystate) \ | 650 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
687 | (!!((Yystate) == (-78))) | 651 | symbol of state STATE-NUM. */ |
688 | 652 | static const yytype_uint8 yystos[] = | |
689 | #define yytable_value_is_error(Yytable_value) \ | 653 | { |
690 | YYID (0) | 654 | 0, 3, 48, 24, 0, 4, 21, 49, 50, 17, |
655 | 18, 32, 58, 50, 25, 51, 49, 42, 45, 46, | ||
656 | 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, | ||
657 | 68, 69, 70, 71, 58, 26, 52, 15, 21, 22, | ||
658 | 25, 71, 71, 71, 34, 12, 36, 11, 38, 39, | ||
659 | 40, 9, 10, 7, 8, 29, 35, 5, 6, 41, | ||
660 | 42, 25, 43, 44, 24, 53, 22, 22, 52, 52, | ||
661 | 62, 59, 63, 64, 65, 66, 67, 67, 68, 68, | ||
662 | 68, 68, 69, 69, 70, 70, 71, 71, 71, 14, | ||
663 | 15, 16, 21, 54, 73, 74, 24, 52, 37, 16, | ||
664 | 16, 24, 28, 52, 54, 74, 27, 54, 73, 60, | ||
665 | 24, 24, 55, 56, 24, 21, 24, 33, 13, 20, | ||
666 | 21, 22, 23, 30, 35, 57, 17, 32, 72, 21, | ||
667 | 22, 29, 58, 35, 20, 19, 21, 31, 33, 34, | ||
668 | 58, 33, 58, 34 | ||
669 | }; | ||
691 | 670 | ||
692 | static const yytype_int16 yycheck[] = | 671 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
672 | static const yytype_uint8 yyr1[] = | ||
693 | { | 673 | { |
694 | 5, 38, 39, 17, 18, 19, 12, 12, 17, 18, | 674 | 0, 47, 48, 49, 49, 50, 50, 51, 51, 51, |
695 | 7, 8, 13, 90, 4, 22, 93, 20, 25, 22, | 675 | 51, 51, 52, 53, 53, 54, 54, 54, 54, 55, |
696 | 21, 22, 23, 24, 33, 3, 26, 34, 26, 32, | 676 | 55, 55, 55, 55, 55, 55, 56, 56, 56, 57, |
697 | 31, 37, 22, 30, 43, 36, 25, 46, 47, 36, | 677 | 57, 57, 57, 57, 58, 58, 58, 59, 60, 60, |
698 | 17, 18, 9, 10, 44, 45, 60, 61, 62, 17, | 678 | 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, |
699 | 18, 0, 89, 15, 22, 23, 33, 27, 14, 15, | 679 | 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, |
700 | 16, 23, 30, 11, 26, 33, 22, 25, 39, 27, | 680 | 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, |
701 | 35, 29, 52, 53, 54, 55, 5, 6, 42, 43, | 681 | 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, |
702 | 34, 35, 56, 57, 50, 51, 58, 59, 40, 25, | 682 | 74 |
703 | 41, 23, 25, 38, 16, 16, 33, 28, 25, 25, | ||
704 | 25, 17, 36, 21, 34, 8, 6, 35, 95, 47, | ||
705 | 45, 93, -1, -1, 90, -1, -1, 122, -1, -1, | ||
706 | 44, -1, -1, 46, -1, -1, -1, -1, 48, -1, | ||
707 | 135, -1, 49, 138 | ||
708 | }; | 683 | }; |
709 | 684 | ||
710 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | 685 | /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ |
711 | symbol of state STATE-NUM. */ | 686 | static const yytype_uint8 yyr2[] = |
712 | static const yytype_uint8 yystos[] = | ||
713 | { | 687 | { |
714 | 0, 3, 49, 25, 0, 4, 22, 50, 51, 17, | 688 | 0, 2, 4, 0, 2, 4, 2, 2, 3, 4, |
715 | 18, 33, 59, 51, 26, 52, 50, 43, 46, 47, | 689 | 3, 4, 5, 0, 2, 4, 2, 3, 2, 2, |
716 | 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, | 690 | 3, 4, 2, 9, 5, 2, 0, 2, 2, 3, |
717 | 69, 70, 71, 72, 59, 27, 53, 15, 23, 26, | 691 | 1, 2, 2, 2, 1, 1, 3, 1, 1, 5, |
718 | 72, 72, 72, 35, 12, 37, 11, 39, 40, 41, | 692 | 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, |
719 | 9, 10, 7, 8, 30, 36, 5, 6, 42, 43, | 693 | 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, |
720 | 26, 44, 45, 25, 54, 23, 53, 53, 63, 60, | 694 | 1, 3, 3, 1, 3, 3, 3, 1, 1, 2, |
721 | 64, 65, 66, 67, 68, 68, 69, 69, 69, 69, | 695 | 2, 2, 0, 2, 2, 0, 2, 2, 2, 3, |
722 | 70, 70, 71, 71, 72, 72, 72, 14, 15, 16, | 696 | 2 |
723 | 22, 55, 74, 75, 25, 38, 16, 16, 25, 29, | ||
724 | 53, 55, 75, 28, 55, 74, 61, 25, 25, 56, | ||
725 | 57, 25, 22, 25, 34, 13, 21, 22, 23, 24, | ||
726 | 31, 36, 58, 17, 33, 73, 22, 23, 30, 59, | ||
727 | 36, 21, 20, 22, 32, 34, 35, 59, 34, 59, | ||
728 | 35 | ||
729 | }; | 697 | }; |
730 | 698 | ||
731 | #define yyerrok (yyerrstatus = 0) | 699 | |
732 | #define yyclearin (yychar = YYEMPTY) | 700 | #define yyerrok (yyerrstatus = 0) |
733 | #define YYEMPTY (-2) | 701 | #define yyclearin (yychar = YYEMPTY) |
734 | #define YYEOF 0 | 702 | #define YYEMPTY (-2) |
735 | 703 | #define YYEOF 0 | |
736 | #define YYACCEPT goto yyacceptlab | 704 | |
737 | #define YYABORT goto yyabortlab | 705 | #define YYACCEPT goto yyacceptlab |
738 | #define YYERROR goto yyerrorlab | 706 | #define YYABORT goto yyabortlab |
739 | 707 | #define YYERROR goto yyerrorlab | |
740 | 708 | ||
741 | /* Like YYERROR except do call yyerror. This remains here temporarily | ||
742 | to ease the transition to the new meaning of YYERROR, for GCC. | ||
743 | Once GCC version 2 has supplanted version 1, this can go. However, | ||
744 | YYFAIL appears to be in use. Nevertheless, it is formally deprecated | ||
745 | in Bison 2.4.2's NEWS entry, where a plan to phase it out is | ||
746 | discussed. */ | ||
747 | |||
748 | #define YYFAIL goto yyerrlab | ||
749 | #if defined YYFAIL | ||
750 | /* This is here to suppress warnings from the GCC cpp's | ||
751 | -Wunused-macros. Normally we don't worry about that warning, but | ||
752 | some users do, and we want to make it easy for users to remove | ||
753 | YYFAIL uses, which will produce warnings from Bison 2.5. */ | ||
754 | #endif | ||
755 | 709 | ||
756 | #define YYRECOVERING() (!!yyerrstatus) | 710 | #define YYRECOVERING() (!!yyerrstatus) |
757 | 711 | ||
@@ -768,27 +722,41 @@ do \ | |||
768 | else \ | 722 | else \ |
769 | { \ | 723 | { \ |
770 | yyerror (YY_("syntax error: cannot back up")); \ | 724 | yyerror (YY_("syntax error: cannot back up")); \ |
771 | YYERROR; \ | 725 | YYERROR; \ |
772 | } \ | 726 | } \ |
773 | while (YYID (0)) | 727 | while (0) |
774 | 728 | ||
775 | /* Error token number */ | 729 | /* Error token number */ |
776 | #define YYTERROR 1 | 730 | #define YYTERROR 1 |
777 | #define YYERRCODE 256 | 731 | #define YYERRCODE 256 |
778 | 732 | ||
779 | 733 | ||
780 | /* This macro is provided for backward compatibility. */ | 734 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
781 | #ifndef YY_LOCATION_PRINT | 735 | If N is 0, then set CURRENT to the empty location which ends |
782 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | 736 | the previous symbol: RHS[0] (always defined). */ |
737 | |||
738 | #ifndef YYLLOC_DEFAULT | ||
739 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ | ||
740 | do \ | ||
741 | if (N) \ | ||
742 | { \ | ||
743 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ | ||
744 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ | ||
745 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ | ||
746 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ | ||
747 | } \ | ||
748 | else \ | ||
749 | { \ | ||
750 | (Current).first_line = (Current).last_line = \ | ||
751 | YYRHSLOC (Rhs, 0).last_line; \ | ||
752 | (Current).first_column = (Current).last_column = \ | ||
753 | YYRHSLOC (Rhs, 0).last_column; \ | ||
754 | } \ | ||
755 | while (0) | ||
783 | #endif | 756 | #endif |
784 | 757 | ||
758 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) | ||
785 | 759 | ||
786 | /* YYLEX -- calling `yylex' with the right arguments. */ | ||
787 | #ifdef YYLEX_PARAM | ||
788 | # define YYLEX yylex (YYLEX_PARAM) | ||
789 | #else | ||
790 | # define YYLEX yylex () | ||
791 | #endif | ||
792 | 760 | ||
793 | /* Enable debugging if requested. */ | 761 | /* Enable debugging if requested. */ |
794 | #if YYDEBUG | 762 | #if YYDEBUG |
@@ -798,50 +766,84 @@ while (YYID (0)) | |||
798 | # define YYFPRINTF fprintf | 766 | # define YYFPRINTF fprintf |
799 | # endif | 767 | # endif |
800 | 768 | ||
801 | # define YYDPRINTF(Args) \ | 769 | # define YYDPRINTF(Args) \ |
802 | do { \ | 770 | do { \ |
803 | if (yydebug) \ | 771 | if (yydebug) \ |
804 | YYFPRINTF Args; \ | 772 | YYFPRINTF Args; \ |
805 | } while (YYID (0)) | 773 | } while (0) |
806 | 774 | ||
807 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ | ||
808 | do { \ | ||
809 | if (yydebug) \ | ||
810 | { \ | ||
811 | YYFPRINTF (stderr, "%s ", Title); \ | ||
812 | yy_symbol_print (stderr, \ | ||
813 | Type, Value); \ | ||
814 | YYFPRINTF (stderr, "\n"); \ | ||
815 | } \ | ||
816 | } while (YYID (0)) | ||
817 | 775 | ||
776 | /* YY_LOCATION_PRINT -- Print the location on the stream. | ||
777 | This macro was not mandated originally: define only if we know | ||
778 | we won't break user code: when these are the locations we know. */ | ||
818 | 779 | ||
819 | /*--------------------------------. | 780 | #ifndef YY_LOCATION_PRINT |
820 | | Print this symbol on YYOUTPUT. | | 781 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL |
821 | `--------------------------------*/ | ||
822 | 782 | ||
823 | /*ARGSUSED*/ | 783 | /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ |
824 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 784 | |
825 | || defined __cplusplus || defined _MSC_VER) | 785 | YY_ATTRIBUTE_UNUSED |
826 | static void | 786 | static unsigned |
827 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) | 787 | yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) |
828 | #else | 788 | { |
829 | static void | 789 | unsigned res = 0; |
830 | yy_symbol_value_print (yyoutput, yytype, yyvaluep) | 790 | int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; |
831 | FILE *yyoutput; | 791 | if (0 <= yylocp->first_line) |
832 | int yytype; | 792 | { |
833 | YYSTYPE const * const yyvaluep; | 793 | res += YYFPRINTF (yyo, "%d", yylocp->first_line); |
794 | if (0 <= yylocp->first_column) | ||
795 | res += YYFPRINTF (yyo, ".%d", yylocp->first_column); | ||
796 | } | ||
797 | if (0 <= yylocp->last_line) | ||
798 | { | ||
799 | if (yylocp->first_line < yylocp->last_line) | ||
800 | { | ||
801 | res += YYFPRINTF (yyo, "-%d", yylocp->last_line); | ||
802 | if (0 <= end_col) | ||
803 | res += YYFPRINTF (yyo, ".%d", end_col); | ||
804 | } | ||
805 | else if (0 <= end_col && yylocp->first_column < end_col) | ||
806 | res += YYFPRINTF (yyo, "-%d", end_col); | ||
807 | } | ||
808 | return res; | ||
809 | } | ||
810 | |||
811 | # define YY_LOCATION_PRINT(File, Loc) \ | ||
812 | yy_location_print_ (File, &(Loc)) | ||
813 | |||
814 | # else | ||
815 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | ||
816 | # endif | ||
834 | #endif | 817 | #endif |
818 | |||
819 | |||
820 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ | ||
821 | do { \ | ||
822 | if (yydebug) \ | ||
823 | { \ | ||
824 | YYFPRINTF (stderr, "%s ", Title); \ | ||
825 | yy_symbol_print (stderr, \ | ||
826 | Type, Value, Location); \ | ||
827 | YYFPRINTF (stderr, "\n"); \ | ||
828 | } \ | ||
829 | } while (0) | ||
830 | |||
831 | |||
832 | /*----------------------------------------. | ||
833 | | Print this symbol's value on YYOUTPUT. | | ||
834 | `----------------------------------------*/ | ||
835 | |||
836 | static void | ||
837 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) | ||
835 | { | 838 | { |
836 | FILE *yyo = yyoutput; | 839 | FILE *yyo = yyoutput; |
837 | YYUSE (yyo); | 840 | YYUSE (yyo); |
841 | YYUSE (yylocationp); | ||
838 | if (!yyvaluep) | 842 | if (!yyvaluep) |
839 | return; | 843 | return; |
840 | # ifdef YYPRINT | 844 | # ifdef YYPRINT |
841 | if (yytype < YYNTOKENS) | 845 | if (yytype < YYNTOKENS) |
842 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | 846 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
843 | # else | ||
844 | YYUSE (yyoutput); | ||
845 | # endif | 847 | # endif |
846 | YYUSE (yytype); | 848 | YYUSE (yytype); |
847 | } | 849 | } |
@@ -851,24 +853,15 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) | |||
851 | | Print this symbol on YYOUTPUT. | | 853 | | Print this symbol on YYOUTPUT. | |
852 | `--------------------------------*/ | 854 | `--------------------------------*/ |
853 | 855 | ||
854 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
855 | || defined __cplusplus || defined _MSC_VER) | ||
856 | static void | ||
857 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) | ||
858 | #else | ||
859 | static void | 856 | static void |
860 | yy_symbol_print (yyoutput, yytype, yyvaluep) | 857 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) |
861 | FILE *yyoutput; | ||
862 | int yytype; | ||
863 | YYSTYPE const * const yyvaluep; | ||
864 | #endif | ||
865 | { | 858 | { |
866 | if (yytype < YYNTOKENS) | 859 | YYFPRINTF (yyoutput, "%s %s (", |
867 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); | 860 | yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); |
868 | else | ||
869 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); | ||
870 | 861 | ||
871 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); | 862 | YY_LOCATION_PRINT (yyoutput, *yylocationp); |
863 | YYFPRINTF (yyoutput, ": "); | ||
864 | yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); | ||
872 | YYFPRINTF (yyoutput, ")"); | 865 | YYFPRINTF (yyoutput, ")"); |
873 | } | 866 | } |
874 | 867 | ||
@@ -877,16 +870,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) | |||
877 | | TOP (included). | | 870 | | TOP (included). | |
878 | `------------------------------------------------------------------*/ | 871 | `------------------------------------------------------------------*/ |
879 | 872 | ||
880 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
881 | || defined __cplusplus || defined _MSC_VER) | ||
882 | static void | 873 | static void |
883 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) | 874 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) |
884 | #else | ||
885 | static void | ||
886 | yy_stack_print (yybottom, yytop) | ||
887 | yytype_int16 *yybottom; | ||
888 | yytype_int16 *yytop; | ||
889 | #endif | ||
890 | { | 875 | { |
891 | YYFPRINTF (stderr, "Stack now"); | 876 | YYFPRINTF (stderr, "Stack now"); |
892 | for (; yybottom <= yytop; yybottom++) | 877 | for (; yybottom <= yytop; yybottom++) |
@@ -897,49 +882,42 @@ yy_stack_print (yybottom, yytop) | |||
897 | YYFPRINTF (stderr, "\n"); | 882 | YYFPRINTF (stderr, "\n"); |
898 | } | 883 | } |
899 | 884 | ||
900 | # define YY_STACK_PRINT(Bottom, Top) \ | 885 | # define YY_STACK_PRINT(Bottom, Top) \ |
901 | do { \ | 886 | do { \ |
902 | if (yydebug) \ | 887 | if (yydebug) \ |
903 | yy_stack_print ((Bottom), (Top)); \ | 888 | yy_stack_print ((Bottom), (Top)); \ |
904 | } while (YYID (0)) | 889 | } while (0) |
905 | 890 | ||
906 | 891 | ||
907 | /*------------------------------------------------. | 892 | /*------------------------------------------------. |
908 | | Report that the YYRULE is going to be reduced. | | 893 | | Report that the YYRULE is going to be reduced. | |
909 | `------------------------------------------------*/ | 894 | `------------------------------------------------*/ |
910 | 895 | ||
911 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
912 | || defined __cplusplus || defined _MSC_VER) | ||
913 | static void | ||
914 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule) | ||
915 | #else | ||
916 | static void | 896 | static void |
917 | yy_reduce_print (yyvsp, yyrule) | 897 | yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) |
918 | YYSTYPE *yyvsp; | ||
919 | int yyrule; | ||
920 | #endif | ||
921 | { | 898 | { |
899 | unsigned long int yylno = yyrline[yyrule]; | ||
922 | int yynrhs = yyr2[yyrule]; | 900 | int yynrhs = yyr2[yyrule]; |
923 | int yyi; | 901 | int yyi; |
924 | unsigned long int yylno = yyrline[yyrule]; | ||
925 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", | 902 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", |
926 | yyrule - 1, yylno); | 903 | yyrule - 1, yylno); |
927 | /* The symbols being reduced. */ | 904 | /* The symbols being reduced. */ |
928 | for (yyi = 0; yyi < yynrhs; yyi++) | 905 | for (yyi = 0; yyi < yynrhs; yyi++) |
929 | { | 906 | { |
930 | YYFPRINTF (stderr, " $%d = ", yyi + 1); | 907 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
931 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], | 908 | yy_symbol_print (stderr, |
932 | &(yyvsp[(yyi + 1) - (yynrhs)]) | 909 | yystos[yyssp[yyi + 1 - yynrhs]], |
933 | ); | 910 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
911 | , &(yylsp[(yyi + 1) - (yynrhs)]) ); | ||
934 | YYFPRINTF (stderr, "\n"); | 912 | YYFPRINTF (stderr, "\n"); |
935 | } | 913 | } |
936 | } | 914 | } |
937 | 915 | ||
938 | # define YY_REDUCE_PRINT(Rule) \ | 916 | # define YY_REDUCE_PRINT(Rule) \ |
939 | do { \ | 917 | do { \ |
940 | if (yydebug) \ | 918 | if (yydebug) \ |
941 | yy_reduce_print (yyvsp, Rule); \ | 919 | yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \ |
942 | } while (YYID (0)) | 920 | } while (0) |
943 | 921 | ||
944 | /* Nonzero means print parse trace. It is left uninitialized so that | 922 | /* Nonzero means print parse trace. It is left uninitialized so that |
945 | multiple parsers can coexist. */ | 923 | multiple parsers can coexist. */ |
@@ -953,7 +931,7 @@ int yydebug; | |||
953 | 931 | ||
954 | 932 | ||
955 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | 933 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
956 | #ifndef YYINITDEPTH | 934 | #ifndef YYINITDEPTH |
957 | # define YYINITDEPTH 200 | 935 | # define YYINITDEPTH 200 |
958 | #endif | 936 | #endif |
959 | 937 | ||
@@ -976,15 +954,8 @@ int yydebug; | |||
976 | # define yystrlen strlen | 954 | # define yystrlen strlen |
977 | # else | 955 | # else |
978 | /* Return the length of YYSTR. */ | 956 | /* Return the length of YYSTR. */ |
979 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
980 | || defined __cplusplus || defined _MSC_VER) | ||
981 | static YYSIZE_T | 957 | static YYSIZE_T |
982 | yystrlen (const char *yystr) | 958 | yystrlen (const char *yystr) |
983 | #else | ||
984 | static YYSIZE_T | ||
985 | yystrlen (yystr) | ||
986 | const char *yystr; | ||
987 | #endif | ||
988 | { | 959 | { |
989 | YYSIZE_T yylen; | 960 | YYSIZE_T yylen; |
990 | for (yylen = 0; yystr[yylen]; yylen++) | 961 | for (yylen = 0; yystr[yylen]; yylen++) |
@@ -1000,16 +971,8 @@ yystrlen (yystr) | |||
1000 | # else | 971 | # else |
1001 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | 972 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
1002 | YYDEST. */ | 973 | YYDEST. */ |
1003 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
1004 | || defined __cplusplus || defined _MSC_VER) | ||
1005 | static char * | 974 | static char * |
1006 | yystpcpy (char *yydest, const char *yysrc) | 975 | yystpcpy (char *yydest, const char *yysrc) |
1007 | #else | ||
1008 | static char * | ||
1009 | yystpcpy (yydest, yysrc) | ||
1010 | char *yydest; | ||
1011 | const char *yysrc; | ||
1012 | #endif | ||
1013 | { | 976 | { |
1014 | char *yyd = yydest; | 977 | char *yyd = yydest; |
1015 | const char *yys = yysrc; | 978 | const char *yys = yysrc; |
@@ -1039,27 +1002,27 @@ yytnamerr (char *yyres, const char *yystr) | |||
1039 | char const *yyp = yystr; | 1002 | char const *yyp = yystr; |
1040 | 1003 | ||
1041 | for (;;) | 1004 | for (;;) |
1042 | switch (*++yyp) | 1005 | switch (*++yyp) |
1043 | { | 1006 | { |
1044 | case '\'': | 1007 | case '\'': |
1045 | case ',': | 1008 | case ',': |
1046 | goto do_not_strip_quotes; | 1009 | goto do_not_strip_quotes; |
1047 | 1010 | ||
1048 | case '\\': | 1011 | case '\\': |
1049 | if (*++yyp != '\\') | 1012 | if (*++yyp != '\\') |
1050 | goto do_not_strip_quotes; | 1013 | goto do_not_strip_quotes; |
1051 | /* Fall through. */ | 1014 | /* Fall through. */ |
1052 | default: | 1015 | default: |
1053 | if (yyres) | 1016 | if (yyres) |
1054 | yyres[yyn] = *yyp; | 1017 | yyres[yyn] = *yyp; |
1055 | yyn++; | 1018 | yyn++; |
1056 | break; | 1019 | break; |
1057 | 1020 | ||
1058 | case '"': | 1021 | case '"': |
1059 | if (yyres) | 1022 | if (yyres) |
1060 | yyres[yyn] = '\0'; | 1023 | yyres[yyn] = '\0'; |
1061 | return yyn; | 1024 | return yyn; |
1062 | } | 1025 | } |
1063 | do_not_strip_quotes: ; | 1026 | do_not_strip_quotes: ; |
1064 | } | 1027 | } |
1065 | 1028 | ||
@@ -1082,11 +1045,11 @@ static int | |||
1082 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | 1045 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, |
1083 | yytype_int16 *yyssp, int yytoken) | 1046 | yytype_int16 *yyssp, int yytoken) |
1084 | { | 1047 | { |
1085 | YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); | 1048 | YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); |
1086 | YYSIZE_T yysize = yysize0; | 1049 | YYSIZE_T yysize = yysize0; |
1087 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; | 1050 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
1088 | /* Internationalized format string. */ | 1051 | /* Internationalized format string. */ |
1089 | const char *yyformat = YY_NULL; | 1052 | const char *yyformat = YY_NULLPTR; |
1090 | /* Arguments of yyformat. */ | 1053 | /* Arguments of yyformat. */ |
1091 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | 1054 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
1092 | /* Number of reported tokens (one for the "unexpected", one per | 1055 | /* Number of reported tokens (one for the "unexpected", one per |
@@ -1094,10 +1057,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | |||
1094 | int yycount = 0; | 1057 | int yycount = 0; |
1095 | 1058 | ||
1096 | /* There are many possibilities here to consider: | 1059 | /* There are many possibilities here to consider: |
1097 | - Assume YYFAIL is not used. It's too flawed to consider. See | ||
1098 | <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> | ||
1099 | for details. YYERROR is fine as it does not invoke this | ||
1100 | function. | ||
1101 | - If this state is a consistent state with a default action, then | 1060 | - If this state is a consistent state with a default action, then |
1102 | the only way this function was invoked is if the default action | 1061 | the only way this function was invoked is if the default action |
1103 | is an error action. In that case, don't check for expected | 1062 | is an error action. In that case, don't check for expected |
@@ -1147,7 +1106,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | |||
1147 | } | 1106 | } |
1148 | yyarg[yycount++] = yytname[yyx]; | 1107 | yyarg[yycount++] = yytname[yyx]; |
1149 | { | 1108 | { |
1150 | YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); | 1109 | YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); |
1151 | if (! (yysize <= yysize1 | 1110 | if (! (yysize <= yysize1 |
1152 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) | 1111 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
1153 | return 2; | 1112 | return 2; |
@@ -1214,26 +1173,18 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | |||
1214 | | Release the memory associated to this symbol. | | 1173 | | Release the memory associated to this symbol. | |
1215 | `-----------------------------------------------*/ | 1174 | `-----------------------------------------------*/ |
1216 | 1175 | ||
1217 | /*ARGSUSED*/ | ||
1218 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
1219 | || defined __cplusplus || defined _MSC_VER) | ||
1220 | static void | ||
1221 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) | ||
1222 | #else | ||
1223 | static void | 1176 | static void |
1224 | yydestruct (yymsg, yytype, yyvaluep) | 1177 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) |
1225 | const char *yymsg; | ||
1226 | int yytype; | ||
1227 | YYSTYPE *yyvaluep; | ||
1228 | #endif | ||
1229 | { | 1178 | { |
1230 | YYUSE (yyvaluep); | 1179 | YYUSE (yyvaluep); |
1231 | 1180 | YYUSE (yylocationp); | |
1232 | if (!yymsg) | 1181 | if (!yymsg) |
1233 | yymsg = "Deleting"; | 1182 | yymsg = "Deleting"; |
1234 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); | 1183 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
1235 | 1184 | ||
1185 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN | ||
1236 | YYUSE (yytype); | 1186 | YYUSE (yytype); |
1187 | YY_IGNORE_MAYBE_UNINITIALIZED_END | ||
1237 | } | 1188 | } |
1238 | 1189 | ||
1239 | 1190 | ||
@@ -1242,18 +1193,14 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1242 | /* The lookahead symbol. */ | 1193 | /* The lookahead symbol. */ |
1243 | int yychar; | 1194 | int yychar; |
1244 | 1195 | ||
1245 | |||
1246 | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN | ||
1247 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN | ||
1248 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END | ||
1249 | #endif | ||
1250 | #ifndef YY_INITIAL_VALUE | ||
1251 | # define YY_INITIAL_VALUE(Value) /* Nothing. */ | ||
1252 | #endif | ||
1253 | |||
1254 | /* The semantic value of the lookahead symbol. */ | 1196 | /* The semantic value of the lookahead symbol. */ |
1255 | YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); | 1197 | YYSTYPE yylval; |
1256 | 1198 | /* Location data for the lookahead symbol. */ | |
1199 | YYLTYPE yylloc | ||
1200 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL | ||
1201 | = { 1, 1, 1, 1 } | ||
1202 | # endif | ||
1203 | ; | ||
1257 | /* Number of syntax errors so far. */ | 1204 | /* Number of syntax errors so far. */ |
1258 | int yynerrs; | 1205 | int yynerrs; |
1259 | 1206 | ||
@@ -1262,35 +1209,17 @@ int yynerrs; | |||
1262 | | yyparse. | | 1209 | | yyparse. | |
1263 | `----------*/ | 1210 | `----------*/ |
1264 | 1211 | ||
1265 | #ifdef YYPARSE_PARAM | ||
1266 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
1267 | || defined __cplusplus || defined _MSC_VER) | ||
1268 | int | ||
1269 | yyparse (void *YYPARSE_PARAM) | ||
1270 | #else | ||
1271 | int | ||
1272 | yyparse (YYPARSE_PARAM) | ||
1273 | void *YYPARSE_PARAM; | ||
1274 | #endif | ||
1275 | #else /* ! YYPARSE_PARAM */ | ||
1276 | #if (defined __STDC__ || defined __C99__FUNC__ \ | ||
1277 | || defined __cplusplus || defined _MSC_VER) | ||
1278 | int | 1212 | int |
1279 | yyparse (void) | 1213 | yyparse (void) |
1280 | #else | ||
1281 | int | ||
1282 | yyparse () | ||
1283 | |||
1284 | #endif | ||
1285 | #endif | ||
1286 | { | 1214 | { |
1287 | int yystate; | 1215 | int yystate; |
1288 | /* Number of tokens to shift before error messages enabled. */ | 1216 | /* Number of tokens to shift before error messages enabled. */ |
1289 | int yyerrstatus; | 1217 | int yyerrstatus; |
1290 | 1218 | ||
1291 | /* The stacks and their tools: | 1219 | /* The stacks and their tools: |
1292 | `yyss': related to states. | 1220 | 'yyss': related to states. |
1293 | `yyvs': related to semantic values. | 1221 | 'yyvs': related to semantic values. |
1222 | 'yyls': related to locations. | ||
1294 | 1223 | ||
1295 | Refer to the stacks through separate pointers, to allow yyoverflow | 1224 | Refer to the stacks through separate pointers, to allow yyoverflow |
1296 | to reallocate them elsewhere. */ | 1225 | to reallocate them elsewhere. */ |
@@ -1305,6 +1234,14 @@ yyparse () | |||
1305 | YYSTYPE *yyvs; | 1234 | YYSTYPE *yyvs; |
1306 | YYSTYPE *yyvsp; | 1235 | YYSTYPE *yyvsp; |
1307 | 1236 | ||
1237 | /* The location stack. */ | ||
1238 | YYLTYPE yylsa[YYINITDEPTH]; | ||
1239 | YYLTYPE *yyls; | ||
1240 | YYLTYPE *yylsp; | ||
1241 | |||
1242 | /* The locations where the error started and ended. */ | ||
1243 | YYLTYPE yyerror_range[3]; | ||
1244 | |||
1308 | YYSIZE_T yystacksize; | 1245 | YYSIZE_T yystacksize; |
1309 | 1246 | ||
1310 | int yyn; | 1247 | int yyn; |
@@ -1314,6 +1251,7 @@ yyparse () | |||
1314 | /* The variables used to return semantic value and location from the | 1251 | /* The variables used to return semantic value and location from the |
1315 | action routines. */ | 1252 | action routines. */ |
1316 | YYSTYPE yyval; | 1253 | YYSTYPE yyval; |
1254 | YYLTYPE yyloc; | ||
1317 | 1255 | ||
1318 | #if YYERROR_VERBOSE | 1256 | #if YYERROR_VERBOSE |
1319 | /* Buffer for error messages, and its allocated size. */ | 1257 | /* Buffer for error messages, and its allocated size. */ |
@@ -1322,7 +1260,7 @@ yyparse () | |||
1322 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | 1260 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
1323 | #endif | 1261 | #endif |
1324 | 1262 | ||
1325 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) | 1263 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) |
1326 | 1264 | ||
1327 | /* The number of symbols on the RHS of the reduced rule. | 1265 | /* The number of symbols on the RHS of the reduced rule. |
1328 | Keep to zero when no symbol should be popped. */ | 1266 | Keep to zero when no symbol should be popped. */ |
@@ -1330,6 +1268,7 @@ yyparse () | |||
1330 | 1268 | ||
1331 | yyssp = yyss = yyssa; | 1269 | yyssp = yyss = yyssa; |
1332 | yyvsp = yyvs = yyvsa; | 1270 | yyvsp = yyvs = yyvsa; |
1271 | yylsp = yyls = yylsa; | ||
1333 | yystacksize = YYINITDEPTH; | 1272 | yystacksize = YYINITDEPTH; |
1334 | 1273 | ||
1335 | YYDPRINTF ((stderr, "Starting parse\n")); | 1274 | YYDPRINTF ((stderr, "Starting parse\n")); |
@@ -1338,6 +1277,7 @@ yyparse () | |||
1338 | yyerrstatus = 0; | 1277 | yyerrstatus = 0; |
1339 | yynerrs = 0; | 1278 | yynerrs = 0; |
1340 | yychar = YYEMPTY; /* Cause a token to be read. */ | 1279 | yychar = YYEMPTY; /* Cause a token to be read. */ |
1280 | yylsp[0] = yylloc; | ||
1341 | goto yysetstate; | 1281 | goto yysetstate; |
1342 | 1282 | ||
1343 | /*------------------------------------------------------------. | 1283 | /*------------------------------------------------------------. |
@@ -1358,23 +1298,26 @@ yyparse () | |||
1358 | 1298 | ||
1359 | #ifdef yyoverflow | 1299 | #ifdef yyoverflow |
1360 | { | 1300 | { |
1361 | /* Give user a chance to reallocate the stack. Use copies of | 1301 | /* Give user a chance to reallocate the stack. Use copies of |
1362 | these so that the &'s don't force the real ones into | 1302 | these so that the &'s don't force the real ones into |
1363 | memory. */ | 1303 | memory. */ |
1364 | YYSTYPE *yyvs1 = yyvs; | 1304 | YYSTYPE *yyvs1 = yyvs; |
1365 | yytype_int16 *yyss1 = yyss; | 1305 | yytype_int16 *yyss1 = yyss; |
1366 | 1306 | YYLTYPE *yyls1 = yyls; | |
1367 | /* Each stack pointer address is followed by the size of the | 1307 | |
1368 | data in use in that stack, in bytes. This used to be a | 1308 | /* Each stack pointer address is followed by the size of the |
1369 | conditional around just the two extra args, but that might | 1309 | data in use in that stack, in bytes. This used to be a |
1370 | be undefined if yyoverflow is a macro. */ | 1310 | conditional around just the two extra args, but that might |
1371 | yyoverflow (YY_("memory exhausted"), | 1311 | be undefined if yyoverflow is a macro. */ |
1372 | &yyss1, yysize * sizeof (*yyssp), | 1312 | yyoverflow (YY_("memory exhausted"), |
1373 | &yyvs1, yysize * sizeof (*yyvsp), | 1313 | &yyss1, yysize * sizeof (*yyssp), |
1374 | &yystacksize); | 1314 | &yyvs1, yysize * sizeof (*yyvsp), |
1375 | 1315 | &yyls1, yysize * sizeof (*yylsp), | |
1376 | yyss = yyss1; | 1316 | &yystacksize); |
1377 | yyvs = yyvs1; | 1317 | |
1318 | yyls = yyls1; | ||
1319 | yyss = yyss1; | ||
1320 | yyvs = yyvs1; | ||
1378 | } | 1321 | } |
1379 | #else /* no yyoverflow */ | 1322 | #else /* no yyoverflow */ |
1380 | # ifndef YYSTACK_RELOCATE | 1323 | # ifndef YYSTACK_RELOCATE |
@@ -1382,34 +1325,36 @@ yyparse () | |||
1382 | # else | 1325 | # else |
1383 | /* Extend the stack our own way. */ | 1326 | /* Extend the stack our own way. */ |
1384 | if (YYMAXDEPTH <= yystacksize) | 1327 | if (YYMAXDEPTH <= yystacksize) |
1385 | goto yyexhaustedlab; | 1328 | goto yyexhaustedlab; |
1386 | yystacksize *= 2; | 1329 | yystacksize *= 2; |
1387 | if (YYMAXDEPTH < yystacksize) | 1330 | if (YYMAXDEPTH < yystacksize) |
1388 | yystacksize = YYMAXDEPTH; | 1331 | yystacksize = YYMAXDEPTH; |
1389 | 1332 | ||
1390 | { | 1333 | { |
1391 | yytype_int16 *yyss1 = yyss; | 1334 | yytype_int16 *yyss1 = yyss; |
1392 | union yyalloc *yyptr = | 1335 | union yyalloc *yyptr = |
1393 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | 1336 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
1394 | if (! yyptr) | 1337 | if (! yyptr) |
1395 | goto yyexhaustedlab; | 1338 | goto yyexhaustedlab; |
1396 | YYSTACK_RELOCATE (yyss_alloc, yyss); | 1339 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
1397 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); | 1340 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
1341 | YYSTACK_RELOCATE (yyls_alloc, yyls); | ||
1398 | # undef YYSTACK_RELOCATE | 1342 | # undef YYSTACK_RELOCATE |
1399 | if (yyss1 != yyssa) | 1343 | if (yyss1 != yyssa) |
1400 | YYSTACK_FREE (yyss1); | 1344 | YYSTACK_FREE (yyss1); |
1401 | } | 1345 | } |
1402 | # endif | 1346 | # endif |
1403 | #endif /* no yyoverflow */ | 1347 | #endif /* no yyoverflow */ |
1404 | 1348 | ||
1405 | yyssp = yyss + yysize - 1; | 1349 | yyssp = yyss + yysize - 1; |
1406 | yyvsp = yyvs + yysize - 1; | 1350 | yyvsp = yyvs + yysize - 1; |
1351 | yylsp = yyls + yysize - 1; | ||
1407 | 1352 | ||
1408 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | 1353 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
1409 | (unsigned long int) yystacksize)); | 1354 | (unsigned long int) yystacksize)); |
1410 | 1355 | ||
1411 | if (yyss + yystacksize - 1 <= yyssp) | 1356 | if (yyss + yystacksize - 1 <= yyssp) |
1412 | YYABORT; | 1357 | YYABORT; |
1413 | } | 1358 | } |
1414 | 1359 | ||
1415 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | 1360 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
@@ -1438,7 +1383,7 @@ yybackup: | |||
1438 | if (yychar == YYEMPTY) | 1383 | if (yychar == YYEMPTY) |
1439 | { | 1384 | { |
1440 | YYDPRINTF ((stderr, "Reading a token: ")); | 1385 | YYDPRINTF ((stderr, "Reading a token: ")); |
1441 | yychar = YYLEX; | 1386 | yychar = yylex (); |
1442 | } | 1387 | } |
1443 | 1388 | ||
1444 | if (yychar <= YYEOF) | 1389 | if (yychar <= YYEOF) |
@@ -1481,7 +1426,7 @@ yybackup: | |||
1481 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN | 1426 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1482 | *++yyvsp = yylval; | 1427 | *++yyvsp = yylval; |
1483 | YY_IGNORE_MAYBE_UNINITIALIZED_END | 1428 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1484 | 1429 | *++yylsp = yylloc; | |
1485 | goto yynewstate; | 1430 | goto yynewstate; |
1486 | 1431 | ||
1487 | 1432 | ||
@@ -1503,7 +1448,7 @@ yyreduce: | |||
1503 | yylen = yyr2[yyn]; | 1448 | yylen = yyr2[yyn]; |
1504 | 1449 | ||
1505 | /* If YYLEN is nonzero, implement the default value of the action: | 1450 | /* If YYLEN is nonzero, implement the default value of the action: |
1506 | `$$ = $1'. | 1451 | '$$ = $1'. |
1507 | 1452 | ||
1508 | Otherwise, the following line sets YYVAL to garbage. | 1453 | Otherwise, the following line sets YYVAL to garbage. |
1509 | This behavior is undocumented and Bison | 1454 | This behavior is undocumented and Bison |
@@ -1512,287 +1457,303 @@ yyreduce: | |||
1512 | GCC warning that YYVAL may be used uninitialized. */ | 1457 | GCC warning that YYVAL may be used uninitialized. */ |
1513 | yyval = yyvsp[1-yylen]; | 1458 | yyval = yyvsp[1-yylen]; |
1514 | 1459 | ||
1515 | 1460 | /* Default location. */ | |
1461 | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); | ||
1516 | YY_REDUCE_PRINT (yyn); | 1462 | YY_REDUCE_PRINT (yyn); |
1517 | switch (yyn) | 1463 | switch (yyn) |
1518 | { | 1464 | { |
1519 | case 2: | 1465 | case 2: |
1520 | /* Line 1787 of yacc.c */ | 1466 | #line 105 "dtc-parser.y" /* yacc.c:1646 */ |
1521 | #line 110 "dtc-parser.y" | ||
1522 | { | 1467 | { |
1523 | the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), | 1468 | the_boot_info = build_boot_info((yyvsp[-1].re), (yyvsp[0].node), |
1524 | guess_boot_cpuid((yyvsp[(4) - (4)].node))); | 1469 | guess_boot_cpuid((yyvsp[0].node))); |
1525 | } | 1470 | } |
1471 | #line 1472 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1526 | break; | 1472 | break; |
1527 | 1473 | ||
1528 | case 3: | 1474 | case 3: |
1529 | /* Line 1787 of yacc.c */ | 1475 | #line 113 "dtc-parser.y" /* yacc.c:1646 */ |
1530 | #line 118 "dtc-parser.y" | ||
1531 | { | 1476 | { |
1532 | (yyval.re) = NULL; | 1477 | (yyval.re) = NULL; |
1533 | } | 1478 | } |
1479 | #line 1480 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1534 | break; | 1480 | break; |
1535 | 1481 | ||
1536 | case 4: | 1482 | case 4: |
1537 | /* Line 1787 of yacc.c */ | 1483 | #line 117 "dtc-parser.y" /* yacc.c:1646 */ |
1538 | #line 122 "dtc-parser.y" | ||
1539 | { | 1484 | { |
1540 | (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); | 1485 | (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re)); |
1541 | } | 1486 | } |
1487 | #line 1488 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1542 | break; | 1488 | break; |
1543 | 1489 | ||
1544 | case 5: | 1490 | case 5: |
1545 | /* Line 1787 of yacc.c */ | 1491 | #line 124 "dtc-parser.y" /* yacc.c:1646 */ |
1546 | #line 129 "dtc-parser.y" | ||
1547 | { | 1492 | { |
1548 | (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer)); | 1493 | (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer)); |
1549 | } | 1494 | } |
1495 | #line 1496 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1550 | break; | 1496 | break; |
1551 | 1497 | ||
1552 | case 6: | 1498 | case 6: |
1553 | /* Line 1787 of yacc.c */ | 1499 | #line 128 "dtc-parser.y" /* yacc.c:1646 */ |
1554 | #line 133 "dtc-parser.y" | ||
1555 | { | 1500 | { |
1556 | add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref)); | 1501 | add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref)); |
1557 | (yyval.re) = (yyvsp[(2) - (2)].re); | 1502 | (yyval.re) = (yyvsp[0].re); |
1558 | } | 1503 | } |
1504 | #line 1505 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1559 | break; | 1505 | break; |
1560 | 1506 | ||
1561 | case 7: | 1507 | case 7: |
1562 | /* Line 1787 of yacc.c */ | 1508 | #line 136 "dtc-parser.y" /* yacc.c:1646 */ |
1563 | #line 141 "dtc-parser.y" | ||
1564 | { | 1509 | { |
1565 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), ""); | 1510 | (yyval.node) = name_node((yyvsp[0].node), ""); |
1566 | } | 1511 | } |
1512 | #line 1513 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1567 | break; | 1513 | break; |
1568 | 1514 | ||
1569 | case 8: | 1515 | case 8: |
1570 | /* Line 1787 of yacc.c */ | 1516 | #line 140 "dtc-parser.y" /* yacc.c:1646 */ |
1571 | #line 145 "dtc-parser.y" | ||
1572 | { | 1517 | { |
1573 | (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); | 1518 | (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node)); |
1574 | } | 1519 | } |
1520 | #line 1521 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1575 | break; | 1521 | break; |
1576 | 1522 | ||
1577 | case 9: | 1523 | case 9: |
1578 | /* Line 1787 of yacc.c */ | 1524 | #line 145 "dtc-parser.y" /* yacc.c:1646 */ |
1579 | #line 149 "dtc-parser.y" | ||
1580 | { | 1525 | { |
1581 | struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref)); | 1526 | struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); |
1582 | 1527 | ||
1528 | add_label(&target->labels, (yyvsp[-2].labelref)); | ||
1583 | if (target) | 1529 | if (target) |
1584 | merge_nodes(target, (yyvsp[(3) - (3)].node)); | 1530 | merge_nodes(target, (yyvsp[0].node)); |
1585 | else | 1531 | else |
1586 | print_error("label or path, '%s', not found", (yyvsp[(2) - (3)].labelref)); | 1532 | ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); |
1587 | (yyval.node) = (yyvsp[(1) - (3)].node); | 1533 | (yyval.node) = (yyvsp[-3].node); |
1588 | } | 1534 | } |
1535 | #line 1536 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1589 | break; | 1536 | break; |
1590 | 1537 | ||
1591 | case 10: | 1538 | case 10: |
1592 | /* Line 1787 of yacc.c */ | 1539 | #line 156 "dtc-parser.y" /* yacc.c:1646 */ |
1593 | #line 159 "dtc-parser.y" | ||
1594 | { | 1540 | { |
1595 | struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref)); | 1541 | struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref)); |
1596 | 1542 | ||
1597 | if (!target) | 1543 | if (target) |
1598 | print_error("label or path, '%s', not found", (yyvsp[(3) - (4)].labelref)); | 1544 | merge_nodes(target, (yyvsp[0].node)); |
1599 | else | 1545 | else |
1600 | delete_node(target); | 1546 | ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); |
1601 | 1547 | (yyval.node) = (yyvsp[-2].node); | |
1602 | (yyval.node) = (yyvsp[(1) - (4)].node); | ||
1603 | } | 1548 | } |
1549 | #line 1550 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1604 | break; | 1550 | break; |
1605 | 1551 | ||
1606 | case 11: | 1552 | case 11: |
1607 | /* Line 1787 of yacc.c */ | 1553 | #line 166 "dtc-parser.y" /* yacc.c:1646 */ |
1608 | #line 173 "dtc-parser.y" | ||
1609 | { | 1554 | { |
1610 | (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); | 1555 | struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref)); |
1556 | |||
1557 | if (target) | ||
1558 | delete_node(target); | ||
1559 | else | ||
1560 | ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref)); | ||
1561 | |||
1562 | |||
1563 | (yyval.node) = (yyvsp[-3].node); | ||
1611 | } | 1564 | } |
1565 | #line 1566 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1612 | break; | 1566 | break; |
1613 | 1567 | ||
1614 | case 12: | 1568 | case 12: |
1615 | /* Line 1787 of yacc.c */ | 1569 | #line 181 "dtc-parser.y" /* yacc.c:1646 */ |
1616 | #line 180 "dtc-parser.y" | ||
1617 | { | 1570 | { |
1618 | (yyval.proplist) = NULL; | 1571 | (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist)); |
1619 | } | 1572 | } |
1573 | #line 1574 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1620 | break; | 1574 | break; |
1621 | 1575 | ||
1622 | case 13: | 1576 | case 13: |
1623 | /* Line 1787 of yacc.c */ | 1577 | #line 188 "dtc-parser.y" /* yacc.c:1646 */ |
1624 | #line 184 "dtc-parser.y" | ||
1625 | { | 1578 | { |
1626 | (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); | 1579 | (yyval.proplist) = NULL; |
1627 | } | 1580 | } |
1581 | #line 1582 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1628 | break; | 1582 | break; |
1629 | 1583 | ||
1630 | case 14: | 1584 | case 14: |
1631 | /* Line 1787 of yacc.c */ | 1585 | #line 192 "dtc-parser.y" /* yacc.c:1646 */ |
1632 | #line 191 "dtc-parser.y" | ||
1633 | { | 1586 | { |
1634 | (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data)); | 1587 | (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist)); |
1635 | } | 1588 | } |
1589 | #line 1590 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1636 | break; | 1590 | break; |
1637 | 1591 | ||
1638 | case 15: | 1592 | case 15: |
1639 | /* Line 1787 of yacc.c */ | 1593 | #line 199 "dtc-parser.y" /* yacc.c:1646 */ |
1640 | #line 195 "dtc-parser.y" | ||
1641 | { | 1594 | { |
1642 | (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data); | 1595 | (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data)); |
1643 | } | 1596 | } |
1597 | #line 1598 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1644 | break; | 1598 | break; |
1645 | 1599 | ||
1646 | case 16: | 1600 | case 16: |
1647 | /* Line 1787 of yacc.c */ | 1601 | #line 203 "dtc-parser.y" /* yacc.c:1646 */ |
1648 | #line 199 "dtc-parser.y" | ||
1649 | { | 1602 | { |
1650 | (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename)); | 1603 | (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data); |
1651 | } | 1604 | } |
1605 | #line 1606 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1652 | break; | 1606 | break; |
1653 | 1607 | ||
1654 | case 17: | 1608 | case 17: |
1655 | /* Line 1787 of yacc.c */ | 1609 | #line 207 "dtc-parser.y" /* yacc.c:1646 */ |
1656 | #line 203 "dtc-parser.y" | ||
1657 | { | 1610 | { |
1658 | add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref)); | 1611 | (yyval.prop) = build_property_delete((yyvsp[-1].propnodename)); |
1659 | (yyval.prop) = (yyvsp[(2) - (2)].prop); | ||
1660 | } | 1612 | } |
1613 | #line 1614 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1661 | break; | 1614 | break; |
1662 | 1615 | ||
1663 | case 18: | 1616 | case 18: |
1664 | /* Line 1787 of yacc.c */ | 1617 | #line 211 "dtc-parser.y" /* yacc.c:1646 */ |
1665 | #line 211 "dtc-parser.y" | ||
1666 | { | 1618 | { |
1667 | (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); | 1619 | add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref)); |
1620 | (yyval.prop) = (yyvsp[0].prop); | ||
1668 | } | 1621 | } |
1622 | #line 1623 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1669 | break; | 1623 | break; |
1670 | 1624 | ||
1671 | case 19: | 1625 | case 19: |
1672 | /* Line 1787 of yacc.c */ | 1626 | #line 219 "dtc-parser.y" /* yacc.c:1646 */ |
1673 | #line 215 "dtc-parser.y" | ||
1674 | { | 1627 | { |
1675 | (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data); | 1628 | (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data)); |
1676 | } | 1629 | } |
1630 | #line 1631 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1677 | break; | 1631 | break; |
1678 | 1632 | ||
1679 | case 20: | 1633 | case 20: |
1680 | /* Line 1787 of yacc.c */ | 1634 | #line 223 "dtc-parser.y" /* yacc.c:1646 */ |
1681 | #line 219 "dtc-parser.y" | ||
1682 | { | 1635 | { |
1683 | (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); | 1636 | (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data); |
1684 | } | 1637 | } |
1638 | #line 1639 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1685 | break; | 1639 | break; |
1686 | 1640 | ||
1687 | case 21: | 1641 | case 21: |
1688 | /* Line 1787 of yacc.c */ | 1642 | #line 227 "dtc-parser.y" /* yacc.c:1646 */ |
1689 | #line 223 "dtc-parser.y" | ||
1690 | { | 1643 | { |
1691 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); | 1644 | (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data)); |
1692 | } | 1645 | } |
1646 | #line 1647 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1693 | break; | 1647 | break; |
1694 | 1648 | ||
1695 | case 22: | 1649 | case 22: |
1696 | /* Line 1787 of yacc.c */ | 1650 | #line 231 "dtc-parser.y" /* yacc.c:1646 */ |
1697 | #line 227 "dtc-parser.y" | ||
1698 | { | 1651 | { |
1699 | FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL); | 1652 | (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref)); |
1653 | } | ||
1654 | #line 1655 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1655 | break; | ||
1656 | |||
1657 | case 23: | ||
1658 | #line 235 "dtc-parser.y" /* yacc.c:1646 */ | ||
1659 | { | ||
1660 | FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL); | ||
1700 | struct data d; | 1661 | struct data d; |
1701 | 1662 | ||
1702 | if ((yyvsp[(6) - (9)].integer) != 0) | 1663 | if ((yyvsp[-3].integer) != 0) |
1703 | if (fseek(f, (yyvsp[(6) - (9)].integer), SEEK_SET) != 0) | 1664 | if (fseek(f, (yyvsp[-3].integer), SEEK_SET) != 0) |
1704 | print_error("Couldn't seek to offset %llu in \"%s\": %s", | 1665 | die("Couldn't seek to offset %llu in \"%s\": %s", |
1705 | (unsigned long long)(yyvsp[(6) - (9)].integer), | 1666 | (unsigned long long)(yyvsp[-3].integer), (yyvsp[-5].data).val, |
1706 | (yyvsp[(4) - (9)].data).val, | 1667 | strerror(errno)); |
1707 | strerror(errno)); | ||
1708 | 1668 | ||
1709 | d = data_copy_file(f, (yyvsp[(8) - (9)].integer)); | 1669 | d = data_copy_file(f, (yyvsp[-1].integer)); |
1710 | 1670 | ||
1711 | (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d); | 1671 | (yyval.data) = data_merge((yyvsp[-8].data), d); |
1712 | fclose(f); | 1672 | fclose(f); |
1713 | } | 1673 | } |
1674 | #line 1675 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1714 | break; | 1675 | break; |
1715 | 1676 | ||
1716 | case 23: | 1677 | case 24: |
1717 | /* Line 1787 of yacc.c */ | 1678 | #line 251 "dtc-parser.y" /* yacc.c:1646 */ |
1718 | #line 244 "dtc-parser.y" | ||
1719 | { | 1679 | { |
1720 | FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL); | 1680 | FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL); |
1721 | struct data d = empty_data; | 1681 | struct data d = empty_data; |
1722 | 1682 | ||
1723 | d = data_copy_file(f, -1); | 1683 | d = data_copy_file(f, -1); |
1724 | 1684 | ||
1725 | (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d); | 1685 | (yyval.data) = data_merge((yyvsp[-4].data), d); |
1726 | fclose(f); | 1686 | fclose(f); |
1727 | } | 1687 | } |
1688 | #line 1689 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1728 | break; | 1689 | break; |
1729 | 1690 | ||
1730 | case 24: | 1691 | case 25: |
1731 | /* Line 1787 of yacc.c */ | 1692 | #line 261 "dtc-parser.y" /* yacc.c:1646 */ |
1732 | #line 254 "dtc-parser.y" | ||
1733 | { | 1693 | { |
1734 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1694 | (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); |
1735 | } | 1695 | } |
1696 | #line 1697 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1736 | break; | 1697 | break; |
1737 | 1698 | ||
1738 | case 25: | 1699 | case 26: |
1739 | /* Line 1787 of yacc.c */ | 1700 | #line 268 "dtc-parser.y" /* yacc.c:1646 */ |
1740 | #line 261 "dtc-parser.y" | ||
1741 | { | 1701 | { |
1742 | (yyval.data) = empty_data; | 1702 | (yyval.data) = empty_data; |
1743 | } | 1703 | } |
1704 | #line 1705 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1744 | break; | 1705 | break; |
1745 | 1706 | ||
1746 | case 26: | 1707 | case 27: |
1747 | /* Line 1787 of yacc.c */ | 1708 | #line 272 "dtc-parser.y" /* yacc.c:1646 */ |
1748 | #line 265 "dtc-parser.y" | ||
1749 | { | 1709 | { |
1750 | (yyval.data) = (yyvsp[(1) - (2)].data); | 1710 | (yyval.data) = (yyvsp[-1].data); |
1751 | } | 1711 | } |
1712 | #line 1713 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1752 | break; | 1713 | break; |
1753 | 1714 | ||
1754 | case 27: | 1715 | case 28: |
1755 | /* Line 1787 of yacc.c */ | 1716 | #line 276 "dtc-parser.y" /* yacc.c:1646 */ |
1756 | #line 269 "dtc-parser.y" | ||
1757 | { | 1717 | { |
1758 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1718 | (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); |
1759 | } | 1719 | } |
1720 | #line 1721 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1760 | break; | 1721 | break; |
1761 | 1722 | ||
1762 | case 28: | 1723 | case 29: |
1763 | /* Line 1787 of yacc.c */ | 1724 | #line 283 "dtc-parser.y" /* yacc.c:1646 */ |
1764 | #line 276 "dtc-parser.y" | ||
1765 | { | 1725 | { |
1766 | (yyval.array).data = empty_data; | 1726 | unsigned long long bits; |
1767 | (yyval.array).bits = eval_literal((yyvsp[(2) - (3)].literal), 0, 7); | 1727 | |
1768 | 1728 | bits = (yyvsp[-1].integer); | |
1769 | if (((yyval.array).bits != 8) && | 1729 | |
1770 | ((yyval.array).bits != 16) && | 1730 | if ((bits != 8) && (bits != 16) && |
1771 | ((yyval.array).bits != 32) && | 1731 | (bits != 32) && (bits != 64)) { |
1772 | ((yyval.array).bits != 64)) | 1732 | ERROR(&(yylsp[-1]), "Array elements must be" |
1773 | { | 1733 | " 8, 16, 32 or 64-bits"); |
1774 | print_error("Only 8, 16, 32 and 64-bit elements" | 1734 | bits = 32; |
1775 | " are currently supported"); | ||
1776 | (yyval.array).bits = 32; | ||
1777 | } | 1735 | } |
1736 | |||
1737 | (yyval.array).data = empty_data; | ||
1738 | (yyval.array).bits = bits; | ||
1778 | } | 1739 | } |
1740 | #line 1741 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1779 | break; | 1741 | break; |
1780 | 1742 | ||
1781 | case 29: | 1743 | case 30: |
1782 | /* Line 1787 of yacc.c */ | 1744 | #line 299 "dtc-parser.y" /* yacc.c:1646 */ |
1783 | #line 291 "dtc-parser.y" | ||
1784 | { | 1745 | { |
1785 | (yyval.array).data = empty_data; | 1746 | (yyval.array).data = empty_data; |
1786 | (yyval.array).bits = 32; | 1747 | (yyval.array).bits = 32; |
1787 | } | 1748 | } |
1749 | #line 1750 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1788 | break; | 1750 | break; |
1789 | 1751 | ||
1790 | case 30: | 1752 | case 31: |
1791 | /* Line 1787 of yacc.c */ | 1753 | #line 304 "dtc-parser.y" /* yacc.c:1646 */ |
1792 | #line 296 "dtc-parser.y" | ||
1793 | { | 1754 | { |
1794 | if ((yyvsp[(1) - (2)].array).bits < 64) { | 1755 | if ((yyvsp[-1].array).bits < 64) { |
1795 | uint64_t mask = (1ULL << (yyvsp[(1) - (2)].array).bits) - 1; | 1756 | uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1; |
1796 | /* | 1757 | /* |
1797 | * Bits above mask must either be all zero | 1758 | * Bits above mask must either be all zero |
1798 | * (positive within range of mask) or all one | 1759 | * (positive within range of mask) or all one |
@@ -1801,275 +1762,258 @@ yyreduce: | |||
1801 | * within the mask to one (i.e. | in the | 1762 | * within the mask to one (i.e. | in the |
1802 | * mask), all bits are one. | 1763 | * mask), all bits are one. |
1803 | */ | 1764 | */ |
1804 | if (((yyvsp[(2) - (2)].integer) > mask) && (((yyvsp[(2) - (2)].integer) | mask) != -1ULL)) | 1765 | if (((yyvsp[0].integer) > mask) && (((yyvsp[0].integer) | mask) != -1ULL)) |
1805 | print_error( | 1766 | ERROR(&(yylsp[0]), "Value out of range for" |
1806 | "integer value out of range " | 1767 | " %d-bit array element", (yyvsp[-1].array).bits); |
1807 | "%016lx (%d bits)", (yyvsp[(1) - (2)].array).bits); | ||
1808 | } | 1768 | } |
1809 | 1769 | ||
1810 | (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits); | 1770 | (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits); |
1811 | } | 1771 | } |
1772 | #line 1773 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1812 | break; | 1773 | break; |
1813 | 1774 | ||
1814 | case 31: | 1775 | case 32: |
1815 | /* Line 1787 of yacc.c */ | 1776 | #line 323 "dtc-parser.y" /* yacc.c:1646 */ |
1816 | #line 316 "dtc-parser.y" | ||
1817 | { | 1777 | { |
1818 | uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits); | 1778 | uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits); |
1819 | 1779 | ||
1820 | if ((yyvsp[(1) - (2)].array).bits == 32) | 1780 | if ((yyvsp[-1].array).bits == 32) |
1821 | (yyvsp[(1) - (2)].array).data = data_add_marker((yyvsp[(1) - (2)].array).data, | 1781 | (yyvsp[-1].array).data = data_add_marker((yyvsp[-1].array).data, |
1822 | REF_PHANDLE, | 1782 | REF_PHANDLE, |
1823 | (yyvsp[(2) - (2)].labelref)); | 1783 | (yyvsp[0].labelref)); |
1824 | else | 1784 | else |
1825 | print_error("References are only allowed in " | 1785 | ERROR(&(yylsp[0]), "References are only allowed in " |
1826 | "arrays with 32-bit elements."); | 1786 | "arrays with 32-bit elements."); |
1827 | 1787 | ||
1828 | (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits); | 1788 | (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits); |
1829 | } | ||
1830 | break; | ||
1831 | |||
1832 | case 32: | ||
1833 | /* Line 1787 of yacc.c */ | ||
1834 | #line 330 "dtc-parser.y" | ||
1835 | { | ||
1836 | (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref)); | ||
1837 | } | 1789 | } |
1790 | #line 1791 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1838 | break; | 1791 | break; |
1839 | 1792 | ||
1840 | case 33: | 1793 | case 33: |
1841 | /* Line 1787 of yacc.c */ | 1794 | #line 337 "dtc-parser.y" /* yacc.c:1646 */ |
1842 | #line 337 "dtc-parser.y" | ||
1843 | { | ||
1844 | (yyval.integer) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64); | ||
1845 | } | ||
1846 | break; | ||
1847 | |||
1848 | case 34: | ||
1849 | /* Line 1787 of yacc.c */ | ||
1850 | #line 341 "dtc-parser.y" | ||
1851 | { | 1795 | { |
1852 | (yyval.integer) = eval_char_literal((yyvsp[(1) - (1)].literal)); | 1796 | (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref)); |
1853 | } | 1797 | } |
1798 | #line 1799 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1854 | break; | 1799 | break; |
1855 | 1800 | ||
1856 | case 35: | 1801 | case 36: |
1857 | /* Line 1787 of yacc.c */ | 1802 | #line 346 "dtc-parser.y" /* yacc.c:1646 */ |
1858 | #line 345 "dtc-parser.y" | ||
1859 | { | 1803 | { |
1860 | (yyval.integer) = (yyvsp[(2) - (3)].integer); | 1804 | (yyval.integer) = (yyvsp[-1].integer); |
1861 | } | 1805 | } |
1806 | #line 1807 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
1862 | break; | 1807 | break; |
1863 | 1808 | ||
1864 | case 38: | 1809 | case 39: |
1865 | /* Line 1787 of yacc.c */ | 1810 | #line 357 "dtc-parser.y" /* yacc.c:1646 */ |
1866 | #line 356 "dtc-parser.y" | 1811 | { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); } |
1867 | { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); } | 1812 | #line 1813 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1868 | break; | ||
1869 | |||
1870 | case 40: | ||
1871 | /* Line 1787 of yacc.c */ | ||
1872 | #line 361 "dtc-parser.y" | ||
1873 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); } | ||
1874 | break; | 1813 | break; |
1875 | 1814 | ||
1876 | case 42: | 1815 | case 41: |
1877 | /* Line 1787 of yacc.c */ | 1816 | #line 362 "dtc-parser.y" /* yacc.c:1646 */ |
1878 | #line 366 "dtc-parser.y" | 1817 | { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); } |
1879 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); } | 1818 | #line 1819 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1880 | break; | 1819 | break; |
1881 | 1820 | ||
1882 | case 44: | 1821 | case 43: |
1883 | /* Line 1787 of yacc.c */ | 1822 | #line 367 "dtc-parser.y" /* yacc.c:1646 */ |
1884 | #line 371 "dtc-parser.y" | 1823 | { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); } |
1885 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); } | 1824 | #line 1825 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1886 | break; | 1825 | break; |
1887 | 1826 | ||
1888 | case 46: | 1827 | case 45: |
1889 | /* Line 1787 of yacc.c */ | 1828 | #line 372 "dtc-parser.y" /* yacc.c:1646 */ |
1890 | #line 376 "dtc-parser.y" | 1829 | { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); } |
1891 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); } | 1830 | #line 1831 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1892 | break; | 1831 | break; |
1893 | 1832 | ||
1894 | case 48: | 1833 | case 47: |
1895 | /* Line 1787 of yacc.c */ | 1834 | #line 377 "dtc-parser.y" /* yacc.c:1646 */ |
1896 | #line 381 "dtc-parser.y" | 1835 | { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); } |
1897 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); } | 1836 | #line 1837 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1898 | break; | 1837 | break; |
1899 | 1838 | ||
1900 | case 50: | 1839 | case 49: |
1901 | /* Line 1787 of yacc.c */ | 1840 | #line 382 "dtc-parser.y" /* yacc.c:1646 */ |
1902 | #line 386 "dtc-parser.y" | 1841 | { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); } |
1903 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); } | 1842 | #line 1843 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1904 | break; | 1843 | break; |
1905 | 1844 | ||
1906 | case 51: | 1845 | case 51: |
1907 | /* Line 1787 of yacc.c */ | 1846 | #line 387 "dtc-parser.y" /* yacc.c:1646 */ |
1908 | #line 387 "dtc-parser.y" | 1847 | { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); } |
1909 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); } | 1848 | #line 1849 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1910 | break; | 1849 | break; |
1911 | 1850 | ||
1912 | case 53: | 1851 | case 52: |
1913 | /* Line 1787 of yacc.c */ | 1852 | #line 388 "dtc-parser.y" /* yacc.c:1646 */ |
1914 | #line 392 "dtc-parser.y" | 1853 | { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); } |
1915 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); } | 1854 | #line 1855 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1916 | break; | 1855 | break; |
1917 | 1856 | ||
1918 | case 54: | 1857 | case 54: |
1919 | /* Line 1787 of yacc.c */ | 1858 | #line 393 "dtc-parser.y" /* yacc.c:1646 */ |
1920 | #line 393 "dtc-parser.y" | 1859 | { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); } |
1921 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); } | 1860 | #line 1861 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1922 | break; | 1861 | break; |
1923 | 1862 | ||
1924 | case 55: | 1863 | case 55: |
1925 | /* Line 1787 of yacc.c */ | 1864 | #line 394 "dtc-parser.y" /* yacc.c:1646 */ |
1926 | #line 394 "dtc-parser.y" | 1865 | { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); } |
1927 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); } | 1866 | #line 1867 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1928 | break; | 1867 | break; |
1929 | 1868 | ||
1930 | case 56: | 1869 | case 56: |
1931 | /* Line 1787 of yacc.c */ | 1870 | #line 395 "dtc-parser.y" /* yacc.c:1646 */ |
1932 | #line 395 "dtc-parser.y" | 1871 | { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); } |
1933 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); } | 1872 | #line 1873 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1934 | break; | 1873 | break; |
1935 | 1874 | ||
1936 | case 57: | 1875 | case 57: |
1937 | /* Line 1787 of yacc.c */ | 1876 | #line 396 "dtc-parser.y" /* yacc.c:1646 */ |
1938 | #line 399 "dtc-parser.y" | 1877 | { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); } |
1939 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); } | 1878 | #line 1879 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1940 | break; | 1879 | break; |
1941 | 1880 | ||
1942 | case 58: | 1881 | case 58: |
1943 | /* Line 1787 of yacc.c */ | 1882 | #line 400 "dtc-parser.y" /* yacc.c:1646 */ |
1944 | #line 400 "dtc-parser.y" | 1883 | { (yyval.integer) = (yyvsp[-2].integer) << (yyvsp[0].integer); } |
1945 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); } | 1884 | #line 1885 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1946 | break; | 1885 | break; |
1947 | 1886 | ||
1948 | case 60: | 1887 | case 59: |
1949 | /* Line 1787 of yacc.c */ | 1888 | #line 401 "dtc-parser.y" /* yacc.c:1646 */ |
1950 | #line 405 "dtc-parser.y" | 1889 | { (yyval.integer) = (yyvsp[-2].integer) >> (yyvsp[0].integer); } |
1951 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); } | 1890 | #line 1891 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1952 | break; | 1891 | break; |
1953 | 1892 | ||
1954 | case 61: | 1893 | case 61: |
1955 | /* Line 1787 of yacc.c */ | 1894 | #line 406 "dtc-parser.y" /* yacc.c:1646 */ |
1956 | #line 406 "dtc-parser.y" | 1895 | { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); } |
1957 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); } | 1896 | #line 1897 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1958 | break; | 1897 | break; |
1959 | 1898 | ||
1960 | case 63: | 1899 | case 62: |
1961 | /* Line 1787 of yacc.c */ | 1900 | #line 407 "dtc-parser.y" /* yacc.c:1646 */ |
1962 | #line 411 "dtc-parser.y" | 1901 | { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); } |
1963 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); } | 1902 | #line 1903 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1964 | break; | 1903 | break; |
1965 | 1904 | ||
1966 | case 64: | 1905 | case 64: |
1967 | /* Line 1787 of yacc.c */ | 1906 | #line 412 "dtc-parser.y" /* yacc.c:1646 */ |
1968 | #line 412 "dtc-parser.y" | 1907 | { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); } |
1969 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); } | 1908 | #line 1909 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1970 | break; | 1909 | break; |
1971 | 1910 | ||
1972 | case 65: | 1911 | case 65: |
1973 | /* Line 1787 of yacc.c */ | 1912 | #line 413 "dtc-parser.y" /* yacc.c:1646 */ |
1974 | #line 413 "dtc-parser.y" | 1913 | { (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer); } |
1975 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); } | 1914 | #line 1915 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1976 | break; | 1915 | break; |
1977 | 1916 | ||
1978 | case 68: | 1917 | case 66: |
1979 | /* Line 1787 of yacc.c */ | 1918 | #line 414 "dtc-parser.y" /* yacc.c:1646 */ |
1980 | #line 419 "dtc-parser.y" | 1919 | { (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer); } |
1981 | { (yyval.integer) = -(yyvsp[(2) - (2)].integer); } | 1920 | #line 1921 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1982 | break; | 1921 | break; |
1983 | 1922 | ||
1984 | case 69: | 1923 | case 69: |
1985 | /* Line 1787 of yacc.c */ | 1924 | #line 420 "dtc-parser.y" /* yacc.c:1646 */ |
1986 | #line 420 "dtc-parser.y" | 1925 | { (yyval.integer) = -(yyvsp[0].integer); } |
1987 | { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); } | 1926 | #line 1927 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1988 | break; | 1927 | break; |
1989 | 1928 | ||
1990 | case 70: | 1929 | case 70: |
1991 | /* Line 1787 of yacc.c */ | 1930 | #line 421 "dtc-parser.y" /* yacc.c:1646 */ |
1992 | #line 421 "dtc-parser.y" | 1931 | { (yyval.integer) = ~(yyvsp[0].integer); } |
1993 | { (yyval.integer) = !(yyvsp[(2) - (2)].integer); } | 1932 | #line 1933 "dtc-parser.tab.c" /* yacc.c:1646 */ |
1994 | break; | 1933 | break; |
1995 | 1934 | ||
1996 | case 71: | 1935 | case 71: |
1997 | /* Line 1787 of yacc.c */ | 1936 | #line 422 "dtc-parser.y" /* yacc.c:1646 */ |
1998 | #line 426 "dtc-parser.y" | 1937 | { (yyval.integer) = !(yyvsp[0].integer); } |
1999 | { | 1938 | #line 1939 "dtc-parser.tab.c" /* yacc.c:1646 */ |
2000 | (yyval.data) = empty_data; | ||
2001 | } | ||
2002 | break; | 1939 | break; |
2003 | 1940 | ||
2004 | case 72: | 1941 | case 72: |
2005 | /* Line 1787 of yacc.c */ | 1942 | #line 427 "dtc-parser.y" /* yacc.c:1646 */ |
2006 | #line 430 "dtc-parser.y" | ||
2007 | { | 1943 | { |
2008 | (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); | 1944 | (yyval.data) = empty_data; |
2009 | } | 1945 | } |
1946 | #line 1947 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2010 | break; | 1947 | break; |
2011 | 1948 | ||
2012 | case 73: | 1949 | case 73: |
2013 | /* Line 1787 of yacc.c */ | 1950 | #line 431 "dtc-parser.y" /* yacc.c:1646 */ |
2014 | #line 434 "dtc-parser.y" | ||
2015 | { | 1951 | { |
2016 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | 1952 | (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte)); |
2017 | } | 1953 | } |
1954 | #line 1955 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2018 | break; | 1955 | break; |
2019 | 1956 | ||
2020 | case 74: | 1957 | case 74: |
2021 | /* Line 1787 of yacc.c */ | 1958 | #line 435 "dtc-parser.y" /* yacc.c:1646 */ |
2022 | #line 441 "dtc-parser.y" | ||
2023 | { | 1959 | { |
2024 | (yyval.nodelist) = NULL; | 1960 | (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref)); |
2025 | } | 1961 | } |
1962 | #line 1963 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2026 | break; | 1963 | break; |
2027 | 1964 | ||
2028 | case 75: | 1965 | case 75: |
2029 | /* Line 1787 of yacc.c */ | 1966 | #line 442 "dtc-parser.y" /* yacc.c:1646 */ |
2030 | #line 445 "dtc-parser.y" | ||
2031 | { | 1967 | { |
2032 | (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); | 1968 | (yyval.nodelist) = NULL; |
2033 | } | 1969 | } |
1970 | #line 1971 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2034 | break; | 1971 | break; |
2035 | 1972 | ||
2036 | case 76: | 1973 | case 76: |
2037 | /* Line 1787 of yacc.c */ | 1974 | #line 446 "dtc-parser.y" /* yacc.c:1646 */ |
2038 | #line 449 "dtc-parser.y" | ||
2039 | { | 1975 | { |
2040 | print_error("syntax error: properties must precede subnodes"); | 1976 | (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist)); |
2041 | YYERROR; | ||
2042 | } | 1977 | } |
1978 | #line 1979 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2043 | break; | 1979 | break; |
2044 | 1980 | ||
2045 | case 77: | 1981 | case 77: |
2046 | /* Line 1787 of yacc.c */ | 1982 | #line 450 "dtc-parser.y" /* yacc.c:1646 */ |
2047 | #line 457 "dtc-parser.y" | ||
2048 | { | 1983 | { |
2049 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename)); | 1984 | ERROR(&(yylsp[0]), "Properties must precede subnodes"); |
1985 | YYERROR; | ||
2050 | } | 1986 | } |
1987 | #line 1988 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2051 | break; | 1988 | break; |
2052 | 1989 | ||
2053 | case 78: | 1990 | case 78: |
2054 | /* Line 1787 of yacc.c */ | 1991 | #line 458 "dtc-parser.y" /* yacc.c:1646 */ |
2055 | #line 461 "dtc-parser.y" | ||
2056 | { | 1992 | { |
2057 | (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename)); | 1993 | (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename)); |
2058 | } | 1994 | } |
1995 | #line 1996 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2059 | break; | 1996 | break; |
2060 | 1997 | ||
2061 | case 79: | 1998 | case 79: |
2062 | /* Line 1787 of yacc.c */ | 1999 | #line 462 "dtc-parser.y" /* yacc.c:1646 */ |
2063 | #line 465 "dtc-parser.y" | 2000 | { |
2001 | (yyval.node) = name_node(build_node_delete(), (yyvsp[-1].propnodename)); | ||
2002 | } | ||
2003 | #line 2004 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2004 | break; | ||
2005 | |||
2006 | case 80: | ||
2007 | #line 466 "dtc-parser.y" /* yacc.c:1646 */ | ||
2064 | { | 2008 | { |
2065 | add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref)); | 2009 | add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref)); |
2066 | (yyval.node) = (yyvsp[(2) - (2)].node); | 2010 | (yyval.node) = (yyvsp[0].node); |
2067 | } | 2011 | } |
2012 | #line 2013 "dtc-parser.tab.c" /* yacc.c:1646 */ | ||
2068 | break; | 2013 | break; |
2069 | 2014 | ||
2070 | 2015 | ||
2071 | /* Line 1787 of yacc.c */ | 2016 | #line 2017 "dtc-parser.tab.c" /* yacc.c:1646 */ |
2072 | #line 2073 "dtc-parser.tab.c" | ||
2073 | default: break; | 2017 | default: break; |
2074 | } | 2018 | } |
2075 | /* User semantic actions sometimes alter yychar, and that requires | 2019 | /* User semantic actions sometimes alter yychar, and that requires |
@@ -2090,8 +2034,9 @@ yyreduce: | |||
2090 | YY_STACK_PRINT (yyss, yyssp); | 2034 | YY_STACK_PRINT (yyss, yyssp); |
2091 | 2035 | ||
2092 | *++yyvsp = yyval; | 2036 | *++yyvsp = yyval; |
2037 | *++yylsp = yyloc; | ||
2093 | 2038 | ||
2094 | /* Now `shift' the result of the reduction. Determine what state | 2039 | /* Now 'shift' the result of the reduction. Determine what state |
2095 | that goes to, based on the state we popped back to and the rule | 2040 | that goes to, based on the state we popped back to and the rule |
2096 | number reduced by. */ | 2041 | number reduced by. */ |
2097 | 2042 | ||
@@ -2106,9 +2051,9 @@ yyreduce: | |||
2106 | goto yynewstate; | 2051 | goto yynewstate; |
2107 | 2052 | ||
2108 | 2053 | ||
2109 | /*------------------------------------. | 2054 | /*--------------------------------------. |
2110 | | yyerrlab -- here on detecting error | | 2055 | | yyerrlab -- here on detecting error. | |
2111 | `------------------------------------*/ | 2056 | `--------------------------------------*/ |
2112 | yyerrlab: | 2057 | yyerrlab: |
2113 | /* Make sure we have latest lookahead translation. See comments at | 2058 | /* Make sure we have latest lookahead translation. See comments at |
2114 | user semantic actions for why this is necessary. */ | 2059 | user semantic actions for why this is necessary. */ |
@@ -2154,25 +2099,25 @@ yyerrlab: | |||
2154 | #endif | 2099 | #endif |
2155 | } | 2100 | } |
2156 | 2101 | ||
2157 | 2102 | yyerror_range[1] = yylloc; | |
2158 | 2103 | ||
2159 | if (yyerrstatus == 3) | 2104 | if (yyerrstatus == 3) |
2160 | { | 2105 | { |
2161 | /* If just tried and failed to reuse lookahead token after an | 2106 | /* If just tried and failed to reuse lookahead token after an |
2162 | error, discard it. */ | 2107 | error, discard it. */ |
2163 | 2108 | ||
2164 | if (yychar <= YYEOF) | 2109 | if (yychar <= YYEOF) |
2165 | { | 2110 | { |
2166 | /* Return failure if at end of input. */ | 2111 | /* Return failure if at end of input. */ |
2167 | if (yychar == YYEOF) | 2112 | if (yychar == YYEOF) |
2168 | YYABORT; | 2113 | YYABORT; |
2169 | } | 2114 | } |
2170 | else | 2115 | else |
2171 | { | 2116 | { |
2172 | yydestruct ("Error: discarding", | 2117 | yydestruct ("Error: discarding", |
2173 | yytoken, &yylval); | 2118 | yytoken, &yylval, &yylloc); |
2174 | yychar = YYEMPTY; | 2119 | yychar = YYEMPTY; |
2175 | } | 2120 | } |
2176 | } | 2121 | } |
2177 | 2122 | ||
2178 | /* Else will try to reuse lookahead token after shifting the error | 2123 | /* Else will try to reuse lookahead token after shifting the error |
@@ -2191,7 +2136,8 @@ yyerrorlab: | |||
2191 | if (/*CONSTCOND*/ 0) | 2136 | if (/*CONSTCOND*/ 0) |
2192 | goto yyerrorlab; | 2137 | goto yyerrorlab; |
2193 | 2138 | ||
2194 | /* Do not reclaim the symbols of the rule which action triggered | 2139 | yyerror_range[1] = yylsp[1-yylen]; |
2140 | /* Do not reclaim the symbols of the rule whose action triggered | ||
2195 | this YYERROR. */ | 2141 | this YYERROR. */ |
2196 | YYPOPSTACK (yylen); | 2142 | YYPOPSTACK (yylen); |
2197 | yylen = 0; | 2143 | yylen = 0; |
@@ -2204,29 +2150,29 @@ yyerrorlab: | |||
2204 | | yyerrlab1 -- common code for both syntax error and YYERROR. | | 2150 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
2205 | `-------------------------------------------------------------*/ | 2151 | `-------------------------------------------------------------*/ |
2206 | yyerrlab1: | 2152 | yyerrlab1: |
2207 | yyerrstatus = 3; /* Each real token shifted decrements this. */ | 2153 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
2208 | 2154 | ||
2209 | for (;;) | 2155 | for (;;) |
2210 | { | 2156 | { |
2211 | yyn = yypact[yystate]; | 2157 | yyn = yypact[yystate]; |
2212 | if (!yypact_value_is_default (yyn)) | 2158 | if (!yypact_value_is_default (yyn)) |
2213 | { | 2159 | { |
2214 | yyn += YYTERROR; | 2160 | yyn += YYTERROR; |
2215 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | 2161 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
2216 | { | 2162 | { |
2217 | yyn = yytable[yyn]; | 2163 | yyn = yytable[yyn]; |
2218 | if (0 < yyn) | 2164 | if (0 < yyn) |
2219 | break; | 2165 | break; |
2220 | } | 2166 | } |
2221 | } | 2167 | } |
2222 | 2168 | ||
2223 | /* Pop the current state because it cannot handle the error token. */ | 2169 | /* Pop the current state because it cannot handle the error token. */ |
2224 | if (yyssp == yyss) | 2170 | if (yyssp == yyss) |
2225 | YYABORT; | 2171 | YYABORT; |
2226 | |||
2227 | 2172 | ||
2173 | yyerror_range[1] = *yylsp; | ||
2228 | yydestruct ("Error: popping", | 2174 | yydestruct ("Error: popping", |
2229 | yystos[yystate], yyvsp); | 2175 | yystos[yystate], yyvsp, yylsp); |
2230 | YYPOPSTACK (1); | 2176 | YYPOPSTACK (1); |
2231 | yystate = *yyssp; | 2177 | yystate = *yyssp; |
2232 | YY_STACK_PRINT (yyss, yyssp); | 2178 | YY_STACK_PRINT (yyss, yyssp); |
@@ -2236,6 +2182,11 @@ yyerrlab1: | |||
2236 | *++yyvsp = yylval; | 2182 | *++yyvsp = yylval; |
2237 | YY_IGNORE_MAYBE_UNINITIALIZED_END | 2183 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
2238 | 2184 | ||
2185 | yyerror_range[2] = yylloc; | ||
2186 | /* Using YYLLOC is tempting, but would change the location of | ||
2187 | the lookahead. YYLOC is available though. */ | ||
2188 | YYLLOC_DEFAULT (yyloc, yyerror_range, 2); | ||
2189 | *++yylsp = yyloc; | ||
2239 | 2190 | ||
2240 | /* Shift the error token. */ | 2191 | /* Shift the error token. */ |
2241 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); | 2192 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
@@ -2275,16 +2226,16 @@ yyreturn: | |||
2275 | user semantic actions for why this is necessary. */ | 2226 | user semantic actions for why this is necessary. */ |
2276 | yytoken = YYTRANSLATE (yychar); | 2227 | yytoken = YYTRANSLATE (yychar); |
2277 | yydestruct ("Cleanup: discarding lookahead", | 2228 | yydestruct ("Cleanup: discarding lookahead", |
2278 | yytoken, &yylval); | 2229 | yytoken, &yylval, &yylloc); |
2279 | } | 2230 | } |
2280 | /* Do not reclaim the symbols of the rule which action triggered | 2231 | /* Do not reclaim the symbols of the rule whose action triggered |
2281 | this YYABORT or YYACCEPT. */ | 2232 | this YYABORT or YYACCEPT. */ |
2282 | YYPOPSTACK (yylen); | 2233 | YYPOPSTACK (yylen); |
2283 | YY_STACK_PRINT (yyss, yyssp); | 2234 | YY_STACK_PRINT (yyss, yyssp); |
2284 | while (yyssp != yyss) | 2235 | while (yyssp != yyss) |
2285 | { | 2236 | { |
2286 | yydestruct ("Cleanup: popping", | 2237 | yydestruct ("Cleanup: popping", |
2287 | yystos[*yyssp], yyvsp); | 2238 | yystos[*yyssp], yyvsp, yylsp); |
2288 | YYPOPSTACK (1); | 2239 | YYPOPSTACK (1); |
2289 | } | 2240 | } |
2290 | #ifndef yyoverflow | 2241 | #ifndef yyoverflow |
@@ -2295,72 +2246,12 @@ yyreturn: | |||
2295 | if (yymsg != yymsgbuf) | 2246 | if (yymsg != yymsgbuf) |
2296 | YYSTACK_FREE (yymsg); | 2247 | YYSTACK_FREE (yymsg); |
2297 | #endif | 2248 | #endif |
2298 | /* Make sure YYID is used. */ | 2249 | return yyresult; |
2299 | return YYID (yyresult); | ||
2300 | } | 2250 | } |
2251 | #line 472 "dtc-parser.y" /* yacc.c:1906 */ | ||
2301 | 2252 | ||
2302 | 2253 | ||
2303 | /* Line 2050 of yacc.c */ | 2254 | void yyerror(char const *s) |
2304 | #line 471 "dtc-parser.y" | ||
2305 | |||
2306 | |||
2307 | void print_error(char const *fmt, ...) | ||
2308 | { | ||
2309 | va_list va; | ||
2310 | |||
2311 | va_start(va, fmt); | ||
2312 | srcpos_verror(&yylloc, fmt, va); | ||
2313 | va_end(va); | ||
2314 | |||
2315 | treesource_error = 1; | ||
2316 | } | ||
2317 | |||
2318 | void yyerror(char const *s) { | ||
2319 | print_error("%s", s); | ||
2320 | } | ||
2321 | |||
2322 | static unsigned long long eval_literal(const char *s, int base, int bits) | ||
2323 | { | ||
2324 | unsigned long long val; | ||
2325 | char *e; | ||
2326 | |||
2327 | errno = 0; | ||
2328 | val = strtoull(s, &e, base); | ||
2329 | if (*e) { | ||
2330 | size_t uls = strspn(e, "UL"); | ||
2331 | if (e[uls]) | ||
2332 | print_error("bad characters in literal"); | ||
2333 | } | ||
2334 | if ((errno == ERANGE) | ||
2335 | || ((bits < 64) && (val >= (1ULL << bits)))) | ||
2336 | print_error("literal out of range"); | ||
2337 | else if (errno != 0) | ||
2338 | print_error("bad literal"); | ||
2339 | return val; | ||
2340 | } | ||
2341 | |||
2342 | static unsigned char eval_char_literal(const char *s) | ||
2343 | { | 2255 | { |
2344 | int i = 1; | 2256 | ERROR(&yylloc, "%s", s); |
2345 | char c = s[0]; | ||
2346 | |||
2347 | if (c == '\0') | ||
2348 | { | ||
2349 | print_error("empty character literal"); | ||
2350 | return 0; | ||
2351 | } | ||
2352 | |||
2353 | /* | ||
2354 | * If the first character in the character literal is a \ then process | ||
2355 | * the remaining characters as an escape encoding. If the first | ||
2356 | * character is neither an escape or a terminator it should be the only | ||
2357 | * character in the literal and will be returned. | ||
2358 | */ | ||
2359 | if (c == '\\') | ||
2360 | c = get_escape_char(s, &i); | ||
2361 | |||
2362 | if (s[i] != '\0') | ||
2363 | print_error("malformed character literal"); | ||
2364 | |||
2365 | return c; | ||
2366 | } | 2257 | } |
diff --git a/scripts/dtc/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped index b2e7a86cd85e..30867c688300 100644 --- a/scripts/dtc/dtc-parser.tab.h_shipped +++ b/scripts/dtc/dtc-parser.tab.h_shipped | |||
@@ -1,19 +1,19 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.7.12-4996. */ | 1 | /* A Bison parser, made by GNU Bison 3.0.2. */ |
2 | 2 | ||
3 | /* Bison interface for Yacc-like parsers in C | 3 | /* Bison interface for Yacc-like parsers in C |
4 | 4 | ||
5 | Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. | 5 | Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. |
6 | 6 | ||
7 | This program is free software: you can redistribute it and/or modify | 7 | This program is free software: you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation, either version 3 of the License, or | 9 | the Free Software Foundation, either version 3 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
19 | 19 | ||
@@ -26,13 +26,13 @@ | |||
26 | special exception, which will cause the skeleton and the resulting | 26 | special exception, which will cause the skeleton and the resulting |
27 | Bison output files to be licensed under the GNU General Public | 27 | Bison output files to be licensed under the GNU General Public |
28 | License without this special exception. | 28 | License without this special exception. |
29 | 29 | ||
30 | This special exception was added by the Free Software Foundation in | 30 | This special exception was added by the Free Software Foundation in |
31 | version 2.2 of Bison. */ | 31 | version 2.2 of Bison. */ |
32 | 32 | ||
33 | #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED | 33 | #ifndef YY_YY_DTC_PARSER_TAB_H_INCLUDED |
34 | # define YY_YY_DTC_PARSER_TAB_H_INCLUDED | 34 | # define YY_YY_DTC_PARSER_TAB_H_INCLUDED |
35 | /* Enabling traces. */ | 35 | /* Debug traces. */ |
36 | #ifndef YYDEBUG | 36 | #ifndef YYDEBUG |
37 | # define YYDEBUG 0 | 37 | # define YYDEBUG 0 |
38 | #endif | 38 | #endif |
@@ -40,48 +40,44 @@ | |||
40 | extern int yydebug; | 40 | extern int yydebug; |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | /* Tokens. */ | 43 | /* Token type. */ |
44 | #ifndef YYTOKENTYPE | 44 | #ifndef YYTOKENTYPE |
45 | # define YYTOKENTYPE | 45 | # define YYTOKENTYPE |
46 | /* Put the tokens into the symbol table, so that GDB and other debuggers | 46 | enum yytokentype |
47 | know about them. */ | 47 | { |
48 | enum yytokentype { | 48 | DT_V1 = 258, |
49 | DT_V1 = 258, | 49 | DT_MEMRESERVE = 259, |
50 | DT_MEMRESERVE = 259, | 50 | DT_LSHIFT = 260, |
51 | DT_LSHIFT = 260, | 51 | DT_RSHIFT = 261, |
52 | DT_RSHIFT = 261, | 52 | DT_LE = 262, |
53 | DT_LE = 262, | 53 | DT_GE = 263, |
54 | DT_GE = 263, | 54 | DT_EQ = 264, |
55 | DT_EQ = 264, | 55 | DT_NE = 265, |
56 | DT_NE = 265, | 56 | DT_AND = 266, |
57 | DT_AND = 266, | 57 | DT_OR = 267, |
58 | DT_OR = 267, | 58 | DT_BITS = 268, |
59 | DT_BITS = 268, | 59 | DT_DEL_PROP = 269, |
60 | DT_DEL_PROP = 269, | 60 | DT_DEL_NODE = 270, |
61 | DT_DEL_NODE = 270, | 61 | DT_PROPNODENAME = 271, |
62 | DT_PROPNODENAME = 271, | 62 | DT_LITERAL = 272, |
63 | DT_LITERAL = 272, | 63 | DT_CHAR_LITERAL = 273, |
64 | DT_CHAR_LITERAL = 273, | 64 | DT_BYTE = 274, |
65 | DT_BASE = 274, | 65 | DT_STRING = 275, |
66 | DT_BYTE = 275, | 66 | DT_LABEL = 276, |
67 | DT_STRING = 276, | 67 | DT_REF = 277, |
68 | DT_LABEL = 277, | 68 | DT_INCBIN = 278 |
69 | DT_REF = 278, | 69 | }; |
70 | DT_INCBIN = 279 | ||
71 | }; | ||
72 | #endif | 70 | #endif |
73 | 71 | ||
74 | 72 | /* Value type. */ | |
75 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | 73 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
76 | typedef union YYSTYPE | 74 | typedef union YYSTYPE YYSTYPE; |
75 | union YYSTYPE | ||
77 | { | 76 | { |
78 | /* Line 2053 of yacc.c */ | 77 | #line 38 "dtc-parser.y" /* yacc.c:1909 */ |
79 | #line 40 "dtc-parser.y" | ||
80 | 78 | ||
81 | char *propnodename; | 79 | char *propnodename; |
82 | char *literal; | ||
83 | char *labelref; | 80 | char *labelref; |
84 | unsigned int cbase; | ||
85 | uint8_t byte; | 81 | uint8_t byte; |
86 | struct data data; | 82 | struct data data; |
87 | 83 | ||
@@ -97,29 +93,29 @@ typedef union YYSTYPE | |||
97 | struct reserve_info *re; | 93 | struct reserve_info *re; |
98 | uint64_t integer; | 94 | uint64_t integer; |
99 | 95 | ||
100 | 96 | #line 97 "dtc-parser.tab.h" /* yacc.c:1909 */ | |
101 | /* Line 2053 of yacc.c */ | 97 | }; |
102 | #line 103 "dtc-parser.tab.h" | ||
103 | } YYSTYPE; | ||
104 | # define YYSTYPE_IS_TRIVIAL 1 | 98 | # define YYSTYPE_IS_TRIVIAL 1 |
105 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||
106 | # define YYSTYPE_IS_DECLARED 1 | 99 | # define YYSTYPE_IS_DECLARED 1 |
107 | #endif | 100 | #endif |
108 | 101 | ||
109 | extern YYSTYPE yylval; | 102 | /* Location type. */ |
110 | 103 | #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED | |
111 | #ifdef YYPARSE_PARAM | 104 | typedef struct YYLTYPE YYLTYPE; |
112 | #if defined __STDC__ || defined __cplusplus | 105 | struct YYLTYPE |
113 | int yyparse (void *YYPARSE_PARAM); | 106 | { |
114 | #else | 107 | int first_line; |
115 | int yyparse (); | 108 | int first_column; |
109 | int last_line; | ||
110 | int last_column; | ||
111 | }; | ||
112 | # define YYLTYPE_IS_DECLARED 1 | ||
113 | # define YYLTYPE_IS_TRIVIAL 1 | ||
116 | #endif | 114 | #endif |
117 | #else /* ! YYPARSE_PARAM */ | 115 | |
118 | #if defined __STDC__ || defined __cplusplus | 116 | |
117 | extern YYSTYPE yylval; | ||
118 | extern YYLTYPE yylloc; | ||
119 | int yyparse (void); | 119 | int yyparse (void); |
120 | #else | ||
121 | int yyparse (); | ||
122 | #endif | ||
123 | #endif /* ! YYPARSE_PARAM */ | ||
124 | 120 | ||
125 | #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ | 121 | #endif /* !YY_YY_DTC_PARSER_TAB_H_INCLUDED */ |
diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y index f412460f94d7..5a897e36562d 100644 --- a/scripts/dtc/dtc-parser.y +++ b/scripts/dtc/dtc-parser.y | |||
@@ -17,31 +17,27 @@ | |||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
18 | * USA | 18 | * USA |
19 | */ | 19 | */ |
20 | |||
21 | %{ | 20 | %{ |
22 | #include <stdio.h> | 21 | #include <stdio.h> |
23 | 22 | ||
24 | #include "dtc.h" | 23 | #include "dtc.h" |
25 | #include "srcpos.h" | 24 | #include "srcpos.h" |
26 | 25 | ||
27 | YYLTYPE yylloc; | ||
28 | |||
29 | extern int yylex(void); | 26 | extern int yylex(void); |
30 | extern void print_error(char const *fmt, ...); | ||
31 | extern void yyerror(char const *s); | 27 | extern void yyerror(char const *s); |
28 | #define ERROR(loc, ...) \ | ||
29 | do { \ | ||
30 | srcpos_error((loc), "Error", __VA_ARGS__); \ | ||
31 | treesource_error = true; \ | ||
32 | } while (0) | ||
32 | 33 | ||
33 | extern struct boot_info *the_boot_info; | 34 | extern struct boot_info *the_boot_info; |
34 | extern int treesource_error; | 35 | extern bool treesource_error; |
35 | |||
36 | static unsigned long long eval_literal(const char *s, int base, int bits); | ||
37 | static unsigned char eval_char_literal(const char *s); | ||
38 | %} | 36 | %} |
39 | 37 | ||
40 | %union { | 38 | %union { |
41 | char *propnodename; | 39 | char *propnodename; |
42 | char *literal; | ||
43 | char *labelref; | 40 | char *labelref; |
44 | unsigned int cbase; | ||
45 | uint8_t byte; | 41 | uint8_t byte; |
46 | struct data data; | 42 | struct data data; |
47 | 43 | ||
@@ -65,9 +61,8 @@ static unsigned char eval_char_literal(const char *s); | |||
65 | %token DT_DEL_PROP | 61 | %token DT_DEL_PROP |
66 | %token DT_DEL_NODE | 62 | %token DT_DEL_NODE |
67 | %token <propnodename> DT_PROPNODENAME | 63 | %token <propnodename> DT_PROPNODENAME |
68 | %token <literal> DT_LITERAL | 64 | %token <integer> DT_LITERAL |
69 | %token <literal> DT_CHAR_LITERAL | 65 | %token <integer> DT_CHAR_LITERAL |
70 | %token <cbase> DT_BASE | ||
71 | %token <byte> DT_BYTE | 66 | %token <byte> DT_BYTE |
72 | %token <data> DT_STRING | 67 | %token <data> DT_STRING |
73 | %token <labelref> DT_LABEL | 68 | %token <labelref> DT_LABEL |
@@ -145,6 +140,18 @@ devicetree: | |||
145 | { | 140 | { |
146 | $$ = merge_nodes($1, $3); | 141 | $$ = merge_nodes($1, $3); |
147 | } | 142 | } |
143 | |||
144 | | devicetree DT_LABEL DT_REF nodedef | ||
145 | { | ||
146 | struct node *target = get_node_by_ref($1, $3); | ||
147 | |||
148 | add_label(&target->labels, $2); | ||
149 | if (target) | ||
150 | merge_nodes(target, $4); | ||
151 | else | ||
152 | ERROR(&@3, "Label or path %s not found", $3); | ||
153 | $$ = $1; | ||
154 | } | ||
148 | | devicetree DT_REF nodedef | 155 | | devicetree DT_REF nodedef |
149 | { | 156 | { |
150 | struct node *target = get_node_by_ref($1, $2); | 157 | struct node *target = get_node_by_ref($1, $2); |
@@ -152,17 +159,18 @@ devicetree: | |||
152 | if (target) | 159 | if (target) |
153 | merge_nodes(target, $3); | 160 | merge_nodes(target, $3); |
154 | else | 161 | else |
155 | print_error("label or path, '%s', not found", $2); | 162 | ERROR(&@2, "Label or path %s not found", $2); |
156 | $$ = $1; | 163 | $$ = $1; |
157 | } | 164 | } |
158 | | devicetree DT_DEL_NODE DT_REF ';' | 165 | | devicetree DT_DEL_NODE DT_REF ';' |
159 | { | 166 | { |
160 | struct node *target = get_node_by_ref($1, $3); | 167 | struct node *target = get_node_by_ref($1, $3); |
161 | 168 | ||
162 | if (!target) | 169 | if (target) |
163 | print_error("label or path, '%s', not found", $3); | ||
164 | else | ||
165 | delete_node(target); | 170 | delete_node(target); |
171 | else | ||
172 | ERROR(&@3, "Label or path %s not found", $3); | ||
173 | |||
166 | 174 | ||
167 | $$ = $1; | 175 | $$ = $1; |
168 | } | 176 | } |
@@ -230,10 +238,9 @@ propdata: | |||
230 | 238 | ||
231 | if ($6 != 0) | 239 | if ($6 != 0) |
232 | if (fseek(f, $6, SEEK_SET) != 0) | 240 | if (fseek(f, $6, SEEK_SET) != 0) |
233 | print_error("Couldn't seek to offset %llu in \"%s\": %s", | 241 | die("Couldn't seek to offset %llu in \"%s\": %s", |
234 | (unsigned long long)$6, | 242 | (unsigned long long)$6, $4.val, |
235 | $4.val, | 243 | strerror(errno)); |
236 | strerror(errno)); | ||
237 | 244 | ||
238 | d = data_copy_file(f, $8); | 245 | d = data_copy_file(f, $8); |
239 | 246 | ||
@@ -274,18 +281,19 @@ propdataprefix: | |||
274 | arrayprefix: | 281 | arrayprefix: |
275 | DT_BITS DT_LITERAL '<' | 282 | DT_BITS DT_LITERAL '<' |
276 | { | 283 | { |
277 | $$.data = empty_data; | 284 | unsigned long long bits; |
278 | $$.bits = eval_literal($2, 0, 7); | 285 | |
279 | 286 | bits = $2; | |
280 | if (($$.bits != 8) && | 287 | |
281 | ($$.bits != 16) && | 288 | if ((bits != 8) && (bits != 16) && |
282 | ($$.bits != 32) && | 289 | (bits != 32) && (bits != 64)) { |
283 | ($$.bits != 64)) | 290 | ERROR(&@2, "Array elements must be" |
284 | { | 291 | " 8, 16, 32 or 64-bits"); |
285 | print_error("Only 8, 16, 32 and 64-bit elements" | 292 | bits = 32; |
286 | " are currently supported"); | ||
287 | $$.bits = 32; | ||
288 | } | 293 | } |
294 | |||
295 | $$.data = empty_data; | ||
296 | $$.bits = bits; | ||
289 | } | 297 | } |
290 | | '<' | 298 | | '<' |
291 | { | 299 | { |
@@ -305,9 +313,8 @@ arrayprefix: | |||
305 | * mask), all bits are one. | 313 | * mask), all bits are one. |
306 | */ | 314 | */ |
307 | if (($2 > mask) && (($2 | mask) != -1ULL)) | 315 | if (($2 > mask) && (($2 | mask) != -1ULL)) |
308 | print_error( | 316 | ERROR(&@2, "Value out of range for" |
309 | "integer value out of range " | 317 | " %d-bit array element", $1.bits); |
310 | "%016lx (%d bits)", $1.bits); | ||
311 | } | 318 | } |
312 | 319 | ||
313 | $$.data = data_append_integer($1.data, $2, $1.bits); | 320 | $$.data = data_append_integer($1.data, $2, $1.bits); |
@@ -321,7 +328,7 @@ arrayprefix: | |||
321 | REF_PHANDLE, | 328 | REF_PHANDLE, |
322 | $2); | 329 | $2); |
323 | else | 330 | else |
324 | print_error("References are only allowed in " | 331 | ERROR(&@2, "References are only allowed in " |
325 | "arrays with 32-bit elements."); | 332 | "arrays with 32-bit elements."); |
326 | 333 | ||
327 | $$.data = data_append_integer($1.data, val, $1.bits); | 334 | $$.data = data_append_integer($1.data, val, $1.bits); |
@@ -334,13 +341,7 @@ arrayprefix: | |||
334 | 341 | ||
335 | integer_prim: | 342 | integer_prim: |
336 | DT_LITERAL | 343 | DT_LITERAL |
337 | { | ||
338 | $$ = eval_literal($1, 0, 64); | ||
339 | } | ||
340 | | DT_CHAR_LITERAL | 344 | | DT_CHAR_LITERAL |
341 | { | ||
342 | $$ = eval_char_literal($1); | ||
343 | } | ||
344 | | '(' integer_expr ')' | 345 | | '(' integer_expr ')' |
345 | { | 346 | { |
346 | $$ = $2; | 347 | $$ = $2; |
@@ -447,7 +448,7 @@ subnodes: | |||
447 | } | 448 | } |
448 | | subnode propdef | 449 | | subnode propdef |
449 | { | 450 | { |
450 | print_error("syntax error: properties must precede subnodes"); | 451 | ERROR(&@2, "Properties must precede subnodes"); |
451 | YYERROR; | 452 | YYERROR; |
452 | } | 453 | } |
453 | ; | 454 | ; |
@@ -470,63 +471,7 @@ subnode: | |||
470 | 471 | ||
471 | %% | 472 | %% |
472 | 473 | ||
473 | void print_error(char const *fmt, ...) | 474 | void yyerror(char const *s) |
474 | { | ||
475 | va_list va; | ||
476 | |||
477 | va_start(va, fmt); | ||
478 | srcpos_verror(&yylloc, fmt, va); | ||
479 | va_end(va); | ||
480 | |||
481 | treesource_error = 1; | ||
482 | } | ||
483 | |||
484 | void yyerror(char const *s) { | ||
485 | print_error("%s", s); | ||
486 | } | ||
487 | |||
488 | static unsigned long long eval_literal(const char *s, int base, int bits) | ||
489 | { | ||
490 | unsigned long long val; | ||
491 | char *e; | ||
492 | |||
493 | errno = 0; | ||
494 | val = strtoull(s, &e, base); | ||
495 | if (*e) { | ||
496 | size_t uls = strspn(e, "UL"); | ||
497 | if (e[uls]) | ||
498 | print_error("bad characters in literal"); | ||
499 | } | ||
500 | if ((errno == ERANGE) | ||
501 | || ((bits < 64) && (val >= (1ULL << bits)))) | ||
502 | print_error("literal out of range"); | ||
503 | else if (errno != 0) | ||
504 | print_error("bad literal"); | ||
505 | return val; | ||
506 | } | ||
507 | |||
508 | static unsigned char eval_char_literal(const char *s) | ||
509 | { | 475 | { |
510 | int i = 1; | 476 | ERROR(&yylloc, "%s", s); |
511 | char c = s[0]; | ||
512 | |||
513 | if (c == '\0') | ||
514 | { | ||
515 | print_error("empty character literal"); | ||
516 | return 0; | ||
517 | } | ||
518 | |||
519 | /* | ||
520 | * If the first character in the character literal is a \ then process | ||
521 | * the remaining characters as an escape encoding. If the first | ||
522 | * character is neither an escape or a terminator it should be the only | ||
523 | * character in the literal and will be returned. | ||
524 | */ | ||
525 | if (c == '\\') | ||
526 | c = get_escape_char(s, &i); | ||
527 | |||
528 | if (s[i] != '\0') | ||
529 | print_error("malformed character literal"); | ||
530 | |||
531 | return c; | ||
532 | } | 477 | } |
diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c index e3c96536fd9d..8c4add69a765 100644 --- a/scripts/dtc/dtc.c +++ b/scripts/dtc/dtc.c | |||
@@ -48,6 +48,8 @@ static void fill_fullpaths(struct node *tree, const char *prefix) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | /* Usage related data. */ | 50 | /* Usage related data. */ |
51 | #define FDT_VERSION(version) _FDT_VERSION(version) | ||
52 | #define _FDT_VERSION(version) #version | ||
51 | static const char usage_synopsis[] = "dtc [options] <input file>"; | 53 | static const char usage_synopsis[] = "dtc [options] <input file>"; |
52 | static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv"; | 54 | static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv"; |
53 | static struct option const usage_long_opts[] = { | 55 | static struct option const usage_long_opts[] = { |
@@ -82,9 +84,9 @@ static const char * const usage_opts_help[] = { | |||
82 | "\t\tdts - device tree source text\n" | 84 | "\t\tdts - device tree source text\n" |
83 | "\t\tdtb - device tree blob\n" | 85 | "\t\tdtb - device tree blob\n" |
84 | "\t\tasm - assembler source", | 86 | "\t\tasm - assembler source", |
85 | "\n\tBlob version to produce, defaults to %d (for dtb and asm output)", //, DEFAULT_FDT_VERSION); | 87 | "\n\tBlob version to produce, defaults to "FDT_VERSION(DEFAULT_FDT_VERSION)" (for dtb and asm output)", |
86 | "\n\tOutput dependency file", | 88 | "\n\tOutput dependency file", |
87 | "\n\ttMake space for <number> reserve map entries (for dtb and asm output)", | 89 | "\n\tMake space for <number> reserve map entries (for dtb and asm output)", |
88 | "\n\tMake the blob at least <bytes> long (extra space)", | 90 | "\n\tMake the blob at least <bytes> long (extra space)", |
89 | "\n\tAdd padding to the blob of <bytes> long (extra space)", | 91 | "\n\tAdd padding to the blob of <bytes> long (extra space)", |
90 | "\n\tSet the physical boot cpu", | 92 | "\n\tSet the physical boot cpu", |
@@ -109,7 +111,7 @@ int main(int argc, char *argv[]) | |||
109 | const char *outform = "dts"; | 111 | const char *outform = "dts"; |
110 | const char *outname = "-"; | 112 | const char *outname = "-"; |
111 | const char *depname = NULL; | 113 | const char *depname = NULL; |
112 | int force = 0, sort = 0; | 114 | bool force = false, sort = false; |
113 | const char *arg; | 115 | const char *arg; |
114 | int opt; | 116 | int opt; |
115 | FILE *outf = NULL; | 117 | FILE *outf = NULL; |
@@ -148,7 +150,7 @@ int main(int argc, char *argv[]) | |||
148 | padsize = strtol(optarg, NULL, 0); | 150 | padsize = strtol(optarg, NULL, 0); |
149 | break; | 151 | break; |
150 | case 'f': | 152 | case 'f': |
151 | force = 1; | 153 | force = true; |
152 | break; | 154 | break; |
153 | case 'q': | 155 | case 'q': |
154 | quiet++; | 156 | quiet++; |
@@ -174,7 +176,7 @@ int main(int argc, char *argv[]) | |||
174 | break; | 176 | break; |
175 | 177 | ||
176 | case 's': | 178 | case 's': |
177 | sort = 1; | 179 | sort = true; |
178 | break; | 180 | break; |
179 | 181 | ||
180 | case 'W': | 182 | case 'W': |
@@ -237,7 +239,7 @@ int main(int argc, char *argv[]) | |||
237 | if (streq(outname, "-")) { | 239 | if (streq(outname, "-")) { |
238 | outf = stdout; | 240 | outf = stdout; |
239 | } else { | 241 | } else { |
240 | outf = fopen(outname, "w"); | 242 | outf = fopen(outname, "wb"); |
241 | if (! outf) | 243 | if (! outf) |
242 | die("Couldn't open output file %s: %s\n", | 244 | die("Couldn't open output file %s: %s\n", |
243 | outname, strerror(errno)); | 245 | outname, strerror(errno)); |
diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h index 264a20cf66a8..56212c8df660 100644 --- a/scripts/dtc/dtc.h +++ b/scripts/dtc/dtc.h | |||
@@ -38,9 +38,9 @@ | |||
38 | #include "util.h" | 38 | #include "util.h" |
39 | 39 | ||
40 | #ifdef DEBUG | 40 | #ifdef DEBUG |
41 | #define debug(fmt,args...) printf(fmt, ##args) | 41 | #define debug(...) printf(__VA_ARGS__) |
42 | #else | 42 | #else |
43 | #define debug(fmt,args...) | 43 | #define debug(...) |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | 46 | ||
@@ -88,7 +88,7 @@ struct data { | |||
88 | }; | 88 | }; |
89 | 89 | ||
90 | 90 | ||
91 | #define empty_data ((struct data){ /* all .members = 0 or NULL */ }) | 91 | #define empty_data ((struct data){ 0 /* all .members = 0 or NULL */ }) |
92 | 92 | ||
93 | #define for_each_marker(m) \ | 93 | #define for_each_marker(m) \ |
94 | for (; (m); (m) = (m)->next) | 94 | for (; (m); (m) = (m)->next) |
@@ -118,7 +118,7 @@ struct data data_append_align(struct data d, int align); | |||
118 | 118 | ||
119 | struct data data_add_marker(struct data d, enum markertype type, char *ref); | 119 | struct data data_add_marker(struct data d, enum markertype type, char *ref); |
120 | 120 | ||
121 | int data_is_one_string(struct data d); | 121 | bool data_is_one_string(struct data d); |
122 | 122 | ||
123 | /* DT constraints */ | 123 | /* DT constraints */ |
124 | 124 | ||
@@ -127,13 +127,13 @@ int data_is_one_string(struct data d); | |||
127 | 127 | ||
128 | /* Live trees */ | 128 | /* Live trees */ |
129 | struct label { | 129 | struct label { |
130 | int deleted; | 130 | bool deleted; |
131 | char *label; | 131 | char *label; |
132 | struct label *next; | 132 | struct label *next; |
133 | }; | 133 | }; |
134 | 134 | ||
135 | struct property { | 135 | struct property { |
136 | int deleted; | 136 | bool deleted; |
137 | char *name; | 137 | char *name; |
138 | struct data val; | 138 | struct data val; |
139 | 139 | ||
@@ -143,7 +143,7 @@ struct property { | |||
143 | }; | 143 | }; |
144 | 144 | ||
145 | struct node { | 145 | struct node { |
146 | int deleted; | 146 | bool deleted; |
147 | char *name; | 147 | char *name; |
148 | struct property *proplist; | 148 | struct property *proplist; |
149 | struct node *children; | 149 | struct node *children; |
@@ -247,8 +247,8 @@ void sort_tree(struct boot_info *bi); | |||
247 | 247 | ||
248 | /* Checks */ | 248 | /* Checks */ |
249 | 249 | ||
250 | void parse_checks_option(bool warn, bool error, const char *optarg); | 250 | void parse_checks_option(bool warn, bool error, const char *arg); |
251 | void process_checks(int force, struct boot_info *bi); | 251 | void process_checks(bool force, struct boot_info *bi); |
252 | 252 | ||
253 | /* Flattened trees */ | 253 | /* Flattened trees */ |
254 | 254 | ||
diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c index 665dad7bb465..bd99fa2d33b8 100644 --- a/scripts/dtc/flattree.c +++ b/scripts/dtc/flattree.c | |||
@@ -261,7 +261,7 @@ static void flatten_tree(struct node *tree, struct emitter *emit, | |||
261 | { | 261 | { |
262 | struct property *prop; | 262 | struct property *prop; |
263 | struct node *child; | 263 | struct node *child; |
264 | int seen_name_prop = 0; | 264 | bool seen_name_prop = false; |
265 | 265 | ||
266 | if (tree->deleted) | 266 | if (tree->deleted) |
267 | return; | 267 | return; |
@@ -279,7 +279,7 @@ static void flatten_tree(struct node *tree, struct emitter *emit, | |||
279 | int nameoff; | 279 | int nameoff; |
280 | 280 | ||
281 | if (streq(prop->name, "name")) | 281 | if (streq(prop->name, "name")) |
282 | seen_name_prop = 1; | 282 | seen_name_prop = true; |
283 | 283 | ||
284 | nameoff = stringtable_insert(strbuf, prop->name); | 284 | nameoff = stringtable_insert(strbuf, prop->name); |
285 | 285 | ||
diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c index e464727c8808..6d1beec9581d 100644 --- a/scripts/dtc/fstree.c +++ b/scripts/dtc/fstree.c | |||
@@ -37,26 +37,26 @@ static struct node *read_fstree(const char *dirname) | |||
37 | tree = build_node(NULL, NULL); | 37 | tree = build_node(NULL, NULL); |
38 | 38 | ||
39 | while ((de = readdir(d)) != NULL) { | 39 | while ((de = readdir(d)) != NULL) { |
40 | char *tmpnam; | 40 | char *tmpname; |
41 | 41 | ||
42 | if (streq(de->d_name, ".") | 42 | if (streq(de->d_name, ".") |
43 | || streq(de->d_name, "..")) | 43 | || streq(de->d_name, "..")) |
44 | continue; | 44 | continue; |
45 | 45 | ||
46 | tmpnam = join_path(dirname, de->d_name); | 46 | tmpname = join_path(dirname, de->d_name); |
47 | 47 | ||
48 | if (lstat(tmpnam, &st) < 0) | 48 | if (lstat(tmpname, &st) < 0) |
49 | die("stat(%s): %s\n", tmpnam, strerror(errno)); | 49 | die("stat(%s): %s\n", tmpname, strerror(errno)); |
50 | 50 | ||
51 | if (S_ISREG(st.st_mode)) { | 51 | if (S_ISREG(st.st_mode)) { |
52 | struct property *prop; | 52 | struct property *prop; |
53 | FILE *pfile; | 53 | FILE *pfile; |
54 | 54 | ||
55 | pfile = fopen(tmpnam, "r"); | 55 | pfile = fopen(tmpname, "rb"); |
56 | if (! pfile) { | 56 | if (! pfile) { |
57 | fprintf(stderr, | 57 | fprintf(stderr, |
58 | "WARNING: Cannot open %s: %s\n", | 58 | "WARNING: Cannot open %s: %s\n", |
59 | tmpnam, strerror(errno)); | 59 | tmpname, strerror(errno)); |
60 | } else { | 60 | } else { |
61 | prop = build_property(xstrdup(de->d_name), | 61 | prop = build_property(xstrdup(de->d_name), |
62 | data_copy_file(pfile, | 62 | data_copy_file(pfile, |
@@ -67,12 +67,12 @@ static struct node *read_fstree(const char *dirname) | |||
67 | } else if (S_ISDIR(st.st_mode)) { | 67 | } else if (S_ISDIR(st.st_mode)) { |
68 | struct node *newchild; | 68 | struct node *newchild; |
69 | 69 | ||
70 | newchild = read_fstree(tmpnam); | 70 | newchild = read_fstree(tmpname); |
71 | newchild = name_node(newchild, xstrdup(de->d_name)); | 71 | newchild = name_node(newchild, xstrdup(de->d_name)); |
72 | add_child(tree, newchild); | 72 | add_child(tree, newchild); |
73 | } | 73 | } |
74 | 74 | ||
75 | free(tmpnam); | 75 | free(tmpname); |
76 | } | 76 | } |
77 | 77 | ||
78 | closedir(d); | 78 | closedir(d); |
@@ -88,3 +88,4 @@ struct boot_info *dt_from_fs(const char *dirname) | |||
88 | 88 | ||
89 | return build_boot_info(NULL, tree, guess_boot_cpuid(tree)); | 89 | return build_boot_info(NULL, tree, guess_boot_cpuid(tree)); |
90 | } | 90 | } |
91 | |||
diff --git a/scripts/dtc/libfdt/Makefile.libfdt b/scripts/dtc/libfdt/Makefile.libfdt index 91126c000a1e..09c322ed82ba 100644 --- a/scripts/dtc/libfdt/Makefile.libfdt +++ b/scripts/dtc/libfdt/Makefile.libfdt | |||
@@ -6,5 +6,6 @@ | |||
6 | LIBFDT_soname = libfdt.$(SHAREDLIB_EXT).1 | 6 | LIBFDT_soname = libfdt.$(SHAREDLIB_EXT).1 |
7 | LIBFDT_INCLUDES = fdt.h libfdt.h libfdt_env.h | 7 | LIBFDT_INCLUDES = fdt.h libfdt.h libfdt_env.h |
8 | LIBFDT_VERSION = version.lds | 8 | LIBFDT_VERSION = version.lds |
9 | LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c fdt_empty_tree.c | 9 | LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c fdt_empty_tree.c \ |
10 | fdt_addresses.c | ||
10 | LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o) | 11 | LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o) |
diff --git a/scripts/dtc/libfdt/fdt.c b/scripts/dtc/libfdt/fdt.c index e56833ae9b6f..2ce6a44179de 100644 --- a/scripts/dtc/libfdt/fdt.c +++ b/scripts/dtc/libfdt/fdt.c | |||
@@ -92,7 +92,7 @@ const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int len) | |||
92 | 92 | ||
93 | uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset) | 93 | uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset) |
94 | { | 94 | { |
95 | const uint32_t *tagp, *lenp; | 95 | const fdt32_t *tagp, *lenp; |
96 | uint32_t tag; | 96 | uint32_t tag; |
97 | int offset = startoffset; | 97 | int offset = startoffset; |
98 | const char *p; | 98 | const char *p; |
@@ -198,6 +198,34 @@ int fdt_next_node(const void *fdt, int offset, int *depth) | |||
198 | return offset; | 198 | return offset; |
199 | } | 199 | } |
200 | 200 | ||
201 | int fdt_first_subnode(const void *fdt, int offset) | ||
202 | { | ||
203 | int depth = 0; | ||
204 | |||
205 | offset = fdt_next_node(fdt, offset, &depth); | ||
206 | if (offset < 0 || depth != 1) | ||
207 | return -FDT_ERR_NOTFOUND; | ||
208 | |||
209 | return offset; | ||
210 | } | ||
211 | |||
212 | int fdt_next_subnode(const void *fdt, int offset) | ||
213 | { | ||
214 | int depth = 1; | ||
215 | |||
216 | /* | ||
217 | * With respect to the parent, the depth of the next subnode will be | ||
218 | * the same as the last. | ||
219 | */ | ||
220 | do { | ||
221 | offset = fdt_next_node(fdt, offset, &depth); | ||
222 | if (offset < 0 || depth < 1) | ||
223 | return -FDT_ERR_NOTFOUND; | ||
224 | } while (depth > 1); | ||
225 | |||
226 | return offset; | ||
227 | } | ||
228 | |||
201 | const char *_fdt_find_string(const char *strtab, int tabsize, const char *s) | 229 | const char *_fdt_find_string(const char *strtab, int tabsize, const char *s) |
202 | { | 230 | { |
203 | int len = strlen(s) + 1; | 231 | int len = strlen(s) + 1; |
diff --git a/scripts/dtc/libfdt/fdt.h b/scripts/dtc/libfdt/fdt.h index 48ccfd910000..526aedb51556 100644 --- a/scripts/dtc/libfdt/fdt.h +++ b/scripts/dtc/libfdt/fdt.h | |||
@@ -1,48 +1,99 @@ | |||
1 | #ifndef _FDT_H | 1 | #ifndef _FDT_H |
2 | #define _FDT_H | 2 | #define _FDT_H |
3 | /* | ||
4 | * libfdt - Flat Device Tree manipulation | ||
5 | * Copyright (C) 2006 David Gibson, IBM Corporation. | ||
6 | * Copyright 2012 Kim Phillips, Freescale Semiconductor. | ||
7 | * | ||
8 | * libfdt is dual licensed: you can use it either under the terms of | ||
9 | * the GPL, or the BSD license, at your option. | ||
10 | * | ||
11 | * a) This library is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License as | ||
13 | * published by the Free Software Foundation; either version 2 of the | ||
14 | * License, or (at your option) any later version. | ||
15 | * | ||
16 | * This library is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public | ||
22 | * License along with this library; if not, write to the Free | ||
23 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, | ||
24 | * MA 02110-1301 USA | ||
25 | * | ||
26 | * Alternatively, | ||
27 | * | ||
28 | * b) Redistribution and use in source and binary forms, with or | ||
29 | * without modification, are permitted provided that the following | ||
30 | * conditions are met: | ||
31 | * | ||
32 | * 1. Redistributions of source code must retain the above | ||
33 | * copyright notice, this list of conditions and the following | ||
34 | * disclaimer. | ||
35 | * 2. Redistributions in binary form must reproduce the above | ||
36 | * copyright notice, this list of conditions and the following | ||
37 | * disclaimer in the documentation and/or other materials | ||
38 | * provided with the distribution. | ||
39 | * | ||
40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
44 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
45 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
46 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
47 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
48 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
49 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
50 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
51 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
52 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
53 | */ | ||
3 | 54 | ||
4 | #ifndef __ASSEMBLY__ | 55 | #ifndef __ASSEMBLY__ |
5 | 56 | ||
6 | struct fdt_header { | 57 | struct fdt_header { |
7 | uint32_t magic; /* magic word FDT_MAGIC */ | 58 | fdt32_t magic; /* magic word FDT_MAGIC */ |
8 | uint32_t totalsize; /* total size of DT block */ | 59 | fdt32_t totalsize; /* total size of DT block */ |
9 | uint32_t off_dt_struct; /* offset to structure */ | 60 | fdt32_t off_dt_struct; /* offset to structure */ |
10 | uint32_t off_dt_strings; /* offset to strings */ | 61 | fdt32_t off_dt_strings; /* offset to strings */ |
11 | uint32_t off_mem_rsvmap; /* offset to memory reserve map */ | 62 | fdt32_t off_mem_rsvmap; /* offset to memory reserve map */ |
12 | uint32_t version; /* format version */ | 63 | fdt32_t version; /* format version */ |
13 | uint32_t last_comp_version; /* last compatible version */ | 64 | fdt32_t last_comp_version; /* last compatible version */ |
14 | 65 | ||
15 | /* version 2 fields below */ | 66 | /* version 2 fields below */ |
16 | uint32_t boot_cpuid_phys; /* Which physical CPU id we're | 67 | fdt32_t boot_cpuid_phys; /* Which physical CPU id we're |
17 | booting on */ | 68 | booting on */ |
18 | /* version 3 fields below */ | 69 | /* version 3 fields below */ |
19 | uint32_t size_dt_strings; /* size of the strings block */ | 70 | fdt32_t size_dt_strings; /* size of the strings block */ |
20 | 71 | ||
21 | /* version 17 fields below */ | 72 | /* version 17 fields below */ |
22 | uint32_t size_dt_struct; /* size of the structure block */ | 73 | fdt32_t size_dt_struct; /* size of the structure block */ |
23 | }; | 74 | }; |
24 | 75 | ||
25 | struct fdt_reserve_entry { | 76 | struct fdt_reserve_entry { |
26 | uint64_t address; | 77 | fdt64_t address; |
27 | uint64_t size; | 78 | fdt64_t size; |
28 | }; | 79 | }; |
29 | 80 | ||
30 | struct fdt_node_header { | 81 | struct fdt_node_header { |
31 | uint32_t tag; | 82 | fdt32_t tag; |
32 | char name[0]; | 83 | char name[0]; |
33 | }; | 84 | }; |
34 | 85 | ||
35 | struct fdt_property { | 86 | struct fdt_property { |
36 | uint32_t tag; | 87 | fdt32_t tag; |
37 | uint32_t len; | 88 | fdt32_t len; |
38 | uint32_t nameoff; | 89 | fdt32_t nameoff; |
39 | char data[0]; | 90 | char data[0]; |
40 | }; | 91 | }; |
41 | 92 | ||
42 | #endif /* !__ASSEMBLY */ | 93 | #endif /* !__ASSEMBLY */ |
43 | 94 | ||
44 | #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ | 95 | #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ |
45 | #define FDT_TAGSIZE sizeof(uint32_t) | 96 | #define FDT_TAGSIZE sizeof(fdt32_t) |
46 | 97 | ||
47 | #define FDT_BEGIN_NODE 0x1 /* Start node: full name */ | 98 | #define FDT_BEGIN_NODE 0x1 /* Start node: full name */ |
48 | #define FDT_END_NODE 0x2 /* End node */ | 99 | #define FDT_END_NODE 0x2 /* End node */ |
@@ -51,10 +102,10 @@ struct fdt_property { | |||
51 | #define FDT_NOP 0x4 /* nop */ | 102 | #define FDT_NOP 0x4 /* nop */ |
52 | #define FDT_END 0x9 | 103 | #define FDT_END 0x9 |
53 | 104 | ||
54 | #define FDT_V1_SIZE (7*sizeof(uint32_t)) | 105 | #define FDT_V1_SIZE (7*sizeof(fdt32_t)) |
55 | #define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(uint32_t)) | 106 | #define FDT_V2_SIZE (FDT_V1_SIZE + sizeof(fdt32_t)) |
56 | #define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(uint32_t)) | 107 | #define FDT_V3_SIZE (FDT_V2_SIZE + sizeof(fdt32_t)) |
57 | #define FDT_V16_SIZE FDT_V3_SIZE | 108 | #define FDT_V16_SIZE FDT_V3_SIZE |
58 | #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(uint32_t)) | 109 | #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(fdt32_t)) |
59 | 110 | ||
60 | #endif /* _FDT_H */ | 111 | #endif /* _FDT_H */ |
diff --git a/scripts/dtc/libfdt/fdt_empty_tree.c b/scripts/dtc/libfdt/fdt_empty_tree.c index f2ae9b77c285..f72d13b1d19c 100644 --- a/scripts/dtc/libfdt/fdt_empty_tree.c +++ b/scripts/dtc/libfdt/fdt_empty_tree.c | |||
@@ -81,3 +81,4 @@ int fdt_create_empty_tree(void *buf, int bufsize) | |||
81 | 81 | ||
82 | return fdt_open_into(buf, buf, bufsize); | 82 | return fdt_open_into(buf, buf, bufsize); |
83 | } | 83 | } |
84 | |||
diff --git a/scripts/dtc/libfdt/fdt_ro.c b/scripts/dtc/libfdt/fdt_ro.c index 02b6d687537f..a65e4b5b72b6 100644 --- a/scripts/dtc/libfdt/fdt_ro.c +++ b/scripts/dtc/libfdt/fdt_ro.c | |||
@@ -154,9 +154,9 @@ int fdt_subnode_offset(const void *fdt, int parentoffset, | |||
154 | return fdt_subnode_offset_namelen(fdt, parentoffset, name, strlen(name)); | 154 | return fdt_subnode_offset_namelen(fdt, parentoffset, name, strlen(name)); |
155 | } | 155 | } |
156 | 156 | ||
157 | int fdt_path_offset(const void *fdt, const char *path) | 157 | int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen) |
158 | { | 158 | { |
159 | const char *end = path + strlen(path); | 159 | const char *end = path + namelen; |
160 | const char *p = path; | 160 | const char *p = path; |
161 | int offset = 0; | 161 | int offset = 0; |
162 | 162 | ||
@@ -164,7 +164,7 @@ int fdt_path_offset(const void *fdt, const char *path) | |||
164 | 164 | ||
165 | /* see if we have an alias */ | 165 | /* see if we have an alias */ |
166 | if (*path != '/') { | 166 | if (*path != '/') { |
167 | const char *q = strchr(path, '/'); | 167 | const char *q = memchr(path, '/', end - p); |
168 | 168 | ||
169 | if (!q) | 169 | if (!q) |
170 | q = end; | 170 | q = end; |
@@ -177,14 +177,15 @@ int fdt_path_offset(const void *fdt, const char *path) | |||
177 | p = q; | 177 | p = q; |
178 | } | 178 | } |
179 | 179 | ||
180 | while (*p) { | 180 | while (p < end) { |
181 | const char *q; | 181 | const char *q; |
182 | 182 | ||
183 | while (*p == '/') | 183 | while (*p == '/') { |
184 | p++; | 184 | p++; |
185 | if (! *p) | 185 | if (p == end) |
186 | return offset; | 186 | return offset; |
187 | q = strchr(p, '/'); | 187 | } |
188 | q = memchr(p, '/', end - p); | ||
188 | if (! q) | 189 | if (! q) |
189 | q = end; | 190 | q = end; |
190 | 191 | ||
@@ -198,6 +199,11 @@ int fdt_path_offset(const void *fdt, const char *path) | |||
198 | return offset; | 199 | return offset; |
199 | } | 200 | } |
200 | 201 | ||
202 | int fdt_path_offset(const void *fdt, const char *path) | ||
203 | { | ||
204 | return fdt_path_offset_namelen(fdt, path, strlen(path)); | ||
205 | } | ||
206 | |||
201 | const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) | 207 | const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) |
202 | { | 208 | { |
203 | const struct fdt_node_header *nh = _fdt_offset_ptr(fdt, nodeoffset); | 209 | const struct fdt_node_header *nh = _fdt_offset_ptr(fdt, nodeoffset); |
@@ -322,7 +328,7 @@ const void *fdt_getprop(const void *fdt, int nodeoffset, | |||
322 | 328 | ||
323 | uint32_t fdt_get_phandle(const void *fdt, int nodeoffset) | 329 | uint32_t fdt_get_phandle(const void *fdt, int nodeoffset) |
324 | { | 330 | { |
325 | const uint32_t *php; | 331 | const fdt32_t *php; |
326 | int len; | 332 | int len; |
327 | 333 | ||
328 | /* FIXME: This is a bit sub-optimal, since we potentially scan | 334 | /* FIXME: This is a bit sub-optimal, since we potentially scan |
@@ -515,8 +521,7 @@ int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle) | |||
515 | return offset; /* error from fdt_next_node() */ | 521 | return offset; /* error from fdt_next_node() */ |
516 | } | 522 | } |
517 | 523 | ||
518 | static int _fdt_stringlist_contains(const char *strlist, int listlen, | 524 | int fdt_stringlist_contains(const char *strlist, int listlen, const char *str) |
519 | const char *str) | ||
520 | { | 525 | { |
521 | int len = strlen(str); | 526 | int len = strlen(str); |
522 | const char *p; | 527 | const char *p; |
@@ -542,7 +547,7 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset, | |||
542 | prop = fdt_getprop(fdt, nodeoffset, "compatible", &len); | 547 | prop = fdt_getprop(fdt, nodeoffset, "compatible", &len); |
543 | if (!prop) | 548 | if (!prop) |
544 | return len; | 549 | return len; |
545 | if (_fdt_stringlist_contains(prop, len, compatible)) | 550 | if (fdt_stringlist_contains(prop, len, compatible)) |
546 | return 0; | 551 | return 0; |
547 | else | 552 | else |
548 | return 1; | 553 | return 1; |
diff --git a/scripts/dtc/libfdt/fdt_rw.c b/scripts/dtc/libfdt/fdt_rw.c index 24437dfc32b8..70adec6c371b 100644 --- a/scripts/dtc/libfdt/fdt_rw.c +++ b/scripts/dtc/libfdt/fdt_rw.c | |||
@@ -84,9 +84,9 @@ static int _fdt_rw_check_header(void *fdt) | |||
84 | 84 | ||
85 | #define FDT_RW_CHECK_HEADER(fdt) \ | 85 | #define FDT_RW_CHECK_HEADER(fdt) \ |
86 | { \ | 86 | { \ |
87 | int err; \ | 87 | int __err; \ |
88 | if ((err = _fdt_rw_check_header(fdt)) != 0) \ | 88 | if ((__err = _fdt_rw_check_header(fdt)) != 0) \ |
89 | return err; \ | 89 | return __err; \ |
90 | } | 90 | } |
91 | 91 | ||
92 | static inline int _fdt_data_size(void *fdt) | 92 | static inline int _fdt_data_size(void *fdt) |
@@ -339,7 +339,7 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset, | |||
339 | int nodelen; | 339 | int nodelen; |
340 | int err; | 340 | int err; |
341 | uint32_t tag; | 341 | uint32_t tag; |
342 | uint32_t *endtag; | 342 | fdt32_t *endtag; |
343 | 343 | ||
344 | FDT_RW_CHECK_HEADER(fdt); | 344 | FDT_RW_CHECK_HEADER(fdt); |
345 | 345 | ||
@@ -366,7 +366,7 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset, | |||
366 | nh->tag = cpu_to_fdt32(FDT_BEGIN_NODE); | 366 | nh->tag = cpu_to_fdt32(FDT_BEGIN_NODE); |
367 | memset(nh->name, 0, FDT_TAGALIGN(namelen+1)); | 367 | memset(nh->name, 0, FDT_TAGALIGN(namelen+1)); |
368 | memcpy(nh->name, name, namelen); | 368 | memcpy(nh->name, name, namelen); |
369 | endtag = (uint32_t *)((char *)nh + nodelen - FDT_TAGSIZE); | 369 | endtag = (fdt32_t *)((char *)nh + nodelen - FDT_TAGSIZE); |
370 | *endtag = cpu_to_fdt32(FDT_END_NODE); | 370 | *endtag = cpu_to_fdt32(FDT_END_NODE); |
371 | 371 | ||
372 | return offset; | 372 | return offset; |
diff --git a/scripts/dtc/libfdt/fdt_sw.c b/scripts/dtc/libfdt/fdt_sw.c index 55ebebf1eb20..6a804859fd0c 100644 --- a/scripts/dtc/libfdt/fdt_sw.c +++ b/scripts/dtc/libfdt/fdt_sw.c | |||
@@ -107,6 +107,38 @@ int fdt_create(void *buf, int bufsize) | |||
107 | return 0; | 107 | return 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | int fdt_resize(void *fdt, void *buf, int bufsize) | ||
111 | { | ||
112 | size_t headsize, tailsize; | ||
113 | char *oldtail, *newtail; | ||
114 | |||
115 | FDT_SW_CHECK_HEADER(fdt); | ||
116 | |||
117 | headsize = fdt_off_dt_struct(fdt); | ||
118 | tailsize = fdt_size_dt_strings(fdt); | ||
119 | |||
120 | if ((headsize + tailsize) > bufsize) | ||
121 | return -FDT_ERR_NOSPACE; | ||
122 | |||
123 | oldtail = (char *)fdt + fdt_totalsize(fdt) - tailsize; | ||
124 | newtail = (char *)buf + bufsize - tailsize; | ||
125 | |||
126 | /* Two cases to avoid clobbering data if the old and new | ||
127 | * buffers partially overlap */ | ||
128 | if (buf <= fdt) { | ||
129 | memmove(buf, fdt, headsize); | ||
130 | memmove(newtail, oldtail, tailsize); | ||
131 | } else { | ||
132 | memmove(newtail, oldtail, tailsize); | ||
133 | memmove(buf, fdt, headsize); | ||
134 | } | ||
135 | |||
136 | fdt_set_off_dt_strings(buf, bufsize); | ||
137 | fdt_set_totalsize(buf, bufsize); | ||
138 | |||
139 | return 0; | ||
140 | } | ||
141 | |||
110 | int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size) | 142 | int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size) |
111 | { | 143 | { |
112 | struct fdt_reserve_entry *re; | 144 | struct fdt_reserve_entry *re; |
@@ -153,7 +185,7 @@ int fdt_begin_node(void *fdt, const char *name) | |||
153 | 185 | ||
154 | int fdt_end_node(void *fdt) | 186 | int fdt_end_node(void *fdt) |
155 | { | 187 | { |
156 | uint32_t *en; | 188 | fdt32_t *en; |
157 | 189 | ||
158 | FDT_SW_CHECK_HEADER(fdt); | 190 | FDT_SW_CHECK_HEADER(fdt); |
159 | 191 | ||
@@ -213,7 +245,7 @@ int fdt_property(void *fdt, const char *name, const void *val, int len) | |||
213 | int fdt_finish(void *fdt) | 245 | int fdt_finish(void *fdt) |
214 | { | 246 | { |
215 | char *p = (char *)fdt; | 247 | char *p = (char *)fdt; |
216 | uint32_t *end; | 248 | fdt32_t *end; |
217 | int oldstroffset, newstroffset; | 249 | int oldstroffset, newstroffset; |
218 | uint32_t tag; | 250 | uint32_t tag; |
219 | int offset, nextoffset; | 251 | int offset, nextoffset; |
diff --git a/scripts/dtc/libfdt/fdt_wip.c b/scripts/dtc/libfdt/fdt_wip.c index 6025fa1fe8fe..c5bbb68d3273 100644 --- a/scripts/dtc/libfdt/fdt_wip.c +++ b/scripts/dtc/libfdt/fdt_wip.c | |||
@@ -74,7 +74,7 @@ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, | |||
74 | 74 | ||
75 | static void _fdt_nop_region(void *start, int len) | 75 | static void _fdt_nop_region(void *start, int len) |
76 | { | 76 | { |
77 | uint32_t *p; | 77 | fdt32_t *p; |
78 | 78 | ||
79 | for (p = start; (char *)p < ((char *)start + len); p++) | 79 | for (p = start; (char *)p < ((char *)start + len); p++) |
80 | *p = cpu_to_fdt32(FDT_NOP); | 80 | *p = cpu_to_fdt32(FDT_NOP); |
diff --git a/scripts/dtc/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h index 73f49759a5e7..ea35ac3c9be4 100644 --- a/scripts/dtc/libfdt/libfdt.h +++ b/scripts/dtc/libfdt/libfdt.h | |||
@@ -51,8 +51,8 @@ | |||
51 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
52 | */ | 52 | */ |
53 | 53 | ||
54 | #include <libfdt_env.h> | 54 | #include "libfdt_env.h" |
55 | #include <fdt.h> | 55 | #include "fdt.h" |
56 | 56 | ||
57 | #define FDT_FIRST_SUPPORTED_VERSION 0x10 | 57 | #define FDT_FIRST_SUPPORTED_VERSION 0x10 |
58 | #define FDT_LAST_SUPPORTED_VERSION 0x11 | 58 | #define FDT_LAST_SUPPORTED_VERSION 0x11 |
@@ -116,7 +116,12 @@ | |||
116 | * Should never be returned, if it is, it indicates a bug in | 116 | * Should never be returned, if it is, it indicates a bug in |
117 | * libfdt itself. */ | 117 | * libfdt itself. */ |
118 | 118 | ||
119 | #define FDT_ERR_MAX 13 | 119 | /* Errors in device tree content */ |
120 | #define FDT_ERR_BADNCELLS 14 | ||
121 | /* FDT_ERR_BADNCELLS: Device tree has a #address-cells, #size-cells | ||
122 | * or similar property with a bad format or value */ | ||
123 | |||
124 | #define FDT_ERR_MAX 14 | ||
120 | 125 | ||
121 | /**********************************************************************/ | 126 | /**********************************************************************/ |
122 | /* Low-level functions (you probably don't need these) */ | 127 | /* Low-level functions (you probably don't need these) */ |
@@ -136,6 +141,28 @@ uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset); | |||
136 | 141 | ||
137 | int fdt_next_node(const void *fdt, int offset, int *depth); | 142 | int fdt_next_node(const void *fdt, int offset, int *depth); |
138 | 143 | ||
144 | /** | ||
145 | * fdt_first_subnode() - get offset of first direct subnode | ||
146 | * | ||
147 | * @fdt: FDT blob | ||
148 | * @offset: Offset of node to check | ||
149 | * @return offset of first subnode, or -FDT_ERR_NOTFOUND if there is none | ||
150 | */ | ||
151 | int fdt_first_subnode(const void *fdt, int offset); | ||
152 | |||
153 | /** | ||
154 | * fdt_next_subnode() - get offset of next direct subnode | ||
155 | * | ||
156 | * After first calling fdt_first_subnode(), call this function repeatedly to | ||
157 | * get direct subnodes of a parent node. | ||
158 | * | ||
159 | * @fdt: FDT blob | ||
160 | * @offset: Offset of previous subnode | ||
161 | * @return offset of next subnode, or -FDT_ERR_NOTFOUND if there are no more | ||
162 | * subnodes | ||
163 | */ | ||
164 | int fdt_next_subnode(const void *fdt, int offset); | ||
165 | |||
139 | /**********************************************************************/ | 166 | /**********************************************************************/ |
140 | /* General functions */ | 167 | /* General functions */ |
141 | /**********************************************************************/ | 168 | /**********************************************************************/ |
@@ -296,6 +323,17 @@ int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, | |||
296 | int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name); | 323 | int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name); |
297 | 324 | ||
298 | /** | 325 | /** |
326 | * fdt_path_offset_namelen - find a tree node by its full path | ||
327 | * @fdt: pointer to the device tree blob | ||
328 | * @path: full path of the node to locate | ||
329 | * @namelen: number of characters of path to consider | ||
330 | * | ||
331 | * Identical to fdt_path_offset(), but only consider the first namelen | ||
332 | * characters of path as the path name. | ||
333 | */ | ||
334 | int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen); | ||
335 | |||
336 | /** | ||
299 | * fdt_path_offset - find a tree node by its full path | 337 | * fdt_path_offset - find a tree node by its full path |
300 | * @fdt: pointer to the device tree blob | 338 | * @fdt: pointer to the device tree blob |
301 | * @path: full path of the node to locate | 339 | * @path: full path of the node to locate |
@@ -582,7 +620,7 @@ const char *fdt_get_alias_namelen(const void *fdt, | |||
582 | * value of the property named 'name' in the node /aliases. | 620 | * value of the property named 'name' in the node /aliases. |
583 | * | 621 | * |
584 | * returns: | 622 | * returns: |
585 | * a pointer to the expansion of the alias named 'name', of it exists | 623 | * a pointer to the expansion of the alias named 'name', if it exists |
586 | * NULL, if the given alias or the /aliases node does not exist | 624 | * NULL, if the given alias or the /aliases node does not exist |
587 | */ | 625 | */ |
588 | const char *fdt_get_alias(const void *fdt, const char *name); | 626 | const char *fdt_get_alias(const void *fdt, const char *name); |
@@ -816,6 +854,75 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset, | |||
816 | int fdt_node_offset_by_compatible(const void *fdt, int startoffset, | 854 | int fdt_node_offset_by_compatible(const void *fdt, int startoffset, |
817 | const char *compatible); | 855 | const char *compatible); |
818 | 856 | ||
857 | /** | ||
858 | * fdt_stringlist_contains - check a string list property for a string | ||
859 | * @strlist: Property containing a list of strings to check | ||
860 | * @listlen: Length of property | ||
861 | * @str: String to search for | ||
862 | * | ||
863 | * This is a utility function provided for convenience. The list contains | ||
864 | * one or more strings, each terminated by \0, as is found in a device tree | ||
865 | * "compatible" property. | ||
866 | * | ||
867 | * @return: 1 if the string is found in the list, 0 not found, or invalid list | ||
868 | */ | ||
869 | int fdt_stringlist_contains(const char *strlist, int listlen, const char *str); | ||
870 | |||
871 | /**********************************************************************/ | ||
872 | /* Read-only functions (addressing related) */ | ||
873 | /**********************************************************************/ | ||
874 | |||
875 | /** | ||
876 | * FDT_MAX_NCELLS - maximum value for #address-cells and #size-cells | ||
877 | * | ||
878 | * This is the maximum value for #address-cells, #size-cells and | ||
879 | * similar properties that will be processed by libfdt. IEE1275 | ||
880 | * requires that OF implementations handle values up to 4. | ||
881 | * Implementations may support larger values, but in practice higher | ||
882 | * values aren't used. | ||
883 | */ | ||
884 | #define FDT_MAX_NCELLS 4 | ||
885 | |||
886 | /** | ||
887 | * fdt_address_cells - retrieve address size for a bus represented in the tree | ||
888 | * @fdt: pointer to the device tree blob | ||
889 | * @nodeoffset: offset of the node to find the address size for | ||
890 | * | ||
891 | * When the node has a valid #address-cells property, returns its value. | ||
892 | * | ||
893 | * returns: | ||
894 | * 0 <= n < FDT_MAX_NCELLS, on success | ||
895 | * 2, if the node has no #address-cells property | ||
896 | * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid #address-cells property | ||
897 | * -FDT_ERR_BADMAGIC, | ||
898 | * -FDT_ERR_BADVERSION, | ||
899 | * -FDT_ERR_BADSTATE, | ||
900 | * -FDT_ERR_BADSTRUCTURE, | ||
901 | * -FDT_ERR_TRUNCATED, standard meanings | ||
902 | */ | ||
903 | int fdt_address_cells(const void *fdt, int nodeoffset); | ||
904 | |||
905 | /** | ||
906 | * fdt_size_cells - retrieve address range size for a bus represented in the | ||
907 | * tree | ||
908 | * @fdt: pointer to the device tree blob | ||
909 | * @nodeoffset: offset of the node to find the address range size for | ||
910 | * | ||
911 | * When the node has a valid #size-cells property, returns its value. | ||
912 | * | ||
913 | * returns: | ||
914 | * 0 <= n < FDT_MAX_NCELLS, on success | ||
915 | * 2, if the node has no #address-cells property | ||
916 | * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid #size-cells property | ||
917 | * -FDT_ERR_BADMAGIC, | ||
918 | * -FDT_ERR_BADVERSION, | ||
919 | * -FDT_ERR_BADSTATE, | ||
920 | * -FDT_ERR_BADSTRUCTURE, | ||
921 | * -FDT_ERR_TRUNCATED, standard meanings | ||
922 | */ | ||
923 | int fdt_size_cells(const void *fdt, int nodeoffset); | ||
924 | |||
925 | |||
819 | /**********************************************************************/ | 926 | /**********************************************************************/ |
820 | /* Write-in-place functions */ | 927 | /* Write-in-place functions */ |
821 | /**********************************************************************/ | 928 | /**********************************************************************/ |
@@ -882,8 +989,8 @@ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, | |||
882 | static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, | 989 | static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, |
883 | const char *name, uint32_t val) | 990 | const char *name, uint32_t val) |
884 | { | 991 | { |
885 | val = cpu_to_fdt32(val); | 992 | fdt32_t tmp = cpu_to_fdt32(val); |
886 | return fdt_setprop_inplace(fdt, nodeoffset, name, &val, sizeof(val)); | 993 | return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp)); |
887 | } | 994 | } |
888 | 995 | ||
889 | /** | 996 | /** |
@@ -917,8 +1024,8 @@ static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, | |||
917 | static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, | 1024 | static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, |
918 | const char *name, uint64_t val) | 1025 | const char *name, uint64_t val) |
919 | { | 1026 | { |
920 | val = cpu_to_fdt64(val); | 1027 | fdt64_t tmp = cpu_to_fdt64(val); |
921 | return fdt_setprop_inplace(fdt, nodeoffset, name, &val, sizeof(val)); | 1028 | return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp)); |
922 | } | 1029 | } |
923 | 1030 | ||
924 | /** | 1031 | /** |
@@ -987,19 +1094,20 @@ int fdt_nop_node(void *fdt, int nodeoffset); | |||
987 | /**********************************************************************/ | 1094 | /**********************************************************************/ |
988 | 1095 | ||
989 | int fdt_create(void *buf, int bufsize); | 1096 | int fdt_create(void *buf, int bufsize); |
1097 | int fdt_resize(void *fdt, void *buf, int bufsize); | ||
990 | int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size); | 1098 | int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size); |
991 | int fdt_finish_reservemap(void *fdt); | 1099 | int fdt_finish_reservemap(void *fdt); |
992 | int fdt_begin_node(void *fdt, const char *name); | 1100 | int fdt_begin_node(void *fdt, const char *name); |
993 | int fdt_property(void *fdt, const char *name, const void *val, int len); | 1101 | int fdt_property(void *fdt, const char *name, const void *val, int len); |
994 | static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val) | 1102 | static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val) |
995 | { | 1103 | { |
996 | val = cpu_to_fdt32(val); | 1104 | fdt32_t tmp = cpu_to_fdt32(val); |
997 | return fdt_property(fdt, name, &val, sizeof(val)); | 1105 | return fdt_property(fdt, name, &tmp, sizeof(tmp)); |
998 | } | 1106 | } |
999 | static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val) | 1107 | static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val) |
1000 | { | 1108 | { |
1001 | val = cpu_to_fdt64(val); | 1109 | fdt64_t tmp = cpu_to_fdt64(val); |
1002 | return fdt_property(fdt, name, &val, sizeof(val)); | 1110 | return fdt_property(fdt, name, &tmp, sizeof(tmp)); |
1003 | } | 1111 | } |
1004 | static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) | 1112 | static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) |
1005 | { | 1113 | { |
@@ -1154,8 +1262,8 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name, | |||
1154 | static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, | 1262 | static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, |
1155 | uint32_t val) | 1263 | uint32_t val) |
1156 | { | 1264 | { |
1157 | val = cpu_to_fdt32(val); | 1265 | fdt32_t tmp = cpu_to_fdt32(val); |
1158 | return fdt_setprop(fdt, nodeoffset, name, &val, sizeof(val)); | 1266 | return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp)); |
1159 | } | 1267 | } |
1160 | 1268 | ||
1161 | /** | 1269 | /** |
@@ -1189,8 +1297,8 @@ static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, | |||
1189 | static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, | 1297 | static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, |
1190 | uint64_t val) | 1298 | uint64_t val) |
1191 | { | 1299 | { |
1192 | val = cpu_to_fdt64(val); | 1300 | fdt64_t tmp = cpu_to_fdt64(val); |
1193 | return fdt_setprop(fdt, nodeoffset, name, &val, sizeof(val)); | 1301 | return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp)); |
1194 | } | 1302 | } |
1195 | 1303 | ||
1196 | /** | 1304 | /** |
@@ -1296,8 +1404,8 @@ int fdt_appendprop(void *fdt, int nodeoffset, const char *name, | |||
1296 | static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, | 1404 | static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, |
1297 | const char *name, uint32_t val) | 1405 | const char *name, uint32_t val) |
1298 | { | 1406 | { |
1299 | val = cpu_to_fdt32(val); | 1407 | fdt32_t tmp = cpu_to_fdt32(val); |
1300 | return fdt_appendprop(fdt, nodeoffset, name, &val, sizeof(val)); | 1408 | return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp)); |
1301 | } | 1409 | } |
1302 | 1410 | ||
1303 | /** | 1411 | /** |
@@ -1331,8 +1439,8 @@ static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, | |||
1331 | static inline int fdt_appendprop_u64(void *fdt, int nodeoffset, | 1439 | static inline int fdt_appendprop_u64(void *fdt, int nodeoffset, |
1332 | const char *name, uint64_t val) | 1440 | const char *name, uint64_t val) |
1333 | { | 1441 | { |
1334 | val = cpu_to_fdt64(val); | 1442 | fdt64_t tmp = cpu_to_fdt64(val); |
1335 | return fdt_appendprop(fdt, nodeoffset, name, &val, sizeof(val)); | 1443 | return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp)); |
1336 | } | 1444 | } |
1337 | 1445 | ||
1338 | /** | 1446 | /** |
diff --git a/scripts/dtc/libfdt/libfdt_env.h b/scripts/dtc/libfdt/libfdt_env.h index 213d7fb81c42..9dea97dfff81 100644 --- a/scripts/dtc/libfdt/libfdt_env.h +++ b/scripts/dtc/libfdt/libfdt_env.h | |||
@@ -1,29 +1,111 @@ | |||
1 | #ifndef _LIBFDT_ENV_H | 1 | #ifndef _LIBFDT_ENV_H |
2 | #define _LIBFDT_ENV_H | 2 | #define _LIBFDT_ENV_H |
3 | /* | ||
4 | * libfdt - Flat Device Tree manipulation | ||
5 | * Copyright (C) 2006 David Gibson, IBM Corporation. | ||
6 | * Copyright 2012 Kim Phillips, Freescale Semiconductor. | ||
7 | * | ||
8 | * libfdt is dual licensed: you can use it either under the terms of | ||
9 | * the GPL, or the BSD license, at your option. | ||
10 | * | ||
11 | * a) This library is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License as | ||
13 | * published by the Free Software Foundation; either version 2 of the | ||
14 | * License, or (at your option) any later version. | ||
15 | * | ||
16 | * This library is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public | ||
22 | * License along with this library; if not, write to the Free | ||
23 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, | ||
24 | * MA 02110-1301 USA | ||
25 | * | ||
26 | * Alternatively, | ||
27 | * | ||
28 | * b) Redistribution and use in source and binary forms, with or | ||
29 | * without modification, are permitted provided that the following | ||
30 | * conditions are met: | ||
31 | * | ||
32 | * 1. Redistributions of source code must retain the above | ||
33 | * copyright notice, this list of conditions and the following | ||
34 | * disclaimer. | ||
35 | * 2. Redistributions in binary form must reproduce the above | ||
36 | * copyright notice, this list of conditions and the following | ||
37 | * disclaimer in the documentation and/or other materials | ||
38 | * provided with the distribution. | ||
39 | * | ||
40 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
41 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
42 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
43 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
44 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
45 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
46 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
47 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
48 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
49 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
50 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
51 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
52 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
53 | */ | ||
3 | 54 | ||
4 | #include <stddef.h> | 55 | #include <stddef.h> |
5 | #include <stdint.h> | 56 | #include <stdint.h> |
6 | #include <string.h> | 57 | #include <string.h> |
7 | 58 | ||
8 | #define EXTRACT_BYTE(n) ((unsigned long long)((uint8_t *)&x)[n]) | 59 | #ifdef __CHECKER__ |
9 | static inline uint16_t fdt16_to_cpu(uint16_t x) | 60 | #define __force __attribute__((force)) |
61 | #define __bitwise __attribute__((bitwise)) | ||
62 | #else | ||
63 | #define __force | ||
64 | #define __bitwise | ||
65 | #endif | ||
66 | |||
67 | typedef uint16_t __bitwise fdt16_t; | ||
68 | typedef uint32_t __bitwise fdt32_t; | ||
69 | typedef uint64_t __bitwise fdt64_t; | ||
70 | |||
71 | #define EXTRACT_BYTE(x, n) ((unsigned long long)((uint8_t *)&x)[n]) | ||
72 | #define CPU_TO_FDT16(x) ((EXTRACT_BYTE(x, 0) << 8) | EXTRACT_BYTE(x, 1)) | ||
73 | #define CPU_TO_FDT32(x) ((EXTRACT_BYTE(x, 0) << 24) | (EXTRACT_BYTE(x, 1) << 16) | \ | ||
74 | (EXTRACT_BYTE(x, 2) << 8) | EXTRACT_BYTE(x, 3)) | ||
75 | #define CPU_TO_FDT64(x) ((EXTRACT_BYTE(x, 0) << 56) | (EXTRACT_BYTE(x, 1) << 48) | \ | ||
76 | (EXTRACT_BYTE(x, 2) << 40) | (EXTRACT_BYTE(x, 3) << 32) | \ | ||
77 | (EXTRACT_BYTE(x, 4) << 24) | (EXTRACT_BYTE(x, 5) << 16) | \ | ||
78 | (EXTRACT_BYTE(x, 6) << 8) | EXTRACT_BYTE(x, 7)) | ||
79 | |||
80 | static inline uint16_t fdt16_to_cpu(fdt16_t x) | ||
81 | { | ||
82 | return (__force uint16_t)CPU_TO_FDT16(x); | ||
83 | } | ||
84 | static inline fdt16_t cpu_to_fdt16(uint16_t x) | ||
10 | { | 85 | { |
11 | return (EXTRACT_BYTE(0) << 8) | EXTRACT_BYTE(1); | 86 | return (__force fdt16_t)CPU_TO_FDT16(x); |
12 | } | 87 | } |
13 | #define cpu_to_fdt16(x) fdt16_to_cpu(x) | ||
14 | 88 | ||
15 | static inline uint32_t fdt32_to_cpu(uint32_t x) | 89 | static inline uint32_t fdt32_to_cpu(fdt32_t x) |
16 | { | 90 | { |
17 | return (EXTRACT_BYTE(0) << 24) | (EXTRACT_BYTE(1) << 16) | (EXTRACT_BYTE(2) << 8) | EXTRACT_BYTE(3); | 91 | return (__force uint32_t)CPU_TO_FDT32(x); |
92 | } | ||
93 | static inline fdt32_t cpu_to_fdt32(uint32_t x) | ||
94 | { | ||
95 | return (__force fdt32_t)CPU_TO_FDT32(x); | ||
18 | } | 96 | } |
19 | #define cpu_to_fdt32(x) fdt32_to_cpu(x) | ||
20 | 97 | ||
21 | static inline uint64_t fdt64_to_cpu(uint64_t x) | 98 | static inline uint64_t fdt64_to_cpu(fdt64_t x) |
99 | { | ||
100 | return (__force uint64_t)CPU_TO_FDT64(x); | ||
101 | } | ||
102 | static inline fdt64_t cpu_to_fdt64(uint64_t x) | ||
22 | { | 103 | { |
23 | return (EXTRACT_BYTE(0) << 56) | (EXTRACT_BYTE(1) << 48) | (EXTRACT_BYTE(2) << 40) | (EXTRACT_BYTE(3) << 32) | 104 | return (__force fdt64_t)CPU_TO_FDT64(x); |
24 | | (EXTRACT_BYTE(4) << 24) | (EXTRACT_BYTE(5) << 16) | (EXTRACT_BYTE(6) << 8) | EXTRACT_BYTE(7); | ||
25 | } | 105 | } |
26 | #define cpu_to_fdt64(x) fdt64_to_cpu(x) | 106 | #undef CPU_TO_FDT64 |
107 | #undef CPU_TO_FDT32 | ||
108 | #undef CPU_TO_FDT16 | ||
27 | #undef EXTRACT_BYTE | 109 | #undef EXTRACT_BYTE |
28 | 110 | ||
29 | #endif /* _LIBFDT_ENV_H */ | 111 | #endif /* _LIBFDT_ENV_H */ |
diff --git a/scripts/dtc/libfdt/libfdt_internal.h b/scripts/dtc/libfdt/libfdt_internal.h index 381133ba81df..02cfa6fb612d 100644 --- a/scripts/dtc/libfdt/libfdt_internal.h +++ b/scripts/dtc/libfdt/libfdt_internal.h | |||
@@ -57,9 +57,9 @@ | |||
57 | 57 | ||
58 | #define FDT_CHECK_HEADER(fdt) \ | 58 | #define FDT_CHECK_HEADER(fdt) \ |
59 | { \ | 59 | { \ |
60 | int err; \ | 60 | int __err; \ |
61 | if ((err = fdt_check_header(fdt)) != 0) \ | 61 | if ((__err = fdt_check_header(fdt)) != 0) \ |
62 | return err; \ | 62 | return __err; \ |
63 | } | 63 | } |
64 | 64 | ||
65 | int _fdt_check_node_offset(const void *fdt, int offset); | 65 | int _fdt_check_node_offset(const void *fdt, int offset); |
diff --git a/scripts/dtc/livetree.c b/scripts/dtc/livetree.c index b61465fb2f33..e229b84432f9 100644 --- a/scripts/dtc/livetree.c +++ b/scripts/dtc/livetree.c | |||
@@ -511,7 +511,9 @@ struct node *get_node_by_phandle(struct node *tree, cell_t phandle) | |||
511 | 511 | ||
512 | struct node *get_node_by_ref(struct node *tree, const char *ref) | 512 | struct node *get_node_by_ref(struct node *tree, const char *ref) |
513 | { | 513 | { |
514 | if (ref[0] == '/') | 514 | if (streq(ref, "/")) |
515 | return tree; | ||
516 | else if (ref[0] == '/') | ||
515 | return get_node_by_path(tree, ref); | 517 | return get_node_by_path(tree, ref); |
516 | else | 518 | else |
517 | return get_node_by_label(tree, ref); | 519 | return get_node_by_label(tree, ref); |
diff --git a/scripts/dtc/srcpos.c b/scripts/dtc/srcpos.c index c20bc5315bc1..f534c22a888d 100644 --- a/scripts/dtc/srcpos.c +++ b/scripts/dtc/srcpos.c | |||
@@ -34,7 +34,7 @@ struct search_path { | |||
34 | static struct search_path *search_path_head, **search_path_tail; | 34 | static struct search_path *search_path_head, **search_path_tail; |
35 | 35 | ||
36 | 36 | ||
37 | static char *dirname(const char *path) | 37 | static char *get_dirname(const char *path) |
38 | { | 38 | { |
39 | const char *slash = strrchr(path, '/'); | 39 | const char *slash = strrchr(path, '/'); |
40 | 40 | ||
@@ -77,7 +77,7 @@ static char *try_open(const char *dirname, const char *fname, FILE **fp) | |||
77 | else | 77 | else |
78 | fullname = join_path(dirname, fname); | 78 | fullname = join_path(dirname, fname); |
79 | 79 | ||
80 | *fp = fopen(fullname, "r"); | 80 | *fp = fopen(fullname, "rb"); |
81 | if (!*fp) { | 81 | if (!*fp) { |
82 | free(fullname); | 82 | free(fullname); |
83 | fullname = NULL; | 83 | fullname = NULL; |
@@ -150,7 +150,7 @@ void srcfile_push(const char *fname) | |||
150 | srcfile = xmalloc(sizeof(*srcfile)); | 150 | srcfile = xmalloc(sizeof(*srcfile)); |
151 | 151 | ||
152 | srcfile->f = srcfile_relative_open(fname, &srcfile->name); | 152 | srcfile->f = srcfile_relative_open(fname, &srcfile->name); |
153 | srcfile->dir = dirname(srcfile->name); | 153 | srcfile->dir = get_dirname(srcfile->name); |
154 | srcfile->prev = current_srcfile; | 154 | srcfile->prev = current_srcfile; |
155 | 155 | ||
156 | srcfile->lineno = 1; | 156 | srcfile->lineno = 1; |
@@ -159,7 +159,7 @@ void srcfile_push(const char *fname) | |||
159 | current_srcfile = srcfile; | 159 | current_srcfile = srcfile; |
160 | } | 160 | } |
161 | 161 | ||
162 | int srcfile_pop(void) | 162 | bool srcfile_pop(void) |
163 | { | 163 | { |
164 | struct srcfile_state *srcfile = current_srcfile; | 164 | struct srcfile_state *srcfile = current_srcfile; |
165 | 165 | ||
@@ -177,7 +177,7 @@ int srcfile_pop(void) | |||
177 | * fix this we could either allocate all the files from a | 177 | * fix this we could either allocate all the files from a |
178 | * table, or use a pool allocator. */ | 178 | * table, or use a pool allocator. */ |
179 | 179 | ||
180 | return current_srcfile ? 1 : 0; | 180 | return current_srcfile ? true : false; |
181 | } | 181 | } |
182 | 182 | ||
183 | void srcfile_add_search_path(const char *dirname) | 183 | void srcfile_add_search_path(const char *dirname) |
@@ -290,42 +290,27 @@ srcpos_string(struct srcpos *pos) | |||
290 | return pos_str; | 290 | return pos_str; |
291 | } | 291 | } |
292 | 292 | ||
293 | void | 293 | void srcpos_verror(struct srcpos *pos, const char *prefix, |
294 | srcpos_verror(struct srcpos *pos, char const *fmt, va_list va) | 294 | const char *fmt, va_list va) |
295 | { | 295 | { |
296 | const char *srcstr; | 296 | char *srcstr; |
297 | |||
298 | srcstr = srcpos_string(pos); | ||
299 | 297 | ||
300 | fprintf(stderr, "Error: %s ", srcstr); | 298 | srcstr = srcpos_string(pos); |
301 | vfprintf(stderr, fmt, va); | ||
302 | fprintf(stderr, "\n"); | ||
303 | } | ||
304 | 299 | ||
305 | void | 300 | fprintf(stderr, "%s: %s ", prefix, srcstr); |
306 | srcpos_error(struct srcpos *pos, char const *fmt, ...) | 301 | vfprintf(stderr, fmt, va); |
307 | { | 302 | fprintf(stderr, "\n"); |
308 | va_list va; | ||
309 | 303 | ||
310 | va_start(va, fmt); | 304 | free(srcstr); |
311 | srcpos_verror(pos, fmt, va); | ||
312 | va_end(va); | ||
313 | } | 305 | } |
314 | 306 | ||
315 | 307 | void srcpos_error(struct srcpos *pos, const char *prefix, | |
316 | void | 308 | const char *fmt, ...) |
317 | srcpos_warn(struct srcpos *pos, char const *fmt, ...) | ||
318 | { | 309 | { |
319 | const char *srcstr; | ||
320 | va_list va; | 310 | va_list va; |
321 | va_start(va, fmt); | ||
322 | |||
323 | srcstr = srcpos_string(pos); | ||
324 | |||
325 | fprintf(stderr, "Warning: %s ", srcstr); | ||
326 | vfprintf(stderr, fmt, va); | ||
327 | fprintf(stderr, "\n"); | ||
328 | 311 | ||
312 | va_start(va, fmt); | ||
313 | srcpos_verror(pos, prefix, fmt, va); | ||
329 | va_end(va); | 314 | va_end(va); |
330 | } | 315 | } |
331 | 316 | ||
diff --git a/scripts/dtc/srcpos.h b/scripts/dtc/srcpos.h index 93a27123c2e9..f81827bd684a 100644 --- a/scripts/dtc/srcpos.h +++ b/scripts/dtc/srcpos.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define _SRCPOS_H_ | 21 | #define _SRCPOS_H_ |
22 | 22 | ||
23 | #include <stdio.h> | 23 | #include <stdio.h> |
24 | #include <stdbool.h> | ||
24 | 25 | ||
25 | struct srcfile_state { | 26 | struct srcfile_state { |
26 | FILE *f; | 27 | FILE *f; |
@@ -55,7 +56,7 @@ extern struct srcfile_state *current_srcfile; /* = NULL */ | |||
55 | FILE *srcfile_relative_open(const char *fname, char **fullnamep); | 56 | FILE *srcfile_relative_open(const char *fname, char **fullnamep); |
56 | 57 | ||
57 | void srcfile_push(const char *fname); | 58 | void srcfile_push(const char *fname); |
58 | int srcfile_pop(void); | 59 | bool srcfile_pop(void); |
59 | 60 | ||
60 | /** | 61 | /** |
61 | * Add a new directory to the search path for input files | 62 | * Add a new directory to the search path for input files |
@@ -106,12 +107,12 @@ extern struct srcpos *srcpos_copy(struct srcpos *pos); | |||
106 | extern char *srcpos_string(struct srcpos *pos); | 107 | extern char *srcpos_string(struct srcpos *pos); |
107 | extern void srcpos_dump(struct srcpos *pos); | 108 | extern void srcpos_dump(struct srcpos *pos); |
108 | 109 | ||
109 | extern void srcpos_verror(struct srcpos *pos, char const *, va_list va) | 110 | extern void srcpos_verror(struct srcpos *pos, const char *prefix, |
110 | __attribute__((format(printf, 2, 0))); | 111 | const char *fmt, va_list va) |
111 | extern void srcpos_error(struct srcpos *pos, char const *, ...) | 112 | __attribute__((format(printf, 3, 0))); |
112 | __attribute__((format(printf, 2, 3))); | 113 | extern void srcpos_error(struct srcpos *pos, const char *prefix, |
113 | extern void srcpos_warn(struct srcpos *pos, char const *, ...) | 114 | const char *fmt, ...) |
114 | __attribute__((format(printf, 2, 3))); | 115 | __attribute__((format(printf, 3, 4))); |
115 | 116 | ||
116 | extern void srcpos_set_line(char *f, int l); | 117 | extern void srcpos_set_line(char *f, int l); |
117 | 118 | ||
diff --git a/scripts/dtc/treesource.c b/scripts/dtc/treesource.c index 5740e6992d37..a55d1d128cce 100644 --- a/scripts/dtc/treesource.c +++ b/scripts/dtc/treesource.c | |||
@@ -26,12 +26,12 @@ extern int yyparse(void); | |||
26 | extern YYLTYPE yylloc; | 26 | extern YYLTYPE yylloc; |
27 | 27 | ||
28 | struct boot_info *the_boot_info; | 28 | struct boot_info *the_boot_info; |
29 | int treesource_error; | 29 | bool treesource_error; |
30 | 30 | ||
31 | struct boot_info *dt_from_source(const char *fname) | 31 | struct boot_info *dt_from_source(const char *fname) |
32 | { | 32 | { |
33 | the_boot_info = NULL; | 33 | the_boot_info = NULL; |
34 | treesource_error = 0; | 34 | treesource_error = false; |
35 | 35 | ||
36 | srcfile_push(fname); | 36 | srcfile_push(fname); |
37 | yyin = current_srcfile->f; | 37 | yyin = current_srcfile->f; |
@@ -54,9 +54,9 @@ static void write_prefix(FILE *f, int level) | |||
54 | fputc('\t', f); | 54 | fputc('\t', f); |
55 | } | 55 | } |
56 | 56 | ||
57 | static int isstring(char c) | 57 | static bool isstring(char c) |
58 | { | 58 | { |
59 | return (isprint(c) | 59 | return (isprint((unsigned char)c) |
60 | || (c == '\0') | 60 | || (c == '\0') |
61 | || strchr("\a\b\t\n\v\f\r", c)); | 61 | || strchr("\a\b\t\n\v\f\r", c)); |
62 | } | 62 | } |
@@ -109,7 +109,7 @@ static void write_propval_string(FILE *f, struct data val) | |||
109 | break; | 109 | break; |
110 | case '\0': | 110 | case '\0': |
111 | fprintf(f, "\", "); | 111 | fprintf(f, "\", "); |
112 | while (m && (m->offset < i)) { | 112 | while (m && (m->offset <= (i + 1))) { |
113 | if (m->type == LABEL) { | 113 | if (m->type == LABEL) { |
114 | assert(m->offset == (i+1)); | 114 | assert(m->offset == (i+1)); |
115 | fprintf(f, "%s: ", m->ref); | 115 | fprintf(f, "%s: ", m->ref); |
@@ -119,7 +119,7 @@ static void write_propval_string(FILE *f, struct data val) | |||
119 | fprintf(f, "\""); | 119 | fprintf(f, "\""); |
120 | break; | 120 | break; |
121 | default: | 121 | default: |
122 | if (isprint(c)) | 122 | if (isprint((unsigned char)c)) |
123 | fprintf(f, "%c", c); | 123 | fprintf(f, "%c", c); |
124 | else | 124 | else |
125 | fprintf(f, "\\x%02hhx", c); | 125 | fprintf(f, "\\x%02hhx", c); |
@@ -178,7 +178,7 @@ static void write_propval_bytes(FILE *f, struct data val) | |||
178 | m = m->next; | 178 | m = m->next; |
179 | } | 179 | } |
180 | 180 | ||
181 | fprintf(f, "%02hhx", *bp++); | 181 | fprintf(f, "%02hhx", (unsigned char)(*bp++)); |
182 | if ((const void *)bp >= propend) | 182 | if ((const void *)bp >= propend) |
183 | break; | 183 | break; |
184 | fprintf(f, " "); | 184 | fprintf(f, " "); |
@@ -281,3 +281,4 @@ void dt_to_source(FILE *f, struct boot_info *bi) | |||
281 | 281 | ||
282 | write_tree_source_node(f, bi->dt, 0); | 282 | write_tree_source_node(f, bi->dt, 0); |
283 | } | 283 | } |
284 | |||
diff --git a/scripts/dtc/util.c b/scripts/dtc/util.c index 3055c16e980d..9d65226df9e4 100644 --- a/scripts/dtc/util.c +++ b/scripts/dtc/util.c | |||
@@ -39,11 +39,11 @@ | |||
39 | char *xstrdup(const char *s) | 39 | char *xstrdup(const char *s) |
40 | { | 40 | { |
41 | int len = strlen(s) + 1; | 41 | int len = strlen(s) + 1; |
42 | char *dup = xmalloc(len); | 42 | char *d = xmalloc(len); |
43 | 43 | ||
44 | memcpy(dup, s, len); | 44 | memcpy(d, s, len); |
45 | 45 | ||
46 | return dup; | 46 | return d; |
47 | } | 47 | } |
48 | 48 | ||
49 | char *join_path(const char *path, const char *name) | 49 | char *join_path(const char *path, const char *name) |
@@ -70,7 +70,7 @@ char *join_path(const char *path, const char *name) | |||
70 | return str; | 70 | return str; |
71 | } | 71 | } |
72 | 72 | ||
73 | int util_is_printable_string(const void *data, int len) | 73 | bool util_is_printable_string(const void *data, int len) |
74 | { | 74 | { |
75 | const char *s = data; | 75 | const char *s = data; |
76 | const char *ss, *se; | 76 | const char *ss, *se; |
@@ -87,7 +87,7 @@ int util_is_printable_string(const void *data, int len) | |||
87 | 87 | ||
88 | while (s < se) { | 88 | while (s < se) { |
89 | ss = s; | 89 | ss = s; |
90 | while (s < se && *s && isprint(*s)) | 90 | while (s < se && *s && isprint((unsigned char)*s)) |
91 | s++; | 91 | s++; |
92 | 92 | ||
93 | /* not zero, or not done yet */ | 93 | /* not zero, or not done yet */ |
@@ -219,10 +219,6 @@ int utilfdt_read_err_len(const char *filename, char **buffp, off_t *len) | |||
219 | if (offset == bufsize) { | 219 | if (offset == bufsize) { |
220 | bufsize *= 2; | 220 | bufsize *= 2; |
221 | buf = xrealloc(buf, bufsize); | 221 | buf = xrealloc(buf, bufsize); |
222 | if (!buf) { | ||
223 | ret = ENOMEM; | ||
224 | break; | ||
225 | } | ||
226 | } | 222 | } |
227 | 223 | ||
228 | ret = read(fd, &buf[offset], bufsize - offset); | 224 | ret = read(fd, &buf[offset], bufsize - offset); |
@@ -375,9 +371,9 @@ void utilfdt_print_data(const char *data, int len) | |||
375 | const uint32_t *cell = (const uint32_t *)data; | 371 | const uint32_t *cell = (const uint32_t *)data; |
376 | 372 | ||
377 | printf(" = <"); | 373 | printf(" = <"); |
378 | for (i = 0; i < len; i += 4) | 374 | for (i = 0, len /= 4; i < len; i++) |
379 | printf("0x%08x%s", fdt32_to_cpu(cell[i]), | 375 | printf("0x%08x%s", fdt32_to_cpu(cell[i]), |
380 | i < (len - 4) ? " " : ""); | 376 | i < (len - 1) ? " " : ""); |
381 | printf(">"); | 377 | printf(">"); |
382 | } else { | 378 | } else { |
383 | printf(" = ["); | 379 | printf(" = ["); |
diff --git a/scripts/dtc/util.h b/scripts/dtc/util.h index 8f40b4499359..f800b6011fb1 100644 --- a/scripts/dtc/util.h +++ b/scripts/dtc/util.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _UTIL_H | 2 | #define _UTIL_H |
3 | 3 | ||
4 | #include <stdarg.h> | 4 | #include <stdarg.h> |
5 | #include <stdbool.h> | ||
5 | #include <getopt.h> | 6 | #include <getopt.h> |
6 | 7 | ||
7 | /* | 8 | /* |
@@ -33,6 +34,7 @@ static inline void __attribute__((noreturn)) die(const char *str, ...) | |||
33 | va_start(ap, str); | 34 | va_start(ap, str); |
34 | fprintf(stderr, "FATAL ERROR: "); | 35 | fprintf(stderr, "FATAL ERROR: "); |
35 | vfprintf(stderr, str, ap); | 36 | vfprintf(stderr, str, ap); |
37 | va_end(ap); | ||
36 | exit(1); | 38 | exit(1); |
37 | } | 39 | } |
38 | 40 | ||
@@ -68,7 +70,7 @@ extern char *join_path(const char *path, const char *name); | |||
68 | * @param len The string length including terminator | 70 | * @param len The string length including terminator |
69 | * @return 1 if a valid printable string, 0 if not | 71 | * @return 1 if a valid printable string, 0 if not |
70 | */ | 72 | */ |
71 | int util_is_printable_string(const void *data, int len); | 73 | bool util_is_printable_string(const void *data, int len); |
72 | 74 | ||
73 | /* | 75 | /* |
74 | * Parse an escaped character starting at index i in string s. The resulting | 76 | * Parse an escaped character starting at index i in string s. The resulting |
diff --git a/scripts/dtc/version_gen.h b/scripts/dtc/version_gen.h index 54d4e904433a..5b8c7d53d608 100644 --- a/scripts/dtc/version_gen.h +++ b/scripts/dtc/version_gen.h | |||
@@ -1 +1 @@ | |||
#define DTC_VERSION "DTC 1.4.0-dirty" | #define DTC_VERSION "DTC 1.4.1-g9d3649bd" | ||