Skip to content

Commit 605e971

Browse files
committed
Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kconfig updates from Michal Marek: - kconfig warns about junk characters in Kconfig files - merge_config.sh error handling - small cleanup * 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: merge_config.sh: exit on missing input files kconfig: Regenerate shipped zconf.{hash,lex}.c files kconfig: warn of unhandled characters in Kconfig commands kconfig: Delete unnecessary checks before the function call "sym_calc_value"
2 parents dab3c3c + 78a6854 commit 605e971

File tree

7 files changed

+211
-207
lines changed

7 files changed

+211
-207
lines changed

scripts/kconfig/confdata.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ int conf_read_simple(const char *name, int def)
268268
goto load;
269269
sym_add_change_count(1);
270270
if (!sym_defconfig_list) {
271-
if (modules_sym)
272-
sym_calc_value(modules_sym);
271+
sym_calc_value(modules_sym);
273272
return 1;
274273
}
275274

@@ -404,9 +403,7 @@ int conf_read_simple(const char *name, int def)
404403
}
405404
free(line);
406405
fclose(in);
407-
408-
if (modules_sym)
409-
sym_calc_value(modules_sym);
406+
sym_calc_value(modules_sym);
410407
return 0;
411408
}
412409

scripts/kconfig/merge_config.sh

+4
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ cat $INITFILE > $TMP_FILE
100100
# Merge files, printing warnings on overridden values
101101
for MERGE_FILE in $MERGE_LIST ; do
102102
echo "Merging $MERGE_FILE"
103+
if [ ! -r "$MERGE_FILE" ]; then
104+
echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2
105+
exit 1
106+
fi
103107
CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE)
104108

105109
for CFG in $CFG_LIST ; do

scripts/kconfig/symbol.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,7 @@ void sym_clear_all_valid(void)
467467
for_all_symbols(i, sym)
468468
sym->flags &= ~SYMBOL_VALID;
469469
sym_add_change_count(1);
470-
if (modules_sym)
471-
sym_calc_value(modules_sym);
470+
sym_calc_value(modules_sym);
472471
}
473472

474473
bool sym_tristate_within_range(struct symbol *sym, tristate val)

scripts/kconfig/zconf.gperf

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ comment, T_COMMENT, TF_COMMAND
2222
config, T_CONFIG, TF_COMMAND
2323
menuconfig, T_MENUCONFIG, TF_COMMAND
2424
help, T_HELP, TF_COMMAND
25+
---help---, T_HELP, TF_COMMAND
2526
if, T_IF, TF_COMMAND|TF_PARAM
2627
endif, T_ENDIF, TF_COMMAND
2728
depends, T_DEPENDS, TF_COMMAND

scripts/kconfig/zconf.hash.c_shipped

