mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Upgrade to C++20 (#4239)
* Use explicit this capture required by C++20 * Use C++20 span * Replace wpi::numbers with std::numbers * Fix C++20 clang-tidy warning false positive in fmt * Remove ciso646 include since C++20 removed that header * Fix global-buffer-overflow asan warnings in ntcore tests * Add DIOSetProxy constructor to HAL * Upgrade MSVC compiler to 2022 * Bump native-utils to 2023.2.7 (changes to std=c++20) Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
This commit is contained in:
@@ -18,7 +18,7 @@ using namespace wpi;
|
||||
TEST(ConvertUTFTest, ConvertUTF16LittleEndianToUTF8String) {
|
||||
// Src is the look of disapproval.
|
||||
alignas(UTF16) static const char Src[] = "\xff\xfe\xa0\x0c_\x00\xa0\x0c";
|
||||
span<const char> Ref(Src, sizeof(Src) - 1);
|
||||
std::span<const char> Ref(Src, sizeof(Src) - 1);
|
||||
SmallString<20> Result;
|
||||
bool Success = convertUTF16ToUTF8String(Ref, Result);
|
||||
EXPECT_TRUE(Success);
|
||||
@@ -29,7 +29,7 @@ TEST(ConvertUTFTest, ConvertUTF16LittleEndianToUTF8String) {
|
||||
TEST(ConvertUTFTest, ConvertUTF16BigEndianToUTF8String) {
|
||||
// Src is the look of disapproval.
|
||||
alignas(UTF16) static const char Src[] = "\xfe\xff\x0c\xa0\x00_\x0c\xa0";
|
||||
span<const char> Ref(Src, sizeof(Src) - 1);
|
||||
std::span<const char> Ref(Src, sizeof(Src) - 1);
|
||||
SmallString<20> Result;
|
||||
bool Success = convertUTF16ToUTF8String(Ref, Result);
|
||||
EXPECT_TRUE(Success);
|
||||
@@ -52,13 +52,13 @@ TEST(ConvertUTFTest, ConvertUTF8ToUTF16String) {
|
||||
|
||||
TEST(ConvertUTFTest, OddLengthInput) {
|
||||
SmallString<20> Result;
|
||||
bool Success = convertUTF16ToUTF8String(span<const char>("xxxxx", 5), Result);
|
||||
bool Success = convertUTF16ToUTF8String(std::span<const char>("xxxxx", 5), Result);
|
||||
EXPECT_FALSE(Success);
|
||||
}
|
||||
|
||||
TEST(ConvertUTFTest, Empty) {
|
||||
SmallString<20> Result;
|
||||
bool Success = convertUTF16ToUTF8String(span<const char>(), Result);
|
||||
bool Success = convertUTF16ToUTF8String(std::span<const char>(), Result);
|
||||
EXPECT_TRUE(Success);
|
||||
EXPECT_TRUE(std::string{Result}.empty());
|
||||
}
|
||||
@@ -82,7 +82,7 @@ TEST(ConvertUTFTest, HasUTF16BOM) {
|
||||
TEST(ConvertUTFTest, UTF16WrappersForConvertUTF16ToUTF8String) {
|
||||
// Src is the look of disapproval.
|
||||
alignas(UTF16) static const char Src[] = "\xff\xfe\xa0\x0c_\x00\xa0\x0c";
|
||||
span<const UTF16> SrcRef((const UTF16 *)Src, 4);
|
||||
std::span<const UTF16> SrcRef((const UTF16 *)Src, 4);
|
||||
SmallString<20> Result;
|
||||
bool Success = convertUTF16ToUTF8String(SrcRef, Result);
|
||||
EXPECT_TRUE(Success);
|
||||
|
||||
Reference in New Issue
Block a user