diff options
author | Jakub Kicinski <kuba@kernel.org> | 2023-01-30 18:33:41 -0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-01-31 20:36:03 -0800 |
commit | eaf317e7d2bbb04486c9842aea9be1e94bd416ed (patch) | |
tree | fa8b4fbd3df6707a38f6c7a217fb723305b01cb7 /tools/net | |
parent | df54fde451db9534f2fd9838d4c7d2a10ccfb6e8 (diff) | |
download | lwn-eaf317e7d2bbb04486c9842aea9be1e94bd416ed.tar.gz lwn-eaf317e7d2bbb04486c9842aea9be1e94bd416ed.zip |
tools: ynl-gen: prevent do / dump reordering
An earlier fix tried to address generated code jumping around
one code-gen run to another. Turns out dict()s are already
ordered since Python 3.7, the problem is that we iterate over
operation modes using a set(). Sets are unordered in Python.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/net')
-rwxr-xr-x | tools/net/ynl/ynl-gen-c.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py index 1aa872e582ab..e5002d420961 100755 --- a/tools/net/ynl/ynl-gen-c.py +++ b/tools/net/ynl/ynl-gen-c.py @@ -933,7 +933,7 @@ class Family: if attr_set_name != op['attribute-set']: raise Exception('For a global policy all ops must use the same set') - for op_mode in {'do', 'dump'}: + for op_mode in ['do', 'dump']: if op_mode in op: global_set.update(op[op_mode].get('request', [])) @@ -2244,7 +2244,7 @@ def main(): for op_name, op in parsed.ops.items(): if parsed.kernel_policy in {'per-op', 'split'}: - for op_mode in {'do', 'dump'}: + for op_mode in ['do', 'dump']: if op_mode in op and 'request' in op[op_mode]: cw.p(f"/* {op.enum_name} - {op_mode} */") ri = RenderInfo(cw, parsed, args.mode, op, op_name, op_mode) |