Make grammar-generation fail if over 64 capabilities.

This commit is contained in:
Dejan Mircevski 2016-04-22 14:56:07 -04:00
parent a9f36d0143
commit 776029fb71

View File

@ -37,6 +37,12 @@ def populate_capability_bit_mapping_dict(cap_dict):
assert cap_dict['category'] == 'ValueEnum' assert cap_dict['category'] == 'ValueEnum'
assert cap_dict['kind'] == 'Capability' assert cap_dict['kind'] == 'Capability'
for enumerant in cap_dict['enumerants']: for enumerant in cap_dict['enumerants']:
if enumerant['value'] > 63:
print(
"error: capability enumerant {} valued {} is over 63; "
"spv_capability_mask_t doesn't support this".format(
enumerant['enumerant'], enumerant['value']))
exit(1)
CAPABILITY_BIT_MAPPING[enumerant['enumerant']] = enumerant['value'] CAPABILITY_BIT_MAPPING[enumerant['enumerant']] = enumerant['value']