Skip to content

Commit 562f36e

Browse files
committed
Merge tag 'kconfig-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kconfig updates from Masahiro Yamada: "A pretty big batch of Kconfig updates. I have to mention the lexer and parser of Kconfig are now built from real .l and .y sources. So, flex and bison are the requirement for building the kernel. Both of them (unlike gperf) have been stable for a long time. This change has been tested several weeks in linux-next, and I did not receive any problem report about this. Summary: - add checks for mistakes, like the choice default is not in choice, help is doubled - document data structure and complex code - fix various memory leaks - change Makefile to build lexer and parser instead of using pre-generated C files - drop 'boolean' keyword, which is equivalent to 'bool' - use default 'yy' prefix and remove unneeded Make variables - fix gettext() check for xconfig - announce that oldnoconfig will be finally removed - make 'Selected by:' and 'Implied by' readable in help and search result - hide silentoldconfig from 'make help' to stop confusing people - fix misc things and cleanups" * tag 'kconfig-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (37 commits) kconfig: Remove silentoldconfig from help and docs; fix kconfig/conf's help kconfig: make "Selected by:" and "Implied by:" readable kconfig: announce removal of oldnoconfig if used kconfig: fix make xconfig when gettext is missing kconfig: Clarify menu and 'if' dependency propagation kconfig: Document 'if' flattening logic kconfig: Clarify choice dependency propagation kconfig: Document SYMBOL_OPTIONAL logic kbuild: remove unnecessary LEX_PREFIX and YACC_PREFIX kconfig: use default 'yy' prefix for lexer and parser kconfig: make conf_unsaved a local variable of conf_read() kconfig: make xfgets() really static kconfig: make input_mode static kconfig: Warn if there is more than one help text kconfig: drop 'boolean' keyword kconfig: use bool instead of boolean for type definition attributes, again kconfig: Remove menu_end_entry() kconfig: Document important expression functions kconfig: Document automatic submenu creation code kconfig: Fix choice symbol expression leak ...
2 parents a659f15 + cedd55d commit 562f36e

20 files changed

Lines changed: 548 additions & 5065 deletions

File tree

‎Documentation/admin-guide/README.rst‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,6 @@ Configuring the kernel
170170
your existing ./.config file and asking about
171171
new config symbols.
172172

173-
"make silentoldconfig"
174-
Like above, but avoids cluttering the screen
175-
with questions already answered.
176-
Additionally updates the dependencies.
177-
178173
"make olddefconfig"
179174
Like above, but sets new symbols to their default
180175
values without prompting.

‎Documentation/process/changes.rst‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ you probably needn't concern yourself with isdn4k-utils.
3232
GNU C 3.2 gcc --version
3333
GNU make 3.81 make --version
3434
binutils 2.20 ld -v
35+
flex 2.5.35 flex --version
36+
bison 2.0 bison --version
3537
util-linux 2.10o fdformat --version
3638
module-init-tools 0.9.10 depmod -V
3739
e2fsprogs 1.41.4 e2fsck -V
@@ -79,6 +81,19 @@ The build system has, as of 4.13, switched to using thin archives (`ar T`)
7981
rather than incremental linking (`ld -r`) for built-in.o intermediate steps.
8082
This requires binutils 2.20 or newer.
8183

84+
Flex
85+
----
86+
87+
Since Linux 4.16, the build system generates lexical analyzers
88+
during build. This requires flex 2.5.35 or later.
89+
90+
91+
Bison
92+
-----
93+
94+
Since Linux 4.16, the build system generates parsers
95+
during build. This requires bison 2.0 or later.
96+
8297
Perl
8398
----
8499

@@ -333,6 +348,16 @@ Binutils
333348

334349
- <https://www.kernel.org/pub/linux/devel/binutils/>
335350

351+
Flex
352+
----
353+
354+
- <https://github.com/westes/flex/releases>
355+
356+
Bison
357+
-----
358+
359+
- <ftp://ftp.gnu.org/gnu/bison/>
360+
336361
OpenSSL
337362
-------
338363

‎Makefile‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ NM = $(CROSS_COMPILE)nm
377377
STRIP = $(CROSS_COMPILE)strip
378378
OBJCOPY = $(CROSS_COMPILE)objcopy
379379
OBJDUMP = $(CROSS_COMPILE)objdump
380+
LEX = flex
381+
YACC = bison
380382
AWK = awk
381383
GENKSYMS = scripts/genksyms/genksyms
382384
INSTALLKERNEL := installkernel
@@ -428,7 +430,7 @@ GCC_PLUGINS_CFLAGS :=
428430

429431
export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
430432
export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES
431-
export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE
433+
export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE
432434
export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
433435

434436
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS

‎drivers/firmware/efi/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ config EFI_CAPSULE_LOADER
113113
Most users should say N.
114114

115115
config EFI_CAPSULE_QUIRK_QUARK_CSH
116-
boolean "Add support for Quark capsules with non-standard headers"
116+
bool "Add support for Quark capsules with non-standard headers"
117117
depends on X86 && !64BIT
118118
select EFI_CAPSULE_LOADER
119119
default y

