aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.build2
-rw-r--r--scripts/Makefile.lib4
-rw-r--r--scripts/basic/fixdep.c1
-rwxr-xr-xscripts/checkpatch.pl14
-rwxr-xr-xscripts/extract-vmlinux62
-rw-r--r--scripts/genksyms/genksyms.c3
-rw-r--r--scripts/genksyms/genksyms.h4
-rw-r--r--scripts/genksyms/lex.l8
-rw-r--r--scripts/genksyms/lex.lex.c_shipped12
-rw-r--r--scripts/genksyms/parse.tab.c_shipped645
-rw-r--r--scripts/genksyms/parse.tab.h_shipped7
-rw-r--r--scripts/genksyms/parse.y40
-rw-r--r--scripts/kconfig/Makefile28
-rw-r--r--scripts/kconfig/confdata.c49
-rw-r--r--scripts/kconfig/lxdialog/textbox.c3
-rw-r--r--scripts/kconfig/mconf.c86
-rw-r--r--scripts/kconfig/menu.c13
-rw-r--r--scripts/kconfig/nconf.c23
-rw-r--r--scripts/kconfig/nconf.gui.c59
-rw-r--r--scripts/kconfig/nconf.h2
-rw-r--r--scripts/kconfig/streamline_config.pl22
-rw-r--r--scripts/mod/modpost.c7
-rwxr-xr-xscripts/tags.sh4
23 files changed, 657 insertions, 441 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index a0fd5029cfe7..d2b366c16b64 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -46,7 +46,7 @@ include $(kbuild-file)
46# If the save-* variables changed error out 46# If the save-* variables changed error out
47ifeq ($(KBUILD_NOPEDANTIC),) 47ifeq ($(KBUILD_NOPEDANTIC),)
48 ifneq ("$(save-cflags)","$(CFLAGS)") 48 ifneq ("$(save-cflags)","$(CFLAGS)")
49 $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS) 49 $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use ccflags-y)
50 endif 50 endif
51endif 51endif
52 52
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index aeea84a24836..5d986d9adf1b 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -167,6 +167,7 @@ ifdef REGENERATE_PARSERS
167quiet_cmd_gperf = GPERF $@ 167quiet_cmd_gperf = GPERF $@
168 cmd_gperf = gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $< 168 cmd_gperf = gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $<
169 169
170.PRECIOUS: $(src)/%.hash.c_shipped
170$(src)/%.hash.c_shipped: $(src)/%.gperf 171$(src)/%.hash.c_shipped: $(src)/%.gperf
171 $(call cmd,gperf) 172 $(call cmd,gperf)
172 173
@@ -177,6 +178,7 @@ LEX_PREFIX = $(if $(LEX_PREFIX_${baseprereq}),$(LEX_PREFIX_${baseprereq}),yy)
177quiet_cmd_flex = LEX $@ 178quiet_cmd_flex = LEX $@
178 cmd_flex = flex -o$@ -L -P $(LEX_PREFIX) $< 179 cmd_flex = flex -o$@ -L -P $(LEX_PREFIX) $<
179 180
181.PRECIOUS: $(src)/%.lex.c_shipped
180$(src)/%.lex.c_shipped: $(src)/%.l 182$(src)/%.lex.c_shipped: $(src)/%.l
181 $(call cmd,flex) 183 $(call cmd,flex)
182 184
@@ -187,12 +189,14 @@ YACC_PREFIX = $(if $(YACC_PREFIX_${baseprereq}),$(YACC_PREFIX_${baseprereq}),yy)
187quiet_cmd_bison = YACC $@ 189quiet_cmd_bison = YACC $@
188 cmd_bison = bison -o$@ -t -l -p $(YACC_PREFIX) $< 190 cmd_bison = bison -o$@ -t -l -p $(YACC_PREFIX) $<
189 191
192.PRECIOUS: $(src)/%.tab.c_shipped
190$(src)/%.tab.c_shipped: $(src)/%.y 193$(src)/%.tab.c_shipped: $(src)/%.y
191 $(call cmd,bison) 194 $(call cmd,bison)
192 195
193quiet_cmd_bison_h = YACC $@ 196quiet_cmd_bison_h = YACC $@
194 cmd_bison_h = bison -o/dev/null --defines=$@ -t -l -p $(YACC_PREFIX) $< 197 cmd_bison_h = bison -o/dev/null --defines=$@ -t -l -p $(YACC_PREFIX) $<
195 198
199.PRECIOUS: $(src)/%.tab.h_shipped
196$(src)/%.tab.h_shipped: $(src)/%.y 200$(src)/%.tab.h_shipped: $(src)/%.y
197 $(call cmd,bison_h) 201 $(call cmd,bison_h)
198 202
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 291228e25984..cb1f50cf12e3 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -345,6 +345,7 @@ static void parse_dep_file(void *map, size_t len)
345 memcpy(s, m, p-m); s[p-m] = 0; 345 memcpy(s, m, p-m); s[p-m] = 0;
346 if (strrcmp(s, "include/generated/autoconf.h") && 346 if (strrcmp(s, "include/generated/autoconf.h") &&
347 strrcmp(s, "arch/um/include/uml-config.h") && 347 strrcmp(s, "arch/um/include/uml-config.h") &&
348 strrcmp(s, "include/linux/kconfig.h") &&
348 strrcmp(s, ".ver")) { 349 strrcmp(s, ".ver")) {
349 /* 350 /*
350 * Do not list the source file as dependency, so that 351 * Do not list the source file as dependency, so that
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5e93342d22f9..8fda3b3f7be8 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1683,6 +1683,20 @@ sub process {
1683 #print "is_end<$is_end> length<$length>\n"; 1683 #print "is_end<$is_end> length<$length>\n";
1684 } 1684 }
1685 1685
1686 if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) &&
1687 ($line =~ /\+(EXTRA_[A-Z]+FLAGS).*/)) {
1688 my $flag = $1;
1689 my $replacement = {
1690 'EXTRA_AFLAGS' => 'asflags-y',
1691 'EXTRA_CFLAGS' => 'ccflags-y',
1692 'EXTRA_CPPFLAGS' => 'cppflags-y',
1693 'EXTRA_LDFLAGS' => 'ldflags-y',
1694 };
1695
1696 WARN("DEPRECATED_VARIABLE",
1697 "Use of $flag is deprecated, please use \`$replacement->{$flag} instead.\n" . $herecurr) if ($replacement->{$flag});
1698 }
1699
1686# check we are in a valid source file if not then ignore this hunk 1700# check we are in a valid source file if not then ignore this hunk
1687 next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/); 1701 next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
1688 1702
diff --git a/scripts/extract-vmlinux b/scripts/extract-vmlinux
new file mode 100755
index 000000000000..5061abcc2540
--- /dev/null
+++ b/scripts/extract-vmlinux
@@ -0,0 +1,62 @@
1#!/bin/sh
2# ----------------------------------------------------------------------
3# extract-vmlinux - Extract uncompressed vmlinux from a kernel image
4#
5# Inspired from extract-ikconfig
6# (c) 2009,2010 Dick Streefland <dick@streefland.net>
7#
8# (c) 2011 Corentin Chary <corentin.chary@gmail.com>
9#
10# Licensed under the GNU General Public License, version 2 (GPLv2).
11# ----------------------------------------------------------------------
12
13check_vmlinux()
14{
15 # Use readelf to check if it's a valid ELF
16 # TODO: find a better to way to check that it's really vmlinux
17 # and not just an elf
18 readelf -h $1 > /dev/null 2>&1 || return 1
19
20 cat $1
21 exit 0
22}
23
24try_decompress()
25{
26 # The obscure use of the "tr" filter is to work around older versions of
27 # "grep" that report the byte offset of the line instead of the pattern.
28
29 # Try to find the header ($1) and decompress from here
30 for pos in `tr "$1\n$2" "\n$2=" < "$img" | grep -abo "^$2"`
31 do
32 pos=${pos%%:*}
33 tail -c+$pos "$img" | $3 > $tmp 2> /dev/null
34 check_vmlinux $tmp
35 done
36}
37
38# Check invocation:
39me=${0##*/}
40img=$1
41if [ $# -ne 1 -o ! -s "$img" ]
42then
43 echo "Usage: $me <kernel-image>" >&2
44 exit 2
45fi
46
47# Prepare temp files:
48tmp=$(mktemp /tmp/vmlinux-XXX)
49trap "rm -f $tmp" 0
50
51# Initial attempt for uncompressed images or objects:
52check_vmlinux $img
53
54# That didn't work, so retry after decompression.
55try_decompress '\037\213\010' xy gunzip
56try_decompress '\3757zXZ\000' abcde unxz
57try_decompress 'BZh' xy bunzip2
58try_decompress '\135\0\0\0' xxx unlzma
59try_decompress '\211\114\132' xy 'lzop -d'
60
61# Bail out:
62echo "$me: Cannot find vmlinux." >&2
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
index 6d3fda0ce2ae..8a106499ec4f 100644
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -40,7 +40,8 @@ static struct symbol *symtab[HASH_BUCKETS];
40static FILE *debugfile; 40static FILE *debugfile;
41 41
42int cur_line = 1; 42int cur_line = 1;
43char *cur_filename; 43char *cur_filename, *source_file;
44int in_source_file;
44 45
45static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types, 46static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types,
46 flag_preserve, flag_warnings; 47 flag_preserve, flag_warnings;
diff --git a/scripts/genksyms/genksyms.h b/scripts/genksyms/genksyms.h
index 7ec52ae3846a..3bffdcaaa274 100644
--- a/scripts/genksyms/genksyms.h
+++ b/scripts/genksyms/genksyms.h
@@ -37,6 +37,7 @@ enum symbol_status {
37struct string_list { 37struct string_list {
38 struct string_list *next; 38 struct string_list *next;
39 enum symbol_type tag; 39 enum symbol_type tag;
40 int in_source_file;
40 char *string; 41 char *string;
41}; 42};
42 43
@@ -57,7 +58,8 @@ typedef struct string_list **yystype;
57#define YYSTYPE yystype 58#define YYSTYPE yystype
58 59
59extern int cur_line; 60extern int cur_line;
60extern char *cur_filename; 61extern char *cur_filename, *source_file;
62extern int in_source_file;
61 63
62struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact); 64struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact);
63struct symbol *add_symbol(const char *name, enum symbol_type type, 65struct symbol *add_symbol(const char *name, enum symbol_type type,
diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l
index 400ae06a70df..f770071719cb 100644
--- a/scripts/genksyms/lex.l
+++ b/scripts/genksyms/lex.l
@@ -116,6 +116,7 @@ MC_TOKEN ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>)
116 cur_node->tag = \ 116 cur_node->tag = \
117 find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\ 117 find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\
118 SYM_ENUM_CONST : SYM_NORMAL ; \ 118 SYM_ENUM_CONST : SYM_NORMAL ; \
119 cur_node->in_source_file = in_source_file; \
119 } while (0) 120 } while (0)
120 121
121#define APP _APP(yytext, yyleng) 122#define APP _APP(yytext, yyleng)
@@ -166,6 +167,13 @@ repeat:
166 cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1); 167 cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1);
167 cur_line = atoi(yytext+2); 168 cur_line = atoi(yytext+2);
168 169
170 if (!source_file) {
171 source_file = xstrdup(cur_filename);
172 in_source_file = 1;
173 } else {
174 in_source_file = (strcmp(cur_filename, source_file) == 0);
175 }
176
169 goto repeat; 177 goto repeat;
170 } 178 }
171 179
diff --git a/scripts/genksyms/lex.lex.c_shipped b/scripts/genksyms/lex.lex.c_shipped
index c83cf60410be..0bf4157e6161 100644
--- a/scripts/genksyms/lex.lex.c_shipped
+++ b/scripts/genksyms/lex.lex.c_shipped
@@ -660,7 +660,7 @@ static int input (void );
660/* This used to be an fputs(), but since the string might contain NUL's, 660/* This used to be an fputs(), but since the string might contain NUL's,
661 * we now use fwrite(). 661 * we now use fwrite().
662 */ 662 */
663#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) 663#define ECHO fwrite( yytext, yyleng, 1, yyout )
664#endif 664#endif
665 665
666/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 666/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -671,7 +671,7 @@ static int input (void );
671 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 671 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
672 { \ 672 { \
673 int c = '*'; \ 673 int c = '*'; \
674 unsigned n; \ 674 int n; \
675 for ( n = 0; n < max_size && \ 675 for ( n = 0; n < max_size && \
676 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 676 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
677 buf[n] = (char) c; \ 677 buf[n] = (char) c; \
@@ -1926,6 +1926,7 @@ void yyfree (void * ptr )
1926 cur_node->tag = \ 1926 cur_node->tag = \
1927 find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\ 1927 find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\
1928 SYM_ENUM_CONST : SYM_NORMAL ; \ 1928 SYM_ENUM_CONST : SYM_NORMAL ; \
1929 cur_node->in_source_file = in_source_file; \
1929 } while (0) 1930 } while (0)
1930 1931
1931#define APP _APP(yytext, yyleng) 1932#define APP _APP(yytext, yyleng)
@@ -1975,6 +1976,13 @@ repeat:
1975 cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1); 1976 cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1);
1976 cur_line = atoi(yytext+2); 1977 cur_line = atoi(yytext+2);
1977 1978
1979 if (!source_file) {
1980 source_file = xstrdup(cur_filename);
1981 in_source_file = 1;
1982 } else {
1983 in_source_file = (strcmp(cur_filename, source_file) == 0);
1984 }
1985
1978 goto repeat; 1986 goto repeat;
1979 } 1987 }
1980 1988
diff --git a/scripts/genksyms/parse.tab.c_shipped b/scripts/genksyms/parse.tab.c_shipped
index 61d4a5d09856..ece53c79bb59 100644
--- a/scripts/genksyms/parse.tab.c_shipped
+++ b/scripts/genksyms/parse.tab.c_shipped
@@ -1,9 +1,8 @@
1/* A Bison parser, made by GNU Bison 2.4.3. */ 1/* A Bison parser, made by GNU Bison 2.5. */
2 2
3/* Skeleton implementation for Bison's Yacc-like parsers in C 3/* Bison implementation for Yacc-like parsers in C
4 4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
6 2009, 2010 Free Software Foundation, Inc.
7 6
8 This program is free software: you can redistribute it and/or modify 7 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
@@ -45,7 +44,7 @@
45#define YYBISON 1 44#define YYBISON 1
46 45
47/* Bison version. */ 46/* Bison version. */
48#define YYBISON_VERSION "2.4.3" 47#define YYBISON_VERSION "2.5"
49 48
50/* Skeleton name. */ 49/* Skeleton name. */
51#define YYSKELETON_NAME "yacc.c" 50#define YYSKELETON_NAME "yacc.c"
@@ -96,6 +95,25 @@ remove_list(struct string_list **pb, struct string_list **pe)
96 free_list(b, e); 95 free_list(b, e);
97} 96}
98 97
98/* Record definition of a struct/union/enum */
99static void record_compound(struct string_list **keyw,
100 struct string_list **ident,
101 struct string_list **body,
102 enum symbol_type type)
103{
104 struct string_list *b = *body, *i = *ident, *r;
105
106 if (i->in_source_file) {
107 remove_node(keyw);
108 (*ident)->tag = type;
109 remove_list(body, ident);
110 return;
111 }
112 r = copy_node(i); r->tag = type;
113 r->next = (*keyw)->next; *body = r; (*keyw)->next = NULL;
114 add_symbol(i->string, type, b, is_extern);
115}
116
99 117
100 118
101 119
@@ -283,11 +301,11 @@ YYID (yyi)
283# define alloca _alloca 301# define alloca _alloca
284# else 302# else
285# define YYSTACK_ALLOC alloca 303# define YYSTACK_ALLOC alloca
286# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 304# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
287 || defined __cplusplus || defined _MSC_VER) 305 || defined __cplusplus || defined _MSC_VER)
288# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 306# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
289# ifndef _STDLIB_H 307# ifndef EXIT_SUCCESS
290# define _STDLIB_H 1 308# define EXIT_SUCCESS 0
291# endif 309# endif
292# endif 310# endif
293# endif 311# endif
@@ -310,24 +328,24 @@ YYID (yyi)
310# ifndef YYSTACK_ALLOC_MAXIMUM 328# ifndef YYSTACK_ALLOC_MAXIMUM
311# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 329# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
312# endif 330# endif
313# if (defined __cplusplus && ! defined _STDLIB_H \ 331# if (defined __cplusplus && ! defined EXIT_SUCCESS \
314 && ! ((defined YYMALLOC || defined malloc) \ 332 && ! ((defined YYMALLOC || defined malloc) \
315 && (defined YYFREE || defined free))) 333 && (defined YYFREE || defined free)))
316# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 334# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
317# ifndef _STDLIB_H 335# ifndef EXIT_SUCCESS
318# define _STDLIB_H 1 336# define EXIT_SUCCESS 0
319# endif 337# endif
320# endif 338# endif
321# ifndef YYMALLOC 339# ifndef YYMALLOC
322# define YYMALLOC malloc 340# define YYMALLOC malloc
323# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 341# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
324 || defined __cplusplus || defined _MSC_VER) 342 || defined __cplusplus || defined _MSC_VER)
325void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 343void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
326# endif 344# endif
327# endif 345# endif
328# ifndef YYFREE 346# ifndef YYFREE
329# define YYFREE free 347# define YYFREE free
330# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 348# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
331 || defined __cplusplus || defined _MSC_VER) 349 || defined __cplusplus || defined _MSC_VER)
332void free (void *); /* INFRINGES ON USER NAME SPACE */ 350void free (void *); /* INFRINGES ON USER NAME SPACE */
333# endif 351# endif
@@ -356,23 +374,7 @@ union yyalloc
356 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 374 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
357 + YYSTACK_GAP_MAXIMUM) 375 + YYSTACK_GAP_MAXIMUM)
358 376
359/* Copy COUNT objects from FROM to TO. The source and destination do 377# define YYCOPY_NEEDED 1
360 not overlap. */
361# ifndef YYCOPY
362# if defined __GNUC__ && 1 < __GNUC__
363# define YYCOPY(To, From, Count) \
364 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
365# else
366# define YYCOPY(To, From, Count) \
367 do \
368 { \
369 YYSIZE_T yyi; \
370 for (yyi = 0; yyi < (Count); yyi++) \
371 (To)[yyi] = (From)[yyi]; \
372 } \
373 while (YYID (0))
374# endif
375# endif
376 378
377/* Relocate STACK from its old location to the new one. The 379/* Relocate STACK from its old location to the new one. The
378 local variables YYSIZE and YYSTACKSIZE give the old and new number of 380 local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -392,6 +394,26 @@ union yyalloc
392 394
393#endif 395#endif
394 396
397#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
398/* Copy COUNT objects from FROM to TO. The source and destination do
399 not overlap. */
400# ifndef YYCOPY
401# if defined __GNUC__ && 1 < __GNUC__
402# define YYCOPY(To, From, Count) \
403 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
404# else
405# define YYCOPY(To, From, Count) \
406 do \
407 { \
408 YYSIZE_T yyi; \
409 for (yyi = 0; yyi < (Count); yyi++) \
410 (To)[yyi] = (From)[yyi]; \
411 } \
412 while (YYID (0))
413# endif
414# endif
415#endif /* !YYCOPY_NEEDED */
416
395/* YYFINAL -- State number of the termination state. */ 417/* YYFINAL -- State number of the termination state. */
396#define YYFINAL 4 418#define YYFINAL 4
397/* YYLAST -- Last index in YYTABLE. */ 419/* YYLAST -- Last index in YYTABLE. */
@@ -514,20 +536,20 @@ static const yytype_int8 yyrhs[] =
514/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 536/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
515static const yytype_uint16 yyrline[] = 537static const yytype_uint16 yyrline[] =
516{ 538{
517 0, 104, 104, 105, 109, 109, 115, 115, 117, 117, 539 0, 123, 123, 124, 128, 128, 134, 134, 136, 136,
518 119, 120, 121, 122, 123, 124, 128, 142, 143, 147, 540 138, 139, 140, 141, 142, 143, 147, 161, 162, 166,
519 155, 168, 174, 175, 179, 180, 184, 190, 194, 195, 541 174, 187, 193, 194, 198, 199, 203, 209, 213, 214,
520 196, 197, 198, 202, 203, 204, 205, 209, 211, 213, 542 215, 216, 217, 221, 222, 223, 224, 228, 230, 232,
521 217, 224, 231, 241, 244, 245, 249, 250, 251, 252, 543 236, 238, 240, 245, 248, 249, 253, 254, 255, 256,
522 253, 254, 255, 256, 257, 258, 259, 263, 268, 269, 544 257, 258, 259, 260, 261, 262, 263, 267, 272, 273,
523 273, 274, 278, 278, 278, 279, 287, 288, 292, 301, 545 277, 278, 282, 282, 282, 283, 291, 292, 296, 305,
524 303, 305, 307, 309, 316, 317, 321, 322, 323, 325, 546 307, 309, 311, 313, 320, 321, 325, 326, 327, 329,
525 327, 329, 331, 336, 337, 338, 342, 343, 347, 348, 547 331, 333, 335, 340, 341, 342, 346, 347, 351, 352,
526 353, 358, 360, 364, 365, 373, 377, 379, 381, 383, 548 357, 362, 364, 368, 369, 377, 381, 383, 385, 387,
527 385, 390, 399, 400, 405, 410, 411, 415, 416, 420, 549 389, 394, 403, 404, 409, 414, 415, 419, 420, 424,
528 421, 425, 427, 432, 433, 437, 438, 442, 443, 444, 550 425, 429, 431, 436, 437, 441, 442, 446, 447, 448,
529 448, 452, 453, 457, 458, 462, 463, 466, 471, 479, 551 452, 456, 457, 461, 462, 466, 467, 470, 475, 483,
530 483, 484, 488 552 487, 488, 492
531}; 553};
532#endif 554#endif
533 555
@@ -618,8 +640,8 @@ static const yytype_uint8 yyr2[] =
618 0, 1, 5 640 0, 1, 5
619}; 641};
620 642
621/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 643/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
622 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 644 Performed when YYTABLE doesn't specify something else to do. Zero
623 means the default is an error. */ 645 means the default is an error. */
624static const yytype_uint8 yydefact[] = 646static const yytype_uint8 yydefact[] =
625{ 647{
@@ -692,8 +714,7 @@ static const yytype_int16 yypgoto[] =
692 714
693/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 715/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
694 positive, shift that token. If negative, reduce the rule which 716 positive, shift that token. If negative, reduce the rule which
695 number is the opposite. If zero, do what YYDEFACT says. 717 number is the opposite. If YYTABLE_NINF, syntax error. */
696 If YYTABLE_NINF, syntax error. */
697#define YYTABLE_NINF -109 718#define YYTABLE_NINF -109
698static const yytype_int16 yytable[] = 719static const yytype_int16 yytable[] =
699{ 720{
@@ -753,6 +774,12 @@ static const yytype_int16 yytable[] =
753 0, 0, 34 774 0, 0, 34
754}; 775};
755 776
777#define yypact_value_is_default(yystate) \
778 ((yystate) == (-135))
779
780#define yytable_value_is_error(yytable_value) \
781 YYID (0)
782
756static const yytype_int16 yycheck[] = 783static const yytype_int16 yycheck[] =
757{ 784{
758 59, 38, 79, 3, 1, 8, 56, 37, 26, 37, 785 59, 38, 79, 3, 1, 8, 56, 37, 26, 37,
@@ -869,7 +896,6 @@ do \
869 { \ 896 { \
870 yychar = (Token); \ 897 yychar = (Token); \
871 yylval = (Value); \ 898 yylval = (Value); \
872 yytoken = YYTRANSLATE (yychar); \
873 YYPOPSTACK (1); \ 899 YYPOPSTACK (1); \
874 goto yybackup; \ 900 goto yybackup; \
875 } \ 901 } \
@@ -911,19 +937,10 @@ while (YYID (0))
911#endif 937#endif
912 938
913 939
914/* YY_LOCATION_PRINT -- Print the location on the stream. 940/* This macro is provided for backward compatibility. */
915 This macro was not mandated originally: define only if we know
916 we won't break user code: when these are the locations we know. */
917 941
918#ifndef YY_LOCATION_PRINT 942#ifndef YY_LOCATION_PRINT
919# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL 943# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
920# define YY_LOCATION_PRINT(File, Loc) \
921 fprintf (File, "%d.%d-%d.%d", \
922 (Loc).first_line, (Loc).first_column, \
923 (Loc).last_line, (Loc).last_column)
924# else
925# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
926# endif
927#endif 944#endif
928 945
929 946
@@ -1115,7 +1132,6 @@ int yydebug;
1115# define YYMAXDEPTH 10000 1132# define YYMAXDEPTH 10000
1116#endif 1133#endif
1117 1134
1118
1119 1135
1120#if YYERROR_VERBOSE 1136#if YYERROR_VERBOSE
1121 1137
@@ -1218,115 +1234,142 @@ yytnamerr (char *yyres, const char *yystr)
1218} 1234}
1219# endif 1235# endif
1220 1236
1221/* Copy into YYRESULT an error message about the unexpected token 1237/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1222 YYCHAR while in state YYSTATE. Return the number of bytes copied, 1238 about the unexpected token YYTOKEN for the state stack whose top is
1223 including the terminating null byte. If YYRESULT is null, do not 1239 YYSSP.
1224 copy anything; just return the number of bytes that would be
1225 copied. As a special case, return 0 if an ordinary "syntax error"
1226 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1227 size calculation. */
1228static YYSIZE_T
1229yysyntax_error (char *yyresult, int yystate, int yychar)
1230{
1231 int yyn = yypact[yystate];
1232 1240
1233 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 1241 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1234 return 0; 1242 not large enough to hold the message. In that case, also set
1235 else 1243 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1244 required number of bytes is too large to store. */
1245static int
1246yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1247 yytype_int16 *yyssp, int yytoken)
1248{
1249 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1250 YYSIZE_T yysize = yysize0;
1251 YYSIZE_T yysize1;
1252 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1253 /* Internationalized format string. */
1254 const char *yyformat = 0;
1255 /* Arguments of yyformat. */
1256 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1257 /* Number of reported tokens (one for the "unexpected", one per
1258 "expected"). */
1259 int yycount = 0;
1260
1261 /* There are many possibilities here to consider:
1262 - Assume YYFAIL is not used. It's too flawed to consider. See
1263 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1264 for details. YYERROR is fine as it does not invoke this
1265 function.
1266 - If this state is a consistent state with a default action, then
1267 the only way this function was invoked is if the default action
1268 is an error action. In that case, don't check for expected
1269 tokens because there are none.
1270 - The only way there can be no lookahead present (in yychar) is if
1271 this state is a consistent state with a default action. Thus,
1272 detecting the absence of a lookahead is sufficient to determine
1273 that there is no unexpected or expected token to report. In that
1274 case, just report a simple "syntax error".
1275 - Don't assume there isn't a lookahead just because this state is a
1276 consistent state with a default action. There might have been a
1277 previous inconsistent state, consistent state with a non-default
1278 action, or user semantic action that manipulated yychar.
1279 - Of course, the expected token list depends on states to have
1280 correct lookahead information, and it depends on the parser not
1281 to perform extra reductions after fetching a lookahead from the
1282 scanner and before detecting a syntax error. Thus, state merging
1283 (from LALR or IELR) and default reductions corrupt the expected
1284 token list. However, the list is correct for canonical LR with
1285 one exception: it will still contain any token that will not be
1286 accepted due to an error action in a later state.
1287 */
1288 if (yytoken != YYEMPTY)
1236 { 1289 {
1237 int yytype = YYTRANSLATE (yychar); 1290 int yyn = yypact[*yyssp];
1238 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 1291 yyarg[yycount++] = yytname[yytoken];
1239 YYSIZE_T yysize = yysize0; 1292 if (!yypact_value_is_default (yyn))
1240 YYSIZE_T yysize1; 1293 {
1241 int yysize_overflow = 0; 1294 /* Start YYX at -YYN if negative to avoid negative indexes in
1242 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1295 YYCHECK. In other words, skip the first -YYN actions for
1243 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1296 this state because they are default actions. */
1244 int yyx; 1297 int yyxbegin = yyn < 0 ? -yyn : 0;
1245 1298 /* Stay within bounds of both yycheck and yytname. */
1246# if 0 1299 int yychecklim = YYLAST - yyn + 1;
1247 /* This is so xgettext sees the translatable formats that are 1300 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1248 constructed on the fly. */ 1301 int yyx;
1249 YY_("syntax error, unexpected %s"); 1302
1250 YY_("syntax error, unexpected %s, expecting %s"); 1303 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1251 YY_("syntax error, unexpected %s, expecting %s or %s"); 1304 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1252 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 1305 && !yytable_value_is_error (yytable[yyx + yyn]))
1253 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 1306 {
1254# endif 1307 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1255 char *yyfmt; 1308 {
1256 char const *yyf; 1309 yycount = 1;
1257 static char const yyunexpected[] = "syntax error, unexpected %s"; 1310 yysize = yysize0;
1258 static char const yyexpecting[] = ", expecting %s"; 1311 break;
1259 static char const yyor[] = " or %s"; 1312 }
1260 char yyformat[sizeof yyunexpected 1313 yyarg[yycount++] = yytname[yyx];
1261 + sizeof yyexpecting - 1 1314 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1262 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 1315 if (! (yysize <= yysize1
1263 * (sizeof yyor - 1))]; 1316 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1264 char const *yyprefix = yyexpecting; 1317 return 2;
1265 1318 yysize = yysize1;
1266 /* Start YYX at -YYN if negative to avoid negative indexes in 1319 }
1267 YYCHECK. */ 1320 }
1268 int yyxbegin = yyn < 0 ? -yyn : 0; 1321 }
1269
1270 /* Stay within bounds of both yycheck and yytname. */
1271 int yychecklim = YYLAST - yyn + 1;
1272 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1273 int yycount = 1;
1274
1275 yyarg[0] = yytname[yytype];
1276 yyfmt = yystpcpy (yyformat, yyunexpected);
1277
1278 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1279 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1280 {
1281 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1282 {
1283 yycount = 1;
1284 yysize = yysize0;
1285 yyformat[sizeof yyunexpected - 1] = '\0';
1286 break;
1287 }
1288 yyarg[yycount++] = yytname[yyx];
1289 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1290 yysize_overflow |= (yysize1 < yysize);
1291 yysize = yysize1;
1292 yyfmt = yystpcpy (yyfmt, yyprefix);
1293 yyprefix = yyor;
1294 }
1295 1322
1296 yyf = YY_(yyformat); 1323 switch (yycount)
1297 yysize1 = yysize + yystrlen (yyf); 1324 {
1298 yysize_overflow |= (yysize1 < yysize); 1325# define YYCASE_(N, S) \
1299 yysize = yysize1; 1326 case N: \
1327 yyformat = S; \
1328 break
1329 YYCASE_(0, YY_("syntax error"));
1330 YYCASE_(1, YY_("syntax error, unexpected %s"));
1331 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1332 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1333 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1334 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1335# undef YYCASE_
1336 }
1300 1337
1301 if (yysize_overflow) 1338 yysize1 = yysize + yystrlen (yyformat);
1302 return YYSIZE_MAXIMUM; 1339 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1340 return 2;
1341 yysize = yysize1;
1303 1342
1304 if (yyresult) 1343 if (*yymsg_alloc < yysize)
1305 { 1344 {
1306 /* Avoid sprintf, as that infringes on the user's name space. 1345 *yymsg_alloc = 2 * yysize;
1307 Don't have undefined behavior even if the translation 1346 if (! (yysize <= *yymsg_alloc
1308 produced a string with the wrong number of "%s"s. */ 1347 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1309 char *yyp = yyresult; 1348 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1310 int yyi = 0; 1349 return 1;
1311 while ((*yyp = *yyf) != '\0')
1312 {
1313 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1314 {
1315 yyp += yytnamerr (yyp, yyarg[yyi++]);
1316 yyf += 2;
1317 }
1318 else
1319 {
1320 yyp++;
1321 yyf++;
1322 }
1323 }
1324 }
1325 return yysize;
1326 } 1350 }
1351
1352 /* Avoid sprintf, as that infringes on the user's name space.
1353 Don't have undefined behavior even if the translation
1354 produced a string with the wrong number of "%s"s. */
1355 {
1356 char *yyp = *yymsg;
1357 int yyi = 0;
1358 while ((*yyp = *yyformat) != '\0')
1359 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1360 {
1361 yyp += yytnamerr (yyp, yyarg[yyi++]);
1362 yyformat += 2;
1363 }
1364 else
1365 {
1366 yyp++;
1367 yyformat++;
1368 }
1369 }
1370 return 0;
1327} 1371}
1328#endif /* YYERROR_VERBOSE */ 1372#endif /* YYERROR_VERBOSE */
1329
1330 1373
1331/*-----------------------------------------------. 1374/*-----------------------------------------------.
1332| Release the memory associated to this symbol. | 1375| Release the memory associated to this symbol. |
@@ -1359,6 +1402,7 @@ yydestruct (yymsg, yytype, yyvaluep)
1359 } 1402 }
1360} 1403}
1361 1404
1405
1362/* Prevent warnings from -Wmissing-prototypes. */ 1406/* Prevent warnings from -Wmissing-prototypes. */
1363#ifdef YYPARSE_PARAM 1407#ifdef YYPARSE_PARAM
1364#if defined __STDC__ || defined __cplusplus 1408#if defined __STDC__ || defined __cplusplus
@@ -1385,10 +1429,9 @@ YYSTYPE yylval;
1385int yynerrs; 1429int yynerrs;
1386 1430
1387 1431
1388 1432/*----------.
1389/*-------------------------. 1433| yyparse. |
1390| yyparse or yypush_parse. | 1434`----------*/
1391`-------------------------*/
1392 1435
1393#ifdef YYPARSE_PARAM 1436#ifdef YYPARSE_PARAM
1394#if (defined __STDC__ || defined __C99__FUNC__ \ 1437#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1412,8 +1455,6 @@ yyparse ()
1412#endif 1455#endif
1413#endif 1456#endif
1414{ 1457{
1415
1416
1417 int yystate; 1458 int yystate;
1418 /* Number of tokens to shift before error messages enabled. */ 1459 /* Number of tokens to shift before error messages enabled. */
1419 int yyerrstatus; 1460 int yyerrstatus;
@@ -1568,7 +1609,7 @@ yybackup:
1568 1609
1569 /* First try to decide what to do without reference to lookahead token. */ 1610 /* First try to decide what to do without reference to lookahead token. */
1570 yyn = yypact[yystate]; 1611 yyn = yypact[yystate];
1571 if (yyn == YYPACT_NINF) 1612 if (yypact_value_is_default (yyn))
1572 goto yydefault; 1613 goto yydefault;
1573 1614
1574 /* Not known => get a lookahead token if don't already have one. */ 1615 /* Not known => get a lookahead token if don't already have one. */
@@ -1599,8 +1640,8 @@ yybackup:
1599 yyn = yytable[yyn]; 1640 yyn = yytable[yyn];
1600 if (yyn <= 0) 1641 if (yyn <= 0)
1601 { 1642 {
1602 if (yyn == 0 || yyn == YYTABLE_NINF) 1643 if (yytable_value_is_error (yyn))
1603 goto yyerrlab; 1644 goto yyerrlab;
1604 yyn = -yyn; 1645 yyn = -yyn;
1605 goto yyreduce; 1646 goto yyreduce;
1606 } 1647 }
@@ -1655,42 +1696,42 @@ yyreduce:
1655 { 1696 {
1656 case 4: 1697 case 4:
1657 1698
1658 { is_typedef = 0; is_extern = 0; current_name = NULL; decl_spec = NULL; ;} 1699 { is_typedef = 0; is_extern = 0; current_name = NULL; decl_spec = NULL; }
1659 break; 1700 break;
1660 1701
1661 case 5: 1702 case 5:
1662 1703
1663 { free_list(*(yyvsp[(2) - (2)]), NULL); *(yyvsp[(2) - (2)]) = NULL; ;} 1704 { free_list(*(yyvsp[(2) - (2)]), NULL); *(yyvsp[(2) - (2)]) = NULL; }
1664 break; 1705 break;
1665 1706
1666 case 6: 1707 case 6:
1667 1708
1668 { is_typedef = 1; ;} 1709 { is_typedef = 1; }
1669 break; 1710 break;
1670 1711
1671 case 7: 1712 case 7:
1672 1713
1673 { (yyval) = (yyvsp[(4) - (4)]); ;} 1714 { (yyval) = (yyvsp[(4) - (4)]); }
1674 break; 1715 break;
1675 1716
1676 case 8: 1717 case 8:
1677 1718
1678 { is_typedef = 1; ;} 1719 { is_typedef = 1; }
1679 break; 1720 break;
1680 1721
1681 case 9: 1722 case 9:
1682 1723
1683 { (yyval) = (yyvsp[(3) - (3)]); ;} 1724 { (yyval) = (yyvsp[(3) - (3)]); }
1684 break; 1725 break;
1685 1726
1686 case 14: 1727 case 14:
1687 1728
1688 { (yyval) = (yyvsp[(2) - (2)]); ;} 1729 { (yyval) = (yyvsp[(2) - (2)]); }
1689 break; 1730 break;
1690 1731
1691 case 15: 1732 case 15:
1692 1733
1693 { (yyval) = (yyvsp[(2) - (2)]); ;} 1734 { (yyval) = (yyvsp[(2) - (2)]); }
1694 break; 1735 break;
1695 1736
1696 case 16: 1737 case 16:
@@ -1704,12 +1745,12 @@ yyreduce:
1704 current_name = NULL; 1745 current_name = NULL;
1705 } 1746 }
1706 (yyval) = (yyvsp[(3) - (3)]); 1747 (yyval) = (yyvsp[(3) - (3)]);
1707 ;} 1748 }
1708 break; 1749 break;
1709 1750
1710 case 17: 1751 case 17:
1711 1752
1712 { (yyval) = NULL; ;} 1753 { (yyval) = NULL; }
1713 break; 1754 break;
1714 1755
1715 case 19: 1756 case 19:
@@ -1720,7 +1761,7 @@ yyreduce:
1720 is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); 1761 is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern);
1721 current_name = NULL; 1762 current_name = NULL;
1722 (yyval) = (yyvsp[(1) - (1)]); 1763 (yyval) = (yyvsp[(1) - (1)]);
1723 ;} 1764 }
1724 break; 1765 break;
1725 1766
1726 case 20: 1767 case 20:
@@ -1733,27 +1774,27 @@ yyreduce:
1733 is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); 1774 is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern);
1734 current_name = NULL; 1775 current_name = NULL;
1735 (yyval) = (yyvsp[(3) - (3)]); 1776 (yyval) = (yyvsp[(3) - (3)]);
1736 ;} 1777 }
1737 break; 1778 break;
1738 1779
1739 case 21: 1780 case 21:
1740 1781
1741 { (yyval) = (yyvsp[(4) - (4)]) ? (yyvsp[(4) - (4)]) : (yyvsp[(3) - (4)]) ? (yyvsp[(3) - (4)]) : (yyvsp[(2) - (4)]) ? (yyvsp[(2) - (4)]) : (yyvsp[(1) - (4)]); ;} 1782 { (yyval) = (yyvsp[(4) - (4)]) ? (yyvsp[(4) - (4)]) : (yyvsp[(3) - (4)]) ? (yyvsp[(3) - (4)]) : (yyvsp[(2) - (4)]) ? (yyvsp[(2) - (4)]) : (yyvsp[(1) - (4)]); }
1742 break; 1783 break;
1743 1784
1744 case 22: 1785 case 22:
1745 1786
1746 { decl_spec = NULL; ;} 1787 { decl_spec = NULL; }
1747 break; 1788 break;
1748 1789
1749 case 24: 1790 case 24:
1750 1791
1751 { decl_spec = *(yyvsp[(1) - (1)]); ;} 1792 { decl_spec = *(yyvsp[(1) - (1)]); }
1752 break; 1793 break;
1753 1794
1754 case 25: 1795 case 25:
1755 1796
1756 { decl_spec = *(yyvsp[(2) - (2)]); ;} 1797 { decl_spec = *(yyvsp[(2) - (2)]); }
1757 break; 1798 break;
1758 1799
1759 case 26: 1800 case 26:
@@ -1762,97 +1803,82 @@ yyreduce:
1762 is really irrelevant to the linkage. */ 1803 is really irrelevant to the linkage. */
1763 remove_node((yyvsp[(1) - (1)])); 1804 remove_node((yyvsp[(1) - (1)]));
1764 (yyval) = (yyvsp[(1) - (1)]); 1805 (yyval) = (yyvsp[(1) - (1)]);
1765 ;} 1806 }
1766 break; 1807 break;
1767 1808
1768 case 31: 1809 case 31:
1769 1810
1770 { is_extern = 1; (yyval) = (yyvsp[(1) - (1)]); ;} 1811 { is_extern = 1; (yyval) = (yyvsp[(1) - (1)]); }
1771 break; 1812 break;
1772 1813
1773 case 32: 1814 case 32:
1774 1815
1775 { is_extern = 0; (yyval) = (yyvsp[(1) - (1)]); ;} 1816 { is_extern = 0; (yyval) = (yyvsp[(1) - (1)]); }
1776 break; 1817 break;
1777 1818
1778 case 37: 1819 case 37:
1779 1820
1780 { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_STRUCT; (yyval) = (yyvsp[(2) - (2)]); ;} 1821 { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_STRUCT; (yyval) = (yyvsp[(2) - (2)]); }
1781 break; 1822 break;
1782 1823
1783 case 38: 1824 case 38:
1784 1825
1785 { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_UNION; (yyval) = (yyvsp[(2) - (2)]); ;} 1826 { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_UNION; (yyval) = (yyvsp[(2) - (2)]); }
1786 break; 1827 break;
1787 1828
1788 case 39: 1829 case 39:
1789 1830
1790 { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_ENUM; (yyval) = (yyvsp[(2) - (2)]); ;} 1831 { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_ENUM; (yyval) = (yyvsp[(2) - (2)]); }
1791 break; 1832 break;
1792 1833
1793 case 40: 1834 case 40:
1794 1835
1795 { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r; 1836 { record_compound((yyvsp[(1) - (3)]), (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)]), SYM_STRUCT); (yyval) = (yyvsp[(3) - (3)]); }
1796 r = copy_node(i); r->tag = SYM_STRUCT;
1797 r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL;
1798 add_symbol(i->string, SYM_STRUCT, s, is_extern);
1799 (yyval) = (yyvsp[(3) - (3)]);
1800 ;}
1801 break; 1837 break;
1802 1838
1803 case 41: 1839 case 41:
1804 1840
1805 { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r; 1841 { record_compound((yyvsp[(1) - (3)]), (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)]), SYM_UNION); (yyval) = (yyvsp[(3) - (3)]); }
1806 r = copy_node(i); r->tag = SYM_UNION;
1807 r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL;
1808 add_symbol(i->string, SYM_UNION, s, is_extern);
1809 (yyval) = (yyvsp[(3) - (3)]);
1810 ;}
1811 break; 1842 break;
1812 1843
1813 case 42: 1844 case 42:
1814 1845
1815 { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r; 1846 { record_compound((yyvsp[(1) - (3)]), (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)]), SYM_ENUM); (yyval) = (yyvsp[(3) - (3)]); }
1816 r = copy_node(i); r->tag = SYM_ENUM;
1817 r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL;
1818 add_symbol(i->string, SYM_ENUM, s, is_extern);
1819 (yyval) = (yyvsp[(3) - (3)]);
1820 ;}
1821 break; 1847 break;
1822 1848
1823 case 43: 1849 case 43:
1824 1850
1825 { add_symbol(NULL, SYM_ENUM, NULL, 0); (yyval) = (yyvsp[(2) - (2)]); ;} 1851 { add_symbol(NULL, SYM_ENUM, NULL, 0); (yyval) = (yyvsp[(2) - (2)]); }
1826 break; 1852 break;
1827 1853
1828 case 44: 1854 case 44:
1829 1855
1830 { (yyval) = (yyvsp[(2) - (2)]); ;} 1856 { (yyval) = (yyvsp[(2) - (2)]); }
1831 break; 1857 break;
1832 1858
1833 case 45: 1859 case 45:
1834 1860
1835 { (yyval) = (yyvsp[(2) - (2)]); ;} 1861 { (yyval) = (yyvsp[(2) - (2)]); }
1836 break; 1862 break;
1837 1863
1838 case 56: 1864 case 56:
1839 1865
1840 { (*(yyvsp[(1) - (1)]))->tag = SYM_TYPEDEF; (yyval) = (yyvsp[(1) - (1)]); ;} 1866 { (*(yyvsp[(1) - (1)]))->tag = SYM_TYPEDEF; (yyval) = (yyvsp[(1) - (1)]); }
1841 break; 1867 break;
1842 1868
1843 case 57: 1869 case 57:
1844 1870
1845 { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} 1871 { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); }
1846 break; 1872 break;
1847 1873
1848 case 58: 1874 case 58:
1849 1875
1850 { (yyval) = NULL; ;} 1876 { (yyval) = NULL; }
1851 break; 1877 break;
1852 1878
1853 case 61: 1879 case 61:
1854 1880
1855 { (yyval) = (yyvsp[(2) - (2)]); ;} 1881 { (yyval) = (yyvsp[(2) - (2)]); }
1856 break; 1882 break;
1857 1883
1858 case 65: 1884 case 65:
@@ -1860,12 +1886,12 @@ yyreduce:
1860 { /* restrict has no effect in prototypes so ignore it */ 1886 { /* restrict has no effect in prototypes so ignore it */
1861 remove_node((yyvsp[(1) - (1)])); 1887 remove_node((yyvsp[(1) - (1)]));
1862 (yyval) = (yyvsp[(1) - (1)]); 1888 (yyval) = (yyvsp[(1) - (1)]);
1863 ;} 1889 }
1864 break; 1890 break;
1865 1891
1866 case 66: 1892 case 66:
1867 1893
1868 { (yyval) = (yyvsp[(2) - (2)]); ;} 1894 { (yyval) = (yyvsp[(2) - (2)]); }
1869 break; 1895 break;
1870 1896
1871 case 68: 1897 case 68:
@@ -1877,97 +1903,97 @@ yyreduce:
1877 current_name = (*(yyvsp[(1) - (1)]))->string; 1903 current_name = (*(yyvsp[(1) - (1)]))->string;
1878 (yyval) = (yyvsp[(1) - (1)]); 1904 (yyval) = (yyvsp[(1) - (1)]);
1879 } 1905 }
1880 ;} 1906 }
1881 break; 1907 break;
1882 1908
1883 case 69: 1909 case 69:
1884 1910
1885 { (yyval) = (yyvsp[(4) - (4)]); ;} 1911 { (yyval) = (yyvsp[(4) - (4)]); }
1886 break; 1912 break;
1887 1913
1888 case 70: 1914 case 70:
1889 1915
1890 { (yyval) = (yyvsp[(4) - (4)]); ;} 1916 { (yyval) = (yyvsp[(4) - (4)]); }
1891 break; 1917 break;
1892 1918
1893 case 71: 1919 case 71:
1894 1920
1895 { (yyval) = (yyvsp[(2) - (2)]); ;} 1921 { (yyval) = (yyvsp[(2) - (2)]); }
1896 break; 1922 break;
1897 1923
1898 case 72: 1924 case 72:
1899 1925
1900 { (yyval) = (yyvsp[(3) - (3)]); ;} 1926 { (yyval) = (yyvsp[(3) - (3)]); }
1901 break; 1927 break;
1902 1928
1903 case 73: 1929 case 73:
1904 1930
1905 { (yyval) = (yyvsp[(3) - (3)]); ;} 1931 { (yyval) = (yyvsp[(3) - (3)]); }
1906 break; 1932 break;
1907 1933
1908 case 74: 1934 case 74:
1909 1935
1910 { (yyval) = (yyvsp[(2) - (2)]); ;} 1936 { (yyval) = (yyvsp[(2) - (2)]); }
1911 break; 1937 break;
1912 1938
1913 case 78: 1939 case 78:
1914 1940
1915 { (yyval) = (yyvsp[(4) - (4)]); ;} 1941 { (yyval) = (yyvsp[(4) - (4)]); }
1916 break; 1942 break;
1917 1943
1918 case 79: 1944 case 79:
1919 1945
1920 { (yyval) = (yyvsp[(4) - (4)]); ;} 1946 { (yyval) = (yyvsp[(4) - (4)]); }
1921 break; 1947 break;
1922 1948
1923 case 80: 1949 case 80:
1924 1950
1925 { (yyval) = (yyvsp[(2) - (2)]); ;} 1951 { (yyval) = (yyvsp[(2) - (2)]); }
1926 break; 1952 break;
1927 1953
1928 case 81: 1954 case 81:
1929 1955
1930 { (yyval) = (yyvsp[(3) - (3)]); ;} 1956 { (yyval) = (yyvsp[(3) - (3)]); }
1931 break; 1957 break;
1932 1958
1933 case 82: 1959 case 82:
1934 1960
1935 { (yyval) = (yyvsp[(3) - (3)]); ;} 1961 { (yyval) = (yyvsp[(3) - (3)]); }
1936 break; 1962 break;
1937 1963
1938 case 83: 1964 case 83:
1939 1965
1940 { (yyval) = (yyvsp[(2) - (2)]); ;} 1966 { (yyval) = (yyvsp[(2) - (2)]); }
1941 break; 1967 break;
1942 1968
1943 case 85: 1969 case 85:
1944 1970
1945 { (yyval) = (yyvsp[(3) - (3)]); ;} 1971 { (yyval) = (yyvsp[(3) - (3)]); }
1946 break; 1972 break;
1947 1973
1948 case 86: 1974 case 86:
1949 1975
1950 { (yyval) = NULL; ;} 1976 { (yyval) = NULL; }
1951 break; 1977 break;
1952 1978
1953 case 89: 1979 case 89:
1954 1980
1955 { (yyval) = (yyvsp[(3) - (3)]); ;} 1981 { (yyval) = (yyvsp[(3) - (3)]); }
1956 break; 1982 break;
1957 1983
1958 case 90: 1984 case 90:
1959 1985
1960 { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} 1986 { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); }
1961 break; 1987 break;
1962 1988
1963 case 91: 1989 case 91:
1964 1990
1965 { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} 1991 { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); }
1966 break; 1992 break;
1967 1993
1968 case 93: 1994 case 93:
1969 1995
1970 { (yyval) = NULL; ;} 1996 { (yyval) = NULL; }
1971 break; 1997 break;
1972 1998
1973 case 94: 1999 case 94:
@@ -1976,39 +2002,39 @@ yyreduce:
1976 private parameter names. */ 2002 private parameter names. */
1977 remove_node((yyvsp[(1) - (1)])); 2003 remove_node((yyvsp[(1) - (1)]));
1978 (yyval) = (yyvsp[(1) - (1)]); 2004 (yyval) = (yyvsp[(1) - (1)]);
1979 ;} 2005 }
1980 break; 2006 break;
1981 2007
1982 case 95: 2008 case 95:
1983 2009
1984 { remove_node((yyvsp[(1) - (1)])); 2010 { remove_node((yyvsp[(1) - (1)]));
1985 (yyval) = (yyvsp[(1) - (1)]); 2011 (yyval) = (yyvsp[(1) - (1)]);
1986 ;} 2012 }
1987 break; 2013 break;
1988 2014
1989 case 96: 2015 case 96:
1990 2016
1991 { (yyval) = (yyvsp[(4) - (4)]); ;} 2017 { (yyval) = (yyvsp[(4) - (4)]); }
1992 break; 2018 break;
1993 2019
1994 case 97: 2020 case 97:
1995 2021
1996 { (yyval) = (yyvsp[(4) - (4)]); ;} 2022 { (yyval) = (yyvsp[(4) - (4)]); }
1997 break; 2023 break;
1998 2024
1999 case 98: 2025 case 98:
2000 2026
2001 { (yyval) = (yyvsp[(2) - (2)]); ;} 2027 { (yyval) = (yyvsp[(2) - (2)]); }
2002 break; 2028 break;
2003 2029
2004 case 99: 2030 case 99:
2005 2031
2006 { (yyval) = (yyvsp[(3) - (3)]); ;} 2032 { (yyval) = (yyvsp[(3) - (3)]); }
2007 break; 2033 break;
2008 2034
2009 case 100: 2035 case 100:
2010 2036
2011 { (yyval) = (yyvsp[(3) - (3)]); ;} 2037 { (yyval) = (yyvsp[(3) - (3)]); }
2012 break; 2038 break;
2013 2039
2014 case 101: 2040 case 101:
@@ -2017,87 +2043,87 @@ yyreduce:
2017 *(yyvsp[(2) - (3)]) = NULL; 2043 *(yyvsp[(2) - (3)]) = NULL;
2018 add_symbol(current_name, SYM_NORMAL, decl, is_extern); 2044 add_symbol(current_name, SYM_NORMAL, decl, is_extern);
2019 (yyval) = (yyvsp[(3) - (3)]); 2045 (yyval) = (yyvsp[(3) - (3)]);
2020 ;} 2046 }
2021 break; 2047 break;
2022 2048
2023 case 102: 2049 case 102:
2024 2050
2025 { (yyval) = NULL; ;} 2051 { (yyval) = NULL; }
2026 break; 2052 break;
2027 2053
2028 case 104: 2054 case 104:
2029 2055
2030 { remove_list((yyvsp[(2) - (2)]), &(*(yyvsp[(1) - (2)]))->next); (yyval) = (yyvsp[(2) - (2)]); ;} 2056 { remove_list((yyvsp[(2) - (2)]), &(*(yyvsp[(1) - (2)]))->next); (yyval) = (yyvsp[(2) - (2)]); }
2031 break; 2057 break;
2032 2058
2033 case 105: 2059 case 105:
2034 2060
2035 { (yyval) = (yyvsp[(3) - (3)]); ;} 2061 { (yyval) = (yyvsp[(3) - (3)]); }
2036 break; 2062 break;
2037 2063
2038 case 106: 2064 case 106:
2039 2065
2040 { (yyval) = (yyvsp[(3) - (3)]); ;} 2066 { (yyval) = (yyvsp[(3) - (3)]); }
2041 break; 2067 break;
2042 2068
2043 case 107: 2069 case 107:
2044 2070
2045 { (yyval) = NULL; ;} 2071 { (yyval) = NULL; }
2046 break; 2072 break;
2047 2073
2048 case 110: 2074 case 110:
2049 2075
2050 { (yyval) = (yyvsp[(2) - (2)]); ;} 2076 { (yyval) = (yyvsp[(2) - (2)]); }
2051 break; 2077 break;
2052 2078
2053 case 111: 2079 case 111:
2054 2080
2055 { (yyval) = (yyvsp[(3) - (3)]); ;} 2081 { (yyval) = (yyvsp[(3) - (3)]); }
2056 break; 2082 break;
2057 2083
2058 case 112: 2084 case 112:
2059 2085
2060 { (yyval) = (yyvsp[(2) - (2)]); ;} 2086 { (yyval) = (yyvsp[(2) - (2)]); }
2061 break; 2087 break;
2062 2088
2063 case 113: 2089 case 113:
2064 2090
2065 { (yyval) = NULL; ;} 2091 { (yyval) = NULL; }
2066 break; 2092 break;
2067 2093
2068 case 116: 2094 case 116:
2069 2095
2070 { (yyval) = (yyvsp[(3) - (3)]); ;} 2096 { (yyval) = (yyvsp[(3) - (3)]); }
2071 break; 2097 break;
2072 2098
2073 case 117: 2099 case 117:
2074 2100
2075 { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;} 2101 { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); }
2076 break; 2102 break;
2077 2103
2078 case 118: 2104 case 118:
2079 2105
2080 { (yyval) = (yyvsp[(2) - (2)]); ;} 2106 { (yyval) = (yyvsp[(2) - (2)]); }
2081 break; 2107 break;
2082 2108
2083 case 120: 2109 case 120:
2084 2110
2085 { (yyval) = (yyvsp[(2) - (2)]); ;} 2111 { (yyval) = (yyvsp[(2) - (2)]); }
2086 break; 2112 break;
2087 2113
2088 case 121: 2114 case 121:
2089 2115
2090 { (yyval) = NULL; ;} 2116 { (yyval) = NULL; }
2091 break; 2117 break;
2092 2118
2093 case 123: 2119 case 123:
2094 2120
2095 { (yyval) = (yyvsp[(3) - (3)]); ;} 2121 { (yyval) = (yyvsp[(3) - (3)]); }
2096 break; 2122 break;
2097 2123
2098 case 124: 2124 case 124:
2099 2125
2100 { (yyval) = (yyvsp[(4) - (4)]); ;} 2126 { (yyval) = (yyvsp[(4) - (4)]); }
2101 break; 2127 break;
2102 2128
2103 case 127: 2129 case 127:
@@ -2105,7 +2131,7 @@ yyreduce:
2105 { 2131 {
2106 const char *name = strdup((*(yyvsp[(1) - (1)]))->string); 2132 const char *name = strdup((*(yyvsp[(1) - (1)]))->string);
2107 add_symbol(name, SYM_ENUM_CONST, NULL, 0); 2133 add_symbol(name, SYM_ENUM_CONST, NULL, 0);
2108 ;} 2134 }
2109 break; 2135 break;
2110 2136
2111 case 128: 2137 case 128:
@@ -2114,28 +2140,39 @@ yyreduce:
2114 const char *name = strdup((*(yyvsp[(1) - (3)]))->string); 2140 const char *name = strdup((*(yyvsp[(1) - (3)]))->string);
2115 struct string_list *expr = copy_list_range(*(yyvsp[(3) - (3)]), *(yyvsp[(2) - (3)])); 2141 struct string_list *expr = copy_list_range(*(yyvsp[(3) - (3)]), *(yyvsp[(2) - (3)]));
2116 add_symbol(name, SYM_ENUM_CONST, expr, 0); 2142 add_symbol(name, SYM_ENUM_CONST, expr, 0);
2117 ;} 2143 }
2118 break; 2144 break;
2119 2145
2120 case 129: 2146 case 129:
2121 2147
2122 { (yyval) = (yyvsp[(2) - (2)]); ;} 2148 { (yyval) = (yyvsp[(2) - (2)]); }
2123 break; 2149 break;
2124 2150
2125 case 130: 2151 case 130:
2126 2152
2127 { (yyval) = NULL; ;} 2153 { (yyval) = NULL; }
2128 break; 2154 break;
2129 2155
2130 case 132: 2156 case 132:
2131 2157
2132 { export_symbol((*(yyvsp[(3) - (5)]))->string); (yyval) = (yyvsp[(5) - (5)]); ;} 2158 { export_symbol((*(yyvsp[(3) - (5)]))->string); (yyval) = (yyvsp[(5) - (5)]); }
2133 break; 2159 break;
2134 2160
2135 2161
2136 2162
2137 default: break; 2163 default: break;
2138 } 2164 }
2165 /* User semantic actions sometimes alter yychar, and that requires
2166 that yytoken be updated with the new translation. We take the
2167 approach of translating immediately before every use of yytoken.
2168 One alternative is translating here after every semantic action,
2169 but that translation would be missed if the semantic action invokes
2170 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2171 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2172 incorrect destructor might then be invoked immediately. In the
2173 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2174 to an incorrect destructor call or verbose syntax error message
2175 before the lookahead is translated. */
2139 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 2176 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2140 2177
2141 YYPOPSTACK (yylen); 2178 YYPOPSTACK (yylen);
@@ -2163,6 +2200,10 @@ yyreduce:
2163| yyerrlab -- here on detecting error | 2200| yyerrlab -- here on detecting error |
2164`------------------------------------*/ 2201`------------------------------------*/
2165yyerrlab: 2202yyerrlab:
2203 /* Make sure we have latest lookahead translation. See comments at
2204 user semantic actions for why this is necessary. */
2205 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2206
2166 /* If not already recovering from an error, report this error. */ 2207 /* If not already recovering from an error, report this error. */
2167 if (!yyerrstatus) 2208 if (!yyerrstatus)
2168 { 2209 {
@@ -2170,37 +2211,36 @@ yyerrlab:
2170#if ! YYERROR_VERBOSE 2211#if ! YYERROR_VERBOSE
2171 yyerror (YY_("syntax error")); 2212 yyerror (YY_("syntax error"));
2172#else 2213#else
2214# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2215 yyssp, yytoken)
2173 { 2216 {
2174 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 2217 char const *yymsgp = YY_("syntax error");
2175 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 2218 int yysyntax_error_status;
2176 { 2219 yysyntax_error_status = YYSYNTAX_ERROR;
2177 YYSIZE_T yyalloc = 2 * yysize; 2220 if (yysyntax_error_status == 0)
2178 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 2221 yymsgp = yymsg;
2179 yyalloc = YYSTACK_ALLOC_MAXIMUM; 2222 else if (yysyntax_error_status == 1)
2180 if (yymsg != yymsgbuf) 2223 {
2181 YYSTACK_FREE (yymsg); 2224 if (yymsg != yymsgbuf)
2182 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 2225 YYSTACK_FREE (yymsg);
2183 if (yymsg) 2226 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2184 yymsg_alloc = yyalloc; 2227 if (!yymsg)
2185 else 2228 {
2186 { 2229 yymsg = yymsgbuf;
2187 yymsg = yymsgbuf; 2230 yymsg_alloc = sizeof yymsgbuf;
2188 yymsg_alloc = sizeof yymsgbuf; 2231 yysyntax_error_status = 2;
2189 } 2232 }
2190 } 2233 else
2191 2234 {
2192 if (0 < yysize && yysize <= yymsg_alloc) 2235 yysyntax_error_status = YYSYNTAX_ERROR;
2193 { 2236 yymsgp = yymsg;
2194 (void) yysyntax_error (yymsg, yystate, yychar); 2237 }
2195 yyerror (yymsg); 2238 }
2196 } 2239 yyerror (yymsgp);
2197 else 2240 if (yysyntax_error_status == 2)
2198 { 2241 goto yyexhaustedlab;
2199 yyerror (YY_("syntax error"));
2200 if (yysize != 0)
2201 goto yyexhaustedlab;
2202 }
2203 } 2242 }
2243# undef YYSYNTAX_ERROR
2204#endif 2244#endif
2205 } 2245 }
2206 2246
@@ -2259,7 +2299,7 @@ yyerrlab1:
2259 for (;;) 2299 for (;;)
2260 { 2300 {
2261 yyn = yypact[yystate]; 2301 yyn = yypact[yystate];
2262 if (yyn != YYPACT_NINF) 2302 if (!yypact_value_is_default (yyn))
2263 { 2303 {
2264 yyn += YYTERROR; 2304 yyn += YYTERROR;
2265 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2305 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -2318,8 +2358,13 @@ yyexhaustedlab:
2318 2358
2319yyreturn: 2359yyreturn:
2320 if (yychar != YYEMPTY) 2360 if (yychar != YYEMPTY)
2321 yydestruct ("Cleanup: discarding lookahead", 2361 {
2322 yytoken, &yylval); 2362 /* Make sure we have latest lookahead translation. See comments at
2363 user semantic actions for why this is necessary. */
2364 yytoken = YYTRANSLATE (yychar);
2365 yydestruct ("Cleanup: discarding lookahead",
2366 yytoken, &yylval);
2367 }
2323 /* Do not reclaim the symbols of the rule which action triggered 2368 /* Do not reclaim the symbols of the rule which action triggered
2324 this YYABORT or YYACCEPT. */ 2369 this YYABORT or YYACCEPT. */
2325 YYPOPSTACK (yylen); 2370 YYPOPSTACK (yylen);
diff --git a/scripts/genksyms/parse.tab.h_shipped b/scripts/genksyms/parse.tab.h_shipped
index 350c2b403e21..93240a3cdecc 100644
--- a/scripts/genksyms/parse.tab.h_shipped
+++ b/scripts/genksyms/parse.tab.h_shipped
@@ -1,9 +1,8 @@
1/* A Bison parser, made by GNU Bison 2.4.3. */ 1/* A Bison parser, made by GNU Bison 2.5. */
2 2
3/* Skeleton interface for Bison's Yacc-like parsers in C 3/* Bison interface for Yacc-like parsers in C
4 4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
6 2009, 2010 Free Software Foundation, Inc.
7 6
8 This program is free software: you can redistribute it and/or modify 7 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y
index ba5c242866c1..23c39998ad86 100644
--- a/scripts/genksyms/parse.y
+++ b/scripts/genksyms/parse.y
@@ -51,6 +51,25 @@ remove_list(struct string_list **pb, struct string_list **pe)
51 free_list(b, e); 51 free_list(b, e);
52} 52}
53 53
54/* Record definition of a struct/union/enum */
55static void record_compound(struct string_list **keyw,
56 struct string_list **ident,
57 struct string_list **body,
58 enum symbol_type type)
59{
60 struct string_list *b = *body, *i = *ident, *r;
61
62 if (i->in_source_file) {
63 remove_node(keyw);
64 (*ident)->tag = type;
65 remove_list(body, ident);
66 return;
67 }
68 r = copy_node(i); r->tag = type;
69 r->next = (*keyw)->next; *body = r; (*keyw)->next = NULL;
70 add_symbol(i->string, type, b, is_extern);
71}
72
54%} 73%}
55 74
56%token ASM_KEYW 75%token ASM_KEYW
@@ -215,26 +234,11 @@ type_specifier:
215 234
216 /* Full definitions of an s/u/e. Record it. */ 235 /* Full definitions of an s/u/e. Record it. */
217 | STRUCT_KEYW IDENT class_body 236 | STRUCT_KEYW IDENT class_body
218 { struct string_list *s = *$3, *i = *$2, *r; 237 { record_compound($1, $2, $3, SYM_STRUCT); $$ = $3; }
219 r = copy_node(i); r->tag = SYM_STRUCT;
220 r->next = (*$1)->next; *$3 = r; (*$1)->next = NULL;
221 add_symbol(i->string, SYM_STRUCT, s, is_extern);
222 $$ = $3;
223 }
224 | UNION_KEYW IDENT class_body 238 | UNION_KEYW IDENT class_body
225 { struct string_list *s = *$3, *i = *$2, *r; 239 { record_compound($1, $2, $3, SYM_UNION); $$ = $3; }
226 r = copy_node(i); r->tag = SYM_UNION;
227 r->next = (*$1)->next; *$3 = r; (*$1)->next = NULL;
228 add_symbol(i->string, SYM_UNION, s, is_extern);
229 $$ = $3;
230 }
231 | ENUM_KEYW IDENT enum_body 240 | ENUM_KEYW IDENT enum_body
232 { struct string_list *s = *$3, *i = *$2, *r; 241 { record_compound($1, $2, $3, SYM_ENUM); $$ = $3; }
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 /* 242 /*
239 * Anonymous enum definition. Tell add_symbol() to restart its counter. 243 * Anonymous enum definition. Tell add_symbol() to restart its counter.
240 */ 244 */
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 82d2eb285b70..ba573fe7c74d 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -33,17 +33,9 @@ silentoldconfig: $(obj)/conf
33 $(Q)mkdir -p include/generated 33 $(Q)mkdir -p include/generated
34 $< --$@ $(Kconfig) 34 $< --$@ $(Kconfig)
35 35
36# if no path is given, then use src directory to find file 36localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
37ifdef LSMOD
38LSMOD_F := $(LSMOD)
39ifeq ($(findstring /,$(LSMOD)),)
40 LSMOD_F := $(objtree)/$(LSMOD)
41endif
42endif
43
44localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
45 $(Q)mkdir -p include/generated 37 $(Q)mkdir -p include/generated
46 $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config 38 $(Q)perl $< --$@ $(srctree) $(Kconfig) > .tmp.config
47 $(Q)if [ -f .config ]; then \ 39 $(Q)if [ -f .config ]; then \
48 cmp -s .tmp.config .config || \ 40 cmp -s .tmp.config .config || \
49 (mv -f .config .config.old.1; \ 41 (mv -f .config .config.old.1; \
@@ -56,22 +48,6 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
56 fi 48 fi
57 $(Q)rm -f .tmp.config 49 $(Q)rm -f .tmp.config
58 50
59localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
60 $(Q)mkdir -p include/generated
61 $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
62 $(Q)sed -i s/=m/=y/ .tmp.config
63 $(Q)if [ -f .config ]; then \
64 cmp -s .tmp.config .config || \
65 (mv -f .config .config.old.1; \
66 mv -f .tmp.config .config; \
67 $(obj)/conf --silentoldconfig $(Kconfig); \
68 mv -f .config.old.1 .config.old) \
69 else \
70 mv -f .tmp.config .config; \
71 $(obj)/conf --silentoldconfig $(Kconfig); \
72 fi
73 $(Q)rm -f .tmp.config
74
75# Create new linux.pot file 51# Create new linux.pot file
76# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files 52# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
77# The symlink is used to repair a deficiency in arch/um 53# The symlink is used to repair a deficiency in arch/um
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 59b667cae5f3..5a58965d8800 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -503,17 +503,6 @@ header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
503 fprintf(fp, "#define %s%s%s 1\n", 503 fprintf(fp, "#define %s%s%s 1\n",
504 CONFIG_, sym->name, suffix); 504 CONFIG_, sym->name, suffix);
505 } 505 }
506 /*
507 * Generate the __enabled_CONFIG_* and
508 * __enabled_CONFIG_*_MODULE macros for use by the
509 * IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is
510 * generated even for booleans so that the IS_ENABLED() macro
511 * works.
512 */
513 fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n",
514 sym->name, (*value == 'y'));
515 fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n",
516 sym->name, (*value == 'm'));
517 break; 506 break;
518 } 507 }
519 case S_HEX: { 508 case S_HEX: {
@@ -565,6 +554,35 @@ static struct conf_printer header_printer_cb =
565}; 554};
566 555
567/* 556/*
557 * Generate the __enabled_CONFIG_* and __enabled_CONFIG_*_MODULE macros for
558 * use by the IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is
559 * generated even for booleans so that the IS_ENABLED() macro works.
560 */
561static void
562header_print__enabled_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
563{
564
565 switch (sym->type) {
566 case S_BOOLEAN:
567 case S_TRISTATE: {
568 fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n",
569 sym->name, (*value == 'y'));
570 fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n",
571 sym->name, (*value == 'm'));
572 break;
573 }
574 default:
575 break;
576 }
577}
578
579static struct conf_printer header__enabled_printer_cb =
580{
581 .print_symbol = header_print__enabled_symbol,
582 .print_comment = header_print_comment,
583};
584
585/*
568 * Tristate printer 586 * Tristate printer
569 * 587 *
570 * This printer is used when generating the `include/config/tristate.conf' file. 588 * This printer is used when generating the `include/config/tristate.conf' file.
@@ -945,11 +963,16 @@ int conf_write_autoconf(void)
945 conf_write_heading(out_h, &header_printer_cb, NULL); 963 conf_write_heading(out_h, &header_printer_cb, NULL);
946 964
947 for_all_symbols(i, sym) { 965 for_all_symbols(i, sym) {
966 if (!sym->name)
967 continue;
968
948 sym_calc_value(sym); 969 sym_calc_value(sym);
949 if (!(sym->flags & SYMBOL_WRITE) || !sym->name) 970
971 conf_write_symbol(out_h, sym, &header__enabled_printer_cb, NULL);
972
973 if (!(sym->flags & SYMBOL_WRITE))
950 continue; 974 continue;
951 975
952 /* write symbol to auto.conf, tristate and header files */
953 conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); 976 conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1);
954 977
955 conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); 978 conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1);
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c
index c704712d0227..154c2dd245b7 100644
--- a/scripts/kconfig/lxdialog/textbox.c
+++ b/scripts/kconfig/lxdialog/textbox.c
@@ -320,7 +320,6 @@ static void print_page(WINDOW * win, int height, int width)
320 */ 320 */
321static void print_line(WINDOW * win, int row, int width) 321static void print_line(WINDOW * win, int row, int width)
322{ 322{
323 int y, x;
324 char *line; 323 char *line;
325 324
326 line = get_line(); 325 line = get_line();
@@ -329,10 +328,10 @@ static void print_line(WINDOW * win, int row, int width)
329 waddch(win, ' '); 328 waddch(win, ' ');
330 waddnstr(win, line, MIN(strlen(line), width - 2)); 329 waddnstr(win, line, MIN(strlen(line), width - 2));
331 330
332 getyx(win, y, x);
333 /* Clear 'residue' of previous line */ 331 /* Clear 'residue' of previous line */
334#if OLD_NCURSES 332#if OLD_NCURSES
335 { 333 {
334 int x = getcurx(win);
336 int i; 335 int i;
337 for (i = 0; i < width - x; i++) 336 for (i = 0; i < width - x; i++)
338 waddch(win, ' '); 337 waddch(win, ' ');
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 820d2b6800fb..19e200d91120 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -15,6 +15,7 @@
15#include <stdarg.h> 15#include <stdarg.h>
16#include <stdlib.h> 16#include <stdlib.h>
17#include <string.h> 17#include <string.h>
18#include <signal.h>
18#include <unistd.h> 19#include <unistd.h>
19#include <locale.h> 20#include <locale.h>
20 21
@@ -272,6 +273,7 @@ static struct menu *current_menu;
272static int child_count; 273static int child_count;
273static int single_menu_mode; 274static int single_menu_mode;
274static int show_all_options; 275static int show_all_options;
276static int saved_x, saved_y;
275 277
276static void conf(struct menu *menu); 278static void conf(struct menu *menu);
277static void conf_choice(struct menu *menu); 279static void conf_choice(struct menu *menu);
@@ -792,9 +794,54 @@ static void conf_save(void)
792 } 794 }
793} 795}
794 796
797static int handle_exit(void)
798{
799 int res;
800
801 dialog_clear();
802 if (conf_get_changed())
803 res = dialog_yesno(NULL,
804 _("Do you wish to save your new configuration ?\n"
805 "<ESC><ESC> to continue."),
806 6, 60);
807 else
808 res = -1;
809
810 end_dialog(saved_x, saved_y);
811
812 switch (res) {
813 case 0:
814 if (conf_write(filename)) {
815 fprintf(stderr, _("\n\n"
816 "Error while writing of the configuration.\n"
817 "Your configuration changes were NOT saved."
818 "\n\n"));
819 return 1;
820 }
821 /* fall through */
822 case -1:
823 printf(_("\n\n"
824 "*** End of the configuration.\n"
825 "*** Execute 'make' to start the build or try 'make help'."
826 "\n\n"));
827 res = 0;
828 break;
829 default:
830 fprintf(stderr, _("\n\n"
831 "Your configuration changes were NOT saved."
832 "\n\n"));
833 }
834
835 return res;
836}
837
838static void sig_handler(int signo)
839{
840 exit(handle_exit());
841}
842
795int main(int ac, char **av) 843int main(int ac, char **av)
796{ 844{
797 int saved_x, saved_y;
798 char *mode; 845 char *mode;
799 int res; 846 int res;
800 847
@@ -802,6 +849,8 @@ int main(int ac, char **av)
802 bindtextdomain(PACKAGE, LOCALEDIR); 849 bindtextdomain(PACKAGE, LOCALEDIR);
803 textdomain(PACKAGE); 850 textdomain(PACKAGE);
804 851
852 signal(SIGINT, sig_handler);
853
805 conf_parse(av[1]); 854 conf_parse(av[1]);
806 conf_read(NULL); 855 conf_read(NULL);
807 856
@@ -823,40 +872,9 @@ int main(int ac, char **av)
823 set_config_filename(conf_get_configname()); 872 set_config_filename(conf_get_configname());
824 do { 873 do {
825 conf(&rootmenu); 874 conf(&rootmenu);
826 dialog_clear(); 875 res = handle_exit();
827 if (conf_get_changed())
828 res = dialog_yesno(NULL,
829 _("Do you wish to save your "
830 "new configuration?\n"
831 "<ESC><ESC> to continue."),
832 6, 60);
833 else
834 res = -1;
835 } while (res == KEY_ESC); 876 } while (res == KEY_ESC);
836 end_dialog(saved_x, saved_y);
837
838 switch (res) {
839 case 0:
840 if (conf_write(filename)) {
841 fprintf(stderr, _("\n\n"
842 "Error while writing of the configuration.\n"
843 "Your configuration changes were NOT saved."
844 "\n\n"));
845 return 1;
846 }
847 /* fall through */
848 case -1:
849 printf(_("\n\n"
850 "*** End of the configuration.\n"
851 "*** Execute 'make' to start the build or try 'make help'."
852 "\n\n"));
853 break;
854 default:
855 fprintf(stderr, _("\n\n"
856 "Your configuration changes were NOT saved."
857 "\n\n"));
858 }
859 877
860 return 0; 878 return res;
861} 879}
862 880
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index d66008639a43..8c2a97e60faf 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -10,8 +10,7 @@
10 10
11#include "lkc.h" 11#include "lkc.h"
12 12
13static const char nohelp_text[] = N_( 13static const char nohelp_text[] = "There is no help available for this option.";
14 "There is no help available for this option.\n");
15 14
16struct menu rootmenu; 15struct menu rootmenu;
17static struct menu **last_entry_ptr; 16static struct menu **last_entry_ptr;
@@ -595,16 +594,14 @@ struct gstr get_relations_str(struct symbol **sym_arr)
595void menu_get_ext_help(struct menu *menu, struct gstr *help) 594void menu_get_ext_help(struct menu *menu, struct gstr *help)
596{ 595{
597 struct symbol *sym = menu->sym; 596 struct symbol *sym = menu->sym;
597 const char *help_text = nohelp_text;
598 598
599 if (menu_has_help(menu)) { 599 if (menu_has_help(menu)) {
600 if (sym->name) { 600 if (sym->name)
601 str_printf(help, "%s%s:\n\n", CONFIG_, sym->name); 601 str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
602 str_append(help, _(menu_get_help(menu))); 602 help_text = menu_get_help(menu);
603 str_append(help, "\n");
604 }
605 } else {
606 str_append(help, nohelp_text);
607 } 603 }
604 str_printf(help, "%s\n", _(help_text));
608 if (sym) 605 if (sym)
609 get_symbol_str(help, sym); 606 get_symbol_str(help, sym);
610} 607}
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 39ca1f1640ea..73070cb0b6de 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -182,8 +182,6 @@ setmod_text[] = N_(
182"This feature depends on another which\n" 182"This feature depends on another which\n"
183"has been configured as a module.\n" 183"has been configured as a module.\n"
184"As a result, this feature will be built as a module."), 184"As a result, this feature will be built as a module."),
185nohelp_text[] = N_(
186"There is no help available for this option.\n"),
187load_config_text[] = N_( 185load_config_text[] = N_(
188"Enter the name of the configuration file you wish to load.\n" 186"Enter the name of the configuration file you wish to load.\n"
189"Accept the name shown to restore the configuration you\n" 187"Accept the name shown to restore the configuration you\n"
@@ -280,6 +278,9 @@ static int global_exit;
280/* the currently selected button */ 278/* the currently selected button */
281const char *current_instructions = menu_instructions; 279const char *current_instructions = menu_instructions;
282 280
281static char *dialog_input_result;
282static int dialog_input_result_len;
283
283static void conf(struct menu *menu); 284static void conf(struct menu *menu);
284static void conf_choice(struct menu *menu); 285static void conf_choice(struct menu *menu);
285static void conf_string(struct menu *menu); 286static void conf_string(struct menu *menu);
@@ -695,7 +696,6 @@ static void search_conf(void)
695{ 696{
696 struct symbol **sym_arr; 697 struct symbol **sym_arr;
697 struct gstr res; 698 struct gstr res;
698 char dialog_input_result[100];
699 char *dialog_input; 699 char *dialog_input;
700 int dres; 700 int dres;
701again: 701again:
@@ -703,7 +703,7 @@ again:
703 _("Search Configuration Parameter"), 703 _("Search Configuration Parameter"),
704 _("Enter " CONFIG_ " (sub)string to search for " 704 _("Enter " CONFIG_ " (sub)string to search for "
705 "(with or without \"" CONFIG_ "\")"), 705 "(with or without \"" CONFIG_ "\")"),
706 "", dialog_input_result, 99); 706 "", &dialog_input_result, &dialog_input_result_len);
707 switch (dres) { 707 switch (dres) {
708 case 0: 708 case 0:
709 break; 709 break;
@@ -1348,7 +1348,6 @@ static void conf_choice(struct menu *menu)
1348static void conf_string(struct menu *menu) 1348static void conf_string(struct menu *menu)
1349{ 1349{
1350 const char *prompt = menu_get_prompt(menu); 1350 const char *prompt = menu_get_prompt(menu);
1351 char dialog_input_result[256];
1352 1351
1353 while (1) { 1352 while (1) {
1354 int res; 1353 int res;
@@ -1371,8 +1370,8 @@ static void conf_string(struct menu *menu)
1371 prompt ? _(prompt) : _("Main Menu"), 1370 prompt ? _(prompt) : _("Main Menu"),
1372 heading, 1371 heading,
1373 sym_get_string_value(menu->sym), 1372 sym_get_string_value(menu->sym),
1374 dialog_input_result, 1373 &dialog_input_result,
1375 sizeof(dialog_input_result)); 1374 &dialog_input_result_len);
1376 switch (res) { 1375 switch (res) {
1377 case 0: 1376 case 0:
1378 if (sym_set_string_value(menu->sym, 1377 if (sym_set_string_value(menu->sym,
@@ -1392,14 +1391,13 @@ static void conf_string(struct menu *menu)
1392 1391
1393static void conf_load(void) 1392static void conf_load(void)
1394{ 1393{
1395 char dialog_input_result[256];
1396 while (1) { 1394 while (1) {
1397 int res; 1395 int res;
1398 res = dialog_inputbox(main_window, 1396 res = dialog_inputbox(main_window,
1399 NULL, load_config_text, 1397 NULL, load_config_text,
1400 filename, 1398 filename,
1401 dialog_input_result, 1399 &dialog_input_result,
1402 sizeof(dialog_input_result)); 1400 &dialog_input_result_len);
1403 switch (res) { 1401 switch (res) {
1404 case 0: 1402 case 0:
1405 if (!dialog_input_result[0]) 1403 if (!dialog_input_result[0])
@@ -1424,14 +1422,13 @@ static void conf_load(void)
1424 1422
1425static void conf_save(void) 1423static void conf_save(void)
1426{ 1424{
1427 char dialog_input_result[256];
1428 while (1) { 1425 while (1) {
1429 int res; 1426 int res;
1430 res = dialog_inputbox(main_window, 1427 res = dialog_inputbox(main_window,
1431 NULL, save_config_text, 1428 NULL, save_config_text,
1432 filename, 1429 filename,
1433 dialog_input_result, 1430 &dialog_input_result,
1434 sizeof(dialog_input_result)); 1431 &dialog_input_result_len);
1435 switch (res) { 1432 switch (res) {
1436 case 0: 1433 case 0:
1437 if (!dialog_input_result[0]) 1434 if (!dialog_input_result[0])
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c
index f8137b3a5382..3b18dd839668 100644
--- a/scripts/kconfig/nconf.gui.c
+++ b/scripts/kconfig/nconf.gui.c
@@ -356,7 +356,7 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...)
356 356
357int dialog_inputbox(WINDOW *main_window, 357int dialog_inputbox(WINDOW *main_window,
358 const char *title, const char *prompt, 358 const char *title, const char *prompt,
359 const char *init, char *result, int result_len) 359 const char *init, char **resultp, int *result_len)
360{ 360{
361 int prompt_lines = 0; 361 int prompt_lines = 0;
362 int prompt_width = 0; 362 int prompt_width = 0;
@@ -367,7 +367,13 @@ int dialog_inputbox(WINDOW *main_window,
367 int i, x, y; 367 int i, x, y;
368 int res = -1; 368 int res = -1;
369 int cursor_position = strlen(init); 369 int cursor_position = strlen(init);
370 int cursor_form_win;
371 char *result = *resultp;
370 372
373 if (strlen(init)+1 > *result_len) {
374 *result_len = strlen(init)+1;
375 *resultp = result = realloc(result, *result_len);
376 }
371 377
372 /* find the widest line of msg: */ 378 /* find the widest line of msg: */
373 prompt_lines = get_line_no(prompt); 379 prompt_lines = get_line_no(prompt);
@@ -384,7 +390,7 @@ int dialog_inputbox(WINDOW *main_window,
384 y = (LINES-(prompt_lines+4))/2; 390 y = (LINES-(prompt_lines+4))/2;
385 x = (COLS-(prompt_width+4))/2; 391 x = (COLS-(prompt_width+4))/2;
386 392
387 strncpy(result, init, result_len); 393 strncpy(result, init, *result_len);
388 394
389 /* create the windows */ 395 /* create the windows */
390 win = newwin(prompt_lines+6, prompt_width+7, y, x); 396 win = newwin(prompt_lines+6, prompt_width+7, y, x);
@@ -405,7 +411,9 @@ int dialog_inputbox(WINDOW *main_window,
405 fill_window(prompt_win, prompt); 411 fill_window(prompt_win, prompt);
406 412
407 mvwprintw(form_win, 0, 0, "%*s", prompt_width, " "); 413 mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
408 mvwprintw(form_win, 0, 0, "%s", result); 414 cursor_form_win = min(cursor_position, prompt_width-1);
415 mvwprintw(form_win, 0, 0, "%s",
416 result + cursor_position-cursor_form_win);
409 417
410 /* create panels */ 418 /* create panels */
411 panel = new_panel(win); 419 panel = new_panel(win);
@@ -431,6 +439,8 @@ int dialog_inputbox(WINDOW *main_window,
431 &result[cursor_position], 439 &result[cursor_position],
432 len-cursor_position+1); 440 len-cursor_position+1);
433 cursor_position--; 441 cursor_position--;
442 cursor_form_win--;
443 len--;
434 } 444 }
435 break; 445 break;
436 case KEY_DC: 446 case KEY_DC:
@@ -438,38 +448,63 @@ int dialog_inputbox(WINDOW *main_window,
438 memmove(&result[cursor_position], 448 memmove(&result[cursor_position],
439 &result[cursor_position+1], 449 &result[cursor_position+1],
440 len-cursor_position+1); 450 len-cursor_position+1);
451 len--;
441 } 452 }
442 break; 453 break;
443 case KEY_UP: 454 case KEY_UP:
444 case KEY_RIGHT: 455 case KEY_RIGHT:
445 if (cursor_position < len && 456 if (cursor_position < len) {
446 cursor_position < min(result_len, prompt_width))
447 cursor_position++; 457 cursor_position++;
458 cursor_form_win++;
459 }
448 break; 460 break;
449 case KEY_DOWN: 461 case KEY_DOWN:
450 case KEY_LEFT: 462 case KEY_LEFT:
451 if (cursor_position > 0) 463 if (cursor_position > 0) {
452 cursor_position--; 464 cursor_position--;
465 cursor_form_win--;
466 }
467 break;
468 case KEY_HOME:
469 cursor_position = 0;
470 cursor_form_win = 0;
471 break;
472 case KEY_END:
473 cursor_position = len;
474 cursor_form_win = min(cursor_position, prompt_width-1);
453 break; 475 break;
454 default: 476 default:
455 if ((isgraph(res) || isspace(res)) && 477 if ((isgraph(res) || isspace(res))) {
456 len-2 < result_len) { 478 /* one for new char, one for '\0' */
479 if (len+2 > *result_len) {
480 *result_len = len+2;
481 *resultp = result = realloc(result,
482 *result_len);
483 }
457 /* insert the char at the proper position */ 484 /* insert the char at the proper position */
458 memmove(&result[cursor_position+1], 485 memmove(&result[cursor_position+1],
459 &result[cursor_position], 486 &result[cursor_position],
460 len+1); 487 len-cursor_position+1);
461 result[cursor_position] = res; 488 result[cursor_position] = res;
462 cursor_position++; 489 cursor_position++;
490 cursor_form_win++;
491 len++;
463 } else { 492 } else {
464 mvprintw(0, 0, "unknow key: %d\n", res); 493 mvprintw(0, 0, "unknown key: %d\n", res);
465 } 494 }
466 break; 495 break;
467 } 496 }
497 if (cursor_form_win < 0)
498 cursor_form_win = 0;
499 else if (cursor_form_win > prompt_width-1)
500 cursor_form_win = prompt_width-1;
501
468 wmove(form_win, 0, 0); 502 wmove(form_win, 0, 0);
469 wclrtoeol(form_win); 503 wclrtoeol(form_win);
470 mvwprintw(form_win, 0, 0, "%*s", prompt_width, " "); 504 mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
471 mvwprintw(form_win, 0, 0, "%s", result); 505 mvwprintw(form_win, 0, 0, "%s",
472 wmove(form_win, 0, cursor_position); 506 result + cursor_position-cursor_form_win);
507 wmove(form_win, 0, cursor_form_win);
473 touchwin(win); 508 touchwin(win);
474 refresh_all_windows(main_window); 509 refresh_all_windows(main_window);
475 510
diff --git a/scripts/kconfig/nconf.h b/scripts/kconfig/nconf.h
index 58fbda8fc0dc..0d5261705ef5 100644
--- a/scripts/kconfig/nconf.h
+++ b/scripts/kconfig/nconf.h
@@ -89,7 +89,7 @@ void fill_window(WINDOW *win, const char *text);
89int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...); 89int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...);
90int dialog_inputbox(WINDOW *main_window, 90int dialog_inputbox(WINDOW *main_window,
91 const char *title, const char *prompt, 91 const char *title, const char *prompt,
92 const char *init, char *result, int result_len); 92 const char *init, char **resultp, int *result_len);
93void refresh_all_windows(WINDOW *main_window); 93void refresh_all_windows(WINDOW *main_window);
94void show_scroll_win(WINDOW *main_window, 94void show_scroll_win(WINDOW *main_window,
95 const char *title, 95 const char *title,
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index a4fe923c0131..ec7afce4c88d 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -43,6 +43,7 @@
43# make oldconfig 43# make oldconfig
44# 44#
45use strict; 45use strict;
46use Getopt::Long;
46 47
47my $config = ".config"; 48my $config = ".config";
48 49
@@ -112,10 +113,17 @@ sub find_config {
112 113
113find_config; 114find_config;
114 115
116# Parse options
117my $localmodconfig = 0;
118my $localyesconfig = 0;
119
120GetOptions("localmodconfig" => \$localmodconfig,
121 "localyesconfig" => \$localyesconfig);
122
115# Get the build source and top level Kconfig file (passed in) 123# Get the build source and top level Kconfig file (passed in)
116my $ksource = $ARGV[0]; 124my $ksource = $ARGV[0];
117my $kconfig = $ARGV[1]; 125my $kconfig = $ARGV[1];
118my $lsmod_file = $ARGV[2]; 126my $lsmod_file = $ENV{'LSMOD'};
119 127
120my @makefiles = `find $ksource -name Makefile 2>/dev/null`; 128my @makefiles = `find $ksource -name Makefile 2>/dev/null`;
121chomp @makefiles; 129chomp @makefiles;
@@ -296,7 +304,11 @@ my %modules;
296 304
297if (defined($lsmod_file)) { 305if (defined($lsmod_file)) {
298 if ( ! -f $lsmod_file) { 306 if ( ! -f $lsmod_file) {
299 die "$lsmod_file not found"; 307 if ( -f $ENV{'objtree'}."/".$lsmod_file) {
308 $lsmod_file = $ENV{'objtree'}."/".$lsmod_file;
309 } else {
310 die "$lsmod_file not found";
311 }
300 } 312 }
301 if ( -x $lsmod_file) { 313 if ( -x $lsmod_file) {
302 # the file is executable, run it 314 # the file is executable, run it
@@ -421,7 +433,11 @@ while(<CIN>) {
421 433
422 if (/^(CONFIG.*)=(m|y)/) { 434 if (/^(CONFIG.*)=(m|y)/) {
423 if (defined($configs{$1})) { 435 if (defined($configs{$1})) {
424 $setconfigs{$1} = $2; 436 if ($localyesconfig) {
437 $setconfigs{$1} = 'y';
438 } else {
439 $setconfigs{$1} = $2;
440 }
425 } elsif ($2 eq "m") { 441 } elsif ($2 eq "m") {
426 print "# $1 is not set\n"; 442 print "# $1 is not set\n";
427 next; 443 next;
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index a509ff8f32fa..2bd594e6d1b4 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1849,6 +1849,12 @@ static void add_header(struct buffer *b, struct module *mod)
1849 buf_printf(b, "};\n"); 1849 buf_printf(b, "};\n");
1850} 1850}
1851 1851
1852static void add_intree_flag(struct buffer *b, int is_intree)
1853{
1854 if (is_intree)
1855 buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n");
1856}
1857
1852static void add_staging_flag(struct buffer *b, const char *name) 1858static void add_staging_flag(struct buffer *b, const char *name)
1853{ 1859{
1854 static const char *staging_dir = "drivers/staging"; 1860 static const char *staging_dir = "drivers/staging";
@@ -2169,6 +2175,7 @@ int main(int argc, char **argv)
2169 buf.pos = 0; 2175 buf.pos = 0;
2170 2176
2171 add_header(&buf, mod); 2177 add_header(&buf, mod);
2178 add_intree_flag(&buf, !external_module);
2172 add_staging_flag(&buf, mod->name); 2179 add_staging_flag(&buf, mod->name);
2173 err |= add_versions(&buf, mod); 2180 err |= add_versions(&buf, mod);
2174 add_depends(&buf, mod, modules); 2181 add_depends(&buf, mod, modules);
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 75c5d24f1993..38f6617a2cb1 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -129,7 +129,7 @@ exuberant()
129 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ 129 -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
130 -I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \ 130 -I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \
131 --extra=+f --c-kinds=+px \ 131 --extra=+f --c-kinds=+px \
132 --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \ 132 --regex-asm='/^(ENTRY|_GLOBAL)\(([^)]*)\).*/\2/' \
133 --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \ 133 --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \
134 --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \ 134 --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \
135 --regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1/' 135 --regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1/'
@@ -151,7 +151,7 @@ exuberant()
151emacs() 151emacs()
152{ 152{
153 all_sources | xargs $1 -a \ 153 all_sources | xargs $1 -a \
154 --regex='/^ENTRY(\([^)]*\)).*/\1/' \ 154 --regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/' \
155 --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \ 155 --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \
156 --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \ 156 --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
157 --regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' 157 --regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/'