Revision: 56758
http://sourceforge.net/p/brlcad/code/56758
Author: brlcad
Date: 2013-08-12 20:08:08 +0000 (Mon, 12 Aug 2013)
Log Message:
-----------
enable stack protection for non-optimized debug-enabled builds. for gcc 4.1+
this is -fstack-protector-all, for clang it's -qstackprotect. wouldn't think
we need both, but would need to check the c/cxx flags independently otherwise
in case the caller is compiling c with clang and cxx with g++ (for example).
easier to just check them both to handle such situations.
Modified Paths:
--------------
brlcad/trunk/misc/CMake/BRLCAD_CompilerFlags.cmake
Modified: brlcad/trunk/misc/CMake/BRLCAD_CompilerFlags.cmake
===================================================================
--- brlcad/trunk/misc/CMake/BRLCAD_CompilerFlags.cmake 2013-08-12 20:01:48 UTC
(rev 56757)
+++ brlcad/trunk/misc/CMake/BRLCAD_CompilerFlags.cmake 2013-08-12 20:08:08 UTC
(rev 56758)
@@ -78,7 +78,21 @@
ADD_NEW_FLAG(CXX OPTIMIZE_CXX_FLAGS "${opt_conf_list}")
endif(opt_conf_list)
-# verbose warning flags
+# enable stack protection for unoptimized debug builds. this is
+# intended to help make it easier to identify problematic code but
+# only when compiling unoptimized (because the extra barrier checks
+# can affect the memory footprint and runtime performance.
+if(${BRLCAD_OPTIMIZED_BUILD} MATCHES "OFF" AND BRLCAD_FLAGS_DEBUG)
+ BRLCAD_CHECK_C_FLAG(fstack-protector-all)
+ BRLCAD_CHECK_CXX_FLAG(fstack-protector-all)
+ # checking both in case compiling c/c++ with different compilers
+ BRLCAD_CHECK_C_FLAG(qstackprotect)
+ BRLCAD_CHECK_CXX_FLAG(qstackprotect)
+endif(${BRLCAD_OPTIMIZED_BUILD} MATCHES "OFF" AND BRLCAD_FLAGS_DEBUG)
+
+# verbose warning flags. we intentionally try to turn on as many as
+# possible. adding more is encouraged (as long as all issues are
+# fixed first).
if(BRLCAD_ENABLE_COMPILER_WARNINGS OR BRLCAD_ENABLE_STRICT)
# also of interest:
# -Wunreachable-code -Wmissing-declarations -Wmissing-prototypes
-Wstrict-prototypes -ansi
@@ -86,7 +100,8 @@
BRLCAD_CHECK_C_FLAG(pedantic)
BRLCAD_CHECK_CXX_FLAG(pedantic)
- # The Wall warnings are too verbose with Visual C++
+ # FIXME: The Wall warnings are too verbose with Visual C++ (for
+ # now). we have a lot to clean up.
if(NOT MSVC)
BRLCAD_CHECK_C_FLAG(Wall)
BRLCAD_CHECK_CXX_FLAG(Wall)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits