mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-22 06:37:35 +08:00
cmake: add -fcheck-new to cxx_compile_flags
GCC assumes that operator new never returns null, but throws an exception instead. This is defined by the C++ standard, and thus ok. But we disable exceptions with -fno-exceptions, so we break this assumption. GCC then goes ahead and removes some of our nullptr checks. This flag removes the assumption. This adds ~1.4kB to the binary size of the px4fmu-v4 target.
This commit is contained in:
@@ -643,6 +643,7 @@ function(px4_add_common_flags)
|
||||
set(cxx_compile_flags
|
||||
-g
|
||||
-fno-exceptions
|
||||
-fcheck-new
|
||||
-fno-rtti
|
||||
-std=gnu++0x
|
||||
-fno-threadsafe-statics
|
||||
|
||||
Reference in New Issue
Block a user