In DEBUG mode, make toxcore crash on signed integer overflow.

Signed overflow is undefined behaviour, so in debug mode, we want to make
it fail in a noisy way.
This commit is contained in:
iphydf 2018-06-08 23:48:40 +00:00
parent 8a4a5c2aa2
commit cf9caa069a
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9

View File

@ -115,6 +115,8 @@ if(NOT MSVC)
# Allows wine to display source code file names and line numbers on crash in its backtrace # Allows wine to display source code file names and line numbers on crash in its backtrace
add_flag("-gdwarf-2") add_flag("-gdwarf-2")
endif() endif()
# Crash on signed integer overflow.
add_flag("-ftrapv")
endif() endif()
option(WARNINGS "Enable additional compiler warnings" ON) option(WARNINGS "Enable additional compiler warnings" ON)