summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Hermier <michel.hermier@gmail.com>2021-12-16 10:54:57 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-23 17:53:46 -0800
commit7b8398ea0d68056e4fee0c97f0eb3ad19d33d560 (patch)
tree17159bd5ff4b9303000334f88d5589a884d49efc
parenta47f43d4cb3733497163a02bd28d97099a574a5c (diff)
downloadserenity-7b8398ea0d68056e4fee0c97f0eb3ad19d33d560.zip
Meta: Allow to skip `#pragma once` check
Some headers migth need to be reentered multiple times (eg. <assert.h>) so a mecanism to skip that check is necessary.
-rwxr-xr-xMeta/check-style.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Meta/check-style.py b/Meta/check-style.py
index 8b61db5217..24ea096b94 100755
--- a/Meta/check-style.py
+++ b/Meta/check-style.py
@@ -30,6 +30,8 @@ LICENSE_HEADER_CHECK_EXCLUDES = {
# We check that "#pragma once" is present
PRAGMA_ONCE_STRING = '#pragma once'
+PRAGMA_ONCE_CHECK_EXCLUDES = {
+}
# We make sure that there's a blank line before and after pragma once
GOOD_PRAGMA_ONCE_PATTERN = re.compile('(^|\\S\n\n)#pragma once(\n\n\\S.|$)')
@@ -58,7 +60,10 @@ def run():
if LIBM_MATH_H_INCLUDE_STRING in file_content:
errors_libm_math_h.append(filename)
if filename.endswith('.h'):
- if GOOD_PRAGMA_ONCE_PATTERN.search(file_content):
+ if any(filename.startswith(forbidden_prefix) for forbidden_prefix in PRAGMA_ONCE_CHECK_EXCLUDES):
+ # File was excluded
+ pass
+ elif GOOD_PRAGMA_ONCE_PATTERN.search(file_content):
# Excellent, the formatting is correct.
pass
elif PRAGMA_ONCE_STRING in file_content: