From 219561391b73ec2ac172ed7538e9156d29713fc1 Mon Sep 17 00:00:00 2001 From: Dylan Conway Date: Thu, 21 Nov 2024 16:18:08 -0800 Subject: [PATCH] move BunExtras.h to BunStdExtras.h --- Source/WTF/wtf/CMakeLists.txt | 1 + Source/WTF/wtf/StdLibExtras.h | 16 +--------------- Source/bmalloc/CMakeLists.txt | 1 - Source/bmalloc/bmalloc/BunExtras.h | 17 ----------------- Source/bmalloc/bmalloc/GigacageConfig.h | 2 +- Source/bmalloc/bmalloc/IsoHeapImplInlines.h | 2 +- Source/bmalloc/bmalloc/IsoPageInlines.h | 2 +- Source/bmalloc/bmalloc/Packed.h | 2 +- 8 files changed, 6 insertions(+), 37 deletions(-) delete mode 100644 Source/bmalloc/bmalloc/BunExtras.h diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt index 38bb4fb475f46..70ee588c7f39e 100644 --- a/Source/WTF/wtf/CMakeLists.txt +++ b/Source/WTF/wtf/CMakeLists.txt @@ -295,6 +295,7 @@ set(WTF_PUBLIC_HEADERS StdFilesystem.h StdIntExtras.h StdLibExtras.h + BunStdExtras.h StdList.h StdMap.h StdMultimap.h diff --git a/Source/WTF/wtf/StdLibExtras.h b/Source/WTF/wtf/StdLibExtras.h index 1880b2eb80e45..99f19ffa2cbd0 100644 --- a/Source/WTF/wtf/StdLibExtras.h +++ b/Source/WTF/wtf/StdLibExtras.h @@ -45,24 +45,10 @@ #include #include #include -#include +#include WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN -#if defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L -#define __bit_cast std::bit_cast -#else -template < - typename Dest, typename Source, - typename std::enable_if::value && - std::is_trivially_copyable::value, - int>::type = 0> -inline constexpr Dest __bit_cast(const Source &source) { - return __builtin_bit_cast(Dest, source); -} -#endif - #define SINGLE_ARG(...) __VA_ARGS__ // useful when a macro argument includes a comma // Use this macro to declare and define a debug-only global variable that may have a diff --git a/Source/bmalloc/CMakeLists.txt b/Source/bmalloc/CMakeLists.txt index 5ec7d67b7ba22..5efacefd8d0ba 100644 --- a/Source/bmalloc/CMakeLists.txt +++ b/Source/bmalloc/CMakeLists.txt @@ -298,7 +298,6 @@ set(bmalloc_PUBLIC_HEADERS bmalloc/Zone.h bmalloc/bmalloc.h bmalloc/valgrind.h - bmalloc/BunExtras.h libpas/src/libpas/bmalloc_heap_config.h libpas/src/libpas/bmalloc_heap.h diff --git a/Source/bmalloc/bmalloc/BunExtras.h b/Source/bmalloc/bmalloc/BunExtras.h deleted file mode 100644 index ed218625d6a9c..0000000000000 --- a/Source/bmalloc/bmalloc/BunExtras.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include - -#if defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L -#define __bit_cast std::bit_cast -#else -template < - typename Dest, typename Source, - typename std::enable_if::value && - std::is_trivially_copyable::value, - int>::type = 0> -inline constexpr Dest __bit_cast(const Source &source) { - return __builtin_bit_cast(Dest, source); -} -#endif \ No newline at end of file diff --git a/Source/bmalloc/bmalloc/GigacageConfig.h b/Source/bmalloc/bmalloc/GigacageConfig.h index 95e878233c58a..e2dbf1a06ea5d 100644 --- a/Source/bmalloc/bmalloc/GigacageConfig.h +++ b/Source/bmalloc/bmalloc/GigacageConfig.h @@ -27,7 +27,7 @@ #include "Algorithm.h" #include "GigacageKind.h" -#include "BunExtras.h" +#include "" #include #include diff --git a/Source/bmalloc/bmalloc/IsoHeapImplInlines.h b/Source/bmalloc/bmalloc/IsoHeapImplInlines.h index 44568b6d92854..350f98dd14f2f 100644 --- a/Source/bmalloc/bmalloc/IsoHeapImplInlines.h +++ b/Source/bmalloc/bmalloc/IsoHeapImplInlines.h @@ -29,7 +29,7 @@ #include "IsoTLSDeallocatorEntry.h" #include "IsoSharedHeapInlines.h" #include "IsoSharedPageInlines.h" -#include "BunExtras.h" +#include "" #if !BUSE(LIBPAS) diff --git a/Source/bmalloc/bmalloc/IsoPageInlines.h b/Source/bmalloc/bmalloc/IsoPageInlines.h index 7c0e5f4460772..e834bed76c55b 100644 --- a/Source/bmalloc/bmalloc/IsoPageInlines.h +++ b/Source/bmalloc/bmalloc/IsoPageInlines.h @@ -30,7 +30,7 @@ #include "IsoHeapImpl.h" #include "IsoPage.h" #include "VMAllocate.h" -#include "BunExtras.h" +#include "" #include #if !BUSE(LIBPAS) diff --git a/Source/bmalloc/bmalloc/Packed.h b/Source/bmalloc/bmalloc/Packed.h index 0e5df3a25bc55..dd8a0f939cafd 100644 --- a/Source/bmalloc/bmalloc/Packed.h +++ b/Source/bmalloc/bmalloc/Packed.h @@ -26,7 +26,7 @@ #pragma once #include "Algorithm.h" -#include "BunExtras.h" +#include "" #include #include