From a8c492971d493a100bb9254958c8ca8e77ed9a94 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Mon, 26 Aug 2024 12:19:20 +0200 Subject: [PATCH] Check empty strings on macro expansion 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. Signed-off-by: Jim Huang --- kconfiglib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kconfiglib.py b/kconfiglib.py index a50312e..e6e8bc3 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -2612,7 +2612,7 @@ def _parse_assignment(self, s): else: break - if s.isspace(): + if not s or s.isspace(): # We also accept a bare macro on a line (e.g. # $(warning-if,$(foo),ops)), provided it expands to a blank string return