[libcxxabi] r296936 - Turn on -Wunused-function and cleanup occurances

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 3 17:02:35 PST 2017


Author: ericwf
Date: Fri Mar  3 19:02:35 2017
New Revision: 296936

URL: http://llvm.org/viewvc/llvm-project?rev=296936&view=rev
Log:
Turn on -Wunused-function and cleanup occurances

Modified:
    libcxxabi/trunk/CMakeLists.txt
    libcxxabi/trunk/cmake/config-ix.cmake
    libcxxabi/trunk/src/cxa_guard.cpp

Modified: libcxxabi/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=296936&r1=296935&r2=296936&view=diff
==============================================================================
--- libcxxabi/trunk/CMakeLists.txt (original)
+++ libcxxabi/trunk/CMakeLists.txt Fri Mar  3 19:02:35 2017
@@ -322,7 +322,7 @@ append_if(LIBCXXABI_COMPILE_FLAGS LIBCXX
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WMISMATCHED_TAGS_FLAG -Wmismatched-tags)
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WMISSING_BRACES_FLAG -Wmissing-braces)
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WNEWLINE_EOF_FLAG -Wnewline-eof)
-append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WNO_UNUSED_FUNCTION_FLAG -Wno-unused-function)
+append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WUNUSED_FUNCTION_FLAG -Wunused-function)
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WSHADOW_FLAG -Wshadow)
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WSHORTEN_64_TO_32_FLAG -Wshorten-64-to-32)
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WSIGN_COMPARE_FLAG -Wsign-compare)

Modified: libcxxabi/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/config-ix.cmake?rev=296936&r1=296935&r2=296936&view=diff
==============================================================================
--- libcxxabi/trunk/cmake/config-ix.cmake (original)
+++ libcxxabi/trunk/cmake/config-ix.cmake Fri Mar  3 19:02:35 2017
@@ -12,7 +12,7 @@ check_cxx_compiler_flag(-nodefaultlibs
 check_cxx_compiler_flag(-nostdinc++           LIBCXXABI_HAS_NOSTDINCXX_FLAG)
 check_cxx_compiler_flag(-Wall                 LIBCXXABI_HAS_WALL_FLAG)
 check_cxx_compiler_flag(-W                    LIBCXXABI_HAS_W_FLAG)
-check_cxx_compiler_flag(-Wno-unused-function  LIBCXXABI_HAS_WNO_UNUSED_FUNCTION_FLAG)
+check_cxx_compiler_flag(-Wunused-function     LIBCXXABI_HAS_WUNUSED_FUNCTION_FLAG)
 check_cxx_compiler_flag(-Wunused-variable     LIBCXXABI_HAS_WUNUSED_VARIABLE_FLAG)
 check_cxx_compiler_flag(-Wunused-parameter    LIBCXXABI_HAS_WUNUSED_PARAMETER_FLAG)
 check_cxx_compiler_flag(-Wstrict-aliasing     LIBCXXABI_HAS_WSTRICT_ALIASING_FLAG)

Modified: libcxxabi/trunk/src/cxa_guard.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_guard.cpp?rev=296936&r1=296935&r2=296936&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_guard.cpp (original)
+++ libcxxabi/trunk/src/cxa_guard.cpp Fri Mar  3 19:02:35 2017
@@ -113,9 +113,10 @@ set_lock(uint64_t& x, lock_type y)
 
 typedef bool lock_type;
 
-inline
-lock_type
-get_lock(uint64_t x)
+#if !defined(__arm__)
+static_assert(std::is_same<guard_type, uint64_t>::value, "");
+
+inline lock_type get_lock(uint64_t x)
 {
     union
     {
@@ -125,9 +126,7 @@ get_lock(uint64_t x)
     return f.lock[1] != 0;
 }
 
-inline
-void
-set_lock(uint64_t& x, lock_type y)
+inline void set_lock(uint64_t& x, lock_type y)
 {
     union
     {
@@ -137,10 +136,10 @@ set_lock(uint64_t& x, lock_type y)
     f.lock[1] = y;
     x = f.guard;
 }
+#else // defined(__arm__)
+static_assert(std::is_same<guard_type, uint32_t>::value, "");
 
-inline
-lock_type
-get_lock(uint32_t x)
+inline lock_type get_lock(uint32_t x)
 {
     union
     {
@@ -150,9 +149,7 @@ get_lock(uint32_t x)
     return f.lock[1] != 0;
 }
 
-inline
-void
-set_lock(uint32_t& x, lock_type y)
+inline void set_lock(uint32_t& x, lock_type y)
 {
     union
     {
@@ -163,7 +160,9 @@ set_lock(uint32_t& x, lock_type y)
     x = f.guard;
 }
 
-#endif  // __APPLE__
+#endif // !defined(__arm__)
+
+#endif  // __APPLE__ && !__arm__
 
 }  // unnamed namespace
 




More information about the cfe-commits mailing list