diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index 19eb2282ea..b4c1df3ea4 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -18,7 +18,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES GNU) endif() if(COMPILE_RUNTIME_LIGHT) - set(REQUIRED_CMAKE_CXX_STANDARD 20) + set(REQUIRED_CMAKE_CXX_STANDARD 23) else() set(REQUIRED_CMAKE_CXX_STANDARD 17) endif() diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp index 26961f3cdf..70703088bf 100644 --- a/compiler/compiler-settings.cpp +++ b/compiler/compiler-settings.cpp @@ -340,6 +340,8 @@ void CompilerSettings::init() { ss << " -std=c++17"; #elif __cplusplus <= 202002L ss << " -std=c++20"; + #elif __cplusplus <= 202302L + ss << " -std=c++23"; #else #error unsupported __cplusplus value #endif diff --git a/compiler/make/make.cpp b/compiler/make/make.cpp index dce017a5dd..776fafb47a 100644 --- a/compiler/make/make.cpp +++ b/compiler/make/make.cpp @@ -450,7 +450,7 @@ static std::string get_light_runtime_compiler_options() { s << option << " "; } } - s << "-std=c++20 "; + s << "-std=c++23 "; s << "-iquote " << G->settings().runtime_and_common_src.get() << " "; #endif diff --git a/runtime-light/coroutine/task.h b/runtime-light/coroutine/task.h index 64838f3445..ce8d49721f 100644 --- a/runtime-light/coroutine/task.h +++ b/runtime-light/coroutine/task.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/runtime-light/tl/tl-types.h b/runtime-light/tl/tl-types.h index 7dcafbd392..9f85981417 100644 --- a/runtime-light/tl/tl-types.h +++ b/runtime-light/tl/tl-types.h @@ -8,11 +8,11 @@ #include #include #include -#include +#include #include #include "common/tl/constants/common.h" -#include "runtime-light/allocator/allocator.h" +#include "runtime-common/core/allocator/script-allocator.h" #include "runtime-common/core/std/containers.h" #include "runtime-light/tl/tl-core.h" @@ -387,26 +387,24 @@ struct HttpVersion final { } bool fetch(TLBuffer &tlb) noexcept { - using version_utype = std::underlying_type_t; - switch (tlb.fetch_trivial().value_or(TL_ZERO)) { - case static_cast(Version::V09): { + case std::to_underlying(Version::V09): { version = Version::V09; break; } - case static_cast(Version::V10): { + case std::to_underlying(Version::V10): { version = Version::V10; break; } - case static_cast(Version::V11): { + case std::to_underlying(Version::V11): { version = Version::V11; break; } - case static_cast(Version::V2): { + case std::to_underlying(Version::V2): { version = Version::V2; break; } - case static_cast(Version::V3): { + case std::to_underlying(Version::V3): { version = Version::V3; break; } @@ -420,7 +418,7 @@ struct HttpVersion final { } void store(TLBuffer &tlb) const noexcept { - tlb.store_trivial(static_cast>(version)); + tlb.store_trivial(std::to_underlying(version)); } }; diff --git a/runtime-light/utils/panic.cpp b/runtime-light/utils/panic.cpp index 8342c1d6b3..0486e48f80 100644 --- a/runtime-light/utils/panic.cpp +++ b/runtime-light/utils/panic.cpp @@ -3,7 +3,7 @@ // Distributed under the GPL v3 License, see LICENSE.notice.txt #include -#include +#include #include "runtime-common/core/utils/kphp-assert-core.h" #include "runtime-light/k2-platform/k2-api.h" @@ -12,7 +12,7 @@ void critical_error_handler() { constexpr std::string_view message = "script panic"; - k2::log(static_cast>(LogLevel::Debug), message.size(), message.data()); + k2::log(std::to_underlying(LogLevel::Debug), message.size(), message.data()); if (k2::instance_state() != nullptr) { InstanceState::get().poll_status = k2::PollStatus::PollFinishedError; diff --git a/runtime-light/utils/php_assert.cpp b/runtime-light/utils/php_assert.cpp index fd03200d02..033707f5c5 100644 --- a/runtime-light/utils/php_assert.cpp +++ b/runtime-light/utils/php_assert.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include "runtime-common/core/utils/kphp-assert-core.h" #include "runtime-light/k2-platform/k2-api.h" @@ -24,7 +25,7 @@ static void php_warning_impl(bool out_of_memory, int error_type, char const *mes int size = vsnprintf(buf, BUF_SIZE, message, args); k2::log(error_type, size, buf); - if (error_type == static_cast>(LogLevel::Error)) { + if (error_type == std::to_underlying(LogLevel::Error)) { critical_error_handler(); } } @@ -32,28 +33,28 @@ static void php_warning_impl(bool out_of_memory, int error_type, char const *mes void php_debug(char const *message, ...) { va_list args; va_start(args, message); - php_warning_impl(false, static_cast>(LogLevel::Debug), message, args); + php_warning_impl(false, std::to_underlying(LogLevel::Debug), message, args); va_end(args); } void php_notice(char const *message, ...) { va_list args; va_start(args, message); - php_warning_impl(false, static_cast>(LogLevel::Info), message, args); + php_warning_impl(false, std::to_underlying(LogLevel::Info), message, args); va_end(args); } void php_warning(char const *message, ...) { va_list args; va_start(args, message); - php_warning_impl(false, static_cast>(LogLevel::Warn), message, args); + php_warning_impl(false, std::to_underlying(LogLevel::Warn), message, args); va_end(args); } void php_error(char const *message, ...) { va_list args; va_start(args, message); - php_warning_impl(false, static_cast>(LogLevel::Error), message, args); + php_warning_impl(false, std::to_underlying(LogLevel::Error), message, args); va_end(args); }