Skip to content

Commit 2fcb5fb

Browse files
committed
Prepare for experiments with gcc-12
Signed-off-by: Petr Shumilov <[email protected]>
1 parent 351253b commit 2fcb5fb

File tree

6 files changed

+48
-13
lines changed

6 files changed

+48
-13
lines changed

cmake/utils.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@ endfunction()
6969

7070
function(allow_deprecated_declarations)
7171
foreach(src_file ${ARGN})
72-
set_source_files_properties(${src_file} PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations)
72+
set_property(SOURCE ${src_file} APPEND PROPERTY COMPILE_OPTIONS -Wno-deprecated-declarations)
73+
endforeach()
74+
endfunction()
75+
76+
function(allow_stringop_overflow)
77+
foreach(src_file ${ARGN})
78+
set_property(SOURCE ${src_file} APPEND PROPERTY COMPILE_OPTIONS -Wno-stringop-overflow)
7379
endforeach()
7480
endfunction()
7581

compiler/compiler-settings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ void CompilerSettings::init() {
340340
std::string cxx_default_flags = ss.str();
341341

342342
cxx_toolchain_option.value_ = !cxx_toolchain_dir.value_.empty() ? ("-B" + cxx_toolchain_dir.value_) : "";
343-
incremental_linker_flags.value_ = dynamic_incremental_linkage.get() ? "-shared" : "-r -nostdlib";
343+
incremental_linker_flags.value_ = dynamic_incremental_linkage.get() ? "-shared" : "-r -nostdlib -flto -Wl,-flto -flinker-output=rel";
344344

345345
remove_extra_spaces(extra_ld_flags.value_);
346346

compiler/compiler.cmake

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,36 @@ prepend(KPHP_COMPILER_SOURCES ${KPHP_COMPILER_DIR}/
225225
utils/string-utils.cpp)
226226

227227
# Suppress YAML-cpp-related warnings
228-
if(COMPILER_CLANG)
229-
allow_deprecated_declarations(${KPHP_COMPILER_DIR}/data/composer-json-data.cpp)
230-
allow_deprecated_declarations(${KPHP_COMPILER_DIR}/data/modulite-data.cpp)
228+
if(COMPILER_CLANG OR (COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")))
229+
allow_deprecated_declarations(
230+
${KPHP_COMPILER_DIR}/data/composer-json-data.cpp
231+
${KPHP_COMPILER_DIR}/data/modulite-data.cpp
232+
)
233+
endif()
234+
235+
if(COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0"))
236+
allow_stringop_overflow(
237+
${KPHP_COMPILER_DIR}/code-gen/vertex-compiler.cpp
238+
${KPHP_COMPILER_DIR}/data/class-data.cpp
239+
${KPHP_COMPILER_DIR}/data/kphp-json-tags.cpp
240+
${KPHP_COMPILER_DIR}/data/generics-mixins.cpp
241+
${KPHP_COMPILER_DIR}/data/kphp-tracing-tags.cpp
242+
${KPHP_COMPILER_DIR}/data/modulite-data.cpp
243+
${KPHP_COMPILER_DIR}/code-gen/files/tracing-autogen.cpp
244+
${KPHP_COMPILER_DIR}/pipes/analyze-performance.cpp
245+
${KPHP_COMPILER_DIR}/pipes/check-access-modifiers.cpp
246+
${KPHP_COMPILER_DIR}/pipes/check-classes.cpp
247+
${KPHP_COMPILER_DIR}/pipes/check-tl-classes.cpp
248+
${KPHP_COMPILER_DIR}/pipes/code-gen.cpp
249+
${KPHP_COMPILER_DIR}/pipes/filter-only-actually-used.cpp
250+
${KPHP_COMPILER_DIR}/pipes/final-check.cpp
251+
${KPHP_COMPILER_DIR}/pipes/parse-and-apply-phpdoc.cpp
252+
${KPHP_COMPILER_DIR}/pipes/sort-and-inherit-classes.cpp
253+
${KPHP_COMPILER_DIR}/pipes/register-kphp-configuration.cpp
254+
${KPHP_COMPILER_DIR}/phpdoc.cpp
255+
${KPHP_COMPILER_DIR}/gentree.cpp
256+
${KPHP_COMPILER_DIR}/make/make.cpp
257+
)
231258
endif()
232259

233260
if(APPLE)

runtime/runtime.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ set_source_files_properties(
142142
)
143143

144144
# Suppress YAML-cpp-related warnings
145-
if(COMPILER_CLANG)
145+
if(COMPILER_CLANG OR (COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")))
146146
allow_deprecated_declarations(${BASE_DIR}/runtime/interface.cpp)
147147
endif()
148148

server/server.cmake

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ prepend(KPHP_SERVER_SOURCES ${BASE_DIR}/server/
3131
signal-handlers.cpp)
3232

3333
# Suppress YAML-cpp-related warnings
34-
if(COMPILER_CLANG)
35-
allow_deprecated_declarations(${BASE_DIR}/server/json-logger.cpp)
36-
allow_deprecated_declarations(${BASE_DIR}/server/lease-config-parser.cpp)
37-
allow_deprecated_declarations(${BASE_DIR}/server/php-engine.cpp)
38-
allow_deprecated_declarations(${BASE_DIR}/server/php-master.cpp)
39-
allow_deprecated_declarations(${BASE_DIR}/server/server-config.cpp)
34+
if(COMPILER_CLANG OR (COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")))
35+
allow_deprecated_declarations(
36+
${BASE_DIR}/server/json-logger.cpp
37+
${BASE_DIR}/server/lease-config-parser.cpp
38+
${BASE_DIR}/server/php-engine.cpp
39+
${BASE_DIR}/server/php-master.cpp
40+
${BASE_DIR}/server/server-config.cpp
41+
)
4042
endif()
4143

4244
prepend(KPHP_JOB_WORKERS_SOURCES ${BASE_DIR}/server/job-workers/

tests/cpp/server/server-tests.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ prepend(SERVER_TESTS_SOURCES ${BASE_DIR}/tests/cpp/server/
77
workers-control-test.cpp)
88

99
# Suppress YAML-cpp-related warnings
10-
if(COMPILER_CLANG)
10+
if(COMPILER_CLANG OR (COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")))
1111
allow_deprecated_declarations(${BASE_DIR}/tests/cpp/server/server-config-test.cpp)
1212
endif()
1313

0 commit comments

Comments
 (0)