aboutsummaryrefslogtreecommitdiff
path: root/bindgen
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2022-07-20 20:38:42 +0200
committerAndre Weissflog <floooh@gmail.com>2022-07-20 20:38:42 +0200
commitfab5004ded53404eaa96e865f98d3c050b2a0b97 (patch)
treee0854afe4382327423411b10a94473c4be4d3020 /bindgen
parent2f7349e97a4f11df034f9c0736e454e8f515ecf0 (diff)
gen_odin.py: rename 'private' struct field to '_'
Diffstat (limited to 'bindgen')
-rw-r--r--bindgen/gen_odin.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/bindgen/gen_odin.py b/bindgen/gen_odin.py
index 2f5295aa..b3d71ce6 100644
--- a/bindgen/gen_odin.py
+++ b/bindgen/gen_odin.py
@@ -425,7 +425,11 @@ def gen_struct(decl, prefix):
for field in decl['fields']:
field_name = check_override(field['name'])
field_type = map_type(check_override(f'{c_struct_name}.{field_name}', default=field['type']), prefix, 'struct_field')
- l(f' {field_name} : {field_type},')
+ # any field name starting with _ is considered private
+ if field_name.startswith('_'):
+ l(f' _ : {field_type},')
+ else:
+ l(f' {field_name} : {field_type},')
l('}')
def gen_enum(decl, prefix):