Fix unused parameters and variables

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290459 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__tree b/include/__tree
index 4c94fe5..485a6c1 100644
--- a/include/__tree
+++ b/include/__tree
@@ -1428,7 +1428,7 @@
         __node_alloc() = __t.__node_alloc();
         }
     _LIBCPP_INLINE_VISIBILITY
-    void __copy_assign_alloc(const __tree& __t, false_type) {}
+    void __copy_assign_alloc(const __tree&, false_type) {}
 
     void __move_assign(__tree& __t, false_type);
     void __move_assign(__tree& __t, true_type)
@@ -1448,7 +1448,7 @@
         _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
         {__node_alloc() = _VSTD::move(__t.__node_alloc());}
     _LIBCPP_INLINE_VISIBILITY
-    void __move_assign_alloc(__tree& __t, false_type) _NOEXCEPT {}
+    void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}
 
     __node_pointer __detach();
     static __node_pointer __detach(__node_pointer);
diff --git a/include/algorithm b/include/algorithm
index 89e138b..c4bf599 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -1754,7 +1754,9 @@
 copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
               _BidirectionalIterator2 __result)
 {
-    return _VSTD::__copy_backward(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result));
+    return _VSTD::__copy_backward(__unwrap_iter(__first),
+                                  __unwrap_iter(__last),
+                                  __unwrap_iter(__result));
 }
 
 // copy_if
@@ -4895,7 +4897,8 @@
 
 template <class _Compare, class _RandomAccessIterator>
 void
-__sift_down(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
+__sift_down(_RandomAccessIterator __first, _RandomAccessIterator /*__last*/,
+            _Compare __comp,
             typename iterator_traits<_RandomAccessIterator>::difference_type __len,
             _RandomAccessIterator __start)
 {
diff --git a/include/complex b/include/complex
index 4d122e9..22f568f 100644
--- a/include/complex
+++ b/include/complex
@@ -844,7 +844,7 @@
 template <class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 typename __libcpp_complex_overload_traits<_Tp>::_ValueType
-imag(_Tp __re)
+imag(_Tp)
 {
     return 0;
 }
diff --git a/include/exception b/include/exception
index d8b8cce..98e1f37 100644
--- a/include/exception
+++ b/include/exception
@@ -163,6 +163,7 @@
         return current_exception();
     }
 #else
+    ((void)__e);
     _VSTD::abort();
 #endif
 }
@@ -208,6 +209,9 @@
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw __nested<typename remove_reference<_Tp>::type>(_VSTD::forward<_Tp>(__t));
+#else
+    ((void)__t);
+    // FIXME: Make this abort.
 #endif
 }
 
@@ -228,6 +232,9 @@
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw _VSTD::forward<_Tp>(__t);
+#else
+    ((void)__t);
+    // FIXME: Make this abort
 #endif
 }
 
diff --git a/include/experimental/filesystem b/include/experimental/filesystem
index 410235f..739918b 100644
--- a/include/experimental/filesystem
+++ b/include/experimental/filesystem
@@ -1218,14 +1218,18 @@
 
 template <class... _Args>
 _LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
+#ifndef _LIBCPP_NO_EXCEPTIONS
 void __throw_filesystem_error(_Args && ...__args)
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
     throw filesystem_error(std::forward<_Args>(__args)...);
-#else
-    _VSTD::abort();
-#endif
 }
+#else
+void __throw_filesystem_error(_Args&&...)
+{
+    _VSTD::abort();
+}
+#endif
+
 
 // operational functions
 
diff --git a/include/experimental/optional b/include/experimental/optional
index 57c5335..8dcda65 100644
--- a/include/experimental/optional
+++ b/include/experimental/optional
@@ -721,7 +721,7 @@
 inline _LIBCPP_INLINE_VISIBILITY
 constexpr
 bool
-operator<=(nullopt_t, const optional<_Tp>& __x) noexcept
+operator<=(nullopt_t, const optional<_Tp>&) noexcept
 {
     return true;
 }
