Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Oct 2012 07:51:18 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r242347 - in stable/9: contrib/libstdc++/config/os/bsd/freebsd contrib/libstdc++/include/bits contrib/libstdc++/include/debug contrib/libstdc++/include/ext contrib/libstdc++/include/std...
Message-ID:  <201210300751.q9U7pIjf045573@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Tue Oct 30 07:51:18 2012
New Revision: 242347
URL: http://svn.freebsd.org/changeset/base/242347

Log:
  MFC r241957:
  
    Fix several clang warnings in libstdc++, which were exposed by the
    recent atf import.  These changes are purely cosmetic, no functional
    change.
  
  MFC r241959:
  
    Fix a number of other clang warnings in libstdc++, which could appear
    when building other C++ software with it.  Also fix one actual bug in
    libsupc++, which was exposed by such a warning.  This latter fix is the
    only functional change.
  
  MFC r241960:
  
    For building GNU libstdc++ and libsupc++, filter out libc++-specific and
    -std= flags above c++98 or gnu++98 from CXXFLAGS *after* including
    bsd.lib.mk, otherwise some additions to CXXFLAGS done in bsd.*.mk might
    not be preserved.

Modified:
  stable/9/contrib/libstdc++/config/os/bsd/freebsd/ctype_base.h
  stable/9/contrib/libstdc++/include/bits/fstream.tcc
  stable/9/contrib/libstdc++/include/bits/locale_facets.h
  stable/9/contrib/libstdc++/include/bits/locale_facets.tcc
  stable/9/contrib/libstdc++/include/bits/streambuf_iterator.h
  stable/9/contrib/libstdc++/include/debug/safe_iterator.tcc
  stable/9/contrib/libstdc++/include/ext/ropeimpl.h
  stable/9/contrib/libstdc++/include/std/std_sstream.h
  stable/9/contrib/libstdc++/libsupc++/tinfo.cc
  stable/9/contrib/libstdc++/src/locale.cc
  stable/9/contrib/libstdc++/src/strstream.cc
  stable/9/contrib/libstdc++/src/tree.cc
  stable/9/gnu/lib/libstdc++/Makefile
  stable/9/gnu/lib/libsupc++/Makefile
Directory Properties:
  stable/9/contrib/libstdc++/   (props changed)
  stable/9/gnu/lib/libstdc++/   (props changed)
  stable/9/gnu/lib/libsupc++/   (props changed)

Modified: stable/9/contrib/libstdc++/config/os/bsd/freebsd/ctype_base.h
==============================================================================
--- stable/9/contrib/libstdc++/config/os/bsd/freebsd/ctype_base.h	Tue Oct 30 06:36:14 2012	(r242346)
+++ stable/9/contrib/libstdc++/config/os/bsd/freebsd/ctype_base.h	Tue Oct 30 07:51:18 2012	(r242347)
@@ -38,8 +38,9 @@
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
   /// @brief  Base class for ctype.
