[libcxx] r343438 - Fix even more Clang warnings.

Eric Fiselier eric at efcs.ca
Sun Sep 30 18:59:37 PDT 2018


Author: ericwf
Date: Sun Sep 30 18:59:37 2018
New Revision: 343438

URL: http://llvm.org/viewvc/llvm-project?rev=343438&view=rev
Log:
Fix even more Clang warnings.

This patch disables shift-sign-overflow warnings for now. It also
fixes most -Wfloat-equal warnings and -Wextra-semi warnings.

Modified:
    libcxx/trunk/CMakeLists.txt
    libcxx/trunk/include/filesystem
    libcxx/trunk/include/memory
    libcxx/trunk/include/regex
    libcxx/trunk/include/utility
    libcxx/trunk/include/vector

Modified: libcxx/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=343438&r1=343437&r2=343438&view=diff
==============================================================================
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Sun Sep 30 18:59:37 2018
@@ -547,7 +547,7 @@ add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_
 add_compile_flags_if_supported(
     -Wall -Wextra -W -Wwrite-strings
     -Wno-unused-parameter -Wno-long-long
-    -Werror=return-type)
+    -Werror=return-type -Wextra-semi)
 if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
     add_compile_flags_if_supported(
         -Wno-user-defined-literals
@@ -566,6 +566,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "
         -Wno-sign-conversion
         -Wno-old-style-cast
         -Wno-deprecated # FIXME: Remove this and fix all occurrences.
+        -Wno-shift-sign-overflow # FIXME: Why do we need this with clang-cl but not clang?
       )
     endif()
 elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")

Modified: libcxx/trunk/include/filesystem
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/filesystem?rev=343438&r1=343437&r2=343438&view=diff
==============================================================================
--- libcxx/trunk/include/filesystem (original)
+++ libcxx/trunk/include/filesystem Sun Sep 30 18:59:37 2018
@@ -587,7 +587,7 @@ template <class _ECharT>
 typename enable_if<__can_convert_char<_ECharT>::value, bool>::type
 __is_separator(_ECharT __e) {
   return __e == _ECharT('/');
-};
+}
 
 struct _NullSentinal {};
 

Modified: libcxx/trunk/include/memory
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=343438&r1=343437&r2=343438&view=diff
==============================================================================
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Sun Sep 30 18:59:37 2018
@@ -2131,7 +2131,9 @@ struct __compressed_pair_elem {
   _LIBCPP_INLINE_VISIBILITY
   constexpr explicit
   __compressed_pair_elem(_Up&& __u)
-      : __value_(_VSTD::forward<_Up>(__u)){};
+      : __value_(_VSTD::forward<_Up>(__u))
+    {
+    }
 
   template <class... _Args, size_t... _Indexes>
   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
@@ -2168,7 +2170,8 @@ struct __compressed_pair_elem<_Tp, _Idx,
   _LIBCPP_INLINE_VISIBILITY
   constexpr explicit
   __compressed_pair_elem(_Up&& __u)
-      : __value_type(_VSTD::forward<_Up>(__u)){};
+      : __value_type(_VSTD::forward<_Up>(__u))
+  {}
 
   template <class... _Args, size_t... _Indexes>
   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14

Modified: libcxx/trunk/include/regex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=343438&r1=343437&r2=343438&view=diff
==============================================================================
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Sun Sep 30 18:59:37 2018
@@ -1352,9 +1352,9 @@ public:
     virtual ~__node() {}
 
     _LIBCPP_INLINE_VISIBILITY
-    virtual void __exec(__state&) const {};
+    virtual void __exec(__state&) const {}
     _LIBCPP_INLINE_VISIBILITY
-    virtual void __exec_split(bool, __state&) const {};
+    virtual void __exec_split(bool, __state&) const {}
 };
 
 // __end_state

Modified: libcxx/trunk/include/utility
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/utility?rev=343438&r1=343437&r2=343438&view=diff
==============================================================================
--- libcxx/trunk/include/utility (original)
+++ libcxx/trunk/include/utility Sun Sep 30 18:59:37 2018
@@ -1454,7 +1454,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<float>
     size_t operator()(float __v) const _NOEXCEPT
     {
         // -0.0 and 0.0 should return same hash
-       if (__v == 0)
+       if (__v == 0.0)
            return 0;
         return __scalar_hash<float>::operator()(__v);
     }
@@ -1468,7 +1468,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<double>
     size_t operator()(double __v) const _NOEXCEPT
     {
         // -0.0 and 0.0 should return same hash
-       if (__v == 0)
+       if (__v == 0.0)
            return 0;
         return __scalar_hash<double>::operator()(__v);
     }
@@ -1482,7 +1482,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<long do
     size_t operator()(long double __v) const _NOEXCEPT
     {
         // -0.0 and 0.0 should return same hash
-        if (__v == 0)
+        if (__v == 0.0)
             return 0;
 #if defined(__i386__)
         // Zero out padding bits

Modified: libcxx/trunk/include/vector
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=343438&r1=343437&r2=343438&view=diff
==============================================================================
--- libcxx/trunk/include/vector (original)
+++ libcxx/trunk/include/vector Sun Sep 30 18:59:37 2018
@@ -2455,7 +2455,7 @@ private:
     void __vdeallocate() _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
     static size_type __align_it(size_type __new_size) _NOEXCEPT
-        {return __new_size + (__bits_per_word-1) & ~((size_type)__bits_per_word-1);};
+        {return __new_size + (__bits_per_word-1) & ~((size_type)__bits_per_word-1);}
     _LIBCPP_INLINE_VISIBILITY  size_type __recommend(size_type __new_size) const;
     _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, bool __x);
     template <class _ForwardIterator>




More information about the libcxx-commits mailing list