From 391cfc46896ec536a390f09b192b58c558e02b05 Mon Sep 17 00:00:00 2001
From: Paolo Carlini <pcarlini@unitus.it>
Date: Sun, 6 Jul 2003 11:37:11 +0200
Subject: [PATCH] locale_classes.h: Fully qualify standard functions with
 std::, thus avoiding Koenig lookup.

2003-07-06  Paolo Carlini  <pcarlini@unitus.it>

	* include/bits/locale_classes.h: Fully qualify standard
	functions with std::, thus avoiding Koenig lookup.
	* include/bits/locale_facets.tcc: Likewise.
	* src/locale.cc: Likewise.
	* src/localename.cc: Likewise.

From-SVN: r68997
---
 libstdc++-v3/ChangeLog                      |  8 ++
 libstdc++-v3/include/bits/locale_classes.h  |  2 +-
 libstdc++-v3/include/bits/locale_facets.tcc | 84 ++++++++++-----------
 libstdc++-v3/src/locale.cc                  | 34 ++++-----
 libstdc++-v3/src/localename.cc              | 22 +++---
 5 files changed, 79 insertions(+), 71 deletions(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index d0a0a7470d71..9ab1587ca0f5 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,11 @@
+2003-07-06  Paolo Carlini  <pcarlini@unitus.it>
+
+	* include/bits/locale_classes.h: Fully qualify standard
+	functions with std::, thus avoiding Koenig lookup.
+	* include/bits/locale_facets.tcc: Likewise.
+	* src/locale.cc: Likewise.
+	* src/localename.cc: Likewise.
+
 2003-07-06  Phil Edwards  <pme@gcc.gnu.org>
 
 	* include/bits/allocator_traits.h:  Fix doxygen markup.
diff --git a/libstdc++-v3/include/bits/locale_classes.h b/libstdc++-v3/include/bits/locale_classes.h
index 7949aa41532b..362e38f27670 100644
--- a/libstdc++-v3/include/bits/locale_classes.h
+++ b/libstdc++-v3/include/bits/locale_classes.h
@@ -386,7 +386,7 @@ namespace std
 	{
 	  delete [] _M_impl->_M_names[__i];
 	  char* __new = new char[2];
-	  strcpy(__new, "*");
+	  std::strcpy(__new, "*");
 	  _M_impl->_M_names[__i] = __new;
 	}
     }
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index 518f41ad0566..97cec3f313d0 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -229,7 +229,7 @@ namespace std
           // Add the ending grouping if a decimal wasn't found.
 	  if (!__found_dec)
 	    __found_grouping += static_cast<char>(__sep_pos);
-          if (!__verify_grouping(__grouping, __found_grouping))
+          if (!std::__verify_grouping(__grouping, __found_grouping))
 	    __err |= ios_base::failbit;
         }
 
@@ -380,7 +380,7 @@ namespace std
         {
           // Add the ending grouping.
           __found_grouping += static_cast<char>(__sep_pos);
-          if (!__verify_grouping(__grouping, __found_grouping))
+          if (!std::__verify_grouping(__grouping, __found_grouping))
 	    __err |= ios_base::failbit;
         }
 
@@ -409,7 +409,7 @@ namespace std
           __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);
 
 	  unsigned long __ul; 
-	  __convert_to_v(__xtrc.c_str(), __ul, __err, _S_c_locale, __base);
+	  std::__convert_to_v(__xtrc.c_str(), __ul, __err, _S_c_locale, __base);
 	  if (!(__err & ios_base::failbit) && __ul <= 1)
 	    __v = __ul;
 	  else 
@@ -470,7 +470,7 @@ namespace std
       string __xtrc;
       int __base;
       __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);
-      __convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale, __base);
+      std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale, __base);
       return __beg;
     }
 
@@ -484,7 +484,7 @@ namespace std
       int __base;
       __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);
       unsigned long __ul;
-      __convert_to_v(__xtrc.c_str(), __ul, __err, _S_c_locale, __base);
+      std::__convert_to_v(__xtrc.c_str(), __ul, __err, _S_c_locale, __base);
       if (!(__err & ios_base::failbit) 
 	  && __ul <= numeric_limits<unsigned short>::max())
 	__v = static_cast<unsigned short>(__ul);
@@ -503,7 +503,7 @@ namespace std
       int __base;
       __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);
       unsigned long __ul;
-      __convert_to_v(__xtrc.c_str(), __ul, __err, _S_c_locale, __base);
+      std::__convert_to_v(__xtrc.c_str(), __ul, __err, _S_c_locale, __base);
       if (!(__err & ios_base::failbit) 
 	  && __ul <= numeric_limits<unsigned int>::max())
 	__v = static_cast<unsigned int>(__ul);
@@ -521,7 +521,7 @@ namespace std
       string __xtrc;
       int __base;
       __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);
-      __convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale, __base);
+      std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale, __base);
       return __beg;
     }
 
@@ -535,7 +535,7 @@ namespace std
       string __xtrc;
       int __base;
       __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);
-      __convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale, __base);
+      std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale, __base);
       return __beg;
     }
 
@@ -548,7 +548,7 @@ namespace std
       string __xtrc;
       int __base;
       __beg = _M_extract_int(__beg, __end, __io, __err, __xtrc, __base);
-      __convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale, __base);
+      std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale, __base);
       return __beg;
     }
 #endif
@@ -562,7 +562,7 @@ namespace std
       string __xtrc;
       __xtrc.reserve(32);
       __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
-      __convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale);
+      std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale);
       return __beg;
     }
 
@@ -575,7 +575,7 @@ namespace std
       string __xtrc;
       __xtrc.reserve(32);
       __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
-      __convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale);
+      std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale);
       return __beg;
     }
 
@@ -588,7 +588,7 @@ namespace std
       string __xtrc;
       __xtrc.reserve(32);
       __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
-      __convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale);
+      std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_c_locale);
       return __beg;
     }
 
@@ -613,7 +613,7 @@ namespace std
       __io.flags(__fmt);
 
       unsigned long __ul;
-      __convert_to_v(__xtrc.c_str(), __ul, __err, _S_c_locale, __base);
+      std::__convert_to_v(__xtrc.c_str(), __ul, __err, _S_c_locale, __base);
       if (!(__err & ios_base::failbit))
 	__v = reinterpret_cast<void*>(__ul);
       else 
@@ -770,8 +770,8 @@ namespace std
 	    *(__new + 1) = *(__cs + 1);
 	  }
       _CharT* __p;
-      __p = __add_grouping(__new + __off, __sep, 
-			   __grouping.c_str(),
+      __p = std::__add_grouping(__new + __off, __sep, 
+				__grouping.c_str(),
 			   __grouping.c_str() + __grouping.size(),
 			   __cs + __off, __cs + __len);
       __len = __p - __new;
@@ -826,7 +826,7 @@ namespace std
 
 	// [22.2.2.2.2] Stage 4.
 	// Write resulting, fully-formatted string to output iterator.
-	return __write(__s, __cs, __len);
+	return std::__write(__s, __cs, __len);
       } 
 
   template<typename _CharT, typename _OutIter>
@@ -840,10 +840,10 @@ namespace std
       // Add grouping, if necessary. 
       _CharT* __p2;
       int __declen = __p ? __p - __cs : __len;
-      __p2 = __add_grouping(__new, __sep, 
-			    __grouping.c_str(),
-			    __grouping.c_str() + __grouping.size(),
-			    __cs, __cs + __declen);
+      __p2 = std::__add_grouping(__new, __sep, 
+				 __grouping.c_str(),
+				 __grouping.c_str() + __grouping.size(),
+				 __cs, __cs + __declen);
       
       // Tack on decimal part.
       int __newlen = __p2 - __new;
@@ -905,16 +905,16 @@ namespace std
 	char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
 
 	_S_format_float(__io, __fbuf, __mod);
-	__len = __convert_from_v(__cs, __cs_size, __fbuf, __v,
-				 _S_c_locale, __prec);
+	__len = std::__convert_from_v(__cs, __cs_size, __fbuf, __v,
+				      _S_c_locale, __prec);
 
 	// If the buffer was not large enough, try again with the correct size.
 	if (__len >= __cs_size)
 	  {
 	    __cs_size = __len + 1; 
 	    __cs = static_cast<char*>(__builtin_alloca(__cs_size));
-	    __len = __convert_from_v(__cs, __cs_size, __fbuf, __v,
-				     _S_c_locale, __prec);
+	    __len = std::__convert_from_v(__cs, __cs_size, __fbuf, __v,
+					  _S_c_locale, __prec);
 	  }
 #else
 	// Consider the possibility of long ios_base::fixed outputs
@@ -931,7 +931,7 @@ namespace std
 	char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
 
 	_S_format_float(__io, __fbuf, __mod);
-	__len = __convert_from_v(__cs, 0, __fbuf, __v, _S_c_locale, __prec);
+	__len = std::__convert_from_v(__cs, 0, __fbuf, __v, _S_c_locale, __prec);
 #endif
 
       // [22.2.2.2.2] Stage 2, convert to char_type, using correct
@@ -975,7 +975,7 @@ namespace std
       
       // [22.2.2.2.2] Stage 4.
       // Write resulting, fully-formatted string to output iterator.
-      return __write(__s, __ws, __len);
+      return std::__write(__s, __ws, __len);
       }
 
   template<typename _CharT, typename _OutIter>
@@ -1014,7 +1014,7 @@ namespace std
 	      __cs = __cs3;
 	    }
 	  __io.width(0);
-	  __s = __write(__s, __cs, __len);
+	  __s = std::__write(__s, __cs, __len);
 	}
       return __s;
     }
@@ -1100,7 +1100,7 @@ namespace std
       const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); 
       const _CharT* __wcs = __str.c_str();
       __ctype.narrow(__wcs, __wcs + __str.size() + 1, char(), __cs);      
-      __convert_to_v(__cs, __units, __err, _S_c_locale);
+      std::__convert_to_v(__cs, __units, __err, _S_c_locale);
       return __beg;
     }
 
@@ -1282,7 +1282,7 @@ namespace std
       // Test for grouping fidelity.
       if (__grouping.size() && __grouping_tmp.size())
 	{
-	  if (!__verify_grouping(__grouping, __grouping_tmp))
+	  if (!std::__verify_grouping(__grouping, __grouping_tmp))
 	    __testvalid = false;
 	}
 
@@ -1324,22 +1324,22 @@ namespace std
       // First try a buffer perhaps big enough.
       int __cs_size = 64;
       char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
-      int __len = __convert_from_v(__cs, __cs_size, "%.01Lf", __units, 
-				   _S_c_locale);
+      int __len = std::__convert_from_v(__cs, __cs_size, "%.01Lf", __units, 
+					_S_c_locale);
       // If the buffer was not large enough, try again with the correct size.
       if (__len >= __cs_size)
 	{
 	  __cs_size = __len + 1;
 	  __cs = static_cast<char*>(__builtin_alloca(__cs_size));
-	  __len = __convert_from_v(__cs, __cs_size, "%.01Lf", __units, 
-				   _S_c_locale);
+	  __len = std::__convert_from_v(__cs, __cs_size, "%.01Lf", __units, 
+					_S_c_locale);
 	}
 #else
       // max_exponent10 + 1 for the integer part, + 4 for sign, decimal point,
       // decimal digit, '\0'. 
       const int __cs_size = numeric_limits<long double>::max_exponent10 + 5;
       char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
-      int __len = __convert_from_v(__cs, 0, "%.01Lf", __units, _S_c_locale);
+      int __len = std::__convert_from_v(__cs, 0, "%.01Lf", __units, _S_c_locale);
 #endif
       _CharT* __ws = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) 
 							   * __cs_size));
@@ -1437,8 +1437,8 @@ namespace std
 		  const int __n = (__end - __beg) * 2;
 		  _CharT* __ws2 =
        	          static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __n));
-		  _CharT* __ws_end = __add_grouping(__ws2, __sep, __gbeg, 
-						    __gend, __beg, __end);
+		  _CharT* __ws_end = std::__add_grouping(__ws2, __sep, __gbeg, 
+							 __gend, __beg, __end);
 		  __value.insert(0, __ws2, __ws_end - __ws2);
 		}
 	      else
@@ -1505,7 +1505,7 @@ namespace std
 	    }
 
 	  // Write resulting, fully-formatted string to output iterator.
-	  __s = __write(__s, __res.c_str(), __len);
+	  __s = std::__write(__s, __res.c_str(), __len);
 	}
       __io.width(0);
       return __s; 
@@ -1958,7 +1958,7 @@ namespace std
       if (__i == 2 || __i == 4)
 	{
 	  long __l;
-	  __convert_to_v(__digits.c_str(), __l, __err, _S_c_locale);
+	  std::__convert_to_v(__digits.c_str(), __l, __err, _S_c_locale);
 	  if (!(__err & ios_base::failbit) && __l <= INT_MAX)
 	    {
 	      __l = __i == 2 ? __l : __l - 1900; 
@@ -2047,7 +2047,7 @@ namespace std
       __tp._M_put(__res, __maxlen, __fmt, __tm);
 
       // Write resulting, fully-formatted string to output iterator.
-      return __write(__s, __res, char_traits<char_type>::length(__res));
+      return std::__write(__s, __res, char_traits<char_type>::length(__res));
     }
 
 
@@ -2280,9 +2280,9 @@ namespace std
     {
       if (__last - __first > *__gbeg)
         {
-          __s = __add_grouping(__s,  __sep, 
-			       (__gbeg + 1 == __gend ? __gbeg : __gbeg + 1),
-			       __gend, __first, __last - *__gbeg);
+          __s = std::__add_grouping(__s,  __sep, 
+				    (__gbeg + 1 == __gend ? __gbeg : __gbeg + 1),
+				    __gend, __first, __last - *__gbeg);
           __first = __last - *__gbeg;
           *__s++ = __sep;
         }
diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc
index e10abee991c0..c6be06928ca1 100644
--- a/libstdc++-v3/src/locale.cc
+++ b/libstdc++-v3/src/locale.cc
@@ -176,18 +176,18 @@ namespace std
     if (__s)
       {
 	_S_initialize(); 
-	if (strcmp(__s, "C") == 0 || strcmp(__s, "POSIX") == 0)
+	if (std::strcmp(__s, "C") == 0 || std::strcmp(__s, "POSIX") == 0)
 	  (_M_impl = _S_classic)->_M_add_reference();
-	else if (strcmp(__s, "") != 0)
+	else if (std::strcmp(__s, "") != 0)
 	  _M_impl = new _Impl(__s, 1);
 	else
 	  {
 	    // Get it from the environment.
 	    char* __env = getenv("LC_ALL");
 	    // If LC_ALL is set we are done.
-	    if (__env && strcmp(__env, "") != 0)
+	    if (__env && std::strcmp(__env, "") != 0)
 	      {
-		if (strcmp(__env, "C") == 0 || strcmp(__env, "POSIX") == 0)
+		if (std::strcmp(__env, "C") == 0 || std::strcmp(__env, "POSIX") == 0)
 		  (_M_impl = _S_classic)->_M_add_reference();
 		else
 		  _M_impl = new _Impl(__env, 1);
@@ -197,8 +197,8 @@ namespace std
 		char* __res;
 		// LANG may set a default different from "C".
 		char* __env = getenv("LANG");
-		if (!__env || strcmp(__env, "") == 0 || strcmp(__env, "C") == 0
-		    || strcmp(__env, "POSIX") == 0)
+		if (!__env || std::strcmp(__env, "") == 0 || std::strcmp(__env, "C") == 0
+		    || std::strcmp(__env, "POSIX") == 0)
 		  __res = strdup("C");
 		else 
 		  __res = strdup(__env);
@@ -206,21 +206,21 @@ namespace std
 		// Scan the categories looking for the first one
 		// different from LANG.
 		size_t __i = 0;
-		if (strcmp(__res, "C") == 0)
+		if (std::strcmp(__res, "C") == 0)
 		  for (; __i < _S_categories_size; ++__i)
 		    {
 		      __env = getenv(_S_categories[__i]);
-		      if (__env && strcmp(__env, "") != 0 
-			  && strcmp(__env, "C") != 0 
-			  && strcmp(__env, "POSIX") != 0) 
+		      if (__env && std::strcmp(__env, "") != 0 
+			  && std::strcmp(__env, "C") != 0 
+			  && std::strcmp(__env, "POSIX") != 0) 
 			break;
 		    }
 		else
 		  for (; __i < _S_categories_size; ++__i)
 		    {
 		      __env = getenv(_S_categories[__i]);
-		      if (__env && strcmp(__env, "") != 0 
-			  && strcmp(__env, __res) != 0) 
+		      if (__env && std::strcmp(__env, "") != 0 
+			  && std::strcmp(__env, __res) != 0) 
 			break;
 		    }
 	
@@ -244,15 +244,15 @@ namespace std
 		    for (; __i < _S_categories_size; ++__i)
 		      {
 			__env = getenv(_S_categories[__i]);
-			if (!__env || strcmp(__env, "") == 0)
+			if (!__env || std::strcmp(__env, "") == 0)
 			  {
 			    __str += _S_categories[__i];
 			    __str += '=';
 			    __str += __res;
 			    __str += ';';
 			  }
-			else if (strcmp(__env, "C") == 0
-				 || strcmp(__env, "POSIX") == 0)
+			else if (std::strcmp(__env, "C") == 0
+				 || std::strcmp(__env, "POSIX") == 0)
 			  {
 			    __str += _S_categories[__i];
 			    __str += "=C;";
@@ -270,7 +270,7 @@ namespace std
 		  }
 		// ... otherwise either an additional instance of
 		// the "C" locale or LANG.
-		else if (strcmp(__res, "C") == 0)
+		else if (std::strcmp(__res, "C") == 0)
 		  (_M_impl = _S_classic)->_M_add_reference();
 		else
 		  _M_impl = new _Impl(__res, 1);
@@ -323,7 +323,7 @@ namespace std
     __other._M_impl->_M_add_reference();
     _S_global = __other._M_impl; 
     if (_S_global->_M_check_same_name() 
-	&& (strcmp(_S_global->_M_names[0], "*") != 0))
+	&& (std::strcmp(_S_global->_M_names[0], "*") != 0))
       setlocale(LC_ALL, __other.name().c_str());
 
     // Reference count sanity check: one reference removed for the
diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc
index 3f4d18d1af99..0a2ef129f4e0 100644
--- a/libstdc++-v3/src/localename.cc
+++ b/libstdc++-v3/src/localename.cc
@@ -150,7 +150,7 @@ namespace std
     for (size_t __i = 0; __i < _S_categories_size; ++__i)
       {
 	char* __new = new char[strlen(__imp._M_names[__i]) + 1];
-	strcpy(__new, __imp._M_names[__i]);
+	std::strcpy(__new, __imp._M_names[__i]);
 	_M_names[__i] = __new;
       }
   }
@@ -199,13 +199,13 @@ namespace std
 	delete [] _M_names;
 	__throw_exception_again;
       }
-    size_t __len = strlen(__s);
-    if (!strchr(__s, ';'))
+    size_t __len = std::strlen(__s);
+    if (!std::strchr(__s, ';'))
       {
 	for (size_t __i = 0; __i < _S_categories_size; ++__i)
 	  {
 	    _M_names[__i] = new char[__len + 1];
-	    strcpy(_M_names[__i], __s);
+	    std::strcpy(_M_names[__i], __s);
 	  }
       }
     else
@@ -213,12 +213,12 @@ namespace std
 	const char* __beg = __s;
 	for (size_t __i = 0; __i < _S_categories_size; ++__i)
 	  {
-	    __beg = strchr(__beg, '=') + 1;
-	    const char* __end = strchr(__beg, ';');
+	    __beg = std::strchr(__beg, '=') + 1;
+	    const char* __end = std::strchr(__beg, ';');
 	    if (!__end)
 	      __end = __s + __len;
 	    char* __new = new char[__end - __beg + 1];
-	    memcpy(__new, __beg, __end - __beg);
+	    std::memcpy(__new, __beg, __end - __beg);
 	    __new[__end - __beg] = '\0';
 	    _M_names[__i] = __new;
 	  }
@@ -355,12 +355,12 @@ namespace std
 	    // Need to replace entry in _M_facets with other locale's info.
 	    _M_replace_category(__imp, _S_facet_categories[__ix]);
 	    // If both have names, go ahead and mangle.
-	    if (strcmp(_M_names[__ix], "*") != 0 
-		&& strcmp(__imp->_M_names[__ix], "*") != 0)
+	    if (std::strcmp(_M_names[__ix], "*") != 0 
+		&& std::strcmp(__imp->_M_names[__ix], "*") != 0)
 	      {
 		delete [] _M_names[__ix];
-		char* __new = new char[strlen(__imp->_M_names[__ix]) + 1];
-		strcpy(__new, __imp->_M_names[__ix]);
+		char* __new = new char[std::strlen(__imp->_M_names[__ix]) + 1];
+		std::strcpy(__new, __imp->_M_names[__ix]);
 		_M_names[__ix] = __new;
 	      }
 	  }
-- 
GitLab