summaryrefslogtreecommitdiff
path: root/scripts/kconfig
AgeCommit message (Collapse)Author
2024-11-06kconfig: document the positional argument in the help messageMasahiro Yamada
The positional argument specifies the top-level Kconfig. Include this information in the help message. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: remove unnecessary mode check in ConfigItem::updateMenu()Masahiro Yamada
The P_MENU entries ("menu" and "menuconfig") are never displayed in symbolMode. The condition, list->mode == symbolMode, is never met here. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: refactor ConfigInfoView::clicked()Masahiro Yamada
Most of the code in ConfigInfoView::clicked() is unnecessary. There is no need to use the regular expression to search for a symbol. Calling sym_find() is simpler and faster. The hyperlink always begins with the "s" tag, and there is no other tag used. Remove it. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: add sym_get_prompt_menu() helper functionMasahiro Yamada
Split out the code that retrieves the menu entry with a prompt, so it can be reused in other functions. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: remove non-functional href="m..." tagMasahiro Yamada
The only functional tag is href="s<symbol_name>". Commit c4f7398bee9c ("kconfig: qconf: make debug links work again") changed prop->name to sym->name for this reference, but it missed to change the tag "m" to "s". This tag is not functional at all. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: remove redundant check in goBack()Masahiro Yamada
The same check is performed in the configList->setParentMenu() call. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: avoid unnecessary parentSelected() when ESC is pressedMasahiro Yamada
When the ESC key is pressed, the parentSelected() signal is currently emitted for singleMode, menuMode, and symbolMode. However, parentSelected() signal is functional only for singleMode. In menuMode, the signal is connected to the goBack() slot, but nothing occurs because configList->rootEntry is always &rootmenu. In symbolMode (in the right pane), the parentSelected() signal is not connected to any slot. This commit prevents the unnecessary emission of the parentSelected() signal. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: remove ConfigItem::visible memberMasahiro Yamada
The " (NEW)" string should be displayed regardless of the visibility of the associated menu. The ConfigItem::visible member is not used for any other purpose. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: do not show goParent button in split viewMasahiro Yamada
When a menu is selected in the split view, the right pane displays the goParent button, but it is never functional. This is unnecessary, as you can select a menu from the menu tree in the left pane. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: convert the last old connection syntax to Qt5 styleMasahiro Yamada
Commit a2574c12df0d ("kconfig: qconf: convert to Qt5 new signal/slot connection syntax") converted most of the old string-based connections, but one more instance still remains. Convert it to the new style. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: remove unnecessary lastWindowClosed() signal connectionMasahiro Yamada
The default value of the quitOnLastWindowClosed property is true. Hence, the application implicitly quits when the last window is closed. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: remove unnecessary setRootIsDecorated() callMasahiro Yamada
The default value of the rootIsDecorated property is true. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: remove redundant type check for choice membersMasahiro Yamada
Since commit fde192511bdb ("kconfig: remove tristate choice support"), choice members are always boolean. The type check is redundant. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: remove mouse{Press,Move}Event() functionsMasahiro Yamada
These functions simply passes the event to the parent. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: simplify character replacementRolf Eike Beer
Replace the hand crafted lookup table with a QHash. This has the nice benefit that the added offsets can not get out of sync with the length of the replacement strings. Signed-off-by: Rolf Eike Beer <eb@emlix.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: use default platform shortcutsRolf Eike Beer
This renames "Load" to "Open" and switches Ctrl-L to Ctrl-O for the default platforms. This may break the workflow for those used to it, but will make it actually work for everyone else like me who would just expect the default behavior. Add some more standard shortcuts where available. If they replace the existing shortcuts they would have the same value in my case. Signed-off-by: Rolf Eike Beer <eb@emlix.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: qconf: use QString to store path to configuration fileRolf Eike Beer
This is the native type used by the file dialogs and avoids any hassle with filename encoding when converting this back and forth to a character array. Signed-off-by: Rolf Eike Beer <eb@emlix.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06kconfig: nconf: Fix typo in function commentThorsten Blum
s/handles/handled/ Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06streamline_config.pl: remove prompt warnings for configs with defaultsDavid Hunter
Ignore process select warnings for config entries that have a default option. Some config entries have no prompt, and nothing selects them, but these config options are okay because they have a default option. Signed-off-by: David Hunter <david.hunter.linux@gmail.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06streamline_config.pl: ensure all defaults are trackedDavid Hunter
Track default options on the second line. On the second line of some config entries, default and dependency options sometimes appear. In those instances, the state will be "NEW" and not "DEP". Signed-off-by: David Hunter <david.hunter.linux@gmail.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-04streamline_config.pl: fix missing variable operator in debug printDavid Hunter
Put in the dollar sign for the variable '$config'. That way, the debug message has more meaning. Signed-off-by: David Hunter <david.hunter.linux@gmail.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-04kconfig: nconf: Use TAB to cycle thru dialog buttonsThorsten Blum
Add the ability to cycle through dialog buttons with the TAB key. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-04kconfig: qconf: set parent in the widget constructorMasahiro Yamada
The ->addWidget() method re-parents the widget. The parent QWidget can be specified directly in the constructor. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-04kconfig: qconf: reorder code in ConfigMainWindow() constructorMasahiro Yamada
Rearrange the code to make the upcoming refactoring easier to understand. No functional changes intended. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-04kconfig: qconf: set QSplitter orientation in the constructorMasahiro Yamada
The orientation of the QSplitter can be specified directly in its constructor. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-04kconfig: remove zconfprint()Masahiro Yamada
Turn all warnings during parsing into hard errors. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-04kconfig: remove support for "bool" prompt for choice entriesMasahiro Yamada
Since commit fde192511bdb ("kconfig: remove tristate choice support"), all choice blocks are now boolean. There is no longer a need to specify the choice type explicitly. All "bool" prompts in choice entries have been converted to "prompt". This commit removes support for the "bool" syntax in choice entries. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-10-31kconfig: show sub-menu entries even if the prompt is hiddenMasahiro Yamada
Since commit f79dc03fe68c ("kconfig: refactor choice value calculation"), when EXPERT is disabled, nothing within the "if INPUT" ... "endif" block in drivers/input/Kconfig is displayed. This issue affects all command-line interfaces and GUI frontends. The prompt for INPUT is hidden when EXPERT is disabled. Previously, menu_is_visible() returned true in this case; however, it now returns false, resulting in all sub-menu entries being skipped. Here is a simplified test case illustrating the issue: config A bool "A" if X default y config B bool "B" depends on A When X is disabled, A becomes unconfigurable and is forced to y. B should be displayed, as its dependency is met. This commit restores the necessary code, so menu_is_visible() functions as it did previously. Fixes: f79dc03fe68c ("kconfig: refactor choice value calculation") Reported-by: Edmund Raile <edmund.raile@proton.me> Closes: https://lore.kernel.org/all/5fd0dfc7ff171aa74352e638c276069a5f2e888d.camel@proton.me/ Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-10-02kconfig: qconf: fix buffer overflow in debug linksMasahiro Yamada
If you enable "Option -> Show Debug Info" and click a link, the program terminates with the following error: *** buffer overflow detected ***: terminated The buffer overflow is caused by the following line: strcat(data, "$"); The buffer needs one more byte to accommodate the additional character. Fixes: c4f7398bee9c ("kconfig: qconf: make debug links work again") Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-10-01kconfig: qconf: move conf_read() before drawing tree painMasahiro Yamada
The constructor of ConfigMainWindow() calls show*View(), which needs to calculate symbol values. conf_read() must be called before that. Fixes: 060e05c3b422 ("kconfig: qconf: remove initial call to conf_changed()") Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-10-01kconfig: clear expr::val_is_valid when allocatedMasahiro Yamada
Since commit 95573cac25c6 ("kconfig: cache expression values"), xconfig emits a lot of false-positive "unmet direct dependencies" warnings. While conf_read() clears val_is_valid flags, 'make xconfig' calculates symbol values even before the conf_read() call. This is another issue that should be addressed separately, but it has revealed that the val_is_valid field is not initialized. Fixes: 95573cac25c6 ("kconfig: cache expression values") Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-09-30kconfig: fix infinite loop in sym_calc_choice()Masahiro Yamada
Since commit f79dc03fe68c ("kconfig: refactor choice value calculation"), Kconfig for ARCH=powerpc may result in an infinite loop. This occurs because there are two entries for POWERPC64_CPU in a choice block. If the same symbol appears twice in a choice block, the ->choice_link node is added twice to ->choice_members, resulting a corrupted linked list. A simple test case is: choice prompt "choice" config A bool "A" config B bool "B 1" config B bool "B 2" endchoice Running 'make defconfig' results in an infinite loop. One solution is to replace the current two entries: config POWERPC64_CPU bool "Generic (POWER5 and PowerPC 970 and above)" depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN select PPC_64S_HASH_MMU config POWERPC64_CPU bool "Generic (POWER8 and above)" depends on PPC_BOOK3S_64 && CPU_LITTLE_ENDIAN select ARCH_HAS_FAST_MULTIPLIER select PPC_64S_HASH_MMU select PPC_HAS_LBARX_LHARX with the following single entry: config POWERPC64_CPU bool "Generic 64 bit powerpc" depends on PPC_BOOK3S_64 select ARCH_HAS_FAST_MULTIPLIER if CPU_LITTLE_ENDIAN select PPC_64S_HASH_MMU select PPC_HAS_LBARX_LHARX if CPU_LITTLE_ENDIAN In my opinion, the latter looks cleaner, but PowerPC maintainers may prefer to display different prompts depending on CPU_LITTLE_ENDIAN. For now, this commit fixes the issue in Kconfig, restoring the original behavior. I will reconsider whether such a use case is worth supporting. Fixes: f79dc03fe68c ("kconfig: refactor choice value calculation") Reported-by: Marco Bonelli <marco@mebeim.net> Closes: https://lore.kernel.org/all/1763151587.3581913.1727224126288@privateemail.com/ Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-09-20kconfig: cache expression valuesMasahiro Yamada
Cache expression values to avoid recalculating them repeatedly. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-09-20kconfig: use hash table to reuse expressionsMasahiro Yamada
Currently, every expression in Kconfig files produces a new abstract syntax tree (AST), even if it is identical to a previously encountered one. Consider the following code: config FOO bool "FOO" depends on (A || B) && C config BAR bool "BAR" depends on (A || B) && C config BAZ bool "BAZ" depends on A || B The "depends on" lines are similar, but currently a separate AST is allocated for each one. The current data structure looks like this: FOO->dep ==> AND BAR->dep ==> AND BAZ->dep ==> OR / \ / \ / \ OR C OR C A B / \ / \ A B A B This is redundant; FOO->dep and BAR->dep have identical ASTs but different memory instances. We can optimize this; FOO->dep and BAR->dep can share the same AST, and BAZ->dep can reference its sub tree. The optimized data structure looks like this: FOO->dep, BAR->dep ==> AND / \ BAZ->dep ==> OR C / \ A B This commit introduces a hash table to keep track of allocated expressions. If an identical expression is found, it is reused. This does not necessarily result in memory savings, as menu_finalize() transforms expressions without freeing up stale ones. This will be addressed later. One optimization that can be easily implemented is caching the expression's value. Once FOO's dependency, (A || B) && C, is calculated, it can be cached, eliminating the need to recalculate it for BAR. This commit also reverts commit e983b7b17ad1 ("kconfig/menu.c: fix multiple references to expressions in menu_add_prop()"). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-09-20kconfig: refactor expr_eliminate_dups()Masahiro Yamada
Currently, expr_eliminate_dups() passes two identical pointers down to expr_eliminate_dups1(), which later skips processing identical leaves. This approach is somewhat tricky and, more importantly, it will not work with the refactoring made in the next commit. This commit slightly changes the recursion logic; it deduplicates both the left and right arms, and then passes them to expr_eliminate_dups1(). expr_eliminate_dups() should produce the same result. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-09-20kconfig: add comments to expression transformationsMasahiro Yamada
Provide explanations for complex transformations. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-09-20kconfig: change some expr_*() functions to boolMasahiro Yamada
This clarifies the behavior of these functions. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-09-20scripts: move hash function from scripts/kconfig/ to scripts/include/Masahiro Yamada
This function was originally added by commit 8af27e1dc4e4 ("fixdep: use hash table instead of a single array"). Move it to scripts/include/ so that other host programs can use it. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-09-01kbuild: split x*alloc() functions in kconfig to scripts/include/xalloc.hMasahiro Yamada
These functions will be useful for other host programs. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-09-01kconfig: remove P_SYMBOL propertyMasahiro Yamada
P_SYMBOL is a pseudo property that was previously used for data linking purposes. It is no longer used except for debug prints. Remove it. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-09-01kconfig: stop adding P_SYMBOL property to symbolsMasahiro Yamada
I believe its last usage was in the following code: if (prop == NULL) prop = stack->sym->prop; This code was previously used to print the file name and line number of associated symbols in sym_check_print_recursive(), which was removed by commit 9d0d26604657 ("kconfig: recursive checks drop file/lineno"). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-09-01kconfig: remove dummy assignments to cur_{filename,lineno}Masahiro Yamada
Since commit ca4c74ba306e ("kconfig: remove P_CHOICE property"), menu_finalize() no longer calls menu_add_symbol(). No function references cur_filename or cur_lineno after yyparse(). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-08-06scripts: kconfig: merge_config: config files: add a trailing newlineAnders Roxell
When merging files without trailing newlines at the end of the file, two config fragments end up at the same row if file1.config doens't have a trailing newline at the end of the file. file1.config "CONFIG_1=y" file2.config "CONFIG_2=y" ./scripts/kconfig/merge_config.sh -m .config file1.config file2.config This will generate a .config looking like this. cat .config ... CONFIG_1=yCONFIG_2=y" Making sure so we add a newline at the end of every config file that is passed into the script. Signed-off-by: Anders Roxell <anders.roxell@linaro.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-07-21kbuild: move some helper headers from scripts/kconfig/ to scripts/include/Masahiro Yamada
Move array_size.h, hashtable.h, list.h, list_types.h from scripts/kconfig/ to scripts/include/. These headers will be useful for other host programs. Remove scripts/mod/list.h. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-07-20kconfig: recursive checks drop file/linenoHONG Yifan
This prevents segfault when getting filename and lineno in recursive checks. If the following snippet is found in Kconfig: [Test code 1] config FOO bool depends on BAR select BAR ... without BAR defined; then there is a segfault. Kconfig:34:error: recursive dependency detected! Kconfig:34: symbol FOO depends on BAR make[4]: *** [scripts/kconfig/Makefile:85: allnoconfig] Segmentation fault This is because of the following. BAR is a fake entry created by sym_lookup() with prop being NULL. In the recursive check, there is a NULL check for prop to fall back to stack->sym->prop if stack->prop is NULL. However, in this case, stack->sym points to the fake BAR entry created by sym_lookup(), so prop is still NULL. prop was then referenced without additional NULL checks, causing segfault. As the previous email thread suggests, the file and lineno for select is also wrong: [Test code 2] config FOO bool config BAR bool config FOO bool "FOO" depends on BAR select BAR $ make defconfig *** Default configuration is based on 'x86_64_defconfig' Kconfig:1:error: recursive dependency detected! Kconfig:1: symbol FOO depends on BAR Kconfig:4: symbol BAR is selected by FOO [...] Kconfig:4 should be Kconfig:10. This patch deletes the wrong and segfault-prone filename/lineno inference completely. With this patch, Test code 1 yields: error: recursive dependency detected! symbol FOO depends on BAR symbol BAR is selected by FOO Signed-off-by: HONG Yifan <elsk@google.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-07-20kconfig: remove 'e1' and 'e2' macros from expression deduplicationMasahiro Yamada
I do not think the macros 'e1' and 'e2' are readable. The statement: e1 = expr_alloc_symbol(...); affects the caller's variable, but this is not sufficiently clear from the code. Remove the macros. No functional change intended. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-07-16kconfig: remove SYMBOL_CHOICEVAL flagMasahiro Yamada
This flag is unneeded because a choice member can be detected by other means. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-07-16kconfig: add const qualifiers to several function argumentsMasahiro Yamada
Clarify that the given structures are not modified. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-07-16kconfig: call expr_eliminate_yn() at least once in expr_eliminate_dups()Masahiro Yamada
Kconfig simplifies expressions, but redundant '&&' and '||' operators involving constant symbols 'y' and 'n' are sometimes trimmed and sometimes not. [Test Code] config DEP def_bool y config A bool "A" depends on DEP && y config B bool "B" depends on DEP && y && y [Result] $ make helpnewconfig [ snip ] ----- There is no help available for this option. Symbol: A [=n] Type : bool Defined at Kconfig:4 Prompt: A Depends on: DEP [=y] && y [=y] Location: -> A (A [=n]) ----- ----- There is no help available for this option. Symbol: B [=n] Type : bool Defined at Kconfig:8 Prompt: B Depends on: DEP [=y] Location: -> B (B [=n]) ----- The dependency for A, 'DEP && y', remains as-is, while that for B, 'DEP && y && y', has been reduced to 'DEP'. Currently, expr_eliminate_dups() calls expr_eliminate_yn() only when trans_count != 0, in other words, only when expr_eliminate_dups1() has trimmed at least one leaf. It fails to trim a single '&& y', etc. To fix this inconsistent behavior, expr_eliminate_yn() should be called at least once even if no leaf has been trimmed. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-07-16kconfig: refactor error messages in sym_check_print_recursive()Masahiro Yamada
Improve the error messages and clean up redundant code. [1] remove redundant next_sym->name checks If 'next_sym' is a choice, the first 'if' block is executed. In the subsequent 'else if' blocks, 'next_sym" is not a choice, hence next_sym->name is not NULL. [2] remove redundant sym->name checks A choice is never selected or implied by anyone because it has no name (it is syntactically impossible). If it is, sym->name is not NULL. [3] Show the location of choice instead of "<choice>" "part of choice <choice>" does not convey useful information. Since a choice has no name, it is more informative to display the file name and line number. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>