Re: [PATCH] kconfig: fix submenu rendering of negative dependencies

Nathan Chancellor <[email protected]> Thu, 30 Jul 2026 18:00:02 -0700
Newsgroups gmane.linux.kbuild.devel,gmane.linux.kernel
Message-ID <178545960208.3004192.10262827405138720875.b4-review@b4>
> This fixes the "ironic visualization" issue reported here:
> https://lore.kernel.org/linux-kbuild/[email protected]/
> 
> where a config option FOO is nested in the submenu of the previous option
> BAR, despite FOO actually depending on !BAR.

I would prefer to have a short standalone blurb about the issue reported
at that link so that the commit message is self-contained. Move the link
to the trailers with the Closes: tag.

> I've only tested locally on x86, but as far as I can tell, this only
> changes how 2 options are rendered in the menu:
> 1. NTFS3_FS, no longer in the NTFS_FS submenu, and
> 2. MTD_BLOCK_RO, no longer in the MTD_BLOCK submenu.

These both seem like correct changes from what I can tell.

> Assisted-by: Claude:claude-4.8-opus
> Signed-off-by: Julian Braha <[email protected]>

Tested-by: Nathan Chancellor <[email protected]>

> diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
> index 16f92c4a775a..2b91d16bf14f 100644
> --- a/scripts/kconfig/expr.c
> +++ b/scripts/kconfig/expr.c
> @@ -738,6 +738,39 @@ bool expr_contains_symbol(struct expr *dep, struct symbol *sym)
>  	return false;
>  }
>  
> +/*
> + * Check if the expression references 'sym' in a way that is satisfiable
> + * with 'sym' disabled, e.g.'sym!=y'.
> + *
> + * Expects that expr_transform() was already called on 'expr'.
> + */
> +bool expr_contains_symbol_negated(struct expr *dep, struct symbol *sym)

I get that this mostly mirrors expr_contains_symbol() but I am not sure
I love the name since the symbol might not actually be negated. That
said, I don't really have a better suggestion :/

-- 
Cheers,
Nathan