This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix -Wsystem-header warnings in libstdc++


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

Tested powerpc64le-linux, committed to trunk.


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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]