From dc18280f808ec565a0adb545f80d1c493ed43ee3 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Mon, 9 Sep 2024 13:22:07 -0600 Subject: [PATCH] Meta: Remove HeaderCheck tool No one has run this tool on the ladybird source tree post-fork, and we have very similar functionality in clangd that can be enabled if needed. --- Meta/HeaderCheck/CMakeLists.txt | 12 ------ Meta/HeaderCheck/generate_all.py | 70 -------------------------------- 2 files changed, 82 deletions(-) delete mode 100644 Meta/HeaderCheck/CMakeLists.txt delete mode 100755 Meta/HeaderCheck/generate_all.py diff --git a/Meta/HeaderCheck/CMakeLists.txt b/Meta/HeaderCheck/CMakeLists.txt deleted file mode 100644 index 426bd533dec..00000000000 --- a/Meta/HeaderCheck/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -execute_process(COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/generate_all.py" "${SERENITY_ARCH}" OUTPUT_VARIABLE SOURCES_STRING) -string(REPLACE "\n" ";" SOURCES_LIST ${SOURCES_STRING}) - -# TODO: LibSoftGPU does not compile with this warning enabled, so we disable it here. -# Once LibSoftGPU drops this disable, HeaderCheck should remove it, too. In particular, the following error would be generated: -# Userland/Libraries/LibSoftGPU/SIMD.h: In function 'AK::SIMD::f32x4 SoftGPU::ddx(AK::SIMD::f32x4)': -# Userland/Libraries/LibSoftGPU/SIMD.h:71:59: error: SSE vector return without SSE enabled changes the ABI [-Werror=psabi] -# 71 | ALWAYS_INLINE static AK::SIMD::f32x4 ddx(AK::SIMD::f32x4 v) -# | ^ -add_compile_options(-Wno-psabi) - -add_library(HeaderCheck OBJECT ${SOURCES_LIST}) diff --git a/Meta/HeaderCheck/generate_all.py b/Meta/HeaderCheck/generate_all.py deleted file mode 100755 index f947003a9fa..00000000000 --- a/Meta/HeaderCheck/generate_all.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -import subprocess - -TEST_FILE_TEMPLATE = '''\ -#include <{filename}> -// Check idempotency: -#include <{filename}> -''' - - -def get_headers_here(): - result = subprocess.run( - ['git', 'ls-files', 'AK/*.h', 'Userland/Libraries/*.h'], - check=True, capture_output=True, text=True) - assert result.stderr == '' - output = result.stdout.split('\n') - assert output[-1] == '' # Trailing newline - assert len(output) > 500, 'There should be well over a thousand headers, not only {}?!'.format(len(output)) - return output[:-1] - - -def as_filename(header_path): - return header_path.replace('/', '__') + '__test.cpp' - - -def verbosely_write(path, new_content): - print(path) - # FIXME: Ensure directory exists - if os.path.exists(path): - with open(path, 'r') as fp: - old_data = fp.read() - if old_data == new_content: - # Fast path! Don't trigger ninja - return - with open(path, 'w') as fp: - fp.write(new_content) - - -def generate_part(header): - content = TEST_FILE_TEMPLATE.format(filename=header) - if header.startswith('Kernel/'): - content += '#define KERNEL\n' - verbosely_write(as_filename(header), content) - - -def run(root_path, arch): - os.chdir(root_path) - headers_list = get_headers_here() - - generated_files_path = os.path.join(root_path, 'Build', arch, 'Meta', 'HeaderCheck') - if not os.path.exists(generated_files_path): - os.mkdir(generated_files_path) - os.chdir(generated_files_path) - for header in headers_list: - generate_part(header) - - -if __name__ == '__main__': - if 'LADYBIRD_SOURCE_DIR' not in os.environ: - print('Must set LADYBIRD_SOURCE_DIR first!', file=sys.stderr) - exit(1) - if len(sys.argv) == 2: - run(os.environ['LADYBIRD_SOURCE_DIR'], sys.argv[1]) - else: - print('Usage: LADYBIRD_SOURCE_DIR=/path/to/serenity {} SERENITY_BUILD_ARCH' - .format(sys.argv[0]), file=sys.stderr) - exit(1)