Skip to content

Commit

Permalink
rust: fix the default format for CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT
Browse files Browse the repository at this point in the history
Another oddity in these config entries is their default value can fall
back to 'n', which is a value for bool or tristate symbols.

The '|| echo n' is an incorrect workaround to avoid the syntax error.
This is not a big deal, as the entry is hidden by 'depends on RUST' in
situations where '$(RUSTC) --version' or '$(BINDGEN) --version' fails.
Anyway, it looks odd.

The default of a string type symbol should be a double-quoted string
literal. Turn it into an empty string when the version command fails.

Fixes: 2f7ab12 ("Kbuild: add Rust support")
Signed-off-by: Masahiro Yamada <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Rebased on top of v6.11-rc1. - Miguel ]
Signed-off-by: Miguel Ojeda <[email protected]>
  • Loading branch information
masahir0y authored and ojeda committed Jul 28, 2024
1 parent 5ce86c6 commit aacf93e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1919,15 +1919,15 @@ config RUST
config RUSTC_VERSION_TEXT
string
depends on RUST
default $(shell,$(RUSTC) --version 2>/dev/null || echo n)
default "$(shell,$(RUSTC) --version 2>/dev/null)"

config BINDGEN_VERSION_TEXT
string
depends on RUST
# The dummy parameter `workaround-for-0.69.0` is required to support 0.69.0
# (https://github.com/rust-lang/rust-bindgen/pull/2678). It can be removed when
# the minimum version is upgraded past that (0.69.1 already fixed the issue).
default $(shell,$(BINDGEN) --version workaround-for-0.69.0 2>/dev/null || echo n)
default "$(shell,$(BINDGEN) --version workaround-for-0.69.0 2>/dev/null)"

#
# Place an empty function call at each tracepoint site. Can be
Expand Down

0 comments on commit aacf93e

Please sign in to comment.