History

kconfig: add more S_INT and S_HEX consistency checks

This patch add more number consistency checkg, trying to catch the following situation: config FOO0 hex default 42 config FOO1 string config BAR0 int default FOO1 config BAR1 hex default FOO1 config FOO2 hex default 42h config FOO3 int default "1bar"

Arnaud Lacombe committed 15 years ago

Commit ab60bd01 parent 4ce2c1e1 file · +12 −3Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/kconfig/menu.c+12−3
@@ -183,7 +183,7 @@ void menu_add_option(int token, char *arg) · 182 unmodified lines
183183 }
184184 }
185185
186−static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2)
186+static int menu_validate_number(struct symbol *sym, struct symbol *sym2)
187187 {
188188 return sym2->type == S_INT || sym2->type == S_HEX ||
189189 (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name));
@@ -201,6 +201,15 @@ static void sym_check_prop(struct symbol *sym) · 11 unmodified lines
201201 prop_warn(prop,
202202 "default for config symbol '%s'"
203203 " must be a single symbol", sym->name);
204+ if (prop->expr->type != E_SYMBOL)
205+ break;
206+ sym2 = prop_get_symbol(prop);
207+ if (sym->type == S_HEX || sym->type == S_INT) {
208+ if (!menu_validate_number(sym, sym2))
209+ prop_warn(prop,
210+ "'%s': number is invalid",
211+ sym->name);
212+ }
204213 break;
205214 case P_SELECT:
206215 sym2 = prop_get_symbol(prop);
@@ -220,8 +229,8 @@ static void sym_check_prop(struct symbol *sym) · 13 unmodified lines
220229 if (sym->type != S_INT && sym->type != S_HEX)
221230 prop_warn(prop, "range is only allowed "
222231 "for int or hex symbols");
223− if (!menu_range_valid_sym(sym, prop->expr->left.sym) ||
224− !menu_range_valid_sym(sym, prop->expr->right.sym))
232+ if (!menu_validate_number(sym, prop->expr->left.sym) ||
233+ !menu_validate_number(sym, prop->expr->right.sym))
225234 prop_warn(prop, "range is invalid");
226235 break;
227236 default:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t