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

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