‎drivers/staging/rtlwifi/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ config R8822BE
77
wireless network adapters.
88

99
config RTLWIFI_DEBUG_ST
10-
boolean
10+
bool
1111
depends on R8822BE
1212
default y

‎scripts/Makefile.lib‎

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,39 +186,49 @@ $(foreach m, $(notdir $1), \
186186
$(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))
187187
endef
188188

189-
ifdef REGENERATE_PARSERS
190-
191189
# LEX
192190
# ---------------------------------------------------------------------------
193-
LEX_PREFIX = $(if $(LEX_PREFIX_${baseprereq}),$(LEX_PREFIX_${baseprereq}),yy)
194-
195191
quiet_cmd_flex = LEX $@
196-
cmd_flex = flex -o$@ -L -P $(LEX_PREFIX) $<
192+
cmd_flex = $(LEX) -o$@ -L $<
197193

194+
ifdef REGENERATE_PARSERS
198195
.PRECIOUS: $(src)/%.lex.c_shipped
199196
$(src)/%.lex.c_shipped: $(src)/%.l
200197
$(call cmd,flex)
198+
endif
199+
200+
.PRECIOUS: $(obj)/%.lex.c
201+
$(filter %.lex.c,$(targets)): $(obj)/%.lex.c: $(src)/%.l FORCE
202+
$(call if_changed,flex)
201203

202204
# YACC
203205
# ---------------------------------------------------------------------------
204-
YACC_PREFIX = $(if $(YACC_PREFIX_${baseprereq}),$(YACC_PREFIX_${baseprereq}),yy)
205-
206206
quiet_cmd_bison = YACC $@
207-
cmd_bison = bison -o$@ -t -l -p $(YACC_PREFIX) $<
207+
cmd_bison = $(YACC) -o$@ -t -l $<
208208

209+
ifdef REGENERATE_PARSERS
209210
.PRECIOUS: $(src)/%.tab.c_shipped
210211
$(src)/%.tab.c_shipped: $(src)/%.y
211212
$(call cmd,bison)
213+
endif
214+
215+
.PRECIOUS: $(obj)/%.tab.c
216+
$(filter %.tab.c,$(targets)): $(obj)/%.tab.c: $(src)/%.y FORCE
217+
$(call if_changed,bison)
212218

213219
quiet_cmd_bison_h = YACC $@
214220
cmd_bison_h = bison -o/dev/null --defines=$@ -t -l -p $(YACC_PREFIX) $<
215221

222+
ifdef REGENERATE_PARSERS
216223
.PRECIOUS: $(src)/%.tab.h_shipped
217224
$(src)/%.tab.h_shipped: $(src)/%.y
218225
$(call cmd,bison_h)
219-
220226
endif
221227

228+
.PRECIOUS: $(obj)/%.tab.h
229+
$(filter %.tab.h,$(targets)): $(obj)/%.tab.h: $(src)/%.y FORCE
230+
$(call if_changed,bison_h)
231+
222232
# Shipped files
223233
# ===========================================================================
224234

‎scripts/kconfig/Makefile‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ config: $(obj)/conf
3434
nconfig: $(obj)/nconf
3535
$< $(silent) $(Kconfig)
3636

37+
# This has become an internal implementation detail and is now deprecated
38+
# for external use.
3739
silentoldconfig: $(obj)/conf
3840
$(Q)mkdir -p include/config include/generated
3941
$(Q)test -e include/generated/autoksyms.h || \
@@ -92,6 +94,8 @@ PHONY += oldnoconfig savedefconfig defconfig
9294
# on its behavior (sets new symbols to their default value but not 'n') with the
9395
# counter-intuitive name.
9496
oldnoconfig: olddefconfig
97+
@echo " WARNING: \"oldnoconfig\" target will be removed after Linux 4.19"
98+
@echo " Please use \"olddefconfig\" instead, which is an alias."
9599

96100
savedefconfig: $(obj)/conf
97101
$< $(silent) --$@=defconfig $(Kconfig)
@@ -142,7 +146,6 @@ help:
142146
@echo ' oldconfig - Update current config utilising a provided .config as base'
143147
@echo ' localmodconfig - Update current config disabling modules not loaded'
144148
@echo ' localyesconfig - Update current config converting local mods to core'
145-
@echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
146149
@echo ' defconfig - New config with default from ARCH supplied defconfig'
147150
@echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
148151
@echo ' allnoconfig - New config where all options are answered with no'
@@ -151,8 +154,8 @@ help:
151154
@echo ' alldefconfig - New config with all symbols set to default'
152155
@echo ' randconfig - New config with random answer to all options'
153156
@echo ' listnewconfig - List new options'
154-
@echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their'
155-
@echo ' default value'
157+
@echo ' olddefconfig - Same as oldconfig but sets new symbols to their'
158+
@echo ' default value without prompting'
156159
@echo ' kvmconfig - Enable additional options for kvm guest kernel support'
157160
@echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support'
158161
@echo ' tinyconfig - Configure the tiniest possible kernel'
@@ -191,6 +194,7 @@ gconf-objs := gconf.o zconf.tab.o
191194

