kconfig: Add wildcard support for "source"

Kconfig's include directive "source" does not support
wildcards (e.g. source src/mainboard/*/Kconfig) which
makes automatic inclusion of all boards a tedious task
and prevents us from implementing "drop in" boards.

In our Makefile.inc files we already include mainboard
directories per wildcard, so let's add the infrastructure
to do the same with Kconfig.

Change-Id: I1988ff6ce3e167e86bb5cb65fc04a13748599dad
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: http://review.coreboot.org/9294
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Stefan Reinauer 2015-04-03 20:01:38 +02:00
parent 1f5349e61d
commit f78a09b60c
6 changed files with 186 additions and 165 deletions

View file

@ -326,10 +326,10 @@ $(obj)/zconf.lex.c: $(src)/zconf.l
$(obj)/zconf.hash.c: $(src)/zconf.gperf $(obj)/zconf.hash.c: $(src)/zconf.gperf
%.tab.c: %.y %.tab.c: %.y
bison -l -b $* -p $(notdir $*) $< bison -t -l -b $* -p $(notdir $*) $<
cp $@ $@_shipped cp $@ $@_shipped
lex.%.c: %.l %.lex.c: %.l
flex -L -P$(notdir $*) -o$@ $< flex -L -P$(notdir $*) -o$@ $<
cp $@ $@_shipped cp $@ $@_shipped

View file

@ -78,6 +78,7 @@ void zconf_starthelp(void);
FILE *zconf_fopen(const char *name); FILE *zconf_fopen(const char *name);
void zconf_initscan(const char *name); void zconf_initscan(const char *name);
void zconf_nextfile(const char *name); void zconf_nextfile(const char *name);
void zconf_nextfiles(const char *name);
int zconf_lineno(void); int zconf_lineno(void);
const char *zconf_curname(void); const char *zconf_curname(void);

View file

@ -13,6 +13,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <wordexp.h>
#include "lkc.h" #include "lkc.h"
@ -336,6 +337,21 @@ void zconf_nextfile(const char *name)
current_file = file; current_file = file;
} }
void zconf_nextfiles(const char *wildcard)
{
wordexp_t p;
char **w;
int i;
wordexp(wildcard, &p, 0);
w = p.we_wordv;
for (i = p.we_wordc - 1; i >= 0; i--)
zconf_nextfile(w[i]);
wordfree(&p);
}
static void zconf_endfile(void) static void zconf_endfile(void)
{ {
struct buffer *parent; struct buffer *parent;

View file

@ -1,5 +1,5 @@
#line 3 "scripts/kconfig/zconf.lex.c_shipped" #line 3 "zconf.lex.c"
#define YY_INT_ALIGNED short int #define YY_INT_ALIGNED short int
@ -27,7 +27,7 @@
#define FLEX_SCANNER #define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 35 #define YY_FLEX_SUBMINOR_VERSION 37
#if YY_FLEX_SUBMINOR_VERSION > 0 #if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA #define FLEX_BETA
#endif #endif
@ -72,7 +72,6 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t; typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t; typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t; typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */ /* Limits of integral types. */
#ifndef INT8_MIN #ifndef INT8_MIN
@ -103,6 +102,8 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U) #define UINT32_MAX (4294967295U)
#endif #endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */ #endif /* ! FLEXINT_H */
#ifdef __cplusplus #ifdef __cplusplus
@ -171,7 +172,12 @@ typedef unsigned int flex_uint32_t;
typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif #endif
extern int zconfleng; #ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif
extern yy_size_t zconfleng;
extern FILE *zconfin, *zconfout; extern FILE *zconfin, *zconfout;
@ -197,11 +203,6 @@ extern FILE *zconfin, *zconfout;
#define unput(c) yyunput( c, (yytext_ptr) ) #define unput(c) yyunput( c, (yytext_ptr) )
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif
#ifndef YY_STRUCT_YY_BUFFER_STATE #ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state struct yy_buffer_state
@ -219,7 +220,7 @@ struct yy_buffer_state
/* Number of characters read into yy_ch_buf, not including EOB /* Number of characters read into yy_ch_buf, not including EOB
* characters. * characters.
*/ */
int yy_n_chars; yy_size_t yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it, /* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to * and can realloc() it to grow it, and should free() it to
@ -289,8 +290,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
/* yy_hold_char holds the character lost when zconftext is formed. */ /* yy_hold_char holds the character lost when zconftext is formed. */
static char yy_hold_char; static char yy_hold_char;
static int yy_n_chars; /* number of characters read into yy_ch_buf */ static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
int zconfleng; yy_size_t zconfleng;
/* Points to current character in buffer. */ /* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0; static char *yy_c_buf_p = (char *) 0;
@ -318,7 +319,7 @@ static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file );
YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size );
YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str );
YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len ); YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,yy_size_t len );
void *zconfalloc (yy_size_t ); void *zconfalloc (yy_size_t );
void *zconfrealloc (void *,yy_size_t ); void *zconfrealloc (void *,yy_size_t );
@ -350,7 +351,7 @@ void zconffree (void * );
/* Begin user sect3 */ /* Begin user sect3 */
#define zconfwrap(n) 1 #define zconfwrap() 1
#define YY_SKIP_YYWRAP #define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR; typedef unsigned char YY_CHAR;
@ -775,6 +776,7 @@ char *zconftext;
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <wordexp.h>
#include "lkc.h" #include "lkc.h"
@ -870,7 +872,7 @@ FILE *zconfget_out (void );
void zconfset_out (FILE * out_str ); void zconfset_out (FILE * out_str );
int zconfget_leng (void ); yy_size_t zconfget_leng (void );
char *zconfget_text (void ); char *zconfget_text (void );
@ -1515,21 +1517,21 @@ static int yy_get_next_buffer (void)
else else
{ {
int num_to_read = yy_size_t num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 ) while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */ { /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */ /* just a shorter name for the current buffer */
YY_BUFFER_STATE b = YY_CURRENT_BUFFER; YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
int yy_c_buf_p_offset = int yy_c_buf_p_offset =
(int) ((yy_c_buf_p) - b->yy_ch_buf); (int) ((yy_c_buf_p) - b->yy_ch_buf);
if ( b->yy_is_our_buffer ) if ( b->yy_is_our_buffer )
{ {
int new_size = b->yy_buf_size * 2; yy_size_t new_size = b->yy_buf_size * 2;
if ( new_size <= 0 ) if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8; b->yy_buf_size += b->yy_buf_size / 8;
@ -1560,7 +1562,7 @@ static int yy_get_next_buffer (void)
/* Read in more data. */ /* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
(yy_n_chars), (size_t) num_to_read ); (yy_n_chars), num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
} }
@ -1630,7 +1632,7 @@ static int yy_get_next_buffer (void)
yy_current_state = yy_nxt[yy_current_state][1]; yy_current_state = yy_nxt[yy_current_state][1];
yy_is_jam = (yy_current_state <= 0); yy_is_jam = (yy_current_state <= 0);
return yy_is_jam ? 0 : yy_current_state; return yy_is_jam ? 0 : yy_current_state;
} }
static void yyunput (int c, register char * yy_bp ) static void yyunput (int c, register char * yy_bp )
@ -1645,7 +1647,7 @@ static int yy_get_next_buffer (void)
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
{ /* need to shift things up to make room */ { /* need to shift things up to make room */
/* +2 for EOB chars. */ /* +2 for EOB chars. */
register int number_to_move = (yy_n_chars) + 2; register yy_size_t number_to_move = (yy_n_chars) + 2;
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
register char *source = register char *source =
@ -1694,7 +1696,7 @@ static int yy_get_next_buffer (void)
else else
{ /* need more input */ { /* need more input */
int offset = (yy_c_buf_p) - (yytext_ptr); yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
++(yy_c_buf_p); ++(yy_c_buf_p);
switch ( yy_get_next_buffer( ) ) switch ( yy_get_next_buffer( ) )
@ -1966,7 +1968,7 @@ void zconfpop_buffer_state (void)
*/ */
static void zconfensure_buffer_stack (void) static void zconfensure_buffer_stack (void)
{ {
int num_to_alloc; yy_size_t num_to_alloc;
if (!(yy_buffer_stack)) { if (!(yy_buffer_stack)) {
@ -2058,12 +2060,12 @@ YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr )
/** Setup the input buffer state to scan the given bytes. The next call to zconflex() will /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
* scan from a @e copy of @a bytes. * scan from a @e copy of @a bytes.
* @param bytes the byte buffer to scan * @param yybytes the byte buffer to scan
* @param len the number of bytes in the buffer pointed to by @a bytes. * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* *
* @return the newly allocated buffer state object. * @return the newly allocated buffer state object.
*/ */
YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, int _yybytes_len ) YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
{ {
YY_BUFFER_STATE b; YY_BUFFER_STATE b;
char *buf; char *buf;
@ -2150,7 +2152,7 @@ FILE *zconfget_out (void)
/** Get the length of the current token. /** Get the length of the current token.
* *
*/ */
int zconfget_leng (void) yy_size_t zconfget_leng (void)
{ {
return zconfleng; return zconfleng;
} }
@ -2392,6 +2394,21 @@ void zconf_nextfile(const char *name)
current_file = file; current_file = file;
} }
void zconf_nextfiles(const char *wildcard)
{
wordexp_t p;
char **w;
int i;
wordexp(wildcard, &p, 0);
w = p.we_wordv;
for (i = p.we_wordc - 1; i >= 0; i--)
zconf_nextfile(w[i]);
wordfree(&p);
}
static void zconf_endfile(void) static void zconf_endfile(void)
{ {
struct buffer *parent; struct buffer *parent;

View file

@ -1,8 +1,8 @@
/* A Bison parser, made by GNU Bison 2.5. */ /* A Bison parser, made by GNU Bison 2.7. */
/* Bison implementation for Yacc-like parsers in C /* Bison implementation for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -44,7 +44,7 @@
#define YYBISON 1 #define YYBISON 1
/* Bison version. */ /* Bison version. */
#define YYBISON_VERSION "2.5" #define YYBISON_VERSION "2.7"
/* Skeleton name. */ /* Skeleton name. */
#define YYSKELETON_NAME "yacc.c" #define YYSKELETON_NAME "yacc.c"
@ -58,8 +58,6 @@
/* Pull parsers. */ /* Pull parsers. */
#define YYPULL 1 #define YYPULL 1
/* Using locations. */
#define YYLSP_NEEDED 0
/* Substitute the variable and function names. */ /* Substitute the variable and function names. */
#define yyparse zconfparse #define yyparse zconfparse
@ -70,7 +68,6 @@
#define yydebug zconfdebug #define yydebug zconfdebug
#define yynerrs zconfnerrs #define yynerrs zconfnerrs
/* Copy the first part of user declarations. */ /* Copy the first part of user declarations. */
@ -108,10 +105,13 @@ static struct menu *current_menu, *current_entry;
/* Enabling traces. */ # ifndef YY_NULL
#ifndef YYDEBUG # if defined __cplusplus && 201103L <= __cplusplus
# define YYDEBUG 1 # define YY_NULL nullptr
#endif # else
# define YY_NULL 0
# endif
# endif
/* Enabling verbose error messages. */ /* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE #ifdef YYERROR_VERBOSE
@ -121,11 +121,14 @@ static struct menu *current_menu, *current_entry;
# define YYERROR_VERBOSE 0 # define YYERROR_VERBOSE 0
#endif #endif
/* Enabling the token table. */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE 0
#endif
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
#endif
#if YYDEBUG
extern int zconfdebug;
#endif
/* Tokens. */ /* Tokens. */
#ifndef YYTOKENTYPE #ifndef YYTOKENTYPE
@ -170,7 +173,6 @@ static struct menu *current_menu, *current_entry;
#endif #endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE typedef union YYSTYPE
{ {
@ -191,6 +193,23 @@ typedef union YYSTYPE
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
#endif #endif
extern YYSTYPE zconflval;
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int zconfparse (void *YYPARSE_PARAM);
#else
int zconfparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int zconfparse (void);
#else
int zconfparse ();
#endif
#endif /* ! YYPARSE_PARAM */
/* Copy the second part of user declarations. */ /* Copy the second part of user declarations. */
@ -251,24 +270,24 @@ typedef short int yytype_int16;
# if defined YYENABLE_NLS && YYENABLE_NLS # if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS # if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid) # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif # endif
# endif # endif
# ifndef YY_ # ifndef YY_
# define YY_(msgid) msgid # define YY_(Msgid) Msgid
# endif # endif
#endif #endif
/* Suppress unused-variable warnings by "using" E. */ /* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__ #if ! defined lint || defined __GNUC__
# define YYUSE(e) ((void) (e)) # define YYUSE(E) ((void) (E))
#else #else
# define YYUSE(e) /* empty */ # define YYUSE(E) /* empty */
#endif #endif
/* Identity function, used to suppress warnings about constant conditions. */ /* Identity function, used to suppress warnings about constant conditions. */
#ifndef lint #ifndef lint
# define YYID(n) (n) # define YYID(N) (N)
#else #else
#if (defined __STDC__ || defined __C99__FUNC__ \ #if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER) || defined __cplusplus || defined _MSC_VER)
@ -304,6 +323,7 @@ YYID (yyi)
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER) || defined __cplusplus || defined _MSC_VER)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS # ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0 # define EXIT_SUCCESS 0
# endif # endif
@ -395,20 +415,20 @@ union yyalloc
#endif #endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from FROM to TO. The source and destination do /* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */ not overlap. */
# ifndef YYCOPY # ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__ # if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(To, From, Count) \ # define YYCOPY(Dst, Src, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From))) __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
# else # else
# define YYCOPY(To, From, Count) \ # define YYCOPY(Dst, Src, Count) \
do \ do \
{ \ { \
YYSIZE_T yyi; \ YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \ for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \ (Dst)[yyi] = (Src)[yyi]; \
} \ } \
while (YYID (0)) while (YYID (0))
# endif # endif
# endif # endif
@ -547,7 +567,7 @@ static const yytype_uint16 yyrline[] =
}; };
#endif #endif
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE #if YYDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] = static const char *const yytname[] =
@ -568,7 +588,7 @@ static const char *const yytname[] =
"menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt", "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt",
"comment", "comment_stmt", "help_start", "help", "depends_list", "comment", "comment_stmt", "help_start", "help", "depends_list",
"depends", "visibility_list", "visible", "prompt_stmt_opt", "prompt", "depends", "visibility_list", "visible", "prompt_stmt_opt", "prompt",
"end", "nl", "if_expr", "expr", "symbol", "word_opt", 0 "end", "nl", "if_expr", "expr", "symbol", "word_opt", YY_NULL
}; };
#endif #endif
@ -730,10 +750,10 @@ static const yytype_int16 yytable[] =
184 184
}; };
#define yypact_value_is_default(yystate) \ #define yypact_value_is_default(Yystate) \
((yystate) == (-90)) (!!((Yystate) == (-90)))
#define yytable_value_is_error(yytable_value) \ #define yytable_value_is_error(Yytable_value) \
YYID (0) YYID (0)
static const yytype_int16 yycheck[] = static const yytype_int16 yycheck[] =
@ -823,62 +843,35 @@ static const yytype_uint8 yystos[] =
#define YYRECOVERING() (!!yyerrstatus) #define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \ #define YYBACKUP(Token, Value) \
do \ do \
if (yychar == YYEMPTY && yylen == 1) \ if (yychar == YYEMPTY) \
{ \ { \
yychar = (Token); \ yychar = (Token); \
yylval = (Value); \ yylval = (Value); \
YYPOPSTACK (1); \ YYPOPSTACK (yylen); \
goto yybackup; \ yystate = *yyssp; \
} \ goto yybackup; \
else \ } \
{ \ else \
{ \
yyerror (YY_("syntax error: cannot back up")); \ yyerror (YY_("syntax error: cannot back up")); \
YYERROR; \ YYERROR; \
} \ } \
while (YYID (0)) while (YYID (0))
/* Error token number */
#define YYTERROR 1 #define YYTERROR 1
#define YYERRCODE 256 #define YYERRCODE 256
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (YYID (N)) \
{ \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
} \
else \
{ \
(Current).first_line = (Current).last_line = \
YYRHSLOC (Rhs, 0).last_line; \
(Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \
} \
while (YYID (0))
#endif
/* This macro is provided for backward compatibility. */ /* This macro is provided for backward compatibility. */
#ifndef YY_LOCATION_PRINT #ifndef YY_LOCATION_PRINT
# define YY_LOCATION_PRINT(File, Loc) ((void) 0) # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif #endif
/* YYLEX -- calling `yylex' with the right arguments. */ /* YYLEX -- calling `yylex' with the right arguments. */
#ifdef YYLEX_PARAM #ifdef YYLEX_PARAM
# define YYLEX yylex (YYLEX_PARAM) # define YYLEX yylex (YYLEX_PARAM)
#else #else
@ -928,6 +921,8 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
YYSTYPE const * const yyvaluep; YYSTYPE const * const yyvaluep;
#endif #endif
{ {
FILE *yyo = yyoutput;
YYUSE (yyo);
if (!yyvaluep) if (!yyvaluep)
return; return;
# ifdef YYPRINT # ifdef YYPRINT
@ -939,7 +934,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
switch (yytype) switch (yytype)
{ {
default: default:
break; break;
} }
} }
@ -1179,12 +1174,11 @@ static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken) yytype_int16 *yyssp, int yytoken)
{ {
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0; YYSIZE_T yysize = yysize0;
YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */ /* Internationalized format string. */
const char *yyformat = 0; const char *yyformat = YY_NULL;
/* Arguments of yyformat. */ /* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per /* Number of reported tokens (one for the "unexpected", one per
@ -1244,11 +1238,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
break; break;
} }
yyarg[yycount++] = yytname[yyx]; yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (0, yytname[yyx]); {
if (! (yysize <= yysize1 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM)) if (! (yysize <= yysize1
return 2; && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
yysize = yysize1; return 2;
yysize = yysize1;
}
} }
} }
} }
@ -1268,10 +1264,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
# undef YYCASE_ # undef YYCASE_
} }
yysize1 = yysize + yystrlen (yyformat); {
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
return 2; if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
yysize = yysize1; return 2;
yysize = yysize1;
}
if (*yymsg_alloc < yysize) if (*yymsg_alloc < yysize)
{ {
@ -1329,64 +1327,59 @@ yydestruct (yymsg, yytype, yyvaluep)
switch (yytype) switch (yytype)
{ {
case 53: /* "choice_entry" */ case 53: /* choice_entry */
{ {
fprintf(stderr, "%s:%d: missing end statement for this entry\n", fprintf(stderr, "%s:%d: missing end statement for this entry\n",
(yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
if (current_menu == (yyvaluep->menu)) if (current_menu == ((*yyvaluep).menu))
menu_end_menu(); menu_end_menu();
}; };
break; break;
case 59: /* "if_entry" */ case 59: /* if_entry */
{ {
fprintf(stderr, "%s:%d: missing end statement for this entry\n", fprintf(stderr, "%s:%d: missing end statement for this entry\n",
(yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
if (current_menu == (yyvaluep->menu)) if (current_menu == ((*yyvaluep).menu))
menu_end_menu(); menu_end_menu();
}; };
break; break;
case 65: /* "menu_entry" */ case 65: /* menu_entry */
{ {
fprintf(stderr, "%s:%d: missing end statement for this entry\n", fprintf(stderr, "%s:%d: missing end statement for this entry\n",
(yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
if (current_menu == (yyvaluep->menu)) if (current_menu == ((*yyvaluep).menu))
menu_end_menu(); menu_end_menu();
}; };
break; break;
default: default:
break; break;
} }
} }
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */
/* The lookahead symbol. */ /* The lookahead symbol. */
int yychar; int yychar;
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
/* The semantic value of the lookahead symbol. */ /* The semantic value of the lookahead symbol. */
YYSTYPE yylval; YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
/* Number of syntax errors so far. */ /* Number of syntax errors so far. */
int yynerrs; int yynerrs;
@ -1426,7 +1419,7 @@ yyparse ()
`yyss': related to states. `yyss': related to states.
`yyvs': related to semantic values. `yyvs': related to semantic values.
Refer to the stacks thru separate pointers, to allow yyoverflow Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */ to reallocate them elsewhere. */
/* The state stack. */ /* The state stack. */
@ -1444,7 +1437,7 @@ yyparse ()
int yyn; int yyn;
int yyresult; int yyresult;
/* Lookahead token as an internal (translated) token number. */ /* Lookahead token as an internal (translated) token number. */
int yytoken; int yytoken = 0;
/* The variables used to return semantic value and location from the /* The variables used to return semantic value and location from the
action routines. */ action routines. */
YYSTYPE yyval; YYSTYPE yyval;
@ -1462,9 +1455,8 @@ yyparse ()
Keep to zero when no symbol should be popped. */ Keep to zero when no symbol should be popped. */
int yylen = 0; int yylen = 0;
yytoken = 0; yyssp = yyss = yyssa;
yyss = yyssa; yyvsp = yyvs = yyvsa;
yyvs = yyvsa;
yystacksize = YYINITDEPTH; yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n")); YYDPRINTF ((stderr, "Starting parse\n"));
@ -1473,14 +1465,6 @@ yyparse ()
yyerrstatus = 0; yyerrstatus = 0;
yynerrs = 0; yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */ yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
yyssp = yyss;
yyvsp = yyvs;
goto yysetstate; goto yysetstate;
/*------------------------------------------------------------. /*------------------------------------------------------------.
@ -1621,7 +1605,9 @@ yybackup:
yychar = YYEMPTY; yychar = YYEMPTY;
yystate = yyn; yystate = yyn;
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval; *++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
goto yynewstate; goto yynewstate;
@ -1923,7 +1909,7 @@ yyreduce:
{ {
printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
zconf_nextfile((yyvsp[(2) - (3)].string)); zconf_nextfiles((yyvsp[(2) - (3)].string));
} }
break; break;
@ -2219,7 +2205,9 @@ yyerrlab1:
YY_STACK_PRINT (yyss, yyssp); YY_STACK_PRINT (yyss, yyssp);
} }
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval; *++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
/* Shift the error token. */ /* Shift the error token. */
@ -2243,7 +2231,7 @@ yyabortlab:
yyresult = 1; yyresult = 1;
goto yyreturn; goto yyreturn;
#if !defined(yyoverflow) || YYERROR_VERBOSE #if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------. /*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. | | yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/ `-------------------------------------------------*/
@ -2535,4 +2523,3 @@ void zconfdump(FILE *out)
#include "expr.c" #include "expr.c"
#include "symbol.c" #include "symbol.c"
#include "menu.c" #include "menu.c"

View file

@ -381,7 +381,7 @@ menu_block:
source_stmt: T_SOURCE prompt T_EOL source_stmt: T_SOURCE prompt T_EOL
{ {
printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2); printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);
zconf_nextfile($2); zconf_nextfiles($2);
}; };
/* comment entry */ /* comment entry */