@@ -739,7 +739,7 @@
 inline _LIBCPP_INLINE_VISIBILITY
 constexpr
 bool
-operator>(nullopt_t, const optional<_Tp>& __x) noexcept
+operator>(nullopt_t, const optional<_Tp>&) noexcept
 {
     return false;
 }
diff --git a/include/forward_list b/include/forward_list
index a75d6e9..d70f7ed 100644
--- a/include/forward_list
+++ b/include/forward_list
@@ -531,7 +531,7 @@
     }
 
     _LIBCPP_INLINE_VISIBILITY
-    void __move_assign_alloc(__forward_list_base& __x, false_type) _NOEXCEPT
+    void __move_assign_alloc(__forward_list_base&, false_type) _NOEXCEPT
         {}
     _LIBCPP_INLINE_VISIBILITY
     void __move_assign_alloc(__forward_list_base& __x, true_type)
@@ -1426,7 +1426,7 @@
 template <class _Tp, class _Alloc>
 void
 forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
-                                        forward_list& __x,
+                                        forward_list& /*__other*/,
                                         const_iterator __i)
 {
     const_iterator __lm1 = _VSTD::next(__i);
@@ -1441,7 +1441,7 @@
 template <class _Tp, class _Alloc>
 void
 forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
-                                        forward_list& __x,
+                                        forward_list& /*__other*/,
                                         const_iterator __f, const_iterator __l)
 {
     if (__f != __l && __p != __f)
diff --git a/include/iterator b/include/iterator
index 657236d..2a859c5 100644
--- a/include/iterator
+++ b/include/iterator
@@ -1751,13 +1751,13 @@
 constexpr auto size(const _Cont& __c) -> decltype(__c.size()) { return __c.size(); }
 
 template <class _Tp, size_t _Sz>
-constexpr size_t size(const _Tp (&__array)[_Sz]) noexcept { return _Sz; }
+constexpr size_t size(const _Tp (&)[_Sz]) noexcept { return _Sz; }
 
 template <class _Cont>
 constexpr auto empty(const _Cont& __c) -> decltype(__c.empty()) { return __c.empty(); }
 
 template <class _Tp, size_t _Sz>
-constexpr bool empty(const _Tp (&__array)[_Sz]) noexcept { return false; }
+constexpr bool empty(const _Tp (&)[_Sz]) noexcept { return false; }
 
 template <class _Ep>
 constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; }
diff --git a/include/list b/include/list
index e44bcf2..220a402 100644
--- a/include/list
+++ b/include/list
@@ -655,7 +655,7 @@
         }
 
     _LIBCPP_INLINE_VISIBILITY
-    void __copy_assign_alloc(const __list_imp& __c, false_type)
+    void __copy_assign_alloc(const __list_imp&, false_type)
         {}
 
     _LIBCPP_INLINE_VISIBILITY
@@ -666,7 +666,7 @@
         }
 
     _LIBCPP_INLINE_VISIBILITY
-    void __move_assign_alloc(__list_imp& __c, false_type)
+    void __move_assign_alloc(__list_imp&, false_type)
         _NOEXCEPT
         {}
 };
@@ -2336,14 +2336,14 @@
 
 template <class _Tp, class _Alloc>
 bool
-list<_Tp, _Alloc>::__addable(const const_iterator* __i, ptrdiff_t __n) const
+list<_Tp, _Alloc>::__addable(const const_iterator*, ptrdiff_t) const
 {
     return false;
 }
 
 template <class _Tp, class _Alloc>
 bool
-list<_Tp, _Alloc>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const
+list<_Tp, _Alloc>::__subscriptable(const const_iterator*, ptrdiff_t) const
 {
     return false;
 }
diff --git a/include/locale b/include/locale
index adb03af..2bda44d 100644
--- a/include/locale
+++ b/include/locale
@@ -3932,7 +3932,8 @@
             streamsize __nmemb = _VSTD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
                                  static_cast<streamsize>(__extbufend_ - __extbufnext_));
             codecvt_base::result __r;
-            state_type __svs = __st_;
+            // FIXME: Do we ever need to restore the state here?
+            //state_type __svs = __st_;
             streamsize __nr = __bufptr_->sgetn(const_cast<char*>(__extbufnext_), __nmemb);
             if (__nr != 0)
             {
diff --git a/include/memory b/include/memory
index 8a3237f..b4c2b35 100644
--- a/include/memory
+++ b/include/memory
@@ -1605,7 +1605,7 @@
              is_trivially_move_constructible<_Tp>::value,
             void
         >::type
-        __construct_forward(allocator_type& __a, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2)
+        __construct_forward(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2)
         {
             ptrdiff_t _Np = __end1 - __begin1;
             if (_Np > 0)
@@ -1635,7 +1635,7 @@
              is_trivially_move_constructible<_Tp>::value,
             void
         >::type
-        __construct_range_forward(allocator_type& __a, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2)
+        __construct_range_forward(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2)
         {
             typedef typename remove_const<_Tp>::type _Vp;
             ptrdiff_t _Np = __end1 - __begin1;
@@ -1669,7 +1669,7 @@
              is_trivially_move_constructible<_Tp>::value,
             void
         >::type
-        __construct_backward(allocator_type& __a, _Tp* __begin1, _Tp* __end1, _Tp*& __end2)
+        __construct_backward(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __end2)
         {
             ptrdiff_t _Np = __end1 - __begin1;
             __end2 -= _Np;
@@ -2109,7 +2109,7 @@
 
     template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
         _LIBCPP_INLINE_VISIBILITY
-        __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
+        __libcpp_compressed_pair_imp(piecewise_construct_t,
                                      tuple<_Args1...> __first_args,
                                      tuple<_Args2...> __second_args,
                                      __tuple_indices<_I1...>,
@@ -2164,7 +2164,7 @@
 
     template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
         _LIBCPP_INLINE_VISIBILITY
-        __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
+        __libcpp_compressed_pair_imp(piecewise_construct_t,
                                      tuple<_Args1...> __first_args,
                                      tuple<_Args2...> __second_args,
                                      __tuple_indices<_I1...>,
@@ -2220,7 +2220,7 @@
 
     template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
         _LIBCPP_INLINE_VISIBILITY
-        __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
+        __libcpp_compressed_pair_imp(piecewise_construct_t,
                                      tuple<_Args1...> __first_args,
                                      tuple<_Args2...> __second_args,
                                      __tuple_indices<_I1...>,
@@ -2274,7 +2274,7 @@
 
     template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
         _LIBCPP_INLINE_VISIBILITY
-        __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
+        __libcpp_compressed_pair_imp(piecewise_construct_t,
                                      tuple<_Args1...> __first_args,
                                      tuple<_Args2...> __second_args,
                                      __tuple_indices<_I1...>,
diff --git a/include/optional b/include/optional
index c64aa8f..735ef47 100644
--- a/include/optional
+++ b/include/optional
@@ -1080,7 +1080,7 @@
 template <class _Tp>
 _LIBCPP_INLINE_VISIBILITY constexpr
 bool
-operator<=(nullopt_t, const optional<_Tp>& __x) noexcept
+operator<=(nullopt_t, const optional<_Tp>&) noexcept
 {
     return true;
 }
@@ -1096,7 +1096,7 @@
 template <class _Tp>
 _LIBCPP_INLINE_VISIBILITY constexpr
 bool
-operator>(nullopt_t, const optional<_Tp>& __x) noexcept
+operator>(nullopt_t, const optional<_Tp>&) noexcept
 {
     return false;
 }
diff --git a/include/set b/include/set
index 606af72..8e4c2ae 100644
--- a/include/set
+++ b/include/set
@@ -1023,7 +1023,7 @@
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     _LIBCPP_INLINE_VISIBILITY
     iterator insert(const_iterator __p, value_type&& __v)
-        {return __tree_.__insert_multi(_VSTD::move(__v));}
+        {return __tree_.__insert_multi(__p, _VSTD::move(__v));}
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     template <class _InputIterator>
         _LIBCPP_INLINE_VISIBILITY
diff --git a/include/stdexcept b/include/stdexcept
index b9dd285..d501d09 100644
--- a/include/stdexcept
+++ b/include/stdexcept
@@ -191,7 +191,8 @@
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw logic_error(__msg);
 #else
-	_VSTD::abort();
+    ((void)__msg);
+	  _VSTD::abort();
 #endif
 }
 
@@ -201,7 +202,8 @@
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw domain_error(__msg);
 #else
-	_VSTD::abort();
+    ((void)__msg);
+	  _VSTD::abort();
 #endif
 }
 
@@ -211,7 +213,8 @@
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw invalid_argument(__msg);
 #else
-	_VSTD::abort();
+    ((void)__msg);
+	  _VSTD::abort();
 #endif
 }
 
@@ -221,7 +224,8 @@
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw length_error(__msg);
 #else
-	_VSTD::abort();
+    ((void)__msg);
+	  _VSTD::abort();
 #endif
 }
 
@@ -231,7 +235,8 @@
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw out_of_range(__msg);
 #else
-	_VSTD::abort();
+    ((void)__msg);
+	  _VSTD::abort();
 #endif
 }
 
@@ -241,7 +246,8 @@
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw range_error(__msg);
 #else
-	_VSTD::abort();
+    ((void)__msg);
+	  _VSTD::abort();
 #endif
 }
 
@@ -251,7 +257,8 @@
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw overflow_error(__msg);
 #else
-	_VSTD::abort();
+    ((void)__msg);
+    _VSTD::abort();
 #endif
 }
 
@@ -261,7 +268,8 @@
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw underflow_error(__msg);
 #else
-	_VSTD::abort();
+    ((void)__msg);
+    _VSTD::abort();
 #endif
 }
 
diff --git a/include/string b/include/string
index 840fd00..2e5ffc1 100644
--- a/include/string
+++ b/include/string
@@ -2220,7 +2220,7 @@
 }
 
 template <class _Tp1, class _Tp2>
-bool __ptr_in_range (const _Tp1* __p, const _Tp2* __first, const _Tp2* __last)
+bool __ptr_in_range (const _Tp1*, const _Tp2*, const _Tp2*)
 {
     return false;
 }
diff --git a/include/unordered_map b/include/unordered_map
index 5546989..50be81e 100644
--- a/include/unordered_map
+++ b/include/unordered_map
@@ -922,6 +922,8 @@
         _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
             "unordered_map::insert(const_iterator, const value_type&) called with an iterator not"
             " referring to this unordered_map");
+#else
+        ((void)__p);
 #endif
         return insert(__x).first;
     }
@@ -946,6 +948,8 @@
         _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
             "unordered_map::insert(const_iterator, const value_type&) called with an iterator not"
             " referring to this unordered_map");
+#else
+        ((void)__p);
 #endif
         return __table_.__insert_unique(_VSTD::move(__x)).first;
     }
@@ -965,6 +969,8 @@
             _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
                 "unordered_map::insert(const_iterator, value_type&&) called with an iterator not"
                 " referring to this unordered_map");
+#else
+          ((void)__p);
 #endif
             return insert(_VSTD::forward<_Pp>(__x)).first;
         }
@@ -982,6 +988,8 @@
         _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
             "unordered_map::emplace_hint(const_iterator, args...) called with an iterator not"
             " referring to this unordered_map");
+#else
+          ((void)__p);
 #endif
         return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;
     }
@@ -1015,8 +1023,10 @@
         _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__h) == this,
             "unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not"
             " referring to this unordered_map");
+#else
+        ((void)__h);
 #endif
-            return try_emplace(__k, _VSTD::forward<_Args>(__args)...).first;
+        return try_emplace(__k, _VSTD::forward<_Args>(__args)...).first;
     }
 
     template <class... _Args>
