public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix -Wsystem-header warnings in libstdc++
@ 2017-12-01 15:12 Jonathan Wakely
  2017-12-01 16:10 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2017-12-01 15:12 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 116 bytes --]

This fixes a number of warnings that show up with -Wsystem-headers

Tested powerpc64le-linux, committed to trunk.



[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 6371 bytes --]

commit cc833c247c3b334c56feff8898bd02c8f9f3fc6a
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Dec 1 14:13:47 2017 +0000

    Add comment to fix -Wfallthrough warning
    
            * include/bits/locale_facets_nonio.tcc (money_get::_M_extract): Add
            fallthrough comment.

diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.tcc b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
index a449c41e6b8..135dd0b9d8f 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
@@ -282,6 +282,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11
 		  ++__beg;
 		else
 		  __testvalid = false;
+		// fallthrough
 	      case money_base::none:
 		// Only if not at the end of the pattern.
 		if (__i != 3)

commit 98e449432c7ceddb157ccc5e94e6c2886c5d33e1
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 30 16:57:20 2017 +0000

    Fix -Wempty-body warnings for debug assertions
    
            * include/bits/node_handle.h (_Node_handle_common::operator=)
            (_Node_handle_common::_M_swap): Add braces around debug assertions.

diff --git a/libstdc++-v3/include/bits/node_handle.h b/libstdc++-v3/include/bits/node_handle.h
index 7f109ada6f1..8a1e465893e 100644
--- a/libstdc++-v3/include/bits/node_handle.h
+++ b/libstdc++-v3/include/bits/node_handle.h
@@ -87,10 +87,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		|| !this->_M_alloc)
 	      this->_M_alloc = std::move(__nh._M_alloc);
 	    else
-	      __glibcxx_assert(this->_M_alloc == __nh._M_alloc);
+	      {
+		__glibcxx_assert(this->_M_alloc == __nh._M_alloc);
+	      }
 	  }
 	else
-	  __glibcxx_assert(_M_alloc);
+	  {
+	    __glibcxx_assert(_M_alloc);
+	  }
 	__nh._M_ptr = nullptr;
 	__nh._M_alloc = nullopt;
 	return *this;
@@ -109,7 +113,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	    || !_M_alloc || !__nh._M_alloc)
 	  _M_alloc.swap(__nh._M_alloc);
 	else
-	  __glibcxx_assert(_M_alloc == __nh._M_alloc);
+	  {
+	    __glibcxx_assert(_M_alloc == __nh._M_alloc);
+	  }
       }
 
     private:

commit 93ebef15310e0ebed92041ebbc6c860c1b06e2a6
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 30 20:14:31 2017 +0000

    Use const char* to fix -Wwrite-strings warning
    
            * include/ext/ropeimpl.h (rope::_S_dump): Use const char*.

diff --git a/libstdc++-v3/include/ext/ropeimpl.h b/libstdc++-v3/include/ext/ropeimpl.h
index 9e88ce14c18..4842034c1e8 100644
--- a/libstdc++-v3/include/ext/ropeimpl.h
+++ b/libstdc++-v3/include/ext/ropeimpl.h
@@ -1139,7 +1139,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	}
       else
 	{
-	  char* __kind;
+	  const char* __kind;
 	  
 	  switch (__r->_M_tag)
 	    {

commit 3a05b2c46c829bc7c3698d3d432372c9b70881c7
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 30 20:18:47 2017 +0000

    Add [[noreturn]] attributes to fix warning
    
            * libsupc++/nested_exception.h (__throw_with_nested_impl): Add
            noreturn attribute.

diff --git a/libstdc++-v3/libsupc++/nested_exception.h b/libstdc++-v3/libsupc++/nested_exception.h
index 43970b4ef86..27bccfce35f 100644
--- a/libstdc++-v3/libsupc++/nested_exception.h
+++ b/libstdc++-v3/libsupc++/nested_exception.h
@@ -92,6 +92,7 @@ namespace std
   // Throw an exception of unspecified type that is publicly derived from
   // both remove_reference_t<_Tp> and nested_exception.
   template<typename _Tp>
+    [[noreturn]]
     inline void
     __throw_with_nested_impl(_Tp&& __t, true_type)
     {
@@ -100,6 +101,7 @@ namespace std
     }
 
   template<typename _Tp>
+    [[noreturn]]
     inline void
     __throw_with_nested_impl(_Tp&& __t, false_type)
     { throw std::forward<_Tp>(__t); }

commit a82e6e608b99d5be038869b3745d1f49ddfc022b
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Dec 1 13:59:59 2017 +0000

    Remove stray semi-colons at namespace scope
    
            * include/bits/regex_executor.tcc (_Executor::_M_rep_once_more):
            Remove semi-colon after function body.
            * include/bits/uniform_int_dist.h (_Power_of_2): Likewise.

diff --git a/libstdc++-v3/include/bits/regex_executor.tcc b/libstdc++-v3/include/bits/regex_executor.tcc
index 2ceba35e7b8..008ffa0e836 100644
--- a/libstdc++-v3/include/bits/regex_executor.tcc
+++ b/libstdc++-v3/include/bits/regex_executor.tcc
@@ -170,7 +170,7 @@ namespace __detail
   // visited more than twice. It's `twice` instead of `once` because
   // we need to spare one more time for potential group capture.
   template<typename _BiIter, typename _Alloc, typename _TraitsT,
-    bool __dfs_mode>
+	   bool __dfs_mode>
     void _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>::
     _M_rep_once_more(_Match_mode __match_mode, _StateIdT __i)
     {
@@ -193,7 +193,7 @@ namespace __detail
 	      __rep_count.second--;
 	    }
 	}
-    };
+    }
 
   // _M_alt branch is "match once more", while _M_next is "get me out
   // of this quantifier". Executing _M_next first or _M_alt first don't
