diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-21 18:55:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-21 18:55:26 -0400 |
commit | eddecbb601c9ea3fab7e67d7892010fc9426d1e6 (patch) | |
tree | 4bfa4740ae554e5c5a8468e74b39531a6153ce9f /scripts | |
parent | 0bf8c869701039b12c3520cb1bb1689595ab108b (diff) | |
parent | f2c23f65f63fe0dd83fc94efdfae0364c74458b8 (diff) |
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
kbuild: Make DEBUG_SECTION_MISMATCH selectable, but not on by default
genksyms: Regenerate lexer and parser
genksyms: Track changes to enum constants
genksyms: simplify usage of find_symbol()
genksyms: Add helpers for building string lists
genksyms: Simplify printing of symbol types
genksyms: Simplify lexer
genksyms: Do not paste the bison header file to lex.c
modpost: fix trailing comma
KBuild: silence "'scripts/unifdef' is up to date."
kbuild: Add extra gcc checks
kbuild: reenable section mismatch analysis
unifdef: update to upstream version 2.5
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile | 5 | ||||
-rw-r--r-- | scripts/Makefile.build | 35 | ||||
-rw-r--r-- | scripts/genksyms/Makefile | 4 | ||||
-rw-r--r-- | scripts/genksyms/genksyms.c | 192 | ||||
-rw-r--r-- | scripts/genksyms/genksyms.h | 7 | ||||
-rw-r--r-- | scripts/genksyms/lex.c_shipped | 427 | ||||
-rw-r--r-- | scripts/genksyms/lex.l | 44 | ||||
-rw-r--r-- | scripts/genksyms/parse.c_shipped | 1071 | ||||
-rw-r--r-- | scripts/genksyms/parse.h_shipped | 72 | ||||
-rw-r--r-- | scripts/genksyms/parse.y | 34 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 23 | ||||
-rw-r--r-- | scripts/unifdef.c | 247 |
12 files changed, 1226 insertions, 935 deletions
diff --git a/scripts/Makefile b/scripts/Makefile index 2e088109fbd5..fcea26168bca 100644 --- a/scripts/Makefile +++ b/scripts/Makefile | |||
@@ -18,6 +18,11 @@ always := $(hostprogs-y) $(hostprogs-m) | |||
18 | # The following hostprogs-y programs are only build on demand | 18 | # The following hostprogs-y programs are only build on demand |
19 | hostprogs-y += unifdef | 19 | hostprogs-y += unifdef |
20 | 20 | ||
21 | # This target is used internally to avoid "is up to date" messages | ||
22 | PHONY += build_unifdef | ||
23 | build_unifdef: scripts/unifdef FORCE | ||
24 | @: | ||
25 | |||
21 | subdir-$(CONFIG_MODVERSIONS) += genksyms | 26 | subdir-$(CONFIG_MODVERSIONS) += genksyms |
22 | subdir-y += mod | 27 | subdir-y += mod |
23 | subdir-$(CONFIG_SECURITY_SELINUX) += selinux | 28 | subdir-$(CONFIG_SECURITY_SELINUX) += selinux |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 4eb99ab34053..d5f925abe4d2 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -49,6 +49,40 @@ ifeq ($(KBUILD_NOPEDANTIC),) | |||
49 | $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS) | 49 | $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS) |
50 | endif | 50 | endif |
51 | endif | 51 | endif |
52 | |||
53 | # | ||
54 | # make W=1 settings | ||
55 | # | ||
56 | # $(call cc-option... ) handles gcc -W.. options which | ||
57 | # are not supported by all versions of the compiler | ||
58 | ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS | ||
59 | KBUILD_EXTRA_WARNINGS := -Wextra | ||
60 | KBUILD_EXTRA_WARNINGS += -Wunused -Wno-unused-parameter | ||
61 | KBUILD_EXTRA_WARNINGS += -Waggregate-return | ||
62 | KBUILD_EXTRA_WARNINGS += -Wbad-function-cast | ||
63 | KBUILD_EXTRA_WARNINGS += -Wcast-qual | ||
64 | KBUILD_EXTRA_WARNINGS += -Wcast-align | ||
65 | KBUILD_EXTRA_WARNINGS += -Wconversion | ||
66 | KBUILD_EXTRA_WARNINGS += -Wdisabled-optimization | ||
67 | KBUILD_EXTRA_WARNINGS += -Wlogical-op | ||
68 | KBUILD_EXTRA_WARNINGS += -Wmissing-declarations | ||
69 | KBUILD_EXTRA_WARNINGS += -Wmissing-format-attribute | ||
70 | KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wmissing-include-dirs,) | ||
71 | KBUILD_EXTRA_WARNINGS += -Wmissing-prototypes | ||
72 | KBUILD_EXTRA_WARNINGS += -Wnested-externs | ||
73 | KBUILD_EXTRA_WARNINGS += -Wold-style-definition | ||
74 | KBUILD_EXTRA_WARNINGS += $(call cc-option, -Woverlength-strings,) | ||
75 | KBUILD_EXTRA_WARNINGS += -Wpacked | ||
76 | KBUILD_EXTRA_WARNINGS += -Wpacked-bitfield-compat | ||
77 | KBUILD_EXTRA_WARNINGS += -Wpadded | ||
78 | KBUILD_EXTRA_WARNINGS += -Wpointer-arith | ||
79 | KBUILD_EXTRA_WARNINGS += -Wredundant-decls | ||
80 | KBUILD_EXTRA_WARNINGS += -Wshadow | ||
81 | KBUILD_EXTRA_WARNINGS += -Wswitch-default | ||
82 | KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wvla,) | ||
83 | KBUILD_CFLAGS += $(KBUILD_EXTRA_WARNINGS) | ||
84 | endif | ||
85 | |||
52 | include scripts/Makefile.lib | 86 | include scripts/Makefile.lib |
53 | 87 | ||
54 | ifdef host-progs | 88 | ifdef host-progs |
@@ -403,7 +437,6 @@ ifneq ($(cmd_files),) | |||
403 | include $(cmd_files) | 437 | include $(cmd_files) |
404 | endif | 438 | endif |
405 | 439 | ||
406 | |||
407 | # Declare the contents of the .PHONY variable as phony. We keep that | 440 | # Declare the contents of the .PHONY variable as phony. We keep that |
408 | # information in a variable se we can use it in if_changed and friends. | 441 | # information in a variable se we can use it in if_changed and friends. |
409 | 442 | ||
diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile index e420fe440019..13d03cf05d95 100644 --- a/scripts/genksyms/Makefile +++ b/scripts/genksyms/Makefile | |||
@@ -28,9 +28,9 @@ $(obj)/keywords.c: $(obj)/keywords.gperf FORCE | |||
28 | # flex | 28 | # flex |
29 | 29 | ||
30 | quiet_cmd_lex.c = FLEX $@ | 30 | quiet_cmd_lex.c = FLEX $@ |
31 | cmd_lex.c = flex -o$@ -d $< $(obj)/parse.h | 31 | cmd_lex.c = flex -o$@ -d $< |
32 | 32 | ||
33 | $(obj)/lex.c: $(obj)/lex.l $(obj)/parse.h $(obj)/keywords.c FORCE | 33 | $(obj)/lex.c: $(obj)/lex.l $(obj)/keywords.c FORCE |
34 | $(call if_changed,lex.c) | 34 | $(call if_changed,lex.c) |
35 | cp $@ $@_shipped | 35 | cp $@ $@_shipped |
36 | 36 | ||
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c index f99115ebe925..f9e75531ea03 100644 --- a/scripts/genksyms/genksyms.c +++ b/scripts/genksyms/genksyms.c | |||
@@ -53,12 +53,22 @@ static int nsyms; | |||
53 | static struct symbol *expansion_trail; | 53 | static struct symbol *expansion_trail; |
54 | static struct symbol *visited_symbols; | 54 | static struct symbol *visited_symbols; |
55 | 55 | ||
56 | static const char *const symbol_type_name[] = { | 56 | static const struct { |
57 | "normal", "typedef", "enum", "struct", "union" | 57 | int n; |
58 | const char *name; | ||
59 | } symbol_types[] = { | ||
60 | [SYM_NORMAL] = { 0, NULL}, | ||
61 | [SYM_TYPEDEF] = {'t', "typedef"}, | ||
62 | [SYM_ENUM] = {'e', "enum"}, | ||
63 | [SYM_STRUCT] = {'s', "struct"}, | ||
64 | [SYM_UNION] = {'u', "union"}, | ||
65 | [SYM_ENUM_CONST] = {'E', "enum constant"}, | ||
58 | }; | 66 | }; |
59 | 67 | ||
60 | static int equal_list(struct string_list *a, struct string_list *b); | 68 | static int equal_list(struct string_list *a, struct string_list *b); |
61 | static void print_list(FILE * f, struct string_list *list); | 69 | static void print_list(FILE * f, struct string_list *list); |
70 | static struct string_list *concat_list(struct string_list *start, ...); | ||
71 | static struct string_list *mk_node(const char *string); | ||
62 | static void print_location(void); | 72 | static void print_location(void); |
63 | static void print_type_name(enum symbol_type type, const char *name); | 73 | static void print_type_name(enum symbol_type type, const char *name); |
64 | 74 | ||
@@ -140,14 +150,20 @@ static unsigned long crc32(const char *s) | |||
140 | 150 | ||
141 | static enum symbol_type map_to_ns(enum symbol_type t) | 151 | static enum symbol_type map_to_ns(enum symbol_type t) |
142 | { | 152 | { |
143 | if (t == SYM_TYPEDEF) | 153 | switch (t) { |
144 | t = SYM_NORMAL; | 154 | case SYM_ENUM_CONST: |
145 | else if (t == SYM_UNION) | 155 | case SYM_NORMAL: |
146 | t = SYM_STRUCT; | 156 | case SYM_TYPEDEF: |
157 | return SYM_NORMAL; | ||
158 | case SYM_ENUM: | ||
159 | case SYM_STRUCT: | ||
160 | case SYM_UNION: | ||
161 | return SYM_STRUCT; | ||
162 | } | ||
147 | return t; | 163 | return t; |
148 | } | 164 | } |
149 | 165 | ||
150 | struct symbol *find_symbol(const char *name, enum symbol_type ns) | 166 | struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact) |
151 | { | 167 | { |
152 | unsigned long h = crc32(name) % HASH_BUCKETS; | 168 | unsigned long h = crc32(name) % HASH_BUCKETS; |
153 | struct symbol *sym; | 169 | struct symbol *sym; |
@@ -158,6 +174,8 @@ struct symbol *find_symbol(const char *name, enum symbol_type ns) | |||
158 | sym->is_declared) | 174 | sym->is_declared) |
159 | break; | 175 | break; |
160 | 176 | ||
177 | if (exact && sym && sym->type != ns) | ||
178 | return NULL; | ||
161 | return sym; | 179 | return sym; |
162 | } | 180 | } |
163 | 181 | ||
@@ -180,10 +198,47 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type, | |||
180 | struct string_list *defn, int is_extern, | 198 | struct string_list *defn, int is_extern, |
181 | int is_reference) | 199 | int is_reference) |
182 | { | 200 | { |
183 | unsigned long h = crc32(name) % HASH_BUCKETS; | 201 | unsigned long h; |
184 | struct symbol *sym; | 202 | struct symbol *sym; |
185 | enum symbol_status status = STATUS_UNCHANGED; | 203 | enum symbol_status status = STATUS_UNCHANGED; |
204 | /* The parser adds symbols in the order their declaration completes, | ||
205 | * so it is safe to store the value of the previous enum constant in | ||
206 | * a static variable. | ||
207 | */ | ||
208 | static int enum_counter; | ||
209 | static struct string_list *last_enum_expr; | ||
210 | |||
211 | if (type == SYM_ENUM_CONST) { | ||
212 | if (defn) { | ||
213 | free_list(last_enum_expr, NULL); | ||
214 | last_enum_expr = copy_list_range(defn, NULL); | ||
215 | enum_counter = 1; | ||
216 | } else { | ||
217 | struct string_list *expr; | ||
218 | char buf[20]; | ||
219 | |||
220 | snprintf(buf, sizeof(buf), "%d", enum_counter++); | ||
221 | if (last_enum_expr) { | ||
222 | expr = copy_list_range(last_enum_expr, NULL); | ||
223 | defn = concat_list(mk_node("("), | ||
224 | expr, | ||
225 | mk_node(")"), | ||
226 | mk_node("+"), | ||
227 | mk_node(buf), NULL); | ||
228 | } else { | ||
229 | defn = mk_node(buf); | ||
230 | } | ||
231 | } | ||
232 | } else if (type == SYM_ENUM) { | ||
233 | free_list(last_enum_expr, NULL); | ||
234 | last_enum_expr = NULL; | ||
235 | enum_counter = 0; | ||
236 | if (!name) | ||
237 | /* Anonymous enum definition, nothing more to do */ | ||
238 | return NULL; | ||
239 | } | ||
186 | 240 | ||
241 | h = crc32(name) % HASH_BUCKETS; | ||
187 | for (sym = symtab[h]; sym; sym = sym->hash_next) { | 242 | for (sym = symtab[h]; sym; sym = sym->hash_next) { |
188 | if (map_to_ns(sym->type) == map_to_ns(type) && | 243 | if (map_to_ns(sym->type) == map_to_ns(type) && |
189 | strcmp(name, sym->name) == 0) { | 244 | strcmp(name, sym->name) == 0) { |
@@ -247,8 +302,12 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type, | |||
247 | sym->is_override = 0; | 302 | sym->is_override = 0; |
248 | 303 | ||
249 | if (flag_debug) { | 304 | if (flag_debug) { |
250 | fprintf(debugfile, "Defn for %s %s == <", | 305 | if (symbol_types[type].name) |
251 | symbol_type_name[type], name); | 306 | fprintf(debugfile, "Defn for %s %s == <", |
307 | symbol_types[type].name, name); | ||
308 | else | ||
309 | fprintf(debugfile, "Defn for type%d %s == <", | ||
310 | type, name); | ||
252 | if (is_extern) | 311 | if (is_extern) |
253 | fputs("extern ", debugfile); | 312 | fputs("extern ", debugfile); |
254 | print_list(debugfile, defn); | 313 | print_list(debugfile, defn); |
@@ -288,6 +347,35 @@ void free_list(struct string_list *s, struct string_list *e) | |||
288 | } | 347 | } |
289 | } | 348 | } |
290 | 349 | ||
350 | static struct string_list *mk_node(const char *string) | ||
351 | { | ||
352 | struct string_list *newnode; | ||
353 | |||
354 | newnode = xmalloc(sizeof(*newnode)); | ||
355 | newnode->string = xstrdup(string); | ||
356 | newnode->tag = SYM_NORMAL; | ||
357 | newnode->next = NULL; | ||
358 | |||
359 | return newnode; | ||
360 | } | ||
361 | |||
362 | static struct string_list *concat_list(struct string_list *start, ...) | ||
363 | { | ||
364 | va_list ap; | ||
365 | struct string_list *n, *n2; | ||
366 | |||
367 | if (!start) | ||
368 | return NULL; | ||
369 | for (va_start(ap, start); (n = va_arg(ap, struct string_list *));) { | ||
370 | for (n2 = n; n2->next; n2 = n2->next) | ||
371 | ; | ||
372 | n2->next = start; | ||
373 | start = n; | ||
374 | } | ||
375 | va_end(ap); | ||
376 | return start; | ||
377 | } | ||
378 | |||
291 | struct string_list *copy_node(struct string_list *node) | 379 | struct string_list *copy_node(struct string_list *node) |
292 | { | 380 | { |
293 | struct string_list *newnode; | 381 | struct string_list *newnode; |
@@ -299,6 +387,22 @@ struct string_list *copy_node(struct string_list *node) | |||
299 | return newnode; | 387 | return newnode; |
300 | } | 388 | } |
301 | 389 | ||
390 | struct string_list *copy_list_range(struct string_list *start, | ||
391 | struct string_list *end) | ||
392 | { | ||
393 | struct string_list *res, *n; | ||
394 | |||
395 | if (start == end) | ||
396 | return NULL; | ||
397 | n = res = copy_node(start); | ||
398 | for (start = start->next; start != end; start = start->next) { | ||
399 | n->next = copy_node(start); | ||
400 | n = n->next; | ||
401 | } | ||
402 | n->next = NULL; | ||
403 | return res; | ||
404 | } | ||
405 | |||
302 | static int equal_list(struct string_list *a, struct string_list *b) | 406 | static int equal_list(struct string_list *a, struct string_list *b) |
303 | { | 407 | { |
304 | while (a && b) { | 408 | while (a && b) { |
@@ -346,8 +450,8 @@ static struct string_list *read_node(FILE *f) | |||
346 | if (node.string[1] == '#') { | 450 | if (node.string[1] == '#') { |
347 | int n; | 451 | int n; |
348 | 452 | ||
349 | for (n = 0; n < ARRAY_SIZE(symbol_type_name); n++) { | 453 | for (n = 0; n < ARRAY_SIZE(symbol_types); n++) { |
350 | if (node.string[0] == symbol_type_name[n][0]) { | 454 | if (node.string[0] == symbol_types[n].n) { |
351 | node.tag = n; | 455 | node.tag = n; |
352 | node.string += 2; | 456 | node.string += 2; |
353 | return copy_node(&node); | 457 | return copy_node(&node); |
@@ -397,8 +501,8 @@ static void read_reference(FILE *f) | |||
397 | 501 | ||
398 | static void print_node(FILE * f, struct string_list *list) | 502 | static void print_node(FILE * f, struct string_list *list) |
399 | { | 503 | { |
400 | if (list->tag != SYM_NORMAL) { | 504 | if (symbol_types[list->tag].n) { |
401 | putc(symbol_type_name[list->tag][0], f); | 505 | putc(symbol_types[list->tag].n, f); |
402 | putc('#', f); | 506 | putc('#', f); |
403 | } | 507 | } |
404 | fputs(list->string, f); | 508 | fputs(list->string, f); |
@@ -468,8 +572,9 @@ static unsigned long expand_and_crc_sym(struct symbol *sym, unsigned long crc) | |||
468 | crc = partial_crc32_one(' ', crc); | 572 | crc = partial_crc32_one(' ', crc); |
469 | break; | 573 | break; |
470 | 574 | ||
575 | case SYM_ENUM_CONST: | ||
471 | case SYM_TYPEDEF: | 576 | case SYM_TYPEDEF: |
472 | subsym = find_symbol(cur->string, cur->tag); | 577 | subsym = find_symbol(cur->string, cur->tag, 0); |
473 | /* FIXME: Bad reference files can segfault here. */ | 578 | /* FIXME: Bad reference files can segfault here. */ |
474 | if (subsym->expansion_trail) { | 579 | if (subsym->expansion_trail) { |
475 | if (flag_dump_defs) | 580 | if (flag_dump_defs) |
@@ -486,55 +591,30 @@ static unsigned long expand_and_crc_sym(struct symbol *sym, unsigned long crc) | |||
486 | case SYM_STRUCT: | 591 | case SYM_STRUCT: |
487 | case SYM_UNION: | 592 | case SYM_UNION: |
488 | case SYM_ENUM: | 593 | case SYM_ENUM: |
489 | subsym = find_symbol(cur->string, cur->tag); | 594 | subsym = find_symbol(cur->string, cur->tag, 0); |
490 | if (!subsym) { | 595 | if (!subsym) { |
491 | struct string_list *n, *t = NULL; | 596 | struct string_list *n; |
492 | 597 | ||
493 | error_with_pos("expand undefined %s %s", | 598 | error_with_pos("expand undefined %s %s", |
494 | symbol_type_name[cur->tag], | 599 | symbol_types[cur->tag].name, |
495 | cur->string); | 600 | cur->string); |
496 | 601 | n = concat_list(mk_node | |
497 | n = xmalloc(sizeof(*n)); | 602 | (symbol_types[cur->tag].name), |
498 | n->string = xstrdup(symbol_type_name[cur->tag]); | 603 | mk_node(cur->string), |
499 | n->tag = SYM_NORMAL; | 604 | mk_node("{"), |
500 | n->next = t; | 605 | mk_node("UNKNOWN"), |
501 | t = n; | 606 | mk_node("}"), NULL); |
502 | |||
503 | n = xmalloc(sizeof(*n)); | ||
504 | n->string = xstrdup(cur->string); | ||
505 | n->tag = SYM_NORMAL; | ||
506 | n->next = t; | ||
507 | t = n; | ||
508 | |||
509 | n = xmalloc(sizeof(*n)); | ||
510 | n->string = xstrdup("{"); | ||
511 | n->tag = SYM_NORMAL; | ||
512 | n->next = t; | ||
513 | t = n; | ||
514 | |||
515 | n = xmalloc(sizeof(*n)); | ||
516 | n->string = xstrdup("UNKNOWN"); | ||
517 | n->tag = SYM_NORMAL; | ||
518 | n->next = t; | ||
519 | t = n; | ||
520 | |||
521 | n = xmalloc(sizeof(*n)); | ||
522 | n->string = xstrdup("}"); | ||
523 | n->tag = SYM_NORMAL; | ||
524 | n->next = t; | ||
525 | t = n; | ||
526 | |||
527 | subsym = | 607 | subsym = |
528 | add_symbol(cur->string, cur->tag, n, 0); | 608 | add_symbol(cur->string, cur->tag, n, 0); |
529 | } | 609 | } |
530 | if (subsym->expansion_trail) { | 610 | if (subsym->expansion_trail) { |
531 | if (flag_dump_defs) { | 611 | if (flag_dump_defs) { |
532 | fprintf(debugfile, "%s %s ", | 612 | fprintf(debugfile, "%s %s ", |
533 | symbol_type_name[cur->tag], | 613 | symbol_types[cur->tag].name, |
534 | cur->string); | 614 | cur->string); |
535 | } | 615 | } |
536 | 616 | ||
537 | crc = partial_crc32(symbol_type_name[cur->tag], | 617 | crc = partial_crc32(symbol_types[cur->tag].name, |
538 | crc); | 618 | crc); |
539 | crc = partial_crc32_one(' ', crc); | 619 | crc = partial_crc32_one(' ', crc); |
540 | crc = partial_crc32(cur->string, crc); | 620 | crc = partial_crc32(cur->string, crc); |
@@ -565,7 +645,7 @@ void export_symbol(const char *name) | |||
565 | { | 645 | { |
566 | struct symbol *sym; | 646 | struct symbol *sym; |
567 | 647 | ||
568 | sym = find_symbol(name, SYM_NORMAL); | 648 | sym = find_symbol(name, SYM_NORMAL, 0); |
569 | if (!sym) | 649 | if (!sym) |
570 | error_with_pos("export undefined symbol %s", name); | 650 | error_with_pos("export undefined symbol %s", name); |
571 | else { | 651 | else { |
@@ -624,8 +704,8 @@ static void print_location(void) | |||
624 | 704 | ||
625 | static void print_type_name(enum symbol_type type, const char *name) | 705 | static void print_type_name(enum symbol_type type, const char *name) |
626 | { | 706 | { |
627 | if (type != SYM_NORMAL) | 707 | if (symbol_types[type].name) |
628 | fprintf(stderr, "%s %s", symbol_type_name[type], name); | 708 | fprintf(stderr, "%s %s", symbol_types[type].name, name); |
629 | else | 709 | else |
630 | fprintf(stderr, "%s", name); | 710 | fprintf(stderr, "%s", name); |
631 | } | 711 | } |
@@ -771,8 +851,8 @@ int main(int argc, char **argv) | |||
771 | 851 | ||
772 | if (sym->is_override) | 852 | if (sym->is_override) |
773 | fputs("override ", dumpfile); | 853 | fputs("override ", dumpfile); |
774 | if (sym->type != SYM_NORMAL) { | 854 | if (symbol_types[sym->type].n) { |
775 | putc(symbol_type_name[sym->type][0], dumpfile); | 855 | putc(symbol_types[sym->type].n, dumpfile); |
776 | putc('#', dumpfile); | 856 | putc('#', dumpfile); |
777 | } | 857 | } |
778 | fputs(sym->name, dumpfile); | 858 | fputs(sym->name, dumpfile); |
diff --git a/scripts/genksyms/genksyms.h b/scripts/genksyms/genksyms.h index 25c4d40cefc1..7ec52ae3846a 100644 --- a/scripts/genksyms/genksyms.h +++ b/scripts/genksyms/genksyms.h | |||
@@ -26,7 +26,8 @@ | |||
26 | #include <stdio.h> | 26 | #include <stdio.h> |
27 | 27 | ||
28 | enum symbol_type { | 28 | enum symbol_type { |
29 | SYM_NORMAL, SYM_TYPEDEF, SYM_ENUM, SYM_STRUCT, SYM_UNION | 29 | SYM_NORMAL, SYM_TYPEDEF, SYM_ENUM, SYM_STRUCT, SYM_UNION, |
30 | SYM_ENUM_CONST | ||
30 | }; | 31 | }; |
31 | 32 | ||
32 | enum symbol_status { | 33 | enum symbol_status { |
@@ -58,7 +59,7 @@ typedef struct string_list **yystype; | |||
58 | extern int cur_line; | 59 | extern int cur_line; |
59 | extern char *cur_filename; | 60 | extern char *cur_filename; |
60 | 61 | ||
61 | struct symbol *find_symbol(const char *name, enum symbol_type ns); | 62 | struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact); |
62 | struct symbol *add_symbol(const char *name, enum symbol_type type, | 63 | struct symbol *add_symbol(const char *name, enum symbol_type type, |
63 | struct string_list *defn, int is_extern); | 64 | struct string_list *defn, int is_extern); |
64 | void export_symbol(const char *); | 65 | void export_symbol(const char *); |
@@ -66,6 +67,8 @@ void export_symbol(const char *); | |||
66 | void free_node(struct string_list *list); | 67 | void free_node(struct string_list *list); |
67 | void free_list(struct string_list *s, struct string_list *e); | 68 | void free_list(struct string_list *s, struct string_list *e); |
68 | struct string_list *copy_node(struct string_list *); | 69 | struct string_list *copy_node(struct string_list *); |
70 | struct string_list *copy_list_range(struct string_list *start, | ||
71 | struct string_list *end); | ||
69 | 72 | ||
70 | int yylex(void); | 73 | int yylex(void); |
71 | int yyparse(void); | 74 | int yyparse(void); |
diff --git a/scripts/genksyms/lex.c_shipped b/scripts/genksyms/lex.c_shipped index 2ac23bcca5b5..af4939041e4b 100644 --- a/scripts/genksyms/lex.c_shipped +++ b/scripts/genksyms/lex.c_shipped | |||
@@ -79,6 +79,7 @@ typedef int flex_int32_t; | |||
79 | typedef unsigned char flex_uint8_t; | 79 | typedef unsigned char flex_uint8_t; |
80 | typedef unsigned short int flex_uint16_t; | 80 | typedef unsigned short int flex_uint16_t; |
81 | typedef unsigned int flex_uint32_t; | 81 | typedef unsigned int flex_uint32_t; |
82 | #endif /* ! C99 */ | ||
82 | 83 | ||
83 | /* Limits of integral types. */ | 84 | /* Limits of integral types. */ |
84 | #ifndef INT8_MIN | 85 | #ifndef INT8_MIN |
@@ -109,8 +110,6 @@ typedef unsigned int flex_uint32_t; | |||
109 | #define UINT32_MAX (4294967295U) | 110 | #define UINT32_MAX (4294967295U) |
110 | #endif | 111 | #endif |
111 | 112 | ||
112 | #endif /* ! C99 */ | ||
113 | |||
114 | #endif /* ! FLEXINT_H */ | 113 | #endif /* ! FLEXINT_H */ |
115 | 114 | ||
116 | /* %endif */ | 115 | /* %endif */ |
@@ -456,16 +455,16 @@ struct yy_trans_info | |||
456 | flex_int32_t yy_verify; | 455 | flex_int32_t yy_verify; |
457 | flex_int32_t yy_nxt; | 456 | flex_int32_t yy_nxt; |
458 | }; | 457 | }; |
459 | static yyconst flex_int16_t yy_accept[76] = | 458 | static yyconst flex_int16_t yy_accept[73] = |
460 | { 0, | 459 | { 0, |
461 | 0, 0, 0, 0, 14, 12, 4, 3, 12, 7, | 460 | 0, 0, 14, 12, 4, 3, 12, 7, 12, 12, |
462 | 12, 12, 7, 12, 12, 12, 12, 12, 9, 9, | 461 | 12, 12, 12, 9, 9, 12, 12, 7, 12, 12, |
463 | 12, 12, 12, 4, 0, 5, 0, 7, 0, 6, | 462 | 4, 0, 5, 0, 7, 8, 0, 6, 0, 0, |
464 | 0, 0, 0, 0, 0, 0, 2, 8, 10, 10, | 463 | 10, 10, 9, 0, 0, 9, 9, 0, 9, 0, |
465 | 9, 0, 0, 9, 9, 0, 9, 0, 0, 11, | 464 | 0, 0, 0, 2, 0, 0, 11, 0, 10, 0, |
466 | 0, 0, 0, 10, 0, 10, 9, 9, 0, 0, | 465 | 10, 9, 9, 0, 0, 0, 10, 10, 0, 0, |
467 | 0, 0, 0, 0, 0, 10, 10, 0, 0, 0, | 466 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
468 | 0, 0, 0, 1, 0 | 467 | 1, 0 |
469 | } ; | 468 | } ; |
470 | 469 | ||
471 | static yyconst flex_int32_t yy_ec[256] = | 470 | static yyconst flex_int32_t yy_ec[256] = |
@@ -507,108 +506,104 @@ static yyconst flex_int32_t yy_meta[29] = | |||
507 | 8, 7, 3, 3, 3, 1, 3, 1 | 506 | 8, 7, 3, 3, 3, 1, 3, 1 |
508 | } ; | 507 | } ; |
509 | 508 | ||
510 | static yyconst flex_int16_t yy_base[88] = | 509 | static yyconst flex_int16_t yy_base[85] = |
511 | { 0, | 510 | { 0, |
512 | 0, 147, 21, 140, 145, 284, 39, 284, 26, 0, | 511 | 0, 145, 150, 266, 27, 266, 25, 0, 131, 23, |
513 | 32, 126, 40, 44, 115, 35, 36, 46, 50, 53, | 512 | 23, 16, 23, 39, 31, 25, 39, 60, 22, 65, |
514 | 39, 61, 54, 79, 65, 284, 0, 0, 66, 284, | 513 | 57, 43, 266, 0, 0, 266, 61, 266, 0, 128, |
515 | 0, 119, 79, 75, 123, 104, 284, 284, 107, 0, | 514 | 74, 0, 113, 59, 62, 113, 52, 0, 0, 72, |
516 | 79, 73, 76, 76, 66, 0, 0, 85, 86, 284, | 515 | 66, 110, 100, 266, 73, 74, 266, 70, 266, 90, |
517 | 133, 83, 91, 284, 99, 147, 284, 114, 122, 70, | 516 | 103, 266, 84, 129, 108, 113, 143, 266, 107, 66, |
518 | 107, 141, 172, 151, 135, 181, 284, 137, 114, 157, | 517 | 118, 137, 168, 120, 80, 91, 145, 143, 83, 41, |
519 | 149, 48, 45, 284, 284, 208, 214, 222, 230, 238, | 518 | 266, 266, 190, 196, 204, 212, 220, 228, 232, 237, |
520 | 246, 250, 255, 256, 261, 267, 275 | 519 | 238, 243, 249, 257 |
521 | } ; | 520 | } ; |
522 | 521 | ||
523 | static yyconst flex_int16_t yy_def[88] = | 522 | static yyconst flex_int16_t yy_def[85] = |
524 | { 0, | 523 | { 0, |
525 | 75, 1, 1, 3, 75, 75, 75, 75, 76, 77, | 524 | 72, 1, 72, 72, 72, 72, 73, 74, 72, 72, |
526 | 78, 75, 77, 79, 75, 75, 75, 75, 75, 19, | 525 | 75, 72, 72, 72, 14, 72, 72, 74, 72, 76, |
527 | 75, 75, 75, 75, 76, 75, 80, 77, 78, 75, | 526 | 72, 73, 72, 77, 74, 72, 75, 72, 78, 72, |
528 | 81, 75, 76, 78, 79, 79, 75, 75, 75, 39, | 527 | 72, 31, 14, 79, 80, 72, 72, 81, 15, 73, |
529 | 19, 82, 83, 75, 75, 84, 20, 76, 78, 75, | 528 | 75, 76, 76, 72, 73, 75, 72, 82, 72, 72, |
530 | 79, 51, 85, 75, 75, 75, 75, 84, 79, 51, | 529 | 72, 72, 81, 76, 54, 72, 72, 72, 76, 54, |
531 | 79, 79, 79, 51, 75, 75, 75, 86, 79, 63, | 530 | 76, 76, 76, 54, 83, 76, 63, 83, 84, 84, |
532 | 86, 87, 87, 75, 0, 75, 75, 75, 75, 75, | 531 | 72, 0, 72, 72, 72, 72, 72, 72, 72, 72, |
533 | 75, 75, 75, 75, 75, 75, 75 | 532 | 72, 72, 72, 72 |
534 | } ; | 533 | } ; |
535 | 534 | ||
536 | static yyconst flex_int16_t yy_nxt[313] = | 535 | static yyconst flex_int16_t yy_nxt[295] = |
537 | { 0, | 536 | { 0, |
538 | 6, 7, 8, 7, 9, 6, 10, 6, 6, 11, | 537 | 4, 5, 6, 5, 7, 4, 8, 9, 10, 11, |
539 | 6, 6, 12, 6, 6, 6, 6, 6, 6, 10, | 538 | 9, 12, 13, 14, 15, 15, 16, 9, 17, 8, |
540 | 10, 10, 13, 10, 10, 6, 10, 6, 15, 16, | 539 | 8, 8, 18, 8, 8, 4, 8, 19, 21, 23, |
541 | 26, 15, 17, 18, 19, 20, 20, 21, 15, 22, | 540 | 21, 26, 28, 26, 26, 30, 31, 31, 31, 26, |
542 | 24, 30, 24, 38, 33, 36, 37, 74, 23, 34, | 541 | 26, 26, 26, 71, 39, 39, 39, 23, 29, 26, |
543 | 74, 27, 38, 38, 38, 38, 38, 31, 32, 39, | 542 | 24, 32, 33, 33, 34, 72, 26, 26, 21, 35, |
544 | 39, 39, 40, 41, 41, 42, 47, 47, 47, 26, | 543 | 21, 36, 37, 38, 40, 36, 43, 44, 24, 41, |
545 | 43, 38, 44, 45, 46, 30, 44, 75, 38, 38, | 544 | 28, 32, 50, 50, 52, 28, 23, 23, 52, 35, |
546 | 24, 38, 24, 26, 30, 40, 55, 55, 57, 26, | 545 | 56, 56, 44, 28, 42, 71, 29, 31, 31, 31, |
547 | 27, 31, 57, 43, 35, 30, 64, 64, 64, 57, | 546 | 42, 29, 59, 44, 48, 49, 49, 24, 24, 29, |
548 | 547 | ||
549 | 31, 65, 65, 75, 27, 36, 37, 35, 59, 37, | 548 | 49, 43, 44, 51, 51, 51, 36, 37, 59, 44, |
550 | 27, 31, 56, 56, 56, 59, 37, 51, 52, 52, | 549 | 36, 65, 44, 54, 55, 55, 51, 51, 51, 59, |
551 | 39, 39, 39, 59, 37, 37, 68, 53, 54, 54, | 550 | 44, 64, 64, 64, 58, 58, 57, 57, 57, 58, |
552 | 69, 50, 38, 54, 59, 37, 44, 45, 32, 37, | 551 | 59, 44, 42, 64, 64, 64, 52, 72, 59, 44, |
553 | 44, 35, 59, 37, 75, 14, 60, 60, 66, 66, | 552 | 47, 66, 60, 60, 42, 44, 59, 69, 26, 72, |
554 | 66, 37, 14, 72, 75, 61, 62, 63, 59, 61, | 553 | 20, 61, 62, 63, 72, 61, 57, 57, 57, 66, |
555 | 56, 56, 56, 69, 64, 64, 64, 69, 67, 67, | 554 | 72, 72, 72, 66, 49, 49, 72, 61, 62, 49, |
556 | 75, 75, 75, 67, 37, 35, 75, 75, 75, 61, | 555 | 44, 61, 72, 72, 72, 72, 72, 72, 72, 72, |
557 | 62, 75, 75, 61, 75, 70, 70, 70, 75, 75, | 556 | 72, 67, 67, 67, 72, 72, 72, 67, 67, 67, |
558 | 75, 70, 70, 70, 66, 66, 66, 75, 75, 75, | 557 | 22, 22, 22, 22, 22, 22, 22, 22, 25, 72, |
559 | 558 | ||
560 | 75, 75, 54, 54, 75, 75, 75, 54, 25, 25, | 559 | 72, 25, 25, 25, 27, 27, 27, 27, 27, 27, |
561 | 25, 25, 25, 25, 25, 25, 28, 75, 75, 28, | 560 | 27, 27, 42, 42, 42, 42, 42, 42, 42, 42, |
562 | 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, | 561 | 45, 72, 45, 45, 45, 45, 45, 45, 46, 72, |
563 | 35, 35, 35, 35, 35, 35, 35, 35, 48, 75, | 562 | 46, 46, 46, 46, 46, 46, 34, 34, 72, 34, |
564 | 48, 48, 48, 48, 48, 48, 49, 75, 49, 49, | 563 | 51, 72, 51, 53, 53, 53, 57, 72, 57, 68, |
565 | 49, 49, 49, 49, 42, 42, 75, 42, 56, 75, | 564 | 68, 68, 68, 68, 68, 68, 68, 70, 70, 70, |
566 | 56, 58, 58, 58, 66, 75, 66, 71, 71, 71, | 565 | 70, 70, 70, 70, 70, 3, 72, 72, 72, 72, |
567 | 71, 71, 71, 71, 71, 73, 73, 73, 73, 73, | 566 | 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, |
568 | 73, 73, 73, 5, 75, 75, 75, 75, 75, 75, | 567 | 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, |
569 | 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, | 568 | 72, 72, 72, 72 |
570 | 569 | ||
571 | 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, | ||
572 | 75, 75 | ||
573 | } ; | 570 | } ; |
574 | 571 | ||
575 | static yyconst flex_int16_t yy_chk[313] = | 572 | static yyconst flex_int16_t yy_chk[295] = |
576 | { 0, | 573 | { 0, |
577 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 574 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
578 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 575 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
579 | 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, | 576 | 1, 1, 1, 1, 1, 1, 1, 1, 5, 7, |
580 | 9, 3, 3, 3, 3, 3, 3, 3, 3, 3, | 577 | 5, 10, 11, 12, 12, 13, 13, 13, 13, 19, |
581 | 7, 11, 7, 16, 13, 14, 14, 73, 3, 13, | 578 | 10, 16, 16, 70, 15, 15, 15, 22, 11, 19, |
582 | 72, 9, 16, 17, 17, 21, 21, 11, 18, 18, | 579 | 7, 14, 14, 14, 14, 15, 17, 17, 21, 14, |
583 | 18, 18, 19, 19, 19, 19, 20, 20, 20, 25, | 580 | 21, 14, 14, 14, 18, 14, 20, 20, 22, 18, |
584 | 19, 23, 19, 19, 19, 29, 19, 20, 22, 22, | 581 | 27, 34, 35, 35, 37, 41, 40, 45, 37, 34, |
585 | 24, 23, 24, 33, 34, 42, 43, 43, 45, 48, | 582 | 48, 48, 65, 46, 65, 69, 27, 31, 31, 31, |
586 | 25, 29, 45, 42, 60, 49, 52, 52, 52, 44, | 583 | 60, 41, 66, 66, 31, 31, 31, 40, 45, 46, |
587 | 584 | ||
588 | 34, 53, 53, 41, 33, 36, 36, 52, 61, 61, | 585 | 31, 43, 43, 50, 50, 50, 53, 53, 59, 59, |
589 | 48, 49, 55, 55, 55, 69, 69, 36, 36, 36, | 586 | 53, 59, 42, 43, 43, 43, 51, 51, 51, 61, |
590 | 39, 39, 39, 59, 59, 35, 59, 39, 39, 39, | 587 | 61, 55, 55, 55, 51, 51, 56, 56, 56, 51, |
591 | 61, 32, 15, 39, 51, 51, 58, 58, 12, 68, | 588 | 54, 54, 55, 64, 64, 64, 36, 33, 62, 62, |
592 | 58, 68, 62, 62, 5, 4, 51, 51, 65, 65, | 589 | 30, 61, 54, 54, 64, 68, 67, 68, 9, 3, |
593 | 65, 71, 2, 71, 0, 51, 51, 51, 70, 51, | 590 | 2, 54, 54, 54, 0, 54, 57, 57, 57, 62, |
594 | 56, 56, 56, 62, 64, 64, 64, 62, 56, 56, | 591 | 0, 0, 0, 62, 57, 57, 0, 67, 67, 57, |
595 | 0, 0, 0, 56, 63, 64, 0, 0, 0, 70, | 592 | 63, 67, 0, 0, 0, 0, 0, 0, 0, 0, |
596 | 70, 0, 0, 70, 0, 63, 63, 63, 0, 0, | 593 | 0, 63, 63, 63, 0, 0, 0, 63, 63, 63, |
597 | 0, 63, 63, 63, 66, 66, 66, 0, 0, 0, | 594 | 73, 73, 73, 73, 73, 73, 73, 73, 74, 0, |
598 | 595 | ||
599 | 0, 0, 66, 66, 0, 0, 0, 66, 76, 76, | 596 | 0, 74, 74, 74, 75, 75, 75, 75, 75, 75, |
600 | 76, 76, 76, 76, 76, 76, 77, 0, 0, 77, | 597 | 75, 75, 76, 76, 76, 76, 76, 76, 76, 76, |
601 | 77, 77, 78, 78, 78, 78, 78, 78, 78, 78, | 598 | 77, 0, 77, 77, 77, 77, 77, 77, 78, 0, |
602 | 79, 79, 79, 79, 79, 79, 79, 79, 80, 0, | 599 | 78, 78, 78, 78, 78, 78, 79, 79, 0, 79, |
603 | 80, 80, 80, 80, 80, 80, 81, 0, 81, 81, | 600 | 80, 0, 80, 81, 81, 81, 82, 0, 82, 83, |
604 | 81, 81, 81, 81, 82, 82, 0, 82, 83, 0, | 601 | 83, 83, 83, 83, 83, 83, 83, 84, 84, 84, |
605 | 83, 84, 84, 84, 85, 0, 85, 86, 86, 86, | 602 | 84, 84, 84, 84, 84, 72, 72, 72, 72, 72, |
606 | 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, | 603 | 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, |
607 | 87, 87, 87, 75, 75, 75, 75, 75, 75, 75, | 604 | 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, |
608 | 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, | 605 | 72, 72, 72, 72 |
609 | 606 | ||
610 | 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, | ||
611 | 75, 75 | ||
612 | } ; | 607 | } ; |
613 | 608 | ||
614 | static yy_state_type yy_last_accepting_state; | 609 | static yy_state_type yy_last_accepting_state; |
@@ -619,8 +614,8 @@ int yy_flex_debug = 1; | |||
619 | 614 | ||
620 | static yyconst flex_int16_t yy_rule_linenum[13] = | 615 | static yyconst flex_int16_t yy_rule_linenum[13] = |
621 | { 0, | 616 | { 0, |
622 | 71, 72, 73, 76, 79, 80, 81, 87, 88, 89, | 617 | 67, 68, 69, 72, 75, 76, 77, 83, 84, 85, |
623 | 91, 94 | 618 | 87, 90 |
624 | } ; | 619 | } ; |
625 | 620 | ||
626 | /* The intent behind this definition is that it'll catch | 621 | /* The intent behind this definition is that it'll catch |
@@ -667,15 +662,11 @@ char *yytext; | |||
667 | and then we categorize those basic tokens in the second stage. */ | 662 | and then we categorize those basic tokens in the second stage. */ |
668 | #define YY_DECL static int yylex1(void) | 663 | #define YY_DECL static int yylex1(void) |
669 | 664 | ||
670 | /* Version 2 checksumming does proper tokenization; version 1 wasn't | ||
671 | quite so pedantic. */ | ||
672 | |||
673 | /* We don't do multiple input files. */ | 665 | /* We don't do multiple input files. */ |
674 | #define YY_NO_INPUT 1 | 666 | #define YY_NO_INPUT 1 |
675 | #line 676 "scripts/genksyms/lex.c" | 667 | #line 668 "scripts/genksyms/lex.c" |
676 | 668 | ||
677 | #define INITIAL 0 | 669 | #define INITIAL 0 |
678 | #define V2_TOKENS 1 | ||
679 | 670 | ||
680 | #ifndef YY_NO_UNISTD_H | 671 | #ifndef YY_NO_UNISTD_H |
681 | /* Special case for "unistd.h", since it is non-ANSI. We include it way | 672 | /* Special case for "unistd.h", since it is non-ANSI. We include it way |
@@ -808,7 +799,7 @@ static int input (void ); | |||
808 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ | 799 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
809 | { \ | 800 | { \ |
810 | int c = '*'; \ | 801 | int c = '*'; \ |
811 | size_t n; \ | 802 | int n; \ |
812 | for ( n = 0; n < max_size && \ | 803 | for ( n = 0; n < max_size && \ |
813 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ | 804 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
814 | buf[n] = (char) c; \ | 805 | buf[n] = (char) c; \ |
@@ -918,12 +909,12 @@ YY_DECL | |||
918 | register int yy_act; | 909 | register int yy_act; |
919 | 910 | ||
920 | /* %% [7.0] user's declarations go here */ | 911 | /* %% [7.0] user's declarations go here */ |
921 | #line 67 "scripts/genksyms/lex.l" | 912 | #line 63 "scripts/genksyms/lex.l" |
922 | 913 | ||
923 | 914 | ||
924 | 915 | ||
925 | /* Keep track of our location in the original source files. */ | 916 | /* Keep track of our location in the original source files. */ |
926 | #line 927 "scripts/genksyms/lex.c" | 917 | #line 918 "scripts/genksyms/lex.c" |
927 | 918 | ||
928 | if ( !(yy_init) ) | 919 | if ( !(yy_init) ) |
929 | { | 920 | { |
@@ -987,13 +978,13 @@ yy_match: | |||
987 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 978 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
988 | { | 979 | { |
989 | yy_current_state = (int) yy_def[yy_current_state]; | 980 | yy_current_state = (int) yy_def[yy_current_state]; |
990 | if ( yy_current_state >= 76 ) | 981 | if ( yy_current_state >= 73 ) |
991 | yy_c = yy_meta[(unsigned int) yy_c]; | 982 | yy_c = yy_meta[(unsigned int) yy_c]; |
992 | } | 983 | } |
993 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 984 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
994 | ++yy_cp; | 985 | ++yy_cp; |
995 | } | 986 | } |
996 | while ( yy_base[yy_current_state] != 284 ); | 987 | while ( yy_base[yy_current_state] != 266 ); |
997 | 988 | ||
998 | yy_find_action: | 989 | yy_find_action: |
999 | /* %% [10.0] code to find the action number goes here */ | 990 | /* %% [10.0] code to find the action number goes here */ |
@@ -1041,42 +1032,42 @@ do_action: /* This label is used only to access EOF actions. */ | |||
1041 | case 1: | 1032 | case 1: |
1042 | /* rule 1 can match eol */ | 1033 | /* rule 1 can match eol */ |
1043 | YY_RULE_SETUP | 1034 | YY_RULE_SETUP |
1044 | #line 71 "scripts/genksyms/lex.l" | 1035 | #line 67 "scripts/genksyms/lex.l" |
1045 | return FILENAME; | 1036 | return FILENAME; |
1046 | YY_BREAK | 1037 | YY_BREAK |
1047 | case 2: | 1038 | case 2: |
1048 | /* rule 2 can match eol */ | 1039 | /* rule 2 can match eol */ |
1049 | YY_RULE_SETUP | 1040 | YY_RULE_SETUP |
1050 | #line 72 "scripts/genksyms/lex.l" | 1041 | #line 68 "scripts/genksyms/lex.l" |
1051 | cur_line++; | 1042 | cur_line++; |
1052 | YY_BREAK | 1043 | YY_BREAK |
1053 | case 3: | 1044 | case 3: |
1054 | /* rule 3 can match eol */ | 1045 | /* rule 3 can match eol */ |
1055 | YY_RULE_SETUP | 1046 | YY_RULE_SETUP |
1056 | #line 73 "scripts/genksyms/lex.l" | 1047 | #line 69 "scripts/genksyms/lex.l" |
1057 | cur_line++; | 1048 | cur_line++; |
1058 | YY_BREAK | 1049 | YY_BREAK |
1059 | /* Ignore all other whitespace. */ | 1050 | /* Ignore all other whitespace. */ |
1060 | case 4: | 1051 | case 4: |
1061 | YY_RULE_SETUP | 1052 | YY_RULE_SETUP |
1062 | #line 76 "scripts/genksyms/lex.l" | 1053 | #line 72 "scripts/genksyms/lex.l" |
1063 | ; | 1054 | ; |
1064 | YY_BREAK | 1055 | YY_BREAK |
1065 | case 5: | 1056 | case 5: |
1066 | /* rule 5 can match eol */ | 1057 | /* rule 5 can match eol */ |
1067 | YY_RULE_SETUP | 1058 | YY_RULE_SETUP |
1068 | #line 79 "scripts/genksyms/lex.l" | 1059 | #line 75 "scripts/genksyms/lex.l" |
1069 | return STRING; | 1060 | return STRING; |
1070 | YY_BREAK | 1061 | YY_BREAK |
1071 | case 6: | 1062 | case 6: |
1072 | /* rule 6 can match eol */ | 1063 | /* rule 6 can match eol */ |
1073 | YY_RULE_SETUP | 1064 | YY_RULE_SETUP |
1074 | #line 80 "scripts/genksyms/lex.l" | 1065 | #line 76 "scripts/genksyms/lex.l" |
1075 | return CHAR; | 1066 | return CHAR; |
1076 | YY_BREAK | 1067 | YY_BREAK |
1077 | case 7: | 1068 | case 7: |
1078 | YY_RULE_SETUP | 1069 | YY_RULE_SETUP |
1079 | #line 81 "scripts/genksyms/lex.l" | 1070 | #line 77 "scripts/genksyms/lex.l" |
1080 | return IDENT; | 1071 | return IDENT; |
1081 | YY_BREAK | 1072 | YY_BREAK |
1082 | /* The Pedant requires that the other C multi-character tokens be | 1073 | /* The Pedant requires that the other C multi-character tokens be |
@@ -1085,38 +1076,37 @@ return IDENT; | |||
1085 | around them properly. */ | 1076 | around them properly. */ |
1086 | case 8: | 1077 | case 8: |
1087 | YY_RULE_SETUP | 1078 | YY_RULE_SETUP |
1088 | #line 87 "scripts/genksyms/lex.l" | 1079 | #line 83 "scripts/genksyms/lex.l" |
1089 | return OTHER; | 1080 | return OTHER; |
1090 | YY_BREAK | 1081 | YY_BREAK |
1091 | case 9: | 1082 | case 9: |
1092 | YY_RULE_SETUP | 1083 | YY_RULE_SETUP |
1093 | #line 88 "scripts/genksyms/lex.l" | 1084 | #line 84 "scripts/genksyms/lex.l" |
1094 | return INT; | 1085 | return INT; |
1095 | YY_BREAK | 1086 | YY_BREAK |
1096 | case 10: | 1087 | case 10: |
1097 | YY_RULE_SETUP | 1088 | YY_RULE_SETUP |
1098 | #line 89 "scripts/genksyms/lex.l" | 1089 | #line 85 "scripts/genksyms/lex.l" |
1099 | return REAL; | 1090 | return REAL; |
1100 | YY_BREAK | 1091 | YY_BREAK |
1101 | case 11: | 1092 | case 11: |
1102 | YY_RULE_SETUP | 1093 | YY_RULE_SETUP |
1103 | #line 91 "scripts/genksyms/lex.l" | 1094 | #line 87 "scripts/genksyms/lex.l" |
1104 | return DOTS; | 1095 | return DOTS; |
1105 | YY_BREAK | 1096 | YY_BREAK |
1106 | /* All other tokens are single characters. */ | 1097 | /* All other tokens are single characters. */ |
1107 | case 12: | 1098 | case 12: |
1108 | YY_RULE_SETUP | 1099 | YY_RULE_SETUP |
1109 | #line 94 "scripts/genksyms/lex.l" | 1100 | #line 90 "scripts/genksyms/lex.l" |
1110 | return yytext[0]; | 1101 | return yytext[0]; |
1111 | YY_BREAK | 1102 | YY_BREAK |
1112 | case 13: | 1103 | case 13: |
1113 | YY_RULE_SETUP | 1104 | YY_RULE_SETUP |
1114 | #line 97 "scripts/genksyms/lex.l" | 1105 | #line 93 "scripts/genksyms/lex.l" |
1115 | ECHO; | 1106 | ECHO; |
1116 | YY_BREAK | 1107 | YY_BREAK |
1117 | #line 1118 "scripts/genksyms/lex.c" | 1108 | #line 1109 "scripts/genksyms/lex.c" |
1118 | case YY_STATE_EOF(INITIAL): | 1109 | case YY_STATE_EOF(INITIAL): |
1119 | case YY_STATE_EOF(V2_TOKENS): | ||
1120 | yyterminate(); | 1110 | yyterminate(); |
1121 | 1111 | ||
1122 | case YY_END_OF_BUFFER: | 1112 | case YY_END_OF_BUFFER: |
@@ -1429,7 +1419,7 @@ static int yy_get_next_buffer (void) | |||
1429 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 1419 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1430 | { | 1420 | { |
1431 | yy_current_state = (int) yy_def[yy_current_state]; | 1421 | yy_current_state = (int) yy_def[yy_current_state]; |
1432 | if ( yy_current_state >= 76 ) | 1422 | if ( yy_current_state >= 73 ) |
1433 | yy_c = yy_meta[(unsigned int) yy_c]; | 1423 | yy_c = yy_meta[(unsigned int) yy_c]; |
1434 | } | 1424 | } |
1435 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 1425 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
@@ -1462,11 +1452,11 @@ static int yy_get_next_buffer (void) | |||
1462 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | 1452 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1463 | { | 1453 | { |
1464 | yy_current_state = (int) yy_def[yy_current_state]; | 1454 | yy_current_state = (int) yy_def[yy_current_state]; |
1465 | if ( yy_current_state >= 76 ) | 1455 | if ( yy_current_state >= 73 ) |
1466 | yy_c = yy_meta[(unsigned int) yy_c]; | 1456 | yy_c = yy_meta[(unsigned int) yy_c]; |
1467 | } | 1457 | } |
1468 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | 1458 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
1469 | yy_is_jam = (yy_current_state == 75); | 1459 | yy_is_jam = (yy_current_state == 72); |
1470 | 1460 | ||
1471 | return yy_is_jam ? 0 : yy_current_state; | 1461 | return yy_is_jam ? 0 : yy_current_state; |
1472 | } | 1462 | } |
@@ -2252,7 +2242,7 @@ void yyfree (void * ptr ) | |||
2252 | 2242 | ||
2253 | /* %ok-for-header */ | 2243 | /* %ok-for-header */ |
2254 | 2244 | ||
2255 | #line 97 "scripts/genksyms/lex.l" | 2245 | #line 93 "scripts/genksyms/lex.l" |
2256 | 2246 | ||
2257 | 2247 | ||
2258 | 2248 | ||
@@ -2263,12 +2253,23 @@ void yyfree (void * ptr ) | |||
2263 | 2253 | ||
2264 | /* Macros to append to our phrase collection list. */ | 2254 | /* Macros to append to our phrase collection list. */ |
2265 | 2255 | ||
2256 | /* | ||
2257 | * We mark any token, that that equals to a known enumerator, as | ||
2258 | * SYM_ENUM_CONST. The parser will change this for struct and union tags later, | ||
2259 | * the only problem is struct and union members: | ||
2260 | * enum e { a, b }; struct s { int a, b; } | ||
2261 | * but in this case, the only effect will be, that the ABI checksums become | ||
2262 | * more volatile, which is acceptable. Also, such collisions are quite rare, | ||
2263 | * so far it was only observed in include/linux/telephony.h. | ||
2264 | */ | ||
2266 | #define _APP(T,L) do { \ | 2265 | #define _APP(T,L) do { \ |
2267 | cur_node = next_node; \ | 2266 | cur_node = next_node; \ |
2268 | next_node = xmalloc(sizeof(*next_node)); \ | 2267 | next_node = xmalloc(sizeof(*next_node)); \ |
2269 | next_node->next = cur_node; \ | 2268 | next_node->next = cur_node; \ |
2270 | cur_node->string = memcpy(xmalloc(L+1), T, L+1); \ | 2269 | cur_node->string = memcpy(xmalloc(L+1), T, L+1); \ |
2271 | cur_node->tag = SYM_NORMAL; \ | 2270 | cur_node->tag = \ |
2271 | find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\ | ||
2272 | SYM_ENUM_CONST : SYM_NORMAL ; \ | ||
2272 | } while (0) | 2273 | } while (0) |
2273 | 2274 | ||
2274 | #define APP _APP(yytext, yyleng) | 2275 | #define APP _APP(yytext, yyleng) |
@@ -2294,7 +2295,6 @@ yylex(void) | |||
2294 | 2295 | ||
2295 | if (lexstate == ST_NOTSTARTED) | 2296 | if (lexstate == ST_NOTSTARTED) |
2296 | { | 2297 | { |
2297 | BEGIN(V2_TOKENS); | ||
2298 | next_node = xmalloc(sizeof(*next_node)); | 2298 | next_node = xmalloc(sizeof(*next_node)); |
2299 | next_node->next = NULL; | 2299 | next_node->next = NULL; |
2300 | lexstate = ST_NORMAL; | 2300 | lexstate = ST_NORMAL; |
@@ -2347,8 +2347,8 @@ repeat: | |||
2347 | 2347 | ||
2348 | case STRUCT_KEYW: | 2348 | case STRUCT_KEYW: |
2349 | case UNION_KEYW: | 2349 | case UNION_KEYW: |
2350 | dont_want_brace_phrase = 3; | ||
2351 | case ENUM_KEYW: | 2350 | case ENUM_KEYW: |
2351 | dont_want_brace_phrase = 3; | ||
2352 | suppress_type_lookup = 2; | 2352 | suppress_type_lookup = 2; |
2353 | goto fini; | 2353 | goto fini; |
2354 | 2354 | ||
@@ -2358,8 +2358,7 @@ repeat: | |||
2358 | } | 2358 | } |
2359 | if (!suppress_type_lookup) | 2359 | if (!suppress_type_lookup) |
2360 | { | 2360 | { |
2361 | struct symbol *sym = find_symbol(yytext, SYM_TYPEDEF); | 2361 | if (find_symbol(yytext, SYM_TYPEDEF, 1)) |
2362 | if (sym && sym->type == SYM_TYPEDEF) | ||
2363 | token = TYPE; | 2362 | token = TYPE; |
2364 | } | 2363 | } |
2365 | } | 2364 | } |
@@ -2478,7 +2477,20 @@ repeat: | |||
2478 | ++count; | 2477 | ++count; |
2479 | APP; | 2478 | APP; |
2480 | goto repeat; | 2479 | goto repeat; |
2481 | case ')': case ']': case '}': | 2480 | case '}': |
2481 | /* is this the last line of an enum declaration? */ | ||
2482 | if (count == 0) | ||
2483 | { | ||
2484 | /* Put back the token we just read so's we can find it again | ||
2485 | after registering the expression. */ | ||
2486 | unput(token); | ||
2487 | |||
2488 | lexstate = ST_NORMAL; | ||
2489 | token = EXPRESSION_PHRASE; | ||
2490 | break; | ||
2491 | } | ||
2492 | /* FALLTHRU */ | ||
2493 | case ')': case ']': | ||
2482 | --count; | 2494 | --count; |
2483 | APP; | 2495 | APP; |
2484 | goto repeat; | 2496 | goto repeat; |
@@ -2567,143 +2579,4 @@ fini: | |||
2567 | 2579 | ||
2568 | return token; | 2580 | return token; |
2569 | } | 2581 | } |
2570 | /* A Bison parser, made by GNU Bison 2.3. */ | ||
2571 | |||
2572 | /* Skeleton interface for Bison's Yacc-like parsers in C | ||
2573 | |||
2574 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | ||
2575 | Free Software Foundation, Inc. | ||
2576 | |||
2577 | This program is free software; you can redistribute it and/or modify | ||
2578 | it under the terms of the GNU General Public License as published by | ||
2579 | the Free Software Foundation; either version 2, or (at your option) | ||
2580 | any later version. | ||
2581 | |||
2582 | This program is distributed in the hope that it will be useful, | ||
2583 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2584 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2585 | GNU General Public License for more details. | ||
2586 | |||
2587 | You should have received a copy of the GNU General Public License | ||
2588 | along with this program; if not, write to the Free Software | ||
2589 | Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
2590 | Boston, MA 02110-1301, USA. */ | ||
2591 | |||
2592 | /* As a special exception, you may create a larger work that contains | ||
2593 | part or all of the Bison parser skeleton and distribute that work | ||
2594 | under terms of your choice, so long as that work isn't itself a | ||
2595 | parser generator using the skeleton or a modified version thereof | ||
2596 | as a parser skeleton. Alternatively, if you modify or redistribute | ||
2597 | the parser skeleton itself, you may (at your option) remove this | ||
2598 | special exception, which will cause the skeleton and the resulting | ||
2599 | Bison output files to be licensed under the GNU General Public | ||
2600 | License without this special exception. | ||
2601 | |||
2602 | This special exception was added by the Free Software Foundation in | ||
2603 | version 2.2 of Bison. */ | ||
2604 | |||
2605 | /* Tokens. */ | ||
2606 | #ifndef YYTOKENTYPE | ||
2607 | # define YYTOKENTYPE | ||
2608 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
2609 | know about them. */ | ||
2610 | enum yytokentype { | ||
2611 | ASM_KEYW = 258, | ||
2612 | ATTRIBUTE_KEYW = 259, | ||
2613 | AUTO_KEYW = 260, | ||
2614 | BOOL_KEYW = 261, | ||
2615 | CHAR_KEYW = 262, | ||
2616 | CONST_KEYW = 263, | ||
2617 | DOUBLE_KEYW = 264, | ||
2618 | ENUM_KEYW = 265, | ||
2619 | EXTERN_KEYW = 266, | ||
2620 | EXTENSION_KEYW = 267, | ||
2621 | FLOAT_KEYW = 268, | ||
2622 | INLINE_KEYW = 269, | ||
2623 | INT_KEYW = 270, | ||
2624 | LONG_KEYW = 271, | ||
2625 | REGISTER_KEYW = 272, | ||
2626 | RESTRICT_KEYW = 273, | ||
2627 | SHORT_KEYW = 274, | ||
2628 | SIGNED_KEYW = 275, | ||
2629 | STATIC_KEYW = 276, | ||
2630 | STRUCT_KEYW = 277, | ||
2631 | TYPEDEF_KEYW = 278, | ||
2632 | UNION_KEYW = 279, | ||
2633 | UNSIGNED_KEYW = 280, | ||
2634 | VOID_KEYW = 281, | ||
2635 | VOLATILE_KEYW = 282, | ||
2636 | TYPEOF_KEYW = 283, | ||
2637 | EXPORT_SYMBOL_KEYW = 284, | ||
2638 | ASM_PHRASE = 285, | ||
2639 | ATTRIBUTE_PHRASE = 286, | ||
2640 | BRACE_PHRASE = 287, | ||
2641 | BRACKET_PHRASE = 288, | ||
2642 | EXPRESSION_PHRASE = 289, | ||
2643 | CHAR = 290, | ||
2644 | DOTS = 291, | ||
2645 | IDENT = 292, | ||
2646 | INT = 293, | ||
2647 | REAL = 294, | ||
2648 | STRING = 295, | ||
2649 | TYPE = 296, | ||
2650 | OTHER = 297, | ||
2651 | FILENAME = 298 | ||
2652 | }; | ||
2653 | #endif | ||
2654 | /* Tokens. */ | ||
2655 | #define ASM_KEYW 258 | ||
2656 | #define ATTRIBUTE_KEYW 259 | ||
2657 | #define AUTO_KEYW 260 | ||
2658 | #define BOOL_KEYW 261 | ||
2659 | #define CHAR_KEYW 262 | ||
2660 | #define CONST_KEYW 263 | ||
2661 | #define DOUBLE_KEYW 264 | ||
2662 | #define ENUM_KEYW 265 | ||
2663 | #define EXTERN_KEYW 266 | ||
2664 | #define EXTENSION_KEYW 267 | ||
2665 | #define FLOAT_KEYW 268 | ||
2666 | #define INLINE_KEYW 269 | ||
2667 | #define INT_KEYW 270 | ||
2668 | #define LONG_KEYW 271 | ||
2669 | #define REGISTER_KEYW 272 | ||
2670 | #define RESTRICT_KEYW 273 | ||
2671 | #define SHORT_KEYW 274 | ||
2672 | #define SIGNED_KEYW 275 | ||
2673 | #define STATIC_KEYW 276 | ||
2674 | #define STRUCT_KEYW 277 | ||
2675 | #define TYPEDEF_KEYW 278 | ||
2676 | #define UNION_KEYW 279 | ||
2677 | #define UNSIGNED_KEYW 280 | ||
2678 | #define VOID_KEYW 281 | ||
2679 | #define VOLATILE_KEYW 282 | ||
2680 | #define TYPEOF_KEYW 283 | ||
2681 | #define EXPORT_SYMBOL_KEYW 284 | ||
2682 | #define ASM_PHRASE 285 | ||
2683 | #define ATTRIBUTE_PHRASE 286 | ||
2684 | #define BRACE_PHRASE 287 | ||
2685 | #define BRACKET_PHRASE 288 | ||
2686 | #define EXPRESSION_PHRASE 289 | ||
2687 | #define CHAR 290 | ||
2688 | #define DOTS 291 | ||
2689 | #define IDENT 292 | ||
2690 | #define INT 293 | ||
2691 | #define REAL 294 | ||
2692 | #define STRING 295 | ||
2693 | #define TYPE 296 | ||
2694 | #define OTHER 297 | ||
2695 | #define FILENAME 298 | ||
2696 | |||
2697 | |||
2698 | |||
2699 | |||
2700 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | ||
2701 | typedef int YYSTYPE; | ||
2702 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||
2703 | # define YYSTYPE_IS_DECLARED 1 | ||
2704 | # define YYSTYPE_IS_TRIVIAL 1 | ||
2705 | #endif | ||
2706 | |||
2707 | extern YYSTYPE yylval; | ||
2708 | |||
2709 | 2582 | ||
diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l index fe50ff9dacd0..e4ddd493fec3 100644 --- a/scripts/genksyms/lex.l +++ b/scripts/genksyms/lex.l | |||
@@ -55,10 +55,6 @@ CHAR L?\'([^\\\']*\\.)*[^\\\']*\' | |||
55 | 55 | ||
56 | MC_TOKEN ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>) | 56 | MC_TOKEN ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>) |
57 | 57 | ||
58 | /* Version 2 checksumming does proper tokenization; version 1 wasn't | ||
59 | quite so pedantic. */ | ||
60 | %s V2_TOKENS | ||
61 | |||
62 | /* We don't do multiple input files. */ | 58 | /* We don't do multiple input files. */ |
63 | %option noyywrap | 59 | %option noyywrap |
64 | 60 | ||
@@ -84,9 +80,9 @@ MC_TOKEN ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>) | |||
84 | recognized as tokens. We don't actually use them since we don't | 80 | recognized as tokens. We don't actually use them since we don't |
85 | parse expressions, but we do want whitespace to be arranged | 81 | parse expressions, but we do want whitespace to be arranged |
86 | around them properly. */ | 82 | around them properly. */ |
87 | <V2_TOKENS>{MC_TOKEN} return OTHER; | 83 | {MC_TOKEN} return OTHER; |
88 | <V2_TOKENS>{INT} return INT; | 84 | {INT} return INT; |
89 | <V2_TOKENS>{REAL} return REAL; | 85 | {REAL} return REAL; |
90 | 86 | ||
91 | "..." return DOTS; | 87 | "..." return DOTS; |
92 | 88 | ||
@@ -103,12 +99,23 @@ MC_TOKEN ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>) | |||
103 | 99 | ||
104 | /* Macros to append to our phrase collection list. */ | 100 | /* Macros to append to our phrase collection list. */ |
105 | 101 | ||
102 | /* | ||
103 | * We mark any token, that that equals to a known enumerator, as | ||
104 | * SYM_ENUM_CONST. The parser will change this for struct and union tags later, | ||
105 | * the only problem is struct and union members: | ||
106 | * enum e { a, b }; struct s { int a, b; } | ||
107 | * but in this case, the only effect will be, that the ABI checksums become | ||
108 | * more volatile, which is acceptable. Also, such collisions are quite rare, | ||
109 | * so far it was only observed in include/linux/telephony.h. | ||
110 | */ | ||
106 | #define _APP(T,L) do { \ | 111 | #define _APP(T,L) do { \ |
107 | cur_node = next_node; \ | 112 | cur_node = next_node; \ |
108 | next_node = xmalloc(sizeof(*next_node)); \ | 113 | next_node = xmalloc(sizeof(*next_node)); \ |
109 | next_node->next = cur_node; \ | 114 | next_node->next = cur_node; \ |
110 | cur_node->string = memcpy(xmalloc(L+1), T, L+1); \ | 115 | cur_node->string = memcpy(xmalloc(L+1), T, L+1); \ |
111 | cur_node->tag = SYM_NORMAL; \ | 116 | cur_node->tag = \ |
117 | find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\ | ||
118 | SYM_ENUM_CONST : SYM_NORMAL ; \ | ||
112 | } while (0) | 119 | } while (0) |
113 | 120 | ||
114 | #define APP _APP(yytext, yyleng) | 121 | #define APP _APP(yytext, yyleng) |
@@ -134,7 +141,6 @@ yylex(void) | |||
134 | 141 | ||
135 | if (lexstate == ST_NOTSTARTED) | 142 | if (lexstate == ST_NOTSTARTED) |
136 | { | 143 | { |
137 | BEGIN(V2_TOKENS); | ||
138 | next_node = xmalloc(sizeof(*next_node)); | 144 | next_node = xmalloc(sizeof(*next_node)); |
139 | next_node->next = NULL; | 145 | next_node->next = NULL; |
140 | lexstate = ST_NORMAL; | 146 | lexstate = ST_NORMAL; |
@@ -187,8 +193,8 @@ repeat: | |||
187 | 193 | ||
188 | case STRUCT_KEYW: | 194 | case STRUCT_KEYW: |
189 | case UNION_KEYW: | 195 | case UNION_KEYW: |
190 | dont_want_brace_phrase = 3; | ||
191 | case ENUM_KEYW: | 196 | case ENUM_KEYW: |
197 | dont_want_brace_phrase = 3; | ||
192 | suppress_type_lookup = 2; | 198 | suppress_type_lookup = 2; |
193 | goto fini; | 199 | goto fini; |
194 | 200 | ||
@@ -198,8 +204,7 @@ repeat: | |||
198 | } | 204 | } |
199 | if (!suppress_type_lookup) | 205 | if (!suppress_type_lookup) |
200 | { | 206 | { |
201 | struct symbol *sym = find_symbol(yytext, SYM_TYPEDEF); | 207 | if (find_symbol(yytext, SYM_TYPEDEF, 1)) |
202 | if (sym && sym->type == SYM_TYPEDEF) | ||
203 | token = TYPE; | 208 | token = TYPE; |
204 | } | 209 | } |
205 | } | 210 | } |
@@ -318,7 +323,20 @@ repeat: | |||
318 | ++count; | 323 | ++count; |
319 | APP; | 324 | APP; |
320 | goto repeat; | 325 | goto repeat; |
321 | case ')': case ']': case '}': | 326 | case '}': |
327 | /* is this the last line of an enum declaration? */ | ||
328 | if (count == 0) | ||
329 | { | ||
330 | /* Put back the token we just read so's we can find it again | ||
331 | after registering the expression. */ | ||
332 | unput(token); | ||
333 | |||
334 | lexstate = ST_NORMAL; | ||
335 | token = EXPRESSION_PHRASE; | ||
336 | break; | ||
337 | } | ||
338 | /* FALLTHRU */ | ||
339 | case ')': case ']': | ||
322 | --count; | 340 | --count; |
323 | APP; | 341 | APP; |
324 | goto repeat; | 342 | goto repeat; |
diff --git a/scripts/genksyms/parse.c_shipped b/scripts/genksyms/parse.c_shipped index 809b949e495b..1a0b8607fb0e 100644 --- a/scripts/genksyms/parse.c_shipped +++ b/scripts/genksyms/parse.c_shipped | |||
@@ -1,24 +1,23 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.3. */ | ||
2 | 1 | ||
3 | /* Skeleton implementation for Bison's Yacc-like parsers in C | 2 | /* A Bison parser, made by GNU Bison 2.4.1. */ |
4 | 3 | ||
5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | 4 | /* Skeleton implementation for Bison's Yacc-like parsers in C |
5 | |||
6 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | ||
6 | Free Software Foundation, Inc. | 7 | Free Software Foundation, Inc. |
7 | 8 | ||
8 | This program is free software; you can redistribute it and/or modify | 9 | This program is free software: you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 10 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2, or (at your option) | 11 | the Free Software Foundation, either version 3 of the License, or |
11 | any later version. | 12 | (at your option) any later version. |
12 | 13 | ||
13 | This program is distributed in the hope that it will be useful, | 14 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 17 | GNU General Public License for more details. |
17 | 18 | ||
18 | You should have received a copy of the GNU General Public License | 19 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
21 | Boston, MA 02110-1301, USA. */ | ||
22 | 21 | ||
23 | /* As a special exception, you may create a larger work that contains | 22 | /* As a special exception, you may create a larger work that contains |
24 | part or all of the Bison parser skeleton and distribute that work | 23 | part or all of the Bison parser skeleton and distribute that work |
@@ -29,7 +28,7 @@ | |||
29 | special exception, which will cause the skeleton and the resulting | 28 | special exception, which will cause the skeleton and the resulting |
30 | Bison output files to be licensed under the GNU General Public | 29 | Bison output files to be licensed under the GNU General Public |
31 | License without this special exception. | 30 | License without this special exception. |
32 | 31 | ||
33 | This special exception was added by the Free Software Foundation in | 32 | This special exception was added by the Free Software Foundation in |
34 | version 2.2 of Bison. */ | 33 | version 2.2 of Bison. */ |
35 | 34 | ||
@@ -47,7 +46,7 @@ | |||
47 | #define YYBISON 1 | 46 | #define YYBISON 1 |
48 | 47 | ||
49 | /* Bison version. */ | 48 | /* Bison version. */ |
50 | #define YYBISON_VERSION "2.3" | 49 | #define YYBISON_VERSION "2.4.1" |
51 | 50 | ||
52 | /* Skeleton name. */ | 51 | /* Skeleton name. */ |
53 | #define YYSKELETON_NAME "yacc.c" | 52 | #define YYSKELETON_NAME "yacc.c" |
@@ -55,11 +54,75 @@ | |||
55 | /* Pure parsers. */ | 54 | /* Pure parsers. */ |
56 | #define YYPURE 0 | 55 | #define YYPURE 0 |
57 | 56 | ||
57 | /* Push parsers. */ | ||
58 | #define YYPUSH 0 | ||
59 | |||
60 | /* Pull parsers. */ | ||
61 | #define YYPULL 1 | ||
62 | |||
58 | /* Using locations. */ | 63 | /* Using locations. */ |
59 | #define YYLSP_NEEDED 0 | 64 | #define YYLSP_NEEDED 0 |
60 | 65 | ||
61 | 66 | ||
62 | 67 | ||
68 | /* Copy the first part of user declarations. */ | ||
69 | |||
70 | /* Line 189 of yacc.c */ | ||
71 | #line 24 "scripts/genksyms/parse.y" | ||
72 | |||
73 | |||
74 | #include <assert.h> | ||
75 | #include <stdlib.h> | ||
76 | #include <string.h> | ||
77 | #include "genksyms.h" | ||
78 | |||
79 | static int is_typedef; | ||
80 | static int is_extern; | ||
81 | static char *current_name; | ||
82 | static struct string_list *decl_spec; | ||
83 | |||
84 | static void yyerror(const char *); | ||
85 | |||
86 | static inline void | ||
87 | remove_node(struct string_list **p) | ||
88 | { | ||
89 | struct string_list *node = *p; | ||
90 | *p = node->next; | ||
91 | free_node(node); | ||
92 | } | ||
93 | |||
94 | static inline void | ||
95 | remove_list(struct string_list **pb, struct string_list **pe) | ||
96 | { | ||
97 | struct string_list *b = *pb, *e = *pe; | ||
98 | *pb = e; | ||
99 | free_list(b, e); | ||
100 | } | ||
101 | |||
102 | |||
103 | |||
104 | /* Line 189 of yacc.c */ | ||
105 | #line 106 "scripts/genksyms/parse.c" | ||
106 | |||
107 | /* Enabling traces. */ | ||
108 | #ifndef YYDEBUG | ||
109 | # define YYDEBUG 1 | ||
110 | #endif | ||
111 | |||
112 | /* Enabling verbose error messages. */ | ||
113 | #ifdef YYERROR_VERBOSE | ||
114 | # undef YYERROR_VERBOSE | ||
115 | # define YYERROR_VERBOSE 1 | ||
116 | #else | ||
117 | # define YYERROR_VERBOSE 0 | ||
118 | #endif | ||
119 | |||
120 | /* Enabling the token table. */ | ||
121 | #ifndef YYTOKEN_TABLE | ||
122 | # define YYTOKEN_TABLE 0 | ||
123 | #endif | ||
124 | |||
125 | |||
63 | /* Tokens. */ | 126 | /* Tokens. */ |
64 | #ifndef YYTOKENTYPE | 127 | #ifndef YYTOKENTYPE |
65 | # define YYTOKENTYPE | 128 | # define YYTOKENTYPE |
@@ -109,117 +172,22 @@ | |||
109 | FILENAME = 298 | 172 | FILENAME = 298 |
110 | }; | 173 | }; |
111 | #endif | 174 | #endif |
112 | /* Tokens. */ | ||
113 | #define ASM_KEYW 258 | ||
114 | #define ATTRIBUTE_KEYW 259 | ||
115 | #define AUTO_KEYW 260 | ||
116 | #define BOOL_KEYW 261 | ||
117 | #define CHAR_KEYW 262 | ||
118 | #define CONST_KEYW 263 | ||
119 | #define DOUBLE_KEYW 264 | ||
120 | #define ENUM_KEYW 265 | ||
121 | #define EXTERN_KEYW 266 | ||
122 | #define EXTENSION_KEYW 267 | ||
123 | #define FLOAT_KEYW 268 | ||
124 | #define INLINE_KEYW 269 | ||
125 | #define INT_KEYW 270 | ||
126 | #define LONG_KEYW 271 | ||
127 | #define REGISTER_KEYW 272 | ||
128 | #define RESTRICT_KEYW 273 | ||
129 | #define SHORT_KEYW 274 | ||
130 | #define SIGNED_KEYW 275 | ||
131 | #define STATIC_KEYW 276 | ||
132 | #define STRUCT_KEYW 277 | ||
133 | #define TYPEDEF_KEYW 278 | ||
134 | #define UNION_KEYW 279 | ||
135 | #define UNSIGNED_KEYW 280 | ||
136 | #define VOID_KEYW 281 | ||
137 | #define VOLATILE_KEYW 282 | ||
138 | #define TYPEOF_KEYW 283 | ||
139 | #define EXPORT_SYMBOL_KEYW 284 | ||
140 | #define ASM_PHRASE 285 | ||
141 | #define ATTRIBUTE_PHRASE 286 | ||
142 | #define BRACE_PHRASE 287 | ||
143 | #define BRACKET_PHRASE 288 | ||
144 | #define EXPRESSION_PHRASE 289 | ||
145 | #define CHAR 290 | ||
146 | #define DOTS 291 | ||
147 | #define IDENT 292 | ||
148 | #define INT 293 | ||
149 | #define REAL 294 | ||
150 | #define STRING 295 | ||
151 | #define TYPE 296 | ||
152 | #define OTHER 297 | ||
153 | #define FILENAME 298 | ||
154 | |||
155 | |||
156 | |||
157 | |||
158 | /* Copy the first part of user declarations. */ | ||
159 | #line 24 "scripts/genksyms/parse.y" | ||
160 | |||
161 | |||
162 | #include <assert.h> | ||
163 | #include <stdlib.h> | ||
164 | #include "genksyms.h" | ||
165 | |||
166 | static int is_typedef; | ||
167 | static int is_extern; | ||
168 | static char *current_name; | ||
169 | static struct string_list *decl_spec; | ||
170 | |||
171 | static void yyerror(const char *); | ||
172 | |||
173 | static inline void | ||
174 | remove_node(struct string_list **p) | ||
175 | { | ||
176 | struct string_list *node = *p; | ||
177 | *p = node->next; | ||
178 | free_node(node); | ||
179 | } | ||
180 | |||
181 | static inline void | ||
182 | remove_list(struct string_list **pb, struct string_list **pe) | ||
183 | { | ||
184 | struct string_list *b = *pb, *e = *pe; | ||
185 | *pb = e; | ||
186 | free_list(b, e); | ||
187 | } | ||
188 | |||
189 | |||
190 | |||
191 | /* Enabling traces. */ | ||
192 | #ifndef YYDEBUG | ||
193 | # define YYDEBUG 1 | ||
194 | #endif | ||
195 | 175 | ||
196 | /* Enabling verbose error messages. */ | ||
197 | #ifdef YYERROR_VERBOSE | ||
198 | # undef YYERROR_VERBOSE | ||
199 | # define YYERROR_VERBOSE 1 | ||
200 | #else | ||
201 | # define YYERROR_VERBOSE 0 | ||
202 | #endif | ||
203 | 176 | ||
204 | /* Enabling the token table. */ | ||
205 | #ifndef YYTOKEN_TABLE | ||
206 | # define YYTOKEN_TABLE 0 | ||
207 | #endif | ||
208 | 177 | ||
209 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | 178 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
210 | typedef int YYSTYPE; | 179 | typedef int YYSTYPE; |
180 | # define YYSTYPE_IS_TRIVIAL 1 | ||
211 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | 181 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
212 | # define YYSTYPE_IS_DECLARED 1 | 182 | # define YYSTYPE_IS_DECLARED 1 |
213 | # define YYSTYPE_IS_TRIVIAL 1 | ||
214 | #endif | 183 | #endif |
215 | 184 | ||
216 | 185 | ||
217 | |||
218 | /* Copy the second part of user declarations. */ | 186 | /* Copy the second part of user declarations. */ |
219 | 187 | ||
220 | 188 | ||
221 | /* Line 216 of yacc.c. */ | 189 | /* Line 264 of yacc.c */ |
222 | #line 223 "scripts/genksyms/parse.c" | 190 | #line 191 "scripts/genksyms/parse.c" |
223 | 191 | ||
224 | #ifdef short | 192 | #ifdef short |
225 | # undef short | 193 | # undef short |
@@ -294,14 +262,14 @@ typedef short int yytype_int16; | |||
294 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 262 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
295 | || defined __cplusplus || defined _MSC_VER) | 263 | || defined __cplusplus || defined _MSC_VER) |
296 | static int | 264 | static int |
297 | YYID (int i) | 265 | YYID (int yyi) |
298 | #else | 266 | #else |
299 | static int | 267 | static int |
300 | YYID (i) | 268 | YYID (yyi) |
301 | int i; | 269 | int yyi; |
302 | #endif | 270 | #endif |
303 | { | 271 | { |
304 | return i; | 272 | return yyi; |
305 | } | 273 | } |
306 | #endif | 274 | #endif |
307 | 275 | ||
@@ -382,9 +350,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ | |||
382 | /* A type that is properly aligned for any stack member. */ | 350 | /* A type that is properly aligned for any stack member. */ |
383 | union yyalloc | 351 | union yyalloc |
384 | { | 352 | { |
385 | yytype_int16 yyss; | 353 | yytype_int16 yyss_alloc; |
386 | YYSTYPE yyvs; | 354 | YYSTYPE yyvs_alloc; |
387 | }; | 355 | }; |
388 | 356 | ||
389 | /* The size of the maximum gap between one aligned stack and the next. */ | 357 | /* The size of the maximum gap between one aligned stack and the next. */ |
390 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) | 358 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
@@ -418,12 +386,12 @@ union yyalloc | |||
418 | elements in the stack, and YYPTR gives the new location of the | 386 | elements in the stack, and YYPTR gives the new location of the |
419 | stack. Advance YYPTR to a properly aligned location for the next | 387 | stack. Advance YYPTR to a properly aligned location for the next |
420 | stack. */ | 388 | stack. */ |
421 | # define YYSTACK_RELOCATE(Stack) \ | 389 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
422 | do \ | 390 | do \ |
423 | { \ | 391 | { \ |
424 | YYSIZE_T yynewbytes; \ | 392 | YYSIZE_T yynewbytes; \ |
425 | YYCOPY (&yyptr->Stack, Stack, yysize); \ | 393 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
426 | Stack = &yyptr->Stack; \ | 394 | Stack = &yyptr->Stack_alloc; \ |
427 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | 395 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
428 | yyptr += yynewbytes / sizeof (*yyptr); \ | 396 | yyptr += yynewbytes / sizeof (*yyptr); \ |
429 | } \ | 397 | } \ |
@@ -434,16 +402,16 @@ union yyalloc | |||
434 | /* YYFINAL -- State number of the termination state. */ | 402 | /* YYFINAL -- State number of the termination state. */ |
435 | #define YYFINAL 4 | 403 | #define YYFINAL 4 |
436 | /* YYLAST -- Last index in YYTABLE. */ | 404 | /* YYLAST -- Last index in YYTABLE. */ |
437 | #define YYLAST 523 | 405 | #define YYLAST 532 |
438 | 406 | ||
439 | /* YYNTOKENS -- Number of terminals. */ | 407 | /* YYNTOKENS -- Number of terminals. */ |
440 | #define YYNTOKENS 53 | 408 | #define YYNTOKENS 53 |
441 | /* YYNNTS -- Number of nonterminals. */ | 409 | /* YYNNTS -- Number of nonterminals. */ |
442 | #define YYNNTS 46 | 410 | #define YYNNTS 49 |
443 | /* YYNRULES -- Number of rules. */ | 411 | /* YYNRULES -- Number of rules. */ |
444 | #define YYNRULES 126 | 412 | #define YYNRULES 132 |
445 | /* YYNRULES -- Number of states. */ | 413 | /* YYNRULES -- Number of states. */ |
446 | #define YYNSTATES 178 | 414 | #define YYNSTATES 188 |
447 | 415 | ||
448 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | 416 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
449 | #define YYUNDEFTOK 2 | 417 | #define YYUNDEFTOK 2 |
@@ -504,7 +472,8 @@ static const yytype_uint16 yyprhs[] = | |||
504 | 239, 242, 245, 247, 248, 250, 252, 257, 262, 265, | 472 | 239, 242, 245, 247, 248, 250, 252, 257, 262, 265, |
505 | 269, 273, 277, 278, 280, 283, 287, 291, 292, 294, | 473 | 269, 273, 277, 278, 280, 283, 287, 291, 292, 294, |
506 | 296, 299, 303, 306, 307, 309, 311, 315, 318, 321, | 474 | 296, 299, 303, 306, 307, 309, 311, 315, 318, 321, |
507 | 323, 326, 327, 330, 333, 334, 336 | 475 | 323, 326, 327, 330, 334, 339, 341, 345, 347, 351, |
476 | 354, 355, 357 | ||
508 | }; | 477 | }; |
509 | 478 | ||
510 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | 479 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
@@ -512,16 +481,16 @@ static const yytype_int8 yyrhs[] = | |||
512 | { | 481 | { |
513 | 54, 0, -1, 55, -1, 54, 55, -1, -1, 56, | 482 | 54, 0, -1, 55, -1, 54, 55, -1, -1, 56, |
514 | 57, -1, -1, 12, 23, 58, 60, -1, -1, 23, | 483 | 57, -1, -1, 12, 23, 58, 60, -1, -1, 23, |
515 | 59, 60, -1, 60, -1, 84, -1, 96, -1, 98, | 484 | 59, 60, -1, 60, -1, 84, -1, 99, -1, 101, |
516 | -1, 1, 44, -1, 1, 45, -1, 64, 61, 44, | 485 | -1, 1, 44, -1, 1, 45, -1, 64, 61, 44, |
517 | -1, -1, 62, -1, 63, -1, 62, 46, 63, -1, | 486 | -1, -1, 62, -1, 63, -1, 62, 46, 63, -1, |
518 | 74, 97, 95, 85, -1, -1, 65, -1, 66, -1, | 487 | 74, 100, 95, 85, -1, -1, 65, -1, 66, -1, |
519 | 65, 66, -1, 67, -1, 68, -1, 5, -1, 17, | 488 | 65, 66, -1, 67, -1, 68, -1, 5, -1, 17, |
520 | -1, 21, -1, 11, -1, 14, -1, 69, -1, 73, | 489 | -1, 21, -1, 11, -1, 14, -1, 69, -1, 73, |
521 | -1, 28, 47, 65, 48, 49, -1, 28, 47, 65, | 490 | -1, 28, 47, 65, 48, 49, -1, 28, 47, 65, |
522 | 49, -1, 22, 37, -1, 24, 37, -1, 10, 37, | 491 | 49, -1, 22, 37, -1, 24, 37, -1, 10, 37, |
523 | -1, 22, 37, 87, -1, 24, 37, 87, -1, 10, | 492 | -1, 22, 37, 87, -1, 24, 37, 87, -1, 10, |
524 | 37, 32, -1, 10, 32, -1, 22, 87, -1, 24, | 493 | 37, 96, -1, 10, 96, -1, 22, 87, -1, 24, |
525 | 87, -1, 7, -1, 19, -1, 15, -1, 16, -1, | 494 | 87, -1, 7, -1, 19, -1, 15, -1, 16, -1, |
526 | 20, -1, 25, -1, 13, -1, 9, -1, 26, -1, | 495 | 20, -1, 25, -1, 13, -1, 9, -1, 26, -1, |
527 | 6, -1, 41, -1, 48, 71, -1, -1, 72, -1, | 496 | 6, -1, 41, -1, 48, 71, -1, -1, 72, -1, |
@@ -543,26 +512,29 @@ static const yytype_int8 yyrhs[] = | |||
543 | 91, 44, -1, 1, 44, -1, -1, 92, -1, 93, | 512 | 91, 44, -1, 1, 44, -1, -1, 92, -1, 93, |
544 | -1, 92, 46, 93, -1, 76, 95, -1, 37, 94, | 513 | -1, 92, 46, 93, -1, 76, 95, -1, 37, 94, |
545 | -1, 94, -1, 52, 34, -1, -1, 95, 31, -1, | 514 | -1, 94, -1, 52, 34, -1, -1, 95, 31, -1, |
546 | 30, 44, -1, -1, 30, -1, 29, 47, 37, 49, | 515 | 51, 97, 45, -1, 51, 97, 46, 45, -1, 98, |
547 | 44, -1 | 516 | -1, 97, 46, 98, -1, 37, -1, 37, 50, 34, |
517 | -1, 30, 44, -1, -1, 30, -1, 29, 47, 37, | ||
518 | 49, 44, -1 | ||
548 | }; | 519 | }; |
549 | 520 | ||
550 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | 521 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
551 | static const yytype_uint16 yyrline[] = | 522 | static const yytype_uint16 yyrline[] = |
552 | { | 523 | { |
553 | 0, 103, 103, 104, 108, 108, 114, 114, 116, 116, | 524 | 0, 104, 104, 105, 109, 109, 115, 115, 117, 117, |
554 | 118, 119, 120, 121, 122, 123, 127, 141, 142, 146, | 525 | 119, 120, 121, 122, 123, 124, 128, 142, 143, 147, |
555 | 154, 167, 173, 174, 178, 179, 183, 189, 193, 194, | 526 | 155, 168, 174, 175, 179, 180, 184, 190, 194, 195, |
556 | 195, 196, 197, 201, 202, 203, 204, 208, 210, 212, | 527 | 196, 197, 198, 202, 203, 204, 205, 209, 211, 213, |
557 | 216, 223, 230, 239, 240, 241, 245, 246, 247, 248, | 528 | 217, 224, 231, 241, 244, 245, 249, 250, 251, 252, |
558 | 249, 250, 251, 252, 253, 254, 255, 259, 264, 265, | 529 | 253, 254, 255, 256, 257, 258, 259, 263, 268, 269, |
559 | 269, 270, 274, 274, 274, 275, 283, 284, 288, 297, | 530 | 273, 274, 278, 278, 278, 279, 287, 288, 292, 301, |
560 | 299, 301, 303, 305, 312, 313, 317, 318, 319, 321, | 531 | 303, 305, 307, 309, 316, 317, 321, 322, 323, 325, |
561 | 323, 325, 327, 332, 333, 334, 338, 339, 343, 344, | 532 | 327, 329, 331, 336, 337, 338, 342, 343, 347, 348, |
562 | 349, 354, 356, 360, 361, 369, 373, 375, 377, 379, | 533 | 353, 358, 360, 364, 365, 373, 377, 379, 381, 383, |
563 | 381, 386, 395, 396, 401, 406, 407, 411, 412, 416, | 534 | 385, 390, 399, 400, 405, 410, 411, 415, 416, 420, |
564 | 417, 421, 423, 428, 429, 433, 434, 438, 439, 440, | 535 | 421, 425, 427, 432, 433, 437, 438, 442, 443, 444, |
565 | 444, 448, 449, 453, 457, 458, 462 | 536 | 448, 452, 453, 457, 458, 462, 463, 466, 471, 479, |
537 | 483, 484, 488 | ||
566 | }; | 538 | }; |
567 | #endif | 539 | #endif |
568 | 540 | ||
@@ -581,8 +553,8 @@ static const char *const yytname[] = | |||
581 | "ATTRIBUTE_PHRASE", "BRACE_PHRASE", "BRACKET_PHRASE", | 553 | "ATTRIBUTE_PHRASE", "BRACE_PHRASE", "BRACKET_PHRASE", |
582 | "EXPRESSION_PHRASE", "CHAR", "DOTS", "IDENT", "INT", "REAL", "STRING", | 554 | "EXPRESSION_PHRASE", "CHAR", "DOTS", "IDENT", "INT", "REAL", "STRING", |
583 | "TYPE", "OTHER", "FILENAME", "';'", "'}'", "','", "'('", "'*'", "')'", | 555 | "TYPE", "OTHER", "FILENAME", "';'", "'}'", "','", "'('", "'*'", "')'", |
584 | "'='", "'{'", "':'", "$accept", "declaration_seq", "declaration", "@1", | 556 | "'='", "'{'", "':'", "$accept", "declaration_seq", "declaration", "$@1", |
585 | "declaration1", "@2", "@3", "simple_declaration", | 557 | "declaration1", "$@2", "$@3", "simple_declaration", |
586 | "init_declarator_list_opt", "init_declarator_list", "init_declarator", | 558 | "init_declarator_list_opt", "init_declarator_list", "init_declarator", |
587 | "decl_specifier_seq_opt", "decl_specifier_seq", "decl_specifier", | 559 | "decl_specifier_seq_opt", "decl_specifier_seq", "decl_specifier", |
588 | "storage_class_specifier", "type_specifier", "simple_type_specifier", | 560 | "storage_class_specifier", "type_specifier", "simple_type_specifier", |
@@ -596,7 +568,8 @@ static const char *const yytname[] = | |||
596 | "member_specification", "member_declaration", | 568 | "member_specification", "member_declaration", |
597 | "member_declarator_list_opt", "member_declarator_list", | 569 | "member_declarator_list_opt", "member_declarator_list", |
598 | "member_declarator", "member_bitfield_declarator", "attribute_opt", | 570 | "member_declarator", "member_bitfield_declarator", "attribute_opt", |
599 | "asm_definition", "asm_phrase_opt", "export_definition", 0 | 571 | "enum_body", "enumerator_list", "enumerator", "asm_definition", |
572 | "asm_phrase_opt", "export_definition", 0 | ||
600 | }; | 573 | }; |
601 | #endif | 574 | #endif |
602 | 575 | ||
@@ -629,7 +602,8 @@ static const yytype_uint8 yyr1[] = | |||
629 | 81, 82, 82, 83, 83, 83, 83, 83, 83, 83, | 602 | 81, 82, 82, 83, 83, 83, 83, 83, 83, 83, |
630 | 83, 84, 85, 85, 86, 87, 87, 88, 88, 89, | 603 | 83, 84, 85, 85, 86, 87, 87, 88, 88, 89, |
631 | 89, 90, 90, 91, 91, 92, 92, 93, 93, 93, | 604 | 89, 90, 90, 91, 91, 92, 92, 93, 93, 93, |
632 | 94, 95, 95, 96, 97, 97, 98 | 605 | 94, 95, 95, 96, 96, 97, 97, 98, 98, 99, |
606 | 100, 100, 101 | ||
633 | }; | 607 | }; |
634 | 608 | ||
635 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | 609 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
@@ -647,7 +621,8 @@ static const yytype_uint8 yyr2[] = | |||
647 | 2, 2, 1, 0, 1, 1, 4, 4, 2, 3, | 621 | 2, 2, 1, 0, 1, 1, 4, 4, 2, 3, |
648 | 3, 3, 0, 1, 2, 3, 3, 0, 1, 1, | 622 | 3, 3, 0, 1, 2, 3, 3, 0, 1, 1, |
649 | 2, 3, 2, 0, 1, 1, 3, 2, 2, 1, | 623 | 2, 3, 2, 0, 1, 1, 3, 2, 2, 1, |
650 | 2, 0, 2, 2, 0, 1, 5 | 624 | 2, 0, 2, 3, 4, 1, 3, 1, 3, 2, |
625 | 0, 1, 5 | ||
651 | }; | 626 | }; |
652 | 627 | ||
653 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | 628 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
@@ -659,17 +634,18 @@ static const yytype_uint8 yydefact[] = | |||
659 | 62, 53, 0, 31, 0, 52, 32, 48, 49, 29, | 634 | 62, 53, 0, 31, 0, 52, 32, 48, 49, 29, |
660 | 65, 47, 50, 30, 0, 8, 0, 51, 54, 63, | 635 | 65, 47, 50, 30, 0, 8, 0, 51, 54, 63, |
661 | 0, 0, 0, 64, 56, 5, 10, 17, 23, 24, | 636 | 0, 0, 0, 64, 56, 5, 10, 17, 23, 24, |
662 | 26, 27, 33, 34, 11, 12, 13, 14, 15, 43, | 637 | 26, 27, 33, 34, 11, 12, 13, 14, 15, 39, |
663 | 39, 6, 37, 0, 44, 22, 38, 45, 0, 0, | 638 | 0, 43, 6, 37, 0, 44, 22, 38, 45, 0, |
664 | 123, 68, 0, 58, 0, 18, 19, 0, 124, 67, | 639 | 0, 129, 68, 0, 58, 0, 18, 19, 0, 130, |
665 | 25, 42, 22, 40, 0, 113, 0, 0, 109, 9, | 640 | 67, 25, 42, 127, 0, 125, 22, 40, 0, 113, |
666 | 17, 41, 0, 0, 0, 0, 57, 59, 60, 16, | 641 | 0, 0, 109, 9, 17, 41, 0, 0, 0, 0, |
667 | 0, 66, 125, 101, 121, 71, 0, 7, 112, 106, | 642 | 57, 59, 60, 16, 0, 66, 131, 101, 121, 71, |
668 | 76, 77, 0, 0, 0, 121, 75, 0, 114, 115, | 643 | 0, 0, 123, 0, 7, 112, 106, 76, 77, 0, |
669 | 119, 105, 0, 110, 124, 0, 36, 0, 73, 72, | 644 | 0, 0, 121, 75, 0, 114, 115, 119, 105, 0, |
670 | 61, 20, 102, 0, 93, 0, 84, 87, 88, 118, | 645 | 110, 130, 0, 36, 0, 73, 72, 61, 20, 102, |
646 | 0, 93, 0, 84, 87, 88, 128, 124, 126, 118, | ||
671 | 0, 76, 0, 120, 74, 117, 80, 0, 111, 0, | 647 | 0, 76, 0, 120, 74, 117, 80, 0, 111, 0, |
672 | 35, 126, 122, 0, 21, 103, 70, 94, 56, 0, | 648 | 35, 132, 122, 0, 21, 103, 70, 94, 56, 0, |
673 | 93, 90, 92, 69, 83, 0, 82, 81, 0, 0, | 649 | 93, 90, 92, 69, 83, 0, 82, 81, 0, 0, |
674 | 116, 104, 0, 95, 0, 91, 98, 0, 85, 89, | 650 | 116, 104, 0, 95, 0, 91, 98, 0, 85, 89, |
675 | 79, 78, 100, 99, 0, 0, 97, 96 | 651 | 79, 78, 100, 99, 0, 0, 97, 96 |
@@ -678,46 +654,47 @@ static const yytype_uint8 yydefact[] = | |||
678 | /* YYDEFGOTO[NTERM-NUM]. */ | 654 | /* YYDEFGOTO[NTERM-NUM]. */ |
679 | static const yytype_int16 yydefgoto[] = | 655 | static const yytype_int16 yydefgoto[] = |
680 | { | 656 | { |
681 | -1, 1, 2, 3, 35, 72, 55, 36, 64, 65, | 657 | -1, 1, 2, 3, 35, 76, 56, 36, 65, 66, |
682 | 66, 75, 38, 39, 40, 41, 42, 67, 86, 87, | 658 | 67, 79, 38, 39, 40, 41, 42, 68, 90, 91, |
683 | 43, 114, 69, 105, 106, 125, 126, 127, 128, 151, | 659 | 43, 121, 70, 112, 113, 132, 133, 134, 135, 161, |
684 | 152, 44, 144, 145, 54, 76, 77, 78, 107, 108, | 660 | 162, 44, 154, 155, 55, 80, 81, 82, 114, 115, |
685 | 109, 110, 122, 45, 94, 46 | 661 | 116, 117, 129, 51, 74, 75, 45, 98, 46 |
686 | }; | 662 | }; |
687 | 663 | ||
688 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | 664 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
689 | STATE-NUM. */ | 665 | STATE-NUM. */ |
690 | #define YYPACT_NINF -134 | 666 | #define YYPACT_NINF -135 |
691 | static const yytype_int16 yypact[] = | 667 | static const yytype_int16 yypact[] = |
692 | { | 668 | { |
693 | -134, 16, -134, 312, -134, -134, 20, -134, -134, -134, | 669 | -135, 20, -135, 321, -135, -135, 30, -135, -135, -135, |
694 | -134, -134, -18, -134, -3, -134, -134, -134, -134, -134, | 670 | -135, -135, -28, -135, 2, -135, -135, -135, -135, -135, |
695 | -134, -134, -134, -134, -26, -134, -25, -134, -134, -134, | 671 | -135, -135, -135, -135, -6, -135, 9, -135, -135, -135, |
696 | -7, 5, 27, -134, -134, -134, -134, 46, 482, -134, | 672 | -5, 15, -17, -135, -135, -135, -135, 18, 491, -135, |
697 | -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, | 673 | -135, -135, -135, -135, -135, -135, -135, -135, -135, -22, |
698 | -8, -134, 30, 97, -134, 482, 30, -134, 482, 7, | 674 | 31, -135, -135, 19, 106, -135, 491, 19, -135, 491, |
699 | -134, -134, 12, 10, 42, 55, -134, 46, -15, 15, | 675 | 50, -135, -135, 11, -3, 51, 57, -135, 18, -14, |
700 | -134, -134, 482, -134, 25, 26, 47, 145, -134, -134, | 676 | 14, -135, -135, 48, 46, -135, 491, -135, 33, 32, |
701 | 46, -134, 356, 39, 71, 77, -134, 10, -134, -134, | 677 | 59, 154, -135, -135, 18, -135, 365, 56, 60, 61, |
702 | 46, -134, -134, -134, -134, -134, 193, -134, -134, -134, | 678 | -135, -3, -135, -135, 18, -135, -135, -135, -135, -135, |
703 | 75, -134, 6, 95, 43, -134, 28, 86, 85, -134, | 679 | 202, 74, -135, -23, -135, -135, -135, 77, -135, 16, |
704 | -134, -134, 88, -134, 103, 87, -134, 91, -134, -134, | 680 | 101, 49, -135, 34, 92, 93, -135, -135, -135, 94, |
705 | -134, -134, -23, 90, 401, 94, 101, 102, -134, -134, | 681 | -135, 110, 95, -135, 97, -135, -135, -135, -135, -20, |
706 | 98, -134, 108, -134, -134, 109, -134, 230, -134, 26, | 682 | 96, 410, 99, 113, 100, -135, -135, -135, -135, -135, |
707 | -134, -134, -134, 134, -134, -134, -134, -134, -134, 9, | 683 | 103, -135, 107, -135, -135, 111, -135, 239, -135, 32, |
708 | 48, -134, 35, -134, -134, 445, -134, -134, 125, 126, | 684 | -135, -135, -135, 123, -135, -135, -135, -135, -135, 3, |
709 | -134, -134, 128, -134, 129, -134, -134, 267, -134, -134, | 685 | 52, -135, 38, -135, -135, 454, -135, -135, 117, 128, |
710 | -134, -134, -134, -134, 130, 131, -134, -134 | 686 | -135, -135, 134, -135, 135, -135, -135, 276, -135, -135, |
687 | -135, -135, -135, -135, 137, 138, -135, -135 | ||
711 | }; | 688 | }; |
712 | 689 | ||
713 | /* YYPGOTO[NTERM-NUM]. */ | 690 | /* YYPGOTO[NTERM-NUM]. */ |
714 | static const yytype_int16 yypgoto[] = | 691 | static const yytype_int16 yypgoto[] = |
715 | { | 692 | { |
716 | -134, -134, 180, -134, -134, -134, -134, -33, -134, -134, | 693 | -135, -135, 187, -135, -135, -135, -135, -50, -135, -135, |
717 | 93, 0, -58, -37, -134, -134, -134, -73, -134, -134, | 694 | 98, 0, -59, -37, -135, -135, -135, -77, -135, -135, |
718 | -54, -32, -134, -81, -134, -133, -134, -134, 29, -50, | 695 | -54, -30, -135, -90, -135, -134, -135, -135, 24, -58, |
719 | -134, -134, -134, -134, -20, -134, -134, 110, -134, -134, | 696 | -135, -135, -135, -135, -18, -135, -135, 109, -135, -135, |
720 | 49, 96, 80, -134, -134, -134 | 697 | 44, 87, 84, 148, -135, 102, -135, -135, -135 |
721 | }; | 698 | }; |
722 | 699 | ||
723 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | 700 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
@@ -727,116 +704,118 @@ static const yytype_int16 yypgoto[] = | |||
727 | #define YYTABLE_NINF -109 | 704 | #define YYTABLE_NINF -109 |
728 | static const yytype_int16 yytable[] = | 705 | static const yytype_int16 yytable[] = |
729 | { | 706 | { |
730 | 82, 70, 104, 37, 159, 68, 57, 130, 142, 88, | 707 | 86, 71, 111, 37, 172, 10, 83, 69, 58, 49, |
731 | 162, 52, 56, 84, 49, 92, 4, 93, 10, 50, | 708 | 92, 152, 88, 169, 73, 20, 96, 140, 97, 142, |
732 | 51, 132, 79, 134, 71, 53, 53, 143, 20, 104, | 709 | 4, 144, 137, 50, 29, 52, 104, 61, 33, 50, |
733 | 85, 104, 73, 120, 175, 91, 81, 29, 124, 97, | 710 | 153, 53, 111, 89, 111, 77, -93, 127, 95, 85, |
734 | 58, 33, -93, 131, 83, 70, 147, 101, 95, 61, | 711 | 157, 131, 59, 185, 173, 54, 57, 99, 62, 71, |
735 | 163, 150, 59, 102, 63, 80, 149, 63, -93, 62, | 712 | 159, 64, -93, 141, 160, 62, 84, 108, 63, 64, |
736 | 63, 136, 96, 100, 47, 48, 104, 101, 166, 98, | 713 | 54, 100, 60, 109, 64, 63, 64, 146, 73, 107, |
737 | 99, 60, 80, 102, 63, 137, 150, 150, 103, 124, | 714 | 54, 176, 111, 108, 47, 48, 84, 105, 106, 109, |
738 | 131, 53, 167, 61, 101, 147, 89, 70, 117, 163, | 715 | 64, 147, 160, 160, 110, 177, 141, 87, 131, 157, |
739 | 102, 63, 111, 62, 63, 149, 63, 124, 74, 164, | 716 | 108, 102, 103, 173, 71, 93, 109, 64, 101, 159, |
740 | 165, 90, 7, 8, 9, 10, 11, 12, 13, 124, | 717 | 64, 174, 175, 94, 118, 124, 131, 78, 136, 125, |
741 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | 718 | 126, 7, 8, 9, 10, 11, 12, 13, 131, 15, |
742 | 118, 26, 27, 28, 29, 30, 119, 103, 33, 133, | 719 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 110, |
743 | 138, 139, 98, 92, -22, 141, 140, 154, 34, 146, | 720 | 26, 27, 28, 29, 30, 143, 148, 33, 105, 149, |
744 | 142, -22, -107, 153, -22, -22, 112, 156, 155, -22, | 721 | 96, 151, 152, -22, 150, 156, 165, 34, 163, 164, |
745 | 7, 8, 9, 10, 11, 12, 13, 157, 15, 16, | 722 | -22, -107, 166, -22, -22, 119, 167, 171, -22, 7, |
746 | 17, 18, 19, 20, 21, 22, 23, 24, 161, 26, | 723 | 8, 9, 10, 11, 12, 13, 180, 15, 16, 17, |
747 | 27, 28, 29, 30, 170, 171, 33, 172, 173, 176, | 724 | 18, 19, 20, 21, 22, 23, 24, 181, 26, 27, |
748 | 177, 5, -22, 121, 169, 135, 34, 113, 160, -22, | 725 | 28, 29, 30, 182, 183, 33, 186, 187, 5, 179, |
749 | -108, 0, -22, -22, 123, 0, 129, -22, 7, 8, | 726 | 120, -22, 128, 170, 139, 34, 145, 72, -22, -108, |
750 | 9, 10, 11, 12, 13, 0, 15, 16, 17, 18, | 727 | 0, -22, -22, 130, 0, 138, -22, 7, 8, 9, |
751 | 19, 20, 21, 22, 23, 24, 0, 26, 27, 28, | 728 | 10, 11, 12, 13, 0, 15, 16, 17, 18, 19, |
752 | 29, 30, 0, 0, 33, 0, 0, 0, 0, -86, | 729 | 20, 21, 22, 23, 24, 0, 26, 27, 28, 29, |
753 | 0, 158, 0, 0, 34, 7, 8, 9, 10, 11, | 730 | 30, 0, 0, 33, 0, 0, 0, 0, -86, 0, |
754 | 12, 13, -86, 15, 16, 17, 18, 19, 20, 21, | 731 | 168, 0, 0, 34, 7, 8, 9, 10, 11, 12, |
755 | 22, 23, 24, 0, 26, 27, 28, 29, 30, 0, | 732 | 13, -86, 15, 16, 17, 18, 19, 20, 21, 22, |
756 | 0, 33, 0, 0, 0, 0, -86, 0, 174, 0, | 733 | 23, 24, 0, 26, 27, 28, 29, 30, 0, 0, |
757 | 0, 34, 7, 8, 9, 10, 11, 12, 13, -86, | 734 | 33, 0, 0, 0, 0, -86, 0, 184, 0, 0, |
758 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | 735 | 34, 7, 8, 9, 10, 11, 12, 13, -86, 15, |
759 | 0, 26, 27, 28, 29, 30, 0, 0, 33, 0, | ||
760 | 0, 0, 0, -86, 0, 0, 0, 0, 34, 0, | ||
761 | 0, 0, 0, 6, 0, 0, -86, 7, 8, 9, | ||
762 | 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, | ||
763 | 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, | ||
764 | 30, 31, 32, 33, 0, 0, 0, 0, 0, -22, | ||
765 | 0, 0, 0, 34, 0, 0, -22, 0, 0, -22, | ||
766 | -22, 7, 8, 9, 10, 11, 12, 13, 0, 15, | ||
767 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, | 736 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, |
768 | 26, 27, 28, 29, 30, 0, 0, 33, 0, 0, | 737 | 26, 27, 28, 29, 30, 0, 0, 33, 0, 0, |
769 | 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, | 738 | 0, 0, -86, 0, 0, 0, 0, 34, 0, 0, |
770 | 0, 0, 0, 0, 115, 116, 7, 8, 9, 10, | 739 | 0, 0, 6, 0, 0, -86, 7, 8, 9, 10, |
771 | 11, 12, 13, 0, 15, 16, 17, 18, 19, 20, | 740 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
772 | 21, 22, 23, 24, 0, 26, 27, 28, 29, 30, | 741 | 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, |
773 | 0, 0, 33, 0, 0, 0, 0, 0, 147, 0, | 742 | 31, 32, 33, 0, 0, 0, 0, 0, -22, 0, |
774 | 0, 0, 148, 0, 0, 0, 0, 0, 149, 63, | 743 | 0, 0, 34, 0, 0, -22, 0, 0, -22, -22, |
775 | 7, 8, 9, 10, 11, 12, 13, 0, 15, 16, | 744 | 7, 8, 9, 10, 11, 12, 13, 0, 15, 16, |
776 | 17, 18, 19, 20, 21, 22, 23, 24, 0, 26, | 745 | 17, 18, 19, 20, 21, 22, 23, 24, 0, 26, |
777 | 27, 28, 29, 30, 0, 0, 33, 0, 0, 0, | 746 | 27, 28, 29, 30, 0, 0, 33, 0, 0, 0, |
778 | 0, 168, 0, 0, 0, 0, 34, 7, 8, 9, | 747 | 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, |
779 | 10, 11, 12, 13, 0, 15, 16, 17, 18, 19, | 748 | 0, 0, 0, 122, 123, 7, 8, 9, 10, 11, |
780 | 20, 21, 22, 23, 24, 0, 26, 27, 28, 29, | 749 | 12, 13, 0, 15, 16, 17, 18, 19, 20, 21, |
781 | 30, 0, 0, 33, 0, 0, 0, 0, 0, 0, | 750 | 22, 23, 24, 0, 26, 27, 28, 29, 30, 0, |
782 | 0, 0, 0, 34 | 751 | 0, 33, 0, 0, 0, 0, 0, 157, 0, 0, |
752 | 0, 158, 0, 0, 0, 0, 0, 159, 64, 7, | ||
753 | 8, 9, 10, 11, 12, 13, 0, 15, 16, 17, | ||
754 | 18, 19, 20, 21, 22, 23, 24, 0, 26, 27, | ||
755 | 28, 29, 30, 0, 0, 33, 0, 0, 0, 0, | ||
756 | 178, 0, 0, 0, 0, 34, 7, 8, 9, 10, | ||
757 | 11, 12, 13, 0, 15, 16, 17, 18, 19, 20, | ||
758 | 21, 22, 23, 24, 0, 26, 27, 28, 29, 30, | ||
759 | 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, | ||
760 | 0, 0, 34 | ||
783 | }; | 761 | }; |
784 | 762 | ||
785 | static const yytype_int16 yycheck[] = | 763 | static const yytype_int16 yycheck[] = |
786 | { | 764 | { |
787 | 58, 38, 75, 3, 137, 37, 26, 1, 31, 63, | 765 | 59, 38, 79, 3, 1, 8, 56, 37, 26, 37, |
788 | 1, 37, 37, 1, 32, 30, 0, 32, 8, 37, | 766 | 64, 31, 1, 147, 37, 18, 30, 1, 32, 109, |
789 | 23, 102, 55, 104, 32, 51, 51, 50, 18, 102, | 767 | 0, 111, 45, 51, 27, 23, 76, 44, 31, 51, |
790 | 62, 104, 52, 87, 167, 67, 56, 27, 96, 72, | 768 | 50, 37, 109, 63, 111, 53, 33, 91, 68, 57, |
791 | 47, 31, 33, 37, 37, 82, 37, 41, 33, 37, | 769 | 37, 100, 47, 177, 41, 51, 37, 33, 37, 86, |
792 | 41, 124, 47, 47, 48, 55, 47, 48, 49, 47, | 770 | 47, 48, 49, 37, 131, 37, 56, 41, 47, 48, |
793 | 48, 33, 47, 37, 44, 45, 139, 41, 33, 44, | 771 | 51, 47, 47, 47, 48, 47, 48, 33, 37, 37, |
794 | 45, 44, 72, 47, 48, 47, 149, 150, 52, 137, | 772 | 51, 33, 149, 41, 44, 45, 76, 44, 45, 47, |
795 | 37, 51, 47, 37, 41, 37, 44, 124, 49, 41, | 773 | 48, 47, 159, 160, 52, 47, 37, 37, 147, 37, |
796 | 47, 48, 45, 47, 48, 47, 48, 155, 1, 149, | 774 | 41, 45, 46, 41, 131, 44, 47, 48, 50, 47, |
797 | 150, 46, 5, 6, 7, 8, 9, 10, 11, 167, | 775 | 48, 159, 160, 46, 45, 49, 165, 1, 34, 49, |
798 | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, | 776 | 49, 5, 6, 7, 8, 9, 10, 11, 177, 13, |
799 | 49, 24, 25, 26, 27, 28, 49, 52, 31, 34, | 777 | 14, 15, 16, 17, 18, 19, 20, 21, 22, 52, |
800 | 44, 46, 44, 30, 37, 44, 49, 36, 41, 49, | 778 | 24, 25, 26, 27, 28, 34, 44, 31, 44, 46, |
801 | 31, 44, 45, 49, 47, 48, 1, 49, 46, 52, | 779 | 30, 44, 31, 37, 49, 49, 46, 41, 49, 36, |
802 | 5, 6, 7, 8, 9, 10, 11, 49, 13, 14, | 780 | 44, 45, 49, 47, 48, 1, 49, 34, 52, 5, |
803 | 15, 16, 17, 18, 19, 20, 21, 22, 34, 24, | 781 | 6, 7, 8, 9, 10, 11, 49, 13, 14, 15, |
804 | 25, 26, 27, 28, 49, 49, 31, 49, 49, 49, | 782 | 16, 17, 18, 19, 20, 21, 22, 49, 24, 25, |
805 | 49, 1, 37, 90, 155, 105, 41, 77, 139, 44, | 783 | 26, 27, 28, 49, 49, 31, 49, 49, 1, 165, |
806 | 45, -1, 47, 48, 1, -1, 100, 52, 5, 6, | 784 | 81, 37, 94, 149, 107, 41, 112, 49, 44, 45, |
807 | 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, | 785 | -1, 47, 48, 1, -1, 103, 52, 5, 6, 7, |
808 | 17, 18, 19, 20, 21, 22, -1, 24, 25, 26, | 786 | 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, |
809 | 27, 28, -1, -1, 31, -1, -1, -1, -1, 36, | 787 | 18, 19, 20, 21, 22, -1, 24, 25, 26, 27, |
810 | -1, 1, -1, -1, 41, 5, 6, 7, 8, 9, | 788 | 28, -1, -1, 31, -1, -1, -1, -1, 36, -1, |
811 | 10, 11, 49, 13, 14, 15, 16, 17, 18, 19, | 789 | 1, -1, -1, 41, 5, 6, 7, 8, 9, 10, |
812 | 20, 21, 22, -1, 24, 25, 26, 27, 28, -1, | 790 | 11, 49, 13, 14, 15, 16, 17, 18, 19, 20, |
813 | -1, 31, -1, -1, -1, -1, 36, -1, 1, -1, | 791 | 21, 22, -1, 24, 25, 26, 27, 28, -1, -1, |
814 | -1, 41, 5, 6, 7, 8, 9, 10, 11, 49, | 792 | 31, -1, -1, -1, -1, 36, -1, 1, -1, -1, |
815 | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, | 793 | 41, 5, 6, 7, 8, 9, 10, 11, 49, 13, |
816 | -1, 24, 25, 26, 27, 28, -1, -1, 31, -1, | ||
817 | -1, -1, -1, 36, -1, -1, -1, -1, 41, -1, | ||
818 | -1, -1, -1, 1, -1, -1, 49, 5, 6, 7, | ||
819 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, | ||
820 | 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, | ||
821 | 28, 29, 30, 31, -1, -1, -1, -1, -1, 37, | ||
822 | -1, -1, -1, 41, -1, -1, 44, -1, -1, 47, | ||
823 | 48, 5, 6, 7, 8, 9, 10, 11, -1, 13, | ||
824 | 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, | 794 | 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, |
825 | 24, 25, 26, 27, 28, -1, -1, 31, -1, -1, | 795 | 24, 25, 26, 27, 28, -1, -1, 31, -1, -1, |
826 | -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, | 796 | -1, -1, 36, -1, -1, -1, -1, 41, -1, -1, |
827 | -1, -1, -1, -1, 48, 49, 5, 6, 7, 8, | 797 | -1, -1, 1, -1, -1, 49, 5, 6, 7, 8, |
828 | 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, | 798 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, |
829 | 19, 20, 21, 22, -1, 24, 25, 26, 27, 28, | 799 | 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, |
830 | -1, -1, 31, -1, -1, -1, -1, -1, 37, -1, | 800 | 29, 30, 31, -1, -1, -1, -1, -1, 37, -1, |
831 | -1, -1, 41, -1, -1, -1, -1, -1, 47, 48, | 801 | -1, -1, 41, -1, -1, 44, -1, -1, 47, 48, |
832 | 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, | 802 | 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, |
833 | 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, | 803 | 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, |
834 | 25, 26, 27, 28, -1, -1, 31, -1, -1, -1, | 804 | 25, 26, 27, 28, -1, -1, 31, -1, -1, -1, |
835 | -1, 36, -1, -1, -1, -1, 41, 5, 6, 7, | 805 | -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, |
836 | 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, | 806 | -1, -1, -1, 48, 49, 5, 6, 7, 8, 9, |
837 | 18, 19, 20, 21, 22, -1, 24, 25, 26, 27, | 807 | 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, |
838 | 28, -1, -1, 31, -1, -1, -1, -1, -1, -1, | 808 | 20, 21, 22, -1, 24, 25, 26, 27, 28, -1, |
839 | -1, -1, -1, 41 | 809 | -1, 31, -1, -1, -1, -1, -1, 37, -1, -1, |
810 | -1, 41, -1, -1, -1, -1, -1, 47, 48, 5, | ||
811 | 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, | ||
812 | 16, 17, 18, 19, 20, 21, 22, -1, 24, 25, | ||
813 | 26, 27, 28, -1, -1, 31, -1, -1, -1, -1, | ||
814 | 36, -1, -1, -1, -1, 41, 5, 6, 7, 8, | ||
815 | 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, | ||
816 | 19, 20, 21, 22, -1, 24, 25, 26, 27, 28, | ||
817 | -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, | ||
818 | -1, -1, 41 | ||
840 | }; | 819 | }; |
841 | 820 | ||
842 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | 821 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
@@ -847,15 +826,16 @@ static const yytype_uint8 yystos[] = | |||
847 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, | 826 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, |
848 | 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, | 827 | 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, |
849 | 28, 29, 30, 31, 41, 57, 60, 64, 65, 66, | 828 | 28, 29, 30, 31, 41, 57, 60, 64, 65, 66, |
850 | 67, 68, 69, 73, 84, 96, 98, 44, 45, 32, | 829 | 67, 68, 69, 73, 84, 99, 101, 44, 45, 37, |
851 | 37, 23, 37, 51, 87, 59, 37, 87, 47, 47, | 830 | 51, 96, 23, 37, 51, 87, 59, 37, 87, 47, |
852 | 44, 37, 47, 48, 61, 62, 63, 70, 74, 75, | 831 | 47, 44, 37, 47, 48, 61, 62, 63, 70, 74, |
853 | 66, 32, 58, 87, 1, 64, 88, 89, 90, 60, | 832 | 75, 66, 96, 37, 97, 98, 58, 87, 1, 64, |
854 | 64, 87, 65, 37, 1, 74, 71, 72, 73, 44, | 833 | 88, 89, 90, 60, 64, 87, 65, 37, 1, 74, |
855 | 46, 74, 30, 32, 97, 33, 47, 60, 44, 45, | 834 | 71, 72, 73, 44, 46, 74, 30, 32, 100, 33, |
856 | 37, 41, 47, 52, 70, 76, 77, 91, 92, 93, | 835 | 47, 50, 45, 46, 60, 44, 45, 37, 41, 47, |
857 | 94, 45, 1, 90, 74, 48, 49, 49, 49, 49, | 836 | 52, 70, 76, 77, 91, 92, 93, 94, 45, 1, |
858 | 73, 63, 95, 1, 65, 78, 79, 80, 81, 94, | 837 | 90, 74, 48, 49, 49, 49, 49, 73, 63, 95, |
838 | 1, 65, 78, 79, 80, 81, 34, 45, 98, 94, | ||
859 | 1, 37, 76, 34, 76, 95, 33, 47, 44, 46, | 839 | 1, 37, 76, 34, 76, 95, 33, 47, 44, 46, |
860 | 49, 44, 31, 50, 85, 86, 49, 37, 41, 47, | 840 | 49, 44, 31, 50, 85, 86, 49, 37, 41, 47, |
861 | 70, 82, 83, 49, 36, 46, 49, 49, 1, 78, | 841 | 70, 82, 83, 49, 36, 46, 49, 49, 1, 78, |
@@ -1045,17 +1025,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) | |||
1045 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 1025 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
1046 | || defined __cplusplus || defined _MSC_VER) | 1026 | || defined __cplusplus || defined _MSC_VER) |
1047 | static void | 1027 | static void |
1048 | yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) | 1028 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) |
1049 | #else | 1029 | #else |
1050 | static void | 1030 | static void |
1051 | yy_stack_print (bottom, top) | 1031 | yy_stack_print (yybottom, yytop) |
1052 | yytype_int16 *bottom; | 1032 | yytype_int16 *yybottom; |
1053 | yytype_int16 *top; | 1033 | yytype_int16 *yytop; |
1054 | #endif | 1034 | #endif |
1055 | { | 1035 | { |
1056 | YYFPRINTF (stderr, "Stack now"); | 1036 | YYFPRINTF (stderr, "Stack now"); |
1057 | for (; bottom <= top; ++bottom) | 1037 | for (; yybottom <= yytop; yybottom++) |
1058 | YYFPRINTF (stderr, " %d", *bottom); | 1038 | { |
1039 | int yybot = *yybottom; | ||
1040 | YYFPRINTF (stderr, " %d", yybot); | ||
1041 | } | ||
1059 | YYFPRINTF (stderr, "\n"); | 1042 | YYFPRINTF (stderr, "\n"); |
1060 | } | 1043 | } |
1061 | 1044 | ||
@@ -1089,11 +1072,11 @@ yy_reduce_print (yyvsp, yyrule) | |||
1089 | /* The symbols being reduced. */ | 1072 | /* The symbols being reduced. */ |
1090 | for (yyi = 0; yyi < yynrhs; yyi++) | 1073 | for (yyi = 0; yyi < yynrhs; yyi++) |
1091 | { | 1074 | { |
1092 | fprintf (stderr, " $%d = ", yyi + 1); | 1075 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
1093 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], | 1076 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], |
1094 | &(yyvsp[(yyi + 1) - (yynrhs)]) | 1077 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
1095 | ); | 1078 | ); |
1096 | fprintf (stderr, "\n"); | 1079 | YYFPRINTF (stderr, "\n"); |
1097 | } | 1080 | } |
1098 | } | 1081 | } |
1099 | 1082 | ||
@@ -1373,10 +1356,8 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1373 | break; | 1356 | break; |
1374 | } | 1357 | } |
1375 | } | 1358 | } |
1376 | |||
1377 | 1359 | ||
1378 | /* Prevent warnings from -Wmissing-prototypes. */ | 1360 | /* Prevent warnings from -Wmissing-prototypes. */ |
1379 | |||
1380 | #ifdef YYPARSE_PARAM | 1361 | #ifdef YYPARSE_PARAM |
1381 | #if defined __STDC__ || defined __cplusplus | 1362 | #if defined __STDC__ || defined __cplusplus |
1382 | int yyparse (void *YYPARSE_PARAM); | 1363 | int yyparse (void *YYPARSE_PARAM); |
@@ -1392,11 +1373,10 @@ int yyparse (); | |||
1392 | #endif /* ! YYPARSE_PARAM */ | 1373 | #endif /* ! YYPARSE_PARAM */ |
1393 | 1374 | ||
1394 | 1375 | ||
1395 | 1376 | /* The lookahead symbol. */ | |
1396 | /* The look-ahead symbol. */ | ||
1397 | int yychar; | 1377 | int yychar; |
1398 | 1378 | ||
1399 | /* The semantic value of the look-ahead symbol. */ | 1379 | /* The semantic value of the lookahead symbol. */ |
1400 | YYSTYPE yylval; | 1380 | YYSTYPE yylval; |
1401 | 1381 | ||
1402 | /* Number of syntax errors so far. */ | 1382 | /* Number of syntax errors so far. */ |
@@ -1404,9 +1384,9 @@ int yynerrs; | |||
1404 | 1384 | ||
1405 | 1385 | ||
1406 | 1386 | ||
1407 | /*----------. | 1387 | /*-------------------------. |
1408 | | yyparse. | | 1388 | | yyparse or yypush_parse. | |
1409 | `----------*/ | 1389 | `-------------------------*/ |
1410 | 1390 | ||
1411 | #ifdef YYPARSE_PARAM | 1391 | #ifdef YYPARSE_PARAM |
1412 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 1392 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
@@ -1430,66 +1410,68 @@ yyparse () | |||
1430 | #endif | 1410 | #endif |
1431 | #endif | 1411 | #endif |
1432 | { | 1412 | { |
1433 | |||
1434 | int yystate; | ||
1435 | int yyn; | ||
1436 | int yyresult; | ||
1437 | /* Number of tokens to shift before error messages enabled. */ | ||
1438 | int yyerrstatus; | ||
1439 | /* Look-ahead token as an internal (translated) token number. */ | ||
1440 | int yytoken = 0; | ||
1441 | #if YYERROR_VERBOSE | ||
1442 | /* Buffer for error messages, and its allocated size. */ | ||
1443 | char yymsgbuf[128]; | ||
1444 | char *yymsg = yymsgbuf; | ||
1445 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | ||
1446 | #endif | ||
1447 | 1413 | ||
1448 | /* Three stacks and their tools: | ||
1449 | `yyss': related to states, | ||
1450 | `yyvs': related to semantic values, | ||
1451 | `yyls': related to locations. | ||
1452 | 1414 | ||
1453 | Refer to the stacks thru separate pointers, to allow yyoverflow | 1415 | int yystate; |
1454 | to reallocate them elsewhere. */ | 1416 | /* Number of tokens to shift before error messages enabled. */ |
1417 | int yyerrstatus; | ||
1455 | 1418 | ||
1456 | /* The state stack. */ | 1419 | /* The stacks and their tools: |
1457 | yytype_int16 yyssa[YYINITDEPTH]; | 1420 | `yyss': related to states. |
1458 | yytype_int16 *yyss = yyssa; | 1421 | `yyvs': related to semantic values. |
1459 | yytype_int16 *yyssp; | ||
1460 | 1422 | ||
1461 | /* The semantic value stack. */ | 1423 | Refer to the stacks thru separate pointers, to allow yyoverflow |
1462 | YYSTYPE yyvsa[YYINITDEPTH]; | 1424 | to reallocate them elsewhere. */ |
1463 | YYSTYPE *yyvs = yyvsa; | ||
1464 | YYSTYPE *yyvsp; | ||
1465 | 1425 | ||
1426 | /* The state stack. */ | ||
1427 | yytype_int16 yyssa[YYINITDEPTH]; | ||
1428 | yytype_int16 *yyss; | ||
1429 | yytype_int16 *yyssp; | ||
1466 | 1430 | ||
1431 | /* The semantic value stack. */ | ||
1432 | YYSTYPE yyvsa[YYINITDEPTH]; | ||
1433 | YYSTYPE *yyvs; | ||
1434 | YYSTYPE *yyvsp; | ||
1467 | 1435 | ||
1468 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) | 1436 | YYSIZE_T yystacksize; |
1469 | |||
1470 | YYSIZE_T yystacksize = YYINITDEPTH; | ||
1471 | 1437 | ||
1438 | int yyn; | ||
1439 | int yyresult; | ||
1440 | /* Lookahead token as an internal (translated) token number. */ | ||
1441 | int yytoken; | ||
1472 | /* The variables used to return semantic value and location from the | 1442 | /* The variables used to return semantic value and location from the |
1473 | action routines. */ | 1443 | action routines. */ |
1474 | YYSTYPE yyval; | 1444 | YYSTYPE yyval; |
1475 | 1445 | ||
1446 | #if YYERROR_VERBOSE | ||
1447 | /* Buffer for error messages, and its allocated size. */ | ||
1448 | char yymsgbuf[128]; | ||
1449 | char *yymsg = yymsgbuf; | ||
1450 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | ||
1451 | #endif | ||
1452 | |||
1453 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) | ||
1476 | 1454 | ||
1477 | /* The number of symbols on the RHS of the reduced rule. | 1455 | /* The number of symbols on the RHS of the reduced rule. |
1478 | Keep to zero when no symbol should be popped. */ | 1456 | Keep to zero when no symbol should be popped. */ |
1479 | int yylen = 0; | 1457 | int yylen = 0; |
1480 | 1458 | ||
1459 | yytoken = 0; | ||
1460 | yyss = yyssa; | ||
1461 | yyvs = yyvsa; | ||
1462 | yystacksize = YYINITDEPTH; | ||
1463 | |||
1481 | YYDPRINTF ((stderr, "Starting parse\n")); | 1464 | YYDPRINTF ((stderr, "Starting parse\n")); |
1482 | 1465 | ||
1483 | yystate = 0; | 1466 | yystate = 0; |
1484 | yyerrstatus = 0; | 1467 | yyerrstatus = 0; |
1485 | yynerrs = 0; | 1468 | yynerrs = 0; |
1486 | yychar = YYEMPTY; /* Cause a token to be read. */ | 1469 | yychar = YYEMPTY; /* Cause a token to be read. */ |
1487 | 1470 | ||
1488 | /* Initialize stack pointers. | 1471 | /* Initialize stack pointers. |
1489 | Waste one element of value and location stack | 1472 | Waste one element of value and location stack |
1490 | so that they stay on the same level as the state stack. | 1473 | so that they stay on the same level as the state stack. |
1491 | The wasted elements are never initialized. */ | 1474 | The wasted elements are never initialized. */ |
1492 | |||
1493 | yyssp = yyss; | 1475 | yyssp = yyss; |
1494 | yyvsp = yyvs; | 1476 | yyvsp = yyvs; |
1495 | 1477 | ||
@@ -1519,7 +1501,6 @@ yyparse () | |||
1519 | YYSTYPE *yyvs1 = yyvs; | 1501 | YYSTYPE *yyvs1 = yyvs; |
1520 | yytype_int16 *yyss1 = yyss; | 1502 | yytype_int16 *yyss1 = yyss; |
1521 | 1503 | ||
1522 | |||
1523 | /* Each stack pointer address is followed by the size of the | 1504 | /* Each stack pointer address is followed by the size of the |
1524 | data in use in that stack, in bytes. This used to be a | 1505 | data in use in that stack, in bytes. This used to be a |
1525 | conditional around just the two extra args, but that might | 1506 | conditional around just the two extra args, but that might |
@@ -1527,7 +1508,6 @@ yyparse () | |||
1527 | yyoverflow (YY_("memory exhausted"), | 1508 | yyoverflow (YY_("memory exhausted"), |
1528 | &yyss1, yysize * sizeof (*yyssp), | 1509 | &yyss1, yysize * sizeof (*yyssp), |
1529 | &yyvs1, yysize * sizeof (*yyvsp), | 1510 | &yyvs1, yysize * sizeof (*yyvsp), |
1530 | |||
1531 | &yystacksize); | 1511 | &yystacksize); |
1532 | 1512 | ||
1533 | yyss = yyss1; | 1513 | yyss = yyss1; |
@@ -1550,9 +1530,8 @@ yyparse () | |||
1550 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | 1530 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
1551 | if (! yyptr) | 1531 | if (! yyptr) |
1552 | goto yyexhaustedlab; | 1532 | goto yyexhaustedlab; |
1553 | YYSTACK_RELOCATE (yyss); | 1533 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
1554 | YYSTACK_RELOCATE (yyvs); | 1534 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
1555 | |||
1556 | # undef YYSTACK_RELOCATE | 1535 | # undef YYSTACK_RELOCATE |
1557 | if (yyss1 != yyssa) | 1536 | if (yyss1 != yyssa) |
1558 | YYSTACK_FREE (yyss1); | 1537 | YYSTACK_FREE (yyss1); |
@@ -1563,7 +1542,6 @@ yyparse () | |||
1563 | yyssp = yyss + yysize - 1; | 1542 | yyssp = yyss + yysize - 1; |
1564 | yyvsp = yyvs + yysize - 1; | 1543 | yyvsp = yyvs + yysize - 1; |
1565 | 1544 | ||
1566 | |||
1567 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | 1545 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
1568 | (unsigned long int) yystacksize)); | 1546 | (unsigned long int) yystacksize)); |
1569 | 1547 | ||
@@ -1573,6 +1551,9 @@ yyparse () | |||
1573 | 1551 | ||
1574 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | 1552 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
1575 | 1553 | ||
1554 | if (yystate == YYFINAL) | ||
1555 | YYACCEPT; | ||
1556 | |||
1576 | goto yybackup; | 1557 | goto yybackup; |
1577 | 1558 | ||
1578 | /*-----------. | 1559 | /*-----------. |
@@ -1581,16 +1562,16 @@ yyparse () | |||
1581 | yybackup: | 1562 | yybackup: |
1582 | 1563 | ||
1583 | /* Do appropriate processing given the current state. Read a | 1564 | /* Do appropriate processing given the current state. Read a |
1584 | look-ahead token if we need one and don't already have one. */ | 1565 | lookahead token if we need one and don't already have one. */ |
1585 | 1566 | ||
1586 | /* First try to decide what to do without reference to look-ahead token. */ | 1567 | /* First try to decide what to do without reference to lookahead token. */ |
1587 | yyn = yypact[yystate]; | 1568 | yyn = yypact[yystate]; |
1588 | if (yyn == YYPACT_NINF) | 1569 | if (yyn == YYPACT_NINF) |
1589 | goto yydefault; | 1570 | goto yydefault; |
1590 | 1571 | ||
1591 | /* Not known => get a look-ahead token if don't already have one. */ | 1572 | /* Not known => get a lookahead token if don't already have one. */ |
1592 | 1573 | ||
1593 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ | 1574 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
1594 | if (yychar == YYEMPTY) | 1575 | if (yychar == YYEMPTY) |
1595 | { | 1576 | { |
1596 | YYDPRINTF ((stderr, "Reading a token: ")); | 1577 | YYDPRINTF ((stderr, "Reading a token: ")); |
@@ -1622,20 +1603,16 @@ yybackup: | |||
1622 | goto yyreduce; | 1603 | goto yyreduce; |
1623 | } | 1604 | } |
1624 | 1605 | ||
1625 | if (yyn == YYFINAL) | ||
1626 | YYACCEPT; | ||
1627 | |||
1628 | /* Count tokens shifted since error; after three, turn off error | 1606 | /* Count tokens shifted since error; after three, turn off error |
1629 | status. */ | 1607 | status. */ |
1630 | if (yyerrstatus) | 1608 | if (yyerrstatus) |
1631 | yyerrstatus--; | 1609 | yyerrstatus--; |
1632 | 1610 | ||
1633 | /* Shift the look-ahead token. */ | 1611 | /* Shift the lookahead token. */ |
1634 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); | 1612 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
1635 | 1613 | ||
1636 | /* Discard the shifted token unless it is eof. */ | 1614 | /* Discard the shifted token. */ |
1637 | if (yychar != YYEOF) | 1615 | yychar = YYEMPTY; |
1638 | yychar = YYEMPTY; | ||
1639 | 1616 | ||
1640 | yystate = yyn; | 1617 | yystate = yyn; |
1641 | *++yyvsp = yylval; | 1618 | *++yyvsp = yylval; |
@@ -1675,47 +1652,65 @@ yyreduce: | |||
1675 | switch (yyn) | 1652 | switch (yyn) |
1676 | { | 1653 | { |
1677 | case 4: | 1654 | case 4: |
1678 | #line 108 "scripts/genksyms/parse.y" | 1655 | |
1656 | /* Line 1455 of yacc.c */ | ||
1657 | #line 109 "scripts/genksyms/parse.y" | ||
1679 | { is_typedef = 0; is_extern = 0; current_name = NULL; decl_spec = NULL; ;} | 1658 | { is_typedef = 0; is_extern = 0; current_name = NULL; decl_spec = NULL; ;} |
1680 | break; | 1659 | break; |
1681 | 1660 | ||
1682 | case 5: | 1661 | case 5: |
1683 | #line 110 "scripts/genksyms/parse.y" | 1662 | |
1663 | /* Line 1455 of yacc.c */ | ||
1664 | #line 111 "scripts/genksyms/parse.y" | ||
1684 | { free_list(*(yyvsp[(2) - (2)]), NULL); *(yyvsp[(2) - (2)]) = NULL; ;} | 1665 | { free_list(*(yyvsp[(2) - (2)]), NULL); *(yyvsp[(2) - (2)]) = NULL; ;} |
1685 | break; | 1666 | break; |
1686 | 1667 | ||
1687 | case 6: | 1668 | case 6: |
1688 | #line 114 "scripts/genksyms/parse.y" | 1669 | |
1670 | /* Line 1455 of yacc.c */ | ||
1671 | #line 115 "scripts/genksyms/parse.y" | ||
1689 | { is_typedef = 1; ;} | 1672 | { is_typedef = 1; ;} |
1690 | break; | 1673 | break; |
1691 | 1674 | ||
1692 | case 7: | 1675 | case 7: |
1693 | #line 115 "scripts/genksyms/parse.y" | 1676 | |
1677 | /* Line 1455 of yacc.c */ | ||
1678 | #line 116 "scripts/genksyms/parse.y" | ||
1694 | { (yyval) = (yyvsp[(4) - (4)]); ;} | 1679 | { (yyval) = (yyvsp[(4) - (4)]); ;} |
1695 | break; | 1680 | break; |
1696 | 1681 | ||
1697 | case 8: | 1682 | case 8: |
1698 | #line 116 "scripts/genksyms/parse.y" | 1683 | |
1684 | /* Line 1455 of yacc.c */ | ||
1685 | #line 117 "scripts/genksyms/parse.y" | ||
1699 | { is_typedef = 1; ;} | 1686 | { is_typedef = 1; ;} |
1700 | break; | 1687 | break; |
1701 | 1688 | ||
1702 | case 9: | 1689 | case 9: |
1703 | #line 117 "scripts/genksyms/parse.y" | 1690 | |
1691 | /* Line 1455 of yacc.c */ | ||
1692 | #line 118 "scripts/genksyms/parse.y" | ||
1704 | { (yyval) = (yyvsp[(3) - (3)]); ;} | 1693 | { (yyval) = (yyvsp[(3) - (3)]); ;} |
1705 | break; | 1694 | break; |
1706 | 1695 | ||
1707 | case 14: | 1696 | case 14: |
1708 | #line 122 "scripts/genksyms/parse.y" | 1697 | |
1698 | /* Line 1455 of yacc.c */ | ||
1699 | #line 123 "scripts/genksyms/parse.y" | ||
1709 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 1700 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
1710 | break; | 1701 | break; |
1711 | 1702 | ||
1712 | case 15: | 1703 | case 15: |
1713 | #line 123 "scripts/genksyms/parse.y" | 1704 | |
1705 | /* Line 1455 of yacc.c */ | ||
1706 | #line 124 "scripts/genksyms/parse.y" | ||
1714 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 1707 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
1715 | break; | 1708 | break; |
1716 | 1709 | ||
1717 | case 16: | 1710 | case 16: |
1718 | #line 128 "scripts/genksyms/parse.y" | 1711 | |
1712 | /* Line 1455 of yacc.c */ | ||
1713 | #line 129 "scripts/genksyms/parse.y" | ||
1719 | { if (current_name) { | 1714 | { if (current_name) { |
1720 | struct string_list *decl = (*(yyvsp[(3) - (3)]))->next; | 1715 | struct string_list *decl = (*(yyvsp[(3) - (3)]))->next; |
1721 | (*(yyvsp[(3) - (3)]))->next = NULL; | 1716 | (*(yyvsp[(3) - (3)]))->next = NULL; |
@@ -1729,12 +1724,16 @@ yyreduce: | |||
1729 | break; | 1724 | break; |
1730 | 1725 | ||
1731 | case 17: | 1726 | case 17: |
1732 | #line 141 "scripts/genksyms/parse.y" | 1727 | |
1728 | /* Line 1455 of yacc.c */ | ||
1729 | #line 142 "scripts/genksyms/parse.y" | ||
1733 | { (yyval) = NULL; ;} | 1730 | { (yyval) = NULL; ;} |
1734 | break; | 1731 | break; |
1735 | 1732 | ||
1736 | case 19: | 1733 | case 19: |
1737 | #line 147 "scripts/genksyms/parse.y" | 1734 | |
1735 | /* Line 1455 of yacc.c */ | ||
1736 | #line 148 "scripts/genksyms/parse.y" | ||
1738 | { struct string_list *decl = *(yyvsp[(1) - (1)]); | 1737 | { struct string_list *decl = *(yyvsp[(1) - (1)]); |
1739 | *(yyvsp[(1) - (1)]) = NULL; | 1738 | *(yyvsp[(1) - (1)]) = NULL; |
1740 | add_symbol(current_name, | 1739 | add_symbol(current_name, |
@@ -1745,7 +1744,9 @@ yyreduce: | |||
1745 | break; | 1744 | break; |
1746 | 1745 | ||
1747 | case 20: | 1746 | case 20: |
1748 | #line 155 "scripts/genksyms/parse.y" | 1747 | |
1748 | /* Line 1455 of yacc.c */ | ||
1749 | #line 156 "scripts/genksyms/parse.y" | ||
1749 | { struct string_list *decl = *(yyvsp[(3) - (3)]); | 1750 | { struct string_list *decl = *(yyvsp[(3) - (3)]); |
1750 | *(yyvsp[(3) - (3)]) = NULL; | 1751 | *(yyvsp[(3) - (3)]) = NULL; |
1751 | free_list(*(yyvsp[(2) - (3)]), NULL); | 1752 | free_list(*(yyvsp[(2) - (3)]), NULL); |
@@ -1758,27 +1759,37 @@ yyreduce: | |||
1758 | break; | 1759 | break; |
1759 | 1760 | ||
1760 | case 21: | 1761 | case 21: |
1761 | #line 168 "scripts/genksyms/parse.y" | 1762 | |
1763 | /* Line 1455 of yacc.c */ | ||
1764 | #line 169 "scripts/genksyms/parse.y" | ||
1762 | { (yyval) = (yyvsp[(4) - (4)]) ? (yyvsp[(4) - (4)]) : (yyvsp[(3) - (4)]) ? (yyvsp[(3) - (4)]) : (yyvsp[(2) - (4)]) ? (yyvsp[(2) - (4)]) : (yyvsp[(1) - (4)]); ;} | 1765 | { (yyval) = (yyvsp[(4) - (4)]) ? (yyvsp[(4) - (4)]) : (yyvsp[(3) - (4)]) ? (yyvsp[(3) - (4)]) : (yyvsp[(2) - (4)]) ? (yyvsp[(2) - (4)]) : (yyvsp[(1) - (4)]); ;} |
1763 | break; | 1766 | break; |
1764 | 1767 | ||
1765 | case 22: | 1768 | case 22: |
1766 | #line 173 "scripts/genksyms/parse.y" | 1769 | |
1770 | /* Line 1455 of yacc.c */ | ||
1771 | #line 174 "scripts/genksyms/parse.y" | ||
1767 | { decl_spec = NULL; ;} | 1772 | { decl_spec = NULL; ;} |
1768 | break; | 1773 | break; |
1769 | 1774 | ||
1770 | case 24: | 1775 | case 24: |
1771 | #line 178 "scripts/genksyms/parse.y" | 1776 | |
1777 | /* Line 1455 of yacc.c */ | ||
1778 | #line 179 "scripts/genksyms/parse.y" | ||
1772 | { decl_spec = *(yyvsp[(1) - (1)]); ;} | 1779 | { decl_spec = *(yyvsp[(1) - (1)]); ;} |
1773 | break; | 1780 | break; |
1774 | 1781 | ||
1775 | case 25: | 1782 | case 25: |
1776 | #line 179 "scripts/genksyms/parse.y" | 1783 | |
1784 | /* Line 1455 of yacc.c */ | ||
1785 | #line 180 "scripts/genksyms/parse.y" | ||
1777 | { decl_spec = *(yyvsp[(2) - (2)]); ;} | 1786 | { decl_spec = *(yyvsp[(2) - (2)]); ;} |
1778 | break; | 1787 | break; |
1779 | 1788 | ||
1780 | case 26: | 1789 | case 26: |
1781 | #line 184 "scripts/genksyms/parse.y" | 1790 | |
1791 | /* Line 1455 of yacc.c */ | ||
1792 | #line 185 "scripts/genksyms/parse.y" | ||
1782 | { /* Version 2 checksumming ignores storage class, as that | 1793 | { /* Version 2 checksumming ignores storage class, as that |
1783 | is really irrelevant to the linkage. */ | 1794 | is really irrelevant to the linkage. */ |
1784 | remove_node((yyvsp[(1) - (1)])); | 1795 | remove_node((yyvsp[(1) - (1)])); |
@@ -1787,32 +1798,44 @@ yyreduce: | |||
1787 | break; | 1798 | break; |
1788 | 1799 | ||
1789 | case 31: | 1800 | case 31: |
1790 | #line 196 "scripts/genksyms/parse.y" | 1801 | |
1802 | /* Line 1455 of yacc.c */ | ||
1803 | #line 197 "scripts/genksyms/parse.y" | ||
1791 | { is_extern = 1; (yyval) = (yyvsp[(1) - (1)]); ;} | 1804 | { is_extern = 1; (yyval) = (yyvsp[(1) - (1)]); ;} |
1792 | break; | 1805 | break; |
1793 | 1806 | ||
1794 | case 32: | 1807 | case 32: |
1795 | #line 197 "scripts/genksyms/parse.y" | 1808 | |
1809 | /* Line 1455 of yacc.c */ | ||
1810 | #line 198 "scripts/genksyms/parse.y" | ||
1796 | { is_extern = 0; (yyval) = (yyvsp[(1) - (1)]); ;} | 1811 | { is_extern = 0; (yyval) = (yyvsp[(1) - (1)]); ;} |
1797 | break; | 1812 | break; |
1798 | 1813 | ||
1799 | case 37: | 1814 | case 37: |
1800 | #line 209 "scripts/genksyms/parse.y" | 1815 | |
1816 | /* Line 1455 of yacc.c */ | ||
1817 | #line 210 "scripts/genksyms/parse.y" | ||
1801 | { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_STRUCT; (yyval) = (yyvsp[(2) - (2)]); ;} | 1818 | { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_STRUCT; (yyval) = (yyvsp[(2) - (2)]); ;} |
1802 | break; | 1819 | break; |
1803 | 1820 | ||
1804 | case 38: | 1821 | case 38: |
1805 | #line 211 "scripts/genksyms/parse.y" | 1822 | |
1823 | /* Line 1455 of yacc.c */ | ||
1824 | #line 212 "scripts/genksyms/parse.y" | ||
1806 | { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_UNION; (yyval) = (yyvsp[(2) - (2)]); ;} | 1825 | { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_UNION; (yyval) = (yyvsp[(2) - (2)]); ;} |
1807 | break; | 1826 | break; |
1808 | 1827 | ||
1809 | case 39: | 1828 | case 39: |
1810 | #line 213 "scripts/genksyms/parse.y" | 1829 | |
1830 | /* Line 1455 of yacc.c */ | ||
1831 | #line 214 "scripts/genksyms/parse.y" | ||
1811 | { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_ENUM; (yyval) = (yyvsp[(2) - (2)]); ;} | 1832 | { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_ENUM; (yyval) = (yyvsp[(2) - (2)]); ;} |
1812 | break; | 1833 | break; |
1813 | 1834 | ||
1814 | case 40: | 1835 | case 40: |
1815 | #line 217 "scripts/genksyms/parse.y" | 1836 | |
1837 | /* Line 1455 of yacc.c */ | ||
1838 | #line 218 "scripts/genksyms/parse.y" | ||
1816 | { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r; | 1839 | { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r; |
1817 | r = copy_node(i); r->tag = SYM_STRUCT; | 1840 | r = copy_node(i); r->tag = SYM_STRUCT; |
1818 | r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL; | 1841 | r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL; |
@@ -1822,7 +1845,9 @@ yyreduce: | |||
1822 | break; | 1845 | break; |
1823 | 1846 | ||
1824 | case 41: | 1847 | case 41: |
1825 | #line 224 "scripts/genksyms/parse.y" | 1848 | |
1849 | /* Line 1455 of yacc.c */ | ||
1850 | #line 225 "scripts/genksyms/parse.y" | ||
1826 | { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r; | 1851 | { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r; |
1827 | r = copy_node(i); r->tag = SYM_UNION; | 1852 | r = copy_node(i); r->tag = SYM_UNION; |
1828 | r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL; | 1853 | r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL; |
@@ -1832,7 +1857,9 @@ yyreduce: | |||
1832 | break; | 1857 | break; |
1833 | 1858 | ||
1834 | case 42: | 1859 | case 42: |
1835 | #line 231 "scripts/genksyms/parse.y" | 1860 | |
1861 | /* Line 1455 of yacc.c */ | ||
1862 | #line 232 "scripts/genksyms/parse.y" | ||
1836 | { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r; | 1863 | { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r; |
1837 | r = copy_node(i); r->tag = SYM_ENUM; | 1864 | r = copy_node(i); r->tag = SYM_ENUM; |
1838 | r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL; | 1865 | r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL; |
@@ -1842,42 +1869,58 @@ yyreduce: | |||
1842 | break; | 1869 | break; |
1843 | 1870 | ||
1844 | case 43: | 1871 | case 43: |
1845 | #line 239 "scripts/genksyms/parse.y" | 1872 | |
1846 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 1873 | /* Line 1455 of yacc.c */ |
1874 | #line 242 "scripts/genksyms/parse.y" | ||
1875 | { add_symbol(NULL, SYM_ENUM, NULL, 0); (yyval) = (yyvsp[(2) - (2)]); ;} | ||
1847 | break; | 1876 | break; |
1848 | 1877 | ||
1849 | case 44: | 1878 | case 44: |
1850 | #line 240 "scripts/genksyms/parse.y" | 1879 | |
1880 | /* Line 1455 of yacc.c */ | ||
1881 | #line 244 "scripts/genksyms/parse.y" | ||
1851 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 1882 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
1852 | break; | 1883 | break; |
1853 | 1884 | ||
1854 | case 45: | 1885 | case 45: |
1855 | #line 241 "scripts/genksyms/parse.y" | 1886 | |
1887 | /* Line 1455 of yacc.c */ | ||
1888 | #line 245 "scripts/genksyms/parse.y" | ||
1856 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 1889 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
1857 | break; | 1890 | break; |
1858 | 1891 | ||
1859 | case 56: | 1892 | case 56: |
1860 | #line 255 "scripts/genksyms/parse.y" | 1893 | |
1894 | /* Line 1455 of yacc.c */ | ||
1895 | #line 259 "scripts/genksyms/parse.y" | ||
1861 | { (*(yyvsp[(1) - (1)]))->tag = SYM_TYPEDEF; (yyval) = (yyvsp[(1) - (1)]); ;} | 1896 | { (*(yyvsp[(1) - (1)]))->tag = SYM_TYPEDEF; (yyval) = (yyvsp[(1) - (1)]); ;} |
1862 | break; | 1897 | break; |
1863 | 1898 | ||
1864 | case 57: | 1899 | case 57: |
1865 | #line 260 "scripts/genksyms/parse.y" | 1900 | |
1901 | /* Line 1455 of yacc.c */ | ||
1902 | #line 264 "scripts/genksyms/parse.y" | ||
1866 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} | 1903 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} |
1867 | break; | 1904 | break; |
1868 | 1905 | ||
1869 | case 58: | 1906 | case 58: |
1870 | #line 264 "scripts/genksyms/parse.y" | 1907 | |
1908 | /* Line 1455 of yacc.c */ | ||
1909 | #line 268 "scripts/genksyms/parse.y" | ||
1871 | { (yyval) = NULL; ;} | 1910 | { (yyval) = NULL; ;} |
1872 | break; | 1911 | break; |
1873 | 1912 | ||
1874 | case 61: | 1913 | case 61: |
1875 | #line 270 "scripts/genksyms/parse.y" | 1914 | |
1915 | /* Line 1455 of yacc.c */ | ||
1916 | #line 274 "scripts/genksyms/parse.y" | ||
1876 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 1917 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
1877 | break; | 1918 | break; |
1878 | 1919 | ||
1879 | case 65: | 1920 | case 65: |
1880 | #line 276 "scripts/genksyms/parse.y" | 1921 | |
1922 | /* Line 1455 of yacc.c */ | ||
1923 | #line 280 "scripts/genksyms/parse.y" | ||
1881 | { /* restrict has no effect in prototypes so ignore it */ | 1924 | { /* restrict has no effect in prototypes so ignore it */ |
1882 | remove_node((yyvsp[(1) - (1)])); | 1925 | remove_node((yyvsp[(1) - (1)])); |
1883 | (yyval) = (yyvsp[(1) - (1)]); | 1926 | (yyval) = (yyvsp[(1) - (1)]); |
@@ -1885,12 +1928,16 @@ yyreduce: | |||
1885 | break; | 1928 | break; |
1886 | 1929 | ||
1887 | case 66: | 1930 | case 66: |
1888 | #line 283 "scripts/genksyms/parse.y" | 1931 | |
1932 | /* Line 1455 of yacc.c */ | ||
1933 | #line 287 "scripts/genksyms/parse.y" | ||
1889 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 1934 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
1890 | break; | 1935 | break; |
1891 | 1936 | ||
1892 | case 68: | 1937 | case 68: |
1893 | #line 289 "scripts/genksyms/parse.y" | 1938 | |
1939 | /* Line 1455 of yacc.c */ | ||
1940 | #line 293 "scripts/genksyms/parse.y" | ||
1894 | { if (current_name != NULL) { | 1941 | { if (current_name != NULL) { |
1895 | error_with_pos("unexpected second declaration name"); | 1942 | error_with_pos("unexpected second declaration name"); |
1896 | YYERROR; | 1943 | YYERROR; |
@@ -1902,97 +1949,135 @@ yyreduce: | |||
1902 | break; | 1949 | break; |
1903 | 1950 | ||
1904 | case 69: | 1951 | case 69: |
1905 | #line 298 "scripts/genksyms/parse.y" | 1952 | |
1953 | /* Line 1455 of yacc.c */ | ||
1954 | #line 302 "scripts/genksyms/parse.y" | ||
1906 | { (yyval) = (yyvsp[(4) - (4)]); ;} | 1955 | { (yyval) = (yyvsp[(4) - (4)]); ;} |
1907 | break; | 1956 | break; |
1908 | 1957 | ||
1909 | case 70: | 1958 | case 70: |
1910 | #line 300 "scripts/genksyms/parse.y" | 1959 | |
1960 | /* Line 1455 of yacc.c */ | ||
1961 | #line 304 "scripts/genksyms/parse.y" | ||
1911 | { (yyval) = (yyvsp[(4) - (4)]); ;} | 1962 | { (yyval) = (yyvsp[(4) - (4)]); ;} |
1912 | break; | 1963 | break; |
1913 | 1964 | ||
1914 | case 71: | 1965 | case 71: |
1915 | #line 302 "scripts/genksyms/parse.y" | 1966 | |
1967 | /* Line 1455 of yacc.c */ | ||
1968 | #line 306 "scripts/genksyms/parse.y" | ||
1916 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 1969 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
1917 | break; | 1970 | break; |
1918 | 1971 | ||
1919 | case 72: | 1972 | case 72: |
1920 | #line 304 "scripts/genksyms/parse.y" | 1973 | |
1974 | /* Line 1455 of yacc.c */ | ||
1975 | #line 308 "scripts/genksyms/parse.y" | ||
1921 | { (yyval) = (yyvsp[(3) - (3)]); ;} | 1976 | { (yyval) = (yyvsp[(3) - (3)]); ;} |
1922 | break; | 1977 | break; |
1923 | 1978 | ||
1924 | case 73: | 1979 | case 73: |
1925 | #line 306 "scripts/genksyms/parse.y" | 1980 | |
1981 | /* Line 1455 of yacc.c */ | ||
1982 | #line 310 "scripts/genksyms/parse.y" | ||
1926 | { (yyval) = (yyvsp[(3) - (3)]); ;} | 1983 | { (yyval) = (yyvsp[(3) - (3)]); ;} |
1927 | break; | 1984 | break; |
1928 | 1985 | ||
1929 | case 74: | 1986 | case 74: |
1930 | #line 312 "scripts/genksyms/parse.y" | 1987 | |
1988 | /* Line 1455 of yacc.c */ | ||
1989 | #line 316 "scripts/genksyms/parse.y" | ||
1931 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 1990 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
1932 | break; | 1991 | break; |
1933 | 1992 | ||
1934 | case 78: | 1993 | case 78: |
1935 | #line 320 "scripts/genksyms/parse.y" | 1994 | |
1995 | /* Line 1455 of yacc.c */ | ||
1996 | #line 324 "scripts/genksyms/parse.y" | ||
1936 | { (yyval) = (yyvsp[(4) - (4)]); ;} | 1997 | { (yyval) = (yyvsp[(4) - (4)]); ;} |
1937 | break; | 1998 | break; |
1938 | 1999 | ||
1939 | case 79: | 2000 | case 79: |
1940 | #line 322 "scripts/genksyms/parse.y" | 2001 | |
2002 | /* Line 1455 of yacc.c */ | ||
2003 | #line 326 "scripts/genksyms/parse.y" | ||
1941 | { (yyval) = (yyvsp[(4) - (4)]); ;} | 2004 | { (yyval) = (yyvsp[(4) - (4)]); ;} |
1942 | break; | 2005 | break; |
1943 | 2006 | ||
1944 | case 80: | 2007 | case 80: |
1945 | #line 324 "scripts/genksyms/parse.y" | 2008 | |
2009 | /* Line 1455 of yacc.c */ | ||
2010 | #line 328 "scripts/genksyms/parse.y" | ||
1946 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 2011 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
1947 | break; | 2012 | break; |
1948 | 2013 | ||
1949 | case 81: | 2014 | case 81: |
1950 | #line 326 "scripts/genksyms/parse.y" | 2015 | |
2016 | /* Line 1455 of yacc.c */ | ||
2017 | #line 330 "scripts/genksyms/parse.y" | ||
1951 | { (yyval) = (yyvsp[(3) - (3)]); ;} | 2018 | { (yyval) = (yyvsp[(3) - (3)]); ;} |
1952 | break; | 2019 | break; |
1953 | 2020 | ||
1954 | case 82: | 2021 | case 82: |
1955 | #line 328 "scripts/genksyms/parse.y" | 2022 | |
2023 | /* Line 1455 of yacc.c */ | ||
2024 | #line 332 "scripts/genksyms/parse.y" | ||
1956 | { (yyval) = (yyvsp[(3) - (3)]); ;} | 2025 | { (yyval) = (yyvsp[(3) - (3)]); ;} |
1957 | break; | 2026 | break; |
1958 | 2027 | ||
1959 | case 83: | 2028 | case 83: |
1960 | #line 332 "scripts/genksyms/parse.y" | 2029 | |
2030 | /* Line 1455 of yacc.c */ | ||
2031 | #line 336 "scripts/genksyms/parse.y" | ||
1961 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 2032 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
1962 | break; | 2033 | break; |
1963 | 2034 | ||
1964 | case 85: | 2035 | case 85: |
1965 | #line 334 "scripts/genksyms/parse.y" | 2036 | |
2037 | /* Line 1455 of yacc.c */ | ||
2038 | #line 338 "scripts/genksyms/parse.y" | ||
1966 | { (yyval) = (yyvsp[(3) - (3)]); ;} | 2039 | { (yyval) = (yyvsp[(3) - (3)]); ;} |
1967 | break; | 2040 | break; |
1968 | 2041 | ||
1969 | case 86: | 2042 | case 86: |
1970 | #line 338 "scripts/genksyms/parse.y" | 2043 | |
2044 | /* Line 1455 of yacc.c */ | ||
2045 | #line 342 "scripts/genksyms/parse.y" | ||
1971 | { (yyval) = NULL; ;} | 2046 | { (yyval) = NULL; ;} |
1972 | break; | 2047 | break; |
1973 | 2048 | ||
1974 | case 89: | 2049 | case 89: |
1975 | #line 345 "scripts/genksyms/parse.y" | 2050 | |
2051 | /* Line 1455 of yacc.c */ | ||
2052 | #line 349 "scripts/genksyms/parse.y" | ||
1976 | { (yyval) = (yyvsp[(3) - (3)]); ;} | 2053 | { (yyval) = (yyvsp[(3) - (3)]); ;} |
1977 | break; | 2054 | break; |
1978 | 2055 | ||
1979 | case 90: | 2056 | case 90: |
1980 | #line 350 "scripts/genksyms/parse.y" | 2057 | |
2058 | /* Line 1455 of yacc.c */ | ||
2059 | #line 354 "scripts/genksyms/parse.y" | ||
1981 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} | 2060 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} |
1982 | break; | 2061 | break; |
1983 | 2062 | ||
1984 | case 91: | 2063 | case 91: |
1985 | #line 355 "scripts/genksyms/parse.y" | 2064 | |
2065 | /* Line 1455 of yacc.c */ | ||
2066 | #line 359 "scripts/genksyms/parse.y" | ||
1986 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} | 2067 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} |
1987 | break; | 2068 | break; |
1988 | 2069 | ||
1989 | case 93: | 2070 | case 93: |
1990 | #line 360 "scripts/genksyms/parse.y" | 2071 | |
2072 | /* Line 1455 of yacc.c */ | ||
2073 | #line 364 "scripts/genksyms/parse.y" | ||
1991 | { (yyval) = NULL; ;} | 2074 | { (yyval) = NULL; ;} |
1992 | break; | 2075 | break; |
1993 | 2076 | ||
1994 | case 94: | 2077 | case 94: |
1995 | #line 362 "scripts/genksyms/parse.y" | 2078 | |
2079 | /* Line 1455 of yacc.c */ | ||
2080 | #line 366 "scripts/genksyms/parse.y" | ||
1996 | { /* For version 2 checksums, we don't want to remember | 2081 | { /* For version 2 checksums, we don't want to remember |
1997 | private parameter names. */ | 2082 | private parameter names. */ |
1998 | remove_node((yyvsp[(1) - (1)])); | 2083 | remove_node((yyvsp[(1) - (1)])); |
@@ -2001,39 +2086,53 @@ yyreduce: | |||
2001 | break; | 2086 | break; |
2002 | 2087 | ||
2003 | case 95: | 2088 | case 95: |
2004 | #line 370 "scripts/genksyms/parse.y" | 2089 | |
2090 | /* Line 1455 of yacc.c */ | ||
2091 | #line 374 "scripts/genksyms/parse.y" | ||
2005 | { remove_node((yyvsp[(1) - (1)])); | 2092 | { remove_node((yyvsp[(1) - (1)])); |
2006 | (yyval) = (yyvsp[(1) - (1)]); | 2093 | (yyval) = (yyvsp[(1) - (1)]); |
2007 | ;} | 2094 | ;} |
2008 | break; | 2095 | break; |
2009 | 2096 | ||
2010 | case 96: | 2097 | case 96: |
2011 | #line 374 "scripts/genksyms/parse.y" | 2098 | |
2099 | /* Line 1455 of yacc.c */ | ||
2100 | #line 378 "scripts/genksyms/parse.y" | ||
2012 | { (yyval) = (yyvsp[(4) - (4)]); ;} | 2101 | { (yyval) = (yyvsp[(4) - (4)]); ;} |
2013 | break; | 2102 | break; |
2014 | 2103 | ||
2015 | case 97: | 2104 | case 97: |
2016 | #line 376 "scripts/genksyms/parse.y" | 2105 | |
2106 | /* Line 1455 of yacc.c */ | ||
2107 | #line 380 "scripts/genksyms/parse.y" | ||
2017 | { (yyval) = (yyvsp[(4) - (4)]); ;} | 2108 | { (yyval) = (yyvsp[(4) - (4)]); ;} |
2018 | break; | 2109 | break; |
2019 | 2110 | ||
2020 | case 98: | 2111 | case 98: |
2021 | #line 378 "scripts/genksyms/parse.y" | 2112 | |
2113 | /* Line 1455 of yacc.c */ | ||
2114 | #line 382 "scripts/genksyms/parse.y" | ||
2022 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 2115 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
2023 | break; | 2116 | break; |
2024 | 2117 | ||
2025 | case 99: | 2118 | case 99: |
2026 | #line 380 "scripts/genksyms/parse.y" | 2119 | |
2120 | /* Line 1455 of yacc.c */ | ||
2121 | #line 384 "scripts/genksyms/parse.y" | ||
2027 | { (yyval) = (yyvsp[(3) - (3)]); ;} | 2122 | { (yyval) = (yyvsp[(3) - (3)]); ;} |
2028 | break; | 2123 | break; |
2029 | 2124 | ||
2030 | case 100: | 2125 | case 100: |
2031 | #line 382 "scripts/genksyms/parse.y" | 2126 | |
2127 | /* Line 1455 of yacc.c */ | ||
2128 | #line 386 "scripts/genksyms/parse.y" | ||
2032 | { (yyval) = (yyvsp[(3) - (3)]); ;} | 2129 | { (yyval) = (yyvsp[(3) - (3)]); ;} |
2033 | break; | 2130 | break; |
2034 | 2131 | ||
2035 | case 101: | 2132 | case 101: |
2036 | #line 387 "scripts/genksyms/parse.y" | 2133 | |
2134 | /* Line 1455 of yacc.c */ | ||
2135 | #line 391 "scripts/genksyms/parse.y" | ||
2037 | { struct string_list *decl = *(yyvsp[(2) - (3)]); | 2136 | { struct string_list *decl = *(yyvsp[(2) - (3)]); |
2038 | *(yyvsp[(2) - (3)]) = NULL; | 2137 | *(yyvsp[(2) - (3)]) = NULL; |
2039 | add_symbol(current_name, SYM_NORMAL, decl, is_extern); | 2138 | add_symbol(current_name, SYM_NORMAL, decl, is_extern); |
@@ -2042,93 +2141,163 @@ yyreduce: | |||
2042 | break; | 2141 | break; |
2043 | 2142 | ||
2044 | case 102: | 2143 | case 102: |
2045 | #line 395 "scripts/genksyms/parse.y" | 2144 | |
2145 | /* Line 1455 of yacc.c */ | ||
2146 | #line 399 "scripts/genksyms/parse.y" | ||
2046 | { (yyval) = NULL; ;} | 2147 | { (yyval) = NULL; ;} |
2047 | break; | 2148 | break; |
2048 | 2149 | ||
2049 | case 104: | 2150 | case 104: |
2050 | #line 402 "scripts/genksyms/parse.y" | 2151 | |
2152 | /* Line 1455 of yacc.c */ | ||
2153 | #line 406 "scripts/genksyms/parse.y" | ||
2051 | { remove_list((yyvsp[(2) - (2)]), &(*(yyvsp[(1) - (2)]))->next); (yyval) = (yyvsp[(2) - (2)]); ;} | 2154 | { remove_list((yyvsp[(2) - (2)]), &(*(yyvsp[(1) - (2)]))->next); (yyval) = (yyvsp[(2) - (2)]); ;} |
2052 | break; | 2155 | break; |
2053 | 2156 | ||
2054 | case 105: | 2157 | case 105: |
2055 | #line 406 "scripts/genksyms/parse.y" | 2158 | |
2159 | /* Line 1455 of yacc.c */ | ||
2160 | #line 410 "scripts/genksyms/parse.y" | ||
2056 | { (yyval) = (yyvsp[(3) - (3)]); ;} | 2161 | { (yyval) = (yyvsp[(3) - (3)]); ;} |
2057 | break; | 2162 | break; |
2058 | 2163 | ||
2059 | case 106: | 2164 | case 106: |
2060 | #line 407 "scripts/genksyms/parse.y" | 2165 | |
2166 | /* Line 1455 of yacc.c */ | ||
2167 | #line 411 "scripts/genksyms/parse.y" | ||
2061 | { (yyval) = (yyvsp[(3) - (3)]); ;} | 2168 | { (yyval) = (yyvsp[(3) - (3)]); ;} |
2062 | break; | 2169 | break; |
2063 | 2170 | ||
2064 | case 107: | 2171 | case 107: |
2065 | #line 411 "scripts/genksyms/parse.y" | 2172 | |
2173 | /* Line 1455 of yacc.c */ | ||
2174 | #line 415 "scripts/genksyms/parse.y" | ||
2066 | { (yyval) = NULL; ;} | 2175 | { (yyval) = NULL; ;} |
2067 | break; | 2176 | break; |
2068 | 2177 | ||
2069 | case 110: | 2178 | case 110: |
2070 | #line 417 "scripts/genksyms/parse.y" | 2179 | |
2180 | /* Line 1455 of yacc.c */ | ||
2181 | #line 421 "scripts/genksyms/parse.y" | ||
2071 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 2182 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
2072 | break; | 2183 | break; |
2073 | 2184 | ||
2074 | case 111: | 2185 | case 111: |
2075 | #line 422 "scripts/genksyms/parse.y" | 2186 | |
2187 | /* Line 1455 of yacc.c */ | ||
2188 | #line 426 "scripts/genksyms/parse.y" | ||
2076 | { (yyval) = (yyvsp[(3) - (3)]); ;} | 2189 | { (yyval) = (yyvsp[(3) - (3)]); ;} |
2077 | break; | 2190 | break; |
2078 | 2191 | ||
2079 | case 112: | 2192 | case 112: |
2080 | #line 424 "scripts/genksyms/parse.y" | 2193 | |
2194 | /* Line 1455 of yacc.c */ | ||
2195 | #line 428 "scripts/genksyms/parse.y" | ||
2081 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 2196 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
2082 | break; | 2197 | break; |
2083 | 2198 | ||
2084 | case 113: | 2199 | case 113: |
2085 | #line 428 "scripts/genksyms/parse.y" | 2200 | |
2201 | /* Line 1455 of yacc.c */ | ||
2202 | #line 432 "scripts/genksyms/parse.y" | ||
2086 | { (yyval) = NULL; ;} | 2203 | { (yyval) = NULL; ;} |
2087 | break; | 2204 | break; |
2088 | 2205 | ||
2089 | case 116: | 2206 | case 116: |
2090 | #line 434 "scripts/genksyms/parse.y" | 2207 | |
2208 | /* Line 1455 of yacc.c */ | ||
2209 | #line 438 "scripts/genksyms/parse.y" | ||
2091 | { (yyval) = (yyvsp[(3) - (3)]); ;} | 2210 | { (yyval) = (yyvsp[(3) - (3)]); ;} |
2092 | break; | 2211 | break; |
2093 | 2212 | ||
2094 | case 117: | 2213 | case 117: |
2095 | #line 438 "scripts/genksyms/parse.y" | 2214 | |
2215 | /* Line 1455 of yacc.c */ | ||
2216 | #line 442 "scripts/genksyms/parse.y" | ||
2096 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} | 2217 | { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} |
2097 | break; | 2218 | break; |
2098 | 2219 | ||
2099 | case 118: | 2220 | case 118: |
2100 | #line 439 "scripts/genksyms/parse.y" | 2221 | |
2222 | /* Line 1455 of yacc.c */ | ||
2223 | #line 443 "scripts/genksyms/parse.y" | ||
2101 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 2224 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
2102 | break; | 2225 | break; |
2103 | 2226 | ||
2104 | case 120: | 2227 | case 120: |
2105 | #line 444 "scripts/genksyms/parse.y" | 2228 | |
2229 | /* Line 1455 of yacc.c */ | ||
2230 | #line 448 "scripts/genksyms/parse.y" | ||
2106 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 2231 | { (yyval) = (yyvsp[(2) - (2)]); ;} |
2107 | break; | 2232 | break; |
2108 | 2233 | ||
2109 | case 121: | 2234 | case 121: |
2110 | #line 448 "scripts/genksyms/parse.y" | 2235 | |
2236 | /* Line 1455 of yacc.c */ | ||
2237 | #line 452 "scripts/genksyms/parse.y" | ||
2111 | { (yyval) = NULL; ;} | 2238 | { (yyval) = NULL; ;} |
2112 | break; | 2239 | break; |
2113 | 2240 | ||
2114 | case 123: | 2241 | case 123: |
2115 | #line 453 "scripts/genksyms/parse.y" | 2242 | |
2116 | { (yyval) = (yyvsp[(2) - (2)]); ;} | 2243 | /* Line 1455 of yacc.c */ |
2244 | #line 457 "scripts/genksyms/parse.y" | ||
2245 | { (yyval) = (yyvsp[(3) - (3)]); ;} | ||
2117 | break; | 2246 | break; |
2118 | 2247 | ||
2119 | case 124: | 2248 | case 124: |
2120 | #line 457 "scripts/genksyms/parse.y" | 2249 | |
2250 | /* Line 1455 of yacc.c */ | ||
2251 | #line 458 "scripts/genksyms/parse.y" | ||
2252 | { (yyval) = (yyvsp[(4) - (4)]); ;} | ||
2253 | break; | ||
2254 | |||
2255 | case 127: | ||
2256 | |||
2257 | /* Line 1455 of yacc.c */ | ||
2258 | #line 467 "scripts/genksyms/parse.y" | ||
2259 | { | ||
2260 | const char *name = strdup((*(yyvsp[(1) - (1)]))->string); | ||
2261 | add_symbol(name, SYM_ENUM_CONST, NULL, 0); | ||
2262 | ;} | ||
2263 | break; | ||
2264 | |||
2265 | case 128: | ||
2266 | |||
2267 | /* Line 1455 of yacc.c */ | ||
2268 | #line 472 "scripts/genksyms/parse.y" | ||
2269 | { | ||
2270 | const char *name = strdup((*(yyvsp[(1) - (3)]))->string); | ||
2271 | struct string_list *expr = copy_list_range(*(yyvsp[(3) - (3)]), *(yyvsp[(2) - (3)])); | ||
2272 | add_symbol(name, SYM_ENUM_CONST, expr, 0); | ||
2273 | ;} | ||
2274 | break; | ||
2275 | |||
2276 | case 129: | ||
2277 | |||
2278 | /* Line 1455 of yacc.c */ | ||
2279 | #line 479 "scripts/genksyms/parse.y" | ||
2280 | { (yyval) = (yyvsp[(2) - (2)]); ;} | ||
2281 | break; | ||
2282 | |||
2283 | case 130: | ||
2284 | |||
2285 | /* Line 1455 of yacc.c */ | ||
2286 | #line 483 "scripts/genksyms/parse.y" | ||
2121 | { (yyval) = NULL; ;} | 2287 | { (yyval) = NULL; ;} |
2122 | break; | 2288 | break; |
2123 | 2289 | ||
2124 | case 126: | 2290 | case 132: |
2125 | #line 463 "scripts/genksyms/parse.y" | 2291 | |
2292 | /* Line 1455 of yacc.c */ | ||
2293 | #line 489 "scripts/genksyms/parse.y" | ||
2126 | { export_symbol((*(yyvsp[(3) - (5)]))->string); (yyval) = (yyvsp[(5) - (5)]); ;} | 2294 | { export_symbol((*(yyvsp[(3) - (5)]))->string); (yyval) = (yyvsp[(5) - (5)]); ;} |
2127 | break; | 2295 | break; |
2128 | 2296 | ||
2129 | 2297 | ||
2130 | /* Line 1267 of yacc.c. */ | 2298 | |
2131 | #line 2132 "scripts/genksyms/parse.c" | 2299 | /* Line 1455 of yacc.c */ |
2300 | #line 2301 "scripts/genksyms/parse.c" | ||
2132 | default: break; | 2301 | default: break; |
2133 | } | 2302 | } |
2134 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); | 2303 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
@@ -2139,7 +2308,6 @@ yyreduce: | |||
2139 | 2308 | ||
2140 | *++yyvsp = yyval; | 2309 | *++yyvsp = yyval; |
2141 | 2310 | ||
2142 | |||
2143 | /* Now `shift' the result of the reduction. Determine what state | 2311 | /* Now `shift' the result of the reduction. Determine what state |
2144 | that goes to, based on the state we popped back to and the rule | 2312 | that goes to, based on the state we popped back to and the rule |
2145 | number reduced by. */ | 2313 | number reduced by. */ |
@@ -2204,7 +2372,7 @@ yyerrlab: | |||
2204 | 2372 | ||
2205 | if (yyerrstatus == 3) | 2373 | if (yyerrstatus == 3) |
2206 | { | 2374 | { |
2207 | /* If just tried and failed to reuse look-ahead token after an | 2375 | /* If just tried and failed to reuse lookahead token after an |
2208 | error, discard it. */ | 2376 | error, discard it. */ |
2209 | 2377 | ||
2210 | if (yychar <= YYEOF) | 2378 | if (yychar <= YYEOF) |
@@ -2221,7 +2389,7 @@ yyerrlab: | |||
2221 | } | 2389 | } |
2222 | } | 2390 | } |
2223 | 2391 | ||
2224 | /* Else will try to reuse look-ahead token after shifting the error | 2392 | /* Else will try to reuse lookahead token after shifting the error |
2225 | token. */ | 2393 | token. */ |
2226 | goto yyerrlab1; | 2394 | goto yyerrlab1; |
2227 | 2395 | ||
@@ -2278,9 +2446,6 @@ yyerrlab1: | |||
2278 | YY_STACK_PRINT (yyss, yyssp); | 2446 | YY_STACK_PRINT (yyss, yyssp); |
2279 | } | 2447 | } |
2280 | 2448 | ||
2281 | if (yyn == YYFINAL) | ||
2282 | YYACCEPT; | ||
2283 | |||
2284 | *++yyvsp = yylval; | 2449 | *++yyvsp = yylval; |
2285 | 2450 | ||
2286 | 2451 | ||
@@ -2305,7 +2470,7 @@ yyabortlab: | |||
2305 | yyresult = 1; | 2470 | yyresult = 1; |
2306 | goto yyreturn; | 2471 | goto yyreturn; |
2307 | 2472 | ||
2308 | #ifndef yyoverflow | 2473 | #if !defined(yyoverflow) || YYERROR_VERBOSE |
2309 | /*-------------------------------------------------. | 2474 | /*-------------------------------------------------. |
2310 | | yyexhaustedlab -- memory exhaustion comes here. | | 2475 | | yyexhaustedlab -- memory exhaustion comes here. | |
2311 | `-------------------------------------------------*/ | 2476 | `-------------------------------------------------*/ |
@@ -2316,7 +2481,7 @@ yyexhaustedlab: | |||
2316 | #endif | 2481 | #endif |
2317 | 2482 | ||
2318 | yyreturn: | 2483 | yyreturn: |
2319 | if (yychar != YYEOF && yychar != YYEMPTY) | 2484 | if (yychar != YYEMPTY) |
2320 | yydestruct ("Cleanup: discarding lookahead", | 2485 | yydestruct ("Cleanup: discarding lookahead", |
2321 | yytoken, &yylval); | 2486 | yytoken, &yylval); |
2322 | /* Do not reclaim the symbols of the rule which action triggered | 2487 | /* Do not reclaim the symbols of the rule which action triggered |
@@ -2342,7 +2507,9 @@ yyreturn: | |||
2342 | } | 2507 | } |
2343 | 2508 | ||
2344 | 2509 | ||
2345 | #line 467 "scripts/genksyms/parse.y" | 2510 | |
2511 | /* Line 1675 of yacc.c */ | ||
2512 | #line 493 "scripts/genksyms/parse.y" | ||
2346 | 2513 | ||
2347 | 2514 | ||
2348 | static void | 2515 | static void |
diff --git a/scripts/genksyms/parse.h_shipped b/scripts/genksyms/parse.h_shipped index c4eeec652b79..517523669251 100644 --- a/scripts/genksyms/parse.h_shipped +++ b/scripts/genksyms/parse.h_shipped | |||
@@ -1,24 +1,23 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.3. */ | ||
2 | 1 | ||
3 | /* Skeleton interface for Bison's Yacc-like parsers in C | 2 | /* A Bison parser, made by GNU Bison 2.4.1. */ |
4 | 3 | ||
5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | 4 | /* Skeleton interface for Bison's Yacc-like parsers in C |
5 | |||
6 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | ||
6 | Free Software Foundation, Inc. | 7 | Free Software Foundation, Inc. |
7 | 8 | ||
8 | This program is free software; you can redistribute it and/or modify | 9 | This program is free software: you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 10 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2, or (at your option) | 11 | the Free Software Foundation, either version 3 of the License, or |
11 | any later version. | 12 | (at your option) any later version. |
12 | 13 | ||
13 | This program is distributed in the hope that it will be useful, | 14 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 17 | GNU General Public License for more details. |
17 | 18 | ||
18 | You should have received a copy of the GNU General Public License | 19 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
21 | Boston, MA 02110-1301, USA. */ | ||
22 | 21 | ||
23 | /* As a special exception, you may create a larger work that contains | 22 | /* As a special exception, you may create a larger work that contains |
24 | part or all of the Bison parser skeleton and distribute that work | 23 | part or all of the Bison parser skeleton and distribute that work |
@@ -29,10 +28,11 @@ | |||
29 | special exception, which will cause the skeleton and the resulting | 28 | special exception, which will cause the skeleton and the resulting |
30 | Bison output files to be licensed under the GNU General Public | 29 | Bison output files to be licensed under the GNU General Public |
31 | License without this special exception. | 30 | License without this special exception. |
32 | 31 | ||
33 | This special exception was added by the Free Software Foundation in | 32 | This special exception was added by the Free Software Foundation in |
34 | version 2.2 of Bison. */ | 33 | version 2.2 of Bison. */ |
35 | 34 | ||
35 | |||
36 | /* Tokens. */ | 36 | /* Tokens. */ |
37 | #ifndef YYTOKENTYPE | 37 | #ifndef YYTOKENTYPE |
38 | # define YYTOKENTYPE | 38 | # define YYTOKENTYPE |
@@ -82,58 +82,16 @@ | |||
82 | FILENAME = 298 | 82 | FILENAME = 298 |
83 | }; | 83 | }; |
84 | #endif | 84 | #endif |
85 | /* Tokens. */ | ||
86 | #define ASM_KEYW 258 | ||
87 | #define ATTRIBUTE_KEYW 259 | ||
88 | #define AUTO_KEYW 260 | ||
89 | #define BOOL_KEYW 261 | ||
90 | #define CHAR_KEYW 262 | ||
91 | #define CONST_KEYW 263 | ||
92 | #define DOUBLE_KEYW 264 | ||
93 | #define ENUM_KEYW 265 | ||
94 | #define EXTERN_KEYW 266 | ||
95 | #define EXTENSION_KEYW 267 | ||
96 | #define FLOAT_KEYW 268 | ||
97 | #define INLINE_KEYW 269 | ||
98 | #define INT_KEYW 270 | ||
99 | #define LONG_KEYW 271 | ||
100 | #define REGISTER_KEYW 272 | ||
101 | #define RESTRICT_KEYW 273 | ||
102 | #define SHORT_KEYW 274 | ||
103 | #define SIGNED_KEYW 275 | ||
104 | #define STATIC_KEYW 276 | ||
105 | #define STRUCT_KEYW 277 | ||
106 | #define TYPEDEF_KEYW 278 | ||
107 | #define UNION_KEYW 279 | ||
108 | #define UNSIGNED_KEYW 280 | ||
109 | #define VOID_KEYW 281 | ||
110 | #define VOLATILE_KEYW 282 | ||
111 | #define TYPEOF_KEYW 283 | ||
112 | #define EXPORT_SYMBOL_KEYW 284 | ||
113 | #define ASM_PHRASE 285 | ||
114 | #define ATTRIBUTE_PHRASE 286 | ||
115 | #define BRACE_PHRASE 287 | ||
116 | #define BRACKET_PHRASE 288 | ||
117 | #define EXPRESSION_PHRASE 289 | ||
118 | #define CHAR 290 | ||
119 | #define DOTS 291 | ||
120 | #define IDENT 292 | ||
121 | #define INT 293 | ||
122 | #define REAL 294 | ||
123 | #define STRING 295 | ||
124 | #define TYPE 296 | ||
125 | #define OTHER 297 | ||
126 | #define FILENAME 298 | ||
127 | |||
128 | 85 | ||
129 | 86 | ||
130 | 87 | ||
131 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | 88 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
132 | typedef int YYSTYPE; | 89 | typedef int YYSTYPE; |
90 | # define YYSTYPE_IS_TRIVIAL 1 | ||
133 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | 91 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
134 | # define YYSTYPE_IS_DECLARED 1 | 92 | # define YYSTYPE_IS_DECLARED 1 |
135 | # define YYSTYPE_IS_TRIVIAL 1 | ||
136 | #endif | 93 | #endif |
137 | 94 | ||
138 | extern YYSTYPE yylval; | 95 | extern YYSTYPE yylval; |
139 | 96 | ||
97 | |||
diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y index 09a265cd7193..ba5c242866c1 100644 --- a/scripts/genksyms/parse.y +++ b/scripts/genksyms/parse.y | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include <assert.h> | 26 | #include <assert.h> |
27 | #include <stdlib.h> | 27 | #include <stdlib.h> |
28 | #include <string.h> | ||
28 | #include "genksyms.h" | 29 | #include "genksyms.h" |
29 | 30 | ||
30 | static int is_typedef; | 31 | static int is_typedef; |
@@ -227,16 +228,19 @@ type_specifier: | |||
227 | add_symbol(i->string, SYM_UNION, s, is_extern); | 228 | add_symbol(i->string, SYM_UNION, s, is_extern); |
228 | $$ = $3; | 229 | $$ = $3; |
229 | } | 230 | } |
230 | | ENUM_KEYW IDENT BRACE_PHRASE | 231 | | ENUM_KEYW IDENT enum_body |
231 | { struct string_list *s = *$3, *i = *$2, *r; | 232 | { struct string_list *s = *$3, *i = *$2, *r; |
232 | r = copy_node(i); r->tag = SYM_ENUM; | 233 | r = copy_node(i); r->tag = SYM_ENUM; |
233 | r->next = (*$1)->next; *$3 = r; (*$1)->next = NULL; | 234 | r->next = (*$1)->next; *$3 = r; (*$1)->next = NULL; |
234 | add_symbol(i->string, SYM_ENUM, s, is_extern); | 235 | add_symbol(i->string, SYM_ENUM, s, is_extern); |
235 | $$ = $3; | 236 | $$ = $3; |
236 | } | 237 | } |
237 | 238 | /* | |
238 | /* Anonymous s/u/e definitions. Nothing needs doing. */ | 239 | * Anonymous enum definition. Tell add_symbol() to restart its counter. |
239 | | ENUM_KEYW BRACE_PHRASE { $$ = $2; } | 240 | */ |
241 | | ENUM_KEYW enum_body | ||
242 | { add_symbol(NULL, SYM_ENUM, NULL, 0); $$ = $2; } | ||
243 | /* Anonymous s/u definitions. Nothing needs doing. */ | ||
240 | | STRUCT_KEYW class_body { $$ = $2; } | 244 | | STRUCT_KEYW class_body { $$ = $2; } |
241 | | UNION_KEYW class_body { $$ = $2; } | 245 | | UNION_KEYW class_body { $$ = $2; } |
242 | ; | 246 | ; |
@@ -449,6 +453,28 @@ attribute_opt: | |||
449 | | attribute_opt ATTRIBUTE_PHRASE | 453 | | attribute_opt ATTRIBUTE_PHRASE |
450 | ; | 454 | ; |
451 | 455 | ||
456 | enum_body: | ||
457 | '{' enumerator_list '}' { $$ = $3; } | ||
458 | | '{' enumerator_list ',' '}' { $$ = $4; } | ||
459 | ; | ||
460 | |||
461 | enumerator_list: | ||
462 | enumerator | ||
463 | | enumerator_list ',' enumerator | ||
464 | |||
465 | enumerator: | ||
466 | IDENT | ||
467 | { | ||
468 | const char *name = strdup((*$1)->string); | ||
469 | add_symbol(name, SYM_ENUM_CONST, NULL, 0); | ||
470 | } | ||
471 | | IDENT '=' EXPRESSION_PHRASE | ||
472 | { | ||
473 | const char *name = strdup((*$1)->string); | ||
474 | struct string_list *expr = copy_list_range(*$3, *$2); | ||
475 | add_symbol(name, SYM_ENUM_CONST, expr, 0); | ||
476 | } | ||
477 | |||
452 | asm_definition: | 478 | asm_definition: |
453 | ASM_PHRASE ';' { $$ = $2; } | 479 | ASM_PHRASE ';' { $$ = $2; } |
454 | ; | 480 | ; |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index e8fba959fffb..cd104afcc5f2 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -1248,6 +1248,19 @@ static int is_function(Elf_Sym *sym) | |||
1248 | return -1; | 1248 | return -1; |
1249 | } | 1249 | } |
1250 | 1250 | ||
1251 | static void print_section_list(const char * const list[20]) | ||
1252 | { | ||
1253 | const char *const *s = list; | ||
1254 | |||
1255 | while (*s) { | ||
1256 | fprintf(stderr, "%s", *s); | ||
1257 | s++; | ||
1258 | if (*s) | ||
1259 | fprintf(stderr, ", "); | ||
1260 | } | ||
1261 | fprintf(stderr, "\n"); | ||
1262 | } | ||
1263 | |||
1251 | /* | 1264 | /* |
1252 | * Print a warning about a section mismatch. | 1265 | * Print a warning about a section mismatch. |
1253 | * Try to find symbols near it so user can find it. | 1266 | * Try to find symbols near it so user can find it. |
@@ -1304,7 +1317,6 @@ static void report_sec_mismatch(const char *modname, | |||
1304 | break; | 1317 | break; |
1305 | case DATA_TO_ANY_INIT: { | 1318 | case DATA_TO_ANY_INIT: { |
1306 | prl_to = sec2annotation(tosec); | 1319 | prl_to = sec2annotation(tosec); |
1307 | const char *const *s = mismatch->symbol_white_list; | ||
1308 | fprintf(stderr, | 1320 | fprintf(stderr, |
1309 | "The variable %s references\n" | 1321 | "The variable %s references\n" |
1310 | "the %s %s%s%s\n" | 1322 | "the %s %s%s%s\n" |
@@ -1312,9 +1324,7 @@ static void report_sec_mismatch(const char *modname, | |||
1312 | "variable with __init* or __refdata (see linux/init.h) " | 1324 | "variable with __init* or __refdata (see linux/init.h) " |
1313 | "or name the variable:\n", | 1325 | "or name the variable:\n", |
1314 | fromsym, to, prl_to, tosym, to_p); | 1326 | fromsym, to, prl_to, tosym, to_p); |
1315 | while (*s) | 1327 | print_section_list(mismatch->symbol_white_list); |
1316 | fprintf(stderr, "%s, ", *s++); | ||
1317 | fprintf(stderr, "\n"); | ||
1318 | free(prl_to); | 1328 | free(prl_to); |
1319 | break; | 1329 | break; |
1320 | } | 1330 | } |
@@ -1329,7 +1339,6 @@ static void report_sec_mismatch(const char *modname, | |||
1329 | break; | 1339 | break; |
1330 | case DATA_TO_ANY_EXIT: { | 1340 | case DATA_TO_ANY_EXIT: { |
1331 | prl_to = sec2annotation(tosec); | 1341 | prl_to = sec2annotation(tosec); |
1332 | const char *const *s = mismatch->symbol_white_list; | ||
1333 | fprintf(stderr, | 1342 | fprintf(stderr, |
1334 | "The variable %s references\n" | 1343 | "The variable %s references\n" |
1335 | "the %s %s%s%s\n" | 1344 | "the %s %s%s%s\n" |
@@ -1337,9 +1346,7 @@ static void report_sec_mismatch(const char *modname, | |||
1337 | "variable with __exit* (see linux/init.h) or " | 1346 | "variable with __exit* (see linux/init.h) or " |
1338 | "name the variable:\n", | 1347 | "name the variable:\n", |
1339 | fromsym, to, prl_to, tosym, to_p); | 1348 | fromsym, to, prl_to, tosym, to_p); |
1340 | while (*s) | 1349 | print_section_list(mismatch->symbol_white_list); |
1341 | fprintf(stderr, "%s, ", *s++); | ||
1342 | fprintf(stderr, "\n"); | ||
1343 | free(prl_to); | 1350 | free(prl_to); |
1344 | break; | 1351 | break; |
1345 | } | 1352 | } |
diff --git a/scripts/unifdef.c b/scripts/unifdef.c index 44d39785e50d..7493c0ee51cc 100644 --- a/scripts/unifdef.c +++ b/scripts/unifdef.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 - 2009 Tony Finch <dot@dotat.at> | 2 | * Copyright (c) 2002 - 2011 Tony Finch <dot@dotat.at> |
3 | * | 3 | * |
4 | * Redistribution and use in source and binary forms, with or without | 4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions | 5 | * modification, are permitted provided that the following conditions |
@@ -24,23 +24,14 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | /* | 26 | /* |
27 | * unifdef - remove ifdef'ed lines | ||
28 | * | ||
27 | * This code was derived from software contributed to Berkeley by Dave Yost. | 29 | * This code was derived from software contributed to Berkeley by Dave Yost. |
28 | * It was rewritten to support ANSI C by Tony Finch. The original version | 30 | * It was rewritten to support ANSI C by Tony Finch. The original version |
29 | * of unifdef carried the 4-clause BSD copyright licence. None of its code | 31 | * of unifdef carried the 4-clause BSD copyright licence. None of its code |
30 | * remains in this version (though some of the names remain) so it now | 32 | * remains in this version (though some of the names remain) so it now |
31 | * carries a more liberal licence. | 33 | * carries a more liberal licence. |
32 | * | 34 | * |
33 | * The latest version is available from http://dotat.at/prog/unifdef | ||
34 | */ | ||
35 | |||
36 | static const char * const copyright[] = { | ||
37 | "@(#) Copyright (c) 2002 - 2009 Tony Finch <dot@dotat.at>\n", | ||
38 | "$dotat: unifdef/unifdef.c,v 1.190 2009/11/27 17:21:26 fanf2 Exp $", | ||
39 | }; | ||
40 | |||
41 | /* | ||
42 | * unifdef - remove ifdef'ed lines | ||
43 | * | ||
44 | * Wishlist: | 35 | * Wishlist: |
45 | * provide an option which will append the name of the | 36 | * provide an option which will append the name of the |
46 | * appropriate symbol after #else's and #endif's | 37 | * appropriate symbol after #else's and #endif's |
@@ -48,12 +39,16 @@ static const char * const copyright[] = { | |||
48 | * #else's and #endif's to see that they match their | 39 | * #else's and #endif's to see that they match their |
49 | * corresponding #ifdef or #ifndef | 40 | * corresponding #ifdef or #ifndef |
50 | * | 41 | * |
51 | * The first two items above require better buffer handling, which would | 42 | * These require better buffer handling, which would also make |
52 | * also make it possible to handle all "dodgy" directives correctly. | 43 | * it possible to handle all "dodgy" directives correctly. |
53 | */ | 44 | */ |
54 | 45 | ||
46 | #include <sys/types.h> | ||
47 | #include <sys/stat.h> | ||
48 | |||
55 | #include <ctype.h> | 49 | #include <ctype.h> |
56 | #include <err.h> | 50 | #include <err.h> |
51 | #include <errno.h> | ||
57 | #include <stdarg.h> | 52 | #include <stdarg.h> |
58 | #include <stdbool.h> | 53 | #include <stdbool.h> |
59 | #include <stdio.h> | 54 | #include <stdio.h> |
@@ -61,6 +56,12 @@ static const char * const copyright[] = { | |||
61 | #include <string.h> | 56 | #include <string.h> |
62 | #include <unistd.h> | 57 | #include <unistd.h> |
63 | 58 | ||
59 | const char copyright[] = | ||
60 | "@(#) $Version: unifdef-2.5 $\n" | ||
61 | "@(#) $Author: Tony Finch (dot@dotat.at) $\n" | ||
62 | "@(#) $URL: http://dotat.at/prog/unifdef $\n" | ||
63 | ; | ||
64 | |||
64 | /* types of input lines: */ | 65 | /* types of input lines: */ |
65 | typedef enum { | 66 | typedef enum { |
66 | LT_TRUEI, /* a true #if with ignore flag */ | 67 | LT_TRUEI, /* a true #if with ignore flag */ |
@@ -153,6 +154,11 @@ static char const * const linestate_name[] = { | |||
153 | #define EDITSLOP 10 | 154 | #define EDITSLOP 10 |
154 | 155 | ||
155 | /* | 156 | /* |
157 | * For temporary filenames | ||
158 | */ | ||
159 | #define TEMPLATE "unifdef.XXXXXX" | ||
160 | |||
161 | /* | ||
156 | * Globals. | 162 | * Globals. |
157 | */ | 163 | */ |
158 | 164 | ||
@@ -165,6 +171,7 @@ static bool strictlogic; /* -K: keep ambiguous #ifs */ | |||
165 | static bool killconsts; /* -k: eval constant #ifs */ | 171 | static bool killconsts; /* -k: eval constant #ifs */ |
166 | static bool lnnum; /* -n: add #line directives */ | 172 | static bool lnnum; /* -n: add #line directives */ |
167 | static bool symlist; /* -s: output symbol list */ | 173 | static bool symlist; /* -s: output symbol list */ |
174 | static bool symdepth; /* -S: output symbol depth */ | ||
168 | static bool text; /* -t: this is a text file */ | 175 | static bool text; /* -t: this is a text file */ |
169 | 176 | ||
170 | static const char *symname[MAXSYMS]; /* symbol name */ | 177 | static const char *symname[MAXSYMS]; /* symbol name */ |
@@ -175,10 +182,18 @@ static int nsyms; /* number of symbols */ | |||
175 | static FILE *input; /* input file pointer */ | 182 | static FILE *input; /* input file pointer */ |
176 | static const char *filename; /* input file name */ | 183 | static const char *filename; /* input file name */ |
177 | static int linenum; /* current line number */ | 184 | static int linenum; /* current line number */ |
185 | static FILE *output; /* output file pointer */ | ||
186 | static const char *ofilename; /* output file name */ | ||
187 | static bool overwriting; /* output overwrites input */ | ||
188 | static char tempname[FILENAME_MAX]; /* used when overwriting */ | ||
178 | 189 | ||
179 | static char tline[MAXLINE+EDITSLOP];/* input buffer plus space */ | 190 | static char tline[MAXLINE+EDITSLOP];/* input buffer plus space */ |
180 | static char *keyword; /* used for editing #elif's */ | 191 | static char *keyword; /* used for editing #elif's */ |
181 | 192 | ||
193 | static const char *newline; /* input file format */ | ||
194 | static const char newline_unix[] = "\n"; | ||
195 | static const char newline_crlf[] = "\r\n"; | ||
196 | |||
182 | static Comment_state incomment; /* comment parser state */ | 197 | static Comment_state incomment; /* comment parser state */ |
183 | static Line_state linestate; /* #if line parser state */ | 198 | static Line_state linestate; /* #if line parser state */ |
184 | static Ifstate ifstate[MAXDEPTH]; /* #if processor state */ | 199 | static Ifstate ifstate[MAXDEPTH]; /* #if processor state */ |
@@ -189,10 +204,13 @@ static int delcount; /* count of deleted lines */ | |||
189 | static unsigned blankcount; /* count of blank lines */ | 204 | static unsigned blankcount; /* count of blank lines */ |
190 | static unsigned blankmax; /* maximum recent blankcount */ | 205 | static unsigned blankmax; /* maximum recent blankcount */ |
191 | static bool constexpr; /* constant #if expression */ | 206 | static bool constexpr; /* constant #if expression */ |
207 | static bool zerosyms = true; /* to format symdepth output */ | ||
208 | static bool firstsym; /* ditto */ | ||
192 | 209 | ||
193 | static int exitstat; /* program exit status */ | 210 | static int exitstat; /* program exit status */ |
194 | 211 | ||
195 | static void addsym(bool, bool, char *); | 212 | static void addsym(bool, bool, char *); |
213 | static void closeout(void); | ||
196 | static void debug(const char *, ...); | 214 | static void debug(const char *, ...); |
197 | static void done(void); | 215 | static void done(void); |
198 | static void error(const char *); | 216 | static void error(const char *); |
@@ -212,6 +230,7 @@ static void state(Ifstate); | |||
212 | static int strlcmp(const char *, const char *, size_t); | 230 | static int strlcmp(const char *, const char *, size_t); |
213 | static void unnest(void); | 231 | static void unnest(void); |
214 | static void usage(void); | 232 | static void usage(void); |
233 | static void version(void); | ||
215 | 234 | ||
216 | #define endsym(c) (!isalnum((unsigned char)c) && c != '_') | 235 | #define endsym(c) (!isalnum((unsigned char)c) && c != '_') |
217 | 236 | ||
@@ -223,7 +242,7 @@ main(int argc, char *argv[]) | |||
223 | { | 242 | { |
224 | int opt; | 243 | int opt; |
225 | 244 | ||
226 | while ((opt = getopt(argc, argv, "i:D:U:I:BbcdeKklnst")) != -1) | 245 | while ((opt = getopt(argc, argv, "i:D:U:I:o:bBcdeKklnsStV")) != -1) |
227 | switch (opt) { | 246 | switch (opt) { |
228 | case 'i': /* treat stuff controlled by these symbols as text */ | 247 | case 'i': /* treat stuff controlled by these symbols as text */ |
229 | /* | 248 | /* |
@@ -245,16 +264,15 @@ main(int argc, char *argv[]) | |||
245 | case 'U': /* undef a symbol */ | 264 | case 'U': /* undef a symbol */ |
246 | addsym(false, false, optarg); | 265 | addsym(false, false, optarg); |
247 | break; | 266 | break; |
248 | case 'I': | 267 | case 'I': /* no-op for compatibility with cpp */ |
249 | /* no-op for compatibility with cpp */ | ||
250 | break; | ||
251 | case 'B': /* compress blank lines around removed section */ | ||
252 | compblank = true; | ||
253 | break; | 268 | break; |
254 | case 'b': /* blank deleted lines instead of omitting them */ | 269 | case 'b': /* blank deleted lines instead of omitting them */ |
255 | case 'l': /* backwards compatibility */ | 270 | case 'l': /* backwards compatibility */ |
256 | lnblank = true; | 271 | lnblank = true; |
257 | break; | 272 | break; |
273 | case 'B': /* compress blank lines around removed section */ | ||
274 | compblank = true; | ||
275 | break; | ||
258 | case 'c': /* treat -D as -U and vice versa */ | 276 | case 'c': /* treat -D as -U and vice versa */ |
259 | complement = true; | 277 | complement = true; |
260 | break; | 278 | break; |
@@ -273,12 +291,20 @@ main(int argc, char *argv[]) | |||
273 | case 'n': /* add #line directive after deleted lines */ | 291 | case 'n': /* add #line directive after deleted lines */ |
274 | lnnum = true; | 292 | lnnum = true; |
275 | break; | 293 | break; |
294 | case 'o': /* output to a file */ | ||
295 | ofilename = optarg; | ||
296 | break; | ||
276 | case 's': /* only output list of symbols that control #ifs */ | 297 | case 's': /* only output list of symbols that control #ifs */ |
277 | symlist = true; | 298 | symlist = true; |
278 | break; | 299 | break; |
300 | case 'S': /* list symbols with their nesting depth */ | ||
301 | symlist = symdepth = true; | ||
302 | break; | ||
279 | case 't': /* don't parse C comments */ | 303 | case 't': /* don't parse C comments */ |
280 | text = true; | 304 | text = true; |
281 | break; | 305 | break; |
306 | case 'V': /* print version */ | ||
307 | version(); | ||
282 | default: | 308 | default: |
283 | usage(); | 309 | usage(); |
284 | } | 310 | } |
@@ -290,21 +316,68 @@ main(int argc, char *argv[]) | |||
290 | errx(2, "can only do one file"); | 316 | errx(2, "can only do one file"); |
291 | } else if (argc == 1 && strcmp(*argv, "-") != 0) { | 317 | } else if (argc == 1 && strcmp(*argv, "-") != 0) { |
292 | filename = *argv; | 318 | filename = *argv; |
293 | input = fopen(filename, "r"); | 319 | input = fopen(filename, "rb"); |
294 | if (input == NULL) | 320 | if (input == NULL) |
295 | err(2, "can't open %s", filename); | 321 | err(2, "can't open %s", filename); |
296 | } else { | 322 | } else { |
297 | filename = "[stdin]"; | 323 | filename = "[stdin]"; |
298 | input = stdin; | 324 | input = stdin; |
299 | } | 325 | } |
326 | if (ofilename == NULL) { | ||
327 | ofilename = "[stdout]"; | ||
328 | output = stdout; | ||
329 | } else { | ||
330 | struct stat ist, ost; | ||
331 | if (stat(ofilename, &ost) == 0 && | ||
332 | fstat(fileno(input), &ist) == 0) | ||
333 | overwriting = (ist.st_dev == ost.st_dev | ||
334 | && ist.st_ino == ost.st_ino); | ||
335 | if (overwriting) { | ||
336 | const char *dirsep; | ||
337 | int ofd; | ||
338 | |||
339 | dirsep = strrchr(ofilename, '/'); | ||
340 | if (dirsep != NULL) | ||
341 | snprintf(tempname, sizeof(tempname), | ||
342 | "%.*s/" TEMPLATE, | ||
343 | (int)(dirsep - ofilename), ofilename); | ||
344 | else | ||
345 | snprintf(tempname, sizeof(tempname), | ||
346 | TEMPLATE); | ||
347 | ofd = mkstemp(tempname); | ||
348 | if (ofd != -1) | ||
349 | output = fdopen(ofd, "wb+"); | ||
350 | if (output == NULL) | ||
351 | err(2, "can't create temporary file"); | ||
352 | fchmod(ofd, ist.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO)); | ||
353 | } else { | ||
354 | output = fopen(ofilename, "wb"); | ||
355 | if (output == NULL) | ||
356 | err(2, "can't open %s", ofilename); | ||
357 | } | ||
358 | } | ||
300 | process(); | 359 | process(); |
301 | abort(); /* bug */ | 360 | abort(); /* bug */ |
302 | } | 361 | } |
303 | 362 | ||
304 | static void | 363 | static void |
364 | version(void) | ||
365 | { | ||
366 | const char *c = copyright; | ||
367 | for (;;) { | ||
368 | while (*++c != '$') | ||
369 | if (*c == '\0') | ||
370 | exit(0); | ||
371 | while (*++c != '$') | ||
372 | putc(*c, stderr); | ||
373 | putc('\n', stderr); | ||
374 | } | ||
375 | } | ||
376 | |||
377 | static void | ||
305 | usage(void) | 378 | usage(void) |
306 | { | 379 | { |
307 | fprintf(stderr, "usage: unifdef [-BbcdeKknst] [-Ipath]" | 380 | fprintf(stderr, "usage: unifdef [-bBcdeKknsStV] [-Ipath]" |
308 | " [-Dsym[=val]] [-Usym] [-iDsym[=val]] [-iUsym] ... [file]\n"); | 381 | " [-Dsym[=val]] [-Usym] [-iDsym[=val]] [-iUsym] ... [file]\n"); |
309 | exit(2); | 382 | exit(2); |
310 | } | 383 | } |
@@ -322,7 +395,8 @@ usage(void) | |||
322 | * When we have processed a group that starts off with a known-false | 395 | * When we have processed a group that starts off with a known-false |
323 | * #if/#elif sequence (which has therefore been deleted) followed by a | 396 | * #if/#elif sequence (which has therefore been deleted) followed by a |
324 | * #elif that we don't understand and therefore must keep, we edit the | 397 | * #elif that we don't understand and therefore must keep, we edit the |
325 | * latter into a #if to keep the nesting correct. | 398 | * latter into a #if to keep the nesting correct. We use strncpy() to |
399 | * overwrite the 4 byte token "elif" with "if " without a '\0' byte. | ||
326 | * | 400 | * |
327 | * When we find a true #elif in a group, the following block will | 401 | * When we find a true #elif in a group, the following block will |
328 | * always be kept and the rest of the sequence after the next #elif or | 402 | * always be kept and the rest of the sequence after the next #elif or |
@@ -375,11 +449,11 @@ static void Oelif (void) { if (!iocccok) Eioccc(); Pelif(); } | |||
375 | static void Idrop (void) { Fdrop(); ignoreon(); } | 449 | static void Idrop (void) { Fdrop(); ignoreon(); } |
376 | static void Itrue (void) { Ftrue(); ignoreon(); } | 450 | static void Itrue (void) { Ftrue(); ignoreon(); } |
377 | static void Ifalse(void) { Ffalse(); ignoreon(); } | 451 | static void Ifalse(void) { Ffalse(); ignoreon(); } |
378 | /* edit this line */ | 452 | /* modify this line */ |
379 | static void Mpass (void) { strncpy(keyword, "if ", 4); Pelif(); } | 453 | static void Mpass (void) { strncpy(keyword, "if ", 4); Pelif(); } |
380 | static void Mtrue (void) { keywordedit("else\n"); state(IS_TRUE_MIDDLE); } | 454 | static void Mtrue (void) { keywordedit("else"); state(IS_TRUE_MIDDLE); } |
381 | static void Melif (void) { keywordedit("endif\n"); state(IS_FALSE_TRAILER); } | 455 | static void Melif (void) { keywordedit("endif"); state(IS_FALSE_TRAILER); } |
382 | static void Melse (void) { keywordedit("endif\n"); state(IS_FALSE_ELSE); } | 456 | static void Melse (void) { keywordedit("endif"); state(IS_FALSE_ELSE); } |
383 | 457 | ||
384 | static state_fn * const trans_table[IS_COUNT][LT_COUNT] = { | 458 | static state_fn * const trans_table[IS_COUNT][LT_COUNT] = { |
385 | /* IS_OUTSIDE */ | 459 | /* IS_OUTSIDE */ |
@@ -431,13 +505,6 @@ static state_fn * const trans_table[IS_COUNT][LT_COUNT] = { | |||
431 | * State machine utility functions | 505 | * State machine utility functions |
432 | */ | 506 | */ |
433 | static void | 507 | static void |
434 | done(void) | ||
435 | { | ||
436 | if (incomment) | ||
437 | error("EOF in comment"); | ||
438 | exit(exitstat); | ||
439 | } | ||
440 | static void | ||
441 | ignoreoff(void) | 508 | ignoreoff(void) |
442 | { | 509 | { |
443 | if (depth == 0) | 510 | if (depth == 0) |
@@ -452,14 +519,8 @@ ignoreon(void) | |||
452 | static void | 519 | static void |
453 | keywordedit(const char *replacement) | 520 | keywordedit(const char *replacement) |
454 | { | 521 | { |
455 | size_t size = tline + sizeof(tline) - keyword; | 522 | snprintf(keyword, tline + sizeof(tline) - keyword, |
456 | char *dst = keyword; | 523 | "%s%s", replacement, newline); |
457 | const char *src = replacement; | ||
458 | if (size != 0) { | ||
459 | while ((--size != 0) && (*src != '\0')) | ||
460 | *dst++ = *src++; | ||
461 | *dst = '\0'; | ||
462 | } | ||
463 | print(); | 524 | print(); |
464 | } | 525 | } |
465 | static void | 526 | static void |
@@ -494,24 +555,26 @@ flushline(bool keep) | |||
494 | if (symlist) | 555 | if (symlist) |
495 | return; | 556 | return; |
496 | if (keep ^ complement) { | 557 | if (keep ^ complement) { |
497 | bool blankline = tline[strspn(tline, " \t\n")] == '\0'; | 558 | bool blankline = tline[strspn(tline, " \t\r\n")] == '\0'; |
498 | if (blankline && compblank && blankcount != blankmax) { | 559 | if (blankline && compblank && blankcount != blankmax) { |
499 | delcount += 1; | 560 | delcount += 1; |
500 | blankcount += 1; | 561 | blankcount += 1; |
501 | } else { | 562 | } else { |
502 | if (lnnum && delcount > 0) | 563 | if (lnnum && delcount > 0) |
503 | printf("#line %d\n", linenum); | 564 | printf("#line %d%s", linenum, newline); |
504 | fputs(tline, stdout); | 565 | fputs(tline, output); |
505 | delcount = 0; | 566 | delcount = 0; |
506 | blankmax = blankcount = blankline ? blankcount + 1 : 0; | 567 | blankmax = blankcount = blankline ? blankcount + 1 : 0; |
507 | } | 568 | } |
508 | } else { | 569 | } else { |
509 | if (lnblank) | 570 | if (lnblank) |
510 | putc('\n', stdout); | 571 | fputs(newline, output); |
511 | exitstat = 1; | 572 | exitstat = 1; |
512 | delcount += 1; | 573 | delcount += 1; |
513 | blankcount = 0; | 574 | blankcount = 0; |
514 | } | 575 | } |
576 | if (debugging) | ||
577 | fflush(output); | ||
515 | } | 578 | } |
516 | 579 | ||
517 | /* | 580 | /* |
@@ -520,22 +583,55 @@ flushline(bool keep) | |||
520 | static void | 583 | static void |
521 | process(void) | 584 | process(void) |
522 | { | 585 | { |
523 | Linetype lineval; | ||
524 | |||
525 | /* When compressing blank lines, act as if the file | 586 | /* When compressing blank lines, act as if the file |
526 | is preceded by a large number of blank lines. */ | 587 | is preceded by a large number of blank lines. */ |
527 | blankmax = blankcount = 1000; | 588 | blankmax = blankcount = 1000; |
528 | for (;;) { | 589 | for (;;) { |
529 | linenum++; | 590 | Linetype lineval = parseline(); |
530 | lineval = parseline(); | ||
531 | trans_table[ifstate[depth]][lineval](); | 591 | trans_table[ifstate[depth]][lineval](); |
532 | debug("process %s -> %s depth %d", | 592 | debug("process line %d %s -> %s depth %d", |
533 | linetype_name[lineval], | 593 | linenum, linetype_name[lineval], |
534 | ifstate_name[ifstate[depth]], depth); | 594 | ifstate_name[ifstate[depth]], depth); |
535 | } | 595 | } |
536 | } | 596 | } |
537 | 597 | ||
538 | /* | 598 | /* |
599 | * Flush the output and handle errors. | ||
600 | */ | ||
601 | static void | ||
602 | closeout(void) | ||
603 | { | ||
604 | if (symdepth && !zerosyms) | ||
605 | printf("\n"); | ||
606 | if (fclose(output) == EOF) { | ||
607 | warn("couldn't write to %s", ofilename); | ||
608 | if (overwriting) { | ||
609 | unlink(tempname); | ||
610 | errx(2, "%s unchanged", filename); | ||
611 | } else { | ||
612 | exit(2); | ||
613 | } | ||
614 | } | ||
615 | } | ||
616 | |||
617 | /* | ||
618 | * Clean up and exit. | ||
619 | */ | ||
620 | static void | ||
621 | done(void) | ||
622 | { | ||
623 | if (incomment) | ||
624 | error("EOF in comment"); | ||
625 | closeout(); | ||
626 | if (overwriting && rename(tempname, ofilename) == -1) { | ||
627 | warn("couldn't rename temporary file"); | ||
628 | unlink(tempname); | ||
629 | errx(2, "%s unchanged", ofilename); | ||
630 | } | ||
631 | exit(exitstat); | ||
632 | } | ||
633 | |||
634 | /* | ||
539 | * Parse a line and determine its type. We keep the preprocessor line | 635 | * Parse a line and determine its type. We keep the preprocessor line |
540 | * parser state between calls in the global variable linestate, with | 636 | * parser state between calls in the global variable linestate, with |
541 | * help from skipcomment(). | 637 | * help from skipcomment(). |
@@ -549,14 +645,22 @@ parseline(void) | |||
549 | Linetype retval; | 645 | Linetype retval; |
550 | Comment_state wascomment; | 646 | Comment_state wascomment; |
551 | 647 | ||
648 | linenum++; | ||
552 | if (fgets(tline, MAXLINE, input) == NULL) | 649 | if (fgets(tline, MAXLINE, input) == NULL) |
553 | return (LT_EOF); | 650 | return (LT_EOF); |
651 | if (newline == NULL) { | ||
652 | if (strrchr(tline, '\n') == strrchr(tline, '\r') + 1) | ||
653 | newline = newline_crlf; | ||
654 | else | ||
655 | newline = newline_unix; | ||
656 | } | ||
554 | retval = LT_PLAIN; | 657 | retval = LT_PLAIN; |
555 | wascomment = incomment; | 658 | wascomment = incomment; |
556 | cp = skipcomment(tline); | 659 | cp = skipcomment(tline); |
557 | if (linestate == LS_START) { | 660 | if (linestate == LS_START) { |
558 | if (*cp == '#') { | 661 | if (*cp == '#') { |
559 | linestate = LS_HASH; | 662 | linestate = LS_HASH; |
663 | firstsym = true; | ||
560 | cp = skipcomment(cp + 1); | 664 | cp = skipcomment(cp + 1); |
561 | } else if (*cp != '\0') | 665 | } else if (*cp != '\0') |
562 | linestate = LS_DIRTY; | 666 | linestate = LS_DIRTY; |
@@ -566,7 +670,8 @@ parseline(void) | |||
566 | cp = skipsym(cp); | 670 | cp = skipsym(cp); |
567 | kwlen = cp - keyword; | 671 | kwlen = cp - keyword; |
568 | /* no way can we deal with a continuation inside a keyword */ | 672 | /* no way can we deal with a continuation inside a keyword */ |
569 | if (strncmp(cp, "\\\n", 2) == 0) | 673 | if (strncmp(cp, "\\\r\n", 3) == 0 || |
674 | strncmp(cp, "\\\n", 2) == 0) | ||
570 | Eioccc(); | 675 | Eioccc(); |
571 | if (strlcmp("ifdef", keyword, kwlen) == 0 || | 676 | if (strlcmp("ifdef", keyword, kwlen) == 0 || |
572 | strlcmp("ifndef", keyword, kwlen) == 0) { | 677 | strlcmp("ifndef", keyword, kwlen) == 0) { |
@@ -617,9 +722,8 @@ parseline(void) | |||
617 | size_t len = cp - tline; | 722 | size_t len = cp - tline; |
618 | if (fgets(tline + len, MAXLINE - len, input) == NULL) { | 723 | if (fgets(tline + len, MAXLINE - len, input) == NULL) { |
619 | /* append the missing newline */ | 724 | /* append the missing newline */ |
620 | tline[len+0] = '\n'; | 725 | strcpy(tline + len, newline); |
621 | tline[len+1] = '\0'; | 726 | cp += strlen(newline); |
622 | cp++; | ||
623 | linestate = LS_START; | 727 | linestate = LS_START; |
624 | } else { | 728 | } else { |
625 | linestate = LS_DIRTY; | 729 | linestate = LS_DIRTY; |
@@ -630,7 +734,7 @@ parseline(void) | |||
630 | while (*cp != '\0') | 734 | while (*cp != '\0') |
631 | cp = skipcomment(cp + 1); | 735 | cp = skipcomment(cp + 1); |
632 | } | 736 | } |
633 | debug("parser %s comment %s line", | 737 | debug("parser line %d state %s comment %s line", linenum, |
634 | comment_name[incomment], linestate_name[linestate]); | 738 | comment_name[incomment], linestate_name[linestate]); |
635 | return (retval); | 739 | return (retval); |
636 | } | 740 | } |
@@ -875,11 +979,16 @@ skipcomment(const char *cp) | |||
875 | } | 979 | } |
876 | while (*cp != '\0') | 980 | while (*cp != '\0') |
877 | /* don't reset to LS_START after a line continuation */ | 981 | /* don't reset to LS_START after a line continuation */ |
878 | if (strncmp(cp, "\\\n", 2) == 0) | 982 | if (strncmp(cp, "\\\r\n", 3) == 0) |
983 | cp += 3; | ||
984 | else if (strncmp(cp, "\\\n", 2) == 0) | ||
879 | cp += 2; | 985 | cp += 2; |
880 | else switch (incomment) { | 986 | else switch (incomment) { |
881 | case NO_COMMENT: | 987 | case NO_COMMENT: |
882 | if (strncmp(cp, "/\\\n", 3) == 0) { | 988 | if (strncmp(cp, "/\\\r\n", 4) == 0) { |
989 | incomment = STARTING_COMMENT; | ||
990 | cp += 4; | ||
991 | } else if (strncmp(cp, "/\\\n", 3) == 0) { | ||
883 | incomment = STARTING_COMMENT; | 992 | incomment = STARTING_COMMENT; |
884 | cp += 3; | 993 | cp += 3; |
885 | } else if (strncmp(cp, "/*", 2) == 0) { | 994 | } else if (strncmp(cp, "/*", 2) == 0) { |
@@ -899,7 +1008,7 @@ skipcomment(const char *cp) | |||
899 | } else if (strncmp(cp, "\n", 1) == 0) { | 1008 | } else if (strncmp(cp, "\n", 1) == 0) { |
900 | linestate = LS_START; | 1009 | linestate = LS_START; |
901 | cp += 1; | 1010 | cp += 1; |
902 | } else if (strchr(" \t", *cp) != NULL) { | 1011 | } else if (strchr(" \r\t", *cp) != NULL) { |
903 | cp += 1; | 1012 | cp += 1; |
904 | } else | 1013 | } else |
905 | return (cp); | 1014 | return (cp); |
@@ -931,7 +1040,10 @@ skipcomment(const char *cp) | |||
931 | cp += 1; | 1040 | cp += 1; |
932 | continue; | 1041 | continue; |
933 | case C_COMMENT: | 1042 | case C_COMMENT: |
934 | if (strncmp(cp, "*\\\n", 3) == 0) { | 1043 | if (strncmp(cp, "*\\\r\n", 4) == 0) { |
1044 | incomment = FINISHING_COMMENT; | ||
1045 | cp += 4; | ||
1046 | } else if (strncmp(cp, "*\\\n", 3) == 0) { | ||
935 | incomment = FINISHING_COMMENT; | 1047 | incomment = FINISHING_COMMENT; |
936 | cp += 3; | 1048 | cp += 3; |
937 | } else if (strncmp(cp, "*/", 2) == 0) { | 1049 | } else if (strncmp(cp, "*/", 2) == 0) { |
@@ -1015,7 +1127,13 @@ findsym(const char *str) | |||
1015 | if (cp == str) | 1127 | if (cp == str) |
1016 | return (-1); | 1128 | return (-1); |
1017 | if (symlist) { | 1129 | if (symlist) { |
1018 | printf("%.*s\n", (int)(cp-str), str); | 1130 | if (symdepth && firstsym) |
1131 | printf("%s%3d", zerosyms ? "" : "\n", depth); | ||
1132 | firstsym = zerosyms = false; | ||
1133 | printf("%s%.*s%s", | ||
1134 | symdepth ? " " : "", | ||
1135 | (int)(cp-str), str, | ||
1136 | symdepth ? "" : "\n"); | ||
1019 | /* we don't care about the value of the symbol */ | 1137 | /* we don't care about the value of the symbol */ |
1020 | return (0); | 1138 | return (0); |
1021 | } | 1139 | } |
@@ -1052,7 +1170,7 @@ addsym(bool ignorethis, bool definethis, char *sym) | |||
1052 | value[symind] = val+1; | 1170 | value[symind] = val+1; |
1053 | *val = '\0'; | 1171 | *val = '\0'; |
1054 | } else if (*val == '\0') | 1172 | } else if (*val == '\0') |
1055 | value[symind] = ""; | 1173 | value[symind] = "1"; |
1056 | else | 1174 | else |
1057 | usage(); | 1175 | usage(); |
1058 | } else { | 1176 | } else { |
@@ -1060,6 +1178,8 @@ addsym(bool ignorethis, bool definethis, char *sym) | |||
1060 | usage(); | 1178 | usage(); |
1061 | value[symind] = NULL; | 1179 | value[symind] = NULL; |
1062 | } | 1180 | } |
1181 | debug("addsym %s=%s", symname[symind], | ||
1182 | value[symind] ? value[symind] : "undef"); | ||
1063 | } | 1183 | } |
1064 | 1184 | ||
1065 | /* | 1185 | /* |
@@ -1100,5 +1220,6 @@ error(const char *msg) | |||
1100 | else | 1220 | else |
1101 | warnx("%s: %d: %s (#if line %d depth %d)", | 1221 | warnx("%s: %d: %s (#if line %d depth %d)", |
1102 | filename, linenum, msg, stifline[depth], depth); | 1222 | filename, linenum, msg, stifline[depth], depth); |
1223 | closeout(); | ||
1103 | errx(2, "output may be truncated"); | 1224 | errx(2, "output may be truncated"); |
1104 | } | 1225 | } |