diff options
| author | Donald Hunter <[email protected]> | 2025-02-11 12:01:23 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-02-13 03:32:15 +0000 |
| commit | 16cd1a5299eedc0328398bff9bf57e08b9925c52 (patch) | |
| tree | 98c8408391441bc0ab75e2873d1d33707eb940e5 /tools/net/ynl/pyynl/ynl_gen_c.py | |
| parent | tools/net/ynl: add s8, s16 to valid scalars in ynl-gen-c (diff) | |
| download | kernel-16cd1a5299eedc0328398bff9bf57e08b9925c52.tar.gz kernel-16cd1a5299eedc0328398bff9bf57e08b9925c52.zip | |
tools/net/ynl: sanitise enums with leading digits in ynl-gen-c
Turn attribute names with leading digits into valid C names by
prepending an underscore, e.g. 5ghz -> _5ghz
Signed-off-by: Donald Hunter <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'tools/net/ynl/pyynl/ynl_gen_c.py')
| -rwxr-xr-x | tools/net/ynl/pyynl/ynl_gen_c.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py index d8fdee24ce25..62a6d8c93765 100755 --- a/tools/net/ynl/pyynl/ynl_gen_c.py +++ b/tools/net/ynl/pyynl/ynl_gen_c.py @@ -74,6 +74,8 @@ class Type(SpecAttr): self.c_name = c_lower(self.name) if self.c_name in _C_KW: self.c_name += '_' + if self.c_name[0].isdigit(): + self.c_name = '_' + self.c_name # Added by resolve(): self.enum_name = None |
