summaryrefslogtreecommitdiff
path: root/tests/Kpreprocess
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-09-04 18:05:28 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2018-09-04 20:49:21 +0200
commita092257a49ed7850913cf53e474f4c8dd175c94b (patch)
tree1024946e748ce2801b03553e78eb9616b0d550da /tests/Kpreprocess
parentef5358e8b8174716470b00691fba9946b7d307ce (diff)
Allow macro expansion within symbol names
The C implementation supports this (though it's undocumented, and unused to far). This can be used e.g. to dynamically instatiate symbols from template files: Kconfig.template: config $(subsys)_LOG bool "Enable logging for $(subsys)" depends on $(subsys)_HAS_LOG ... other stuff dependent on $(subsys) Elsewhere: subsys = FOO source "Kconfig.template" subsys = BAR source "Kconfig.template" Pretty sure this can easily be abused, but it should be supported at least.
Diffstat (limited to 'tests/Kpreprocess')
-rw-r--r--tests/Kpreprocess6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/Kpreprocess b/tests/Kpreprocess
index 2ebf6e6..e30b389 100644
--- a/tests/Kpreprocess
+++ b/tests/Kpreprocess
@@ -67,11 +67,17 @@ special-chars-fn-res = $(fn,$(comma)$(dollar)$(left-paren)foo$(right-paren))
qaz = QAZ
echo = $(1)
+ignore-first = $(2)
config PRINT_ME
string "$(ENV_1)" if ($(echo,FOO) && $(echo,BAR)) || !$(echo,BAZ) || !(($(qaz)))
default "$(echo,"foo")" if "foo $(echo,"bar") baz" = "$(undefined)"
+# Expansion within a symbol token, with deliberate sloppiness
+config PRINT_$(ignore-first, ,ME)_TOO
+ bool "foo"
+ default FOO$(ignore-first, ,BAR)BAZ$(qaz) if $(qaz)&&$(qaz)FOO&&x$(ignore-first, ,xx)
+
# Recursive expansion (throws an exception)