diff --git a/libstdc++-v3/include/bits/uniform_int_dist.h b/libstdc++-v3/include/bits/uniform_int_dist.h
index 16509c4ef8a..c64c02c245e 100644
--- a/libstdc++-v3/include/bits/uniform_int_dist.h
+++ b/libstdc++-v3/include/bits/uniform_int_dist.h
@@ -46,7 +46,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _Power_of_2(_Tp __x)
       {
 	return ((__x - 1) & __x) == 0;
-      };
+      }
   }
 
   /**

commit 13b4b8dab56d73faa858926cdcf16dc839455657
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 30 18:03:06 2017 +0000

    Use value-init syntax in std::__detail::__airy
    
            * include/tr1/modified_bessel_func.tcc (__airy): Use value-init not
            list-init.

diff --git a/libstdc++-v3/include/tr1/modified_bessel_func.tcc b/libstdc++-v3/include/tr1/modified_bessel_func.tcc
index 3910b95bd28..f39ff6c82d2 100644
--- a/libstdc++-v3/include/tr1/modified_bessel_func.tcc
+++ b/libstdc++-v3/include/tr1/modified_bessel_func.tcc
@@ -384,11 +384,11 @@ namespace tr1
         __Bip = __Aip = __Bi = __Ai = std::numeric_limits<_Tp>::quiet_NaN();
       else if (__z == _S_inf)
         {
-	  __Aip = __Ai = _Tp{0};
+	  __Aip = __Ai = _Tp(0);
 	  __Bip = __Bi = _S_inf;
 	}
       else if (__z == -_S_inf)
-	__Bip = __Aip = __Bi = __Ai = _Tp{0};
+	__Bip = __Aip = __Bi = __Ai = _Tp(0);
       else if (__x > _Tp(0))
         {
           _Tp __I_nu, __Ip_nu, __K_nu, __Kp_nu;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix -Wsystem-header warnings in libstdc++
  2017-12-01 15:12 [PATCH] Fix -Wsystem-header warnings in libstdc++ Jonathan Wakely
@ 2017-12-01 16:10 ` Jonathan Wakely
  2017-12-04 23:08   ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2017-12-01 16:10 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 188 bytes --]

On 01/12/17 15:11 +0000, Jonathan Wakely wrote:
>This fixes a number of warnings that show up with -Wsystem-headers

This fixes some more.

Tested powerpc64le-linux, committed to trunk.



[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 7520 bytes --]

commit cea830828177721a6d201dd6c201c34235626641
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Dec 1 15:59:01 2017 +0000

    Fix narrowing conversions in string_view types
    
            * include/experimental/string_view (basic_string_view::_S_compare):
            Use value-init so narrowing conversions are not ill-formed.
            * include/std/string_view (basic_string_view::_S_compare): Likewise.

diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view
index 96d1f58f8e9..ef171ecc025 100644
--- a/libstdc++-v3/include/experimental/string_view
+++ b/libstdc++-v3/include/experimental/string_view
@@ -422,11 +422,11 @@ inline namespace fundamentals_v1
       static constexpr int
       _S_compare(size_type __n1, size_type __n2) noexcept
       {
-	return difference_type{__n1 - __n2} > std::numeric_limits<int>::max()
+	return difference_type(__n1 - __n2) > std::numeric_limits<int>::max()
 	     ? std::numeric_limits<int>::max()
-	     : difference_type{__n1 - __n2} < std::numeric_limits<int>::min()
+	     : difference_type(__n1 - __n2) < std::numeric_limits<int>::min()
 	     ? std::numeric_limits<int>::min()
-	     : static_cast<int>(difference_type{__n1 - __n2});
+	     : static_cast<int>(difference_type(__n1 - __n2));
       }
 
       size_t	    _M_len;
diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view
index 1266a07d04f..3b2901ab3c6 100644
--- a/libstdc++-v3/include/std/string_view
+++ b/libstdc++-v3/include/std/string_view
@@ -408,7 +408,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       static constexpr int
       _S_compare(size_type __n1, size_type __n2) noexcept
       {
-	const difference_type __diff{__n1 - __n2};
+	const difference_type __diff = __n1 - __n2;
 	if (__diff > std::numeric_limits<int>::max())
 	  return std::numeric_limits<int>::max();
 	if (__diff < std::numeric_limits<int>::min())

commit b992ef59e17964034ffb6dd094629468998ee6e9
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 30 16:26:22 2017 +0000

    Disable -Wliteral-suffix for standard UDLs
    
            * include/bits/basic_string.h (operator""s): Add pragmas to disable
            -Wliteral-suffix warnings.
            * include/experimental/string_view (operator""sv): Likewise.
            * include/std/chrono (operator""h, operator""min, operator""s)
            (operator""ms, operator""us, operator""ns): Likewise.
            * include/std/complex (operator""if, operator""i, operator""il):
            Likewise.
            * include/std/string_view (operator""sv): Likewise.
            * testsuite/20_util/duration/literals/range.cc: Adjust dg-error.

diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index a4b81137571..70373e7448a 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -6665,6 +6665,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   {
   inline namespace string_literals
   {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wliteral-suffix"
     _GLIBCXX_DEFAULT_ABI_TAG
     inline basic_string<char>
     operator""s(const char* __str, size_t __len)
@@ -6689,6 +6691,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { return basic_string<char32_t>{__str, __len}; }
 #endif
 
+#pragma GCC diagnostic pop
   } // inline namespace string_literals
   } // inline namespace literals
 
diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view
index 8eaf9ec3d96..96d1f58f8e9 100644
--- a/libstdc++-v3/include/experimental/string_view
+++ b/libstdc++-v3/include/experimental/string_view
@@ -644,6 +644,8 @@ namespace experimental
   {
   inline namespace string_view_literals
   {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wliteral-suffix"
     inline constexpr basic_string_view<char>
     operator""sv(const char* __str, size_t __len) noexcept
     { return basic_string_view<char>{__str, __len}; }
@@ -663,6 +665,7 @@ namespace experimental
     operator""sv(const char32_t* __str, size_t __len) noexcept
     { return basic_string_view<char32_t>{__str, __len}; }
 #endif
+#pragma GCC diagnostic pop
   } // namespace string_literals
   } // namespace literals
 } // namespace experimental
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index 9491508e637..2419e82acce 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -884,6 +884,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   {
   inline namespace chrono_literals
   {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wliteral-suffix"
     template<typename _Rep, unsigned long long _Val>
       struct _Checked_integral_constant
       : integral_constant<_Rep, static_cast<_Rep>(_Val)>
@@ -958,6 +960,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       operator""ns()
       { return __check_overflow<chrono::nanoseconds, _Digits...>(); }
 
+#pragma GCC diagnostic pop
   } // inline namespace chrono_literals
   } // inline namespace literals
 
@@ -966,7 +969,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     using namespace literals::chrono_literals;
   } // namespace chrono
 
-#endif // __cplusplus > 201103L
+#endif // C++14
 
   // @} group chrono
 
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index bd8b09d84f0..61f8cc1fce3 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -1941,6 +1941,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 inline namespace literals {
 inline namespace complex_literals {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wliteral-suffix"
 #define __cpp_lib_complex_udls 201309
 
   constexpr std::complex<float>
@@ -1967,6 +1969,7 @@ inline namespace complex_literals {
   operator""il(unsigned long long __num)
   { return std::complex<long double>{0.0L, static_cast<long double>(__num)}; }
 
+#pragma GCC diagnostic pop
 } // inline namespace complex_literals
 } // inline namespace literals
 
diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view
index 68b4b08f8f4..1266a07d04f 100644
--- a/libstdc++-v3/include/std/string_view
+++ b/libstdc++-v3/include/std/string_view
@@ -626,6 +626,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   {
   inline namespace string_view_literals
   {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wliteral-suffix"
     inline constexpr basic_string_view<char>
     operator""sv(const char* __str, size_t __len) noexcept
     { return basic_string_view<char>{__str, __len}; }
@@ -645,6 +647,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator""sv(const char32_t* __str, size_t __len) noexcept
     { return basic_string_view<char32_t>{__str, __len}; }
 #endif
+#pragma GCC diagnostic pop
   } // namespace string_literals
   } // namespace literals
 
diff --git a/libstdc++-v3/testsuite/20_util/duration/literals/range.cc b/libstdc++-v3/testsuite/20_util/duration/literals/range.cc
index c0d1a6e5885..20d82c5cdbe 100644
--- a/libstdc++-v3/testsuite/20_util/duration/literals/range.cc
+++ b/libstdc++-v3/testsuite/20_util/duration/literals/range.cc
@@ -26,6 +26,6 @@ test01()
 
   // std::numeric_limits<int64_t>::max() == 9223372036854775807;
   auto h = 9223372036854775808h;
-  // { dg-error "cannot be represented" "" { target *-*-* } 892 }
+  // { dg-error "cannot be represented" "" { target *-*-* } 894 }
 }
 // { dg-prune-output "in constexpr expansion" } // needed for -O0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix -Wsystem-header warnings in libstdc++
  2017-12-01 16:10 ` Jonathan Wakely
@ 2017-12-04 23:08   ` Jonathan Wakely
  2017-12-04 23:15     ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2017-12-04 23:08 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

On 01/12/17 16:10 +0000, Jonathan Wakely wrote:
>On 01/12/17 15:11 +0000, Jonathan Wakely wrote:
>>This fixes a number of warnings that show up with -Wsystem-headers
>
>This fixes some more.

And some more, this time for -Wunused, -Wcomment, and
-Wvariadic-macros.

Tested powerpc64le-linux, committed to trunk.

The purpose of these is not only to reduce noise if users use
-Wsystem-headers, but to get us to a place where PR 50871 can be fixed
(i.e. build and test libstdc++ without having useful warnings
suppressed by the #pragma GCC system_header lines).


[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 9346 bytes --]

commit e04e77ee6202b69652d033d419283bc35d67897a
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Dec 4 20:49:42 2017 +0000

    Fix warnings in <bits/regex_compiler.tcc>
    
            * include/bits/regex_compiler.tcc: Use C-style comment to work around
            PR preprocessor/61638.
            (__INSERT_REGEX_MATCHER): Replace GNU extension with __VA_ARGS__.

diff --git a/libstdc++-v3/include/bits/regex_compiler.tcc b/libstdc++-v3/include/bits/regex_compiler.tcc
index 1f7dd91b643..0c89800ea94 100644
--- a/libstdc++-v3/include/bits/regex_compiler.tcc
+++ b/libstdc++-v3/include/bits/regex_compiler.tcc
@@ -30,8 +30,9 @@
 
 // FIXME make comments doxygen format.
 
+/*
 // This compiler refers to "Regular Expression Matching Can Be Simple And Fast"
-// (http://swtch.com/~rsc/regexp/regexp1.html"),
+// (http://swtch.com/~rsc/regexp/regexp1.html),
 // but doesn't strictly follow it.
 //
 // When compiling, states are *chained* instead of tree- or graph-constructed.
@@ -51,7 +52,8 @@
 // article.
 //
 // That's why we introduced dummy node here ------ "end_tag" is a dummy node.
-// All dummy node will be eliminated at the end of compiling process.
+// All dummy nodes will be eliminated at the end of compilation.
+*/
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
@@ -292,18 +294,18 @@ namespace __detail
       return true;
     }
 