-  struct ctype_base
+  class ctype_base
   {
+  public:
     // Non-standard typedefs.
     typedef const int* 		__to_type;
 

Modified: stable/9/contrib/libstdc++/include/bits/fstream.tcc
==============================================================================
--- stable/9/contrib/libstdc++/include/bits/fstream.tcc	Tue Oct 30 06:36:14 2012	(r242346)
+++ stable/9/contrib/libstdc++/include/bits/fstream.tcc	Tue Oct 30 07:51:18 2012	(r242347)
@@ -641,21 +641,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     setbuf(char_type* __s, streamsize __n)
     {
       if (!this->is_open())
-	if (__s == 0 && __n == 0)
-	  _M_buf_size = 1;
-	else if (__s && __n > 0)
-	  {
-	    // This is implementation-defined behavior, and assumes that
-	    // an external char_type array of length __n exists and has
-	    // been pre-allocated. If this is not the case, things will
-	    // quickly blow up. When __n > 1, __n - 1 positions will be
-	    // used for the get area, __n - 1 for the put area and 1
-	    // position to host the overflow char of a full put area.
-	    // When __n == 1, 1 position will be used for the get area
-	    // and 0 for the put area, as in the unbuffered case above.
-	    _M_buf = __s;
-	    _M_buf_size = __n;
-	  }
+	{
+	  if (__s == 0 && __n == 0)
+	    _M_buf_size = 1;
+	  else if (__s && __n > 0)
+	    {
+	      // This is implementation-defined behavior, and assumes that
+	      // an external char_type array of length __n exists and has
+	      // been pre-allocated. If this is not the case, things will
+	      // quickly blow up. When __n > 1, __n - 1 positions will be
+	      // used for the get area, __n - 1 for the put area and 1
+	      // position to host the overflow char of a full put area.
+	      // When __n == 1, 1 position will be used for the get area
+	      // and 0 for the put area, as in the unbuffered case above.
+	      _M_buf = __s;
+	      _M_buf_size = __n;
+	    }
+	}
       return this;
     }
 

Modified: stable/9/contrib/libstdc++/include/bits/locale_facets.h
==============================================================================
--- stable/9/contrib/libstdc++/include/bits/locale_facets.h	Tue Oct 30 06:36:14 2012	(r242346)
+++ stable/9/contrib/libstdc++/include/bits/locale_facets.h	Tue Oct 30 07:51:18 2012	(r242347)
@@ -4335,8 +4335,9 @@ _GLIBCXX_END_LDBL_NAMESPACE
   /**
    *  @brief  Messages facet base class providing catalog typedef.
    */
-  struct messages_base
+  class messages_base
   {
+  public:
     typedef int catalog;
   };
 

Modified: stable/9/contrib/libstdc++/include/bits/locale_facets.tcc
==============================================================================
--- stable/9/contrib/libstdc++/include/bits/locale_facets.tcc	Tue Oct 30 06:36:14 2012	(r242346)
+++ stable/9/contrib/libstdc++/include/bits/locale_facets.tcc	Tue Oct 30 07:51:18 2012	(r242347)
@@ -316,7 +316,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
       int __sep_pos = 0;
       while (!__testeof)
 	{
-	  if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep
+	  if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
 	      || __c == __lc->_M_decimal_point)
 	    break;
 	  else if (__c == __lit[__num_base::_S_izero])
@@ -558,7 +558,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
 	int __sep_pos = 0;
 	while (!__testeof)
 	  {
-	    if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep
+	    if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
 		|| __c == __lc->_M_decimal_point)
 	      break;
 	    else if (__c == __lit[__num_base::_S_izero] 
@@ -748,16 +748,20 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
 	      const char_type __c = *__beg;
 
 	      if (__testf)
-		if (__n < __lc->_M_falsename_size)
-		  __testf = __c == __lc->_M_falsename[__n];
-		else
-		  break;
+		{
+		  if (__n < __lc->_M_falsename_size)
+		    __testf = __c == __lc->_M_falsename[__n];
+		  else
+		    break;
+		}
 
 	      if (__testt)
-		if (__n < __lc->_M_truename_size)
-		  __testt = __c == __lc->_M_truename[__n];
-		else
-		  break;
+		{
+		  if (__n < __lc->_M_truename_size)
+		    __testt = __c == __lc->_M_truename[__n];
+		  else
+		    break;
+		}
 
 	      if (!__testf && !__testt)
 		break;
@@ -1387,9 +1391,9 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
 					 == money_base::space)))
 		    || (__i == 2 && ((static_cast<part>(__p.field[3])
 				      == money_base::value)
-				     || __mandatory_sign
+				     || (__mandatory_sign
 				     && (static_cast<part>(__p.field[3])
-					 == money_base::sign))))
+					 == money_base::sign)))))
 		  {
 		    const size_type __len = __lc->_M_curr_symbol_size;
 		    size_type __j = 0;

Modified: stable/9/contrib/libstdc++/include/bits/streambuf_iterator.h
==============================================================================
--- stable/9/contrib/libstdc++/include/bits/streambuf_iterator.h	Tue Oct 30 06:36:14 2012	(r242346)
+++ stable/9/contrib/libstdc++/include/bits/streambuf_iterator.h	Tue Oct 30 07:51:18 2012	(r242347)
@@ -160,7 +160,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       {
 	const bool __thiseof = _M_at_eof();
 	const bool __beof = __b._M_at_eof();
-	return (__thiseof && __beof || (!__thiseof && !__beof));
+	return ((__thiseof && __beof) || (!__thiseof && !__beof));
       }
 
     private:

Modified: stable/9/contrib/libstdc++/include/debug/safe_iterator.tcc
==============================================================================
--- stable/9/contrib/libstdc++/include/debug/safe_iterator.tcc	Tue Oct 30 06:36:14 2012	(r242346)
+++ stable/9/contrib/libstdc++/include/debug/safe_iterator.tcc	Tue Oct 30 07:51:18 2012	(r242347)
@@ -54,8 +54,8 @@ namespace __gnu_debug
 	    static_cast<const _Sequence*>(_M_sequence)->begin();
 	  std::pair<difference_type, _Distance_precision> __dist =
 	    this->_M_get_distance(__begin, *this);
-	  bool __ok =  (__dist.second == __dp_exact && __dist.first >= -__n
-			|| __dist.second != __dp_exact && __dist.first > 0);
+	  bool __ok =  ((__dist.second == __dp_exact && __dist.first >= -__n)
+			|| (__dist.second != __dp_exact && __dist.first > 0));
 	  return __ok;
 	}
       else