+31-27
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ kconf_id_hash (register const char *str, register unsigned int len)
5050
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
5151
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
5252
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
53-
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
53+
73, 73, 73, 73, 73, 0, 73, 73, 73, 73,
5454
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
5555
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
5656
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
@@ -96,6 +96,7 @@ struct kconf_id_strings_t
9696
char kconf_id_strings_str7[sizeof("default")];
9797
char kconf_id_strings_str8[sizeof("tristate")];
9898
char kconf_id_strings_str9[sizeof("endchoice")];
99+
char kconf_id_strings_str10[sizeof("---help---")];
99100
char kconf_id_strings_str12[sizeof("def_tristate")];
100101
char kconf_id_strings_str13[sizeof("def_bool")];
101102
char kconf_id_strings_str14[sizeof("defconfig_list")];
@@ -132,6 +133,7 @@ static const struct kconf_id_strings_t kconf_id_strings_contents =
132133
"default",
133134
"tristate",
134135
"endchoice",
136+
"---help---",
135137
"def_tristate",
136138
"def_bool",
137139
"defconfig_list",
@@ -172,7 +174,7 @@ kconf_id_lookup (register const char *str, register unsigned int len)
172174
{
173175
enum
174176
{
175-
TOTAL_KEYWORDS = 33,
177+
TOTAL_KEYWORDS = 34,
176178
MIN_WORD_LENGTH = 2,
177179
MAX_WORD_LENGTH = 14,
178180
MIN_HASH_VALUE = 2,
@@ -182,34 +184,36 @@ kconf_id_lookup (register const char *str, register unsigned int len)
182184
static const struct kconf_id wordlist[] =
183185
{
184186
{-1}, {-1},
185-
#line 25 "scripts/kconfig/zconf.gperf"
187+
#line 26 "scripts/kconfig/zconf.gperf"
186188
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_IF, TF_COMMAND|TF_PARAM},
187-
#line 36 "scripts/kconfig/zconf.gperf"
189+
#line 37 "scripts/kconfig/zconf.gperf"
188190
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3, T_TYPE, TF_COMMAND, S_INT},
189191
{-1},
190-
#line 26 "scripts/kconfig/zconf.gperf"
192+
#line 27 "scripts/kconfig/zconf.gperf"
191193
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND},
192194
{-1},
193-
#line 29 "scripts/kconfig/zconf.gperf"
195+
#line 30 "scripts/kconfig/zconf.gperf"
194196
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_DEFAULT, TF_COMMAND, S_UNKNOWN},
195-
#line 31 "scripts/kconfig/zconf.gperf"
197+
#line 32 "scripts/kconfig/zconf.gperf"
196198
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_TYPE, TF_COMMAND, S_TRISTATE},
197199
#line 20 "scripts/kconfig/zconf.gperf"
198200
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9, T_ENDCHOICE, TF_COMMAND},
199-
{-1}, {-1},
200-
#line 32 "scripts/kconfig/zconf.gperf"
201+
#line 25 "scripts/kconfig/zconf.gperf"
202+
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10, T_HELP, TF_COMMAND},
203+
{-1},
204+
#line 33 "scripts/kconfig/zconf.gperf"
201205
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_TRISTATE},
202-
#line 35 "scripts/kconfig/zconf.gperf"
206+
#line 36 "scripts/kconfig/zconf.gperf"
203207
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN},
204-
#line 45 "scripts/kconfig/zconf.gperf"
208+
#line 46 "scripts/kconfig/zconf.gperf"
205209
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_OPT_DEFCONFIG_LIST,TF_OPTION},
206210
{-1}, {-1},
207-
#line 43 "scripts/kconfig/zconf.gperf"
211+
#line 44 "scripts/kconfig/zconf.gperf"
208212
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_ON, TF_PARAM},
209-
#line 28 "scripts/kconfig/zconf.gperf"
213+
#line 29 "scripts/kconfig/zconf.gperf"
210214
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_OPTIONAL, TF_COMMAND},
211215
{-1}, {-1},
212-
#line 42 "scripts/kconfig/zconf.gperf"
216+
#line 43 "scripts/kconfig/zconf.gperf"
213217
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_OPTION, TF_COMMAND},
214218
#line 17 "scripts/kconfig/zconf.gperf"
215219
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_ENDMENU, TF_COMMAND},
@@ -219,51 +223,51 @@ kconf_id_lookup (register const char *str, register unsigned int len)
219223
#line 23 "scripts/kconfig/zconf.gperf"
220224
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str25, T_MENUCONFIG, TF_COMMAND},
221225
{-1},
222-
#line 44 "scripts/kconfig/zconf.gperf"
226+
#line 45 "scripts/kconfig/zconf.gperf"
223227
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION},
224-
#line 47 "scripts/kconfig/zconf.gperf"
228+
#line 48 "scripts/kconfig/zconf.gperf"
225229
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_OPT_ALLNOCONFIG_Y,TF_OPTION},
226230
#line 16 "scripts/kconfig/zconf.gperf"
227231
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND},
228232
{-1},
229-
#line 39 "scripts/kconfig/zconf.gperf"
233+
#line 40 "scripts/kconfig/zconf.gperf"
230234
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SELECT, TF_COMMAND},
231235
#line 21 "scripts/kconfig/zconf.gperf"
232236
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND},
233-
#line 46 "scripts/kconfig/zconf.gperf"
237+
#line 47 "scripts/kconfig/zconf.gperf"
234238
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_OPT_ENV, TF_OPTION},
235239
{-1},
236-
#line 40 "scripts/kconfig/zconf.gperf"
240+
#line 41 "scripts/kconfig/zconf.gperf"
237241
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_RANGE, TF_COMMAND},
238242
#line 19 "scripts/kconfig/zconf.gperf"
239243
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_CHOICE, TF_COMMAND},
240244
{-1}, {-1},
241-
#line 33 "scripts/kconfig/zconf.gperf"
245+
#line 34 "scripts/kconfig/zconf.gperf"
242246
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str39, T_TYPE, TF_COMMAND, S_BOOLEAN},
243247
{-1},
244248
#line 18 "scripts/kconfig/zconf.gperf"
245249
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_SOURCE, TF_COMMAND},
246-
#line 41 "scripts/kconfig/zconf.gperf"
250+
#line 42 "scripts/kconfig/zconf.gperf"
247251
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_VISIBLE, TF_COMMAND},
248-
#line 37 "scripts/kconfig/zconf.gperf"
252+
#line 38 "scripts/kconfig/zconf.gperf"
249253
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str43, T_TYPE, TF_COMMAND, S_HEX},
250254
{-1}, {-1},
251255
#line 22 "scripts/kconfig/zconf.gperf"
252256
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_CONFIG, TF_COMMAND},
253-
#line 34 "scripts/kconfig/zconf.gperf"
257+
#line 35 "scripts/kconfig/zconf.gperf"
254258
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN},
255259
{-1}, {-1}, {-1},
256-
#line 38 "scripts/kconfig/zconf.gperf"
260+
#line 39 "scripts/kconfig/zconf.gperf"
257261
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str51, T_TYPE, TF_COMMAND, S_STRING},
258262
{-1}, {-1},
259263
#line 24 "scripts/kconfig/zconf.gperf"
260264
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str54, T_HELP, TF_COMMAND},
261265
{-1},
262-
#line 30 "scripts/kconfig/zconf.gperf"
266+
#line 31 "scripts/kconfig/zconf.gperf"
263267
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str56, T_PROMPT, TF_COMMAND},
264268
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
265269
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
266-
#line 27 "scripts/kconfig/zconf.gperf"
270+
#line 28 "scripts/kconfig/zconf.gperf"
267271
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str72, T_DEPENDS, TF_COMMAND}
268272
};
269273

@@ -285,5 +289,5 @@ kconf_id_lookup (register const char *str, register unsigned int len)
285289
}
286290
return 0;
287291
}
288-
#line 48 "scripts/kconfig/zconf.gperf"
292+
#line 49 "scripts/kconfig/zconf.gperf"
289293

scripts/kconfig/zconf.l

+11-9
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,16 @@ static void alloc_string(const char *str, int size)
6666
memcpy(text, str, size);
6767
text[size] = 0;
6868
}
69+
70+
static void warn_ignored_character(char chr)
71+
{
72+
fprintf(stderr,
73+
"%s:%d:warning: ignoring unsupported character '%c'\n",
74+
zconf_curname(), zconf_lineno(), chr);
75+
}
6976
%}
7077

71-
n [A-Za-z0-9_]
78+
n [A-Za-z0-9_-]
7279

7380
%%
7481
int str = 0;
@@ -106,7 +113,7 @@ n [A-Za-z0-9_]
106113
zconflval.string = text;
107114
return T_WORD;
108115
}
109-
.
116+
. warn_ignored_character(*yytext);
110117
\n {
111118
BEGIN(INITIAL);
112119
current_file->lineno++;
@@ -132,8 +139,7 @@ n [A-Za-z0-9_]
132139
BEGIN(STRING);
133140
}
134141
\n BEGIN(INITIAL); current_file->lineno++; return T_EOL;
135-
--- /* ignore */
136-
({n}|[-/.])+ {
142+
({n}|[/.])+ {
137143
const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
138144
if (id && id->flags & TF_PARAM) {
139145
zconflval.id = id;
@@ -146,11 +152,7 @@ n [A-Za-z0-9_]
146152
#.* /* comment */
147153
\\\n current_file->lineno++;
148154
[[:blank:]]+
149-
. {
150-
fprintf(stderr,
151-
"%s:%d:warning: ignoring unsupported character '%c'\n",
152-
zconf_curname(), zconf_lineno(), *yytext);
153-
}
155+
. warn_ignored_character(*yytext);
154156
<<EOF>> {
155157
BEGIN(INITIAL);
156158
}

0 commit comments

Comments
 (0)