From c3f78659b886f81b7b5898497c9aa94dc634aef2 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Mon, 26 Aug 2024 12:19:20 +0200 Subject: kconfiglib: 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. --- kconfiglib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kconfiglib.py b/kconfiglib.py index 77f35e4..4506296 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -2611,7 +2611,7 @@ class Kconfig(object): 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 -- cgit v1.2.3