From c2ab1d60b16d0250df41a251afd32d7801b249a9 Mon Sep 17 00:00:00 2001 From: stasoid Date: Sun, 1 Dec 2024 14:43:10 +0500 Subject: [PATCH] AK: Simplify usage of windows.h and winsock2.h Use instead of windows.h/winsock2.h to avoid timeval-related errors. Note: winsock2.h includes windows.h --- AK/CMakeLists.txt | 1 + AK/Time.cpp | 4 +--- AK/Windows.h | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 AK/Windows.h diff --git a/AK/CMakeLists.txt b/AK/CMakeLists.txt index 3fbdc65b90a9d..3db92bbb8b657 100644 --- a/AK/CMakeLists.txt +++ b/AK/CMakeLists.txt @@ -75,6 +75,7 @@ if (BUILD_SHARED_LIBS AND NOT CMAKE_SKIP_INSTALL_RULES AND NOT "${VCPKG_INSTALLE endif() if (ENABLE_SWIFT) + set(SWIFT_EXCLUDE_HEADERS Windows.h) generate_clang_module_map(AK GENERATED_FILES "${CMAKE_CURRENT_BINARY_DIR}/Backtrace.h" diff --git a/AK/Time.cpp b/AK/Time.cpp index 923f6404da6a2..d10340e5978ae 100644 --- a/AK/Time.cpp +++ b/AK/Time.cpp @@ -8,9 +8,7 @@ #include #ifdef AK_OS_WINDOWS -# define timeval dummy_timeval -# include -# undef timeval +# include #endif namespace AK { diff --git a/AK/Windows.h b/AK/Windows.h new file mode 100644 index 0000000000000..c8783daf2e9e6 --- /dev/null +++ b/AK/Windows.h @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024, stasoid + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +#define timeval dummy_timeval +#include +#undef timeval +#include