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]

libstdc++ fixes for h8300-elf


Since size_t is narrower than int, some type promotions that don't
cause conflicts on other ports break on h8300-elf.  This patch fixes
some problems that crept into libstdc++-v3 after I last fixed such
issues.  Ok to install?  Tested on i686-pc-linux-gnu native and cross
h8300-elf.

Index: libstdc++-v3/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* include/bits/istream.tcc (getline): Make sure arguments passed
	to min/max have the same type.
	* include/bits/locale_facets.tcc (__verify_grouping): Likewise.
	* include/bits/stl_deque.h (_Deque_base::_Deque_base): Likewise.

Index: libstdc++-v3/include/bits/istream.tcc
===================================================================
RCS file: /cvs/uberbaum/libstdc++-v3/include/bits/istream.tcc,v
retrieving revision 1.69
diff -u -p -r1.69 istream.tcc
--- libstdc++-v3/include/bits/istream.tcc 10 Jun 2004 19:54:59 -0000 1.69
+++ libstdc++-v3/include/bits/istream.tcc 21 Jun 2004 10:42:35 -0000
@@ -598,7 +598,8 @@ namespace std
 		{
 		  streamsize __size = std::min(streamsize(__sb->egptr()
 							  - __sb->gptr()),
-					       __n - _M_gcount - 1);
+					       streamsize(__n - _M_gcount
+							  - 1));
 		  if (__size > 1)
 		    {
 		      const char_type* __p = traits_type::find(__sb->gptr(),
Index: libstdc++-v3/include/bits/locale_facets.tcc
===================================================================
RCS file: /cvs/uberbaum/libstdc++-v3/include/bits/locale_facets.tcc,v
retrieving revision 1.194
diff -u -p -r1.194 locale_facets.tcc
--- libstdc++-v3/include/bits/locale_facets.tcc 14 Jun 2004 10:49:36 -0000 1.194
+++ libstdc++-v3/include/bits/locale_facets.tcc 21 Jun 2004 10:42:40 -0000
@@ -2448,7 +2448,7 @@ namespace std
 		    const string& __grouping_tmp)
   {
     const size_t __n = __grouping_tmp.size() - 1;
-    const size_t __min = std::min(__n, __grouping_size - 1);
+    const size_t __min = std::min(__n, size_t(__grouping_size - 1));
     size_t __i = __n;
     bool __test = true;
     
Index: libstdc++-v3/include/bits/stl_deque.h
===================================================================
RCS file: /cvs/uberbaum/libstdc++-v3/include/bits/stl_deque.h,v
retrieving revision 1.50
diff -u -p -r1.50 stl_deque.h
--- libstdc++-v3/include/bits/stl_deque.h 9 Jun 2004 21:37:46 -0000 1.50
+++ libstdc++-v3/include/bits/stl_deque.h 21 Jun 2004 10:42:40 -0000
@@ -446,7 +446,7 @@ namespace _GLIBCXX_STD
       size_t __num_nodes = __num_elements / __deque_buf_size(sizeof(_Tp)) + 1;
 
       this->_M_impl._M_map_size = std::max((size_t) _S_initial_map_size,
-				   __num_nodes + 2);
+				   size_t(__num_nodes + 2));
       this->_M_impl._M_map = _M_allocate_map(this->_M_impl._M_map_size);
 
       // For "small" maps (needing less than _M_map_size nodes), allocation
-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

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