mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-24 06:56:40 +00:00
kconfig: Sync with upstream v5.6
This commit introduces the following upstream changes: 089b7d890f97 kconfig: Invalidate all symbols after changing to y or m. 5f2fb52fac15 kbuild: rename hostprogs-y/always to hostprogs/always-y c8fb7d7e48d1 kconfig: fix broken dependency in randconfig-generated .config ba82f52e2287 kconfig: fix an "implicit declaration of function" warning a9609686042b kconfig: fix nesting of symbol help text 3460d0bc256a kconfig: distinguish between dependencies and visibility in help text edda15f21974 kconfig: list all definitions of a symbol in help text 89b9060987d9 kconfig: Add yes2modconfig and mod2yesconfig targets. c8138a57bbd1 kconfig: use $(PERL) in Makefile 1d1352373ebc kconfig: fix too deep indentation in Makefile 68f0d62746bc kconfig: localmodconfig: fix indentation for closing brace 5edcef8454a4 kconfig: localmodconfig: remove unused $config adf7c5bd0674 kconfig: squash prop_alloc() into menu_add_prop() 6397d96ba5a5 kconfig: remove sym from struct property 2ffeef615b5e kconfig: remove 'prompt' argument from menu_add_prop() 024352ff8d69 kconfig: move prompt handling to menu_add_prompt() from menu_add_prop() 1be6e791383a kconfig: remove 'prompt' symbol 801b27db4638 kconfig: drop T_WORD from the RHS of 'prompt' symbol de026ca9152c kconfig: use parent->dep as the parentdep of 'menu' f64048a20b0c kconfig: remove the rootmenu check in menu_add_prop() 8b41fc4454e3 kbuild: create modules.builtin without Makefile.modbuiltin or tristate.conf Signed-off-by: Chris Packham <judge.packham@gmail.com>
This commit is contained in:
parent
acce58834d
commit
3bf9edb36c
@ -34,6 +34,8 @@ enum input_mode {
|
|||||||
listnewconfig,
|
listnewconfig,
|
||||||
helpnewconfig,
|
helpnewconfig,
|
||||||
olddefconfig,
|
olddefconfig,
|
||||||
|
yes2modconfig,
|
||||||
|
mod2yesconfig,
|
||||||
};
|
};
|
||||||
static enum input_mode input_mode = oldaskconfig;
|
static enum input_mode input_mode = oldaskconfig;
|
||||||
|
|
||||||
@ -467,6 +469,8 @@ static struct option long_opts[] = {
|
|||||||
{"listnewconfig", no_argument, NULL, listnewconfig},
|
{"listnewconfig", no_argument, NULL, listnewconfig},
|
||||||
{"helpnewconfig", no_argument, NULL, helpnewconfig},
|
{"helpnewconfig", no_argument, NULL, helpnewconfig},
|
||||||
{"olddefconfig", no_argument, NULL, olddefconfig},
|
{"olddefconfig", no_argument, NULL, olddefconfig},
|
||||||
|
{"yes2modconfig", no_argument, NULL, yes2modconfig},
|
||||||
|
{"mod2yesconfig", no_argument, NULL, mod2yesconfig},
|
||||||
{NULL, 0, NULL, 0}
|
{NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -532,6 +536,8 @@ int main(int ac, char **av)
|
|||||||
case listnewconfig:
|
case listnewconfig:
|
||||||
case helpnewconfig:
|
case helpnewconfig:
|
||||||
case olddefconfig:
|
case olddefconfig:
|
||||||
|
case yes2modconfig:
|
||||||
|
case mod2yesconfig:
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
fprintf(stderr, "See README for usage info\n");
|
fprintf(stderr, "See README for usage info\n");
|
||||||
@ -566,6 +572,8 @@ int main(int ac, char **av)
|
|||||||
case listnewconfig:
|
case listnewconfig:
|
||||||
case helpnewconfig:
|
case helpnewconfig:
|
||||||
case olddefconfig:
|
case olddefconfig:
|
||||||
|
case yes2modconfig:
|
||||||
|
case mod2yesconfig:
|
||||||
conf_read(NULL);
|
conf_read(NULL);
|
||||||
break;
|
break;
|
||||||
case allnoconfig:
|
case allnoconfig:
|
||||||
@ -639,6 +647,12 @@ int main(int ac, char **av)
|
|||||||
break;
|
break;
|
||||||
case savedefconfig:
|
case savedefconfig:
|
||||||
break;
|
break;
|
||||||
|
case yes2modconfig:
|
||||||
|
conf_rewrite_mod_or_yes(def_y2m);
|
||||||
|
break;
|
||||||
|
case mod2yesconfig:
|
||||||
|
conf_rewrite_mod_or_yes(def_m2y);
|
||||||
|
break;
|
||||||
case oldaskconfig:
|
case oldaskconfig:
|
||||||
rootEntry = &rootmenu;
|
rootEntry = &rootmenu;
|
||||||
conf(&rootmenu);
|
conf(&rootmenu);
|
||||||
|
@ -710,25 +710,6 @@ static struct conf_printer header_printer_cb =
|
|||||||
.print_comment = header_print_comment,
|
.print_comment = header_print_comment,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Tristate printer
|
|
||||||
*
|
|
||||||
* This printer is used when generating the `include/config/tristate.conf' file.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
tristate_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (sym->type == S_TRISTATE && *value != 'n')
|
|
||||||
fprintf(fp, "%s%s=%c\n", CONFIG_, sym->name, (char)toupper(*value));
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct conf_printer tristate_printer_cb =
|
|
||||||
{
|
|
||||||
.print_symbol = tristate_print_symbol,
|
|
||||||
.print_comment = kconfig_print_comment,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void conf_write_symbol(FILE *fp, struct symbol *sym,
|
static void conf_write_symbol(FILE *fp, struct symbol *sym,
|
||||||
struct conf_printer *printer, void *printer_arg)
|
struct conf_printer *printer, void *printer_arg)
|
||||||
{
|
{
|
||||||
@ -1062,7 +1043,7 @@ int conf_write_autoconf(int overwrite)
|
|||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *autoconf_name = conf_get_autoconfig_name();
|
const char *autoconf_name = conf_get_autoconfig_name();
|
||||||
FILE *out, *tristate, *out_h;
|
FILE *out, *out_h;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!overwrite && is_present(autoconf_name))
|
if (!overwrite && is_present(autoconf_name))
|
||||||
@ -1077,23 +1058,13 @@ int conf_write_autoconf(int overwrite)
|
|||||||
if (!out)
|
if (!out)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
tristate = fopen(".tmpconfig_tristate", "w");
|
|
||||||
if (!tristate) {
|
|
||||||
fclose(out);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
out_h = fopen(".tmpconfig.h", "w");
|
out_h = fopen(".tmpconfig.h", "w");
|
||||||
if (!out_h) {
|
if (!out_h) {
|
||||||
fclose(out);
|
fclose(out);
|
||||||
fclose(tristate);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf_write_heading(out, &kconfig_printer_cb, NULL);
|
conf_write_heading(out, &kconfig_printer_cb, NULL);
|
||||||
|
|
||||||
conf_write_heading(tristate, &tristate_printer_cb, NULL);
|
|
||||||
|
|
||||||
conf_write_heading(out_h, &header_printer_cb, NULL);
|
conf_write_heading(out_h, &header_printer_cb, NULL);
|
||||||
|
|
||||||
for_all_symbols(i, sym) {
|
for_all_symbols(i, sym) {
|
||||||
@ -1101,15 +1072,11 @@ int conf_write_autoconf(int overwrite)
|
|||||||
if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
|
if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* write symbol to auto.conf, tristate and header files */
|
/* write symbols to auto.conf and autoconf.h */
|
||||||
conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1);
|
conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1);
|
||||||
|
|
||||||
conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1);
|
|
||||||
|
|
||||||
conf_write_symbol(out_h, sym, &header_printer_cb, NULL);
|
conf_write_symbol(out_h, sym, &header_printer_cb, NULL);
|
||||||
}
|
}
|
||||||
fclose(out);
|
fclose(out);
|
||||||
fclose(tristate);
|
|
||||||
fclose(out_h);
|
fclose(out_h);
|
||||||
|
|
||||||
name = getenv("KCONFIG_AUTOHEADER");
|
name = getenv("KCONFIG_AUTOHEADER");
|
||||||
@ -1120,14 +1087,6 @@ int conf_write_autoconf(int overwrite)
|
|||||||
if (rename(".tmpconfig.h", name))
|
if (rename(".tmpconfig.h", name))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
name = getenv("KCONFIG_TRISTATE");
|
|
||||||
if (!name)
|
|
||||||
name = "include/config/tristate.conf";
|
|
||||||
if (make_parent_dir(name))
|
|
||||||
return 1;
|
|
||||||
if (rename(".tmpconfig_tristate", name))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (make_parent_dir(autoconf_name))
|
if (make_parent_dir(autoconf_name))
|
||||||
return 1;
|
return 1;
|
||||||
/*
|
/*
|
||||||
@ -1353,7 +1312,7 @@ bool conf_set_all_new_symbols(enum conf_def_mode mode)
|
|||||||
|
|
||||||
sym_calc_value(csym);
|
sym_calc_value(csym);
|
||||||
if (mode == def_random)
|
if (mode == def_random)
|
||||||
has_changed = randomize_choice_values(csym);
|
has_changed |= randomize_choice_values(csym);
|
||||||
else {
|
else {
|
||||||
set_all_choice_values(csym);
|
set_all_choice_values(csym);
|
||||||
has_changed = true;
|
has_changed = true;
|
||||||
@ -1362,3 +1321,18 @@ bool conf_set_all_new_symbols(enum conf_def_mode mode)
|
|||||||
|
|
||||||
return has_changed;
|
return has_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void conf_rewrite_mod_or_yes(enum conf_def_mode mode)
|
||||||
|
{
|
||||||
|
struct symbol *sym;
|
||||||
|
int i;
|
||||||
|
tristate old_val = (mode == def_y2m) ? yes : mod;
|
||||||
|
tristate new_val = (mode == def_y2m) ? mod : yes;
|
||||||
|
|
||||||
|
for_all_symbols(i, sym) {
|
||||||
|
if (sym_get_type(sym) == S_TRISTATE &&
|
||||||
|
sym->def[S_DEF_USER].tri == old_val)
|
||||||
|
sym->def[S_DEF_USER].tri = new_val;
|
||||||
|
}
|
||||||
|
sym_clear_all_valid();
|
||||||
|
}
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#define DEBUG_EXPR 0
|
#define DEBUG_EXPR 0
|
||||||
|
|
||||||
static int expr_eq(struct expr *e1, struct expr *e2);
|
|
||||||
static struct expr *expr_eliminate_yn(struct expr *e);
|
static struct expr *expr_eliminate_yn(struct expr *e);
|
||||||
|
|
||||||
struct expr *expr_alloc_symbol(struct symbol *sym)
|
struct expr *expr_alloc_symbol(struct symbol *sym)
|
||||||
@ -250,7 +249,7 @@ void expr_eliminate_eq(struct expr **ep1, struct expr **ep2)
|
|||||||
* equals some operand in the other (operands do not need to appear in the same
|
* equals some operand in the other (operands do not need to appear in the same
|
||||||
* order), recursively.
|
* order), recursively.
|
||||||
*/
|
*/
|
||||||
static int expr_eq(struct expr *e1, struct expr *e2)
|
int expr_eq(struct expr *e1, struct expr *e2)
|
||||||
{
|
{
|
||||||
int res, old_count;
|
int res, old_count;
|
||||||
|
|
||||||
|
@ -191,7 +191,6 @@ enum prop_type {
|
|||||||
|
|
||||||
struct property {
|
struct property {
|
||||||
struct property *next; /* next property - null if last */
|
struct property *next; /* next property - null if last */
|
||||||
struct symbol *sym; /* the symbol for which the property is associated */
|
|
||||||
enum prop_type type; /* type of property */
|
enum prop_type type; /* type of property */
|
||||||
const char *text; /* the prompt value - P_PROMPT, P_MENU, P_COMMENT */
|
const char *text; /* the prompt value - P_PROMPT, P_MENU, P_COMMENT */
|
||||||
struct expr_value visible;
|
struct expr_value visible;
|
||||||
@ -301,6 +300,7 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
|
|||||||
struct expr *expr_copy(const struct expr *org);
|
struct expr *expr_copy(const struct expr *org);
|
||||||
void expr_free(struct expr *e);
|
void expr_free(struct expr *e);
|
||||||
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
|
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
|
||||||
|
int expr_eq(struct expr *e1, struct expr *e2);
|
||||||
tristate expr_calc_value(struct expr *e);
|
tristate expr_calc_value(struct expr *e);
|
||||||
struct expr *expr_trans_bool(struct expr *e);
|
struct expr *expr_trans_bool(struct expr *e);
|
||||||
struct expr *expr_eliminate_dups(struct expr *e);
|
struct expr *expr_eliminate_dups(struct expr *e);
|
||||||
|
@ -34,6 +34,8 @@ enum conf_def_mode {
|
|||||||
def_default,
|
def_default,
|
||||||
def_yes,
|
def_yes,
|
||||||
def_mod,
|
def_mod,
|
||||||
|
def_y2m,
|
||||||
|
def_m2y,
|
||||||
def_no,
|
def_no,
|
||||||
def_random
|
def_random
|
||||||
};
|
};
|
||||||
@ -52,6 +54,7 @@ const char *conf_get_configname(void);
|
|||||||
void sym_set_change_count(int count);
|
void sym_set_change_count(int count);
|
||||||
void sym_add_change_count(int count);
|
void sym_add_change_count(int count);
|
||||||
bool conf_set_all_new_symbols(enum conf_def_mode mode);
|
bool conf_set_all_new_symbols(enum conf_def_mode mode);
|
||||||
|
void conf_rewrite_mod_or_yes(enum conf_def_mode mode);
|
||||||
void set_all_choice_values(struct symbol *csym);
|
void set_all_choice_values(struct symbol *csym);
|
||||||
|
|
||||||
/* confdata.c and expr.c */
|
/* confdata.c and expr.c */
|
||||||
@ -112,7 +115,6 @@ struct symbol *sym_choice_default(struct symbol *sym);
|
|||||||
struct property *sym_get_range_prop(struct symbol *sym);
|
struct property *sym_get_range_prop(struct symbol *sym);
|
||||||
const char *sym_get_string_default(struct symbol *sym);
|
const char *sym_get_string_default(struct symbol *sym);
|
||||||
struct symbol *sym_check_deps(struct symbol *sym);
|
struct symbol *sym_check_deps(struct symbol *sym);
|
||||||
struct property *prop_alloc(enum prop_type type, struct symbol *sym);
|
|
||||||
struct symbol *prop_get_symbol(struct property *prop);
|
struct symbol *prop_get_symbol(struct property *prop);
|
||||||
|
|
||||||
static inline tristate sym_get_tristate_value(struct symbol *sym)
|
static inline tristate sym_get_tristate_value(struct symbol *sym)
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <strings.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
201
kconfig/menu.c
201
kconfig/menu.c
@ -124,65 +124,80 @@ void menu_set_type(int type)
|
|||||||
sym_type_name(sym->type), sym_type_name(type));
|
sym_type_name(sym->type), sym_type_name(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep)
|
static struct property *menu_add_prop(enum prop_type type, struct expr *expr,
|
||||||
|
struct expr *dep)
|
||||||
{
|
{
|
||||||
struct property *prop = prop_alloc(type, current_entry->sym);
|
struct property *prop;
|
||||||
|
|
||||||
|
prop = xmalloc(sizeof(*prop));
|
||||||
|
memset(prop, 0, sizeof(*prop));
|
||||||
|
prop->type = type;
|
||||||
|
prop->file = current_file;
|
||||||
|
prop->lineno = zconf_lineno();
|
||||||
prop->menu = current_entry;
|
prop->menu = current_entry;
|
||||||
prop->expr = expr;
|
prop->expr = expr;
|
||||||
prop->visible.expr = dep;
|
prop->visible.expr = dep;
|
||||||
|
|
||||||
if (prompt) {
|
/* append property to the prop list of symbol */
|
||||||
/* For crostool-NG, a leading pipe followed with spaces
|
if (current_entry->sym) {
|
||||||
* means that pipe shall be removed, and the spaces should
|
struct property **propp;
|
||||||
* not be trimmed.
|
|
||||||
*/
|
|
||||||
if (*prompt == '|')
|
|
||||||
prompt++;
|
|
||||||
else if (isspace(*prompt)) {
|
|
||||||
prop_warn(prop, "leading whitespace ignored");
|
|
||||||
while (isspace(*prompt))
|
|
||||||
prompt++;
|
|
||||||
}
|
|
||||||
if (current_entry->prompt && current_entry != &rootmenu)
|
|
||||||
prop_warn(prop, "prompt redefined");
|
|
||||||
|
|
||||||
/* Apply all upper menus' visibilities to actual prompts. */
|
for (propp = ¤t_entry->sym->prop;
|
||||||
if(type == P_PROMPT) {
|
*propp;
|
||||||
struct menu *menu = current_entry;
|
propp = &(*propp)->next)
|
||||||
|
;
|
||||||
while ((menu = menu->parent) != NULL) {
|
*propp = prop;
|
||||||
struct expr *dup_expr;
|
|
||||||
|
|
||||||
if (!menu->visibility)
|
|
||||||
continue;
|
|
||||||
/*
|
|
||||||
* Do not add a reference to the
|
|
||||||
* menu's visibility expression but
|
|
||||||
* use a copy of it. Otherwise the
|
|
||||||
* expression reduction functions
|
|
||||||
* will modify expressions that have
|
|
||||||
* multiple references which can
|
|
||||||
* cause unwanted side effects.
|
|
||||||
*/
|
|
||||||
dup_expr = expr_copy(menu->visibility);
|
|
||||||
|
|
||||||
prop->visible.expr
|
|
||||||
= expr_alloc_and(prop->visible.expr,
|
|
||||||
dup_expr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
current_entry->prompt = prop;
|
|
||||||
}
|
}
|
||||||
prop->text = prompt;
|
|
||||||
|
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep)
|
struct property *menu_add_prompt(enum prop_type type, char *prompt,
|
||||||
|
struct expr *dep)
|
||||||
{
|
{
|
||||||
return menu_add_prop(type, prompt, NULL, dep);
|
struct property *prop = menu_add_prop(type, NULL, dep);
|
||||||
|
|
||||||
|
/* For crostool-NG, a leading pipe followed with spaces
|
||||||
|
* means that pipe shall be removed, and the spaces should
|
||||||
|
* not be trimmed.
|
||||||
|
*/
|
||||||
|
if (*prompt == '|')
|
||||||
|
prompt++;
|
||||||
|
else if (isspace(*prompt)) {
|
||||||
|
prop_warn(prop, "leading whitespace ignored");
|
||||||
|
while (isspace(*prompt))
|
||||||
|
prompt++;
|
||||||
|
}
|
||||||
|
if (current_entry->prompt)
|
||||||
|
prop_warn(prop, "prompt redefined");
|
||||||
|
|
||||||
|
/* Apply all upper menus' visibilities to actual prompts. */
|
||||||
|
if (type == P_PROMPT) {
|
||||||
|
struct menu *menu = current_entry;
|
||||||
|
|
||||||
|
while ((menu = menu->parent) != NULL) {
|
||||||
|
struct expr *dup_expr;
|
||||||
|
|
||||||
|
if (!menu->visibility)
|
||||||
|
continue;
|
||||||
|
/*
|
||||||
|
* Do not add a reference to the menu's visibility
|
||||||
|
* expression but use a copy of it. Otherwise the
|
||||||
|
* expression reduction functions will modify
|
||||||
|
* expressions that have multiple references which
|
||||||
|
* can cause unwanted side effects.
|
||||||
|
*/
|
||||||
|
dup_expr = expr_copy(menu->visibility);
|
||||||
|
|
||||||
|
prop->visible.expr = expr_alloc_and(prop->visible.expr,
|
||||||
|
dup_expr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
current_entry->prompt = prop;
|
||||||
|
prop->text = prompt;
|
||||||
|
|
||||||
|
return prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_add_visibility(struct expr *expr)
|
void menu_add_visibility(struct expr *expr)
|
||||||
@ -193,12 +208,12 @@ void menu_add_visibility(struct expr *expr)
|
|||||||
|
|
||||||
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
|
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
|
||||||
{
|
{
|
||||||
menu_add_prop(type, NULL, expr, dep);
|
menu_add_prop(type, expr, dep);
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
|
void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
|
||||||
{
|
{
|
||||||
menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep);
|
menu_add_prop(type, expr_alloc_symbol(sym), dep);
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_add_option_modules(void)
|
void menu_add_option_modules(void)
|
||||||
@ -332,12 +347,10 @@ void menu_finalize(struct menu *parent)
|
|||||||
* choice value symbols.
|
* choice value symbols.
|
||||||
*/
|
*/
|
||||||
parentdep = expr_alloc_symbol(sym);
|
parentdep = expr_alloc_symbol(sym);
|
||||||
} else if (parent->prompt)
|
} else {
|
||||||
/* Menu node for 'menu' */
|
/* Menu node for 'menu', 'if' */
|
||||||
parentdep = parent->prompt->visible.expr;
|
|
||||||
else
|
|
||||||
/* Menu node for 'if' */
|
|
||||||
parentdep = parent->dep;
|
parentdep = parent->dep;
|
||||||
|
}
|
||||||
|
|
||||||
/* For each child menu node... */
|
/* For each child menu node... */
|
||||||
for (menu = parent->list; menu; menu = menu->next) {
|
for (menu = parent->list; menu; menu = menu->next) {
|
||||||
@ -704,6 +717,21 @@ const char *menu_get_help(struct menu *menu)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void get_def_str(struct gstr *r, struct menu *menu)
|
||||||
|
{
|
||||||
|
str_printf(r, "Defined at %s:%d\n",
|
||||||
|
menu->file->name, menu->lineno);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void get_dep_str(struct gstr *r, struct expr *expr, const char *prefix)
|
||||||
|
{
|
||||||
|
if (!expr_is_yes(expr)) {
|
||||||
|
str_append(r, prefix);
|
||||||
|
expr_gstr_print(expr, r);
|
||||||
|
str_append(r, "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void get_prompt_str(struct gstr *r, struct property *prop,
|
static void get_prompt_str(struct gstr *r, struct property *prop,
|
||||||
struct list_head *head)
|
struct list_head *head)
|
||||||
{
|
{
|
||||||
@ -711,7 +739,20 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
|
|||||||
struct menu *submenu[8], *menu, *location = NULL;
|
struct menu *submenu[8], *menu, *location = NULL;
|
||||||
struct jump_key *jump = NULL;
|
struct jump_key *jump = NULL;
|
||||||
|
|
||||||
str_printf(r, "Prompt: %s\n", prop->text);
|
str_printf(r, " Prompt: %s\n", prop->text);
|
||||||
|
|
||||||
|
get_dep_str(r, prop->menu->dep, " Depends on: ");
|
||||||
|
/*
|
||||||
|
* Most prompts in Linux have visibility that exactly matches their
|
||||||
|
* dependencies. For these, we print only the dependencies to improve
|
||||||
|
* readability. However, prompts with inline "if" expressions and
|
||||||
|
* prompts with a parent that has a "visible if" expression have
|
||||||
|
* differing dependencies and visibility. In these rare cases, we
|
||||||
|
* print both.
|
||||||
|
*/
|
||||||
|
if (!expr_eq(prop->menu->dep, prop->visible.expr))
|
||||||
|
get_dep_str(r, prop->visible.expr, " Visible if: ");
|
||||||
|
|
||||||
menu = prop->menu->parent;
|
menu = prop->menu->parent;
|
||||||
for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
|
for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
|
||||||
bool accessible = menu_is_visible(menu);
|
bool accessible = menu_is_visible(menu);
|
||||||
@ -761,18 +802,6 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* get property of type P_SYMBOL
|
|
||||||
*/
|
|
||||||
static struct property *get_symbol_prop(struct symbol *sym)
|
|
||||||
{
|
|
||||||
struct property *prop = NULL;
|
|
||||||
|
|
||||||
for_all_properties(sym, prop, P_SYMBOL)
|
|
||||||
break;
|
|
||||||
return prop;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void get_symbol_props_str(struct gstr *r, struct symbol *sym,
|
static void get_symbol_props_str(struct gstr *r, struct symbol *sym,
|
||||||
enum prop_type tok, const char *prefix)
|
enum prop_type tok, const char *prefix)
|
||||||
{
|
{
|
||||||
@ -812,32 +841,34 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for_all_prompts(sym, prop)
|
|
||||||
get_prompt_str(r, prop, head);
|
|
||||||
|
|
||||||
prop = get_symbol_prop(sym);
|
/* Print the definitions with prompts before the ones without */
|
||||||
if (prop) {
|
for_all_properties(sym, prop, P_SYMBOL) {
|
||||||
str_printf(r, " Defined at %s:%d\n", prop->menu->file->name,
|
if (prop->menu->prompt) {
|
||||||
prop->menu->lineno);
|
get_def_str(r, prop->menu);
|
||||||
if (!expr_is_yes(prop->visible.expr)) {
|
get_prompt_str(r, prop->menu->prompt, head);
|
||||||
str_append(r, " Depends on: ");
|
|
||||||
expr_gstr_print(prop->visible.expr, r);
|
|
||||||
str_append(r, "\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get_symbol_props_str(r, sym, P_SELECT, " Selects: ");
|
for_all_properties(sym, prop, P_SYMBOL) {
|
||||||
if (sym->rev_dep.expr) {
|
if (!prop->menu->prompt) {
|
||||||
expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, " Selected by [y]:\n");
|
get_def_str(r, prop->menu);
|
||||||
expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, " Selected by [m]:\n");
|
get_dep_str(r, prop->menu->dep, " Depends on: ");
|
||||||
expr_gstr_print_revdep(sym->rev_dep.expr, r, no, " Selected by [n]:\n");
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get_symbol_props_str(r, sym, P_IMPLY, " Implies: ");
|
get_symbol_props_str(r, sym, P_SELECT, "Selects: ");
|
||||||
|
if (sym->rev_dep.expr) {
|
||||||
|
expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, "Selected by [y]:\n");
|
||||||
|
expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, "Selected by [m]:\n");
|
||||||
|
expr_gstr_print_revdep(sym->rev_dep.expr, r, no, "Selected by [n]:\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
get_symbol_props_str(r, sym, P_IMPLY, "Implies: ");
|
||||||
if (sym->implied.expr) {
|
if (sym->implied.expr) {
|
||||||
expr_gstr_print_revdep(sym->implied.expr, r, yes, " Implied by [y]:\n");
|
expr_gstr_print_revdep(sym->implied.expr, r, yes, "Implied by [y]:\n");
|
||||||
expr_gstr_print_revdep(sym->implied.expr, r, mod, " Implied by [m]:\n");
|
expr_gstr_print_revdep(sym->implied.expr, r, mod, "Implied by [m]:\n");
|
||||||
expr_gstr_print_revdep(sym->implied.expr, r, no, " Implied by [n]:\n");
|
expr_gstr_print_revdep(sym->implied.expr, r, no, "Implied by [n]:\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
str_append(r, "\n\n");
|
str_append(r, "\n\n");
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#endif
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <strings.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "lkc.h"
|
#include "lkc.h"
|
||||||
|
@ -90,7 +90,6 @@ static struct menu *current_menu, *current_entry;
|
|||||||
%left T_LESS T_LESS_EQUAL T_GREATER T_GREATER_EQUAL
|
%left T_LESS T_LESS_EQUAL T_GREATER T_GREATER_EQUAL
|
||||||
%nonassoc T_NOT
|
%nonassoc T_NOT
|
||||||
|
|
||||||
%type <string> prompt
|
|
||||||
%type <symbol> nonconst_symbol
|
%type <symbol> nonconst_symbol
|
||||||
%type <symbol> symbol
|
%type <symbol> symbol
|
||||||
%type <type> type logic_type default
|
%type <type> type logic_type default
|
||||||
@ -113,7 +112,7 @@ input: mainmenu_stmt stmt_list | stmt_list;
|
|||||||
|
|
||||||
/* mainmenu entry */
|
/* mainmenu entry */
|
||||||
|
|
||||||
mainmenu_stmt: T_MAINMENU prompt T_EOL
|
mainmenu_stmt: T_MAINMENU T_WORD_QUOTE T_EOL
|
||||||
{
|
{
|
||||||
menu_add_prompt(P_MENU, $2, NULL);
|
menu_add_prompt(P_MENU, $2, NULL);
|
||||||
};
|
};
|
||||||
@ -181,7 +180,7 @@ config_option: type prompt_stmt_opt T_EOL
|
|||||||
$1);
|
$1);
|
||||||
};
|
};
|
||||||
|
|
||||||
config_option: T_PROMPT prompt if_expr T_EOL
|
config_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL
|
||||||
{
|
{
|
||||||
menu_add_prompt(P_PROMPT, $2, $3);
|
menu_add_prompt(P_PROMPT, $2, $3);
|
||||||
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
|
||||||
@ -265,7 +264,7 @@ choice_option_list:
|
|||||||
| choice_option_list help
|
| choice_option_list help
|
||||||
;
|
;
|
||||||
|
|
||||||
choice_option: T_PROMPT prompt if_expr T_EOL
|
choice_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL
|
||||||
{
|
{
|
||||||
menu_add_prompt(P_PROMPT, $2, $3);
|
menu_add_prompt(P_PROMPT, $2, $3);
|
||||||
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
|
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
|
||||||
@ -334,7 +333,7 @@ if_stmt: if_entry stmt_list if_end
|
|||||||
|
|
||||||
/* menu entry */
|
/* menu entry */
|
||||||
|
|
||||||
menu: T_MENU prompt T_EOL
|
menu: T_MENU T_WORD_QUOTE T_EOL
|
||||||
{
|
{
|
||||||
menu_add_entry(NULL);
|
menu_add_entry(NULL);
|
||||||
menu_add_prompt(P_MENU, $2, NULL);
|
menu_add_prompt(P_MENU, $2, NULL);
|
||||||
@ -363,7 +362,7 @@ menu_option_list:
|
|||||||
| menu_option_list depends
|
| menu_option_list depends
|
||||||
;
|
;
|
||||||
|
|
||||||
source_stmt: T_SOURCE prompt T_EOL
|
source_stmt: T_SOURCE T_WORD_QUOTE 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_nextfile($2);
|
||||||
@ -372,7 +371,7 @@ source_stmt: T_SOURCE prompt T_EOL
|
|||||||
|
|
||||||
/* comment entry */
|
/* comment entry */
|
||||||
|
|
||||||
comment: T_COMMENT prompt T_EOL
|
comment: T_COMMENT T_WORD_QUOTE T_EOL
|
||||||
{
|
{
|
||||||
menu_add_entry(NULL);
|
menu_add_entry(NULL);
|
||||||
menu_add_prompt(P_COMMENT, $2, NULL);
|
menu_add_prompt(P_COMMENT, $2, NULL);
|
||||||
@ -429,15 +428,11 @@ visible: T_VISIBLE if_expr T_EOL
|
|||||||
|
|
||||||
prompt_stmt_opt:
|
prompt_stmt_opt:
|
||||||
/* empty */
|
/* empty */
|
||||||
| prompt if_expr
|
| T_WORD_QUOTE if_expr
|
||||||
{
|
{
|
||||||
menu_add_prompt(P_PROMPT, $1, $2);
|
menu_add_prompt(P_PROMPT, $1, $2);
|
||||||
};
|
};
|
||||||
|
|
||||||
prompt: T_WORD
|
|
||||||
| T_WORD_QUOTE
|
|
||||||
;
|
|
||||||
|
|
||||||
end: T_ENDMENU T_EOL { $$ = "menu"; }
|
end: T_ENDMENU T_EOL { $$ = "menu"; }
|
||||||
| T_ENDCHOICE T_EOL { $$ = "choice"; }
|
| T_ENDCHOICE T_EOL { $$ = "choice"; }
|
||||||
| T_ENDIF T_EOL { $$ = "if"; }
|
| T_ENDIF T_EOL { $$ = "if"; }
|
||||||
@ -665,7 +660,7 @@ static void print_symbol(FILE *out, struct menu *menu)
|
|||||||
break;
|
break;
|
||||||
case P_SYMBOL:
|
case P_SYMBOL:
|
||||||
fputs( " symbol ", out);
|
fputs( " symbol ", out);
|
||||||
fprintf(out, "%s\n", prop->sym->name);
|
fprintf(out, "%s\n", prop->menu->sym->name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(out, " unknown prop %d!\n", prop->type);
|
fprintf(out, " unknown prop %d!\n", prop->type);
|
||||||
|
@ -1273,28 +1273,6 @@ struct symbol *sym_check_deps(struct symbol *sym)
|
|||||||
return sym2;
|
return sym2;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct property *prop_alloc(enum prop_type type, struct symbol *sym)
|
|
||||||
{
|
|
||||||
struct property *prop;
|
|
||||||
struct property **propp;
|
|
||||||
|
|
||||||
prop = xmalloc(sizeof(*prop));
|
|
||||||
memset(prop, 0, sizeof(*prop));
|
|
||||||
prop->type = type;
|
|
||||||
prop->sym = sym;
|
|
||||||
prop->file = current_file;
|
|
||||||
prop->lineno = zconf_lineno();
|
|
||||||
|
|
||||||
/* append property to the prop list of symbol */
|
|
||||||
if (sym) {
|
|
||||||
for (propp = &sym->prop; *propp; propp = &(*propp)->next)
|
|
||||||
;
|
|
||||||
*propp = prop;
|
|
||||||
}
|
|
||||||
|
|
||||||
return prop;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct symbol *prop_get_symbol(struct property *prop)
|
struct symbol *prop_get_symbol(struct property *prop)
|
||||||
{
|
{
|
||||||
if (prop->expr && (prop->expr->type == E_SYMBOL ||
|
if (prop->expr && (prop->expr->type == E_SYMBOL ||
|
||||||
|
Loading…
Reference in New Issue
Block a user