aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/zconf.y (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-01-06kconfig: remove unused "file" field of yylval unionMasahiro Yamada1-1/+0
This has never been used. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-28kconfig: split the lexer out of zconf.yMasahiro Yamada1-2/+0
Compile zconf.lex.c independently of the other files. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-28kconfig: split some C files out of zconf.yMasahiro Yamada1-4/+0
I want to compile each C file independently instead of including all of them from zconf.y. Split out confdata.c, expr.c, symbol.c, and preprocess.c . These are low-hanging fruits. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-28kconfig: convert to SPDX License IdentifierMasahiro Yamada1-2/+2
All files in lxdialog/ are licensed under GPL-2.0+, and the rest are under GPL-2.0. I added GPL-2.0 tags to test scripts in tests/. Documentation/process/license-rules.rst does not suggest anything about the flex/bison files. Because flex does not accept the C++ comment style at the very top of a file, I used the C style for zconf.l, and so for zconf.y for consistency. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-28kconfig: remove keyword lookup table entirelyMasahiro Yamada1-5/+0
Commit 7a88488bbc23 ("[PATCH] kconfig: use gperf for kconfig keywords") introduced gperf for the keyword lookup. Then, commit bb3290d91695 ("Remove gperf usage from toolchain") killed the gperf use. As a result, the linear keyword search was left behind. If we do not use gperf, there is no reason to have the separate table of the keywords. Move all keywords back to the lexer. I also refactored the lexer to remove the COMMAND and PARAM states. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-22kconfig: stop associating kconf_id with yylvalMasahiro Yamada1-21/+20
The lexer has conventionally associated kconf_id data with yylval to carry additional information to the parser. No token is relying on this any more. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-22kconfig: refactor end token rulesMasahiro Yamada1-28/+15
T_ENDMENU, T_ENDCHOICE, T_ENDIF are the last users of kconf_id associated with yylval. Refactor them to not use it. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-22kconfig: use T_WORD instead of T_VARIABLE for variablesMasahiro Yamada1-2/+1
There is no grammatical ambiguity by using T_WORD for variables. The parser can distinguish variables from symbols from the context. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-22kconfig: use specific tokens instead of T_ASSIGN for assignmentsMasahiro Yamada1-2/+10
Currently, the lexer returns T_ASSIGN for all of =, :=, and += associating yylval with the flavor. I want to make the generated lexer as simple as possible. So, the lexer should convert keywords to tokens without thinking about the meaning. = -> T_EQUAL := -> T_COLON_EQUAL += -> T_PLUS_EQUAL Unfortunately, Kconfig uses = instead of == for the equal operator. So, the same token T_EQUAL is used for assignment and comparison. The parser can still distinguish them from the context. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-22kconfig: refactor scanning and parsing "option" propertiesMasahiro Yamada1-20/+15
For the keywords "modules", "defconfig_list", and "allnoconfig_y", the lexer should pass specific tokens instead of generic T_WORD. This simplifies both the lexer and the parser. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-22kconfig: use distinct tokens for type and default propertiesMasahiro Yamada1-23/+39
This commit removes kconf_id::stype to prepare for the entire removal of kconf_id.c To simplify the lexer, I want keywords straight-mapped to tokens. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-15kconfig: remove redundant token definesMasahiro Yamada1-5/+0
These are already defined as %left. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-15kconfig: rename depends_list to comment_option_listMasahiro Yamada1-6/+6
Now the comment_stmt is the only user of depends_list. Rename it to comment_option_list Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-15kconfig: loosen the order of "visible" and "depends on" in menu entryMasahiro Yamada1-7/+7
Currently, "visible" and "depends on", if defined in a menu entry, must appear in that order. The real example is in drivers/media/tuners/Kconfig: menu "Customize TV tuners" visible if <expr1> depends on <expr2> ... is fine, but you cannot change the property order like this: menu "Customize TV tuners" depends on <expr2> visible if <expr1> Kconfig does not require a specific order of properties. In this case, menu_add_visibility(() and menu_add_dep() are orthogonal. Loosen this unreasonable restriction. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-15kconfig: remove redundant menu_block ruleMasahiro Yamada1-8/+1
The code block surrounded by "menu" ... "endmenu" is stmt_list. Remove the redundant menu_block symbol entirely. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-15kconfig: remove redundant if_block ruleMasahiro Yamada1-9/+1
The code block surrounded by "if" ... "endif" is stmt_list. Remove the redundant if_block symbol entirely. Remove "stmt_list: stmt_list end" rule as well since it would obviously cause conflicts. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-15kconfig: remove grammatically ambiguous option_errorMasahiro Yamada1-10/+0
This commit decreases 6 shift/reduce conflicts, and finally achieves conflict-free parser. Since Kconfig has no terminator for a config block, detecting the end of config_stmt is not easy. For example, there are two ways for handling the error in the following code: 1 config FOO 2 = [A] Print "unknown option" error, assuming the line 2 is a part of config_option_list [B] Print "invalid statement", assuming the line 1 is reduced into a config_stmt by itself Bison actually chooses [A] because it performs the shift rather than the reduction where both are possible. However, there is no reason to choose one over the other. Let's remove the option_error, and let it fall back to [B]. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-15kconfig: remove grammatically ambiguous "unexpected option" diagnosticMasahiro Yamada1-10/+1
This commit decreases 15 shift/reduce conflicts. The location of this error recovery is ambiguous. For example, there are two ways to interpret the following code: 1 config FOO 2 bool "foo" [A] Both lines are reduced together into a config_stmt. [B] The only line 1 is reduced into a config_stmt, and the line 2 matches to "option_name error T_EOL" Of course, we expect [A], but [B] could be grammatically possible. Kconfig has no terminator for a config block. So, we cannot detect its end until we see a non-property keyword. People often insert a blank line between two config blocks, but it is just a coding convention. Blank lines are actually allowed anywhere in Kconfig files. The real error is when a property keyword appears right after "endif", "endchoice", "endmenu", "source", "comment", or variable assignment. Instead of fixing the grammatical ambiguity, I chose to simply remove this error recovery. The difference is unexpected option "bool" ... is turned into a more generic message: invalid statement Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-13kconfig: fix ambiguous grammar in terms of new linesMasahiro Yamada1-15/+3
This commit decreases 8 shift/reduce conflicts. A certain amount of grammatical ambiguity comes from how to reduce excessive T_EOL tokens. Let's take a look at the example code below: 1 config A 2 bool "a" 3 4 depends on B 5 6 config B 7 def_bool y The line 3 is melt into "config_option_list", but the line 5 can be either a part of "config_option_list" or "common_stmt" by itself. Currently, the lexer converts '\n' to T_EOL verbatim. In Kconfig, a new line works as a statement terminator, but new lines in empty lines are not critical since empty lines (or lines that contain only whitespaces/comments) are just no-op. If the lexer simply discards no-op lines, the parser will not be bothered by excessive T_EOL tokens. Of course, this means we are shifting the complexity from the parser to the lexer, but it is much easier than tackling on shift/reduce conflicts. I introduced the second stage lexer to tweak the behavior. Discard T_EOL if the previous token is T_EOL or T_HELPTEXT. Two T_EOL tokens in a row is meaningless. T_HELPTEXT is a special token that is reduced without T_EOL. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-12-13kconfig: require T_EOL to reduce visible statementMasahiro Yamada1-2/+2
All line-oriented statements should be reduced when seeing a T_EOL token. I guess missing T_EOL for the "visible" statement is just a mistake. This commit decreases one shift/reduce conflict. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-13kconfig: fix the rule of mainmenu_stmt symbolMasahiro Yamada1-2/+2
The rule of mainmenu_stmt does not have debug print of zconf_lineno(), but if it had, it would print a wrong line number for the same reason as commit b2d00d7c61c8 ("kconfig: fix line numbers for if-entries in menu tree"). The mainmenu_stmt does not need to eat following empty lines because they are reduced to common_stmt. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-07-18kconfig: rename SYMBOL_AUTO to SYMBOL_NO_WRITEDirk Gouders1-1/+1
Over time, the use of the flag SYMBOL_AUTO changed from initially marking three automatically generated symbols ARCH, KERNELRELEASE and UNAME_RELEASE to today's effect of protecting symbols from being written out. Currently, only symbols of type CHOICE and those with option defconf_list set have that flag set. Reflect that change in semantics in the flag's name. Signed-off-by: Dirk Gouders <dirk@gouders.net> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-06-28kconfig: handle P_SYMBOL in print_symbol()Dirk Gouders1-0/+4
Each symbol has a property of type P_SYMBOL since commit 59e89e3ddf85 (kconfig: save location of config symbols). Handle those properties in print_symbol(). Further, place a pointer to print_symbol() in the comment above the list of known property type. Signed-off-by: Dirk Gouders <dirk@gouders.net> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-06-25kconfig: fix line numbers for if-entries in menu treeDirk Gouders1-2/+2
The line numers for if-entries in the menu tree are off by one or more lines which is confusing when debugging for correctness of unrelated changes. According to the git log, commit a02f0570ae201c49 (kconfig: improve error handling in the parser) was the last one that changed that part of the parser and replaced "if_entry: T_IF expr T_EOL" by "if_entry: T_IF expr nl" but the commit message does not state why this has been done. When reverting that part of the commit, only the line numers are corrected (checked with cdebug = DEBUG_PARSE in zconf.y), otherwise the menu tree remains unchanged (checked with zconfdump() enabled in conf.c). An example for the corrected line numbers: drivers/soc/Kconfig:15:source drivers/soc/tegra/Kconfig drivers/soc/tegra/Kconfig:4:if drivers/soc/tegra/Kconfig:6:if changes to: drivers/soc/Kconfig:15:source drivers/soc/tegra/Kconfig drivers/soc/tegra/Kconfig:1:if drivers/soc/tegra/Kconfig:4:if Signed-off-by: Dirk Gouders <dirk@gouders.net> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-05-29kconfig: support simply expanded variableMasahiro Yamada1-2/+3
The previous commit added variable and user-defined function. They work similarly in the sense that the evaluation is deferred until they are used. This commit adds another type of variable, simply expanded variable, as we see in Make. The := operator defines a simply expanded variable, expanding the righthand side immediately. This works like traditional programming language variables. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-05-29kconfig: support user-defined function and recursively expanded variableMasahiro Yamada1-1/+18
Now, we got a basic ability to test compiler capability in Kconfig. config CC_HAS_STACKPROTECTOR def_bool $(shell,($(CC) -Werror -fstack-protector -E -x c /dev/null -o /dev/null 2>/dev/null) && echo y || echo n) This works, but it is ugly to repeat this long boilerplate. We want to describe like this: config CC_HAS_STACKPROTECTOR bool default $(cc-option,-fstack-protector) It is straight-forward to add a new function, but I do not like to hard-code specialized functions like that. Hence, here is another feature, user-defined function. This works as a textual shorthand with parameterization. A user-defined function is defined by using the = operator, and can be referenced in the same way as built-in functions. A user-defined function in Make is referenced like $(call my-func,arg1,arg2), but I omitted the 'call' to make the syntax shorter. The definition of a user-defined function contains $(1), $(2), etc. in its body to reference the parameters. It is grammatically valid to pass more or fewer arguments when calling it. We already exploit this feature in our makefiles; scripts/Kbuild.include defines cc-option which takes two arguments at most, but most of the callers pass only one argument. By the way, a variable is supported as a subset of this feature since a variable is "a user-defined function with zero argument". In this context, I mean "variable" as recursively expanded variable. I will add a different flavored variable in the next commit. The code above can be written as follows: [Example Code] success = $(shell,($(1)) >/dev/null 2>&1 && echo y || echo n) cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null) config CC_HAS_STACKPROTECTOR def_bool $(cc-option,-fstack-protector) [Result] $ make -s alldefconfig && tail -n 1 .config CONFIG_CC_HAS_STACKPROTECTOR=y Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-05-29kconfig: make default prompt of mainmenu less specificMasahiro Yamada1-1/+1
If "mainmenu" is not specified, "Linux Kernel Configuration" is used as a default prompt. Given that Kconfig is used in other projects than Linux, let's use a more generic prompt, "Main menu". Suggested-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-05-29kconfig: remove string expansion for mainmenu after yyparse()Masahiro Yamada1-19/+5
Now that environments are expanded in the lexer, conf_parse() does not need to expand them explicitly. The hack introduced by commit 0724a7c32a54 ("kconfig: Don't leak main menus during parsing") can go away. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-05-29kconfig: reference environment variables directly and remove 'option env='Masahiro Yamada1-1/+1
To get access to environment variables, Kconfig needs to define a symbol using "option env=" syntax. It is tedious to add a symbol entry for each environment variable given that we need to define much more such as 'CC', 'AS', 'srctree' etc. to evaluate the compiler capability in Kconfig. Adding '$' for symbol references is grammatically inconsistent. Looking at the code, the symbols prefixed with 'S' are expanded by: - conf_expand_value() This is used to expand 'arch/$ARCH/defconfig' and 'defconfig_list' - sym_expand_string_value() This is used to expand strings in 'source' and 'mainmenu' All of them are fixed values independent of user configuration. So, they can be changed into the direct expansion instead of symbols. This change makes the code much cleaner. The bounce symbols 'SRCARCH', 'ARCH', 'SUBARCH', 'KERNELVERSION' are gone. sym_init() hard-coding 'UNAME_RELEASE' is also gone. 'UNAME_RELEASE' should be replaced with an environment variable. ARCH_DEFCONFIG is a normal symbol, so it should be simply referenced without '$' prefix. The new syntax is addicted by Make. The variable reference needs parentheses, like $(FOO), but you can omit them for single-letter variables, like $F. Yet, in Makefiles, people tend to use the parenthetical form for consistency / clarification. At this moment, only the environment variable is supported, but I will extend the concept of 'variable' later on. The variables are expanded in the lexer so we can simplify the token handling on the parser side. For example, the following code works. [Example code] config MY_TOOLCHAIN_LIST string default "My tools: CC=$(CC), AS=$(AS), CPP=$(CPP)" [Result] $ make -s alldefconfig && tail -n 1 .config CONFIG_MY_TOOLCHAIN_LIST="My tools: CC=gcc, AS=as, CPP=gcc -E" Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Kees Cook <keescook@chromium.org>
2018-05-28kconfig: drop localization supportSam Ravnborg1-1/+1
The localization support is broken and appears unused. There is no google hits on the update-po-config target. And there is no recent (5 years) activity related to the localization. So lets just drop this as it is no longer used. Suggested-by: Ulf Magnusson <ulfalizer@gmail.com> Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-03-02kconfig: Don't leak choice names during parsingMasahiro Yamada1-0/+1
The named choice is not used in the kernel tree, but if it were used, it would not be freed. The intention of the named choice can be seen in the log of commit 5a1aa8a1aff6 ("kconfig: add named choice group"). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-03-02kconfig: add xstrdup() helperMasahiro Yamada1-1/+1
We already have xmalloc(), xcalloc(), and xrealloc((). Add xstrdup() as well to save tedious error handling. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-02-03kconfig: Warn if help text is blankUlf Magnusson1-0/+6
Blank help texts are probably either a typo, a Kconfig misunderstanding, or some kind of half-committing to adding a help text (in which case a TODO comment would be clearer, if the help text really can't be added right away). Best to flag them, IMO. Example warning: drivers/mmc/host/Kconfig:877: warning: 'MMC_TOSHIBA_PCI' defined with blank help text Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: use default 'yy' prefix for lexer and parserMasahiro Yamada1-11/+11
Flex and Bison provide an option to change the prefix of globally- visible symbols. This is useful to link multiple lexers and/or parsers into the same executable. However, Kconfig (and any other host programs in kernel) uses a single lexer and parser. I do not see a good reason to change the default 'yy' prefix. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-01-22kconfig: Warn if there is more than one help textUlf Magnusson1-0/+5
Avoids mistakes like in the following real-world example, where only the final help string ("Say Y...") was used. This particular example was fixed in commit 561b29e4ec8d ("media: fix media Kconfig help syntax issues"). config DVB_NETUP_UNIDVB ... select DVB_CXD2841ER if MEDIA_SUBDRV_AUTOSELECT ---help--- Support for NetUP PCI express Universal DVB card. help Say Y when you want to support NetUP Dual Universal DVB card ... This now prints the following warning: drivers/media/pci/netup_unidvb:13: warning: 'DVB_NETUP_UNIDVB' defined with more than one help text -- only the last one will be used Also free() any extra help strings. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: drop 'boolean' keywordMasahiro Yamada1-1/+1
No more users of this keyword. Drop it according to the notice by commit 6341e62b212a ("kconfig: use bool instead of boolean for type definition attributes"). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Luis R. Rodriguez <mcgrof@kernel.org>
2018-01-22kconfig: Remove menu_end_entry()Ulf Magnusson1-5/+1
menu_end_entry() is empty and completely unused as far as I can tell: $ git log -G menu_end_entry --oneline a02f057 [PATCH] kconfig: improve error handling in the parser 1da177e Linux-2.6.12-rc2 Last one is the initial Git commit, where menu_end_entry() is empty as well. I couldn't find anything that redefined it on Google either. It might be a debugging helper for setting a breakpoint after each config, menuconfig, and comment is parsed. IMO it hurts more than it helps in that case by making the parsing code look more complicated at a glance than it really is, and I suspect it doesn't get used much. Tested by running the Kconfiglib test suite, which indirectly verifies that the .config files generated by the C implementation for each defconfig file in the kernel stays the same. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Don't leak main menus during parsingUlf Magnusson1-9/+24
If a 'mainmenu' entry appeared in the Kconfig files, two things would leak: - The 'struct property' allocated for the default "Linux Kernel Configuration" prompt. - The string for the T_WORD/T_WORD_QUOTE prompt after the T_MAINMENU token, allocated on the heap in zconf.l. To fix it, introduce a new 'no_mainmenu_stmt' nonterminal that matches if there's no 'mainmenu' and adds the default prompt. That means the prompt only gets allocated once regardless of whether there's a 'mainmenu' statement or not, and managing it becomes simple. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 344,568 bytes in 14,352 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 344,440 bytes in 14,350 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-11kconfig: Don't leak 'option' arguments during parsingUlf Magnusson1-1/+3
The following strings would leak before this change: - option env="LEAKED" - option defconfig_list="LEAKED" These come in the form of T_WORD tokens and are always allocated on the heap in zconf.l. Free them. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 344,616 bytes in 14,355 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 344,568 bytes in 14,352 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-11kconfig: Don't leak 'source' filenames during parsingUlf Magnusson1-0/+1
The 'source_stmt' nonterminal takes a 'prompt', which consists of either a T_WORD or a T_WORD_QUOTE, both of which are always allocated on the heap in zconf.l and need to have their associated strings freed. Free them. The existing code already makes sure to always copy the string, but add a warning to sym_expand_string_value() to make it clear that the string must be copied, just in case. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 387,504 bytes in 15,545 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 344,616 bytes in 14,355 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-10kconfig: Don't leak symbol names during parsingUlf Magnusson1-17/+19
Prior to this fix, zconf.y did not free symbol names from zconf.l in these contexts: - After T_CONFIG ('config LEAKED') - After T_MENUCONFIG ('menuconfig LEAKED') - After T_SELECT ('select LEAKED') - After T_IMPLY ('imply LEAKED') - After T_DEFAULT in a choice ('default LEAKED') All of these come in the form of T_WORD tokens, which always have their associated string allocated on the heap in zconf.l and need to be freed. Fix by introducing a new nonterminal 'nonconst_symbol' which takes a T_WORD, fetches the symbol, and then frees the T_WORD string. The already existing 'symbol' nonterminal works the same way but also accepts T_WORD_QUOTE, corresponding to a constant symbol. T_WORD_QUOTE should not be accepted in any of the contexts above, so the 'symbol' nonterminal can't be reused here. Fetching the symbol in 'nonconst_symbol' also removes a bunch of sym_lookup() calls from actions. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 711,571 bytes in 37,756 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 387,504 bytes in 15,545 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-12-12kconfig: Sync zconf.y with zconf.tab.c_shippedUlf Magnusson1-1/+1
Looks like a change to a comment in zconf.y was never committed, because the updated version only appears it zconf.tab.c_shipped. Update the comment in zconf.y to match. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-08-19Remove gperf usage from toolchainLinus Torvalds1-5/+5
It turns out that gperf-3.1 changed types in the generated code in ways that aren't even trivially detectable without having to generate a test-file. It's just not worth using tools and libraries from clowns that don't understand or care about compatibility. So get rid of gperf. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-11-16Kconfig: Introduce the "imply" keywordNicolas Pitre1-2/+14
The "imply" keyword is a weak version of "select" where the target config symbol can still be turned off, avoiding those pitfalls that come with the "select" keyword. This is useful e.g. with multiple drivers that want to indicate their ability to hook into a secondary subsystem while allowing the user to configure that subsystem out without also having to unset these drivers. Currently, the same effect can almost be achieved with: config DRIVER_A tristate config DRIVER_B tristate config DRIVER_C tristate config DRIVER_D tristate [...] config SUBSYSTEM_X tristate default DRIVER_A || DRIVER_B || DRIVER_C || DRIVER_D || [...] This is unwieldy to maintain especially with a large number of drivers. Furthermore, there is no easy way to restrict the choice for SUBSYSTEM_X to y or n, excluding m, when some drivers are built-in. The "select" keyword allows for excluding m, but it excludes n as well. Hence this "imply" keyword. The above becomes: config DRIVER_A tristate imply SUBSYSTEM_X config DRIVER_B tristate imply SUBSYSTEM_X [...] config SUBSYSTEM_X tristate This is much cleaner, and way more flexible than "select". SUBSYSTEM_X can still be configured out, and it can be set as a module when none of the drivers are configured in or all of them are modular. Signed-off-by: Nicolas Pitre <nico@linaro.org> Acked-by: Richard Cochran <richardcochran@gmail.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: John Stultz <john.stultz@linaro.org> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Cc: Paul Bolle <pebolle@tiscali.nl> Cc: linux-kbuild@vger.kernel.org Cc: netdev@vger.kernel.org Cc: Michal Marek <mmarek@suse.com> Cc: Edward Cree <ecree@solarflare.com> Link: http://lkml.kernel.org/r/1478841010-28605-2-git-send-email-nicolas.pitre@linaro.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2015-06-15kconfig: allow use of relations other than (in)equalityJan Beulich1-0/+9
Over the years I found it desirable to be able to use all sorts of relations, not just (in)equality. And apparently I'm not the only one, as there's at least one example in the tree where the programmer assumed this would work (see DEBUG_UART_8250_WORD in arch/arm/Kconfig.debug). Another possible use would e.g. be to fold the two SMP/NR_CPUS prompts into one: SMP could be promptless, simply depending on NR_CPUS > 1. A (desirable) side effect of this change - resulting from numeric values now necessarily being compared as numbers rather than as strings - is that comparing hex values now works as expected: Other than int ones (which aren't allowed to have leading zeroes), zeroes following the 0x prefix made them compare unequal even if their values were equal. Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-06-10kbuild: trivial - use tabs for code indent where possibleMasahiro Yamada1-1/+1
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
2013-09-05kconfig: do not special-case 'MODULES' symbolYann E. MORIN1-9/+2
Currently, the 'MODULES' symbol is hard-coded to be the default symbol that enables/disables tristates, if no other symbol was declared with 'option modules'. While this used to be needed for the Linux kernel, we now have an explicit 'option modules' attached to the 'MODULES' symbol (since cset 11097a036), so we no longer need to special-case it in the kconfig code. Furthermore, kconfig is extensively used out of the Linux kernel, and other projects may have another meaning for a symbol named 'MODULES'. This patch changes the way we enable/disable tristates: if a symbol was found with 'option modules' attached to it, then that symbol controls enabling tristates. Otherwise, tristates are disabled, even if a symbol named 'MODULES' exists. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2011-07-30Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6Linus Torvalds1-1/+0
* 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6: (25 commits) kconfig: Introduce IS_ENABLED(), IS_BUILTIN() and IS_MODULE() xconfig: Abort close if configuration cannot be saved kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h kconfig/nconf: remove useless conditionnal kconfig/nconf: prevent segfault on empty menu kconfig/nconf: use the generic menu_get_ext_help() nconfig: Avoid Wunused-but-set warning kconfig/conf: mark xfgets() private kconfig: remove pending prototypes for kconfig_load() kconfig/conf: add command line options' description kconfig/conf: reduce the scope of `defconfig_file' kconfig: use calloc() for expr allocation kconfig: introduce specialized printer kconfig: do not overwrite symbol direct dependency in assignment kconfig/gconf: silent missing prototype warnings kconfig/gconf: kill deadcode kconfig: nuke LKC_DIRECT_LINK cruft kconfig: nuke reference to SWIG kconfig: add missing <stdlib.h> inclusion kconfig: add missing <ctype.h> inclusion ... Fix up conflicts in scripts/kconfig/Makefile
2011-06-09kconfig: migrate parser to implicit rulesArnaud Lacombe1-1/+1
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
2011-06-09kconfig: kill no longer needed reference to YYDEBUGArnaud Lacombe1-8/+0
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>