Skip to content

Conversation

@leandrolanzieri
Copy link
Contributor

During macro expansion, bare macros on a line are accepted by the parser as long as they resolve to blank strings. The problem is that the script is currently checking using isspace, so it's actually not checking for blank strings.

This causes the parsing to fail when a macro is the last line of a file, and no newline character is added afterwards. This patch adds a check for the string itself being empty.

This can be tested, for instance, by applying the following and running the tests:

diff --git a/tests/Kpreprocess b/tests/Kpreprocess
index 283a988..a30ba74 100644
--- a/tests/Kpreprocess
+++ b/tests/Kpreprocess
@@ -149,3 +149,5 @@ env_ref_3 += $(ENV_4)
 $(warning-if,$(ENV_5),$(ENV_UNDEFINED))
 source "$(ENV_6)"
 env_ref_4 = $(ENV_7)  # Never evaluated
+
+$(info,Information message)
\ No newline at end of file

Originally ulfalizer/Kconfiglib#99.

During macro expansion, bare macros on a line are accepted by the parser
as long as they resolve to blank strings. The problem is that the script
is currently checking using isspace, so it's actually not checking for
blank strings.

This causes the parsing to fail when a macro is the last line of a file,
and no newline character is added afterwards. This patch adds a check for
the string itself being empty.
@stephanosio stephanosio force-pushed the pr/fix_preprocessor_expanded_empty branch from de5265a to 00d3c03 Compare October 4, 2024 14:49
@stephanosio
Copy link
Member

Rebased

@tejlmand tejlmand self-assigned this Oct 21, 2025
@tejlmand tejlmand removed the request for review from jackrosenthal October 21, 2025 13:57
@tejlmand tejlmand merged commit c3f7865 into zephyrproject-rtos:main Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants