diff options
author | Ben Pfaff <blp@nicira.com> | 2011-10-23 18:16:03 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2012-03-07 13:59:02 -0800 |
commit | 539315543cc6123ae4efec162e291f7f90d0ccf0 (patch) | |
tree | d245fe745975d5f65a0f5fc91ee53cc444e10e35 /build-aux | |
parent | 27527aa09ce456796eeea728cef9528aa5612b70 (diff) |
Move content of openflow.h into openflow-1.0.h.
This prepares for a gradual introduction of definitions from OpenFlow
1.1 and later, by making it clearer that the current definitions are
specific to OpenFlow 1.0.
Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'build-aux')
-rwxr-xr-x | build-aux/check-structs | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/build-aux/check-structs b/build-aux/check-structs index 0849fcf1..731a4e29 100755 --- a/build-aux/check-structs +++ b/build-aux/check-structs @@ -23,13 +23,18 @@ token = None line = "" idRe = "[a-zA-Z_][a-zA-Z_0-9]*" tokenRe = "#?" + idRe + "|[0-9]+|." +includeRe = re.compile(r'\s*#include\s+"(openflow/[^#]+)"') +includePath = '' inComment = False inDirective = False +inputStack = [] def getToken(): global token global line global inComment global inDirective + global inputFile + global fileName while True: line = line.lstrip() if line != "": @@ -59,16 +64,27 @@ def getToken(): return True else: global lineNumber - line = inputFile.readline() - lineNumber += 1 - while line.endswith("\\\n"): - line = line[:-2] + inputFile.readline() + while True: + line = inputFile.readline() lineNumber += 1 - if line == "": - if token == None: - fatal("unexpected end of input") - token = None - return False + while line.endswith("\\\n"): + line = line[:-2] + inputFile.readline() + lineNumber += 1 + match = includeRe.match(line) + if match: + inputStack.append((fileName, inputFile, lineNumber)) + inputFile = open(includePath + match.group(1)) + lineNumber = 0 + continue + if line == "": + if inputStack: + fileName, inputFile, lineNumber = inputStack.pop() + continue + if token == None: + fatal("unexpected end of input") + token = None + return False + break def fatal(msg): sys.stderr.write("%s:%d: error at \"%s\": %s\n" % (fileName, lineNumber, token, msg)) @@ -199,7 +215,7 @@ def checkStructs(): argv0 = os.path.basename(sys.argv[0]) print '''\ %(argv0)s, for checking struct and struct member alignment -usage: %(argv0)s HEADER [HEADER]... +usage: %(argv0)s -Ipath HEADER [HEADER]... This program reads the header files specified on the command line and verifies that all struct members are aligned on natural boundaries @@ -210,16 +226,19 @@ some ABIs for ARM require all structs to be a multiple of 32 bits), or compiler adding additional padding. Finally, it checks struct size assertions using OFP_ASSERT. -Header files are read in the order specified. #include directives are -not processed, so specify them in dependency order. - -This program is specialized for reading include/openflow/openflow.h -and include/openflow/nicira-ext.h. It will not work on arbitrary -header files without extensions.''' % {"argv0": argv0} +This program is specialized for reading Open vSwitch's OpenFlow header +files. It will not work on arbitrary header files without extensions.\ +''' % {"argv0": argv0} sys.exit(0) global fileName for fileName in sys.argv[1:]: + if fileName.startswith('-I'): + global includePath + includePath = fileName[2:] + if not includePath.endswith('/'): + includePath += '/' + continue global inputFile global lineNumber inputFile = open(fileName) |