aboutsummaryrefslogtreecommitdiff
path: root/bindgen
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2022-06-25 14:35:03 +0200
committerAndre Weissflog <floooh@gmail.com>2022-06-25 14:35:03 +0200
commit105ba48330e68ed862752bc5d844f7d2ba5d7edd (patch)
treebd97f2b2fce51ecab492b7b5ac5571fa35c30689 /bindgen
parent52e99842d3ec1050a198c4c4f29da4e1816e5ba7 (diff)
nim bindings: don't differentiate between 'cint' and 'uint32' enums
Diffstat (limited to 'bindgen')
-rw-r--r--bindgen/gen_nim.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/bindgen/gen_nim.py b/bindgen/gen_nim.py
index 655ef686..a7f42c5d 100644
--- a/bindgen/gen_nim.py
+++ b/bindgen/gen_nim.py
@@ -383,13 +383,10 @@ def gen_consts(decl, prefix):
def gen_enum(decl, prefix, bitfield=None):
item_names_by_value = {}
value = -1
- has_force_u32 = False
has_explicit_values = False
for item in decl['items']:
item_name = check_override(item['name'])
- if item_name.endswith("_FORCE_U32"):
- has_force_u32 = True
- elif item_name.endswith("_NUM"):
+ if item_name.endswith("_NUM") or item_name.endswith("_FORCE_U32"):
continue
else:
if 'value' in item:
@@ -401,10 +398,7 @@ def gen_enum(decl, prefix, bitfield=None):
enum_name = bitfield if bitfield is not None else decl['name']
enum_name_nim = as_nim_type_name(enum_name, prefix)
l('type')
- if has_force_u32:
- l(f" {enum_name_nim}* {{.pure, size:sizeof(uint32).}} = enum")
- else:
- l(f" {enum_name_nim}* {{.pure, size:sizeof(cint).}} = enum")
+ l(f" {enum_name_nim}* {{.pure, size:sizeof(int32).}} = enum")
if has_explicit_values:
# Nim requires explicit enum values to be declared in ascending order
for value in sorted(item_names_by_value):