Build with RTTI and exceptions disabled. Only in GCC for now.
authorOscar Fuentes <ofv@wanadoo.es>
Sun, 17 Oct 2010 02:26:16 +0000 (02:26 +0000)
committerOscar Fuentes <ofv@wanadoo.es>
Sun, 17 Oct 2010 02:26:16 +0000 (02:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116682 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/LLVMProcessSources.cmake
examples/ExceptionDemo/CMakeLists.txt
examples/Kaleidoscope/Chapter7/CMakeLists.txt
lib/Support/CMakeLists.txt
lib/System/CMakeLists.txt
lib/VMCore/CMakeLists.txt
utils/TableGen/CMakeLists.txt
utils/unittest/CMakeLists.txt

index b753735cd55e713fcdc1d4577372ea05b3d6bd49..a71c6f2af839f9571832234084230cdb1ab30a4a 100644 (file)
@@ -36,6 +36,19 @@ function(llvm_process_sources OUT_VAR)
     add_td_sources(sources)
     add_header_files(sources)
   endif()
+
+  # Set common compiler options:
+  if( NOT LLVM_REQUIRES_EH )
+    if( CMAKE_COMPILER_IS_GNUCXX )
+      add_definitions( -fno-exceptions )
+    endif()
+  endif()
+  if( NOT LLVM_REQUIRES_RTTI )
+    if( CMAKE_COMPILER_IS_GNUCXX )
+      add_definitions( -fno-rtti )
+    endif()
+  endif()
+
   set( ${OUT_VAR} ${sources} PARENT_SCOPE )
 endfunction(llvm_process_sources)
 
index d6619155684341eec5e3f9daa3d2342d9aa56e84..88c9ab7c181690c4d889a148b23753ff4dcebd60 100644 (file)
@@ -1,4 +1,5 @@
 set(LLVM_LINK_COMPONENTS jit nativecodegen)
+set(LLVM_REQUIRES_EH 1)
 
 add_llvm_example(ExceptionDemo
   ExceptionDemo.cpp
index 9b8227c693409144d99c20f68c7b9a5ac0353bc1..da3839843bd008f7ac521dec6889c69d0680b756 100644 (file)
@@ -1,4 +1,5 @@
 set(LLVM_LINK_COMPONENTS core jit interpreter native)
+set(LLVM_REQUIRES_RTTI 1)
 
 add_llvm_example(Kaleidoscope-Ch7
   toy.cpp
index f7e02c9bc0a145867f1cbd2db9066569f883073d..c9c862ce84a862aa68956f462b569c961bb63ade 100644 (file)
@@ -1,3 +1,6 @@
+## FIXME: This only requires RTTI because tblgen uses it.  Fix that.
+set(LLVM_REQUIRES_RTTI 1)
+
 add_llvm_library(LLVMSupport
   APFloat.cpp
   APInt.cpp
index 5c15f8e9eba63992db8bd449ec5640c46697d2bb..ac2830e80a0730beec96d3069be40fcbe0b4d8d7 100644 (file)
@@ -1,3 +1,8 @@
+set(LLVM_REQUIRES_RTTI 1)
+if( MINGW )
+  set(LLVM_REQUIRES_EH 1)
+endif()
+
 add_llvm_library(LLVMSystem
   Alarm.cpp
   Atomic.cpp
index 1388c93cce39c68bae385d8949b1529e52dc63cf..0ff260f060af4f2953c6a1e54db00137b32d15d1 100644 (file)
@@ -1,3 +1,5 @@
+set(LLVM_REQUIRES_RTTI 1)
+
 add_llvm_library(LLVMCore
   AsmWriter.cpp
   Attributes.cpp
index c748614479af0d7f8ab8312428237e1042a7ff9d..5bafcecc2072ca23c3cd9893e0761c5f6db747d0 100644 (file)
@@ -1,3 +1,6 @@
+set(LLVM_REQUIRES_EH 1)
+set(LLVM_REQUIRES_RTTI 1)
+
 add_executable(tblgen
   ARMDecoderEmitter.cpp
   AsmMatcherEmitter.cpp
index 4400b38234e4551c12cbabe8a47be668e049ca0f..9d678edfd12c6d5281e556002ab6bb8e36b83124 100644 (file)
@@ -24,6 +24,12 @@ if(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
 
+set(LLVM_REQUIRES_RTTI 1)
+add_definitions( -DGTEST_HAS_RTTI=0 )
+# libstdc++'s TR1 <tuple> header depends on RTTI and uses C++'0x features not
+# supported by Clang, so force googletest to use its own tuple implementation.
+add_definitions( -DGTEST_USE_OWN_TR1_TUPLE )
+
 add_llvm_library(gtest
   googletest/gtest.cc
   googletest/gtest-death-test.cc