summaryrefslogtreecommitdiff
path: root/kconfig
diff options
context:
space:
mode:
authorBryan Hundven <bryanhundven@gmail.com>2018-02-01 00:39:45 (GMT)
committerBryan Hundven <bryanhundven@gmail.com>2018-02-01 00:39:45 (GMT)
commit59b08f8d06700770cf1105269acb2ec2460e2a34 (patch)
tree7e26466ff1bdcb344d223d27c24a2014ff54a38f /kconfig
parentba165ed4c0bfa8a83e61a2efd1ad205777978486 (diff)
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>
Diffstat (limited to 'kconfig')
-rw-r--r--kconfig/.gitignore1
-rw-r--r--kconfig/Makefile.in12
-rw-r--r--kconfig/check.sh1
-rw-r--r--kconfig/conf.c1
-rw-r--r--kconfig/expr.c5
-rw-r--r--kconfig/expr.h2
-rw-r--r--kconfig/kconf_id.c54
-rw-r--r--kconfig/list.h1
-rw-r--r--kconfig/lkc.h2
-rw-r--r--kconfig/lkc_proto.h1
-rw-r--r--kconfig/lxdialog/check-lxdialog.sh1
-rw-r--r--kconfig/menu.c57
-rw-r--r--kconfig/nconf.c14
-rw-r--r--kconfig/nconf.gui.c19
-rw-r--r--kconfig/symbol.c26
-rw-r--r--kconfig/zconf.gperf49
-rw-r--r--kconfig/zconf.y26
17 files changed, 174 insertions, 98 deletions
diff --git a/kconfig/.gitignore b/kconfig/.gitignore
index 473d174..49c0689 100644
--- a/kconfig/.gitignore
+++ b/kconfig/.gitignore
@@ -3,7 +3,6 @@ conf
*.o
*.dep
zconf.lex.c
-zconf.hash.c
zconf.tab.c
*.exe
Makefile
diff --git a/kconfig/Makefile.in b/kconfig/Makefile.in
index 403d04b..7e18b6e 100644
--- a/kconfig/Makefile.in
+++ b/kconfig/Makefile.in
@@ -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)
diff --git a/kconfig/check.sh b/kconfig/check.sh
index 55b79ba..97f0fee 100644
--- a/kconfig/check.sh
+++ b/kconfig/check.sh
@@ -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>
diff --git a/kconfig/conf.c b/kconfig/conf.c
index 4a23f54..df87eb4 100644
--- a/kconfig/conf.c
+++ b/kconfig/conf.c
@@ -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];
diff --git a/kconfig/expr.c b/kconfig/expr.c
index cbf4996..8cee597 100644
--- a/kconfig/expr.c
+++ b/kconfig/expr.c
@@ -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;
diff --git a/kconfig/expr.h b/kconfig/expr.h
index 973b6f7..a73f762 100644
--- a/kconfig/expr.h
+++ b/kconfig/expr.h
@@ -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 */
diff --git a/kconfig/kconf_id.c b/kconfig/kconf_id.c
new file mode 100644
index 0000000..5abbc72
--- /dev/null
+++ b/kconfig/kconf_id.c
@@ -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;
+}
diff --git a/kconfig/list.h b/kconfig/list.h
index 2cf23f0..45cb237 100644
--- a/kconfig/list.h
+++ b/kconfig/list.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
#ifndef LIST_H
#define LIST_H
diff --git a/kconfig/lkc.h b/kconfig/lkc.h
index 91ca126..cdcbe43 100644
--- a/kconfig/lkc.h
+++ b/kconfig/lkc.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;
diff --git a/kconfig/lkc_proto.h b/kconfig/lkc_proto.h
index d539871..5d86e2d 100644
--- a/kconfig/lkc_proto.h
+++ b/kconfig/lkc_proto.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
#include <stdarg.h>
/* confdata.c */
diff --git a/kconfig/lxdialog/check-lxdialog.sh b/kconfig/lxdialog/check-lxdialog.sh
index 5075ebf..a10bd9d 100644
--- a/kconfig/lxdialog/check-lxdialog.sh
+++ b/kconfig/lxdialog/check-lxdialog.sh
@@ -1,4 +1,5 @@
#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
# Check ncurses compatibility
# What library to link
diff --git a/kconfig/menu.c b/kconfig/menu.c
index 6a65271..1fd7b25 100644
--- a/kconfig/menu.c
+++ b/kconfig/menu.c
@@ -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");
}
diff --git a/kconfig/nconf.c b/kconfig/nconf.c
index 4db74c9..be76120 100644
--- a/kconfig/nconf.c
+++ b/kconfig/nconf.c
@@ -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;
diff --git a/kconfig/nconf.gui.c b/kconfig/nconf.gui.c
index 8275f0e..a64b1c3 100644
--- a/kconfig/nconf.gui.c
+++ b/kconfig/nconf.gui.c
@@ -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);
diff --git a/kconfig/symbol.c b/kconfig/symbol.c
index 2432298..3c8bd9b 100644
--- a/kconfig/symbol.c
+++ b/kconfig/symbol.c
@@ -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:
diff --git a/kconfig/zconf.gperf b/kconfig/zconf.gperf
deleted file mode 100644
index 434483b..0000000
--- a/kconfig/zconf.gperf
+++ /dev/null
@@ -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
-%%
diff --git a/kconfig/zconf.y b/kconfig/zconf.y
index c3f9a5f..5edf50c 100644
--- a/kconfig/zconf.y
+++ b/kconfig/zconf.y
@@ -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);