Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Oct 2012 11:46:03 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Olivier Smedts <olivier@gid0.org>
Cc:        FreeBSD current mailing list <current@freebsd.org>
Subject:   Re: buildworld fails with clang, seems to be due to ATF import
Message-ID:  <5086675B.40907@FreeBSD.org>
In-Reply-To: <CABzXLYOvE8cZFZ25TkHGbpgy--oppadtn=2-kQFCx32P1GQbfg@mail.gmail.com>
References:  <CABzXLYOvE8cZFZ25TkHGbpgy--oppadtn=2-kQFCx32P1GQbfg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------080802080305050801040601
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

On 2012-10-23 11:21, Olivier Smedts wrote:
> I can't buildworld with clang anymore, tried with one job, error
> below. Sorry for the noise if that's a known problem.
...
> /usr/obj/usr/src/tmp/usr/include/c++/4.2/bits/streambuf_iterator.h:162:20:
> error: '&&' within '||' [-Werror,-Wlogical-op-parentheses]
>          return (__thiseof && __beof || (!__thiseof && !__beof));
>                  ~~~~~~~~~~^~~~~~~~~ ~~

Yes, these are several warnings in libstdc++ that should be fixed.  I
have a few patches ready to commit tonight.  Meanwhile, you can apply
the attached patch.

--------------080802080305050801040601
Content-Type: text/x-diff;
 name="fix-libstdcxx-warnings-1.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="fix-libstdcxx-warnings-1.diff"

Index: contrib/atf/atf-report/atf-report.cpp
===================================================================
--- contrib/atf/atf-report/atf-report.cpp	(revision 241921)
+++ contrib/atf/atf-report/atf-report.cpp	(working copy)
@@ -381,7 +381,6 @@ class ticker_writer : public writer {
 class xml_writer : public writer {
     ostream_ptr m_os;
 
-    size_t m_curtp, m_ntps;
     std::string m_tcname, m_tpname;
 
     static
Index: contrib/atf/atf-run/io.hpp
===================================================================
--- contrib/atf/atf-run/io.hpp	(revision 241921)
+++ contrib/atf/atf-run/io.hpp	(working copy)
@@ -378,11 +378,6 @@ class pistream :
     public std::istream, utils::noncopyable
 {
     //!
-    //! \brief The file handle managed by this stream.
-    //!
-    int m_fd;
-
-    //!
     //! \brief The systembuf object used to manage this stream's data.
     //!
     systembuf m_systembuf;
Index: contrib/libstdc++/config/os/bsd/freebsd/ctype_base.h
===================================================================
--- contrib/libstdc++/config/os/bsd/freebsd/ctype_base.h	(revision 241921)
+++ contrib/libstdc++/config/os/bsd/freebsd/ctype_base.h	(working copy)
@@ -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;
 
Index: contrib/libstdc++/include/bits/fstream.tcc
===================================================================
--- contrib/libstdc++/include/bits/fstream.tcc	(revision 241921)
+++ contrib/libstdc++/include/bits/fstream.tcc	(working copy)
@@ -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;
     }
 
Index: contrib/libstdc++/include/bits/locale_facets.h
===================================================================
--- contrib/libstdc++/include/bits/locale_facets.h	(revision 241921)
+++ contrib/libstdc++/include/bits/locale_facets.h	(working copy)
@@ -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;
   };
 
Index: contrib/libstdc++/include/bits/locale_facets.tcc
===================================================================
--- contrib/libstdc++/include/bits/locale_facets.tcc	(revision 241921)
+++ contrib/libstdc++/include/bits/locale_facets.tcc	(working copy)
@@ -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;
Index: contrib/libstdc++/include/bits/streambuf_iterator.h
===================================================================
--- contrib/libstdc++/include/bits/streambuf_iterator.h	(revision 241921)
+++ contrib/libstdc++/include/bits/streambuf_iterator.h	(working copy)
@@ -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:
Index: contrib/libstdc++/include/std/std_sstream.h
===================================================================
--- contrib/libstdc++/include/std/std_sstream.h	(revision 241921)
+++ contrib/libstdc++/include/std/std_sstream.h	(working copy)
@@ -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());
+	  }
       }
     };
 

--------------080802080305050801040601--



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