From 4aa60cc306479e1f871e03c923c0476f0ae31dab Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 11 Jan 2023 11:13:05 +1000 Subject: [PATCH] cxx: enabled sized-deallocation on clang --- nc_cxx.cmake | 4 ++++ nc_warnings.cmake | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nc_cxx.cmake b/nc_cxx.cmake index 1cf0b58..40b5667 100644 --- a/nc_cxx.cmake +++ b/nc_cxx.cmake @@ -89,6 +89,10 @@ append_compile_flag("-fvisibility=hidden") append_compile_flag("-fvisibility-inlines-hidden") append_compile_flag("-fPIC") +# Clang doesn't enabled sized deallocation (__cpp_sized_deallocation) by +# default, at least by clang-15, so we have to enable it explicitly. +append_compile_flag("-fsized-deallocation") + # We want a build-id so that we can attribute minidumps append_link_flag("-Wl,--build-id") diff --git a/nc_warnings.cmake b/nc_warnings.cmake index 53849ea..442e920 100644 --- a/nc_warnings.cmake +++ b/nc_warnings.cmake @@ -53,6 +53,9 @@ append_compile_flag(-Wswitch) # with language primitives like range-for. # append_compile_flag(-Wunsafe-loop-optimizations) +# gcc warnings with unknown version +append_compile_flag(-Wsized-deallocation) + # gcc-6.1.0 warnings append_compile_flag(-Wshift-negative-value) append_compile_flag(-Wnull-dereference) @@ -101,7 +104,6 @@ append_compile_flag(-Wbitwise-instead-of-logical) append_compile_flag(-Wunaligned-access) append_compile_flag(-Wunreachable-code-fallthrough) - # ------------------------------------------------------------------------- # Required extensions #AX_APPEND_COMPILE_FLAGS([-Wgnu-flexible-array-union-member], [], [-Werror])