diff options
author | 2016-06-08 17:52:05 -0700 | |
---|---|---|
committer | 2016-06-08 17:52:05 -0700 | |
commit | 0a0c1b0d59341e2535e27d86f1cd61f6c114b2ed (patch) | |
tree | 7910593b0f6919ae7bc8269cb8394f4ac0502fd9 /tools/distrib/check_include_guards.py | |
parent | 2bdde23c25b2df3f5b94100226ca2957e4e2cba4 (diff) | |
parent | d861b13aff7481b4901ab012cfd51c5887b11a2e (diff) |
Merge remote-tracking branch 'upstream/master' into base64_decode
Diffstat (limited to 'tools/distrib/check_include_guards.py')
-rwxr-xr-x | tools/distrib/check_include_guards.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/distrib/check_include_guards.py b/tools/distrib/check_include_guards.py index 8207f5cce0..ef770b30b4 100755 --- a/tools/distrib/check_include_guards.py +++ b/tools/distrib/check_include_guards.py @@ -56,7 +56,7 @@ class GuardValidator(object): def __init__(self): self.ifndef_re = re.compile(r'#ifndef ([A-Z][A-Z_1-9]*)') self.define_re = re.compile(r'#define ([A-Z][A-Z_1-9]*)') - self.endif_c_re = re.compile(r'#endif /\* ([A-Z][A-Z_1-9]*) \*/') + self.endif_c_re = re.compile(r'#endif /\* ([A-Z][A-Z_1-9]*) (?:\\ *\n *)?\*/') self.endif_cpp_re = re.compile(r'#endif // ([A-Z][A-Z_1-9]*)') self.failed = False @@ -98,6 +98,7 @@ class GuardValidator(object): match = self.ifndef_re.search(fcontents) if not match: print 'something drastically wrong with: %s' % fpath + return False # failed if match.lastindex is None: # No ifndef. Request manual addition with hints self.fail(fpath, match.re, match.string, '', '', False) @@ -132,7 +133,7 @@ class GuardValidator(object): # Is there a properly commented #endif? endif_re = self.endif_cpp_re if cpp_header else self.endif_c_re flines = fcontents.rstrip().splitlines() - match = endif_re.search(flines[-1]) + match = endif_re.search('\n'.join(flines[-2:])) if not match: # No endif. Check if we have the last line as just '#endif' and if so # replace it with a properly commented one. |