You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
self.logMsg('error', 'Invalid value for bitwidth attribute (', groupElem.get('bitwidth'), ') for ', groupName, ' - must be an integer value\n')
624
624
exit(1)
625
625
626
-
usebitmask=False
627
-
usedefine=False
628
-
629
-
# Bitmask flags can be generated as either "static const uint{32,64}_t" values,
630
-
# or as 32-bit C enums. 64-bit types must use uint64_t values.
631
-
ifgroupElem.get('type') =='bitmask':
632
-
ifbitwidth>32orself.misracppstyle():
633
-
usebitmask=True
634
-
ifself.misracstyle():
635
-
usedefine=True
636
-
637
-
ifusedefineorusebitmask:
638
-
# Validate the bitwidth and generate values appropriately
639
-
ifbitwidth>64:
640
-
self.logMsg('error', 'Invalid value for bitwidth attribute (', groupElem.get('bitwidth'), ') for bitmask type ', groupName, ' - must be less than or equal to 64\n')
# Validate the bitwidth and generate values appropriately
646
-
ifbitwidth>32:
647
-
self.logMsg('error', 'Invalid value for bitwidth attribute (', groupElem.get('bitwidth'), ') for enum type ', groupName, ' - must be less than or equal to 32\n')
"""Generate the C declaration for an "enum" that is actually a
654
-
set of flag bits"""
655
-
groupElem=groupinfo.elem
656
-
flagTypeName=groupElem.get('name')
657
-
658
-
# Prefix
659
-
body=f"// Flag bits for {flagTypeName}\n"
660
-
661
-
ifbitwidth==64:
662
-
body+=f"typedef VkFlags64 {flagTypeName};\n";
626
+
# Validate the bitwidth and generate values appropriately
627
+
ifbitwidth>64:
628
+
self.logMsg('error', 'Invalid value for bitwidth attribute (', groupElem.get('bitwidth'), ') for enum type ', groupName, ' - must be less than or equal to 64\n')
629
+
exit(1)
663
630
else:
664
-
body+=f"typedef VkFlags {flagTypeName};\n";
665
-
666
-
# Maximum allowable value for a flag (unsigned 64-bit integer)
667
-
maxValidValue=2**(64) -1
668
-
minValidValue=0
669
-
670
-
# Get a list of nested 'enum' tags.
671
-
enums=groupElem.findall('enum')
672
-
673
-
# Check for and report duplicates, and return a list with them
674
-
# removed.
675
-
enums=self.checkDuplicateEnums(enums)
676
-
677
-
# Accumulate non-numeric enumerant values separately and append
678
-
# them following the numeric values, to allow for aliases.
679
-
# NOTE: this does not do a topological sort yet, so aliases of
680
-
# aliases can still get in the wrong order.
681
-
aliasText=''
682
-
683
-
# Loop over the nested 'enum' tags.
684
-
foreleminenums:
685
-
# Convert the value to an integer and use that to track min/max.
686
-
# Values of form -(number) are accepted but nothing more complex.
687
-
# Should catch exceptions here for more complex constructs. Not yet.
self.logMsg('error', 'Allowable range for flag types in C is [', minValidValue, ',', maxValidValue, '], but', name, 'flag has a value outside of this (', strVal, ')\n')
0 commit comments