-#define __INSERT_REGEX_MATCHER(__func, args...)\
+#define __INSERT_REGEX_MATCHER(__func, ...)\
 	do\
 	  if (!(_M_flags & regex_constants::icase))\
 	    if (!(_M_flags & regex_constants::collate))\
-	      __func<false, false>(args);\
+	      __func<false, false>(__VA_ARGS__);\
 	    else\
-	      __func<false, true>(args);\
+	      __func<false, true>(__VA_ARGS__);\
 	  else\
 	    if (!(_M_flags & regex_constants::collate))\
-	      __func<true, false>(args);\
+	      __func<true, false>(__VA_ARGS__);\
 	    else\
-	      __func<true, true>(args);\
+	      __func<true, true>(__VA_ARGS__);\
 	while (false)
 
   template<typename _TraitsT>

commit f2d7faeec2d63743c5acdc1dc77fca7ba64fce1f
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Dec 4 16:08:34 2017 +0000

    Fix -Wunused warnings in libstdc++ headers
    
            * config/io/basic_file_stdio.h (__basic_file): Remove name of unused
            parameter.
            * include/bits/boost_concept_check.h: Add pragmas to disable
            -Wunused-local-typedef warnings.
            * include/bits/codecvt.h (codecvt_byname<char16_t, char, mbstate_t>)
            (codecvt_byname<char32_t, char, mbstate_t>): Remove name of unused
            parameter.
            * include/bits/locale_facets_nonio.tcc (time_get::do_get_weekday)
            (time_get::do_get_monthname, time_get::do_get_year): Remove unused
            variables.
            * include/std/bitset (_Base_bitset<0>::_M_getword): Remove name of
            unused parameter.
            * include/std/streambuf (_IsUnused): Define.
            (basic_streambuf::imbue, basic_streambuf::pbackfail)
            (basic_streambuf::overflow): Add macro to unused parameters.
            * testsuite/24_iterators/operations/prev_neg.cc: Adjust dg-error.

