From 8974eb21ad43fd535cd8c665f79c64c15b95b354 Mon Sep 17 00:00:00 2001 From: Razakhel Date: Sun, 19 Nov 2023 11:07:20 +0100 Subject: [PATCH] [Utils/StrUtils] Disabled Clang's deprecation warning for conversions - std::wstring_convert & std::codecvt_utf8_utf16 are deprecated from C++17 onward - A warning is triggered with Emscripten --- include/RaZ/Utils/StrUtils.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/RaZ/Utils/StrUtils.hpp b/include/RaZ/Utils/StrUtils.hpp index d249af02..89b042e6 100644 --- a/include/RaZ/Utils/StrUtils.hpp +++ b/include/RaZ/Utils/StrUtils.hpp @@ -3,6 +3,8 @@ #ifndef RAZ_STRUTILS_HPP #define RAZ_STRUTILS_HPP +#include "RaZ/Utils/CompilerUtils.hpp" + #include #include #include @@ -369,7 +371,10 @@ inline std::vector split(std::wstring text, wchar_t delimiter) { /// \param text Wide string to convert. /// \return Converted UTF-8 string. inline std::string toUtf8(const std::wstring& text) { + PUSH_WARNINGS_STATE + DISABLE_WARNING_CLANG(-Wdeprecated-declarations) return std::wstring_convert>().to_bytes(text); + POP_WARNINGS_STATE } /// Returns the current UTF-8 encoded string. @@ -384,7 +389,10 @@ constexpr const std::string& toUtf8(const std::string& text) { /// \param text UTF-8 string to convert. /// \return Converted wide string. inline std::wstring toWide(const std::string& text) { + PUSH_WARNINGS_STATE + DISABLE_WARNING_CLANG(-Wdeprecated-declarations) return std::wstring_convert>().from_bytes(text); + POP_WARNINGS_STATE } /// Returns the current wide string.