diff --git a/src/include/jessilib/unicode_sequence.hpp b/src/include/jessilib/unicode_sequence.hpp index f288451..0576e2a 100644 --- a/src/include/jessilib/unicode_sequence.hpp +++ b/src/include/jessilib/unicode_sequence.hpp @@ -26,6 +26,7 @@ #pragma once #include "unicode_base.hpp" +#include namespace jessilib { diff --git a/src/include/jessilib/unicode_syntax.hpp b/src/include/jessilib/unicode_syntax.hpp index 5c2bdf2..42d4a9a 100644 --- a/src/include/jessilib/unicode_syntax.hpp +++ b/src/include/jessilib/unicode_syntax.hpp @@ -26,6 +26,7 @@ #pragma once #include +#include #include "unicode.hpp" namespace jessilib { diff --git a/src/include/jessilib/util.hpp b/src/include/jessilib/util.hpp index e4f0ec7..0591f5f 100644 --- a/src/include/jessilib/util.hpp +++ b/src/include/jessilib/util.hpp @@ -21,6 +21,8 @@ #include #include #include +#include +#include /** Macros */ @@ -140,6 +142,10 @@ constexpr T square(T in_value) { return in_value * in_value; } +#ifdef __cpp_lib_byteswap +using std::byteswap; +#else + template constexpr IntegerT byteswap(IntegerT in_integer) { // TODO: Remove w/ C++23 static_assert(sizeof(IntegerT) > 1, "byteswap on single byte does nothing"); @@ -171,6 +177,8 @@ constexpr IntegerT byteswap(IntegerT in_integer) { // TODO: Remove w/ C++23 } } +#endif // __cpp_lib_byteswap + template void array_byteswap(CharT* begin, CharT* end) { while (begin != end) { diff --git a/src/include/jessilib/word_split.hpp b/src/include/jessilib/word_split.hpp index 310fe10..53ee80c 100644 --- a/src/include/jessilib/word_split.hpp +++ b/src/include/jessilib/word_split.hpp @@ -28,6 +28,7 @@ #include #include #include +#include namespace jessilib { diff --git a/src/test/unicode.cpp b/src/test/unicode.cpp index 055ca04..30f5d27 100644 --- a/src/test/unicode.cpp +++ b/src/test/unicode.cpp @@ -19,6 +19,7 @@ #include "jessilib/unicode.hpp" #include #include +#include #include "jessilib/split.hpp" #include "test.hpp" @@ -466,7 +467,7 @@ std::vector folding_sets_from_folding_info(const std::vector result; folding_set current{}; - uint32_t last_match; + uint32_t last_match{}; for (auto& info : in_info) { int64_t diff = static_cast(info.out_codepoint) - static_cast(info.in_codepoint); diff --git a/src/test/unicode_sequence.cpp b/src/test/unicode_sequence.cpp index e65d643..4d451f1 100644 --- a/src/test/unicode_sequence.cpp +++ b/src/test/unicode_sequence.cpp @@ -25,13 +25,13 @@ using namespace std::literals; // Compile-time tests for constexpr on compilers which support C++20 constexpr std::string #if defined(__cpp_lib_constexpr_string) && (__GNUC__ >= 12 || _MSC_VER >= 1929) -constexpr std::string cpp_constexpr(std::string_view in_expression) { - std::string result{ static_cast(in_expression) }; +constexpr std::u8string cpp_constexpr(std::u8string_view in_expression) { + std::u8string result{ static_cast(in_expression) }; jessilib::apply_cpp_escape_sequences(result); return result; } -ASSERT_COMPILES_CONSTEXPR(return cpp_constexpr("test"s) == "test"s); -ASSERT_COMPILES_CONSTEXPR(return cpp_constexpr("\\r\\n"s) == "\r\n"s); +ASSERT_COMPILES_CONSTEXPR(return cpp_constexpr(u8"test"s) == u8"test"s); +ASSERT_COMPILES_CONSTEXPR(return cpp_constexpr(u8"\\r\\n"s) == u8"\r\n"s); #endif // __cpp_lib_constexpr_string #ifdef JESSILIB_CHAR_AS_UTF8