<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-linux/scripts/kconfig/symbol.c, branch jd/bump-compilers</title>
<subtitle>WireGuard for the Linux kernel</subtitle>
<id>https://git.zx2c4.com/wireguard-linux/atom/scripts/kconfig/symbol.c?h=jd%2Fbump-compilers</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-linux/atom/scripts/kconfig/symbol.c?h=jd%2Fbump-compilers'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/'/>
<updated>2024-07-20T07:33:45Z</updated>
<entry>
<title>kconfig: recursive checks drop file/lineno</title>
<updated>2024-07-20T07:33:45Z</updated>
<author>
<name>HONG Yifan</name>
<email>elsk@google.com</email>
</author>
<published>2024-07-17T01:50:41Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=9d0d266046571f4b3e733c7eb9cf7c959f37fbdd'/>
<id>urn:sha1:9d0d266046571f4b3e733c7eb9cf7c959f37fbdd</id>
<content type='text'>
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-&gt;sym-&gt;prop if stack-&gt;prop is
NULL. However, in this case, stack-&gt;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 &lt;elsk@google.com&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kconfig: remove SYMBOL_CHOICEVAL flag</title>
<updated>2024-07-16T07:07:14Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-07-07T15:38:06Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=94a4b0a4cb4340273a2d67be893f9032fe7b7e26'/>
<id>urn:sha1:94a4b0a4cb4340273a2d67be893f9032fe7b7e26</id>
<content type='text'>
This flag is unneeded because a choice member can be detected by
other means.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kconfig: add const qualifiers to several function arguments</title>
<updated>2024-07-16T07:07:14Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-07-07T15:38:05Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=6425e3b247b1eff04c64091b2af8811d05546a86'/>
<id>urn:sha1:6425e3b247b1eff04c64091b2af8811d05546a86</id>
<content type='text'>
Clarify that the given structures are not modified.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kconfig: refactor error messages in sym_check_print_recursive()</title>
<updated>2024-07-15T16:08:38Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-06-26T18:22:04Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=d5afb4824f142205900aa4a3a133b5dd68720e67'/>
<id>urn:sha1:d5afb4824f142205900aa4a3a133b5dd68720e67</id>
<content type='text'>
Improve the error messages and clean up redundant code.

[1] remove redundant next_sym-&gt;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-&gt;name is not NULL.

[2] remove redundant sym-&gt;name checks

A choice is never selected or implied by anyone because it has no name
(it is syntactically impossible). If it is, sym-&gt;name is not NULL.

[3] Show the location of choice instead of "&lt;choice&gt;"

"part of choice &lt;choice&gt;" 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 &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kconfig: improve error message for recursive dependency in choice</title>
<updated>2024-07-15T16:08:38Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-06-26T18:22:03Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=d67624d814ae40a655981992b0f0d652e6f591b8'/>
<id>urn:sha1:d67624d814ae40a655981992b0f0d652e6f591b8</id>
<content type='text'>
Kconfig detects recursive dependencies in a choice block, but the error
message is unclear.

[Test Code]

    choice
            prompt "choose"
            depends on A

    config A
            bool "A"

    config B
            bool "B"

    endchoice

[Result]

    Kconfig:1:error: recursive dependency detected!
    Kconfig:1:      choice &lt;choice&gt; contains symbol A
    Kconfig:5:      symbol A is part of choice &lt;choice&gt;
    For a resolution refer to Documentation/kbuild/kconfig-language.rst
    subsection "Kconfig recursive dependency limitations"

The phrase "contains symbol A" does not accurately describe the problem.
The issue is that the choice depends on A, which is a member of itself.

The first if-block does not print a sensible message. Remove it.

This commit improves the error message to:

    Kconfig:1:error: recursive dependency detected!
    Kconfig:1:      symbol &lt;choice&gt; symbol is visible depending on A
    Kconfig:5:      symbol A is part of choice &lt;choice&gt;
    For a resolution refer to Documentation/kbuild/kconfig-language.rst
    subsection "Kconfig recursive dependency limitations"

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kconfig: improve error message for dependency between choice members</title>
<updated>2024-07-15T16:08:38Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-06-26T18:22:02Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=1a7d0ea83e620fd8d7b3ced00a1c31f64cb70730'/>
<id>urn:sha1:1a7d0ea83e620fd8d7b3ced00a1c31f64cb70730</id>
<content type='text'>
A choice member must not depend on another member within the same choice
block.

Kconfig detects this, but the error message is not sensible.

[Test Code]

    choice
            prompt "choose"

    config A
            bool "A"
            depends on B

    config B
            bool "B"

    endchoice

[Result]

    Kconfig:1:error: recursive dependency detected!
    Kconfig:1:      choice &lt;choice&gt; contains symbol A
    Kconfig:4:      symbol A is part of choice B
    Kconfig:8:      symbol B is part of choice &lt;choice&gt;
    For a resolution refer to Documentation/kbuild/kconfig-language.rst
    subsection "Kconfig recursive dependency limitations"

