aboutsummaryrefslogtreecommitdiffstats
path: root/tools/net/ynl/pyynl/ynl_gen_c.py
diff options
context:
space:
mode:
authorJakub Kicinski <[email protected]>2025-05-09 15:42:12 +0000
committerPaolo Abeni <[email protected]>2025-05-13 11:22:32 +0000
commit9ba8e351efd4d003a7fc22bc7455f0e95665cf44 (patch)
tree73cca3b24befa99abeaf720c7b16bda238f33300 /tools/net/ynl/pyynl/ynl_gen_c.py
parenttools: ynl-gen: support sub-type for binary attributes (diff)
downloadkernel-9ba8e351efd4d003a7fc22bc7455f0e95665cf44.tar.gz
kernel-9ba8e351efd4d003a7fc22bc7455f0e95665cf44.zip
tools: ynl-gen: auto-indent else
We auto-indent if statements (increase the indent of the subsequent line by 1), do the same thing for else branches without a block. There hasn't been any else branches before but we're about to add one. Reviewed-by: Donald Hunter <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'tools/net/ynl/pyynl/ynl_gen_c.py')
-rwxr-xr-xtools/net/ynl/pyynl/ynl_gen_c.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index 4e2ae738c0aa..9a5c65966e9d 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -1458,6 +1458,7 @@ class CodeWriter:
if self._silent_block:
ind += 1
self._silent_block = line.endswith(')') and CodeWriter._is_cond(line)
+ self._silent_block |= line.strip() == 'else'
if line[0] == '#':
ind = 0
if add_ind: