mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
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.
This commit is contained in:
parent
a47f43d4cb
commit
7b8398ea0d
Notes:
sideshowbarker
2024-07-17 22:18:20 +09:00
Author: https://github.com/mhermier Commit: https://github.com/SerenityOS/serenity/commit/7b8398ea0d6 Pull-request: https://github.com/SerenityOS/serenity/pull/11328
1 changed files with 6 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue