From 61b4e99649d66dd69d9127f2dcaab2c161736797 Mon Sep 17 00:00:00 2001
From: Petr Shumilov
Date: Mon, 21 Apr 2025 20:17:30 +0300
Subject: [PATCH 1/2] Introduce LTO for whole project
Signed-off-by: Petr Shumilov
---
cmake/init-compilation-flags.cmake | 14 ++++++++++++++
.../core/core-types/definition/array.inl | 10 ++++++----
third-party/curl-cmake/curl.cmake | 2 +-
third-party/nghttp2-cmake/nghttp2.cmake | 2 +-
third-party/numactl-cmake/numactl.cmake | 2 +-
third-party/openssl-cmake/openssl.cmake | 2 +-
third-party/pcre-cmake/pcre.cmake | 2 +-
third-party/pcre2-cmake/pcre2.cmake | 2 +-
third-party/re2-cmake/re2.cmake | 2 +-
third-party/timelib-cmake/timelib.cmake | 2 +-
third-party/uber-h3-cmake/uber-h3.cmake | 2 +-
third-party/yaml-cpp-cmake/yaml-cpp.cmake | 2 +-
third-party/zlib-cmake/zlib.cmake | 2 +-
third-party/zstd-cmake/zstd.cmake | 2 +-
vkext/vkext-rpc.cpp | 5 ++++-
15 files changed, 36 insertions(+), 17 deletions(-)
diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake
index 09ae3e17cd..62674df796 100644
--- a/cmake/init-compilation-flags.cmake
+++ b/cmake/init-compilation-flags.cmake
@@ -65,6 +65,20 @@ endif()
cmake_print_variables(CMAKE_BUILD_TYPE)
if("${CMAKE_BUILD_TYPE}" STREQUAL ${DEFAULT_BUILD_TYPE})
add_compile_options(-O3)
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION 1)
+ if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
+ set(COMPILE_LTO_OPTIONS -flto)
+ set(LINK_LTO_OPTIONS -flto)
+ if(NOT APPLE)
+ list(APPEND COMPILE_LTO_OPTIONS -ffat-lto-objects)
+ endif()
+ if(COMPILER_GCC)
+ list(APPEND COMPILE_LTO_OPTIONS -fuse-linker-plugin -Wl,-flto)
+ endif()
+ add_compile_options(${COMPILE_LTO_OPTIONS})
+ add_link_options(${LINK_LTO_OPTIONS})
+ list(JOIN COMPILE_LTO_OPTIONS " " THIRD_PARTY_LTO_OPTIONS)
+ endif()
endif()
if(DEFINED ENV{FAST_COMPILATION_FMT})
diff --git a/runtime-common/core/core-types/definition/array.inl b/runtime-common/core/core-types/definition/array.inl
index ce1270adae..c975c95e70 100644
--- a/runtime-common/core/core-types/definition/array.inl
+++ b/runtime-common/core/core-types/definition/array.inl
@@ -103,19 +103,21 @@ bool array::is_int_key(const typename array::key_type& key) {
return key.is_int();
}
+static uint8_t empty_array_raw_mem[2 * sizeof(array_inner_control)];
+
template<>
inline typename array::array_inner* array::array_inner::empty_array() {
// need this hack because gcc10 and newer complains about
- // "array subscript is outside array bounds of array::array_inner"
- static array_inner_control empty_array[1]{{
+ // "array subscript is outside array bounds of array::array_inner
+ new (&empty_array_raw_mem) array_inner_control{
true,
ExtraRefCnt::for_global_const,
-1,
{0, 0},
0,
2,
- }};
- return static_cast::array_inner*>(&empty_array[0]);
+ };
+ return reinterpret_cast::array_inner*>(&empty_array_raw_mem);
}
template
diff --git a/third-party/curl-cmake/curl.cmake b/third-party/curl-cmake/curl.cmake
index 0b0178a043..19d7d63413 100644
--- a/third-party/curl-cmake/curl.cmake
+++ b/third-party/curl-cmake/curl.cmake
@@ -25,7 +25,7 @@ function(build_curl PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})
- set(compile_flags "$ENV{CFLAGS} -g0 -Wno-deprecated-declarations ${extra_compile_flags}")
+ set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 -Wno-deprecated-declarations ${extra_compile_flags}")
# Suppress compiler-specific warnings caused by -O3
if(COMPILER_CLANG)
diff --git a/third-party/nghttp2-cmake/nghttp2.cmake b/third-party/nghttp2-cmake/nghttp2.cmake
index 87458c35a5..835d4809c8 100644
--- a/third-party/nghttp2-cmake/nghttp2.cmake
+++ b/third-party/nghttp2-cmake/nghttp2.cmake
@@ -30,7 +30,7 @@ function(build_nghttp2 PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})
- set(compile_flags "$ENV{CFLAGS} -g0 ${extra_compile_flags}")
+ set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 ${extra_compile_flags}")
message(STATUS "NGHTTP2 Summary:
diff --git a/third-party/numactl-cmake/numactl.cmake b/third-party/numactl-cmake/numactl.cmake
index 4682907dc7..ed5f32a051 100644
--- a/third-party/numactl-cmake/numactl.cmake
+++ b/third-party/numactl-cmake/numactl.cmake
@@ -27,7 +27,7 @@ function(build_numactl PIC_ENABLED)
# The configuration has been based on:
# https://sources.debian.org/src/numactl/2.0.12-1/debian/rules/
- set(compile_flags "$ENV{CFLAGS} -Wno-unused-but-set-variable -g0 ${extra_compile_flags}")
+ set(compile_flags "$ENV{CFLAGS} -Wno-unused-but-set-variable -g0 -fno-lto ${extra_compile_flags}")
message(STATUS "NUMA Summary:
diff --git a/third-party/openssl-cmake/openssl.cmake b/third-party/openssl-cmake/openssl.cmake
index 0fec65a816..3b356a1e59 100644
--- a/third-party/openssl-cmake/openssl.cmake
+++ b/third-party/openssl-cmake/openssl.cmake
@@ -35,7 +35,7 @@ function(build_openssl PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})
- set(compile_flags "$ENV{CFLAGS} -g0 ${extra_compile_flags}")
+ set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 ${extra_compile_flags}")
# The configuration has been based on:
# https://packages.debian.org/buster/libssl1.1
diff --git a/third-party/pcre-cmake/pcre.cmake b/third-party/pcre-cmake/pcre.cmake
index 38325357dd..0b345038e9 100644
--- a/third-party/pcre-cmake/pcre.cmake
+++ b/third-party/pcre-cmake/pcre.cmake
@@ -30,7 +30,7 @@ function(build_pcre PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})
- set(compile_flags "$ENV{CFLAGS} -g0 -Wall ${extra_compile_flags}")
+ set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 -Wall ${extra_compile_flags}")
message(STATUS "PCRE Summary:
diff --git a/third-party/pcre2-cmake/pcre2.cmake b/third-party/pcre2-cmake/pcre2.cmake
index d72510dc98..4cd9c5b364 100644
--- a/third-party/pcre2-cmake/pcre2.cmake
+++ b/third-party/pcre2-cmake/pcre2.cmake
@@ -28,7 +28,7 @@ function(build_pcre2 PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})
- set(compile_flags "$ENV{CFLAGS} -O3 ${extra_compile_flags}")
+ set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -O3 ${extra_compile_flags}")
message(STATUS "PCRE2 Summary:
diff --git a/third-party/re2-cmake/re2.cmake b/third-party/re2-cmake/re2.cmake
index 446c77fe25..3341f31a06 100644
--- a/third-party/re2-cmake/re2.cmake
+++ b/third-party/re2-cmake/re2.cmake
@@ -37,7 +37,7 @@ function(build_re2 PIC_ENABLED)
# The configuration has been based on:
# https://sources.debian.org/src/re2/20190101%2Bdfsg-2/debian/rules/#L5
- set(compile_flags "$ENV{CFLAGS} -g0 -Wall -std=c++11 -O3 ${extra_compile_flags}")
+ set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 -Wall -std=c++11 -O3 ${extra_compile_flags}")
message(STATUS "RE2 Summary:
diff --git a/third-party/timelib-cmake/timelib.cmake b/third-party/timelib-cmake/timelib.cmake
index a99225c9bd..3c1c07ac78 100644
--- a/third-party/timelib-cmake/timelib.cmake
+++ b/third-party/timelib-cmake/timelib.cmake
@@ -36,7 +36,7 @@ function(build_timelib PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})
- set(compile_flags "$ENV{CFLAGS} -g0 ${extra_compile_flags}")
+ set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 ${extra_compile_flags}")
message(STATUS "Timelib Summary:
diff --git a/third-party/uber-h3-cmake/uber-h3.cmake b/third-party/uber-h3-cmake/uber-h3.cmake
index f692505ce4..0fad35c907 100644
--- a/third-party/uber-h3-cmake/uber-h3.cmake
+++ b/third-party/uber-h3-cmake/uber-h3.cmake
@@ -26,7 +26,7 @@ function(build_uber_h3 PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})
- set(compile_flags "$ENV{CFLAGS} -g0 ${extra_compile_flags}")
+ set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 ${extra_compile_flags}")
message(STATUS "Uber-h3 Summary:
diff --git a/third-party/yaml-cpp-cmake/yaml-cpp.cmake b/third-party/yaml-cpp-cmake/yaml-cpp.cmake
index 9d8e57766d..52da416708 100644
--- a/third-party/yaml-cpp-cmake/yaml-cpp.cmake
+++ b/third-party/yaml-cpp-cmake/yaml-cpp.cmake
@@ -25,7 +25,7 @@ function(build_yaml_cpp PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})
- set(compile_flags "$ENV{CFLAGS} -g0 ${extra_compile_flags}")
+ set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 ${extra_compile_flags}")
# Suppress compiler-specific warnings
if(COMPILER_CLANG)
diff --git a/third-party/zlib-cmake/zlib.cmake b/third-party/zlib-cmake/zlib.cmake
index 13cf3c356d..7bbb8e7b95 100644
--- a/third-party/zlib-cmake/zlib.cmake
+++ b/third-party/zlib-cmake/zlib.cmake
@@ -27,7 +27,7 @@ function(build_zlib PIC_ENABLED)
# The configuration has been based on:
# https://sources.debian.org/src/zlib/1%3A1.3.dfsg%2Breally1.3.1-1/debian/rules/#L20
- set(compile_flags "$ENV{CFLAGS} -g0 -Wall -O3 -D_REENTRANT ${extra_compile_flags}")
+ set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 -Wall -O3 -D_REENTRANT ${extra_compile_flags}")
message(STATUS "Zlib Summary:
diff --git a/third-party/zstd-cmake/zstd.cmake b/third-party/zstd-cmake/zstd.cmake
index 2448568b3e..053dc89958 100644
--- a/third-party/zstd-cmake/zstd.cmake
+++ b/third-party/zstd-cmake/zstd.cmake
@@ -30,7 +30,7 @@ function(build_zstd PIC_ENABLED)
# The configuration has been based on:
# https://sources.debian.org/src/libzstd/1.4.8%2Bdfsg-2.1/debian/rules/
- set(compile_flags "$ENV{CFLAGS} -g0 -Wno-unused-but-set-variable ${extra_compile_flags}")
+ set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 -Wno-unused-but-set-variable ${extra_compile_flags}")
message(STATUS "ZSTD Summary:
diff --git a/vkext/vkext-rpc.cpp b/vkext/vkext-rpc.cpp
index 6f5512327c..d0bce55733 100644
--- a/vkext/vkext-rpc.cpp
+++ b/vkext/vkext-rpc.cpp
@@ -154,8 +154,11 @@ void update_precise_now() {
}
}
+static rpc_connection dummy_rpc_connection{};
+
rpc_connection *rpc_connection_get(int fd) {
- rpc_connection **T = tree_lookup_value_connection(rpc_connection_tree, reinterpret_cast(&fd));
+ dummy_rpc_connection.fd = fd;
+ rpc_connection **T = tree_lookup_value_connection(rpc_connection_tree, reinterpret_cast(&dummy_rpc_connection));
return T ? *T : 0;
}
From 7f6a164c5ff058d822b27d63cbd6ee113dc1f05d Mon Sep 17 00:00:00 2001
From: Petr Shumilov
Date: Thu, 24 Apr 2025 16:55:57 +0300
Subject: [PATCH 2/2] Prepare for experiments with gcc-12
Signed-off-by: Petr Shumilov
---
cmake/init-compilation-flags.cmake | 4 +--
cmake/utils.cmake | 8 ++++-
compiler/compiler-settings.cpp | 2 +-
compiler/compiler.cmake | 33 +++++++++++++++++--
compiler/ffi/c_parser/parsing_driver.cpp | 3 +-
.../core/core-types/definition/array.inl | 30 ++++++++++-------
runtime/runtime.cmake | 2 +-
server/server.cmake | 14 ++++----
tests/cpp/server/server-tests.cmake | 2 +-
vkext/vkext-rpc.cpp | 3 +-
10 files changed, 71 insertions(+), 30 deletions(-)
diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake
index 62674df796..a2aee3f278 100644
--- a/cmake/init-compilation-flags.cmake
+++ b/cmake/init-compilation-flags.cmake
@@ -36,7 +36,7 @@ if(APPLE)
add_definitions(-D_XOPEN_SOURCE)
else()
# Since Ubuntu 22.04 lto is enabled by default; breaks some builds
- add_link_options(-fno-lto)
+ #add_link_options(-fno-lto)
endif()
@@ -73,7 +73,7 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL ${DEFAULT_BUILD_TYPE})
list(APPEND COMPILE_LTO_OPTIONS -ffat-lto-objects)
endif()
if(COMPILER_GCC)
- list(APPEND COMPILE_LTO_OPTIONS -fuse-linker-plugin -Wl,-flto)
+ list(APPEND COMPILE_LTO_OPTIONS -Wl,-flto)
endif()
add_compile_options(${COMPILE_LTO_OPTIONS})
add_link_options(${LINK_LTO_OPTIONS})
diff --git a/cmake/utils.cmake b/cmake/utils.cmake
index 2747a77f98..be6b879487 100644
--- a/cmake/utils.cmake
+++ b/cmake/utils.cmake
@@ -69,7 +69,13 @@ endfunction()
function(allow_deprecated_declarations)
foreach(src_file ${ARGN})
- set_source_files_properties(${src_file} PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations)
+ set_property(SOURCE ${src_file} APPEND PROPERTY COMPILE_OPTIONS -Wno-deprecated-declarations)
+ endforeach()
+endfunction()
+
+function(allow_stringop_overflow)
+ foreach(src_file ${ARGN})
+ set_property(SOURCE ${src_file} APPEND PROPERTY COMPILE_OPTIONS -Wno-stringop-overflow)
endforeach()
endfunction()
diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp
index 491e23f4aa..1575da4004 100644
--- a/compiler/compiler-settings.cpp
+++ b/compiler/compiler-settings.cpp
@@ -340,7 +340,7 @@ void CompilerSettings::init() {
std::string cxx_default_flags = ss.str();
cxx_toolchain_option.value_ = !cxx_toolchain_dir.value_.empty() ? ("-B" + cxx_toolchain_dir.value_) : "";
- incremental_linker_flags.value_ = dynamic_incremental_linkage.get() ? "-shared" : "-r -nostdlib";
+ incremental_linker_flags.value_ = dynamic_incremental_linkage.get() ? "-shared" : "-r -nostdlib -gdwarf64 -gdwarf-5 -mcmodel=large -flto -Wl,-flto -flinker-output=rel";
remove_extra_spaces(extra_ld_flags.value_);
diff --git a/compiler/compiler.cmake b/compiler/compiler.cmake
index 3fcdcab68e..4d697b978a 100644
--- a/compiler/compiler.cmake
+++ b/compiler/compiler.cmake
@@ -225,9 +225,36 @@ prepend(KPHP_COMPILER_SOURCES ${KPHP_COMPILER_DIR}/
utils/string-utils.cpp)
# Suppress YAML-cpp-related warnings
-if(COMPILER_CLANG)
- allow_deprecated_declarations(${KPHP_COMPILER_DIR}/data/composer-json-data.cpp)
- allow_deprecated_declarations(${KPHP_COMPILER_DIR}/data/modulite-data.cpp)
+if(COMPILER_CLANG OR (COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")))
+ allow_deprecated_declarations(
+ ${KPHP_COMPILER_DIR}/data/composer-json-data.cpp
+ ${KPHP_COMPILER_DIR}/data/modulite-data.cpp
+ )
+endif()
+
+if(COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0"))
+ allow_stringop_overflow(
+ ${KPHP_COMPILER_DIR}/code-gen/vertex-compiler.cpp
+ ${KPHP_COMPILER_DIR}/data/class-data.cpp
+ ${KPHP_COMPILER_DIR}/data/kphp-json-tags.cpp
+ ${KPHP_COMPILER_DIR}/data/generics-mixins.cpp
+ ${KPHP_COMPILER_DIR}/data/kphp-tracing-tags.cpp
+ ${KPHP_COMPILER_DIR}/data/modulite-data.cpp
+ ${KPHP_COMPILER_DIR}/code-gen/files/tracing-autogen.cpp
+ ${KPHP_COMPILER_DIR}/pipes/analyze-performance.cpp
+ ${KPHP_COMPILER_DIR}/pipes/check-access-modifiers.cpp
+ ${KPHP_COMPILER_DIR}/pipes/check-classes.cpp
+ ${KPHP_COMPILER_DIR}/pipes/check-tl-classes.cpp
+ ${KPHP_COMPILER_DIR}/pipes/code-gen.cpp
+ ${KPHP_COMPILER_DIR}/pipes/filter-only-actually-used.cpp
+ ${KPHP_COMPILER_DIR}/pipes/final-check.cpp
+ ${KPHP_COMPILER_DIR}/pipes/parse-and-apply-phpdoc.cpp
+ ${KPHP_COMPILER_DIR}/pipes/sort-and-inherit-classes.cpp
+ ${KPHP_COMPILER_DIR}/pipes/register-kphp-configuration.cpp
+ ${KPHP_COMPILER_DIR}/phpdoc.cpp
+ ${KPHP_COMPILER_DIR}/gentree.cpp
+ ${KPHP_COMPILER_DIR}/make/make.cpp
+ )
endif()
if(APPLE)
diff --git a/compiler/ffi/c_parser/parsing_driver.cpp b/compiler/ffi/c_parser/parsing_driver.cpp
index e0989a6aca..709a3feba1 100644
--- a/compiler/ffi/c_parser/parsing_driver.cpp
+++ b/compiler/ffi/c_parser/parsing_driver.cpp
@@ -11,6 +11,7 @@
#include
#include
+#include
using namespace ffi;
@@ -113,7 +114,7 @@ FFIType *ParsingDriver::function_to_var(FFIType *function) {
function->kind = FFITypeKind::Var;
FFIType *function_ptr_type = alloc.new_type(FFITypeKind::FunctionPointer);
function_ptr_type->members = std::move(function->members);
- function->members = {function_ptr_type};
+ function->members = std::vector{function_ptr_type};
return function;
}
diff --git a/runtime-common/core/core-types/definition/array.inl b/runtime-common/core/core-types/definition/array.inl
index c975c95e70..b6f3d8ef7a 100644
--- a/runtime-common/core/core-types/definition/array.inl
+++ b/runtime-common/core/core-types/definition/array.inl
@@ -103,21 +103,27 @@ bool array::is_int_key(const typename array::key_type& key) {
return key.is_int();
}
-static uint8_t empty_array_raw_mem[2 * sizeof(array_inner_control)];
-
template<>
inline typename array::array_inner* array::array_inner::empty_array() {
// need this hack because gcc10 and newer complains about
- // "array subscript is outside array bounds of array::array_inner
- new (&empty_array_raw_mem) array_inner_control{
- true,
- ExtraRefCnt::for_global_const,
- -1,
- {0, 0},
- 0,
- 2,
- };
- return reinterpret_cast::array_inner*>(&empty_array_raw_mem);
+ // "array subscript is outside array bounds of array::array_inner"
+ static array_inner_control empty_array[2]{{
+ true,
+ ExtraRefCnt::for_global_const,
+ -1,
+ {0, 0},
+ 0,
+ 2,
+ },
+ {
+ true,
+ ExtraRefCnt::for_global_const,
+ -1,
+ {0, 0},
+ 0,
+ 2,
+ }};
+ return static_cast::array_inner*>(&empty_array[0]);
}
template
diff --git a/runtime/runtime.cmake b/runtime/runtime.cmake
index 80d5a0b1e0..9aa98ff158 100644
--- a/runtime/runtime.cmake
+++ b/runtime/runtime.cmake
@@ -142,7 +142,7 @@ set_source_files_properties(
)
# Suppress YAML-cpp-related warnings
-if(COMPILER_CLANG)
+if(COMPILER_CLANG OR (COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")))
allow_deprecated_declarations(${BASE_DIR}/runtime/interface.cpp)
endif()
diff --git a/server/server.cmake b/server/server.cmake
index 59ac5f311c..fd1b5dbf9f 100644
--- a/server/server.cmake
+++ b/server/server.cmake
@@ -31,12 +31,14 @@ prepend(KPHP_SERVER_SOURCES ${BASE_DIR}/server/
signal-handlers.cpp)
# Suppress YAML-cpp-related warnings
-if(COMPILER_CLANG)
- allow_deprecated_declarations(${BASE_DIR}/server/json-logger.cpp)
- allow_deprecated_declarations(${BASE_DIR}/server/lease-config-parser.cpp)
- allow_deprecated_declarations(${BASE_DIR}/server/php-engine.cpp)
- allow_deprecated_declarations(${BASE_DIR}/server/php-master.cpp)
- allow_deprecated_declarations(${BASE_DIR}/server/server-config.cpp)
+if(COMPILER_CLANG OR (COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")))
+ allow_deprecated_declarations(
+ ${BASE_DIR}/server/json-logger.cpp
+ ${BASE_DIR}/server/lease-config-parser.cpp
+ ${BASE_DIR}/server/php-engine.cpp
+ ${BASE_DIR}/server/php-master.cpp
+ ${BASE_DIR}/server/server-config.cpp
+ )
endif()
prepend(KPHP_JOB_WORKERS_SOURCES ${BASE_DIR}/server/job-workers/
diff --git a/tests/cpp/server/server-tests.cmake b/tests/cpp/server/server-tests.cmake
index 98827729e2..ebfd72f529 100644
--- a/tests/cpp/server/server-tests.cmake
+++ b/tests/cpp/server/server-tests.cmake
@@ -7,7 +7,7 @@ prepend(SERVER_TESTS_SOURCES ${BASE_DIR}/tests/cpp/server/
workers-control-test.cpp)
# Suppress YAML-cpp-related warnings
-if(COMPILER_CLANG)
+if(COMPILER_CLANG OR (COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")))
allow_deprecated_declarations(${BASE_DIR}/tests/cpp/server/server-config-test.cpp)
endif()
diff --git a/vkext/vkext-rpc.cpp b/vkext/vkext-rpc.cpp
index d0bce55733..1096c52d15 100644
--- a/vkext/vkext-rpc.cpp
+++ b/vkext/vkext-rpc.cpp
@@ -154,9 +154,8 @@ void update_precise_now() {
}
}
-static rpc_connection dummy_rpc_connection{};
-
rpc_connection *rpc_connection_get(int fd) {
+ static rpc_connection dummy_rpc_connection{};
dummy_rpc_connection.fd = fd;
rpc_connection **T = tree_lookup_value_connection(rpc_connection_tree, reinterpret_cast(&dummy_rpc_connection));
return T ? *T : 0;