projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ofproto-dpif: Revalidate tagged packets, too, in facet_lookup_valid().
[openvswitch]
/
build-aux
/
check-structs
diff --git
a/build-aux/check-structs
b/build-aux/check-structs
index 545c80a89543135498dc45f58b2969b1a93f0b18..0849fcf14208174f9d1f4bba09c0e9db9b68b901 100755
(executable)
--- a/
build-aux/check-structs
+++ b/
build-aux/check-structs
@@
-1,5
+1,6
@@
#! /usr/bin/python
#! /usr/bin/python
+import os.path
import sys
import re
import sys
import re
@@
-13,6
+14,10
@@
types['uint8_t'] = {"size": 1, "alignment": 1}
types['uint16_t'] = {"size": 2, "alignment": 2}
types['uint32_t'] = {"size": 4, "alignment": 4}
types['uint64_t'] = {"size": 8, "alignment": 8}
types['uint16_t'] = {"size": 2, "alignment": 2}
types['uint32_t'] = {"size": 4, "alignment": 4}
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 = ""
token = None
line = ""
@@
-182,6
+187,7
@@
def parseStruct():
warn("%s needs %d bytes of tail padding" % (structName, shortage))
size += shortage
types[structName] = {"size": size, "alignment": alignment}
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:
def checkStructs():
if len(sys.argv) < 2:
@@
-190,10
+196,7
@@
def checkStructs():
sys.exit(1)
if '--help' in sys.argv:
sys.exit(1)
if '--help' in sys.argv:
- argv0 = sys.argv[0]
- slash = argv0.rfind('/')
- if slash:
- argv0 = argv0[slash + 1:]
+ argv0 = os.path.basename(sys.argv[0])
print '''\
%(argv0)s, for checking struct and struct member alignment
usage: %(argv0)s HEADER [HEADER]...
print '''\
%(argv0)s, for checking struct and struct member alignment
usage: %(argv0)s HEADER [HEADER]...
@@
-221,6
+224,7
@@
header files without extensions.''' % {"argv0": argv0}
global lineNumber
inputFile = open(fileName)
lineNumber = 0
global lineNumber
inputFile = open(fileName)
lineNumber = 0
+ lastStruct = None
while getToken():
if token in ("#ifdef", "#ifndef", "#include",
"#endif", "#elif", "#else"):
while getToken():
if token in ("#ifdef", "#ifndef", "#include",
"#endif", "#elif", "#else"):
@@
-241,12
+245,15
@@
header files without extensions.''' % {"argv0": argv0}
while token != ';':
getToken()
elif token in ('struct', 'union'):
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()
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('=')
forceMatch(')')
forceMatch('=')
forceMatch('=')