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.

llvm-svn: 280286
This commit is contained in:
Saleem Abdulrasool 2016-08-31 20:29:05 +00:00
parent 1b258d313c
commit 7c4700525c

View File

@ -34,34 +34,38 @@ 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;
inline void set_initialized(guard_type* guard_object) {
*guard_object |= 1;
}
#else
typedef uint64_t guard_type;
void set_initialized(guard_type* guard_object) {
char* initialized = (char*)guard_object;
*initialized = 1;
}
#endif
#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;
}
inline void set_initialized(guard_type* guard_object) {
*guard_object |= 1;
}
#else
typedef uint64_t guard_type;
bool is_initialized(guard_type* guard_object) {
char* initialized = (char*)guard_object;
return *initialized;
}
void set_initialized(guard_type* guard_object) {
char* initialized = (char*)guard_object;
*initialized = 1;
}
#endif
#endif
#if !LIBCXXABI_HAS_NO_THREADS