Skip to content

Commit b9355f0

Browse files
committed
suppress incorrect warning
1 parent 48e6331 commit b9355f0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

dlib/test/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,17 @@ if (CMAKE_COMPILER_IS_GNUCXX)
187187
add_compile_options(-Wno-free-nonheap-object)
188188
endif()
189189

190+
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14.0.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 14.0.1)
191+
# These versions of gcc wrongly yield this warning:
192+
# In member function ‘allocate_array’,
193+
# inlined from ‘set_max_size’ at /builddir/build/BUILD/dlib-19.24.4/dlib/../dlib/svm/../matrix/../array/array_kernel.h:438:59,
194+
# inlined from ‘push_back.constprop’ at /builddir/build/BUILD/dlib-19.24.4/dlib/../dlib/svm/../matrix/../array/array_kernel.h:769:30:
195+
# /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=]
196+
# 54 | return new T[size];
197+
# when compiling dlib example programs that most definitely do not ask for such allocations.
198+
add_compile_options(-Wno-alloc-size-larger-than)
199+
endif()
200+
190201
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0")
191202
# strip debug symbols to make the binary smaller
192203
target_link_options(${target_name} PRIVATE $<$<CONFIG:RELEASE>:-s>)

0 commit comments

Comments
 (0)