@@ -64,8 +64,8 @@ namespace __gnu_debug
 	    static_cast<const _Sequence*>(_M_sequence)->end();
 	  std::pair<difference_type, _Distance_precision> __dist =
 	    this->_M_get_distance(*this, __end);
-	  bool __ok = (__dist.second == __dp_exact && __dist.first >= __n
-		       || __dist.second != __dp_exact && __dist.first > 0);
+	  bool __ok = ((__dist.second == __dp_exact && __dist.first >= __n)
+		       || (__dist.second != __dp_exact && __dist.first > 0));
 	  return __ok;
 	}
     }

Modified: stable/9/contrib/libstdc++/include/ext/ropeimpl.h
==============================================================================
--- stable/9/contrib/libstdc++/include/ext/ropeimpl.h	Tue Oct 30 06:36:14 2012	(r242346)
+++ stable/9/contrib/libstdc++/include/ext/ropeimpl.h	Tue Oct 30 07:51:18 2012	(r242347)
@@ -1143,7 +1143,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 	}
       else
 	{
-	  char* __kind;
+	  const char* __kind;
 	  
 	  switch (__r->_M_tag)
 	    {

Modified: stable/9/contrib/libstdc++/include/std/std_sstream.h
==============================================================================
--- stable/9/contrib/libstdc++/include/std/std_sstream.h	Tue Oct 30 06:36:14 2012	(r242346)
+++ stable/9/contrib/libstdc++/include/std/std_sstream.h	Tue Oct 30 07:51:18 2012	(r242347)
@@ -240,10 +240,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       {
 	const bool __testin = _M_mode & ios_base::in;
 	if (this->pptr() && this->pptr() > this->egptr())
-	  if (__testin)
-	    this->setg(this->eback(), this->gptr(), this->pptr());
-	  else
-	    this->setg(this->pptr(), this->pptr(), this->pptr());
+	  {
+	    if (__testin)
+	      this->setg(this->eback(), this->gptr(), this->pptr());
+	    else
+	      this->setg(this->pptr(), this->pptr(), this->pptr());
+	  }
       }
     };
 

Modified: stable/9/contrib/libstdc++/libsupc++/tinfo.cc
==============================================================================
--- stable/9/contrib/libstdc++/libsupc++/tinfo.cc	Tue Oct 30 06:36:14 2012	(r242346)
+++ stable/9/contrib/libstdc++/libsupc++/tinfo.cc	Tue Oct 30 07:51:18 2012	(r242347)
@@ -499,9 +499,9 @@ __do_dyncast (ptrdiff_t src2dst,
           result.whole2dst =
               __sub_kind (result.whole2dst | result2.whole2dst);
         }
-      else if ((result.dst_ptr != 0 & result2.dst_ptr != 0)
-	       || (result.dst_ptr != 0 & result2_ambig)
-	       || (result2.dst_ptr != 0 & result_ambig))
+      else if ((result.dst_ptr != 0 && result2.dst_ptr != 0)
+	       || (result.dst_ptr != 0 && result2_ambig)
+	       || (result2.dst_ptr != 0 && result_ambig))
         {
           // Found two different DST_TYPE bases, or a valid one and a set of
           // ambiguous ones, must disambiguate. See whether SRC_PTR is

Modified: stable/9/contrib/libstdc++/src/locale.cc
==============================================================================
--- stable/9/contrib/libstdc++/src/locale.cc	Tue Oct 30 06:36:14 2012	(r242346)
+++ stable/9/contrib/libstdc++/src/locale.cc	Tue Oct 30 07:51:18 2012	(r242347)
@@ -146,7 +146,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   locale::_S_normalize_category(category __cat) 
   {
     int __ret = 0;
-    if (__cat == none || (__cat & all) && !(__cat & ~all))
+    if (__cat == none || ((__cat & all) && !(__cat & ~all)))
       __ret = __cat;
     else
       {

Modified: stable/9/contrib/libstdc++/src/strstream.cc
==============================================================================
--- stable/9/contrib/libstdc++/src/strstream.cc	Tue Oct 30 06:36:14 2012	(r242346)
+++ stable/9/contrib/libstdc++/src/strstream.cc	Tue Oct 30 07:51:18 2012	(r242347)
@@ -311,10 +311,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   strstreambuf::_M_free(char* p)
   {
     if (p)
-      if (_M_free_fun)
-	_M_free_fun(p);
-      else
-	delete[] p;
+      {
+	if (_M_free_fun)
+	  _M_free_fun(p);
+	else
+	  delete[] p;
+      }
   }
 
   void 

Modified: stable/9/contrib/libstdc++/src/tree.cc
==============================================================================
--- stable/9/contrib/libstdc++/src/tree.cc	Tue Oct 30 06:36:14 2012	(r242346)
+++ stable/9/contrib/libstdc++/src/tree.cc	Tue Oct 30 07:51:18 2012	(r242347)
@@ -316,17 +316,21 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 	  else
 	    __z->_M_parent->_M_right = __x;
 	if (__leftmost == __z) 
-	  if (__z->_M_right == 0)        // __z->_M_left must be null also
-	    __leftmost = __z->_M_parent;
-	// makes __leftmost == _M_header if __z == __root
-	  else
-	    __leftmost = _Rb_tree_node_base::_S_minimum(__x);
+	  {
+	    if (__z->_M_right == 0)        // __z->_M_left must be null also
+	      __leftmost = __z->_M_parent;
+	    // makes __leftmost == _M_header if __z == __root
+	    else
+	      __leftmost = _Rb_tree_node_base::_S_minimum(__x);
+	  }
 	if (__rightmost == __z)  
-	  if (__z->_M_left == 0)         // __z->_M_right must be null also
-	    __rightmost = __z->_M_parent;  
-	// makes __rightmost == _M_header if __z == __root
-	  else                      // __x == __z->_M_left
-	    __rightmost = _Rb_tree_node_base::_S_maximum(__x);
+	  {
+	    if (__z->_M_left == 0)         // __z->_M_right must be null also
+	      __rightmost = __z->_M_parent;  
+	    // makes __rightmost == _M_header if __z == __root
+	    else                      // __x == __z->_M_left
+	      __rightmost = _Rb_tree_node_base::_S_maximum(__x);
+	  }
       }
     if (__y->_M_color != _S_red) 
       { 

Modified: stable/9/gnu/lib/libstdc++/Makefile
==============================================================================
--- stable/9/gnu/lib/libstdc++/Makefile	Tue Oct 30 06:36:14 2012	(r242346)
+++ stable/9/gnu/lib/libstdc++/Makefile	Tue Oct 30 07:51:18 2012	(r242347)
@@ -22,7 +22,6 @@ CFLAGS+=	-I${GCCLIB}/include -I${SRCDIR}
 CFLAGS+=	-frandom-seed=RepeatabilityConsideredGood
 CXXFLAGS+=	-fno-implicit-templates -ffunction-sections -fdata-sections \
 		-Wno-deprecated
-CXXFLAGS:=	${CXXFLAGS:N-stdlib=libc++:N-std=c++[01][13x]:N-std=gnu++[01][13x]}
 PO_CXXFLAGS=	${CXXFLAGS:N-ffunction-sections}
 
 DPADD=		${LIBM}
@@ -626,3 +625,6 @@ ${VERSION_MAP}: ${SRCDIR}/config/abi/pre
 CLEANFILES+=	${VERSION_MAP}
 
 .include <bsd.lib.mk>
+
+# Filter out libc++-specific flags, and -std= flags above c++98 or gnu++98.
+CXXFLAGS:=	${CXXFLAGS:N-stdlib=libc++:N-std=c++[01][13x]:N-std=gnu++[01][13x]}

Modified: stable/9/gnu/lib/libsupc++/Makefile
==============================================================================
--- stable/9/gnu/lib/libsupc++/Makefile	Tue Oct 30 06:36:14 2012	(r242346)
+++ stable/9/gnu/lib/libsupc++/Makefile	Tue Oct 30 07:51:18 2012	(r242347)
@@ -24,7 +24,6 @@ CFLAGS+=	-I${GCCLIB}/include -I${SRCDIR}
 CFLAGS+=	-I${.CURDIR}/../libstdc++ -I.
 CFLAGS+=	-frandom-seed=RepeatabilityConsideredGood
 CXXFLAGS+=	-fno-implicit-templates -ffunction-sections -fdata-sections
-CXXFLAGS:=	${CXXFLAGS:N-stdlib=libc++:N-std=c++[01][13x]:N-std=gnu++[01][13x]}
 PO_CXXFLAGS=    ${CXXFLAGS:N-ffunction-sections}
 
 HDRS=	exception new typeinfo cxxabi.h exception_defines.h
@@ -43,3 +42,6 @@ VERSION_MAP=	${.CURDIR}/Version.map
 
 
 .include <bsd.lib.mk>
+
+# Filter out libc++-specific flags, and -std= flags above c++98 or gnu++98.
+CXXFLAGS:=	${CXXFLAGS:N-stdlib=libc++:N-std=c++[01][13x]:N-std=gnu++[01][13x]}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210300751.q9U7pIjf045573>