Commit 1f34d121 by Benjamin Kosnik Committed by Benjamin Kosnik

re PR libstdc++/16678 (warning: suggest parentheses around assignment used as truth value)


2004-07-23  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/16678
	* include/bits/locale_facets.tcc: Fix for -Werror.

From-SVN: r85103
parent 0e7d217a
2004-07-23 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/16678
* include/bits/locale_facets.tcc: Fix for -Werror.
2004-07-23 Jonathan Wakely <redi@gcc.gnu.org> 2004-07-23 Jonathan Wakely <redi@gcc.gnu.org>
* docs/html/debug.html: Say debug mode only available since 3.4.0. * docs/html/debug.html: Say debug mode only available since 3.4.0.
......
...@@ -325,12 +325,12 @@ namespace std ...@@ -325,12 +325,12 @@ namespace std
__found_grouping.reserve(32); __found_grouping.reserve(32);
int __sep_pos = 0; int __sep_pos = 0;
const char_type* __lit_zero = __lit + __num_base::_S_izero; const char_type* __lit_zero = __lit + __num_base::_S_izero;
const char_type* __q;
while (__beg != __end) while (__beg != __end)
{ {
// According to 22.2.2.1.2, p8-9, first look for thousands_sep // According to 22.2.2.1.2, p8-9, first look for thousands_sep
// and decimal_point. // and decimal_point.
const char_type __c = *__beg; const char_type __c = *__beg;
const char_type* __q = __traits_type::find(__lit_zero, 10, __c);
if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
{ {
if (!__found_dec && !__found_sci) if (!__found_dec && !__found_sci)
...@@ -368,7 +368,7 @@ namespace std ...@@ -368,7 +368,7 @@ namespace std
else else
break; break;
} }
else if (__q = __traits_type::find(__lit_zero, 10, __c)) else if (__q != 0)
{ {
__xtrc += __num_base::_S_atoms_in[__q - __lit]; __xtrc += __num_base::_S_atoms_in[__q - __lit];
__found_mantissa = true; __found_mantissa = true;
...@@ -508,7 +508,6 @@ namespace std ...@@ -508,7 +508,6 @@ namespace std
bool __overflow = false; bool __overflow = false;
_ValueT __result = 0; _ValueT __result = 0;
const char_type* __lit_zero = __lit + __num_base::_S_izero; const char_type* __lit_zero = __lit + __num_base::_S_izero;
const char_type* __q;
if (__negative) if (__negative)
{ {
const _ValueT __min = numeric_limits<_ValueT>::min() / __base; const _ValueT __min = numeric_limits<_ValueT>::min() / __base;
...@@ -517,6 +516,8 @@ namespace std ...@@ -517,6 +516,8 @@ namespace std
// According to 22.2.2.1.2, p8-9, first look for thousands_sep // According to 22.2.2.1.2, p8-9, first look for thousands_sep
// and decimal_point. // and decimal_point.
const char_type __c = *__beg; const char_type __c = *__beg;
const char_type* __q = __traits_type::find(__lit_zero,
__len, __c);
if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
{ {
// NB: Thousands separator at the beginning of a string // NB: Thousands separator at the beginning of a string
...@@ -534,7 +535,7 @@ namespace std ...@@ -534,7 +535,7 @@ namespace std
} }
else if (__c == __lc->_M_decimal_point) else if (__c == __lc->_M_decimal_point)
break; break;
else if (__q = __traits_type::find(__lit_zero, __len, __c)) else if (__q != 0)
{ {
int __digit = __q - __lit_zero; int __digit = __q - __lit_zero;
if (__digit > 15) if (__digit > 15)
...@@ -562,6 +563,8 @@ namespace std ...@@ -562,6 +563,8 @@ namespace std
for (; __beg != __end; ++__beg) for (; __beg != __end; ++__beg)
{ {
const char_type __c = *__beg; const char_type __c = *__beg;
const char_type* __q = __traits_type::find(__lit_zero,
__len, __c);
if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
{ {
if (__sep_pos) if (__sep_pos)
...@@ -577,7 +580,7 @@ namespace std ...@@ -577,7 +580,7 @@ namespace std
} }
else if (__c == __lc->_M_decimal_point) else if (__c == __lc->_M_decimal_point)
break; break;
else if (__q = __traits_type::find(__lit_zero, __len, __c)) else if (__q != 0)
{ {
int __digit = __q - __lit_zero; int __digit = __q - __lit_zero;
if (__digit > 15) if (__digit > 15)
...@@ -1119,8 +1122,8 @@ namespace std ...@@ -1119,8 +1122,8 @@ namespace std
// Replace decimal point. // Replace decimal point.
const _CharT __cdec = __ctype.widen('.'); const _CharT __cdec = __ctype.widen('.');
const _CharT __dec = __lc->_M_decimal_point; const _CharT __dec = __lc->_M_decimal_point;
const _CharT* __p; const _CharT* __p = char_traits<_CharT>::find(__ws, __len, __cdec);
if (__p = char_traits<_CharT>::find(__ws, __len, __cdec)) if (__p)
__ws[__p - __ws] = __dec; __ws[__p - __ws] = __dec;
// Add grouping, if necessary. // Add grouping, if necessary.
...@@ -1294,7 +1297,6 @@ namespace std ...@@ -1294,7 +1297,6 @@ namespace std
__res.reserve(32); __res.reserve(32);
const char_type* __lit_zero = __lit + money_base::_S_zero; const char_type* __lit_zero = __lit + money_base::_S_zero;
const char_type* __q;
const money_base::pattern __p = __lc->_M_neg_format; const money_base::pattern __p = __lc->_M_neg_format;
for (int __i = 0; __i < 4 && __testvalid; ++__i) for (int __i = 0; __i < 4 && __testvalid; ++__i)
{ {
...@@ -1356,35 +1358,40 @@ namespace std ...@@ -1356,35 +1358,40 @@ namespace std
// Extract digits, remove and stash away the // Extract digits, remove and stash away the
// grouping of found thousands separators. // grouping of found thousands separators.
for (; __beg != __end; ++__beg) for (; __beg != __end; ++__beg)
if (__q = __traits_type::find(__lit_zero, 10, *__beg)) {
{ const char_type* __q = __traits_type::find(__lit_zero,
__res += money_base::_S_atoms[__q - __lit]; 10, *__beg);
++__n; if (__q != 0)
} {
else if (*__beg == __lc->_M_decimal_point && !__testdecfound) __res += money_base::_S_atoms[__q - __lit];
{ ++__n;
__last_pos = __n; }
__n = 0; else if (*__beg == __lc->_M_decimal_point
__testdecfound = true; && !__testdecfound)
} {
else if (__lc->_M_use_grouping __last_pos = __n;
&& *__beg == __lc->_M_thousands_sep __n = 0;
&& !__testdecfound) __testdecfound = true;
{ }
if (__n) else if (__lc->_M_use_grouping
{ && *__beg == __lc->_M_thousands_sep
// Mark position for later analysis. && !__testdecfound)
__grouping_tmp += static_cast<char>(__n); {
__n = 0; if (__n)
} {
else // Mark position for later analysis.
{ __grouping_tmp += static_cast<char>(__n);
__testvalid = false; __n = 0;
break; }
} else
} {
else __testvalid = false;
break; break;
}
}
else
break;
}
if (__res.empty()) if (__res.empty())
__testvalid = false; __testvalid = false;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment