mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
Meta: Ignore local includes of .moc files
These are generated by Qt and added to the include path automatically by CMake.
This commit is contained in:
parent
f4446cdf8c
commit
0fd35b4dd8
Notes:
sideshowbarker
2024-07-17 08:43:11 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/0fd35b4dd8 Pull-request: https://github.com/SerenityOS/serenity/pull/19514
1 changed files with 12 additions and 0 deletions
|
@ -51,12 +51,19 @@ BAD_INCLUDE_LIBC = re.compile("# *include <LibC/")
|
|||
ANY_INCLUDE_PATTERN = re.compile('^ *# *include\\b.*[>"](?!\\)).*$', re.M)
|
||||
SYSTEM_INCLUDE_PATTERN = re.compile("^ *# *include *<([^>]+)>(?: /[*/].*)?$")
|
||||
LOCAL_INCLUDE_PATTERN = re.compile('^ *# *include *"([^>]+)"(?: /[*/].*)?$')
|
||||
|
||||
INCLUDE_CHECK_EXCLUDES = {
|
||||
"Userland/Libraries/LibCodeComprehension/Cpp/Tests/",
|
||||
"Userland/Libraries/LibCpp/Tests/parser/",
|
||||
"Userland/Libraries/LibCpp/Tests/preprocessor/",
|
||||
}
|
||||
|
||||
LOCAL_INCLUDE_SUFFIX_EXCLUDES = [
|
||||
# Some Qt files are required to include their .moc files, which will be located in a deep
|
||||
# subdirectory that we won't find from here.
|
||||
'.moc',
|
||||
]
|
||||
|
||||
|
||||
def should_check_file(filename):
|
||||
if not filename.endswith('.cpp') and not filename.endswith('.h'):
|
||||
|
@ -126,8 +133,13 @@ def run():
|
|||
if filename not in errors_include_weird_format:
|
||||
errors_include_weird_format.append(filename)
|
||||
continue
|
||||
|
||||
relative_filename = local_match.group(1)
|
||||
referenced_file = file_directory.joinpath(relative_filename)
|
||||
|
||||
if referenced_file.suffix in LOCAL_INCLUDE_SUFFIX_EXCLUDES:
|
||||
continue
|
||||
|
||||
if not referenced_file.exists():
|
||||
print(f"In {filename}: Cannot find {referenced_file}")
|
||||
if filename not in errors_include_missing_local:
|
||||
|
|
Loading…
Reference in a new issue