Commit graph

1326 commits

Author SHA1 Message Date
Masahiro Yamada
59adbcd805 kconfig: gconf: avoid hardcoding model* in on_treeview*_button_press_event()
It is better not to hardcode model1 or model2 for consistency.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:15 +09:00
Masahiro Yamada
e6991e8004 kconfig: gconf: avoid hardcoding model2 in renderer_edited()
Although this is only used in the right tree view, it is better not to
hardcode model2 for consistency.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada
cae9cdbcd9 kconfig: gconf: avoid hardcoding model2 in on_treeview2_cursor_changed()
The on_treeview2_cursor_changed() handler is connected to both the left
and right tree views, but it hardcodes model2 (the GtkTreeModel of the
right tree view). This is incorrect. Get the associated model from the
view.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada
3beae86595 kconfig: gconf: make key_press_event work in left pane too
Currently, on_treeview2_key_press_event() returns early for the tree1
widget. We can make it work on the left pane as well by avoiding the
hardcoded use of model2.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada
e06b176bf1 kconfig: gconf: remove glade_xml_signal_autoconnect() call
Now that all signals are connected manually, this is no longer
necessary.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada
77e8ff9889 kconfig: gconf: add static qualifiers to event handlers
This fixes several -Wmissing-prototypes warnings.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada
f0049c937d kconfig: gconf: move button1 and save1 initialization code
Move the relevant initialization code closer together.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada
3e0fb3ef01 kconfig: gconf: move the main window event handlers below
This allows removal of the forward delcaration of on_save_activate().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:13 +09:00
Masahiro Yamada
b22bbaea7f kconfig: gconf: grey out button for current view
This clarifies which view is currently selected.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02 10:34:57 +09:00
Masahiro Yamada
8d6b5c14ab kconfig: gconf: refactor view setting code
Factor out common code for setting the view into a new function,
set_view_mode().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02 10:34:02 +09:00
Masahiro Yamada
7ef533938e kconfig: gconf: move init_*() functions below
This allows removal of the forward declaration of renderer_edited().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:35 +09:00
Masahiro Yamada
290fc035df kconfig: gconf: add static qualifiers to variables
I also removed unnecessary initializers.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:35 +09:00
Masahiro Yamada
b4809e25e2 kconfig: gconf: remove unused 'color' variable
This is not used at all.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:35 +09:00
Masahiro Yamada
57b63d17f7 kconfig: gconf: remove unneeded variables in on_treeview*_button_press_event()
Not all position parameters are used here. Passing NULL to
gtk_tree_view_get_cursor() or gtk_tree_view_get_path_at_pos() is
allowed. [1] [2]

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gtk/gtktreeview.c#L12638
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gtk/gtktreeview.c#L12795

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:35 +09:00
Masahiro Yamada
8e3136eb27 kconfig: gconf: remove unneeded variable in on_split_clicked()
The height of the window is not used here. Passing NULL to
gtk_window_get_default_size() is allowed. [1]

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gtk/gtkwindow.c#L3974

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
9b8338fd45 kconfig: gconf: remove unnecessary NULL checks for tree1 and tree2
The tree1 and tree2 variables are initialized earlier in
init_tree_model(), so the NULL checks are redundant.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
b3841b501c kconfig: gconf: remove parents[] array and indent variable
The parents[] array is used to store the GtkTreeIter of parent nodes,
but this can be simplified: we can pass a GtkTreeIter pointer down
when _display_tree() recurses.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
a54b0397d3 kconfig: gconf: remove internal-child="image" nodes from glade
These nodes do not appear to serve anything useful.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
f931a5d37a kconfig: gconf: remove unnecessary gtk_set_locale() call
gtk_set_locale() has been deprecated since version 2.24, and setlocale()
should be used directly. [1]

However, gtk_init() automatically does this, so there is typically no
point in calling this function.

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gtk/gtkmain.c#L1152

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
ace8bee836 kconfig: gconf: remove gtk_tree_view_set_rules_hint() calls
The use of the this function is not recommended, and it has been
deprecated since GTK 3.14.

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/3.14.0/gtk/gtktreeview.c#L11891

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
dc1de6c03b kconfig: gconf: remove gtk_widget_realize() calls
This function is primarily used in widget implementations, and isn't
very useful otherwise.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
ede0a43249 kconfig: gconf: remove gtk_tree_view_column_set_visible() calls
The columns are visible by default.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
0872643688 kconfig: gconf: remove unneeded gtk_tree_view_set_headers_visible() calls
The headers are visible by default.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
5575df3d3a kconfig: gconf: remove meaningless code in init_main_window()
The 'widget' variable is set, but not used in later code.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
ab2924ab5e kconfig: gconf: remove empty if-block
This if-block is empty.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
bff576a2a9 kconfig: gconf: remove old #ifdef GTK_CHECK_VERSION
Remove old code.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
02bb13bd6c kconfig: gconf: always destroy dialog in on_window1_delete_event()
When gtk_dialog_run() returns GTK_RESPONSE_YES or GTK_RESPONSE_NO,
gtk_widget_destroy() is not called, resulting in a memory leak.

