libc++abi: fix some -Wunused-function warnings
authorSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 31 Aug 2016 20:29:05 +0000 (20:29 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 31 Aug 2016 20:29:05 +0000 (20:29 +0000)
is_initialized is only used in the no threads case or if on non ARM Apple
targets.  Use the preprocessor to remove the function otherwise.  NFC.

llvm-svn: 280286

libcxxabi/src/cxa_guard.cpp

index 72e868f..2a01f27 100644 (file)
@@ -34,35 +34,39 @@ namespace
 {
 
 #ifdef __arm__
-
 // A 32-bit, 4-byte-aligned static data value. The least significant 2 bits must
 // be statically initialized to 0.
 typedef uint32_t guard_type;
 
-// Test the lowest bit.
-inline bool is_initialized(guard_type* guard_object) {
-    return (*guard_object) & 1;
-}
-
 inline void set_initialized(guard_type* guard_object) {
     *guard_object |= 1;
 }
-
 #else
-
 typedef uint64_t guard_type;
 
-bool is_initialized(guard_type* guard_object) {
+void set_initialized(guard_type* guard_object) {
     char* initialized = (char*)guard_object;
-    return *initialized;
+    *initialized = 1;
 }
+#endif
 
-void set_initialized(guard_type* guard_object) {
+#if LIBCXXABI_HAS_NO_THREADS || (defined(__APPLE__) && !defined(__arm__))
+#ifdef __arm__
+
+// Test the lowest bit.
+inline bool is_initialized(guard_type* guard_object) {
+    return (*guard_object) & 1;
+}
+
+#else
+
+bool is_initialized(guard_type* guard_object) {
     char* initialized = (char*)guard_object;
-    *initialized = 1;
+    return *initialized;
 }
 
 #endif
+#endif
 
 #if !LIBCXXABI_HAS_NO_THREADS
 pthread_mutex_t guard_mut = PTHREAD_MUTEX_INITIALIZER;