diff --git a/libstdc++-v3/config/io/basic_file_stdio.h b/libstdc++-v3/config/io/basic_file_stdio.h
index f959ea534cb..76435e417ef 100644
--- a/libstdc++-v3/config/io/basic_file_stdio.h
+++ b/libstdc++-v3/config/io/basic_file_stdio.h
@@ -63,7 +63,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __basic_file(__c_lock* __lock = 0) throw ();
 
 #if __cplusplus >= 201103L
-      __basic_file(__basic_file&& __rv, __c_lock* __lock = 0) noexcept
+      __basic_file(__basic_file&& __rv, __c_lock* = 0) noexcept
       : _M_cfile(__rv._M_cfile), _M_cfile_created(__rv._M_cfile_created)
       {
 	__rv._M_cfile = nullptr;
diff --git a/libstdc++-v3/include/bits/boost_concept_check.h b/libstdc++-v3/include/bits/boost_concept_check.h
index fb9a643c869..43ab03415e5 100644
--- a/libstdc++-v3/include/bits/boost_concept_check.h
+++ b/libstdc++-v3/include/bits/boost_concept_check.h
@@ -48,6 +48,9 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
+
 #define _IsUnused __attribute__ ((__unused__))
 
 // When the C-C code is in use, we would like this function to do as little
@@ -783,6 +786,7 @@ struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; };
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 
+#pragma GCC diagnostic pop
 #undef _IsUnused
 
 #endif // _GLIBCXX_BOOST_CONCEPT_CHECK
