AnDiXL commented on code in PR #3698:
URL: https://github.com/apache/brpc/pull/3698#discussion_r4438848361


##########
CMakeLists.txt:
##########
@@ -150,6 +150,15 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
     endif()
 endif()
 
+# Cacheline-aligned types such as ResourcePool<Socket> are created with plain
+# `new'. C++17 honors their alignment by default, C++14 only with
+# -faligned-new; without it glibc returns 16-byte aligned storage.
+include(CheckCXXCompilerFlag)
+check_cxx_compiler_flag(-faligned-new BRPC_HAS_ALIGNED_NEW)
+if(BRPC_HAS_ALIGNED_NEW)
+    list(APPEND BRPC_COMMON_COMPILE_OPTIONS 
$<$<COMPILE_LANGUAGE:CXX>:-faligned-new>)

Review Comment:
   Fixed. A C++14 build without working aligned new now stops with a 
`FATAL_ERROR` that names the required toolchain.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to