]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rv/rvgen: replace % string formatting with f-strings
authorWander Lairson Costa <wander@redhat.com>
Mon, 23 Feb 2026 16:17:46 +0000 (13:17 -0300)
committerGabriele Monaco <gmonaco@redhat.com>
Tue, 31 Mar 2026 14:47:51 +0000 (16:47 +0200)
commit908f377f4a0fa4b0b86352af9cb858e6ffcc6e2d
treedf5eb87260a9fd7c3fec3d864d285262d2457b6b
parent3f305f86373d5940e5105110415e97b4a4c3cf92
rv/rvgen: replace % string formatting with f-strings

Replace all instances of percent-style string formatting with
f-strings across the rvgen codebase. This modernizes the string
formatting to use Python 3.6+ features, providing clearer and more
maintainable code while improving runtime performance.

The conversion handles all formatting cases including simple variable
substitution, multi-variable formatting, and complex format specifiers.
Dynamic width formatting is converted from "%*s" to "{var:>{width}}"
using proper alignment syntax. Template strings for generated C code
properly escape braces using double-brace syntax to produce literal
braces in the output.

F-strings provide approximately 2x performance improvement over percent
formatting and are the recommended approach in modern Python.

Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Reviewed-by: Nam Cao <namcao@linutronix.de>
Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>
Link: https://lore.kernel.org/r/20260223162407.147003-4-wander@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
tools/verification/rvgen/__main__.py
tools/verification/rvgen/rvgen/automata.py
tools/verification/rvgen/rvgen/dot2c.py
tools/verification/rvgen/rvgen/dot2k.py
tools/verification/rvgen/rvgen/generator.py
tools/verification/rvgen/rvgen/ltl2k.py