mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-18 20:37:56 +00:00
Sync kconfig files with upstream 4.15
Last updated with 4.9-rc7. This commit introduces the following upstream changes: 9059a3493efe kconfig: fix relational operators for bool and tristate symbols 88127dae6ed9 kconfig/symbol.c: use correct pointer type argument for sizeof b24413180f56 License cleanup: add SPDX GPL-2.0 license identifier to files with no license bb3290d91695 Remove gperf usage from toolchain ad8181060788 kconfig: fix sparse warnings in nconfig ff85a1a80e00 kconfig: Check for libncurses before menuconfig 9be3213b14d4 gconfig: remove misleading parentheses around a condition 83c3a1bad224 xconfig: fix missing suboption and help panels on first run e039303ff71a xconfig: fix 'Show Debug' functionality 79e51b5c2dee kconfig/nconf: Fix hang when editing symbol with a long prompt 0eb47346968f Scripts: kconfig: nconf: fix _GNU_SOURCE redefined warning 237e3ad0f195 Kconfig: Introduce the "imply" keyword Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
This commit is contained in:
parent
ba165ed4c0
commit
59b08f8d06
1
kconfig/.gitignore
vendored
1
kconfig/.gitignore
vendored
@ -3,7 +3,6 @@ conf
|
||||
*.o
|
||||
*.dep
|
||||
zconf.lex.c
|
||||
zconf.hash.c
|
||||
zconf.tab.c
|
||||
*.exe
|
||||
Makefile
|
||||
|
@ -11,8 +11,7 @@ all: $(PROGS)
|
||||
@true # Just be silent, you fscking son of a fscking beach...
|
||||
|
||||
# Build flags
|
||||
CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(VERSION)\"" \
|
||||
-DGPERF_LEN_TYPE="$(gperf_len_type)"
|
||||
CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(VERSION)\""
|
||||
LDFLAGS = $(INTL_LIBS)
|
||||
|
||||
ifneq (@DPKG_BUILDFLAGS@,)
|
||||
@ -78,16 +77,13 @@ DEPS += $(nconf_DEP)
|
||||
$(call __silent,DEP,$@)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MM $< |$(sed) -r -e 's|([^:]+.o)( *:+)|$(<:.c=.o) $@\2|;' >$@
|
||||
|
||||
# Generate the grammar parser
|
||||
zconf.tab.o: zconf.tab.c zconf.hash.c zconf.lex.c
|
||||
zconf.tab.dep: zconf.tab.c zconf.hash.c zconf.lex.c
|
||||
zconf.tab.o: zconf.tab.c zconf.lex.c
|
||||
zconf.tab.dep: zconf.tab.c zconf.lex.c
|
||||
|
||||
.PRECIOUS: zconf.tab.c
|
||||
zconf.tab.c: zconf.y
|
||||
$(call __silent,BISON)bison -l -b zconf -p zconf $<
|
||||
|
||||
zconf.hash.c: zconf.gperf
|
||||
$(call __silent,GPERF)$(gperf) -C < $< > $@
|
||||
|
||||
zconf.lex.c: zconf.l
|
||||
$(call __silent,LEX)flex -L -Pzconf -o$@ $<
|
||||
|
||||
@ -121,4 +117,4 @@ install-kconfig.mk: kconfig.mk
|
||||
clean:
|
||||
$(call __silent,RM,objs)rm -f $(ALL_OBJS) $(ALL_DEPS)
|
||||
$(call __silent_rm,$(PROGS))
|
||||
$(call __silent_rm,zconf.tab.c zconf.hash.c zconf.lex.c lex.backup)
|
||||
$(call __silent_rm,zconf.tab.c zconf.lex.c lex.backup)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Needed for systems without gettext
|
||||
$* -x c -o /dev/null - > /dev/null 2>&1 << EOF
|
||||
#include <libintl.h>
|
||||
|
@ -538,6 +538,7 @@ int main(int ac, char **av)
|
||||
}
|
||||
if (ac == optind) {
|
||||
printf(_("%s: Kconfig file missing\n"), av[0]);
|
||||
fprintf(stderr, _("See README for usage info\n"));
|
||||
exit(1);
|
||||
}
|
||||
name = av[optind];
|
||||
|
@ -893,7 +893,10 @@ static enum string_value_kind expr_parse_string(const char *str,
|
||||
switch (type) {
|
||||
case S_BOOLEAN:
|
||||
case S_TRISTATE:
|
||||
return k_string;
|
||||
val->s = !strcmp(str, "n") ? 0 :
|
||||
!strcmp(str, "m") ? 1 :
|
||||
!strcmp(str, "y") ? 2 : -1;
|
||||
return k_signed;
|
||||
case S_INT:
|
||||
val->s = strtoll(str, &tail, 10);
|
||||
kind = k_signed;
|
||||
|
@ -85,6 +85,7 @@ struct symbol {
|
||||
struct property *prop;
|
||||
struct expr_value dir_dep;
|
||||
struct expr_value rev_dep;
|
||||
struct expr_value implied;
|
||||
};
|
||||
|
||||
#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
|
||||
@ -136,6 +137,7 @@ enum prop_type {
|
||||
P_DEFAULT, /* default y */
|
||||
P_CHOICE, /* choice value */
|
||||
P_SELECT, /* select BAR */
|
||||
P_IMPLY, /* imply BAR */
|
||||
P_RANGE, /* range 7..100 (for a symbol) */
|
||||
P_ENV, /* value from environment variable */
|
||||
P_SYMBOL, /* where a symbol is defined */
|
||||
|
54
kconfig/kconf_id.c
Normal file
54
kconfig/kconf_id.c
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
static struct kconf_id kconf_id_array[] = {
|
||||
{ "mainmenu", T_MAINMENU, TF_COMMAND },
|
||||
{ "menu", T_MENU, TF_COMMAND },
|
||||
{ "endmenu", T_ENDMENU, TF_COMMAND },
|
||||
{ "source", T_SOURCE, TF_COMMAND },
|
||||
{ "choice", T_CHOICE, TF_COMMAND },
|
||||
{ "endchoice", T_ENDCHOICE, TF_COMMAND },
|
||||
{ "comment", T_COMMENT, TF_COMMAND },
|
||||
{ "config", T_CONFIG, TF_COMMAND },
|
||||
{ "menuconfig", T_MENUCONFIG, TF_COMMAND },
|
||||
{ "help", T_HELP, TF_COMMAND },
|
||||
{ "---help---", T_HELP, TF_COMMAND },
|
||||
{ "if", T_IF, TF_COMMAND|TF_PARAM },
|
||||
{ "endif", T_ENDIF, TF_COMMAND },
|
||||
{ "depends", T_DEPENDS, TF_COMMAND },
|
||||
{ "optional", T_OPTIONAL, TF_COMMAND },
|
||||
{ "default", T_DEFAULT, TF_COMMAND, S_UNKNOWN },
|
||||
{ "prompt", T_PROMPT, TF_COMMAND },
|
||||
{ "tristate", T_TYPE, TF_COMMAND, S_TRISTATE },
|
||||
{ "def_tristate", T_DEFAULT, TF_COMMAND, S_TRISTATE },
|
||||
{ "bool", T_TYPE, TF_COMMAND, S_BOOLEAN },
|
||||
{ "boolean", T_TYPE, TF_COMMAND, S_BOOLEAN },
|
||||
{ "def_bool", T_DEFAULT, TF_COMMAND, S_BOOLEAN },
|
||||
{ "int", T_TYPE, TF_COMMAND, S_INT },
|
||||
{ "hex", T_TYPE, TF_COMMAND, S_HEX },
|
||||
{ "string", T_TYPE, TF_COMMAND, S_STRING },
|
||||
{ "select", T_SELECT, TF_COMMAND },
|
||||
{ "imply", T_IMPLY, TF_COMMAND },
|
||||
{ "range", T_RANGE, TF_COMMAND },
|
||||
{ "visible", T_VISIBLE, TF_COMMAND },
|
||||
{ "option", T_OPTION, TF_COMMAND },
|
||||
{ "on", T_ON, TF_PARAM },
|
||||
{ "modules", T_OPT_MODULES, TF_OPTION },
|
||||
{ "defconfig_list", T_OPT_DEFCONFIG_LIST, TF_OPTION },
|
||||
{ "env", T_OPT_ENV, TF_OPTION },
|
||||
{ "allnoconfig_y", T_OPT_ALLNOCONFIG_Y, TF_OPTION },
|
||||
};
|
||||
|
||||
#define KCONF_ID_ARRAY_SIZE (sizeof(kconf_id_array)/sizeof(struct kconf_id))
|
||||
|
||||
static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < KCONF_ID_ARRAY_SIZE; i++) {
|
||||
struct kconf_id *id = kconf_id_array+i;
|
||||
int l = strlen(id->name);
|
||||
|
||||
if (len == l && !memcmp(str, id->name, len))
|
||||
return id;
|
||||
}
|
||||
return NULL;
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef LIST_H
|
||||
#define LIST_H
|
||||
|
||||
|
@ -62,7 +62,7 @@ enum conf_def_mode {
|
||||
#define T_OPT_ALLNOCONFIG_Y 4
|
||||
|
||||
struct kconf_id {
|
||||
int name;
|
||||
const char *name;
|
||||
int token;
|
||||
unsigned int flags;
|
||||
enum symbol_type stype;
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#include <stdarg.h>
|
||||
|
||||
/* confdata.c */
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Check ncurses compatibility
|
||||
|
||||
# What library to link
|
||||
|
@ -239,6 +239,8 @@ static void sym_check_prop(struct symbol *sym)
|
||||
{
|
||||
struct property *prop;
|
||||
struct symbol *sym2;
|
||||
char *use;
|
||||
|
||||
for (prop = sym->prop; prop; prop = prop->next) {
|
||||
switch (prop->type) {
|
||||
case P_DEFAULT:
|
||||
@ -258,18 +260,20 @@ static void sym_check_prop(struct symbol *sym)
|
||||
}
|
||||
break;
|
||||
case P_SELECT:
|
||||
case P_IMPLY:
|
||||
use = prop->type == P_SELECT ? "select" : "imply";
|
||||
sym2 = prop_get_symbol(prop);
|
||||
if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE)
|
||||
prop_warn(prop,
|
||||
"config symbol '%s' uses select, but is "
|
||||
"not boolean or tristate", sym->name);
|
||||
"config symbol '%s' uses %s, but is "
|
||||
"not boolean or tristate", sym->name, use);
|
||||
else if (sym2->type != S_UNKNOWN &&
|
||||
sym2->type != S_BOOLEAN &&
|
||||
sym2->type != S_TRISTATE)
|
||||
prop_warn(prop,
|
||||
"'%s' has wrong type. 'select' only "
|
||||
"'%s' has wrong type. '%s' only "
|
||||
"accept arguments of boolean and "
|
||||
"tristate type", sym2->name);
|
||||
"tristate type", sym2->name, use);
|
||||
break;
|
||||
case P_RANGE:
|
||||
if (sym->type != S_INT && sym->type != S_HEX)
|
||||
@ -339,6 +343,10 @@ void menu_finalize(struct menu *parent)
|
||||
struct symbol *es = prop_get_symbol(prop);
|
||||
es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr,
|
||||
expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
|
||||
} else if (prop->type == P_IMPLY) {
|
||||
struct symbol *es = prop_get_symbol(prop);
|
||||
es->implied.expr = expr_alloc_or(es->implied.expr,
|
||||
expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -483,7 +491,7 @@ bool menu_is_visible(struct menu *menu)
|
||||
|
||||
if (menu->visibility) {
|
||||
if (expr_calc_value(menu->visibility) == no)
|
||||
return no;
|
||||
return false;
|
||||
}
|
||||
|
||||
sym = menu->sym;
|
||||
@ -618,13 +626,30 @@ static struct property *get_symbol_prop(struct symbol *sym)
|
||||
return prop;
|
||||
}
|
||||
|
||||
static void get_symbol_props_str(struct gstr *r, struct symbol *sym,
|
||||
enum prop_type tok, const char *prefix)
|
||||
{
|
||||
bool hit = false;
|
||||
struct property *prop;
|
||||
|
||||
for_all_properties(sym, prop, tok) {
|
||||
if (!hit) {
|
||||
str_append(r, prefix);
|
||||
hit = true;
|
||||
} else
|
||||
str_printf(r, " && ");
|
||||
expr_gstr_print(prop->expr, r);
|
||||
}
|
||||
if (hit)
|
||||
str_append(r, "\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* head is optional and may be NULL
|
||||
*/
|
||||
static void get_symbol_str(struct gstr *r, struct symbol *sym,
|
||||
struct list_head *head)
|
||||
{
|
||||
bool hit;
|
||||
struct property *prop;
|
||||
|
||||
if (sym && sym->name) {
|
||||
@ -654,22 +679,20 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym,
|
||||
}
|
||||
}
|
||||
|
||||
hit = false;
|
||||
for_all_properties(sym, prop, P_SELECT) {
|
||||
if (!hit) {
|
||||
str_append(r, " Selects: ");
|
||||
hit = true;
|
||||
} else
|
||||
str_printf(r, " && ");
|
||||
expr_gstr_print(prop->expr, r);
|
||||
}
|
||||
if (hit)
|
||||
str_append(r, "\n");
|
||||
get_symbol_props_str(r, sym, P_SELECT, _(" Selects: "));
|
||||
if (sym->rev_dep.expr) {
|
||||
str_append(r, _(" Selected by: "));
|
||||
expr_gstr_print(sym->rev_dep.expr, r);
|
||||
str_append(r, "\n");
|
||||
}
|
||||
|
||||
get_symbol_props_str(r, sym, P_IMPLY, _(" Implies: "));
|
||||
if (sym->implied.expr) {
|
||||
str_append(r, _(" Implied by: "));
|
||||
expr_gstr_print(sym->implied.expr, r);
|
||||
str_append(r, "\n");
|
||||
}
|
||||
|
||||
str_append(r, "\n\n");
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,9 @@
|
||||
* Derived from menuconfig.
|
||||
*
|
||||
*/
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -272,7 +274,7 @@ static struct mitem k_menu_items[MAX_MENU_ITEMS];
|
||||
static int items_num;
|
||||
static int global_exit;
|
||||
/* the currently selected button */
|
||||
const char *current_instructions = menu_instructions;
|
||||
static const char *current_instructions = menu_instructions;
|
||||
|
||||
static char *dialog_input_result;
|
||||
static int dialog_input_result_len;
|
||||
@ -306,7 +308,7 @@ struct function_keys {
|
||||
};
|
||||
|
||||
static const int function_keys_num = 9;
|
||||
struct function_keys function_keys[] = {
|
||||
static struct function_keys function_keys[] = {
|
||||
{
|
||||
.key_str = "F1",
|
||||
.func = "Help",
|
||||
@ -509,7 +511,7 @@ static int get_mext_match(const char *match_str, match_f flag)
|
||||
index = (index + items_num) % items_num;
|
||||
while (true) {
|
||||
char *str = k_menu_items[index].str;
|
||||
if (strcasestr(str, match_str) != 0)
|
||||
if (strcasestr(str, match_str) != NULL)
|
||||
return index;
|
||||
if (flag == FIND_NEXT_MATCH_UP ||
|
||||
flag == MATCH_TINKER_PATTERN_UP)
|
||||
@ -1068,7 +1070,7 @@ static int do_match(int key, struct match_state *state, int *ans)
|
||||
|
||||
static void conf(struct menu *menu)
|
||||
{
|
||||
struct menu *submenu = 0;
|
||||
struct menu *submenu = NULL;
|
||||
const char *prompt = menu_get_prompt(menu);
|
||||
struct symbol *sym;
|
||||
int res;
|
||||
@ -1235,7 +1237,7 @@ static void show_help(struct menu *menu)
|
||||
static void conf_choice(struct menu *menu)
|
||||
{
|
||||
const char *prompt = _(menu_get_prompt(menu));
|
||||
struct menu *child = 0;
|
||||
struct menu *child = NULL;
|
||||
struct symbol *active;
|
||||
int selected_index = 0;
|
||||
int last_top_row = 0;
|
||||
@ -1457,7 +1459,7 @@ static void conf_save(void)
|
||||
}
|
||||
}
|
||||
|
||||
void setup_windows(void)
|
||||
static void setup_windows(void)
|
||||
{
|
||||
int lines, columns;
|
||||
|
||||
|
@ -129,7 +129,7 @@ static void no_colors_theme(void)
|
||||
mkattrn(FUNCTION_TEXT, A_REVERSE);
|
||||
}
|
||||
|
||||
void set_colors()
|
||||
void set_colors(void)
|
||||
{
|
||||
start_color();
|
||||
use_default_colors();
|
||||
@ -192,7 +192,7 @@ const char *get_line(const char *text, int line_no)
|
||||
int lines = 0;
|
||||
|
||||
if (!text)
|
||||
return 0;
|
||||
return NULL;
|
||||
|
||||
for (i = 0; text[i] != '\0' && lines < line_no; i++)
|
||||
if (text[i] == '\n')
|
||||
@ -364,12 +364,14 @@ int dialog_inputbox(WINDOW *main_window,
|
||||
WINDOW *prompt_win;
|
||||
WINDOW *form_win;
|
||||
PANEL *panel;
|
||||
int i, x, y;
|
||||
int i, x, y, lines, columns, win_lines, win_cols;
|
||||
int res = -1;
|
||||
int cursor_position = strlen(init);
|
||||
int cursor_form_win;
|
||||
char *result = *resultp;
|
||||
|
||||
getmaxyx(stdscr, lines, columns);
|
||||
|
||||
if (strlen(init)+1 > *result_len) {
|
||||
*result_len = strlen(init)+1;
|
||||
*resultp = result = realloc(result, *result_len);
|
||||
@ -386,14 +388,19 @@ int dialog_inputbox(WINDOW *main_window,
|
||||
if (title)
|
||||
prompt_width = max(prompt_width, strlen(title));
|
||||
|
||||
win_lines = min(prompt_lines+6, lines-2);
|
||||
win_cols = min(prompt_width+7, columns-2);
|
||||
prompt_lines = max(win_lines-6, 0);
|
||||
prompt_width = max(win_cols-7, 0);
|
||||
|
||||
/* place dialog in middle of screen */
|
||||
y = (getmaxy(stdscr)-(prompt_lines+4))/2;
|
||||
x = (getmaxx(stdscr)-(prompt_width+4))/2;
|
||||
y = (lines-win_lines)/2;
|
||||
x = (columns-win_cols)/2;
|
||||
|
||||
strncpy(result, init, *result_len);
|
||||
|
||||
/* create the windows */
|
||||
win = newwin(prompt_lines+6, prompt_width+7, y, x);
|
||||
win = newwin(win_lines, win_cols, y, x);
|
||||
prompt_win = derwin(win, prompt_lines+1, prompt_width, 2, 2);
|
||||
form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);
|
||||
keypad(form_win, TRUE);
|
||||
|
@ -258,6 +258,15 @@ static void sym_calc_visibility(struct symbol *sym)
|
||||
sym->rev_dep.tri = tri;
|
||||
sym_set_changed(sym);
|
||||
}
|
||||
tri = no;
|
||||
if (sym->implied.expr && sym->dir_dep.tri != no)
|
||||
tri = expr_calc_value(sym->implied.expr);
|
||||
if (tri == mod && sym_get_type(sym) == S_BOOLEAN)
|
||||
tri = yes;
|
||||
if (sym->implied.tri != tri) {
|
||||
sym->implied.tri = tri;
|
||||
sym_set_changed(sym);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -397,6 +406,10 @@ void sym_calc_value(struct symbol *sym)
|
||||
newval.tri = EXPR_AND(expr_calc_value(prop->expr),
|
||||
prop->visible.tri);
|
||||
}
|
||||
if (sym->implied.tri != no) {
|
||||
sym->flags |= SYMBOL_WRITE;
|
||||
newval.tri = EXPR_OR(newval.tri, sym->implied.tri);
|
||||
}
|
||||
}
|
||||
calc_newval:
|
||||
if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) {
|
||||
@ -413,7 +426,8 @@ void sym_calc_value(struct symbol *sym)
|
||||
}
|
||||
newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
|
||||
}
|
||||
if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
|
||||
if (newval.tri == mod &&
|
||||
(sym_get_type(sym) == S_BOOLEAN || sym->implied.tri == yes))
|
||||
newval.tri = yes;
|
||||
break;
|
||||
case S_STRING:
|
||||
@ -498,6 +512,8 @@ bool sym_tristate_within_range(struct symbol *sym, tristate val)
|
||||
return false;
|
||||
if (sym->visible <= sym->rev_dep.tri)
|
||||
return false;
|
||||
if (sym->implied.tri == yes && val == mod)
|
||||
return false;
|
||||
if (sym_is_choice_value(sym) && sym->visible == yes)
|
||||
return val == yes;
|
||||
return val >= sym->rev_dep.tri && val <= sym->visible;
|
||||
@ -750,6 +766,10 @@ const char *sym_get_string_default(struct symbol *sym)
|
||||
if (sym->type == S_BOOLEAN && val == mod)
|
||||
val = yes;
|
||||
|
||||
/* adjust the default value if this symbol is implied by another */
|
||||
if (val < sym->implied.tri)
|
||||
val = sym->implied.tri;
|
||||
|
||||
switch (sym->type) {
|
||||
case S_BOOLEAN:
|
||||
case S_TRISTATE:
|
||||
@ -1041,7 +1061,7 @@ struct symbol **sym_re_search(const char *pattern)
|
||||
}
|
||||
if (sym_match_arr) {
|
||||
qsort(sym_match_arr, cnt, sizeof(struct sym_match), sym_rel_comp);
|
||||
sym_arr = malloc((cnt+1) * sizeof(struct symbol));
|
||||
sym_arr = malloc((cnt+1) * sizeof(struct symbol *));
|
||||
if (!sym_arr)
|
||||
goto sym_re_search_free;
|
||||
for (i = 0; i < cnt; i++)
|
||||
@ -1352,6 +1372,8 @@ const char *prop_get_type_name(enum prop_type type)
|
||||
return "choice";
|
||||
case P_SELECT:
|
||||
return "select";
|
||||
case P_IMPLY:
|
||||
return "imply";
|
||||
case P_RANGE:
|
||||
return "range";
|
||||
case P_SYMBOL:
|
||||
|
@ -1,49 +0,0 @@
|
||||
%language=ANSI-C
|
||||
%define hash-function-name kconf_id_hash
|
||||
%define lookup-function-name kconf_id_lookup
|
||||
%define string-pool-name kconf_id_strings
|
||||
%compare-strncmp
|
||||
%enum
|
||||
%pic
|
||||
%struct-type
|
||||
|
||||
struct kconf_id;
|
||||
|
||||
static const struct kconf_id *kconf_id_lookup(register const char *str, register GPERF_LEN_TYPE len);
|
||||
|
||||
%%
|
||||
mainmenu, T_MAINMENU, TF_COMMAND
|
||||
menu, T_MENU, TF_COMMAND
|
||||
endmenu, T_ENDMENU, TF_COMMAND
|
||||
source, T_SOURCE, TF_COMMAND
|
||||
choice, T_CHOICE, TF_COMMAND
|
||||
endchoice, T_ENDCHOICE, TF_COMMAND
|
||||
comment, T_COMMENT, TF_COMMAND
|
||||
config, T_CONFIG, TF_COMMAND
|
||||
menuconfig, T_MENUCONFIG, TF_COMMAND
|
||||
help, T_HELP, TF_COMMAND
|
||||
---help---, T_HELP, TF_COMMAND
|
||||
if, T_IF, TF_COMMAND|TF_PARAM
|
||||
endif, T_ENDIF, TF_COMMAND
|
||||
depends, T_DEPENDS, TF_COMMAND
|
||||
optional, T_OPTIONAL, TF_COMMAND
|
||||
default, T_DEFAULT, TF_COMMAND, S_UNKNOWN
|
||||
prompt, T_PROMPT, TF_COMMAND
|
||||
tristate, T_TYPE, TF_COMMAND, S_TRISTATE
|
||||
def_tristate, T_DEFAULT, TF_COMMAND, S_TRISTATE
|
||||
bool, T_TYPE, TF_COMMAND, S_BOOLEAN
|
||||
boolean, T_TYPE, TF_COMMAND, S_BOOLEAN
|
||||
def_bool, T_DEFAULT, TF_COMMAND, S_BOOLEAN
|
||||
int, T_TYPE, TF_COMMAND, S_INT
|
||||
hex, T_TYPE, TF_COMMAND, S_HEX
|
||||
string, T_TYPE, TF_COMMAND, S_STRING
|
||||
select, T_SELECT, TF_COMMAND
|
||||
range, T_RANGE, TF_COMMAND
|
||||
visible, T_VISIBLE, TF_COMMAND
|
||||
option, T_OPTION, TF_COMMAND
|
||||
on, T_ON, TF_PARAM
|
||||
modules, T_OPT_MODULES, TF_OPTION
|
||||
defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION
|
||||
env, T_OPT_ENV, TF_OPTION
|
||||
allnoconfig_y, T_OPT_ALLNOCONFIG_Y,TF_OPTION
|
||||
%%
|
@ -31,7 +31,7 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE];
|
||||
static struct menu *current_menu, *current_entry;
|
||||
|
||||
%}
|
||||
%expect 30
|
||||
%expect 32
|
||||
|
||||
%union
|
||||
{
|
||||
@ -62,6 +62,7 @@ static struct menu *current_menu, *current_entry;
|
||||
%token <id>T_TYPE
|
||||
%token <id>T_DEFAULT
|
||||
%token <id>T_SELECT
|
||||
%token <id>T_IMPLY
|
||||
%token <id>T_RANGE
|
||||
%token <id>T_VISIBLE
|
||||
%token <id>T_OPTION
|
||||
@ -100,8 +101,8 @@ static struct menu *current_menu, *current_entry;
|
||||
} if_entry menu_entry choice_entry
|
||||
|
||||
%{
|
||||
/* Include zconf.hash.c here so it can see the token constants. */
|
||||
#include "zconf.hash.c"
|
||||
/* Include zconf_id.c here so it can see the token constants. */
|
||||
#include "kconf_id.c"
|
||||
%}
|
||||
|
||||
%%
|
||||
@ -118,13 +119,13 @@ stmt_list:
|
||||
| stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); }
|
||||
| stmt_list option_name error T_EOL
|
||||
{
|
||||
zconf_error("unexpected option \"%s\"", kconf_id_strings + $2->name);
|
||||
zconf_error("unexpected option \"%s\"", $2->name);
|
||||
}
|
||||
| stmt_list error T_EOL { zconf_error("invalid statement"); }
|
||||
;
|
||||
|
||||
option_name:
|
||||
T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE
|
||||
T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_IMPLY | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE
|
||||
;
|
||||
|
||||
common_stmt:
|
||||
@ -216,6 +217,12 @@ config_option: T_SELECT T_WORD if_expr T_EOL
|
||||
printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
|
||||
};
|
||||
|
||||
config_option: T_IMPLY T_WORD if_expr T_EOL
|
||||
{
|
||||
menu_add_symbol(P_IMPLY, sym_lookup($2, 0), $3);
|
||||
printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno());
|
||||
};
|
||||
|
||||
config_option: T_RANGE symbol symbol if_expr T_EOL
|
||||
{
|
||||
menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4);
|
||||
@ -546,13 +553,13 @@ static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtok
|
||||
{
|
||||
if (id->token != endtoken) {
|
||||
zconf_error("unexpected '%s' within %s block",
|
||||
kconf_id_strings + id->name, zconf_tokenname(starttoken));
|
||||
id->name, zconf_tokenname(starttoken));
|
||||
zconfnerrs++;
|
||||
return false;
|
||||
}
|
||||
if (current_menu->file != current_file) {
|
||||
zconf_error("'%s' in different file than '%s'",
|
||||
kconf_id_strings + id->name, zconf_tokenname(starttoken));
|
||||
id->name, zconf_tokenname(starttoken));
|
||||
fprintf(stderr, "%s:%d: location of the '%s'\n",
|
||||
current_menu->file->name, current_menu->lineno,
|
||||
zconf_tokenname(starttoken));
|
||||
@ -666,6 +673,11 @@ static void print_symbol(FILE *out, struct menu *menu)
|
||||
expr_fprint(prop->expr, out);
|
||||
fputc('\n', out);
|
||||
break;
|
||||
case P_IMPLY:
|
||||
fputs( " imply ", out);
|
||||
expr_fprint(prop->expr, out);
|
||||
fputc('\n', out);
|
||||
break;
|
||||
case P_RANGE:
|
||||
fputs( " range ", out);
|
||||
expr_fprint(prop->expr, out);
|
||||
|
Loading…
Reference in New Issue
Block a user