From 9379266a529fa7f4bba1331daec413a982f8744b Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 23 Feb 2019 17:13:35 +0100 Subject: [PATCH] donate-cpu.py: Improve regex to find more includes. (#1688) Now also found: - Includes directly at the beginning of a file - Indented includes - Includes where there is no white-space between "include" and header name --- tools/donate-cpu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/donate-cpu.py b/tools/donate-cpu.py index 3097532c3..63c30afd9 100644 --- a/tools/donate-cpu.py +++ b/tools/donate-cpu.py @@ -217,7 +217,7 @@ def hasInclude(path, includes): pass f.close() re_includes = [re.escape(inc) for inc in includes] - if re.search('\n#[ \t]*include[ \t]+(' + '|'.join(re_includes) + ')', filedata): + if re.search('^[ \t]*#[ \t]*include[ \t]*(' + '|'.join(re_includes) + ')', filedata, re.MULTILINE): return True except IOError: pass