The positional argument specifies the top-level Kconfig. Include this
information in the help message.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
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>
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>
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>
The only functional tag is href="s<symbol_name>".
Commit c4f7398bee ("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>
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>
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>
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>
Commit a2574c12df ("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>
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>
Since commit fde192511b ("kconfig: remove tristate choice support"),
choice members are always boolean. The type check is redundant.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
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>
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>
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>
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>
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>
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>
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>
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>
Rearrange the code to make the upcoming refactoring easier to understand.
No functional changes intended.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Since commit fde192511b ("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>
Since commit f79dc03fe6 ("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: f79dc03fe6 ("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>
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: c4f7398bee ("kconfig: qconf: make debug links work again")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
The constructor of ConfigMainWindow() calls show*View(), which needs
to calculate symbol values. conf_read() must be called before that.
Fixes: 060e05c3b4 ("kconfig: qconf: remove initial call to conf_changed()")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Since commit 95573cac25 ("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: 95573cac25 ("kconfig: cache expression values")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Since commit f79dc03fe6 ("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: f79dc03fe6 ("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>
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 e983b7b17a ("kconfig/menu.c: fix
multiple references to expressions in menu_add_prop()").
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
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>
This function was originally added by commit 8af27e1dc4 ("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>
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>
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 9d0d266046 ("kconfig: recursive checks drop file/lineno").
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Since commit ca4c74ba30 ("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>
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>
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>
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>
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>
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>
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>