[libcxxabi] r280286 - libc++abi: fix some -Wunused-function warnings

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 31 13:29:05 PDT 2016


Author: compnerd
Date: Wed Aug 31 15:29:05 2016
New Revision: 280286

URL: http://llvm.org/viewvc/llvm-project?rev=280286&view=rev
Log:
libc++abi: fix some -Wunused-function warnings

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.

Modified:
    libcxxabi/trunk/src/cxa_guard.cpp

Modified: libcxxabi/trunk/src/cxa_guard.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_guard.cpp?rev=280286&r1=280285&r2=280286&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_guard.cpp (original)
+++ libcxxabi/trunk/src/cxa_guard.cpp Wed Aug 31 15:29:05 2016
@@ -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;




More information about the cfe-commits mailing list