192195
hostprogs-y := conf nconf mconf kxgettext qconf gconf
193196

197+
targets += zconf.tab.c zconf.lex.c
194198
clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck
195199
clean-files += zconf.tab.c zconf.lex.c gconf.glade.h
196200
clean-files += config.pot linux.pot
@@ -205,14 +209,12 @@ always := dochecklxdialog
205209

206210
# Add environment specific flags
207211
HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
212+
HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCXX) $(HOSTCXXFLAGS))
208213

209214
# generated files seem to need this to find local include files
210215
HOSTCFLAGS_zconf.lex.o := -I$(src)
211216
HOSTCFLAGS_zconf.tab.o := -I$(src)
212217

213-
LEX_PREFIX_zconf := zconf
214-
YACC_PREFIX_zconf := zconf
215-
216218
HOSTLOADLIBES_qconf = $(KC_QT_LIBS)
217219
HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS)
218220

‎scripts/kconfig/conf.c‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
static void conf(struct menu *menu);
2222
static void check_conf(struct menu *menu);
23-
static void xfgets(char *str, int size, FILE *in);
2423

2524
enum input_mode {
2625
oldaskconfig,
@@ -35,7 +34,8 @@ enum input_mode {
3534
savedefconfig,
3635
listnewconfig,
3736
olddefconfig,
38-
} input_mode = oldaskconfig;
37+
};
38+
static enum input_mode input_mode = oldaskconfig;
3939

4040
static int indent = 1;
4141
static int tty_stdio;
@@ -82,6 +82,13 @@ static void check_stdin(void)
8282
}
8383
}
8484

85+
/* Helper function to facilitate fgets() by Jean Sacren. */
86+
static void xfgets(char *str, int size, FILE *in)
87+
{
88+
if (!fgets(str, size, in))
89+
fprintf(stderr, "\nError in reading or end of file.\n");
90+
}
91+
8592
static int conf_askvalue(struct symbol *sym, const char *def)
8693
{
8794
enum symbol_type type = sym_get_type(sym);
@@ -477,8 +484,9 @@ static void conf_usage(const char *progname)
477484
printf(" --listnewconfig List new options\n");
478485
printf(" --oldaskconfig Start a new configuration using a line-oriented program\n");
479486
printf(" --oldconfig Update a configuration using a provided .config as base\n");
480-
printf(" --silentoldconfig Same as oldconfig, but quietly, additionally update deps\n");
481-
printf(" --olddefconfig Same as silentoldconfig but sets new symbols to their default value\n");
487+
printf(" --silentoldconfig Similar to oldconfig but generates configuration in\n"
488+
" include/{generated/,config/} (oldconfig used to be more verbose)\n");
489+
printf(" --olddefconfig Same as oldconfig but sets new symbols to their default value\n");
482490
printf(" --oldnoconfig An alias of olddefconfig\n");
483491
printf(" --defconfig <file> New config with default defined in <file>\n");
484492
printf(" --savedefconfig <file> Save the minimal current configuration to <file>\n");
@@ -712,12 +720,3 @@ int main(int ac, char **av)
712720
}
713721
return 0;
714722
}
715-
716-
/*
717-
* Helper function to facilitate fgets() by Jean Sacren.
718-
*/
719-
void xfgets(char *str, int size, FILE *in)
720-
{
721-
if (fgets(str, size, in) == NULL)
722-
fprintf(stderr, "\nError in reading or end of file.\n");
723-
}

‎scripts/kconfig/confdata.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static void conf_message(const char *fmt, ...)
2828
__attribute__ ((format (printf, 1, 2)));
2929

3030
static const char *conf_filename;
31-
static int conf_lineno, conf_warnings, conf_unsaved;
31+
static int conf_lineno, conf_warnings;
3232

3333
const char conf_defname[] = "arch/$ARCH/defconfig";
3434

@@ -290,7 +290,6 @@ int conf_read_simple(const char *name, int def)
290290
conf_filename = name;
291291
conf_lineno = 0;
292292
conf_warnings = 0;
293-
conf_unsaved = 0;
294293

295294
def_flags = SYMBOL_DEF << def;
296295
for_all_symbols(i, sym) {
@@ -409,6 +408,7 @@ int conf_read_simple(const char *name, int def)
409408
int conf_read(const char *name)
410409
{
411410
struct symbol *sym;
411+
int conf_unsaved = 0;
412412
int i;
413413

414414
sym_set_change_count(0);
@@ -1123,7 +1123,7 @@ void set_all_choice_values(struct symbol *csym)
11231123
bool conf_set_all_new_symbols(enum conf_def_mode mode)
11241124
{
11251125
struct symbol *sym, *csym;
1126-
int i, cnt, pby, pty, ptm; /* pby: probability of boolean = y
1126+
int i, cnt, pby, pty, ptm; /* pby: probability of bool = y
11271127
* pty: probability of tristate = y
11281128
* ptm: probability of tristate = m
11291129
*/

0 commit comments

Comments
 (0)