warn("%s needs %d bytes of tail padding" % (structName, shortage))
size += shortage
types[structName] = {"size": size, "alignment": alignment}
+ return structName
def checkStructs():
if len(sys.argv) < 2:
global lineNumber
inputFile = open(fileName)
lineNumber = 0
+ lastStruct = None
while getToken():
if token in ("#ifdef", "#ifndef", "#include",
"#endif", "#elif", "#else"):
while token != ';':
getToken()
elif token in ('struct', 'union'):
- parseStruct()
+ lastStruct = parseStruct()
elif match('OFP_ASSERT') or match('BOOST_STATIC_ASSERT'):
forceMatch('(')
forceMatch('sizeof')
forceMatch('(')
typeName = parseTypeName()
+ if typeName != lastStruct:
+ warn("checking size of %s but %s was most recently defined"
+ % (typeName, lastStruct))
forceMatch(')')
forceMatch('=')
forceMatch('=')