Commit 5e05981b authored by Michal Marek's avatar Michal Marek

Merge branch 'kbuild-implicit-parser-rule' of...

Merge branch 'kbuild-implicit-parser-rule' of git://github.com/lacombar/linux-2.6 into kbuild/kbuild
parents 2e483528 edfc86aa
......@@ -20,6 +20,10 @@ depfile = $(subst $(comma),_,$(dot-target).d)
# filename of target with directory and extension stripped
basetarget = $(basename $(notdir $@))
###
# filename of first prerequisite with directory and extension stripped
baseprereq = $(basename $(notdir $<))
###
# Escape single quote for use in echo statements
escsq = $(subst $(squote),'\$(squote)',$1)
......
......@@ -160,13 +160,51 @@ ld_flags = $(LDFLAGS) $(ldflags-y)
modname-multi = $(sort $(foreach m,$(multi-used),\
$(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))
ifdef REGENERATE_PARSERS
# GPERF
# ---------------------------------------------------------------------------
quiet_cmd_gperf = GPERF $@
cmd_gperf = gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $<
$(src)/%.hash.c_shipped: $(src)/%.gperf
$(call cmd,gperf)
# LEX
# ---------------------------------------------------------------------------
LEX_PREFIX = $(if $(LEX_PREFIX_${baseprereq}),$(LEX_PREFIX_${baseprereq}),yy)
quiet_cmd_flex = LEX $@
cmd_flex = flex -o$@ -L -P $(LEX_PREFIX) $<
$(src)/%.lex.c_shipped: $(src)/%.l
$(call cmd,flex)
# YACC
# ---------------------------------------------------------------------------
YACC_PREFIX = $(if $(YACC_PREFIX_${baseprereq}),$(YACC_PREFIX_${baseprereq}),yy)
quiet_cmd_bison = YACC $@
cmd_bison = bison -o$@ -t -l -p $(YACC_PREFIX) $<
$(src)/%.tab.c_shipped: $(src)/%.y
$(call cmd,bison)
quiet_cmd_bison_h = YACC $@
cmd_bison_h = bison -o/dev/null --defines=$@ -t -l -p $(YACC_PREFIX) $<
$(src)/%.tab.h_shipped: $(src)/%.y
$(call cmd,bison_h)
endif
# Shipped files
# ===========================================================================
quiet_cmd_shipped = SHIPPED $@
cmd_shipped = cat $< > $@
$(obj)/%:: $(src)/%_shipped
$(obj)/%: $(src)/%_shipped
$(call cmd,shipped)
# Commands useful for building a boot image
......
......@@ -25,31 +25,5 @@ HOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC)
HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
# dependencies on generated files need to be listed explicitly
$(obj)/dtc-parser.tab.o: $(obj)/dtc-parser.tab.c $(obj)/dtc-parser.tab.h
$(obj)/dtc-lexer.lex.o: $(obj)/dtc-lexer.lex.c $(obj)/dtc-parser.tab.h
$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
targets += dtc-parser.tab.c dtc-lexer.lex.c
clean-files += dtc-parser.tab.h
# GENERATE_PARSER := 1 # Uncomment to rebuild flex/bison output
ifdef GENERATE_PARSER
BISON = bison
FLEX = flex
quiet_cmd_bison = BISON $@
cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped
quiet_cmd_flex = FLEX $@
cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped
$(obj)/dtc-parser.tab.c: $(src)/dtc-parser.y FORCE
$(call if_changed,bison)
$(obj)/dtc-parser.tab.h: $(obj)/dtc-parser.tab.c
$(obj)/dtc-lexer.lex.c: $(src)/dtc-lexer.l FORCE
$(call if_changed,flex)
endif
#line 2 "dtc-lexer.lex.c"
#line 4 "dtc-lexer.lex.c"
#line 3 "scripts/dtc/dtc-lexer.lex.c_shipped"
#define YY_INT_ALIGNED short int
......@@ -54,6 +53,7 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
......@@ -84,8 +84,6 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
......@@ -142,15 +140,7 @@ typedef unsigned int flex_uint32_t;
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k.
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
* Ditto for the __ia64__ case accordingly.
*/
#define YY_BUF_SIZE 32768
#else
#define YY_BUF_SIZE 16384
#endif /* __ia64__ */
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
......@@ -550,7 +540,6 @@ int yy_flex_debug = 0;
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "dtc-lexer.l"
/*
* (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
*
......@@ -572,10 +561,6 @@ char *yytext;
*/
#define YY_NO_INPUT 1
#line 37 "dtc-lexer.l"
#include "dtc.h"
#include "srcpos.h"
#include "dtc-parser.tab.h"
......@@ -603,7 +588,6 @@ static int dts_version = 1;
static void push_input_file(const char *filename);
static int pop_input_file(void);
#line 607 "dtc-lexer.lex.c"
#define INITIAL 0
#define INCLUDE 1
......@@ -686,12 +670,7 @@ static int input (void );
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k */
#define YY_READ_BUF_SIZE 16384
#else
#define YY_READ_BUF_SIZE 8192
#endif /* __ia64__ */
#endif
/* Copy whatever the last rule matched to the standard output. */
......@@ -710,7 +689,7 @@ static int input (void );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
size_t n; \
unsigned n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
......@@ -792,10 +771,6 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
#line 66 "dtc-lexer.l"
#line 798 "dtc-lexer.lex.c"
if ( !(yy_init) )
{
(yy_init) = 1;
......@@ -876,7 +851,6 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
/* rule 1 can match eol */
YY_RULE_SETUP
#line 67 "dtc-lexer.l"
{
char *name = strchr(yytext, '\"') + 1;
yytext[yyleng-1] = '\0';
......@@ -888,7 +862,6 @@ case YY_STATE_EOF(INCLUDE):
case YY_STATE_EOF(BYTESTRING):
case YY_STATE_EOF(PROPNODENAME):
case YY_STATE_EOF(V1):
#line 73 "dtc-lexer.l"
{
if (!pop_input_file()) {
yyterminate();
......@@ -898,7 +871,6 @@ case YY_STATE_EOF(V1):
case 2:
/* rule 2 can match eol */
YY_RULE_SETUP
#line 79 "dtc-lexer.l"
{
DPRINT("String: %s\n", yytext);
yylval.data = data_copy_escape_string(yytext+1,
......@@ -908,7 +880,6 @@ YY_RULE_SETUP
YY_BREAK
case 3:
YY_RULE_SETUP
#line 86 "dtc-lexer.l"
{
DPRINT("Keyword: /dts-v1/\n");
dts_version = 1;
......@@ -918,7 +889,6 @@ YY_RULE_SETUP
YY_BREAK
case 4:
YY_RULE_SETUP
#line 93 "dtc-lexer.l"
{
DPRINT("Keyword: /memreserve/\n");
BEGIN_DEFAULT();
......@@ -927,7 +897,6 @@ YY_RULE_SETUP
YY_BREAK
case 5:
YY_RULE_SETUP
#line 99 "dtc-lexer.l"
{
DPRINT("Label: %s\n", yytext);
yylval.labelref = xstrdup(yytext);
......@@ -937,7 +906,6 @@ YY_RULE_SETUP
YY_BREAK
case 6:
YY_RULE_SETUP
#line 106 "dtc-lexer.l"
{
yylval.literal = xstrdup(yytext);
DPRINT("Literal: '%s'\n", yylval.literal);
......@@ -946,7 +914,6 @@ YY_RULE_SETUP
YY_BREAK
case 7:
YY_RULE_SETUP
#line 112 "dtc-lexer.l"
{ /* label reference */
DPRINT("Ref: %s\n", yytext+1);
yylval.labelref = xstrdup(yytext+1);
......@@ -955,7 +922,6 @@ YY_RULE_SETUP
YY_BREAK
case 8:
YY_RULE_SETUP
#line 118 "dtc-lexer.l"
{ /* new-style path reference */
yytext[yyleng-1] = '\0';
DPRINT("Ref: %s\n", yytext+2);
......@@ -965,7 +931,6 @@ YY_RULE_SETUP
YY_BREAK
case 9:
YY_RULE_SETUP
#line 125 "dtc-lexer.l"
{
yylval.byte = strtol(yytext, NULL, 16);
DPRINT("Byte: %02x\n", (int)yylval.byte);
......@@ -974,7 +939,6 @@ YY_RULE_SETUP
YY_BREAK
case 10:
YY_RULE_SETUP
#line 131 "dtc-lexer.l"
{
DPRINT("/BYTESTRING\n");
BEGIN_DEFAULT();
......@@ -983,7 +947,6 @@ YY_RULE_SETUP
YY_BREAK
case 11:
YY_RULE_SETUP
#line 137 "dtc-lexer.l"
{
DPRINT("PropNodeName: %s\n", yytext);
yylval.propnodename = xstrdup(yytext);
......@@ -993,7 +956,6 @@ YY_RULE_SETUP
YY_BREAK
case 12:
YY_RULE_SETUP
#line 144 "dtc-lexer.l"
{
DPRINT("Binary Include\n");
return DT_INCBIN;
......@@ -1002,24 +964,20 @@ YY_RULE_SETUP
case 13:
/* rule 13 can match eol */
YY_RULE_SETUP
#line 149 "dtc-lexer.l"
/* eat whitespace */
YY_BREAK
case 14:
/* rule 14 can match eol */
YY_RULE_SETUP
#line 150 "dtc-lexer.l"
/* eat C-style comments */
YY_BREAK
case 15:
/* rule 15 can match eol */
YY_RULE_SETUP
#line 151 "dtc-lexer.l"
/* eat C++-style comments */
YY_BREAK
case 16:
YY_RULE_SETUP
#line 153 "dtc-lexer.l"
{
DPRINT("Char: %c (\\x%02x)\n", yytext[0],
(unsigned)yytext[0]);
......@@ -1037,10 +995,8 @@ YY_RULE_SETUP
YY_BREAK
case 17:
YY_RULE_SETUP
#line 168 "dtc-lexer.l"
ECHO;
YY_BREAK
#line 1044 "dtc-lexer.lex.c"
case YY_END_OF_BUFFER:
{
......@@ -1756,8 +1712,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
* scan from a @e copy of @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* @param bytes the byte buffer to scan
* @param len the number of bytes in the buffer pointed to by @a bytes.
*
* @return the newly allocated buffer state object.
*/
......@@ -1996,10 +1952,6 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
#line 168 "dtc-lexer.l"
static void push_input_file(const char *filename)
{
assert(filename);
......@@ -2011,7 +1963,6 @@ static void push_input_file(const char *filename)
yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE));
}
static int pop_input_file(void)
{
if (srcfile_pop() == 0)
......
This diff is collapsed.
/* A Bison parser, made by GNU Bison 2.4.1. */
/* A Bison parser, made by GNU Bison 2.4.3. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2009, 2010 Free Software Foundation, Inc.
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
......@@ -58,8 +57,6 @@
typedef union YYSTYPE
{
/* Line 1676 of yacc.c */
#line 39 "dtc-parser.y"
char *propnodename;
char *literal;
......@@ -78,8 +75,6 @@ typedef union YYSTYPE
/* Line 1676 of yacc.c */
#line 83 "dtc-parser.tab.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
......
keywords.c
lex.c
parse.[ch]
*.hash.c
*.lex.c
*.tab.c
*.tab.h
genksyms
......@@ -2,52 +2,12 @@
hostprogs-y := genksyms
always := $(hostprogs-y)
genksyms-objs := genksyms.o parse.o lex.o
genksyms-objs := genksyms.o parse.tab.o lex.lex.o
# -I needed for generated C source (shipped source)
HOSTCFLAGS_parse.o := -Wno-uninitialized -I$(src)
HOSTCFLAGS_parse.tab.o := -I$(src)
HOSTCFLAGS_lex.lex.o := -I$(src)
# dependencies on generated files need to be listed explicitly
$(obj)/lex.o: $(obj)/parse.h $(obj)/keywords.c
$(obj)/lex.lex.o: $(obj)/keywords.hash.c $(obj)/parse.tab.h
# -I needed for generated C source (shipped source)
HOSTCFLAGS_lex.o := -I$(src)
ifdef GENERATE_PARSER
# gperf
quiet_cmd_keywords.c = GPERF $@
cmd_keywords.c = gperf -L ANSI-C -a -C -E -g -H is_reserved_hash \
-k 1,3,$$ -N is_reserved_word -p -t $< > $@
$(obj)/keywords.c: $(obj)/keywords.gperf FORCE
$(call if_changed,keywords.c)
cp $@ $@_shipped
# flex
quiet_cmd_lex.c = FLEX $@
cmd_lex.c = flex -o$@ -d $<
$(obj)/lex.c: $(obj)/lex.l $(obj)/keywords.c FORCE
$(call if_changed,lex.c)
cp $@ $@_shipped
# bison
quiet_cmd_parse.c = BISON $@
cmd_parse.c = bison -o$@ -dtv $(filter-out FORCE,$^)
$(obj)/parse.c: $(obj)/parse.y FORCE
$(call if_changed,parse.c)
cp $@ $@_shipped
cp $(@:.c=.h) $(@:.c=.h)_shipped
$(obj)/parse.h: $(obj)/parse.c ;
clean-files += parse.output
endif
targets += keywords.c lex.c parse.c parse.h
%language=ANSI-C
%define hash-function-name is_reserved_hash
%define lookup-function-name is_reserved_word
%{
struct resword;
static const struct resword *is_reserved_word(register const char *str, register unsigned int len);
......
/* ANSI-C code produced by gperf version 3.0.4 */
/* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */
/* Command-line: gperf -t --output-file scripts/genksyms/keywords.hash.c_shipped -a -C -E -g -k '1,3,$' -p -t scripts/genksyms/keywords.gperf */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
......@@ -28,11 +28,11 @@
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
#endif
#line 1 "scripts/genksyms/keywords.gperf"
#line 4 "scripts/genksyms/keywords.gperf"
struct resword;
static const struct resword *is_reserved_word(register const char *str, register unsigned int len);
#line 5 "scripts/genksyms/keywords.gperf"
#line 8 "scripts/genksyms/keywords.gperf"
struct resword { const char *name; int token; };
/* maximum key range = 64, duplicates = 0 */
......@@ -99,108 +99,108 @@ is_reserved_word (register const char *str, register unsigned int len)
static const struct resword wordlist[] =
{
{""}, {""}, {""},
#line 30 "scripts/genksyms/keywords.gperf"
#line 33 "scripts/genksyms/keywords.gperf"
{"asm", ASM_KEYW},
{""},
#line 12 "scripts/genksyms/keywords.gperf"
#line 15 "scripts/genksyms/keywords.gperf"
{"__asm", ASM_KEYW},
{""},
#line 13 "scripts/genksyms/keywords.gperf"
#line 16 "scripts/genksyms/keywords.gperf"
{"__asm__", ASM_KEYW},
{""}, {""},
#line 56 "scripts/genksyms/keywords.gperf"
#line 59 "scripts/genksyms/keywords.gperf"
{"__typeof__", TYPEOF_KEYW},
{""},
#line 16 "scripts/genksyms/keywords.gperf"
#line 19 "scripts/genksyms/keywords.gperf"
{"__const", CONST_KEYW},
#line 15 "scripts/genksyms/keywords.gperf"
#line 18 "scripts/genksyms/keywords.gperf"
{"__attribute__", ATTRIBUTE_KEYW},
#line 17 "scripts/genksyms/keywords.gperf"
#line 20 "scripts/genksyms/keywords.gperf"
{"__const__", CONST_KEYW},
#line 22 "scripts/genksyms/keywords.gperf"
#line 25 "scripts/genksyms/keywords.gperf"
{"__signed__", SIGNED_KEYW},
#line 48 "scripts/genksyms/keywords.gperf"
#line 51 "scripts/genksyms/keywords.gperf"
{"static", STATIC_KEYW},
{""},
#line 43 "scripts/genksyms/keywords.gperf"
#line 46 "scripts/genksyms/keywords.gperf"
{"int", INT_KEYW},
#line 36 "scripts/genksyms/keywords.gperf"
#line 39 "scripts/genksyms/keywords.gperf"
{"char", CHAR_KEYW},
#line 37 "scripts/genksyms/keywords.gperf"
#line 40 "scripts/genksyms/keywords.gperf"
{"const", CONST_KEYW},
#line 49 "scripts/genksyms/keywords.gperf"
#line 52 "scripts/genksyms/keywords.gperf"
{"struct", STRUCT_KEYW},
#line 28 "scripts/genksyms/keywords.gperf"
#line 31 "scripts/genksyms/keywords.gperf"
{"__restrict__", RESTRICT_KEYW},
#line 29 "scripts/genksyms/keywords.gperf"
#line 32 "scripts/genksyms/keywords.gperf"
{"restrict", RESTRICT_KEYW},
#line 9 "scripts/genksyms/keywords.gperf"
#line 12 "scripts/genksyms/keywords.gperf"
{"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW},
#line 20 "scripts/genksyms/keywords.gperf"
#line 23 "scripts/genksyms/keywords.gperf"
{"__inline__", INLINE_KEYW},
{""},
#line 24 "scripts/genksyms/keywords.gperf"
#line 27 "scripts/genksyms/keywords.gperf"
{"__volatile__", VOLATILE_KEYW},
#line 7 "scripts/genksyms/keywords.gperf"
#line 10 "scripts/genksyms/keywords.gperf"
{"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW},
#line 27 "scripts/genksyms/keywords.gperf"
#line 30 "scripts/genksyms/keywords.gperf"
{"_restrict", RESTRICT_KEYW},
{""},
#line 14 "scripts/genksyms/keywords.gperf"
#line 17 "scripts/genksyms/keywords.gperf"
{"__attribute", ATTRIBUTE_KEYW},
#line 8 "scripts/genksyms/keywords.gperf"
#line 11 "scripts/genksyms/keywords.gperf"
{"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW},
#line 18 "scripts/genksyms/keywords.gperf"
#line 21 "scripts/genksyms/keywords.gperf"
{"__extension__", EXTENSION_KEYW},
#line 39 "scripts/genksyms/keywords.gperf"
#line 42 "scripts/genksyms/keywords.gperf"
{"enum", ENUM_KEYW},
#line 10 "scripts/genksyms/keywords.gperf"
#line 13 "scripts/genksyms/keywords.gperf"
{"EXPORT_UNUSED_SYMBOL", EXPORT_SYMBOL_KEYW},
#line 40 "scripts/genksyms/keywords.gperf"
#line 43 "scripts/genksyms/keywords.gperf"
{"extern", EXTERN_KEYW},
{""},
#line 21 "scripts/genksyms/keywords.gperf"
#line 24 "scripts/genksyms/keywords.gperf"
{"__signed", SIGNED_KEYW},
#line 11 "scripts/genksyms/keywords.gperf"
#line 14 "scripts/genksyms/keywords.gperf"
{"EXPORT_UNUSED_SYMBOL_GPL", EXPORT_SYMBOL_KEYW},
#line 51 "scripts/genksyms/keywords.gperf"
#line 54 "scripts/genksyms/keywords.gperf"
{"union", UNION_KEYW},
#line 55 "scripts/genksyms/keywords.gperf"
#line 58 "scripts/genksyms/keywords.gperf"
{"typeof", TYPEOF_KEYW},
#line 50 "scripts/genksyms/keywords.gperf"
#line 53 "scripts/genksyms/keywords.gperf"
{"typedef", TYPEDEF_KEYW},
#line 19 "scripts/genksyms/keywords.gperf"
#line 22 "scripts/genksyms/keywords.gperf"
{"__inline", INLINE_KEYW},
#line 35 "scripts/genksyms/keywords.gperf"
#line 38 "scripts/genksyms/keywords.gperf"
{"auto", AUTO_KEYW},
#line 23 "scripts/genksyms/keywords.gperf"
#line 26 "scripts/genksyms/keywords.gperf"
{"__volatile", VOLATILE_KEYW},
{""}, {""},
#line 52 "scripts/genksyms/keywords.gperf"
#line 55 "scripts/genksyms/keywords.gperf"
{"unsigned", UNSIGNED_KEYW},
{""},
#line 46 "scripts/genksyms/keywords.gperf"
#line 49 "scripts/genksyms/keywords.gperf"
{"short", SHORT_KEYW},
#line 42 "scripts/genksyms/keywords.gperf"
#line 45 "scripts/genksyms/keywords.gperf"
{"inline", INLINE_KEYW},
{""},
#line 54 "scripts/genksyms/keywords.gperf"
#line 57 "scripts/genksyms/keywords.gperf"
{"volatile", VOLATILE_KEYW},
#line 44 "scripts/genksyms/keywords.gperf"
#line 47 "scripts/genksyms/keywords.gperf"
{"long", LONG_KEYW},
#line 26 "scripts/genksyms/keywords.gperf"
#line 29 "scripts/genksyms/keywords.gperf"
{"_Bool", BOOL_KEYW},
{""}, {""},
#line 45 "scripts/genksyms/keywords.gperf"
#line 48 "scripts/genksyms/keywords.gperf"
{"register", REGISTER_KEYW},
#line 53 "scripts/genksyms/keywords.gperf"
#line 56 "scripts/genksyms/keywords.gperf"
{"void", VOID_KEYW},
#line 41 "scripts/genksyms/keywords.gperf"
#line 44 "scripts/genksyms/keywords.gperf"
{"float", FLOAT_KEYW},
#line 38 "scripts/genksyms/keywords.gperf"
#line 41 "scripts/genksyms/keywords.gperf"
{"double", DOUBLE_KEYW},
{""}, {""}, {""}, {""},
#line 47 "scripts/genksyms/keywords.gperf"
#line 50 "scripts/genksyms/keywords.gperf"
{"signed", SIGNED_KEYW}
};
......
......@@ -29,7 +29,7 @@
#include <ctype.h>
#include "genksyms.h"
#include "parse.h"
#include "parse.tab.h"
/* We've got a two-level lexer here. We let flex do basic tokenization
and then we categorize those basic tokens in the second stage. */
......@@ -94,7 +94,7 @@ MC_TOKEN ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>)
/* Bring in the keyword recognizer. */
#include "keywords.c"
#include "keywords.hash.c"
/* Macros to append to our phrase collection list. */
......
/* A Bison parser, made by GNU Bison 2.4.1. */
/* A Bison parser, made by GNU Bison 2.4.3. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2009, 2010 Free Software Foundation, Inc.
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
......
......@@ -2,7 +2,7 @@
# Generated files
#
config*
lex.*.c
*.lex.c
*.tab.c
*.tab.h
zconf.hash.c
......
......@@ -204,7 +204,7 @@ ifeq ($(gconf-target),1)
endif
clean-files := lkc_defs.h qconf.moc .tmp_qtcheck .tmp_gtkcheck
clean-files += zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
clean-files += zconf.tab.c zconf.lex.c zconf.hash.c gconf.glade.h
clean-files += mconf qconf gconf nconf
clean-files += config.pot linux.pot
......@@ -220,9 +220,12 @@ always := dochecklxdialog
HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
# generated files seem to need this to find local include files
HOSTCFLAGS_lex.zconf.o := -I$(src)
HOSTCFLAGS_zconf.lex.o := -I$(src)
HOSTCFLAGS_zconf.tab.o := -I$(src)
LEX_PREFIX_zconf := zconf
YACC_PREFIX_zconf := zconf
HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl
HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
......@@ -316,7 +319,7 @@ $(obj)/.tmp_gtkcheck:
fi
endif
$(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
$(obj)/zconf.tab.o: $(obj)/zconf.lex.c $(obj)/zconf.hash.c
$(obj)/kconfig_load.o: $(obj)/lkc_defs.h
......@@ -335,28 +338,3 @@ $(obj)/gconf.glade.h: $(obj)/gconf.glade
$(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \
$(obj)/gconf.glade
###
# The following requires flex/bison/gperf
# By default we use the _shipped versions, uncomment the following line if
# you are modifying the flex/bison src.
# LKC_GENPARSER := 1
ifdef LKC_GENPARSER
$(obj)/zconf.tab.c: $(src)/zconf.y
$(obj)/lex.zconf.c: $(src)/zconf.l
$(obj)/zconf.hash.c: $(src)/zconf.gperf
%.tab.c: %.y
bison -l -b $* -p $(notdir $*) $<
cp $@ $@_shipped
lex.%.c: %.l
flex -L -P$(notdir $*) -o$@ $<
cp $@ $@_shipped
%.hash.c: %.gperf
gperf < $< > $@
cp $@ $@_shipped
endif
......@@ -68,9 +68,7 @@ struct kconf_id {
enum symbol_type stype;
};
#ifdef YYDEBUG
extern int zconfdebug;
#endif
int zconfparse(void);
void zconfdump(FILE *out);
......
......@@ -9,7 +9,7 @@
struct kconf_id;
static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);
static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);
%%
mainmenu, T_MAINMENU, TF_COMMAND
......
This diff is collapsed.
%option backup nostdinit noyywrap never-interactive full ecs
%option 8bit backup nodefault perf-report perf-report
%option nostdinit noyywrap never-interactive full ecs
%option 8bit nodefault perf-report perf-report
%option noinput
%x COMMAND HELP STRING PARAM
%{
......@@ -96,7 +96,7 @@ n [A-Za-z0-9_]
<COMMAND>{
{n}+ {
struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
BEGIN(PARAM);
current_pos.file = current_file;
current_pos.lineno = current_file->lineno;
......@@ -132,7 +132,7 @@ n [A-Za-z0-9_]
\n BEGIN(INITIAL); current_file->lineno++; return T_EOL;
--- /* ignore */
({n}|[-/.])+ {
struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
if (id && id->flags & TF_PARAM) {
zconflval.id = id;
return id->token;
......
#line 3 "scripts/kconfig/lex.zconf.c"
#line 3 "scripts/kconfig/zconf.lex.c_shipped"
#define YY_INT_ALIGNED short int
......@@ -72,6 +72,7 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
......@@ -102,8 +103,6 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
......@@ -160,15 +159,7 @@ typedef unsigned int flex_uint32_t;
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k.
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
* Ditto for the __ia64__ case accordingly.
*/
#define YY_BUF_SIZE 32768
#else
#define YY_BUF_SIZE 16384
#endif /* __ia64__ */
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
......@@ -922,12 +913,7 @@ static int input (void );
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k */
#define YY_READ_BUF_SIZE 16384
#else
#define YY_READ_BUF_SIZE 8192
#endif /* __ia64__ */
#endif
/* Copy whatever the last rule matched to the standard output. */
......@@ -1100,7 +1086,7 @@ YY_RULE_SETUP
case 6:
YY_RULE_SETUP
{
struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
BEGIN(PARAM);
current_pos.file = current_file;
current_pos.lineno = current_file->lineno;
......@@ -1175,7 +1161,7 @@ YY_RULE_SETUP
case 19:
YY_RULE_SETUP
{
struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
if (id && id->flags & TF_PARAM) {
zconflval.id = id;
return id->token;
......@@ -2073,8 +2059,8 @@ 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
* scan from a @e copy of @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* @param bytes the byte buffer to scan
* @param len the number of bytes in the buffer pointed to by @a bytes.
*
* @return the newly allocated buffer state object.
*/
......
/* A Bison parser, made by GNU Bison 2.4.1. */
/* A Bison parser, made by GNU Bison 2.4.3. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2009, 2010 Free Software Foundation, Inc.
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
......@@ -46,7 +45,7 @@
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "2.4.1"
#define YYBISON_VERSION "2.4.3"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
......@@ -102,22 +101,18 @@ extern int zconflex(void);
static void zconfprint(const char *err, ...);
static void zconf_error(const char *err, ...);
static void zconferror(const char *err);
static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
struct symbol *symbol_hash[SYMBOL_HASHSIZE];
static struct menu *current_menu, *current_entry;
#define YYDEBUG 0
#if YYDEBUG
#define YYERROR_VERBOSE
#endif
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
# define YYDEBUG 1
#endif
/* Enabling verbose error messages. */
......@@ -188,7 +183,7 @@ typedef union YYSTYPE
struct symbol *symbol;
struct expr *expr;
struct menu *menu;
struct kconf_id *id;
const struct kconf_id *id;
......@@ -255,7 +250,7 @@ typedef short int yytype_int16;
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
# if YYENABLE_NLS
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
......@@ -535,18 +530,18 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 108, 108, 108, 110, 110, 112, 114, 115, 116,
117, 118, 119, 123, 127, 127, 127, 127, 127, 127,
127, 127, 131, 132, 133, 134, 135, 136, 140, 141,
147, 155, 161, 169, 179, 181, 182, 183, 184, 185,
186, 189, 197, 203, 213, 219, 225, 228, 230, 241,
242, 247, 256, 261, 269, 272, 274, 275, 276, 277,
278, 281, 287, 298, 304, 314, 316, 321, 329, 337,
340, 342, 343, 344, 349, 356, 363, 368, 376, 379,
381, 382, 383, 386, 394, 401, 408, 414, 421, 423,
424, 425, 428, 436, 438, 439, 442, 449, 451, 456,
457, 460, 461, 462, 466, 467, 470, 471, 474, 475,
476, 477, 478, 479, 480, 483, 484, 487, 488
0, 104, 104, 104, 106, 106, 108, 110, 111, 112,
113, 114, 115, 119, 123, 123, 123, 123, 123, 123,
123, 123, 127, 128, 129, 130, 131, 132, 136, 137,
143, 151, 157, 165, 175, 177, 178, 179, 180, 181,
182, 185, 193, 199, 209, 215, 221, 224, 226, 237,
238, 243, 252, 257, 265, 268, 270, 271, 272, 273,
274, 277, 283, 294, 300, 310, 312, 317, 325, 333,
336, 338, 339, 340, 345, 352, 359, 364, 372, 375,
377, 378, 379, 382, 390, 397, 404, 410, 417, 419,
420, 421, 424, 432, 434, 435, 438, 445, 447, 452,
453, 456, 457, 458, 462, 463, 466, 467, 470, 471,
472, 473, 474, 475, 476, 479, 480, 483, 484
};
#endif
......@@ -806,9 +801,18 @@ static const yytype_uint8 yystos[] =
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
Once GCC version 2 has supplanted version 1, this can go. However,
YYFAIL appears to be in use. Nevertheless, it is formally deprecated
in Bison 2.4.2's NEWS entry, where a plan to phase it out is
discussed. */
#define YYFAIL goto yyerrlab
#if defined YYFAIL
/* This is here to suppress warnings from the GCC cpp's
-Wunused-macros. Normally we don't worry about that warning, but
some users do, and we want to make it easy for users to remove
YYFAIL uses, which will produce warnings from Bison 2.5. */
#endif
#define YYRECOVERING() (!!yyerrstatus)
......@@ -865,7 +869,7 @@ while (YYID (0))
we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT
# if YYLTYPE_IS_TRIVIAL
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \
......@@ -1753,7 +1757,7 @@ yyreduce:
case 48:
{
struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string)));
const struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string)));
if (id && id->flags & TF_OPTION)
menu_add_option(id->token, (yyvsp[(3) - (3)].string));
else
......@@ -2258,10 +2262,8 @@ void conf_parse(const char *name)
modules_sym->flags |= SYMBOL_AUTO;
rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
#if YYDEBUG
if (getenv("ZCONF_DEBUG"))
zconfdebug = 1;
#endif
zconfparse();
if (zconfnerrs)
exit(1);
......@@ -2300,7 +2302,7 @@ static const char *zconf_tokenname(int token)
return "<token>";
}
static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken)
{
if (id->token != endtoken) {
zconf_error("unexpected '%s' within %s block",
......@@ -2345,9 +2347,7 @@ static void zconf_error(const char *err, ...)
static void zconferror(const char *err)
{
#if YYDEBUG
fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
#endif
}
static void print_quoted_string(FILE *out, const char *str)
......@@ -2496,7 +2496,7 @@ void zconfdump(FILE *out)
}
}
#include "lex.zconf.c"
#include "zconf.lex.c"
#include "util.c"
#include "confdata.c"
#include "expr.c"
......
......@@ -25,16 +25,12 @@ extern int zconflex(void);
static void zconfprint(const char *err, ...);
static void zconf_error(const char *err, ...);
static void zconferror(const char *err);
static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
struct symbol *symbol_hash[SYMBOL_HASHSIZE];
static struct menu *current_menu, *current_entry;
#define YYDEBUG 0
#if YYDEBUG
#define YYERROR_VERBOSE
#endif
%}
%expect 30
......@@ -45,7 +41,7 @@ static struct menu *current_menu, *current_entry;
struct symbol *symbol;
struct expr *expr;
struct menu *menu;
struct kconf_id *id;
const struct kconf_id *id;
}
%token <id>T_MAINMENU
......@@ -229,7 +225,7 @@ symbol_option_list:
/* empty */
| symbol_option_list T_WORD symbol_option_arg
{
struct kconf_id *id = kconf_id_lookup($2, strlen($2));
const struct kconf_id *id = kconf_id_lookup($2, strlen($2));
if (id && id->flags & TF_OPTION)
menu_add_option(id->token, $3);
else
......@@ -503,10 +499,8 @@ void conf_parse(const char *name)
modules_sym->flags |= SYMBOL_AUTO;
rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
#if YYDEBUG
if (getenv("ZCONF_DEBUG"))
zconfdebug = 1;
#endif
zconfparse();
if (zconfnerrs)
exit(1);
......@@ -545,7 +539,7 @@ static const char *zconf_tokenname(int token)
return "<token>";
}
static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken)
{
if (id->token != endtoken) {
zconf_error("unexpected '%s' within %s block",
......@@ -590,9 +584,7 @@ static void zconf_error(const char *err, ...)
static void zconferror(const char *err)
{
#if YYDEBUG
fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
#endif
}
static void print_quoted_string(FILE *out, const char *str)
......@@ -741,7 +733,7 @@ void zconfdump(FILE *out)
}
}
#include "lex.zconf.c"
#include "zconf.lex.c"
#include "util.c"
#include "confdata.c"
#include "expr.c"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment