From 0b485f3e911e946da4ecac73544116df2bd4dae1 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 1 Oct 2018 01:59:37 +0000 Subject: [PATCH] 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. llvm-svn: 343438 --- libcxx/CMakeLists.txt | 3 ++- libcxx/include/filesystem | 2 +- libcxx/include/memory | 7 +++++-- libcxx/include/regex | 4 ++-- libcxx/include/utility | 6 +++--- libcxx/include/vector | 2 +- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index 7295e01a98e3..3ea86bae4188 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -547,7 +547,7 @@ add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 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 "Clang") -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") diff --git a/libcxx/include/filesystem b/libcxx/include/filesystem index 7547e6c5a691..339bb252fcee 100644 --- a/libcxx/include/filesystem +++ b/libcxx/include/filesystem @@ -587,7 +587,7 @@ template typename enable_if<__can_convert_char<_ECharT>::value, bool>::type __is_separator(_ECharT __e) { return __e == _ECharT('/'); -}; +} struct _NullSentinal {}; diff --git a/libcxx/include/memory b/libcxx/include/memory index df629b930ddd..6e292a52cca3 100644 --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -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 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 @@ -2168,7 +2170,8 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp { _LIBCPP_INLINE_VISIBILITY constexpr explicit __compressed_pair_elem(_Up&& __u) - : __value_type(_VSTD::forward<_Up>(__u)){}; + : __value_type(_VSTD::forward<_Up>(__u)) + {} template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 diff --git a/libcxx/include/regex b/libcxx/include/regex index db15f78e410b..18585003a8f4 100644 --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -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 diff --git a/libcxx/include/utility b/libcxx/include/utility index 570ec05ae81b..5388585ece85 100644 --- a/libcxx/include/utility +++ b/libcxx/include/utility @@ -1454,7 +1454,7 @@ struct _LIBCPP_TEMPLATE_VIS hash 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::operator()(__v); } @@ -1468,7 +1468,7 @@ struct _LIBCPP_TEMPLATE_VIS hash 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::operator()(__v); } @@ -1482,7 +1482,7 @@ struct _LIBCPP_TEMPLATE_VIS hash 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 diff --git a/libcxx/include/vector b/libcxx/include/vector index e7aaa4df6c0d..de7de093d585 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -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