diff options
author | lloyd <[email protected]> | 2010-12-28 16:01:28 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-12-28 16:01:28 +0000 |
commit | 6720ec251d88ea23f232fd06d55c3b9694b82af1 (patch) | |
tree | d68d3852e2cc73eb04c946cbcb49eeec5fe08a78 | |
parent | a72a2d92200e4f5988a496b23b7bedbfbcf442a2 (diff) |
If there is a malformed or missing header guard, raise an error with
an informative message rather than dying with an index error.
-rwxr-xr-x | configure.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/configure.py b/configure.py index 5d81c8a17..7dd89600a 100755 --- a/configure.py +++ b/configure.py @@ -1321,7 +1321,7 @@ def generate_amalgamation(build_config): return val.endswith(suffix) return predicate - def strip_header_goop(contents): + def strip_header_goop(header_name, contents): header_guard = re.compile('^#define BOTAN_.*_H__$') while len(contents) > 0: @@ -1331,6 +1331,9 @@ def generate_amalgamation(build_config): contents = contents[1:] + if len(contents) == 0: + raise Exception("No header guard found in " + header_name) + while contents[0] == '\n': contents = contents[1:] @@ -1352,7 +1355,7 @@ def generate_amalgamation(build_config): self.file_contents = {} for f in sorted(input_list): - contents = strip_header_goop(open(f).readlines()) + contents = strip_header_goop(f, open(f).readlines()) self.file_contents[os.path.basename(f)] = contents self.contents = '' |