From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, saeedm@nvidia.com, horms@kernel.org,
donald.hunter@gmail.com
Subject: [PATCH net-next 1/5] tools: ynl-gen: extend block_start/end by noind arg
Date: Fri, 2 May 2025 13:38:17 +0200 [thread overview]
Message-ID: <20250502113821.889-2-jiri@resnulli.us> (raw)
In-Reply-To: <20250502113821.889-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@nvidia.com>
In order to allow block with no indentation, like switch-case, extend
block_start/end by "noind" arg allowing caller to instruct writer to
do no indentation.
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
tools/net/ynl/pyynl/ynl_gen_c.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index 9613a6135003..b4889974f645 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -1345,16 +1345,18 @@ class CodeWriter:
def nl(self):
self._nl = True
- def block_start(self, line=''):
+ def block_start(self, line='', noind=False):
if line:
line = line + ' '
self.p(line + '{')
- self._ind += 1
+ if not noind:
+ self._ind += 1
- def block_end(self, line=''):
+ def block_end(self, line='', noind=False):
if line and line[0] not in {';', ','}:
line = ' ' + line
- self._ind -= 1
+ if not noind:
+ self._ind -= 1
self._nl = False
if not line:
# Delay printing closing bracket in case "else" comes next
--
2.49.0
next prev parent reply other threads:[~2025-05-02 11:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-02 11:38 [PATCH net-next 0/5] devlink: sanitize variable typed attributes Jiri Pirko
2025-05-02 11:38 ` Jiri Pirko [this message]
2025-05-03 1:37 ` [PATCH net-next 1/5] tools: ynl-gen: extend block_start/end by noind arg Jakub Kicinski
2025-05-04 18:25 ` Jiri Pirko
2025-05-02 11:38 ` [PATCH net-next 2/5] tools: ynl-gen: allow noncontiguous enums Jiri Pirko
2025-05-03 1:43 ` Jakub Kicinski
2025-05-04 18:25 ` Jiri Pirko
2025-05-02 11:38 ` [PATCH net-next 3/5] devlink: define enum for attr types of dynamic attributes Jiri Pirko
2025-05-03 1:46 ` Jakub Kicinski
2025-05-04 18:25 ` Jiri Pirko
2025-05-02 11:38 ` [PATCH net-next 4/5] devlink: avoid param type value translations Jiri Pirko
2025-05-02 11:38 ` [PATCH net-next 5/5] devlink: use DEVLINK_VAR_ATTR_TYPE_* instead of NLA_* in fmsg Jiri Pirko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250502113821.889-2-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).