X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=build-aux%2Fcheck-structs;h=0849fcf14208174f9d1f4bba09c0e9db9b68b901;hb=6161d3fd928edf7016abae60f549a135a2f83f09;hp=152c6a21426d3d23137abdc7bd81a749cf78711b;hpb=c4617b3c28b9a96e09fdbbe2682b875dbfeaec5b;p=openvswitch diff --git a/build-aux/check-structs b/build-aux/check-structs index 152c6a21..0849fcf1 100755 --- a/build-aux/check-structs +++ b/build-aux/check-structs @@ -187,6 +187,7 @@ def parseStruct(): 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: @@ -223,6 +224,7 @@ header files without extensions.''' % {"argv0": argv0} global lineNumber inputFile = open(fileName) lineNumber = 0 + lastStruct = None while getToken(): if token in ("#ifdef", "#ifndef", "#include", "#endif", "#elif", "#else"): @@ -243,12 +245,15 @@ header files without extensions.''' % {"argv0": argv0} 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('=')