When compiling debug builds with GCC use _FORTIFY_SOURCE=2:

This gcc/glibc feature adds some (supposedly) lightweight checks which can
help detect errors such as buffer overflows.
This commit is contained in:
Nik Bougalis
2014-08-09 13:27:01 -07:00
parent 901ccad0cf
commit d7b054c3f6

View File

@@ -355,6 +355,14 @@ def config_env(toolchain, variant, env):
# Why is this only for gcc?!
env.Append(CCFLAGS=['-Wno-unused-local-typedefs'])
# If we are in debug mode, use GCC-specific functionality to add
# extra error checking into the code (e.g. std::vector will throw
# for out-of-bounds conditions)
if variant == 'debug':
env.Append(CPPDEFINES={
'_FORTIFY_SOURCE': 2
})
elif toolchain == 'msvc':
env.Append (CPPPATH=[
os.path.join('src', 'protobuf', 'src'),