X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=build-aux%2Fcheck-structs;h=0849fcf14208174f9d1f4bba09c0e9db9b68b901;hb=b0f7b9b5c98557d159e4a12f125eacbf2a04a25b;hp=536045fe479c47a896a9988669d89dd32c0d5b99;hpb=a44d74d75294e358e501cc83fd35e6a5e50ebf0b;p=openvswitch diff --git a/build-aux/check-structs b/build-aux/check-structs index 536045fe..0849fcf1 100755 --- a/build-aux/check-structs +++ b/build-aux/check-structs @@ -17,6 +17,7 @@ types['uint64_t'] = {"size": 8, "alignment": 8} types['ovs_be16'] = {"size": 2, "alignment": 2} types['ovs_be32'] = {"size": 4, "alignment": 4} types['ovs_be64'] = {"size": 8, "alignment": 8} +types['ovs_32aligned_be64'] = {"size": 8, "alignment": 4} token = None line = "" @@ -186,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: @@ -222,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"): @@ -242,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('=')