diff --git a/meson.build b/meson.build index 5b9c20e9a..620df8762 100644 --- a/meson.build +++ b/meson.build @@ -6,7 +6,7 @@ project( version: '0.1.0', meson_version: '>= 1.3', default_options: [ - 'cpp_std=c++23', + 'cpp_std=c++20', 'warning_level=0', 'unity=on', # merge source files per target 'unity_size=8', # TODO: mess around with this diff --git a/subprojects/packagefiles/simdutf/meson.build b/subprojects/packagefiles/simdutf/meson.build index 573d5d8b7..f4035adeb 100644 --- a/subprojects/packagefiles/simdutf/meson.build +++ b/subprojects/packagefiles/simdutf/meson.build @@ -1,6 +1,6 @@ project('simdutf', 'cpp', - default_options: ['cpp_std=c++23'], + default_options: ['cpp_std=c++20'], version: '8.2.0', meson_version: '>= 1.1', license: ['MIT'], diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp index cc4de5bff..16707e95f 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.cpp @@ -589,7 +589,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { backupTexture = getTextureId(m_skinIndex); if (m_skinIndex == - std::to_underlying(EDefaultSkins::ServerSelected)) { + static_cast(EDefaultSkins::ServerSelected)) { skinName = app.GetString(IDS_DEFAULT_SKINS); } else { skinName = wchDefaultNamesA[m_skinIndex]; @@ -908,8 +908,8 @@ int UIScene_SkinSelectMenu::getNextSkinIndex(int sourceIndex) { ++nextSkin; if (m_packIndex == SKIN_SELECT_PACK_DEFAULT && - nextSkin >= std::to_underlying(EDefaultSkins::Count)) { - nextSkin = std::to_underlying(EDefaultSkins::ServerSelected); + nextSkin >= static_cast(EDefaultSkins::Count)) { + nextSkin = static_cast(EDefaultSkins::ServerSelected); } else if (m_currentPack != nullptr && nextSkin >= m_currentPack->getSkinCount()) { nextSkin = 0; @@ -933,7 +933,7 @@ int UIScene_SkinSelectMenu::getPreviousSkinIndex(int sourceIndex) { default: if (previousSkin == 0) { if (m_packIndex == SKIN_SELECT_PACK_DEFAULT) { - previousSkin = std::to_underlying(EDefaultSkins::Count) - 1; + previousSkin = static_cast(EDefaultSkins::Count) - 1; } else if (m_currentPack != nullptr) { previousSkin = m_currentPack->getSkinCount() - 1; } diff --git a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h index b7e9299bf..5e9027f0f 100644 --- a/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h +++ b/targets/app/common/UI/Scenes/Help & Options/UIScene_SkinSelectMenu.h @@ -25,7 +25,7 @@ class UILayer; class UIScene_SkinSelectMenu : public UIScene { private: static const char* - wchDefaultNamesA[std::to_underlying(EDefaultSkins::Count)]; + wchDefaultNamesA[static_cast(EDefaultSkins::Count)]; // 4J Stu - How many to show on each side of the main control static const int sidePreviewControls = 4; diff --git a/targets/app/common/UI/UIController.cpp b/targets/app/common/UI/UIController.cpp index 21db28c7a..12d91628d 100644 --- a/targets/app/common/UI/UIController.cpp +++ b/targets/app/common/UI/UIController.cpp @@ -1268,7 +1268,7 @@ bool UIController::NavigateToScene(int iPad, EUIScene scene, void* initData, setFullscreenMenuDisplayed(true); } - std::println(stderr, "TIMER: Navigate to scene: Elapsed time {:.6f}", + fprintf(stderr, "TIMER: Navigate to scene: Elapsed time %.6f", timer.elapsed_seconds()); return success; diff --git a/targets/minecraft/world/entity/player/Player.cpp b/targets/minecraft/world/entity/player/Player.cpp index 2c04410a1..26ec1cb79 100644 --- a/targets/minecraft/world/entity/player/Player.cpp +++ b/targets/minecraft/world/entity/player/Player.cpp @@ -535,7 +535,7 @@ void Player::ride(std::shared_ptr e) { void Player::setPlayerDefaultSkin(EDefaultSkins skin) { #if !defined(_CONTENT_PACKAGE) printf("Setting default skin to %d for player %s\n", - std::to_underlying(skin), name.c_str()); + static_cast(skin), name.c_str()); #endif m_skinIndex = skin; } diff --git a/targets/platform/thread/C4JThread.cpp b/targets/platform/thread/C4JThread.cpp index b469ee17d..c253cf7c9 100644 --- a/targets/platform/thread/C4JThread.cpp +++ b/targets/platform/thread/C4JThread.cpp @@ -140,7 +140,7 @@ void setPriorityPlatform(std::thread& threadHandle, bool isSelf, handle = ::GetCurrentThread(); else return; - (void)::SetThreadPriority(handle, std::to_underlying(priority)); + (void)::SetThreadPriority(handle, static_cast(priority)); #elif defined(__linux__) std::int64_t tid = 0; diff --git a/targets/util/FrameProfiler.h b/targets/util/FrameProfiler.h index 71fa01937..b39edbc6a 100644 --- a/targets/util/FrameProfiler.h +++ b/targets/util/FrameProfiler.h @@ -40,7 +40,7 @@ public: [[nodiscard]] static constexpr std::size_t BucketIndex( Bucket bucket) noexcept { - return static_cast(std::to_underlying(bucket)); + return static_cast(bucket); } [[nodiscard]] static constexpr std::size_t BucketCount() noexcept { diff --git a/targets/util/Timer.h b/targets/util/Timer.h index 5738d0a0c..60aee1338 100644 --- a/targets/util/Timer.h +++ b/targets/util/Timer.h @@ -81,11 +81,12 @@ public: std::chrono::duration(elapsed).count(); try { - name_.empty() - ? std::println(stderr, "[TIMER] {:.3f} ms ({}:{})", ms, file_, - line_) - : std::println(stderr, "[TIMER] {} - {:.3f} ms ({}:{})", name_, - ms, file_, line_); + const auto log = + name_.empty() ? std::format("[TIMER] {:.3f} ms ({}:{})\n", ms, + file_, line_) + : std::format("[TIMER] {} - {:.3f} ms ({}:{})\n", + name_, ms, file_, line_); + std::fputs(log.c_str(), stderr); } catch (...) { std::fprintf(stderr, "[TIMER] %.3f ms\n", ms); }