suppress incorrect warning

This commit is contained in:
Davis King 2024-04-27 08:41:42 -04:00
parent 48e6331705
commit b9355f08c4

View File

@ -187,6 +187,17 @@ if (CMAKE_COMPILER_IS_GNUCXX)
add_compile_options(-Wno-free-nonheap-object) add_compile_options(-Wno-free-nonheap-object)
endif() endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14.0.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 14.0.1)
# These versions of gcc wrongly yield this warning:
# In member function allocate_array,
# inlined from set_max_size at /builddir/build/BUILD/dlib-19.24.4/dlib/../dlib/svm/../matrix/../array/array_kernel.h:438:59,
# inlined from push_back.constprop at /builddir/build/BUILD/dlib-19.24.4/dlib/../dlib/svm/../matrix/../array/array_kernel.h:769:30:
# /builddir/build/BUILD/dlib-19.24.4/dlib/../dlib/svm/../memory_manager_stateless/memory_manager_stateless_kernel_1.h:54:24: warning: argument 1 value 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
# 54 | return new T[size];
# when compiling dlib example programs that most definitely do not ask for such allocations.
add_compile_options(-Wno-alloc-size-larger-than)
endif()
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0") if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0")
# strip debug symbols to make the binary smaller # strip debug symbols to make the binary smaller
target_link_options(${target_name} PRIVATE $<$<CONFIG:RELEASE>:-s>) target_link_options(${target_name} PRIVATE $<$<CONFIG:RELEASE>:-s>)