aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2006-12-14 05:49:06 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2006-12-14 05:49:06 +0000
commit2a67bec24f6c82008acbe9138515a541edc10f7e (patch)
tree50f6bb9f779d4a706c820c0da135fd92bcd9c11a /libstdc++-v3
parent73f30c6308cc7e246841e83969a1f4551bac3d3d (diff)
downloadgcc-2a67bec24f6c82008acbe9138515a541edc10f7e.zip
gcc-2a67bec24f6c82008acbe9138515a541edc10f7e.tar.gz
gcc-2a67bec24f6c82008acbe9138515a541edc10f7e.tar.bz2
re PR c++/19564 (-Wparentheses does not work with the C++ front-end)
PR c++/19564 PR c++/19756 gcc/: * c-typeck.c (parser_build_binary_op): Move parentheses warnings to warn_about_parentheses in c-common.c. * c-common.c (warn_about_parentheses): New function. * c-common.h (warn_about_parentheses): Declare. * doc/invoke.texi (Warning Options): Update -Wparentheses description. gcc/cp/: * parser.c (cp_parser_expression_stack_entry): Add field lhs_type. (cp_parser_binary_expression): Track tree code of left hand side of expression. Use it when calling build_x_binary_op. (cp_parser_selection_statement): Add if_p parameter. Change all callers. Warn about ambiguous else. (cp_parser_statement): Add if_p parameter. Change all callers. (cp_parser_implicitly_scoped_statement): Likewise. * typeck.c (build_x_binary_op): Add parameters arg1_code and arg2_code. Change all callers. Call warn_about_parentheses. * cp-tree.h (build_x_binary_op): Update declaration. gcc/testsuite/: * g++.dg/warn/Wparentheses-5.C: New test. * g++.dg/warn/Wparentheses-6.C: New test. * g++.dg/warn/Wparentheses-7.C: New test. * g++.dg/warn/Wparentheses-8.C: New test. * g++.dg/warn/Wparentheses-9.C: New test. * g++.dg/warn/Wparentheses-10.C: New test. * g++.dg/warn/Wparentheses-11.C: New test. * g++.dg/warn/Wparentheses-12.C: New test. * g++.dg/warn/Wparentheses-13.C: New test. * g++.dg/warn/Wparentheses-14.C: New test. * g++.dg/warn/Wparentheses-15.C: New test. * g++.dg/warn/Wparentheses-16.C: New test. * g++.dg/warn/Wparentheses-17.C: New test. * g++.dg/warn/Wparentheses-18.C: New test. * g++.dg/warn/Wparentheses-19.C: New test. * g++.dg/warn/Wparentheses-20.C: New test. * g++.dg/warn/Wparentheses-21.C: New test. libstdc++-v3/: * include/bits/locale_facets.tcc (num_get<>::_M_extract_float): Add parentheses around && within || to avoid warning. (num_get<>::_M_extract_int): Likewise. (money_get<>::_M_extract): Likewise. (num_get<>::do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, void*&)): Add parentheses around & within | to avoid warning. (num_put<>::do_put(iter_type, ios_base&, char_type, const void*)): Likewise. * include/bits/streambuf_iterator.h (istreambuf_iterator::equal): Add parentheses around && within || to avoid warning. * libsupc++/tinfo.cc (__do_dyncast): Likewise. * src/locale.cc (locale::_S_normalize_category): Likewise. * include/bits/stl_tree.h (_Rb_tree<>::_M_insert_unique): Add braces to avoid ambiguous else warning. * src/strstream.cc (strstreambuf::_M_free): Likewise. * src/tree.cc (_Rb_tree_rebalance_for_erase): Likewise. From-SVN: r119855
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog22
-rw-r--r--libstdc++-v3/include/bits/locale_facets.tcc14
-rw-r--r--libstdc++-v3/include/bits/stl_tree.h10
-rw-r--r--libstdc++-v3/include/bits/streambuf_iterator.h2
-rw-r--r--libstdc++-v3/libsupc++/tinfo.cc6
-rw-r--r--libstdc++-v3/src/locale.cc2
-rw-r--r--libstdc++-v3/src/strstream.cc10
-rw-r--r--libstdc++-v3/src/tree.cc24
8 files changed, 60 insertions, 30 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index dd70b8e..5b692ea 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,25 @@
+2006-12-13 Ian Lance Taylor <iant@google.com>
+
+ PR c++/19564
+ PR c++/19756
+ * include/bits/locale_facets.tcc (num_get<>::_M_extract_float):
+ Add parentheses around && within || to avoid warning.
+ (num_get<>::_M_extract_int): Likewise.
+ (money_get<>::_M_extract): Likewise.
+ (num_get<>::do_get(iter_type, iter_type, ios_base&,
+ ios_base::iostate&, void*&)): Add parentheses around & within | to
+ avoid warning.
+ (num_put<>::do_put(iter_type, ios_base&, char_type, const void*)):
+ Likewise.
+ * include/bits/streambuf_iterator.h (istreambuf_iterator::equal):
+ Add parentheses around && within || to avoid warning.
+ * libsupc++/tinfo.cc (__do_dyncast): Likewise.
+ * src/locale.cc (locale::_S_normalize_category): Likewise.
+ * include/bits/stl_tree.h (_Rb_tree<>::_M_insert_unique): Add
+ braces to avoid ambiguous else warning.
+ * src/strstream.cc (strstreambuf::_M_free): Likewise.
+ * src/tree.cc (_Rb_tree_rebalance_for_erase): Likewise.
+
2006-12-12 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/28265
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index d3c47ff..1eba5ae 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -314,7 +314,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])
@@ -556,7 +556,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]
@@ -883,7 +883,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
// Prepare for hex formatted input.
typedef ios_base::fmtflags fmtflags;
const fmtflags __fmt = __io.flags();
- __io.flags(__fmt & ~ios_base::basefield | ios_base::hex);
+ __io.flags((__fmt & ~ios_base::basefield) | ios_base::hex);
unsigned long __ul;
__beg = _M_extract_int(__beg, __end, __io, __err, __ul);
@@ -1305,7 +1305,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
const ios_base::fmtflags __fmt = ~(ios_base::basefield
| ios_base::uppercase
| ios_base::internal);
- __io.flags(__flags & __fmt | (ios_base::hex | ios_base::showbase));
+ __io.flags((__flags & __fmt) | (ios_base::hex | ios_base::showbase));
__s = _M_insert_int(__s, __io, __fill,
reinterpret_cast<unsigned long>(__v));
@@ -1377,9 +1377,9 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
== money_base::space)))
|| (__i == 2 && ((static_cast<part>(__p.field[3])
== money_base::value)
- || __mandatory_sign
- && (static_cast<part>(__p.field[3])
- == money_base::sign))))
+ || (__mandatory_sign
+ && (static_cast<part>(__p.field[3])
+ == money_base::sign)))))
{
const size_type __len = __lc->_M_curr_symbol_size;
size_type __j = 0;
diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h
index d2efb3a..bbfb252 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -1055,10 +1055,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
iterator __j = iterator(__y);
if (__comp)
- if (__j == begin())
- return pair<iterator, bool>(_M_insert_(__x, __y, __v), true);
- else
- --__j;
+ {
+ if (__j == begin())
+ return pair<iterator, bool>(_M_insert_(__x, __y, __v), true);
+ else
+ --__j;
+ }
if (_M_impl._M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__v)))
return pair<iterator, bool>(_M_insert_(__x, __y, __v), true);
return pair<iterator, bool>(__j, false);
diff --git a/libstdc++-v3/include/bits/streambuf_iterator.h b/libstdc++-v3/include/bits/streambuf_iterator.h
index a1cf234..c743bb3 100644
--- a/libstdc++-v3/include/bits/streambuf_iterator.h
+++ b/libstdc++-v3/include/bits/streambuf_iterator.h
@@ -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:
diff --git a/libstdc++-v3/libsupc++/tinfo.cc b/libstdc++-v3/libsupc++/tinfo.cc
index a153c2d4..89d9e16 100644
--- a/libstdc++-v3/libsupc++/tinfo.cc
+++ b/libstdc++-v3/libsupc++/tinfo.cc
@@ -490,9 +490,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
diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc
index 12070eb..a760994 100644
--- a/libstdc++-v3/src/locale.cc
+++ b/libstdc++-v3/src/locale.cc
@@ -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
{
diff --git a/libstdc++-v3/src/strstream.cc b/libstdc++-v3/src/strstream.cc
index 5bbb33a4..f221454 100644
--- a/libstdc++-v3/src/strstream.cc
+++ b/libstdc++-v3/src/strstream.cc
@@ -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
diff --git a/libstdc++-v3/src/tree.cc b/libstdc++-v3/src/tree.cc
index 38a3037..b23ca8e 100644
--- a/libstdc++-v3/src/tree.cc
+++ b/libstdc++-v3/src/tree.cc
@@ -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)
{