It is better to always destroy the dialog, even if the application
is about to exit.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-01 20:07:25 +09:00
Masahiro Yamada
f72ed4c6a3 kconfig: gconf: fix potential memory leak in renderer_edited()
If gtk_tree_model_get_iter() fails, gtk_tree_path_free() is not called.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-06-30 13:20:56 +09:00
Masahiro Yamada
2f2d60f489 kconfig: gconf: make columns resizable
The variable "resizeable" is a typo and always set to FALSE, resulting
in dead code in init_right_tree(). It is unclear column resizing should
be disabled. Enable it.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-06-30 13:20:42 +09:00
Masahiro Yamada
7d1bfaa457 kconfig: re-add menu_get_parent_menu() that returns parent menu
This helper returns the parent menu, or NULL if there is no parent.
The main difference from the previous version is that it always returns
the parent menu even when the given argument is itself a menu.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-06-30 13:20:23 +09:00
Masahiro Yamada
3c292cd004 kconfig: rename menu_get_parent_menu() to menu_get_menu_or_parent_menu()
The current menu_get_parent_menu() does not always return the parent
menu; if the given argument is itself a menu, it returns that menu.

Rename this function to better reflect this behavior.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-06-30 12:52:58 +09:00
Masahiro Yamada
604f5b2127 kconfig: qconf: show selected choice in the Value column
It is useful to display the selected choice's value in the Value column.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-06-30 12:39:04 +09:00
Masahiro Yamada
cd5f1534a3 kconfig: qconf: do not show checkbox icon for choice
When you select "Show All Options" or "Show Prompt Options", choice
entries display a check box icon, but this has no point because
choice is always y since commit fde192511b ("kconfig: remove tristate
choice support").

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-06-30 12:36:43 +09:00
Masahiro Yamada
b04c7e88bc kconfig: set MENU_CHANGED to choice when the selected member is changed
In gconf, choice entries display the selected symbol in the 'Value'
column, but it is not updated when the selected symbol is changed.

Set the MENU_CHANGED flag, so it is updated.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-06-28 01:57:59 +09:00
Yann E. MORIN
694174f94e kconfig: lxdialog: fix 'space' to (de)select options
In case a menu has comment without letters/numbers (eg. characters
matching the regexp '^[^[:alpha:][:digit:]]+$', for example - or *),
hitting space will cycle through those comments, rather than
selecting/deselecting the currently-highlighted option.

This is the behaviour of hitting any letter/digit: jump to the next
option which prompt starts with that letter. The only letters that
do not behave as such are 'y' 'm' and 'n'. Prompts that start with
one of those three letters are instead matched on the first letter
that is not 'y', 'm' or 'n'.

Fix that by treating 'space' as we treat y/m/n, ie. as an action key,
not as shortcut to jump to  prompt.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Cherniaev Andrei <dungeonlords789@naver.com>
[masahiro: took from Buildroot, adjusted the commit subject]
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-06-24 20:30:27 +09:00
Thomas Meyer
0a1eab129f kconfig: use memcmp instead of deprecated bcmp
bcmp() was removed in POSIX.1-2008.

This commit replaces bcmp() with memcmp(). This allows Kconfig to link
with C libraries that do not provide bcmp(), such as Android bionic
libc.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
Reported-by: Abhigyan Ghosh <zscript.team.zs@gmail.com>
[masahiro: update commit description]
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-06-18 10:11:15 +09:00
Masahiro Yamada
0f57c75973 kconfig: introduce menu type enum
Currently, menu->prompt->type is checked to distinguish "comment"
(P_COMMENT) and "menu" (P_MENU) entries from regular "config" entries.
This is odd because P_COMMENT and P_MENU are not properties.

This commit introduces menu type enum to distinguish menu types more
naturally.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-06-06 05:40:25 +09:00
Daniel Gomez
a26fe287ee kconfig: merge_config: use an empty file as initfile
The scripts/kconfig/merge_config.sh script requires an existing
$INITFILE (or the $1 argument) as a base file for merging Kconfig
fragments. However, an empty $INITFILE can serve as an initial starting
point, later referenced by the KCONFIG_ALLCONFIG Makefile variable
if -m is not used. This variable can point to any configuration file
containing preset config symbols (the merged output) as stated in
Documentation/kbuild/kconfig.rst. When -m is used $INITFILE will
contain just the merge output requiring the user to run make (i.e.
KCONFIG_ALLCONFIG=<$INITFILE> make <allnoconfig/alldefconfig> or make
olddefconfig).

Instead of failing when `$INITFILE` is missing, create an empty file and
use it as the starting point for merges.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-04-06 06:22:01 +09:00
Masahiro Yamada
ab5bc764bd kconfig: remove unnecessary cast in sym_get_string()
The explicit casting from (char *) to (const char *) is unneeded.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-03-15 21:16:21 +09:00
Masahiro Yamada
226ac19c21 kconfig: do not clear SYMBOL_VALID when reading include/config/auto.conf
When conf_read_simple() is called with S_DEF_AUTO, it is meant to read
previous symbol values from include/config/auto.conf to determine which
include/config/* files should be touched.

This process should not modify the current symbol status in any way.
However, conf_touch_deps() currently invalidates all symbol values and
recalculates them, which is totally unneeded.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-03-15 21:16:21 +09:00
Masahiro Yamada
a409fc1463 kconfig: fix memory leak in sym_warn_unmet_dep()
The string allocated in sym_warn_unmet_dep() is never freed, leading
to a memory leak when an unmet dependency is detected.

Fixes: f8f69dc0b4 ("kconfig: make unmet dependency warnings readable")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
2025-01-30 08:43:12 +09:00
Masahiro Yamada
a314f52a02 kconfig: fix file name in warnings when loading KCONFIG_DEFCONFIG_LIST
Most 'make *config' commands use .config as the base configuration file.

When .config does not exist, Kconfig tries to load a file listed in
KCONFIG_DEFCONFIG_LIST instead.

However, since commit b75b0a819a ("kconfig: change defconfig_list
option to environment variable"), warning messages have displayed an
incorrect file name in such cases.

Below is a demonstration using Debian Trixie. While loading
/boot/config-6.12.9-amd64, the warning messages incorrectly show .config
as the file name.

With this commit, the correct file name is displayed in warnings.

[Before]

  $ rm -f .config
  $ make config
  #
  # using defaults found in /boot/config-6.12.9-amd64
  #
  .config:6804:warning: symbol value 'm' invalid for FB_BACKLIGHT
  .config:9895:warning: symbol value 'm' invalid for ANDROID_BINDER_IPC

[After]

  $ rm -f .config
  $ make config
  #
  # using defaults found in /boot/config-6.12.9-amd64
  #
  /boot/config-6.12.9-amd64:6804:warning: symbol value 'm' invalid for FB_BACKLIGHT
  /boot/config-6.12.9-amd64:9895:warning: symbol value 'm' invalid for ANDROID_BINDER_IPC

Fixes: b75b0a819a ("kconfig: change defconfig_list option to environment variable")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-01-30 08:40:17 +09:00
Rolf Eike Beer
ad2091dee0 kconfig: qconf: use preferred form of QString API
A QString constructed from a character literal of length 0, i.e. "", is not
"null" for historical reasons. This does not matter here so use the preferred
method isEmpty() instead.

Also directly construct empty QString objects instead of passing in an empty
character literal that has to be parsed into an empty object first.

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Link: https://doc.qt.io/qt-6/qstring.html#distinction-between-null-and-empty-strings
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-01-10 23:01:22 +09:00
Masahiro Yamada
1f937a4bcb kbuild: suppress stdout from merge_config for silent builds
merge_config does not respect the Make's -s (--silent) option.

Let's sink the stdout from merge_config for silent builds.

This commit does not cater to the direct invocation of merge_config.sh
(e.g. arch/mips/Makefile).

Reported-by: Leon Romanovsky <leon@kernel.org>
Closes: https://lore.kernel.org/all/e534ce33b0e1060eb85ece8429810f087b034c88.1733234008.git.leonro@nvidia.com/
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Leon Romanovsky <leon@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
2025-01-10 23:01:21 +09:00
Masahiro Yamada
a49401be4c kconfig: document the positional argument in the help message
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-06 08:46:35 +09:00
Masahiro Yamada
d6a91e28d1 kconfig: qconf: remove unnecessary mode check in ConfigItem::updateMenu()
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-06 08:46:34 +09:00
Masahiro Yamada
a914032b71 kconfig: qconf: refactor ConfigInfoView::clicked()
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-06 08:46:34 +09:00
Masahiro Yamada
bce590f102 kconfig: add sym_get_prompt_menu() helper function
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-06 08:46:34 +09:00
Masahiro Yamada
929ce506d6 kconfig: qconf: remove non-functional href="m..." tag
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>
2024-11-06 08:46:34 +09:00
Masahiro Yamada
8e8ce9531e kconfig: qconf: remove redundant check in goBack()
The same check is performed in the configList->setParentMenu() call.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-11-06 08:46:34 +09:00