diff --git a/AK/StdLibExtraDetails.h b/AK/StdLibExtraDetails.h index 3746f1c280a..a970cfd2bb9 100644 --- a/AK/StdLibExtraDetails.h +++ b/AK/StdLibExtraDetails.h @@ -274,6 +274,12 @@ template<> struct __MakeUnsigned { using Type = bool; }; +#ifdef AK_ARCH_AARCH64 +template<> +struct __MakeUnsigned { + using Type = wchar_t; +}; +#endif template using MakeUnsigned = typename __MakeUnsigned::Type; @@ -326,6 +332,12 @@ template<> struct __MakeSigned { using Type = char; }; +#ifdef AK_ARCH_AARCH64 +template<> +struct __MakeSigned { + using Type = void; +}; +#endif template using MakeSigned = typename __MakeSigned::Type; diff --git a/CMakeLists.txt b/CMakeLists.txt index 0344af4abe8..8df01f31d6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -182,6 +182,11 @@ if (ENABLE_COMPILETIME_FORMAT_CHECK) add_compile_definitions(ENABLE_COMPILETIME_FORMAT_CHECK) endif() +if("${SERENITY_ARCH}" STREQUAL "aarch64") + # FIXME: re-enable this warning + add_compile_options(-Wno-type-limits) +endif() + add_link_options(-Wno-unused-command-line-argument) include_directories(.) diff --git a/Tests/LibC/TestWchar.cpp b/Tests/LibC/TestWchar.cpp index 86a3e61692f..db445e485e9 100644 --- a/Tests/LibC/TestWchar.cpp +++ b/Tests/LibC/TestWchar.cpp @@ -239,17 +239,17 @@ TEST_CASE(mbrtowc) // Ensure that we can parse normal ASCII characters. ret = mbrtowc(&wc, "Hello", 5, &state); EXPECT_EQ(ret, 1ul); - EXPECT_EQ(wc, 'H'); + EXPECT_EQ(wc, static_cast('H')); // Try two three-byte codepoints (™™), only one of which should be consumed. ret = mbrtowc(&wc, "\xe2\x84\xa2\xe2\x84\xa2", 6, &state); EXPECT_EQ(ret, 3ul); - EXPECT_EQ(wc, 0x2122); + EXPECT_EQ(wc, static_cast(0x2122)); // Try a null character, which should return 0 and reset the state to the initial state. ret = mbrtowc(&wc, "\x00\x00", 2, &state); EXPECT_EQ(ret, 0ul); - EXPECT_EQ(wc, 0); + EXPECT_EQ(wc, static_cast(0)); EXPECT_NE(mbsinit(&state), 0); // Try an incomplete multibyte character. @@ -262,7 +262,7 @@ TEST_CASE(mbrtowc) // Finish the previous multibyte character. ret = mbrtowc(&wc, "\xa2", 1, &state); EXPECT_EQ(ret, 1ul); - EXPECT_EQ(wc, 0x2122); + EXPECT_EQ(wc, static_cast(0x2122)); // Try an invalid multibyte sequence. // Reset the state afterwards because the effects are undefined. @@ -550,17 +550,17 @@ TEST_CASE(mbtowc) // Ensure that we can parse normal ASCII characters. ret = mbtowc(&wc, "Hello", 5); EXPECT_EQ(ret, 1); - EXPECT_EQ(wc, 'H'); + EXPECT_EQ(wc, static_cast('H')); // Try two three-byte codepoints (™™), only one of which should be consumed. ret = mbtowc(&wc, "\xe2\x84\xa2\xe2\x84\xa2", 6); EXPECT_EQ(ret, 3); - EXPECT_EQ(wc, 0x2122); + EXPECT_EQ(wc, static_cast(0x2122)); // Try a null character, which should return 0. ret = mbtowc(&wc, "\x00\x00", 2); EXPECT_EQ(ret, 0); - EXPECT_EQ(wc, 0); + EXPECT_EQ(wc, static_cast(0)); // Try an incomplete multibyte character. ret = mbtowc(&wc, "\xe2\x84", 2); diff --git a/Userland/Libraries/LibRegex/RegexMatch.h b/Userland/Libraries/LibRegex/RegexMatch.h index a15cabb744f..04f2e0483bd 100644 --- a/Userland/Libraries/LibRegex/RegexMatch.h +++ b/Userland/Libraries/LibRegex/RegexMatch.h @@ -270,9 +270,11 @@ public: return m_view.visit( [&](StringView view) -> u32 { auto ch = view[index]; - if (ch < 0) - return 256u + ch; - return ch; + if constexpr (IsSigned) { + if (ch < 0) + return 256u + ch; + return ch; + } }, [&](Utf32View const& view) -> u32 { return view[index]; }, [&](Utf16View const& view) -> u32 { return view.code_point_at(index); },