mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 15:10:19 +00:00
Everywhere: Remove AK_DONT_REPLACE_STD macro
Let's just always include `<utility>`. Placing our own incompatible with the STL declaration of these functions in AK was always fishy to begin with.
This commit is contained in:
parent
cb7402bc69
commit
45301e8169
Notes:
github-actions[bot]
2024-07-31 00:39:22 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/45301e81694 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/821
27 changed files with 4 additions and 86 deletions
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/Base64.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Vector.h>
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include <AK/Assertions.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace AK {
|
||||
|
||||
template<typename T, typename U>
|
||||
|
@ -35,44 +37,8 @@ requires(AK::Detail::IsIntegral<T>)
|
|||
template<typename... Args>
|
||||
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<typename T>
|
||||
constexpr T&& forward(AK::Detail::RemoveReference<T>& param)
|
||||
{
|
||||
return static_cast<T&&>(param);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr T&& forward(AK::Detail::RemoveReference<T>&& param) noexcept
|
||||
{
|
||||
static_assert(!AK::Detail::IsLvalueReference<T>, "Can't forward an rvalue as an lvalue.");
|
||||
return static_cast<T&&>(param);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr T&& move(T& arg)
|
||||
{
|
||||
return static_cast<T&&>(arg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace AK {
|
||||
using AK_REPLACED_STD_NAMESPACE::forward;
|
||||
using AK_REPLACED_STD_NAMESPACE::move;
|
||||
using std::forward;
|
||||
using std::move;
|
||||
}
|
||||
|
||||
namespace AK::Detail {
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/Array.h>
|
||||
#include <AK/Checked.h>
|
||||
#include <AK/Endian.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/CharacterTypes.h>
|
||||
#include <AK/Concepts.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/Format.h>
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -48,7 +48,6 @@ config("ladybird_config") {
|
|||
"//Userland/Applications",
|
||||
"//Userland/Services",
|
||||
]
|
||||
defines = [ "AK_DONT_REPLACE_STD" ]
|
||||
}
|
||||
|
||||
ladybird_helper_processes = [
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
#include <AK/Atomic.h>
|
||||
#include <AK/SourceLocation.h>
|
||||
#include <LibAudio/PlaybackStreamOboe.h>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
#include <LibGfx/Font/OpenType/Typeface.h>
|
||||
#include <LibGfx/Font/WOFF2/Loader.h>
|
||||
#include <woff2/decode.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/Array.h>
|
||||
#include <AK/CharacterTypes.h>
|
||||
#include <AK/Find.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/AllOf.h>
|
||||
#include <AK/Array.h>
|
||||
#include <AK/GenericLexer.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/Array.h>
|
||||
#include <LibUnicode/DisplayNames.h>
|
||||
#include <LibUnicode/ICU.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/Array.h>
|
||||
#include <AK/CharacterTypes.h>
|
||||
#include <AK/GenericLexer.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/Utf16View.h>
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/String.h>
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <LibUnicode/ICU.h>
|
||||
#include <LibUnicode/IDNA.h>
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <LibUnicode/ICU.h>
|
||||
#include <LibUnicode/ListFormat.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/AllOf.h>
|
||||
#include <AK/GenericLexer.h>
|
||||
#include <AK/HashTable.h>
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibUnicode/ICU.h>
|
||||
#include <LibUnicode/Normalize.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/CharacterTypes.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/Utf8View.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <LibUnicode/ICU.h>
|
||||
#include <LibUnicode/Locale.h>
|
||||
#include <LibUnicode/NumberFormat.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/Utf16View.h>
|
||||
#include <AK/Utf32View.h>
|
||||
#include <LibUnicode/ICU.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibUnicode/ICU.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/Array.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/QuickSort.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <LibUnicode/DateTimeFormat.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <core/SkBitmap.h>
|
||||
#include <core/SkBlurTypes.h>
|
||||
#include <core/SkCanvas.h>
|
||||
|
|
Loading…
Reference in a new issue