MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / bitsOfEssentialType

Function bitsOfEssentialType

addons/misra.py:771–790  ·  view source on GitHub ↗
(ty)

Source from the content-addressed store, hash-verified

769
770
771def bitsOfEssentialType(ty):
772 if ty is None:
773 return 0
774 last_type = ty.split(' ')[-1]
775 if last_type == 'Boolean':
776 return 1
777 if last_type == 'char':
778 return typeBits['CHAR']
779 if last_type == 'short':
780 return typeBits['SHORT']
781 if last_type == 'int':
782 return typeBits['INT']
783 if ty.endswith('long long'):
784 return typeBits['LONG_LONG']
785 if last_type == 'long':
786 return typeBits['LONG']
787 for sty in STDINT_TYPES:
788 if ty == sty:
789 return int(''.join(filter(str.isdigit, sty)))
790 return 0
791
792
793def get_function_pointer_type(tok):

Callers 8

getEssentialTypeFunction · 0.85
misra_10_3Method · 0.85
misra_10_6Method · 0.85
misra_10_7Method · 0.85
misra_10_8Method · 0.85
misra_12_2Method · 0.85
misra_12_4_check_exprMethod · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected