diff --git a/AK/Base64.cpp b/AK/Base64.cpp index 7a57944064..05691270f2 100644 --- a/AK/Base64.cpp +++ b/AK/Base64.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/AK/StdLibExtras.h b/AK/StdLibExtras.h index bb337e326f..2944137a72 100644 --- a/AK/StdLibExtras.h +++ b/AK/StdLibExtras.h @@ -16,6 +16,8 @@ #include +#include + namespace AK { template @@ -35,44 +37,8 @@ requires(AK::Detail::IsIntegral) template void compiletime_fail(Args...); -} - -#if !USING_AK_GLOBALLY || defined(AK_DONT_REPLACE_STD) -# define AK_REPLACED_STD_NAMESPACE AK::replaced_std -#else -# define AK_REPLACED_STD_NAMESPACE std -#endif - -namespace AK_REPLACED_STD_NAMESPACE { // NOLINT(cert-dcl58-cpp) Names in std to aid tools - -// NOTE: These are in the "std" namespace since some compilers and static analyzers rely on it. -// If USING_AK_GLOBALLY is false, we can't put them in ::std, so we put them in AK::replaced_std instead -// The user code should not notice anything unless it explicitly asks for std::stuff, so...don't. - -template -constexpr T&& forward(AK::Detail::RemoveReference& param) -{ - return static_cast(param); -} - -template -constexpr T&& forward(AK::Detail::RemoveReference&& param) noexcept -{ - static_assert(!AK::Detail::IsLvalueReference, "Can't forward an rvalue as an lvalue."); - return static_cast(param); -} - -template -constexpr T&& move(T& arg) -{ - return static_cast(arg); -} - -} - -namespace AK { -using AK_REPLACED_STD_NAMESPACE::forward; -using AK_REPLACED_STD_NAMESPACE::move; +using std::forward; +using std::move; } namespace AK::Detail { diff --git a/AK/String.cpp b/AK/String.cpp index 130afd7414..dd6502740f 100644 --- a/AK/String.cpp +++ b/AK/String.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/AK/Utf16View.cpp b/AK/Utf16View.cpp index bd971adc9a..f09e85cab1 100644 --- a/AK/Utf16View.cpp +++ b/AK/Utf16View.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/AK/Utf8View.cpp b/AK/Utf8View.cpp index 05d67cfa20..71f71618be 100644 --- a/AK/Utf8View.cpp +++ b/AK/Utf8View.cpp @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a5e9e43b6..20c507af1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,6 @@ if (HAIKU) add_compile_definitions(__USE_GNU) endif() -add_compile_definitions(AK_DONT_REPLACE_STD) add_cxx_compile_options(-Wno-expansion-to-defined) add_cxx_compile_options(-Wno-user-defined-literals) diff --git a/Meta/Lagom/ReadMe.md b/Meta/Lagom/ReadMe.md index 877eb1abbe..c4fa0e918b 100644 --- a/Meta/Lagom/ReadMe.md +++ b/Meta/Lagom/ReadMe.md @@ -40,8 +40,6 @@ Now, you can link against Lagom libraries. Things to keep in mind: - You should prefer to use a library's `Lagom::` alias when linking - Example: `Lagom::Core` vs `LibCore` -- If you still _need_ to use the C++ standard library, you may have to compile with the `AK_DONT_REPLACE_STD` macro. - - Serenity defines its own `move` and `forward` functions inside of `AK/StdLibExtras.h` that will clash with the standard library's definitions. This macro will make Serenity use the standard library's `move` and `forward` instead. - If your application has name clashes with any names in AK, you may have to define `USING_AK_GLOBALLY=0` for the files that have visibility to both sets of headers. ## Fuzzing diff --git a/Meta/gn/secondary/Ladybird/BUILD.gn b/Meta/gn/secondary/Ladybird/BUILD.gn index 15cfb5c0d7..fe0002ecb6 100644 --- a/Meta/gn/secondary/Ladybird/BUILD.gn +++ b/Meta/gn/secondary/Ladybird/BUILD.gn @@ -48,7 +48,6 @@ config("ladybird_config") { "//Userland/Applications", "//Userland/Services", ] - defines = [ "AK_DONT_REPLACE_STD" ] } ladybird_helper_processes = [ diff --git a/Userland/Libraries/LibAudio/PlaybackStreamOboe.cpp b/Userland/Libraries/LibAudio/PlaybackStreamOboe.cpp index d619fd6839..a9cd02b980 100644 --- a/Userland/Libraries/LibAudio/PlaybackStreamOboe.cpp +++ b/Userland/Libraries/LibAudio/PlaybackStreamOboe.cpp @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD #include #include #include diff --git a/Userland/Libraries/LibGfx/Font/WOFF2/Loader.cpp b/Userland/Libraries/LibGfx/Font/WOFF2/Loader.cpp index f92976b4ab..e6938bde73 100644 --- a/Userland/Libraries/LibGfx/Font/WOFF2/Loader.cpp +++ b/Userland/Libraries/LibGfx/Font/WOFF2/Loader.cpp @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD #include #include #include diff --git a/Userland/Libraries/LibUnicode/CharacterTypes.cpp b/Userland/Libraries/LibUnicode/CharacterTypes.cpp index a0f5a8048d..f8cf4bc608 100644 --- a/Userland/Libraries/LibUnicode/CharacterTypes.cpp +++ b/Userland/Libraries/LibUnicode/CharacterTypes.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibUnicode/DateTimeFormat.cpp b/Userland/Libraries/LibUnicode/DateTimeFormat.cpp index b480112145..4b5707e9bb 100644 --- a/Userland/Libraries/LibUnicode/DateTimeFormat.cpp +++ b/Userland/Libraries/LibUnicode/DateTimeFormat.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibUnicode/DisplayNames.cpp b/Userland/Libraries/LibUnicode/DisplayNames.cpp index e8111f246c..f2ad844235 100644 --- a/Userland/Libraries/LibUnicode/DisplayNames.cpp +++ b/Userland/Libraries/LibUnicode/DisplayNames.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibUnicode/DurationFormat.cpp b/Userland/Libraries/LibUnicode/DurationFormat.cpp index a3ccb02c5e..cadca63d30 100644 --- a/Userland/Libraries/LibUnicode/DurationFormat.cpp +++ b/Userland/Libraries/LibUnicode/DurationFormat.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibUnicode/ICU.cpp b/Userland/Libraries/LibUnicode/ICU.cpp index 853a4dd0d5..fc63292ed6 100644 --- a/Userland/Libraries/LibUnicode/ICU.cpp +++ b/Userland/Libraries/LibUnicode/ICU.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibUnicode/ICU.h b/Userland/Libraries/LibUnicode/ICU.h index 5cbaea76d3..c6af66b2ae 100644 --- a/Userland/Libraries/LibUnicode/ICU.h +++ b/Userland/Libraries/LibUnicode/ICU.h @@ -6,8 +6,6 @@ #pragma once -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibUnicode/IDNA.cpp b/Userland/Libraries/LibUnicode/IDNA.cpp index c890751e85..47dc9f75d2 100644 --- a/Userland/Libraries/LibUnicode/IDNA.cpp +++ b/Userland/Libraries/LibUnicode/IDNA.cpp @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include diff --git a/Userland/Libraries/LibUnicode/ListFormat.cpp b/Userland/Libraries/LibUnicode/ListFormat.cpp index 2205a5e03b..6db8045ccb 100644 --- a/Userland/Libraries/LibUnicode/ListFormat.cpp +++ b/Userland/Libraries/LibUnicode/ListFormat.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibUnicode/Locale.cpp b/Userland/Libraries/LibUnicode/Locale.cpp index df8680b768..f4bdf2cc0f 100644 --- a/Userland/Libraries/LibUnicode/Locale.cpp +++ b/Userland/Libraries/LibUnicode/Locale.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibUnicode/Normalize.cpp b/Userland/Libraries/LibUnicode/Normalize.cpp index ce01566c29..c5b5b1cb97 100644 --- a/Userland/Libraries/LibUnicode/Normalize.cpp +++ b/Userland/Libraries/LibUnicode/Normalize.cpp @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibUnicode/NumberFormat.cpp b/Userland/Libraries/LibUnicode/NumberFormat.cpp index 372c63c874..a45bd39061 100644 --- a/Userland/Libraries/LibUnicode/NumberFormat.cpp +++ b/Userland/Libraries/LibUnicode/NumberFormat.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibUnicode/RelativeTimeFormat.cpp b/Userland/Libraries/LibUnicode/RelativeTimeFormat.cpp index 25ebe6619b..a9604bb24a 100644 --- a/Userland/Libraries/LibUnicode/RelativeTimeFormat.cpp +++ b/Userland/Libraries/LibUnicode/RelativeTimeFormat.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibUnicode/Segmenter.cpp b/Userland/Libraries/LibUnicode/Segmenter.cpp index 450b53eb03..953f36a73d 100644 --- a/Userland/Libraries/LibUnicode/Segmenter.cpp +++ b/Userland/Libraries/LibUnicode/Segmenter.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibUnicode/String.cpp b/Userland/Libraries/LibUnicode/String.cpp index 30b4ff6449..2e37675ca2 100644 --- a/Userland/Libraries/LibUnicode/String.cpp +++ b/Userland/Libraries/LibUnicode/String.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibUnicode/TimeZone.cpp b/Userland/Libraries/LibUnicode/TimeZone.cpp index 5269c4fa89..e6fdcb5c88 100644 --- a/Userland/Libraries/LibUnicode/TimeZone.cpp +++ b/Userland/Libraries/LibUnicode/TimeZone.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibUnicode/UnicodeKeywords.cpp b/Userland/Libraries/LibUnicode/UnicodeKeywords.cpp index 1713607f76..048a6092d2 100644 --- a/Userland/Libraries/LibUnicode/UnicodeKeywords.cpp +++ b/Userland/Libraries/LibUnicode/UnicodeKeywords.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include diff --git a/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp b/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp index c40c2e4823..069b022ed8 100644 --- a/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp +++ b/Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#define AK_DONT_REPLACE_STD - #include #include #include