提交 303fc01f 编写于 作者: M Michal Marek

genksyms: Regenerate lexer and parser

Regenerated the parser after "genksyms: Track changes to enum
constants".
Signed-off-by: NMichal Marek <mmarek@suse.cz>
Acked-by: NSam Ravnborg <sam@ravnborg.org>
上级 e37ddb82
...@@ -2253,12 +2253,23 @@ void yyfree (void * ptr ) ...@@ -2253,12 +2253,23 @@ void yyfree (void * ptr )
/* Macros to append to our phrase collection list. */ /* Macros to append to our phrase collection list. */
/*
* We mark any token, that that equals to a known enumerator, as
* SYM_ENUM_CONST. The parser will change this for struct and union tags later,
* the only problem is struct and union members:
* enum e { a, b }; struct s { int a, b; }
* but in this case, the only effect will be, that the ABI checksums become
* more volatile, which is acceptable. Also, such collisions are quite rare,
* so far it was only observed in include/linux/telephony.h.
*/
#define _APP(T,L) do { \ #define _APP(T,L) do { \
cur_node = next_node; \ cur_node = next_node; \
next_node = xmalloc(sizeof(*next_node)); \ next_node = xmalloc(sizeof(*next_node)); \
next_node->next = cur_node; \ next_node->next = cur_node; \
cur_node->string = memcpy(xmalloc(L+1), T, L+1); \ cur_node->string = memcpy(xmalloc(L+1), T, L+1); \
cur_node->tag = SYM_NORMAL; \ cur_node->tag = \
find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\
SYM_ENUM_CONST : SYM_NORMAL ; \
} while (0) } while (0)
#define APP _APP(yytext, yyleng) #define APP _APP(yytext, yyleng)
...@@ -2336,8 +2347,8 @@ repeat: ...@@ -2336,8 +2347,8 @@ repeat:
case STRUCT_KEYW: case STRUCT_KEYW:
case UNION_KEYW: case UNION_KEYW:
dont_want_brace_phrase = 3;
case ENUM_KEYW: case ENUM_KEYW:
dont_want_brace_phrase = 3;
suppress_type_lookup = 2; suppress_type_lookup = 2;
goto fini; goto fini;
...@@ -2466,7 +2477,20 @@ repeat: ...@@ -2466,7 +2477,20 @@ repeat:
++count; ++count;
APP; APP;
goto repeat; goto repeat;
case ')': case ']': case '}': case '}':
/* is this the last line of an enum declaration? */
if (count == 0)
{
/* Put back the token we just read so's we can find it again
after registering the expression. */
unput(token);
lexstate = ST_NORMAL;
token = EXPRESSION_PHRASE;
break;
}
/* FALLTHRU */
case ')': case ']':
--count; --count;
APP; APP;
goto repeat; goto repeat;
......
此差异已折叠。
/* A Bison parser, made by GNU Bison 2.3. */
/* A Bison parser, made by GNU Bison 2.4.1. */
/* Skeleton interface for Bison's Yacc-like parsers in C /* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc. 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
the Free Software Foundation; either version 2, or (at your option) the Free Software Foundation, either version 3 of the License, or
any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
...@@ -16,9 +17,7 @@ ...@@ -16,9 +17,7 @@
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program. If not, see <http://www.gnu.org/licenses/>. */
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, you may create a larger work that contains /* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work part or all of the Bison parser skeleton and distribute that work
...@@ -33,6 +32,7 @@ ...@@ -33,6 +32,7 @@
This special exception was added by the Free Software Foundation in This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */ version 2.2 of Bison. */
/* Tokens. */ /* Tokens. */
#ifndef YYTOKENTYPE #ifndef YYTOKENTYPE
# define YYTOKENTYPE # define YYTOKENTYPE
...@@ -82,58 +82,16 @@ ...@@ -82,58 +82,16 @@
FILENAME = 298 FILENAME = 298
}; };
#endif #endif
/* Tokens. */
#define ASM_KEYW 258
#define ATTRIBUTE_KEYW 259
#define AUTO_KEYW 260
#define BOOL_KEYW 261
#define CHAR_KEYW 262
#define CONST_KEYW 263
#define DOUBLE_KEYW 264
#define ENUM_KEYW 265
#define EXTERN_KEYW 266
#define EXTENSION_KEYW 267
#define FLOAT_KEYW 268
#define INLINE_KEYW 269
#define INT_KEYW 270
#define LONG_KEYW 271
#define REGISTER_KEYW 272
#define RESTRICT_KEYW 273
#define SHORT_KEYW 274
#define SIGNED_KEYW 275
#define STATIC_KEYW 276
#define STRUCT_KEYW 277
#define TYPEDEF_KEYW 278
#define UNION_KEYW 279
#define UNSIGNED_KEYW 280
#define VOID_KEYW 281
#define VOLATILE_KEYW 282
#define TYPEOF_KEYW 283
#define EXPORT_SYMBOL_KEYW 284
#define ASM_PHRASE 285
#define ATTRIBUTE_PHRASE 286
#define BRACE_PHRASE 287
#define BRACKET_PHRASE 288
#define EXPRESSION_PHRASE 289
#define CHAR 290
#define DOTS 291
#define IDENT 292
#define INT 293
#define REAL 294
#define STRING 295
#define TYPE 296
#define OTHER 297
#define FILENAME 298
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE; typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif #endif
extern YYSTYPE yylval; extern YYSTYPE yylval;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册