aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-05-16 18:41:45 -0700
committerGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-05-16 18:41:45 -0700
commitf1dc3deed72126df02fe56667ff322ecefd0e164 (patch)
tree8983d939e82325aa96a8f882f979d31bc0782828
parent305b0f4e2f99d2326bf1aaa881f857bb5fe1a817 (diff)
parent93466168b01fddc3bdac406c4278e54045097968 (diff)
Merge pull request #6568 from dgquintas/fix-include-guards-long-names
Allow for multiline #endif guards
-rwxr-xr-xtools/distrib/check_include_guards.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/distrib/check_include_guards.py b/tools/distrib/check_include_guards.py
index 8207f5cce0..9c23a70e00 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
@@ -132,7 +132,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.