diff --git a/libstdc++-v3/include/bits/codecvt.h b/libstdc++-v3/include/bits/codecvt.h
index fc2da321ab6..09af6d88fd2 100644
--- a/libstdc++-v3/include/bits/codecvt.h
+++ b/libstdc++-v3/include/bits/codecvt.h
@@ -612,7 +612,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     {
     public:
       explicit
-      codecvt_byname(const char* __s, size_t __refs = 0)
+      codecvt_byname(const char*, size_t __refs = 0)
       : codecvt<char16_t, char, mbstate_t>(__refs) { }
 
       explicit
@@ -630,7 +630,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     {
     public:
       explicit
-      codecvt_byname(const char* __s, size_t __refs = 0)
+      codecvt_byname(const char*, size_t __refs = 0)
       : codecvt<char32_t, char, mbstate_t>(__refs) { }
 
       explicit
diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.tcc b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
index 135dd0b9d8f..63e832ea233 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
@@ -1096,7 +1096,6 @@ _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
     {
       const locale& __loc = __io._M_getloc();
       const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
-      const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
       const char_type* __days[14];
       __tp._M_days_abbreviated(__days);
       __tp._M_days(__days + 7);
@@ -1123,7 +1122,6 @@ _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
     {
       const locale& __loc = __io._M_getloc();
       const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
-      const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
       const char_type*  __months[24];
       __tp._M_months_abbreviated(__months);
       __tp._M_months(__months + 12);
@@ -1148,8 +1146,6 @@ _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
     do_get_year(iter_type __beg, iter_type __end, ios_base& __io,
 		ios_base::iostate& __err, tm* __tm) const
     {
-      const locale& __loc = __io._M_getloc();
-      const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
       int __tmpyear;
       ios_base::iostate __tmperr = ios_base::goodbit;
 
diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset
index 382886ca224..0afad6e5e0e 100644
--- a/libstdc++-v3/include/std/bitset
+++ b/libstdc++-v3/include/std/bitset
@@ -561,7 +561,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       }
 
       _GLIBCXX_CONSTEXPR _WordT
-      _M_getword(size_t __pos) const _GLIBCXX_NOEXCEPT
+      _M_getword(size_t) const _GLIBCXX_NOEXCEPT
       { return 0; }
 
       _GLIBCXX_CONSTEXPR _WordT
diff --git a/libstdc++-v3/include/std/streambuf b/libstdc++-v3/include/std/streambuf
index c1fd395b827..34fa9a45511 100644
--- a/libstdc++-v3/include/std/streambuf
+++ b/libstdc++-v3/include/std/streambuf
@@ -46,6 +46,8 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
+#define _IsUnused __attribute__ ((__unused__))
+
   template<typename _CharT, typename _Traits>
     streamsize
     __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*,
@@ -578,7 +580,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        *  @note  Base class version does nothing.
       */
       virtual void
-      imbue(const locale& __loc)
+      imbue(const locale& __loc _IsUnused)
       { }
 
       // [27.5.2.4.2] buffer management and positioning
@@ -726,7 +728,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        *  @note  Base class version does nothing, returns eof().
       */
       virtual int_type
-      pbackfail(int_type __c  = traits_type::eof())
+      pbackfail(int_type __c _IsUnused  = traits_type::eof())
       { return traits_type::eof(); }
 
       // Put area:
@@ -770,7 +772,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        *  @note  Base class version does nothing, returns eof().
       */
       virtual int_type
-      overflow(int_type __c  = traits_type::eof())
+      overflow(int_type __c _IsUnused  = traits_type::eof())
       { return traits_type::eof(); }
 
 #if _GLIBCXX_USE_DEPRECATED && __cplusplus <= 201402L
@@ -852,6 +854,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 			  basic_streambuf<wchar_t>* __sbout, bool& __ineof);
 #endif
 
+#undef _IsUnused
+
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 
diff --git a/libstdc++-v3/testsuite/24_iterators/operations/prev_neg.cc b/libstdc++-v3/testsuite/24_iterators/operations/prev_neg.cc
index bcbde41093d..3fbdb6f6f09 100644
--- a/libstdc++-v3/testsuite/24_iterators/operations/prev_neg.cc
+++ b/libstdc++-v3/testsuite/24_iterators/operations/prev_neg.cc
@@ -38,5 +38,5 @@ test02()
 {
   const Y array[1] = { };
   std::prev(array + 1);
-  // { dg-error "forward_iterator" "" { target *-*-* } 220 }
+  // { dg-error "forward_iterator" "" { target *-*-* } 223 }
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix -Wsystem-header warnings in libstdc++
  2017-12-04 23:08   ` Jonathan Wakely
@ 2017-12-04 23:15     ` Jonathan Wakely
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2017-12-04 23:15 UTC (permalink / raw)
  To: libstdc++, gcc-patches

On 04/12/17 23:07 +0000, Jonathan Wakely wrote:
>On 01/12/17 16:10 +0000, Jonathan Wakely wrote:
>>On 01/12/17 15:11 +0000, Jonathan Wakely wrote:
>>>This fixes a number of warnings that show up with -Wsystem-headers
>>
>>This fixes some more.
>
>And some more, this time for -Wunused, -Wcomment, and
>-Wvariadic-macros.
>
>Tested powerpc64le-linux, committed to trunk.
>
>The purpose of these is not only to reduce noise if users use
>-Wsystem-headers, but to get us to a place where PR 50871 can be fixed
>(i.e. build and test libstdc++ without having useful warnings
>suppressed by the #pragma GCC system_header lines).

This warning remains:

/home/jwakely/gcc/8/include/c++/8.0.0/bits/valarray_array.h:56:12: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
     inline _Tp*__restrict__
            ^~~

I think we can just remove the __restrict__.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-04 23:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-01 15:12 [PATCH] Fix -Wsystem-header warnings in libstdc++ Jonathan Wakely
2017-12-01 16:10 ` Jonathan Wakely
2017-12-04 23:08   ` Jonathan Wakely
2017-12-04 23:15     ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).