@@ -1027,6 +1037,8 @@
         _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__h) == this,
             "unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not"
             " referring to this unordered_map");
+#else
+        ((void)__h);
 #endif
         return try_emplace(_VSTD::move(__k), _VSTD::forward<_Args>(__args)...).first;
     }
@@ -1057,15 +1069,17 @@
 
     template <class _Vp>
         _LIBCPP_INLINE_VISIBILITY
-        iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v)
+        iterator insert_or_assign(const_iterator, const key_type& __k, _Vp&& __v)
      {
+          // FIXME: Add debug mode checking for the iterator input
           return insert_or_assign(__k, _VSTD::forward<_Vp>(__v)).first;
      }
 
     template <class _Vp>
         _LIBCPP_INLINE_VISIBILITY
-        iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v)
+        iterator insert_or_assign(const_iterator, key_type&& __k, _Vp&& __v)
      {
+        // FIXME: Add debug mode checking for the iterator input
         return insert_or_assign(_VSTD::move(__k), _VSTD::forward<_Vp>(__v)).first;
      }
 #endif
diff --git a/include/vector b/include/vector
index f175e47..3dae3b5 100644
--- a/include/vector
+++ b/include/vector
@@ -821,30 +821,40 @@
     // We call annotatations only for the default Allocator because other allocators
     // may not meet the AddressSanitizer alignment constraints.
     // See the documentation for __sanitizer_annotate_contiguous_container for more details.
-    void __annotate_contiguous_container
-    (const void *__beg, const void *__end, const void *__old_mid, const void *__new_mid) const
-    {
 #ifndef _LIBCPP_HAS_NO_ASAN
+    void __annotate_contiguous_container(const void *__beg, const void *__end,
+                                         const void *__old_mid,
+                                         const void *__new_mid) const
+    {
+
       if (__beg && is_same<allocator_type, __default_allocator_type>::value)
         __sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid);
-#endif
     }
-
-    void __annotate_new(size_type __current_size) const
-    {
+#else
+    _LIBCPP_INLINE_VISIBILITY
+    void __annotate_contiguous_container(const void*, const void*, const void*,
+                                         const void*) const {}
+#endif
+    _LIBCPP_INLINE_VISIBILITY
+    void __annotate_new(size_type __current_size) const {
       __annotate_contiguous_container(data(), data() + capacity(),
                                       data() + capacity(), data() + __current_size);
     }
-    void __annotate_delete() const
-    {
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __annotate_delete() const {
       __annotate_contiguous_container(data(), data() + capacity(),
                                       data() + size(), data() + capacity());
     }
+
+    _LIBCPP_INLINE_VISIBILITY
     void __annotate_increase(size_type __n) const
     {
       __annotate_contiguous_container(data(), data() + capacity(),
                                       data() + size(), data() + size() + __n);
     }
+
+    _LIBCPP_INLINE_VISIBILITY
     void __annotate_shrink(size_type __old_size) const
     {
       __annotate_contiguous_container(data(), data() + capacity(),
@@ -869,8 +879,9 @@
     };
 #else
     struct __RAII_IncreaseAnnotator {
-      inline __RAII_IncreaseAnnotator(const vector &, size_type __n = 1) {}
-      inline void __done() {}
+      _LIBCPP_INLINE_VISIBILITY
+      __RAII_IncreaseAnnotator(const vector &, size_type = 1) {}
+      _LIBCPP_INLINE_VISIBILITY void __done() {}
     };
 #endif
 
@@ -2914,7 +2925,9 @@
 vector<bool, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
 {
     clear();
-    difference_type __n = _VSTD::distance(__first, __last);
+    difference_type __ns = _VSTD::distance(__first, __last);
+    _LIBCPP_ASSERT(__ns >= 0, "invalid range specified");
+    const size_t __n = static_cast<size_type>(__ns);
     if (__n)
     {
         if (__n > capacity())