aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-01-13 13:03:02 -0500
committerJack Lloyd <[email protected]>2019-01-13 13:07:16 -0500
commitf4246cd7cc1a9f4c4f5ff0cd891c85f5a0784603 (patch)
treef1aa6d899bfe749332dbf3925c22341cb1aaa18e
parentaae03e177452a5b7f5a42b4acf0c3fde07fdf045 (diff)
Ignore trailing whitespace in header guards
This is specifically needed to handle CRLF lines in Python2, otherwise the regex for header guards does not match and building the amalgamation fails. This only occured if a header was edited on Windows then later a build using amalgamation attempted on Linux. Closes #1763
-rwxr-xr-xconfigure.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/configure.py b/configure.py
index fc9a0ba2b..dc39c2541 100755
--- a/configure.py
+++ b/configure.py
@@ -2453,7 +2453,8 @@ class AmalgamationHeader(object):
class AmalgamationGenerator(object):
filename_prefix = 'botan_all'
- _header_guard_pattern = re.compile('^#define BOTAN_.*_H_$')
+ _header_guard_pattern = re.compile(r'^#define BOTAN_.*_H_\s*$')
+ _header_endif_pattern = re.compile(r'^#endif\s*$')
@staticmethod
def read_header(filepath):
@@ -2478,7 +2479,7 @@ class AmalgamationGenerator(object):
end_header_guard_index = None
for index, line in enumerate(lines):
- if line == '#endif\n':
+ if AmalgamationGenerator._header_endif_pattern.match(line):
end_header_guard_index = index # override with last found
if end_header_guard_index is None:
raise InternalError("No header guard end found in " + header_name)