The phrase "part of choice B" is weird because B is not a choice block,
but a choice member.

To determine whether the current symbol is a part of a choice block,
sym_is_choice(next_sym) must be checked.

This commit improves the error message to:

    Kconfig:1:error: recursive dependency detected!
    Kconfig:1:      choice &lt;choice&gt; contains symbol A
    Kconfig:4:      symbol A symbol is visible depending on B
    Kconfig:8:      symbol B is part of choice &lt;choice&gt;
    For a resolution refer to Documentation/kbuild/kconfig-language.rst
    subsection "Kconfig recursive dependency limitations"

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kconfig: fix conditional prompt behavior for choice</title>
<updated>2024-07-15T16:08:37Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-06-26T18:22:01Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=d533828ef3cafc2178dda44851d7cd8875781d55'/>
<id>urn:sha1:d533828ef3cafc2178dda44851d7cd8875781d55</id>
<content type='text'>
When a prompt is followed by "if &lt;expr&gt;", the symbol is configurable
when the if-conditional evaluates to true.

A typical usage is as follows:

    menuconfig BLOCK
            bool "Enable the block layer" if EXPERT
            default y

When EXPERT=n, the prompt is hidden, but this config entry is still
active, and BLOCK is set to its default value 'y'. When EXPERT=y, the
prompt is shown, making BLOCK a user-configurable option.

This usage is common throughout the kernel tree, but it has never worked
within a choice block.

[Test Code]

    config EXPERT
            bool "Allow expert users to modify more options"

    choice
            prompt "Choose" if EXPERT

    config A
            bool "A"

    config B
            bool "B"

    endchoice

[Result]

    # CONFIG_EXPERT is not set

When the prompt is hidden, the choice block should produce the default
without asking for the user's preference. Hence, the output should be:

    # CONFIG_EXPERT is not set
    CONFIG_A=y
    # CONFIG_B is not set

Removing unnecessary hacks fixes the issue.

This commit also changes the behavior of 'select' by choice members.

[Test Code 2]

    config MODULES
            def_bool y
            modules

    config DEP
            def_tristate m

    if DEP

    choice
            prompt "choose"

    config A
            bool "A"
            select C

    endchoice

    config B
            def_bool y
            select D

    endif

    config C
            tristate

    config D
            tristate

The current output is as follows:

    CONFIG_MODULES=y
    CONFIG_DEP=m
    CONFIG_A=y
    CONFIG_B=y
    CONFIG_C=y
    CONFIG_D=m

With this commit, the output will be changed as follows:

    CONFIG_MODULES=y
    CONFIG_DEP=m
    CONFIG_A=y
    CONFIG_B=y
    CONFIG_C=m
    CONFIG_D=m

CONFIG_C will be changed to 'm' because 'select C' will inherit the
dependency on DEP, which is 'm'.

This change is aligned with the behavior of 'select' outside a choice
block; 'select D' depends on DEP, therefore D is selected by (B &amp;&amp; DEP).

Note:

With this commit, allmodconfig will set CONFIG_USB_ROLE_SWITCH to 'm'
instead of 'y'. I did not see any build regression with this change.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kconfig: remove E_LIST expression type</title>
<updated>2024-07-15T16:08:37Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-06-18T10:35:31Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=7c9bb07a6e9439fb7bdeee15eb188fe127a0d0e0'/>
<id>urn:sha1:7c9bb07a6e9439fb7bdeee15eb188fe127a0d0e0</id>
<content type='text'>
E_LIST was preveously used to form an expression tree consisting of
choice members.

It is no longer used.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kconfig: remove P_CHOICE property</title>
<updated>2024-07-15T16:08:37Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-06-18T10:35:30Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=ca4c74ba306e28cebf53908e69b773dcbb700cbc'/>
<id>urn:sha1:ca4c74ba306e28cebf53908e69b773dcbb700cbc</id>
<content type='text'>
P_CHOICE is a pseudo property used to link a choice with its members.

There is no more code relying on this, except for some debug code.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kconfig: use sym_get_choice_menu() in sym_check_deps()</title>
<updated>2024-07-15T16:08:37Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-06-18T10:35:29Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=b139b43e9d47552b3f998fade184ed19e45d0c32'/>
<id>urn:sha1:b139b43e9d47552b3f998fade184ed19e45d0c32</id>
<content type='text'>
Choices and their members are associated via the P_CHOICE property.

Currently, prop_get_symbol(sym_get_choice_prop()) is used to obtain
the choice of the given choice member.

Replace it with sym_get_choice_menu(), which retrieves the choice
without relying on P_CHOICE.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
</feed>
