Enable -Wunreachable-code
[folly.git] / folly / experimental / exception_tracer / ExceptionTracerLib.cpp
index 2ba97b7843f55818e960bfefad39db39611b9106..4a10d41c81df66af892cddf3e89cbcf1a4aa27f8 100644 (file)
@@ -34,7 +34,6 @@ void __cxa_throw(
     void (*destructor)(void*)) __attribute__((__noreturn__));
 void* __cxa_begin_catch(void* excObj) throw();
 void __cxa_rethrow(void) __attribute__((__noreturn__));
-void __cxa_rethrow(void);
 void __cxa_end_catch(void);
 }
 
@@ -88,6 +87,15 @@ DECLARE_CALLBACK(RethrowException);
 } // exception_tracer
 } // folly
 
+// Clang is smart enough to understand that the symbols we're loading
+// are [[noreturn]], but GCC is not. In order to be able to build with
+// -Wunreachable-code enable for Clang, these __builtin_unreachable()
+// calls need to go away. Everything else is messy though, so just
+// #define it to an empty macro under Clang and be done with it.
+#ifdef __clang__
+# define __builtin_unreachable()
+#endif
+
 namespace __cxxabiv1 {
 
 void __cxa_throw(void* thrownException,