2009-09-13  Martin Sebor  <sebor@apache.org>

	Merged revs 814395, 814400, 814401, 814405, and 814409 from
	branches/4.2.x.

	2009-09-13  Martin Sebor  <sebor@apache.org>

	* tests/regress/23.vector.stdcxx-1037.cpp (Alloc::Alloc(const Alloc&)):
	Corrected syntax to prevent compiler errors. (Does a recent version of
	any compiler actually allow this? Maybe Visual C++?)

	2009-09-13  Martin Sebor  <sebor@apache.org>

	STDCXX-791
	* include/deque.cc (deque::_C_push): Parenthesized logic
	expression to silence gcc -Wparentheses warning.
	* include/list.cc (list::splice): Same.
	* valarray (valarray::valarray(const gslice_array&,
	gslice_array::operator=, gslice_array::operator*=,
	gslice_array::operator/=, gslice_array::operator+=,
	gslice_array::operator-=, gslice_array::operator%=,
	gslice_array::operator^=, gslice_array::operator&=,
	gslice_array::operator|=, gslice_array::operator<<=,
	gslice_array::operator>>=): Same.
	* tests/iostream/27.filebuf.cpp (CodeCvt::do_in): Same.
	* tests/numerics/26.c.math.cp (test_behavior): Same.
	* tests/src/locale.cpp (rw_get_wchars): Same.
	* (UserTraits::lt, UserTraits::compare, UserTraits::copy,
	UserTraits::move): Same.
	* tests/src/cmdopt.cpp (_rw_print_help, _rw_getbounds, rw_runopts):
	Same.
	* tests/src/23.containers.cpp (_rw_sigcat): Same.
	* tests/src/opt_lines.cpp (_rw_enable_line): Same.
	* tests/src/printf.cpp (_rw_fmtstrarray, _rw_vasnprintf_ext,
	_rw_fmtstr): Same.
	* tests/src/opt_trace.cpp (_rw_setopt_trace_mask): Same.
	* tests/localization/22.locale.num.put.cpp (do_test): Same.
	* tests/localization/22.locale.messages.cpp (open_catalog): Same.
	* tests/localization/22.locale.numpunct.cpp (check_numpunct): Same.
	* tests/localization/22.locale.time.get.cpp (do_test): Same.
	* tests/localization/22.locale.money.get.cpp (do_test): Same.
	* tests/localization/22.locale.num.get.cpp (do_test): Same.
	* tests/self/0.fnmatch.cpp (test): Same.
	* tests/strings/21.string.compare.cpp (test_compare): Same.
	* tests/strings/21.string.io.cpp (test_io): Same.
	* tests/containers/23.vector.cons.cpp (test_ctors): Same.
	* tests/algorithms/25.equal.cpp (test_equal): Same.
	* tests/algorithms/25.transform.cpp (gen_test): Same.
	* tests/algorithms/25.replace.cpp (test_replace): Same.
	* util/collate.cpp (Def::process_order_stmt): Same.
	* examples/tutorial/icecream.cpp (irand): Same.
	* tests/support/18.numeric.special.float.cpp (VERIFY_FUNCTION): Same.
	* tests/iostream/27.filebuf.codecvt.cpp (cformat::do_in): Same.
	(run_test): Changed the type of a local to silence gcc's
	-Wsign-compare warnings.
	* include/rw/_ioiter.h (istreambuf_iterator::equal): Simplified
	expression to silence gcc -Wparentheses warning and to help gcc
	generate more optimal code (see
	http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38126).
	* tests/iostream/27.istream.sentry.cpp (test_ok): Same.

	2009-09-13  Martin Sebor  <sebor@apache.org>

	STDCXX-791
	* include/valarray (valarray::valarray(const gslice_array&,
	gslice_array::operator=, gslice_array::operator*=,
	gslice_array::operator/=, gslice_array::operator+=,
	gslice_array::operator-=, gslice_array::operator%=,
	gslice_array::operator^=, gslice_array::operator&=,
	gslice_array::operator|=, gslice_array::operator<<=,
	gslice_array::operator>>=): Parenthesized logic expression
	to silence gcc -Wparentheses warning. (Missed in r814400).

	2009-09-13  Martin Sebor  <sebor@apache.org>

	STDCXX-791
	* tests/src/char.cpp (UserTraits::lt, UserTraits::compare,
	UserTraits::copy, UserTraits::move): Parenthesized logic expression
	to silence gcc -Wparentheses warning. (Missed in r814400).

	2009-09-13  Martin Sebor  <sebor@apache.org>

	* tests/localization/22.locale.ctype.tolower.cpp (locale_list): Removed
	unused global variable to silence gcc -Wshadow warnings.
	* tests/localization/22.locale.messages.mt.cpp (run_test): Silenced
	gcc's -Wunused warning, corrected a logic error in a preprocessor
	conditional and fixed a typo.
	* tests/localization/22.locale.statics.mt.cpp (test_global): Changed
	type of a local variable to avoid gcc's -Wsign-compare warnings.
	* tests/regress/22.locale.messages.stdcxx-542.cpp (run_test): Same.
	* tests/containers/23.bitset.cpp (test_ctors, stress_ctors,
	test_operators, test_other, stress_count, test_elem_access,
	test_to_string): Corrected formatting directive for size_t argument.
	* tests/regress/23.set.stdcxx-216.cpp (Value::Value(unsigned): Renamed
	a function formal argument to avoid a gcc -Wshadow warning. Removed
	commented out debugging code.
	* tests/regress/21.string.append.stdcxx-438.cpp (operator new): Threw
	std::bad_alloc on failure as required instead of returning null to
	silence a gcc warning.
	* tests/regress/21.string.replace.stdcxx-175.cpp (main): Removed
	unused arguments to silence gcc -Wunused warnings.
	* tests/regress/23.list.special.stdcxx-334.cpp (operator==, operator!=,
	main): Same.
	* tests/regress/23.list.insert.stdcxx-331.cpp (main): Same.
	* tests/regress/21.string.stdcxx-466.cpp (main): Same.
	* tests/regress/23.list.cons.stdcxx-268.cpp (main): Same.
	* util/locale.cpp (write_coll_info): Removed an empty else branch
	to silence a gcc -Wmissing-braces warning.
	* util/exec.cpp (wait_for_child): Added braces to silence a gcc
	-Wmissing-braces warning.


git-svn-id: https://svn.apache.org/repos/asf/stdcxx/trunk@814419 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/examples/tutorial/icecream.cpp b/examples/tutorial/icecream.cpp
index aae9bb8..f7ceefc 100644
--- a/examples/tutorial/icecream.cpp
+++ b/examples/tutorial/icecream.cpp
@@ -141,7 +141,8 @@
 
     std::random_shuffle (seq, seq + sizeof seq / sizeof *seq);
 
-    const int rnd = (seq [0] << 11) | (seq [1] << 8) | (seq [2] << 4) + seq [3];
+    const int rnd =
+        ((seq [0] << 11) | (seq [1] << 8) | (seq [2] << 4)) + seq [3];
 
     return rnd % n;
 }
diff --git a/include/deque.cc b/include/deque.cc
index 427366c..d522934 100644
--- a/include/deque.cc
+++ b/include/deque.cc
@@ -233,8 +233,8 @@
     const bool __empty = empty ();
 
     if (   __empty
-        || __at_back && _C_end._C_node == _C_nodes + _C_node_size - 1
-        || !__at_back && _C_beg._C_node == _C_nodes) {
+        || (__at_back && _C_end._C_node == _C_nodes + _C_node_size - 1)
+        || (!__at_back && _C_beg._C_node == _C_nodes)) {
 
         _C_node_alloc_type __node_alloc (*this);
 
diff --git a/include/list.cc b/include/list.cc
index c6cfcc6..ff389f9 100644
--- a/include/list.cc
+++ b/include/list.cc
@@ -286,7 +286,7 @@
     _RWSTD_ASSERT_RANGE (__j, __k);
 
     // 23.2.2.4, p12 - check undefined behavior
-    _RWSTD_ASSERT (&__x != this || __i != __j && __i != __k);
+    _RWSTD_ASSERT (&__x != this || (__i != __j && __i != __k));
 
     if (__j == __k)
         return;
diff --git a/include/rw/_ioiter.h b/include/rw/_ioiter.h
index 5493a82..d7d0302 100644
--- a/include/rw/_ioiter.h
+++ b/include/rw/_ioiter.h
@@ -190,7 +190,7 @@
     const bool __eof_rhs =
         !__rhs._C_sb || traits_type::eq_int_type (__rhs._C_sb->sgetc(), __eof);
 
-    return __eof_lhs && __eof_rhs || !__eof_lhs && !__eof_rhs;
+    return __eof_lhs == __eof_rhs;
 }
 
 
diff --git a/include/valarray b/include/valarray
index abca28a..b387808 100644
--- a/include/valarray
+++ b/include/valarray
@@ -1856,8 +1856,8 @@
     _RWSTD_SIZE_T __i = gsl->next_ind();
     _RWSTD_SIZE_T __cpt = 0;
 
-    while( (!gsl->is_reseted() || !__cpt && gsl->ind_numb()) && __cpt < __rhs.size() )
-    {
+    while (   (!gsl->is_reseted () || (!__cpt && gsl->ind_numb ()))
+           && __cpt < __rhs.size ()) {
       (*_C_array)[__i] = __rhs[__cpt];
       __i= gsl->next_ind();
       __cpt++;
@@ -1871,8 +1871,7 @@
     _RWSTD_SIZE_T __i = gsl->next_ind();
     _RWSTD_SIZE_T __cpt = 0;
 
-    while( !gsl->is_reseted() || !__cpt && gsl->ind_numb() )
-    {
+    while (!gsl->is_reseted () || (!__cpt && gsl->ind_numb ())) {
       (*_C_array)[__i] = value;
       __i= gsl->next_ind();
       __cpt++;
@@ -1889,8 +1888,8 @@
     _RWSTD_SIZE_T __i = gsl->next_ind();
     _RWSTD_SIZE_T __cpt = 0;
 
-    while( (!gsl->is_reseted() || !__cpt && gsl->ind_numb()) && __cpt < __rhs.size() )
-    {
+    while (   (!gsl->is_reseted () || (!__cpt && gsl->ind_numb ()))
+           && __cpt < __rhs.size ()) {
       (*_C_array)[__i] *= __rhs[__cpt];
       __i= gsl->next_ind();
       __cpt++;
@@ -1904,8 +1903,8 @@
     _RWSTD_SIZE_T __i = gsl->next_ind();
     _RWSTD_SIZE_T __cpt = 0;
 
-    while( (!gsl->is_reseted() || !__cpt && gsl->ind_numb()) && __cpt < __rhs.size() )
-    {
+    while (   (!gsl->is_reseted () || (!__cpt && gsl->ind_numb ()))
+           && __cpt < __rhs.size ()) {
       (*_C_array)[__i] /= __rhs[__cpt];
       __i= gsl->next_ind();
       __cpt++;
@@ -1919,8 +1918,8 @@
     _RWSTD_SIZE_T __i = gsl->next_ind();
     _RWSTD_SIZE_T __cpt = 0;
 
-    while( (!gsl->is_reseted() || !__cpt && gsl->ind_numb()) && __cpt < __rhs.size() )
-    {
+    while (  (!gsl->is_reseted () || (!__cpt && gsl->ind_numb ()))
+           && __cpt < __rhs.size ()) {
       (*_C_array)[__i] += __rhs[__cpt];
       __i= gsl->next_ind();
       __cpt++;
@@ -1934,8 +1933,8 @@
     _RWSTD_SIZE_T __i = gsl->next_ind();
     _RWSTD_SIZE_T __cpt = 0;
 
-    while( (!gsl->is_reseted() || !__cpt && gsl->ind_numb()) && __cpt < __rhs.size() )
-    {
+    while (   (!gsl->is_reseted() || (!__cpt && gsl->ind_numb ()))
+           && __cpt < __rhs.size ()) {
       (*_C_array)[__i] -= __rhs[__cpt];
       __i= gsl->next_ind();
       __cpt++;
@@ -1950,8 +1949,8 @@
     _RWSTD_SIZE_T __i = gsl->next_ind();
     _RWSTD_SIZE_T __cpt = 0;
 
-    while( (!gsl->is_reseted() || !__cpt && gsl->ind_numb()) && __cpt < __rhs.size() )
-    {
+    while (   (!gsl->is_reseted () || (!__cpt && gsl->ind_numb ()))
+           && __cpt < __rhs.size ()) {
       (*_C_array)[__i] %= __rhs[__cpt];
       __i= gsl->next_ind();
       __cpt++;
@@ -1965,8 +1964,8 @@
     _RWSTD_SIZE_T __i = gsl->next_ind();
     _RWSTD_SIZE_T __cpt = 0;
 
-    while( (!gsl->is_reseted() || !__cpt && gsl->ind_numb()) && __cpt < __rhs.size() )
-    {
+    while (   (!gsl->is_reseted () || (!__cpt && gsl->ind_numb ()))
+           && __cpt < __rhs.size ()) {
       (*_C_array)[__i] ^= __rhs[__cpt];
       __i= gsl->next_ind();
       __cpt++;
@@ -1980,8 +1979,8 @@
     _RWSTD_SIZE_T __i = gsl->next_ind();
     _RWSTD_SIZE_T __cpt = 0;
 
-    while( (!gsl->is_reseted() || !__cpt && gsl->ind_numb()) && __cpt < __rhs.size() )
-    {
+    while (   (!gsl->is_reseted() || (!__cpt && gsl->ind_numb ()))
+           && __cpt < __rhs.size ()) {
       (*_C_array)[__i] &= __rhs[__cpt];
       __i= gsl->next_ind();
       __cpt++;
@@ -1995,8 +1994,8 @@
     _RWSTD_SIZE_T __i = gsl->next_ind();
     _RWSTD_SIZE_T __cpt = 0;
 
-    while( (!gsl->is_reseted() || !__cpt && gsl->ind_numb()) && __cpt < __rhs.size() )
-    {
+    while (   (!gsl->is_reseted() || (!__cpt && gsl->ind_numb ()))
+           && __cpt < __rhs.size ()) {
       (*_C_array)[__i] |= __rhs[__cpt];
       __i= gsl->next_ind();
       __cpt++;
@@ -2010,8 +2009,8 @@
     _RWSTD_SIZE_T __i = gsl->next_ind();
     _RWSTD_SIZE_T __cpt = 0;
 
-    while( (!gsl->is_reseted() || !__cpt && gsl->ind_numb()) && __cpt < __rhs.size() )
-    {
+    while (   (!gsl->is_reseted () || (!__cpt && gsl->ind_numb ()))
+           && __cpt < __rhs.size ()) {
       (*_C_array)[__i] <<= __rhs[__cpt];
       __i= gsl->next_ind();
       __cpt++;
@@ -2025,8 +2024,8 @@
     _RWSTD_SIZE_T __i = gsl->next_ind();
     _RWSTD_SIZE_T __cpt = 0;
 
-    while( (!gsl->is_reseted() || !__cpt && gsl->ind_numb()) && __cpt < __rhs.size() )
-    {
+    while (   (!gsl->is_reseted () || (!__cpt && gsl->ind_numb ()))
+           && __cpt < __rhs.size ()) {
       (*_C_array)[__i] >>= __rhs[__cpt];
       __i= gsl->next_ind();
       __cpt++;
@@ -2158,8 +2157,7 @@
     _RWSTD_SIZE_T __i = __sl.next_ind();
     _RWSTD_SIZE_T __cpt = 0;
 
-    while( !__sl.is_reseted() || !__cpt && __maxinx )
-    {
+    while (!__sl.is_reseted () || (!__cpt && __maxinx)) {
       __tmp[__cpt] = (*(sl_ar.get_ref_mem_array()))[__i];
       __i= __sl.next_ind();
       __cpt++;
diff --git a/tests/algorithms/25.equal.cpp b/tests/algorithms/25.equal.cpp
index 96ef43d..675e5da 100644
--- a/tests/algorithms/25.equal.cpp
+++ b/tests/algorithms/25.equal.cpp
@@ -125,7 +125,7 @@
         }
 
         // verify 25.1.8, p1
-        int success = res && i < mid_inx || !res && mid_inx <= i;
+        int success = (res && i < mid_inx) || (!res && mid_inx <= i);
 
         const bool equal_expected = i < mid_inx;
 
diff --git a/tests/algorithms/25.replace.cpp b/tests/algorithms/25.replace.cpp
index fbd64e3..ffad963 100644
--- a/tests/algorithms/25.replace.cpp
+++ b/tests/algorithms/25.replace.cpp
@@ -210,8 +210,7 @@
 
         success =
                val != src [i]
-            || val == src [i]
-            && replace_with.origin_ == xsrc [i].origin_;
+            || (val == src [i] && replace_with.origin_ == xsrc [i].origin_);
 
         if (!success)
             break;
@@ -324,8 +323,7 @@
     for (i = 0; i != nsrc; ++i) {
         success =
                val != src [i]
-            || val == src [i]
-            && replace_with.origin_ == xdst [i].origin_;
+            || (val == src [i] && replace_with.origin_ == xdst [i].origin_);
 
         if (!success)
             break;
diff --git a/tests/algorithms/25.transform.cpp b/tests/algorithms/25.transform.cpp
index 2e544d9..5b871a8 100644
--- a/tests/algorithms/25.transform.cpp
+++ b/tests/algorithms/25.transform.cpp
@@ -300,7 +300,7 @@
 
     //////////////////////////////////////////////////////////////////
     if (rw_opt_no_input_iter) {
-        if (1 == tag1 || 0 == tag1 && 1 == tag2)
+        if (1 == tag1 || (0 == tag1 && 1 == tag2))
             rw_note (0, __FILE__, __LINE__, "InputIterator test disabled");
     }
     else {
@@ -316,7 +316,7 @@
 
     //////////////////////////////////////////////////////////////////
     if (rw_opt_no_fwd_iter) {
-        if (tag1 || !tag1 && tag2 || !tag1 && !tag2 && tag3)
+        if (tag1 || (!tag1 && tag2) || (!tag1 && !tag2 && tag3))
             rw_note (0, __FILE__, __LINE__, "ForwardIterator test disabled");
     }
     else {
@@ -344,7 +344,7 @@
 
     //////////////////////////////////////////////////////////////////
     if (rw_opt_no_bidir_iter) {
-        if (tag1 || !tag1 && tag2 || !tag1 && !tag2 && tag3)
+        if (tag1 || (!tag1 && tag2) || (!tag1 && !tag2 && tag3))
             rw_note (0, __FILE__, __LINE__,
                      "BidirectionalIterator test disabled");
     }
@@ -373,7 +373,7 @@
 
     //////////////////////////////////////////////////////////////////
     if (rw_opt_no_rnd_iter) {
-        if (tag1 || !tag1 && tag2 || !tag1 && !tag2 && tag3)
+        if (tag1 || (!tag1 && tag2) || (!tag1 && !tag2 && tag3))
             rw_note (0, __FILE__, __LINE__,
                      "RandomAccessIterator test disabled");
     }
diff --git a/tests/containers/23.bitset.cpp b/tests/containers/23.bitset.cpp
index d0a55b2..5192fba 100644
--- a/tests/containers/23.bitset.cpp
+++ b/tests/containers/23.bitset.cpp
@@ -379,25 +379,25 @@
     const ULong bmask = ULong (::bitmax (N));
 
     {   // bitset::bitset()
-        rw_info (0, 0, __LINE__, "std::bitset<%d>::bitset()", N);
+        rw_info (0, 0, __LINE__, "std::bitset<%zu>::bitset()", N);
 
         const std::bitset<N> b;
         rw_assert (0 == b.to_ulong (), 0, __LINE__,
-                   "bitset<%d>::bitset ().to_ulong() == 0, got %#lx",
+                   "bitset<%zu>::bitset ().to_ulong() == 0, got %#lx",
                    b.to_ulong ());
     }
     
     {   // bitset::bitset (unsigned long)
-        rw_info (0, 0, __LINE__, "std::bitset<%d>::bitset (unsigned long)", N);
+        rw_info (0, 0, __LINE__, "std::bitset<%zu>::bitset (unsigned long)", N);
 
         const std::bitset<N> b (ULONG_MAX & bmask);
         rw_assert ((ULONG_MAX & bmask) == b.to_ulong (), 0, __LINE__,
-                   "bitset<%d>::bitset (%#lx).to_ulong() == 0, got %#lx",
+                   "bitset<%zu>::bitset (%#lx).to_ulong() == 0, got %#lx",
                    N, ULONG_MAX & bmask, b.to_ulong ());
     }
 
     {   // bitset (const string& str, size_t pos = 0, size_t n = (size_t)-1);
-        rw_info (0, 0, __LINE__, "std::bitset<%d>::bitset (string)", N);
+        rw_info (0, 0, __LINE__, "std::bitset<%zu>::bitset (string)", N);
 
         test_set<N> ts;
         ts.set ();
@@ -407,12 +407,12 @@
 
             if (N <= sizeof (unsigned long) * CHAR_BIT)
                 rw_assert (b == bmask, 0, __LINE__,
-                           "bitset<%d>::bitset(string(\"%s\").to_ulong()"
+                           "bitset<%zu>::bitset(string(\"%s\").to_ulong()"
                            " == %#x, got %#x", N, ts.bits (), bmask,
                            b.to_ulong ());
             else
                 rw_assert (test_set<N>(b) == ts, 0, __LINE__,
-                           "bitset<%d>::bitset(string(\"111...111\")"
+                           "bitset<%zu>::bitset(string(\"111...111\")"
                            " == 111...111, got %s",
                            N, test_set<N>(b).bits ());
 
@@ -423,24 +423,24 @@
     }
 
     {   // bitset (const bitset<N>& rhs)
-        rw_info (0, 0, __LINE__, "std::bitset<%d>::bitset (const bitset&)", N);
+        rw_info (0, 0, __LINE__, "std::bitset<%zu>::bitset (const bitset&)", N);
 
         const std::bitset<N> b1 (12345);
         const std::bitset<N> b2 (b1);
 
         rw_assert (b1.to_ulong () == b2.to_ulong (), 0, __LINE__,
-                   "bitset<%d>::bitset (bitset<%d>(%#lx)).to_ulong() == %#lx,"
-                   " got %#lx", N, b1.to_ulong (), b2.to_ulong ());
+                   "bitset<%zu>::bitset (bitset<%1$zu>(%#lx)).to_ulong() "
+                   "== %#2$lx, got %#lx", N, b1.to_ulong (), b2.to_ulong ());
 
         rw_info (0, 0, __LINE__,
-                 "std::bitset<%d>::operator=(const bitset&)", N);
+                 "std::bitset<%zu>::operator=(const bitset&)", N);
 
         std::bitset<N> b3;
         b3 = b1;
 
         rw_assert (b1.to_ulong () == b3.to_ulong (), 0, __LINE__,
-                   "bitset<%d>::bitset (bitset<%d>(%#lx)).to_ulong() == %#lx,"
-                   " got %#lx", N, b1.to_ulong (), b3.to_ulong ());
+                   "bitset<%zu>::bitset (bitset<%1$zu>(%#lx)).to_ulong() "
+                   "== %#1$lx, got %#lx", N, b1.to_ulong (), b3.to_ulong ());
     }
 }
 
@@ -449,7 +449,7 @@
 template <std::size_t N>
 void stress_ctors (const std::bitset<N>*)
 {
-    rw_info (0, 0, __LINE__, "std::bitset<%d>::bitset (string)", N);
+    rw_info (0, 0, __LINE__, "std::bitset<%zu>::bitset (string)", N);
 
     const std::size_t max_mask = bitmax (N);
 
@@ -462,7 +462,7 @@
         const std::bitset<N> b1 (n);
 
         rw_assert (n == b1.to_ulong (), 0, __LINE__,
-                   "bitset<%d>::bitset(%#lx).to_ulong() == %#lx, got %#lx",
+                   "bitset<%zu>::bitset(%#lx).to_ulong() == %#lx, got %#lx",
                    N, n, n, b1.to_ulong ());
 
         test_set<N> ts;
@@ -471,7 +471,7 @@
         // exercise 23.3.5.1, p3
         std::bitset<N> b2 = std::bitset<N>(std::string (ts.bits ()));
         rw_assert (test_set<N>(b2) == ts, 0, __LINE__,
-                   "bitset<%d>::bitset (\"%s\") got %s",
+                   "bitset<%zu>::bitset (\"%s\") got %s",
                    N, ts.bits (), b2.to_string ().c_str ());
     }
 }
@@ -482,7 +482,7 @@
 void test_operators (const std::bitset<N>*)
 {
 #define TEST_OP(op) do {                                                   \
-   rw_info (!i, 0, __LINE__, "std::bitset<%d>::operator" #op               \
+   rw_info (!i, 0, __LINE__, "std::bitset<%zu>::operator" #op              \
                              "= (const bitset&)", N);                      \
                                                                            \
           test_set<N> lhs = test_set<N>().random ();                       \
@@ -493,12 +493,12 @@
     const std::bitset<N> b_res = b_lhs op ## = b_rhs;                      \
                                                                            \
     rw_assert (res == test_set<N>(b_res), 0, __LINE__,                     \
-               "bitset<%lu>::operator" #op "= (const bitset<%lu>&):"       \
+               "bitset<%zu>::operator" #op "= (const bitset<%zu>&):"       \
                " %s " #op " %s == %s, got %s",                             \
                N, N, lhs.bits (), rhs.bits (), res.bits (),                \
                test_set<N>(b_res).bits ());                                \
                                                                            \
-    rw_info (!i, 0, __LINE__, "std::bitset<%d>::operator" #op              \
+    rw_info (!i, 0, __LINE__, "std::bitset<%zu>::operator" #op             \
                               " (const bitset&)", N);                      \
     lhs.random ();                                                         \
     b_lhs = std::bitset<N>(std::string (lhs.bits ()));                     \
@@ -507,7 +507,7 @@
     const std::bitset<N> b_res2 = b_lhs op b_rhs;                          \
                                                                            \
     rw_assert (res2 == test_set<N>(b_res2), 0, __LINE__,                   \
-               "bitset<%lu>::operator" #op " (const bitset<%lu>&):"        \
+               "bitset<%zu>::operator" #op " (const bitset<%zu>&):"        \
                " %s " #op " %s == %s, got %s",                             \
                N, N, lhs.bits (), rhs.bits (), res2.bits (),               \
                test_set<N>(b_res2).bits ());                               \
@@ -530,7 +530,7 @@
         // 23.3.5.2, p5 and 23.3.5.3, p3
         TEST_OP (^);
 
-        rw_info (!i, 0, __LINE__, "std::bitset<%d>::operator<<=(size_t)", N);
+        rw_info (!i, 0, __LINE__, "std::bitset<%zu>::operator<<=(size_t)", N);
 
         const test_set<N> ts1 = test_set<N>().random ();
         const test_set<N> ts2 = test_set<N>(ts1) <<= i % M;
@@ -541,11 +541,11 @@
         b1 <<= i % M;
 
         rw_assert (test_set<N>(b1) == ts2, 0, __LINE__,
-                   "bitset<%d>::operator<<=(%lu): %s << %lu == %s, got %s",
+                   "bitset<%zu>::operator<<=(%lu): %s << %lu == %s, got %s",
                    N, i % M, ts1.bits (), i % M, ts2.bits (),
                    test_set<N>(b1).bits ());
 
-        rw_info (!i, 0, __LINE__, "std::bitset<%d>::operator>>=(size_t)", N);
+        rw_info (!i, 0, __LINE__, "std::bitset<%zu>::operator>>=(size_t)", N);
 
         const test_set<N> ts3 = test_set<N>(ts1) >>= i % M;
         std::bitset<N> b2 = std::bitset<N>(std::string (ts1.bits ()));
@@ -554,32 +554,32 @@
         b2 >>= i % M;
 
         rw_assert (test_set<N>(b2) == ts3, 0, __LINE__,
-                   "bitset<%d>::operator>>=(%lu): %s >> %lu == %s, got %s",
+                   "bitset<%zu>::operator>>=(%lu): %s >> %lu == %s, got %s",
                    N, i % M, ts1.bits (), i % M, ts3.bits (),
                    test_set<N>(b2).bits ());
 
         rw_info (!i, 0, __LINE__,
-                 "std::bitset<%d>::operator<<=(size_t) (unused bits)", N);
+                 "std::bitset<%zu>::operator<<=(size_t) (unused bits)", N);
 
         if (N) {
             b1.set (N - 1);
             std::size_t first  = b1.count ();
             std::size_t second = (b1 <<= 1).count ();
             rw_assert (!(first == second), 0, __LINE__,
-                       "bitset<%lu>::operator<<=(1): "
+                       "bitset<%zu>::operator<<=(1): "
                        "after <<= 1: expected %lu, got %lu",
                        N, first - 1, second);
         }
 
         rw_info (!i, 0, __LINE__,
-                 "std::bitset<%d>::operator>>=(size_t) (unused bits)", N);
+                 "std::bitset<%zu>::operator>>=(size_t) (unused bits)", N);
 
         if (N) {
             b2.set ();
             std::size_t first  = b2.count ();
             std::size_t second = (b2 >>= 1).count ();
             rw_assert (first - 1 == second, 0, __LINE__,
-                       "bitset<%lu>::operator>>=(1): "
+                       "bitset<%zu>::operator>>=(1): "
                        "after >>= 1: expected %lu, got %lu",
                        N, first - 1, second);
         }
@@ -603,13 +603,13 @@
         std::bitset<N> b2 = ~b1;
 
         rw_assert (ts2 == test_set<N>(b2), 0, __LINE__,
-                   "bitset<%d>::operator~(): ~%s == %s, got %s",
+                   "bitset<%zu>::operator~(): ~%s == %s, got %s",
                    N, ts1.bits (), ts2.bits (), test_set<N>(b2).bits ());
 
         // 23.3.5.2, p25
         b2.flip ();
         rw_assert (ts1 == test_set<N>(b2), 0, __LINE__,
-                   "bitset<%d>::flip (): ~%s == %s, got %s",
+                   "bitset<%zu>::flip (): ~%s == %s, got %s",
                    N, ts1.bits (), ts2.bits (), test_set<N>(b2).bits ());
 
         // 23.3.5.2, p27
@@ -617,36 +617,36 @@
             b2.flip (_j);
 
         rw_assert (ts2 == test_set<N>(b2), 0, __LINE__,
-            "bitset<%d>::flip () == %s, got %s",
+            "bitset<%zu>::flip () == %s, got %s",
             N, ts2.bits (), test_set<N>(b2).bits ());
 
         // 23.3.5.3, p35
         rw_assert (ts2.count () == b2.count (), 0, __LINE__,
-                   "bitset<%d>::count () == %d, got %d [%s]",
+                   "bitset<%zu>::count () == %zu, got %d [%s]",
                    N, ts2.count (), b2.count (), test_set<N>(b2).bits());
                
         // 23.3.5.3, p37
-        rw_assert (b2 == b2 && (N && !(b1 == b2) || !N && b1 == b2),
+        rw_assert (b2 == b2 && ((N && !(b1 == b2)) || (!N && b1 == b2)),
                    0, __LINE__,
-                   "bitset<%d>::operator==(const bitset<%ul>&) [%s]",
-                   N, N, N ? test_set<N>(b2).bits () : "<empty>");
+                   "bitset<%zu>::operator== (const bitset&) [%s]",
+                   N, N ? test_set<N>(b2).bits () : "<empty>");
     
         // 23.3.5.3, p38
-        rw_assert ((N && b1 != b2 || !N && !(b1 != b2)) && !(b2 != b2),
+        rw_assert ((N && b1 != b2) || (!N && !(b1 != b2) && !(b2 != b2)),
                    0, __LINE__,
-                   "bitset<%d>::operator!=(const bitset<%ul>&) [%s]",
-                   N, N, N ? test_set<N>(b2).bits () : "<empty>");
+                   "bitset<%zu>::operator!= (const bitset&) [%s]",
+                   N, N ? test_set<N>(b2).bits () : "<empty>");
     
         // 23.3.5.3, p42
-        rw_assert (b2.count() && b2.any() || !b2.count() && !b2.any(),
+        rw_assert ((b2.count () && b2.any ()) || (!b2.count () && !b2.any ()),
                    0, __LINE__,
-                   "bitset<%d>::any () [%s]",
+                   "bitset<%zu>::any () [%s]",
                    N, test_set<N>(b2).bits ());
 
         // 23.3.5.3, p43
-        rw_assert (b2.count() && !b2.none() || !b2.count() && b2.none(),
+        rw_assert ((b2.count () && !b2.none ()) || (!b2.count () && b2.none ()),
                    0, __LINE__,
-                   "bitset<%d>::none () [%s]",
+                   "bitset<%zu>::none () [%s]",
                    N, test_set<N>(b2).bits ());
 
         for (std::size_t k = 0; k != N; ++k) {
@@ -654,13 +654,13 @@
             std::bitset<N> b3  = b1 << k;
 
             rw_assert (test_set<N>(b3) == ts3,  0, __LINE__,
-                       "bitset<%lu>::operator<<(%lu)", N, k);
+                       "bitset<%zu>::operator<< (%zu)", N, k);
 
             ts3 = test_set<N>(ts1) >>= k;
             b3  = b1 >> k;
 
             rw_assert (test_set<N>(b3) == ts3, 0, __LINE__,
-                       "bitset<%lu>::operator>>(%lu)", N, k);
+                       "bitset<%zu>::operator>> (%zu)", N, k);
         }
     }
 }
@@ -670,7 +670,7 @@
 template <std::size_t N>
 void stress_count (const std::bitset<N>*)
 {
-    rw_info (0, 0, __LINE__, "std::bitset<%lu>::count()", N);
+    rw_info (0, 0, __LINE__, "std::bitset<%zu>::count()", N);
 
     for (std::size_t i = 0; i != N; i++) {
         std::bitset<N> b;
@@ -679,7 +679,7 @@
             b.set (j);
 
         rw_assert (b.count () == i,  0, __LINE__,
-                   "%lu. std::bitset<%lu>::count()", i, N);
+                   "%lu. std::bitset<%zu>::count()", i, N);
     }
 }
 
@@ -688,9 +688,9 @@
 template <std::size_t N>
 void test_elem_access (const std::bitset<N>*)
 {
-    rw_info (0, 0, __LINE__, "std::bitset<%lu>::test(size_t)", N);
-    rw_info (0, 0, __LINE__, "std::bitset<%lu>::operator[](size_t)", N);
-    rw_info (0, 0, __LINE__, "std::bitset<%lu>::operator[](size_t) const", N);
+    rw_info (0, 0, __LINE__, "std::bitset<%zu>::test(size_t)", N);
+    rw_info (0, 0, __LINE__, "std::bitset<%zu>::operator[](size_t)", N);
+    rw_info (0, 0, __LINE__, "std::bitset<%zu>::operator[](size_t) const", N);
 
     for (std::size_t i = 0; i != NLOOPS; ++i) {
 
@@ -700,18 +700,18 @@
         for (std::size_t _j = 0; _j != N; ++_j) {
             // 23.3.5.2, p39
             rw_assert (b.test (_j) == ts.test (_j), 0, __LINE__,
-                       "bitset<%lu>::test (%lu): %s",
+                       "bitset<%zu>::test (%lu): %s",
                        N, _j, test_set<N>(b).bits ());
 
             // 23.3.5.2, p??: see lwg issue 11
             rw_assert (b [_j] == ts.test (_j), 0, __LINE__,
-                       "bitset<%lu>::operator[](%lu): %s",
+                       "bitset<%zu>::operator[](%lu): %s",
                        N, _j, test_set<N>(b).bits ());
 
             // 23.3.5.2, p??: see lwg issue 11
             rw_assert (((const std::bitset<N>&)b) [_j] == ts.test (_j),
                        0, __LINE__,
-                       "bitset<%lu>::operator[](%lu) const: %s",
+                       "bitset<%zu>::operator[](%lu) const: %s",
                        N, _j, test_set<N>(b).bits ());
 
             // exercise std::bitset<N>::reference
@@ -720,18 +720,18 @@
             // std::bitset<N>::reference::flip()
             r.flip ();
             rw_assert (r == !ts.test (_j), 0, __LINE__,
-                       "bitset<%lu>::reference::flip()", N);
+                       "bitset<%zu>::reference::flip()", N);
 
             // std::bitset<N>::reference::operator~()
             bool toggled = ~r;
             rw_assert (toggled == ts.test (_j), 0, __LINE__,
-                       "bitset<%lu>::reference::operator~()", N);
+                       "bitset<%zu>::reference::operator~()", N);
 
             // std::bitset<N>::reference::operator=(bool)
             r = toggled;
             rw_assert (r == ts.test (_j) && b.test (_j) == ts.test (_j),
                        0, __LINE__,
-                       "bitset<%lu>::reference::operator=(bool)", N);
+                       "bitset<%zu>::reference::operator=(bool)", N);
         }
     }
 }
@@ -1031,7 +1031,7 @@
     static const char* const aname = alloc_name (Alloc ());
 
     rw_info (0, 0, __LINE__,
-             "std::bitset<%lu>::to_string<%s, %s, %s >()",
+             "std::bitset<%zu>::to_string<%s, %s, %s >()",
              N, cname, tname, aname);
 
     test_set<N> ts;
@@ -1063,7 +1063,7 @@
     pos  = compare (str3.data (), ts.bits (), "01");
 
     rw_assert (-1 == pos, 0, __LINE__,
-               "bitset<%lu>::to_string () == \"%s\", got \"%s\": "
+               "bitset<%zu>::to_string () == \"%s\", got \"%s\": "
                "mismatch at bit %d",
                N, ts.bits (), TO_STR (str3), pos);
 
@@ -1071,14 +1071,14 @@
     // specify one of the two function arguments (exercise the default
     // or the respective overload)
     rw_info (0, 0, __LINE__,
-             "std::bitset<%lu>::to_string<%s, %s, %s >(\"%s\")",
+             "std::bitset<%zu>::to_string<%s, %s, %s >(\"%s\")",
              N, cname, tname, aname, cname);
 
     str3 = bitset_to_string_3 (bs, 1, zero, one, (String3*)0);
     pos  = compare (str3.data (), ts.bits (), "o1");
 
     rw_assert (-1 == pos, 0, __LINE__,
-               "bitset<%lu>::to_string ('o') == %s, got %s: "
+               "bitset<%zu>::to_string ('o') == %s, got %s: "
                "mismatch at bit %d", N,
                to_string (ts.bits (), "o1").c_str (),
                TO_STR (str3), pos);
@@ -1086,14 +1086,14 @@
 
     // specify both of the two function arguments
     rw_info (0, 0, __LINE__,
-             "std::bitset<%lu>::to_string<%s, %s, %s >(%s, %s)",
+             "std::bitset<%zu>::to_string<%s, %s, %s >(%s, %s)",
              N, cname, tname, aname, cname, cname);
 
     str3 = bitset_to_string_3 (bs, 2, zero, one, (String3*)0);
     pos  = compare (str3.data (), ts.bits (), "ox");
 
     rw_assert (-1 == pos, 0, __LINE__,
-               "bitset<%lu>::to_string ('o', 'x') == %s, got %s: "
+               "bitset<%zu>::to_string ('o', 'x') == %s, got %s: "
                "mismatch at bit %d", N,
                to_string (ts.bits (), "ox").c_str (),
                TO_STR (str3), pos);
@@ -1103,7 +1103,7 @@
     // exercise the overload of the to_string() member function template
     // that takes the first two template parameters different from char,
     // and char_traits<char>
-    rw_info (0, 0, __LINE__, "std::bitset<%lu>::to_string<%s, %s >()",
+    rw_info (0, 0, __LINE__, "std::bitset<%zu>::to_string<%s, %s >()",
              N, cname, tname);
 
     typedef std::allocator<charT>                        CharTAlloc;
@@ -1117,21 +1117,21 @@
     pos  = compare (str2.data (), ts.bits (), "01");
 
     rw_assert (-1 == pos, 0, __LINE__,
-               "bitset<%lu>::to_string () == %s, got %s: mismatch at bit %d",
+               "bitset<%zu>::to_string () == %s, got %s: mismatch at bit %d",
                N, ts.bits (), TO_STR (str2), pos);
 
 
     // specify one of the two function arguments (exercise the default
     // or the respective overload)
     rw_info (0, 0, __LINE__,
-             "std::bitset<%lu>::to_string<%s, %s >(%s)",
+             "std::bitset<%zu>::to_string<%s, %s >(%s)",
              N, cname, tname, cname);
 
     str2 = bitset_to_string_2 (bs, 1, zero, one, (String2*)0);
     pos  = compare (str2.data (), ts.bits (), "o1");
 
     rw_assert (-1 == pos, 0, __LINE__,
-               "bitset<%lu>::to_string ('o') == %s, got %s: "
+               "bitset<%zu>::to_string ('o') == %s, got %s: "
                "mismatch at bit %d", N,
                to_string (ts.bits (), "o1").c_str (),
                TO_STR (str2), pos);
@@ -1139,14 +1139,14 @@
 
     // specify both of the two function arguments
     rw_info (0, 0, __LINE__,
-             "std::bitset<%lu>::to_string<%s, %s >(%s, %s)",
+             "std::bitset<%zu>::to_string<%s, %s >(%s, %s)",
              N, cname, tname, cname, cname);
 
     str2 = bitset_to_string_2 (bs, 2, zero, one, (String2*)0);
     pos  = compare (str2.data (), ts.bits (), "ox");
 
     rw_assert (-1 == pos, 0, __LINE__,
-               "bitset<%lu>::to_string ('o', 'x') == %s, got %s: "
+               "bitset<%zu>::to_string ('o', 'x') == %s, got %s: "
                "mismatch at bit %d", N,
                to_string (ts.bits (), "ox").c_str (),
                TO_STR (str2), pos);
@@ -1155,7 +1155,7 @@
     ////////////////////////////////////////////////////////////////////////
     // exercise the overload of the to_string() member function template
     // that takes the first template parameter different from char
-    rw_info (0, 0, __LINE__, "std::bitset<%lu>::to_string<%s>()",
+    rw_info (0, 0, __LINE__, "std::bitset<%zu>::to_string<%s>()",
              N, cname);
 
     typedef std::char_traits<charT>                          CharTraits;
@@ -1169,20 +1169,20 @@
     pos  = compare (str1.data (), ts.bits (), "01");
 
     rw_assert (-1 == pos, 0, __LINE__,
-               "bitset<%lu>::to_string () == %s, got %s: mismatch at bit %d",
+               "bitset<%zu>::to_string () == %s, got %s: mismatch at bit %d",
                N, ts.bits (), TO_STR (str1), pos);
 
 
     // specify one of the two function arguments (exercise the default
     // or the respective overload)
-    rw_info (0, 0, __LINE__, "std::bitset<%lu>::to_string<%s>(%s)",
+    rw_info (0, 0, __LINE__, "std::bitset<%zu>::to_string<%s>(%s)",
              N, cname, cname);
 
     str1 = bitset_to_string_1 (bs, 1, zero, one, (String1*)0);
     pos  = compare (str1.data (), ts.bits (), "o1");
 
     rw_assert (-1 == pos, 0, __LINE__,
-               "bitset<%lu>::to_string ('o') == %s, got %s: "
+               "bitset<%zu>::to_string ('o') == %s, got %s: "
                "mismatch at bit %d", N,
                to_string (ts.bits (), "o1").c_str (),
                TO_STR (str1), pos);
@@ -1190,14 +1190,14 @@
 
     // specify both of the two function arguments
     rw_info (0, 0, __LINE__,
-             "std::bitset<%lu>::to_string<%s>(%s, %s)",
+             "std::bitset<%zu>::to_string<%s>(%s, %s)",
              N, cname, cname, cname);
 
     str1 = bitset_to_string_1 (bs, 2, zero, one, (String1*)0);
     pos  = compare (str1.data (), ts.bits (), "ox");
 
     rw_assert (-1 == pos, 0, __LINE__,
-               "bitset<%lu>::to_string ('o', 'x') == %s, got %s: "
+               "bitset<%zu>::to_string ('o', 'x') == %s, got %s: "
                "mismatch at bit %d", N,
                to_string (ts.bits (), "ox").c_str (),
                TO_STR (str1), pos);
@@ -1209,7 +1209,7 @@
     if (nontemplate_done)
         return;
 
-    rw_info (0, 0, __LINE__, "std::bitset<%lu>::to_string ()", N);
+    rw_info (0, 0, __LINE__, "std::bitset<%zu>::to_string ()", N);
 
     typedef std::string String0;
 
@@ -1221,32 +1221,32 @@
     pos  = compare (str0.data (), ts.bits (), "01");
 
     rw_assert (-1 == pos, 0, __LINE__,
-               "bitset<%lu>::to_string () == %s, got %s: mismatch at bit %d",
+               "bitset<%zu>::to_string () == %s, got %s: mismatch at bit %d",
                N, ts.bits (), str0.c_str (), pos);
 
 
     // specify one of the two function arguments (exercise the default
     // or the respective overload)
-    rw_info (0, 0, __LINE__, "std::bitset<%lu>::to_string (char)", N);
+    rw_info (0, 0, __LINE__, "std::bitset<%zu>::to_string (char)", N);
 
     str0 = bitset_to_string_0 (bs, 1, 'o', 'x', (String0*)0);
     pos  = compare (str0.data (), ts.bits (), "o1");
 
     rw_assert (-1 == pos, 0, __LINE__,
-               "bitset<%lu>::to_string ('o') == %s, got %s: "
+               "bitset<%zu>::to_string ('o') == %s, got %s: "
                "mismatch at bit %d", N,
                to_string (ts.bits (), "o1").c_str (),
                str0.c_str (), pos);
 
 
     // specify both of the two function arguments
-    rw_info (0, 0, __LINE__, "std::bitset<%lu>::to_string (char, char)", N);
+    rw_info (0, 0, __LINE__, "std::bitset<%zu>::to_string (char, char)", N);
 
     str0 = bitset_to_string_0 (bs, 2, 'o', 'x', (String0*)0);
     pos  = compare (str0.data (), ts.bits (), "ox");
 
     rw_assert (-1 == pos, 0, __LINE__,
-               "bitset<%lu>::to_string ('o', 'x') == %s, got %s: "
+               "bitset<%zu>::to_string ('o', 'x') == %s, got %s: "
                "mismatch at bit %d", N,
                to_string (ts.bits (), "ox").c_str (),
                str0.c_str (), pos);
diff --git a/tests/containers/23.vector.cons.cpp b/tests/containers/23.vector.cons.cpp
index e064fac..c498d29 100644
--- a/tests/containers/23.vector.cons.cpp
+++ b/tests/containers/23.vector.cons.cpp
@@ -634,23 +634,23 @@
             const Vector v1 (first, last, alloc);
 
             if (   i != v0.size ()
-                || (!(i && !v0.empty () || !i && v0.empty ()))
+                || (!((i && !v0.empty ()) || (!i && v0.empty ())))
                 || (i != v1.size ())
-                || (!(i && !v1.empty () || !i && v1.empty ())))
+                || (!((i && !v1.empty ()) || (!i && v1.empty ()))))
                 success = false;
 
             // verify size() and empty()
             rw_assert (i == v0.size (), 0, __LINE__,
                        "size () == %zu, got %zu", i, v0.size ());
 
-            rw_assert (i && !v0.empty () || !i && v0.empty (),
+            rw_assert ((i && !v0.empty ()) || (!i && v0.empty ()),
                        0, __LINE__, "size () == %zu, empty () == %d",
                        v0.size (), v0.empty ());
 
             rw_assert (i == v1.size (), 0, __LINE__,
                        "size () == %zu, got %zu", i, v1.size ());
 
-            rw_assert (i && !v1.empty () || !i && v1.empty (),
+            rw_assert ((i && !v1.empty ()) || (!i && v1.empty ()),
                        0, __LINE__, "size () == %zu, empty () == %d",
                        v1.size (), v1.empty ());
         }
diff --git a/tests/iostream/27.filebuf.codecvt.cpp b/tests/iostream/27.filebuf.codecvt.cpp
index 64e82ed..dd7ccc2 100644
--- a/tests/iostream/27.filebuf.codecvt.cpp
+++ b/tests/iostream/27.filebuf.codecvt.cpp
@@ -503,7 +503,7 @@
         else if ('?' == ch && !(mask & trigraphs)) {
             // (try to) convert a trigraph sequence
             if (   2 > from_end - from_next
-                || '?' == from_next [1] && 3 > from_end - from_next) {
+                || ('?' == from_next [1] && 3 > from_end - from_next)) {
                 res = partial;
                 break;
             }
@@ -1126,17 +1126,17 @@
         // if end-of-file occurs on the input sequence
         RW_ASSERT_STATE (f, std::ios::eofbit | std::ios::failbit);
 
-        rw_assert (long (n) == buflen, 0, __LINE__,
+        rw_assert (std::size_t (n) == buflen, 0, __LINE__,
                    "ifstream::read (%#p, %d); read %ld, expected %d",
                    tmpbuf, sizeof tmpbuf, long (n), buflen);
 
         // assert that converted file contents are the same
         // as the originally generated buffer
-        const long len = long (n) < buflen ? long (n) : buflen;
-        for (long i = 0; i != len; ++i) {
+        const long len = std::size_t (n) < buflen ? std::size_t (n) : buflen;
+        for (std::size_t i = 0; i != len; ++i) {
             if (tmpbuf [i] != buffer [i]) {
                 rw_assert (0, 0, __LINE__,
-                           "'\\%03o' == '\\%03o'; offset %d",
+                           "'\\%03o' == '\\%03o'; offset %zu",
                            (unsigned char)buffer [i],
                            (unsigned char)tmpbuf [i], i);
                 break;
diff --git a/tests/iostream/27.filebuf.cpp b/tests/iostream/27.filebuf.cpp
index fcb35a8..b34f32c 100644
--- a/tests/iostream/27.filebuf.cpp
+++ b/tests/iostream/27.filebuf.cpp
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2008 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  *
  **************************************************************************/
 
@@ -2096,12 +2096,12 @@
                 return std::codecvt_base::partial;
 
             if (   from_next [0] != '\\' || from_next [1] != 'x'
-                || !(   from_next [2] >= '0' && from_next [2] <= '9'
-                     || from_next [2] >= 'A' && from_next [2] <= 'F'
-                     || from_next [2] >= 'a' && from_next [2] <= 'f')
-                || !(   from_next [3] >= '0' && from_next [3] <= '9'
-                     || from_next [3] >= 'A' && from_next [3] <= 'F'
-                     || from_next [3] >= 'a' && from_next [3] <= 'f'))
+                || !(   (from_next [2] >= '0' && from_next [2] <= '9')
+                     || (from_next [2] >= 'A' && from_next [2] <= 'F')
+                     || (from_next [2] >= 'a' && from_next [2] <= 'f'))
+                || !(   (from_next [3] >= '0' && from_next [3] <= '9')
+                     || (from_next [3] >= 'A' && from_next [3] <= 'F')
+                     || (from_next [3] >= 'a' && from_next [3] <= 'f')))
                 return std::codecvt_base::error;
 
             // convert a hex literal to a number
diff --git a/tests/iostream/27.istream.sentry.cpp b/tests/iostream/27.istream.sentry.cpp
index 284474a..dfbd790 100644
--- a/tests/iostream/27.istream.sentry.cpp
+++ b/tests/iostream/27.istream.sentry.cpp
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2003-2006 Rogue Wave Software.
+ * Copyright 2003-2006 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -434,9 +434,8 @@
 
                     _RWSTD_UNUSED (guard);
 
-                    const bool success =
-                           is.good () && guard
-                        || !is.good () && !guard;
+                    // verify that both are either false or true
+                    const bool success = !is.good () == !guard;
 
                     rw_assert (success, 0, __LINE__,
                                "%u. %{$SENTRY}"
diff --git a/tests/localization/22.locale.ctype.tolower.cpp b/tests/localization/22.locale.ctype.tolower.cpp
index 28a6e69..c6a5547 100644
--- a/tests/localization/22.locale.ctype.tolower.cpp
+++ b/tests/localization/22.locale.ctype.tolower.cpp
@@ -83,8 +83,6 @@
                  "{zh-CN-*-{GB*,UTF-8,CP125?}},"                           \
                  "{ru-RU-*-{KOI*,UTF-8,CP125?}}}"
 
-const char* locale_list = 0;
-
 #define BEGIN_LOCALE_LOOP(num, locname, loop_cntrl)                        \
    const char* locale_list = rw_locale_query (LC_CTYPE, LOCALES);          \
    for (const char* locname = locale_list;                                 \
diff --git a/tests/localization/22.locale.messages.cpp b/tests/localization/22.locale.messages.cpp
index 17755ba..066f859 100644
--- a/tests/localization/22.locale.messages.cpp
+++ b/tests/localization/22.locale.messages.cpp
@@ -376,7 +376,7 @@
         cat = (msgs.open)(cat_name, loc);
 
         const bool success =
-            expect_success && -1 < cat || expect_failure && cat < 0;
+            (expect_success && -1 < cat) || (expect_failure && cat < 0);
 
         rw_assert (success, 0, line,
                    "messages<%s>::open(%#s, locale(%#s))"
diff --git a/tests/localization/22.locale.messages.mt.cpp b/tests/localization/22.locale.messages.mt.cpp
index 3cf1e3e..ec1f1c3 100644
--- a/tests/localization/22.locale.messages.mt.cpp
+++ b/tests/localization/22.locale.messages.mt.cpp
@@ -375,13 +375,21 @@
         try {
             const std::locale loc (data.locale_name_);
 
-            const std::messages<char>& nm =
-                std::use_facet<std::messages<char> >(loc);
+            {
+                const std::messages<char>& nm =
+                    std::use_facet<std::messages<char> >(loc);
 
-#ifdef _RWSTD_NO_WCHAR_T
+                _RWSTD_UNUSED (nm);
+            }
 
-            const std::messages<wchar_t>& nm =
-                std::use_facet<std::messages<wchar_t> >(loc);
+#ifndef _RWSTD_NO_WCHAR_T
+
+            {
+                const std::messages<wchar_t>& wm =
+                    std::use_facet<std::messages<wchar_t> >(loc);
+
+                _RWSTD_UNUSED (wm);
+            }
 
 #endif // _RWSTD_NO_WCHAR_T
 
diff --git a/tests/localization/22.locale.money.get.cpp b/tests/localization/22.locale.money.get.cpp
index 5047d2f..67a2414 100644
--- a/tests/localization/22.locale.money.get.cpp
+++ b/tests/localization/22.locale.money.get.cpp
@@ -361,7 +361,7 @@
             err_expect = err;
 
         const int success =
-            !(-1 != consumed && last - next != consumed || err != err_expect);
+            !((-1 != consumed && last - next != consumed) || err != err_expect);
 
         rw_assert (success, __FILE__, lineno,
                    "money_get<%s>::get (%{*Ac}, ..., %b, ..., %s&), "
@@ -393,7 +393,7 @@
         last = mg.get (next, last, intl, io, err, bs);
 
         int success =
-            !(-1 != consumed && last - next != consumed || err != err_expect);
+            !((-1 != consumed && last - next != consumed) || err != err_expect);
 
         rw_assert (success, __FILE__, lineno,
                    "money_get<%s>::get (%{*Ac}, ..., %b, ..., "
@@ -418,10 +418,10 @@
             int n = std::sscanf (narrow_buf, fmt, &x);
 
             success = 
-                !(   err_expect & std::ios::failbit && !*grouping
-                  && (1 == n || bs != initial)
-                  || !(err_expect & std::ios::failbit)
-                  && 1 < rw_ldblcmp (x, val));
+                !(   (   err_expect & std::ios::failbit && !*grouping
+                      && (1 == n || bs != initial))
+                  || (   !(err_expect & std::ios::failbit)
+                      && 1 < rw_ldblcmp (x, val)));
 
             rw_assert (success, __FILE__, lineno,
                        "money_get<%s>::get (%{*Ac}, ..., %b, ..., "
diff --git a/tests/localization/22.locale.num.get.cpp b/tests/localization/22.locale.num.get.cpp
index 4fb1990..da1c290 100644
--- a/tests/localization/22.locale.num.get.cpp
+++ b/tests/localization/22.locale.num.get.cpp
@@ -380,7 +380,7 @@
     // that the extracted value can be in
     success =
            err == err_expect
-        && (rw_equal (x, val) || val <= x && x <= val_max);
+        && (rw_equal (x, val) || (val <= x && x <= val_max));
 
     nfailures += !success;
 
@@ -416,8 +416,8 @@
         const int n = std::sscanf (str, scanspec, &y);
 
         success =
-            !(   err & std::ios::failbit    && n > 0
-              || !(err & std::ios::failbit) && 1 != n
+            !(   (err & std::ios::failbit    && n > 0)
+              || (!(err & std::ios::failbit) && 1 != n)
               || !rw_equal (x, y));
 
         nfailures += !success;
diff --git a/tests/localization/22.locale.num.put.cpp b/tests/localization/22.locale.num.put.cpp
index 1b42b26..fa6aaf7 100644
--- a/tests/localization/22.locale.num.put.cpp
+++ b/tests/localization/22.locale.num.put.cpp
@@ -419,7 +419,7 @@
         || '+' == fill
         || pun.thousands_sep_ == fill
         || pun.decimal_point_ == fill
-        || fill >= '0' && fill <= '9')
+        || (fill >= '0' && fill <= '9'))
         return;
 
     // do not perform extraction if there is no data to extract
diff --git a/tests/localization/22.locale.numpunct.cpp b/tests/localization/22.locale.numpunct.cpp
index 63ede49..d27720c 100644
--- a/tests/localization/22.locale.numpunct.cpp
+++ b/tests/localization/22.locale.numpunct.cpp
@@ -224,8 +224,8 @@
 
         // check that newly constructed locale matches
 
-        if (   'C' == locnamebuf [0] && '\0' == locnamebuf [1]
-            || 'C' == locname [0] && '\0' == locname [1]
+        if (   ('C' == locnamebuf [0] && '\0' == locnamebuf [1])
+            || ('C' == locname [0] && '\0' == locname [1])
             || *loc == std::locale::classic ()) {
             // follow requirements in 22.2.3.1.2. p1, 2, and 3
             check_decimal_point (charT ('.'), tname, loc);
diff --git a/tests/localization/22.locale.statics.mt.cpp b/tests/localization/22.locale.statics.mt.cpp
index d8be12f..2bdfdd0 100644
--- a/tests/localization/22.locale.statics.mt.cpp
+++ b/tests/localization/22.locale.statics.mt.cpp
@@ -93,7 +93,7 @@
 static void*
 test_global (void*)
 {
-    for (std::size_t i = 0; i != opt_nloops; ++i) {
+    for (std::size_t i = 0; i != std::size_t (opt_nloops); ++i) {
 
         if (rw_thread_pool_timeout_expired ())
             break;
diff --git a/tests/localization/22.locale.time.get.cpp b/tests/localization/22.locale.time.get.cpp
index 41b637d..ff7f249 100644
--- a/tests/localization/22.locale.time.get.cpp
+++ b/tests/localization/22.locale.time.get.cpp
@@ -89,7 +89,7 @@
 
     _TRY {
         if (   '\0' == fmt [1]
-            || ('E' ==  fmt [0] || 'O' == fmt [0] && '\0' == fmt [2])) {
+            || ('E' ==  fmt [0] || ('O' == fmt [0] && '\0' == fmt [2]))) {
 
             // single-character format strings "a", "b", "x", "X", and "Y"
             // exercise the standard time_get interface, i.e., get_weekday(),
diff --git a/tests/numerics/26.c.math.cpp b/tests/numerics/26.c.math.cpp
index 47e5d9c..9eede3c 100644
--- a/tests/numerics/26.c.math.cpp
+++ b/tests/numerics/26.c.math.cpp
@@ -208,7 +208,7 @@
                 const float xf = std::pow (fi, j);
                 const float yf = std::pow (fi, fj);
 
-                rw_assert (rw_equal (xf, yf) || !i && j < 0,
+                rw_assert (rw_equal (xf, yf) || (!i && j < 0),
                            0, __LINE__,
                            "std::pow (%d.0f, %d) = %g, "
                            "std::pow (%d,0f, %d.0f) = %g",
@@ -221,7 +221,7 @@
             const double xd = std::pow (id, j);
             const double yd = std::pow (id, jd);
 
-            rw_assert (rw_equal (xd, yd) || !i && j < 0,
+            rw_assert (rw_equal (xd, yd) || (!i && j < 0),
                        0, __LINE__,
                        "std::pow (%d.0, %d) = %g, "
                        "std::pow (%d.0, %d.0) = %g",
@@ -235,7 +235,7 @@
             const long double xl = std::pow (il, j);
             const long double yl = std::pow (il, jl);
 
-            rw_assert (rw_equal (xl, yl) || !i && j < 0,
+            rw_assert (rw_equal (xl, yl) || (!i && j < 0),
                        0, __LINE__,
                        "std::pow (%d.0L, %d) = %Lg, "
                        "std::pow (%d.0L, %d.0L) = %Lg",
diff --git a/tests/regress/21.string.append.stdcxx-438.cpp b/tests/regress/21.string.append.stdcxx-438.cpp
index a260c14..ab58c9f 100644
--- a/tests/regress/21.string.append.stdcxx-438.cpp
+++ b/tests/regress/21.string.append.stdcxx-438.cpp
@@ -40,7 +40,7 @@
 {
     void* const ptr = std::malloc (n + sizeof n);
     if (!ptr)
-        return 0;
+        throw std::bad_alloc ();
 
     std::memset (ptr, -1, n);
     *(std::size_t*)ptr = n;
diff --git a/tests/regress/21.string.replace.stdcxx-175.cpp b/tests/regress/21.string.replace.stdcxx-175.cpp
index 505bf39..f910f66 100644
--- a/tests/regress/21.string.replace.stdcxx-175.cpp
+++ b/tests/regress/21.string.replace.stdcxx-175.cpp
@@ -28,17 +28,15 @@
 #include <string>
 #include <stdexcept>
 
-int main (int argc, char* argv [])
+int main ()
 {
     std::string s (4095, 'a');
 
-    try 
-    {
+    try {
         s.replace (0, 1, "a", s.max_size () + 1);
         assert (!"Expect length error, got nothing");
     }
-    catch (std::length_error& e)
-    {
+    catch (std::length_error&) {
     }
 
     return 0;
diff --git a/tests/regress/21.string.stdcxx-466.cpp b/tests/regress/21.string.stdcxx-466.cpp
index 19683a8..860218d 100644
--- a/tests/regress/21.string.stdcxx-466.cpp
+++ b/tests/regress/21.string.stdcxx-466.cpp
@@ -27,7 +27,7 @@
 #include <cassert>
 #include <string>
 
-int main (int argc, char* argv[])
+int main ()
 {
     std::string s ("efgh");
 
diff --git a/tests/regress/22.locale.messages.stdcxx-542.cpp b/tests/regress/22.locale.messages.stdcxx-542.cpp
index d755bbc..5b29aeb 100644
--- a/tests/regress/22.locale.messages.stdcxx-542.cpp
+++ b/tests/regress/22.locale.messages.stdcxx-542.cpp
@@ -65,7 +65,7 @@
 
     messagesT::catalog cats [4];
 
-    int i;
+    std::size_t i;
 
     // test STDCXX-508
     for (i = 0; i < sizeof (cats) / sizeof (*cats); ++i) {
@@ -74,7 +74,7 @@
     }
     
     // test STDCXX-542
-    for (--i; i >= 0; --i)
+    while (i-- > 0)
         msgs.close (cats [i]);
 
     std::remove (CATALOG CAT_EXT);
diff --git a/tests/regress/23.list.cons.stdcxx-268.cpp b/tests/regress/23.list.cons.stdcxx-268.cpp
index a27b68e..9f76d69 100644
--- a/tests/regress/23.list.cons.stdcxx-268.cpp
+++ b/tests/regress/23.list.cons.stdcxx-268.cpp
@@ -51,7 +51,8 @@
 
 int ListItem::count_ = 0;
 
-int main(int argc, char* argv[])
+
+int main ()
 {
     typedef std::list<ListItem> List;
     ListItem items [20];
diff --git a/tests/regress/23.list.insert.stdcxx-331.cpp b/tests/regress/23.list.insert.stdcxx-331.cpp
index 36e31aa..776b59f 100644
--- a/tests/regress/23.list.insert.stdcxx-331.cpp
+++ b/tests/regress/23.list.insert.stdcxx-331.cpp
@@ -51,7 +51,8 @@
 
 int ListItem::count_ = 0;
 
-int main (int argc, char* argv[])
+
+int main ()
 {
     typedef std::list<ListItem> List;
     ListItem items [20];
diff --git a/tests/regress/23.list.special.stdcxx-334.cpp b/tests/regress/23.list.special.stdcxx-334.cpp
index 0668e8c..687c2ad 100644
--- a/tests/regress/23.list.special.stdcxx-334.cpp
+++ b/tests/regress/23.list.special.stdcxx-334.cpp
@@ -32,17 +32,18 @@
 {
 };
 
-bool operator == (Alloc a1, Alloc a2)
+bool operator== (Alloc, Alloc)
 {
     return false;
 }
 
-bool operator != (Alloc a1, Alloc a2)
+bool operator!= (Alloc, Alloc)
 {
     return true;
 }
 
-int main(int argc, char* argv[])
+
+int main ()
 {
     const char src [] = "source string";
     const char dst [] = "destination string";
diff --git a/tests/regress/23.set.stdcxx-216.cpp b/tests/regress/23.set.stdcxx-216.cpp
index 271bc4a..ef284f8 100644
--- a/tests/regress/23.set.stdcxx-216.cpp
+++ b/tests/regress/23.set.stdcxx-216.cpp
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2008 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -33,15 +33,15 @@
 {
     static const unsigned magic = 0x12344321;
 
-    Value (unsigned value = 0)
-        : value (value)
-        , valid (magic)
+    Value (unsigned val = 0)
+        : value (val),
+          valid (magic)
     {
     }
 
     Value (const Value& key)
-        : value (key.value)
-        , valid (key.magic)
+        : value (key.value),
+          valid (key.magic)
     {
     }
 
@@ -89,17 +89,6 @@
     unsigned valid;
 };
 
-//#include <iostream>
-//
-//void dump (const std::set<Value>& s)
-//{
-//    std::set<Value>::const_iterator b = s.begin ();
-//    std::set<Value>::const_iterator e = s.end   ();
-//
-//    for (/**/; b != e; ++b)
-//        std::cout << b->value << ' ';
-//    std::cout << std::endl;
-//}
 
 int main ()
 {
diff --git a/tests/regress/23.vector.stdcxx-1037.cpp b/tests/regress/23.vector.stdcxx-1037.cpp
index bdaa1b2..c48877c 100644
--- a/tests/regress/23.vector.stdcxx-1037.cpp
+++ b/tests/regress/23.vector.stdcxx-1037.cpp
@@ -42,7 +42,8 @@
     };
 
     template <typename U>
-    Alloc (const Alloc<U>& other) : std::allocator (other), i_ (other.i_) { }
+    Alloc (const Alloc<U>& other)
+        : std::allocator<T>(other), i_ (other.i_) { }
 
     template <typename U>
     Alloc& operator= (const Alloc<U>& other)
diff --git a/tests/self/0.fnmatch.cpp b/tests/self/0.fnmatch.cpp
index a5a970d..c3e9ac8 100644
--- a/tests/self/0.fnmatch.cpp
+++ b/tests/self/0.fnmatch.cpp
@@ -48,7 +48,7 @@
     const int native = exp;
 #endif   // FNMATCH
 
-    if (result != native || -1 < exp && result != exp) {
+    if (result != native || (-1 < exp && result != exp)) {
 
         ++nerrors;
 
diff --git a/tests/src/23.containers.cpp b/tests/src/23.containers.cpp
index 72d5151..855ab97 100644
--- a/tests/src/23.containers.cpp
+++ b/tests/src/23.containers.cpp
@@ -298,9 +298,10 @@
         RW_ASSERT (0 != tname);
 
         if (   0 == func || is_member
-            || Ids::arg_cont != argtype && Ids::arg_ccont != argtype) {
+            || (Ids::arg_cont != argtype && Ids::arg_ccont != argtype)) {
                 // append the name or mnemonic of the argument type
-                rw_asnprintf (pbuf, pbufsize, "%{+}%{?}_%{:}%{?}, %{;}%{;}%s%s%s",
+                rw_asnprintf (pbuf, pbufsize,
+                              "%{+}%{?}_%{:}%{?}, %{;}%{;}%s%s%s",
                     0 == func, 0 < argno, pfx, tname, sfx);
             }
         else {
diff --git a/tests/src/char.cpp b/tests/src/char.cpp
index d5c5a06..534a6fb 100644
--- a/tests/src/char.cpp
+++ b/tests/src/char.cpp
@@ -332,21 +332,21 @@
 {
     ++n_calls_ [MemFun::lt];
 
-    return c1.f < c2.f || c1.f == c2.f && c1.c < c2.c;
+    return c1.f < c2.f || (c1.f == c2.f && c1.c < c2.c);
 }
 
 
 int UserTraits<UserChar>::
 compare (const char_type *s1, const char_type *s2, size_t n)
 {
-    RW_ASSERT (0 == n || s1 && s2);
+    RW_ASSERT (0 == n || (s1 && s2));
 
     ++n_calls_ [MemFun::compare];
 
     for (size_t i = 0; i != n; ++i) {
         if (s1 [i].f != s2 [i].f || s1 [i].c != s2 [i].c) {
             if (   s1 [i].f < s2 [i].f
-                || s1 [i].f == s2 [i].f && s1 [i].c < s2 [i].c)
+                || (s1 [i].f == s2 [i].f && s1 [i].c < s2 [i].c))
                 return -1;
 
             return 1;
@@ -393,7 +393,7 @@
 UserTraits<UserChar>::
 copy (char_type *dst, const char_type *src, size_t n)
 {
-    RW_ASSERT (0 == n || dst && src);
+    RW_ASSERT (0 == n || (dst && src));
 
     ++n_calls_ [MemFun::copy];
 
@@ -408,7 +408,7 @@
 UserTraits<UserChar>::
 move (char_type *dst, const char_type *src, size_t n)
 {
-    RW_ASSERT (0 == n || dst && src);
+    RW_ASSERT (0 == n || (dst && src));
 
     ++n_calls_ [MemFun::move];
 
diff --git a/tests/src/cmdopt.cpp b/tests/src/cmdopt.cpp
index 146de8b..bb33264 100644
--- a/tests/src/cmdopt.cpp
+++ b/tests/src/cmdopt.cpp
@@ -121,8 +121,8 @@
 
         if (opthelp && *opthelp) {
 
-            if (   opt->sopt_ == opthelp [0] && '\0' == opthelp [1]
-                || *lopt && 0 == strcmp (lopt + 1, opthelp)) {
+            if (   (opt->sopt_ == opthelp [0] && '\0' == opthelp [1])
+                || (*lopt && 0 == strcmp (lopt + 1, opthelp))) {
 
                 // remember that we found the option whose (short
                 // or long) name we're to give help on; after printing
@@ -374,7 +374,7 @@
 
             if (   '*' == *next
                 || '+' == *next
-                || val < 0 && '-' == *next
+                || (val < 0 && '-' == *next)
                 || isdigit (*next)) {
 
                 end = 0;
@@ -991,11 +991,11 @@
 
                 // try to match the long option first, and only if it
                 // doesn't match try the short single-character option
-                if (   cmplen == strlen (lopt)
-                    && 0 == memcmp (optname, lopt, cmplen)
-                    || opt->sopt_
-                    && optname [0] == opt->sopt_
-                    && (1 == optlen || opt->arg_)) {
+                if (   (   cmplen == strlen (lopt)
+                        && 0 == memcmp (optname, lopt, cmplen))
+                    || (   opt->sopt_
+                        && optname [0] == opt->sopt_
+                        && (1 == optlen || opt->arg_))) {
 
                     // matching option has been found
                     found = true;
diff --git a/tests/src/locale.cpp b/tests/src/locale.cpp
index 34f456f..07d21f2 100644
--- a/tests/src/locale.cpp
+++ b/tests/src/locale.cpp
@@ -676,7 +676,7 @@
         const wchar_t wc = wchar_t (i);
         const int len = wctomb (tmp, wc);
 
-        if (nbytes == 0 && 0 < len || nbytes != 0 && nbytes == len) {
+        if ((nbytes == 0 && 0 < len) || (nbytes != 0 && nbytes == len)) {
             // if the requested length is 0 (i.e., the caller doesn't
             // care) and the character is valid, store it
             // if the requested length is non-zero (including -1),
@@ -706,7 +706,7 @@
 
         const int len = wctomb (tmp, wc);
 
-        if (nbytes == 0 && 0 < len || nbytes != 0 && nbytes == len) {
+        if ((nbytes == 0 && 0 < len) || (nbytes != 0 && nbytes == len)) {
             wbuf [nchars++] = wc;
             if (nchars == bufsize)
                 return nchars;
diff --git a/tests/src/opt_lines.cpp b/tests/src/opt_lines.cpp
index 16441bf..8fc1c15 100644
--- a/tests/src/opt_lines.cpp
+++ b/tests/src/opt_lines.cpp
@@ -130,7 +130,7 @@
         // skip any trailing whitespace
         for ( ; ' ' == *end; ++end);
 
-        if (end == parg || '-' != *end && ',' != *end && '\0' != *end) {
+        if (end == parg || ('-' != *end && ',' != *end && '\0' != *end)) {
             fprintf (stderr,
                      "invalid character '%c' at position %d: \"%s\"\n",
                      *end, int (parg - argbeg), argv [0]);
diff --git a/tests/src/opt_trace.cpp b/tests/src/opt_trace.cpp
index 005fb88..2cefe15 100644
--- a/tests/src/opt_trace.cpp
+++ b/tests/src/opt_trace.cpp
@@ -115,7 +115,7 @@
         // skip any trailing whitespace
         for ( ; ' ' == *end; ++end);
 
-        if (end == parg || '-' != *end && ',' != *end && '\0' != *end) {
+        if (end == parg || ('-' != *end && ',' != *end && '\0' != *end)) {
             fprintf (stderr,
                      "invalid character '%c' at position %d: \"%s\"\n",
                      *end, int (parg - argbeg), argv [0]);
diff --git a/tests/src/printf.cpp b/tests/src/printf.cpp
index 3c5dd94..acd0c35 100644
--- a/tests/src/printf.cpp
+++ b/tests/src/printf.cpp
@@ -2232,7 +2232,7 @@
 
         len += n;
 
-        if (i + 1 == argc || _RWSTD_SIZE_MAX == argc && 0 == argv [i + 1])
+        if (i + 1 == argc || (_RWSTD_SIZE_MAX == argc && 0 == argv [i + 1]))
             break;
 
         const unsigned pound = spec.fl_pound;
@@ -2845,8 +2845,9 @@
         break;
 
     case 'S':   // %{S}, %{lS}, %{#*S}
-        if (   spec.mod == spec.mod_l || spec.mod == FmtSpec::mod_none
-            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
+        if (   spec.mod == spec.mod_l
+            || (   spec.mod == FmtSpec::mod_none
+                && spec.fl_pound && sizeof (wchar_t) == spec.width)) {
             // std::wstring
             spec.param.ptr_ = PARAM (ptr_, pva);
 
@@ -3269,7 +3270,7 @@
     // verify that the length of the fomatted buffer is less than
     // its size (this test is unreliable if there are any embedded
     // NULs in the output)
-    RW_ASSERT (nchars < 0 || buf && strlen (buf) < bufsize);
+    RW_ASSERT (nchars < 0 || (buf && strlen (buf) < bufsize));
 
     _RWSTD_UNUSED (nchars);
 
diff --git a/tests/strings/21.string.compare.cpp b/tests/strings/21.string.compare.cpp
index e894cc0..d9866a6 100644
--- a/tests/strings/21.string.compare.cpp
+++ b/tests/strings/21.string.compare.cpp
@@ -800,9 +800,9 @@
         }
 
         // verify the returned value
-        const bool success =    res < 0 && tcase.nres == NPOS
-                             || res > 0 && tcase.nres > 0
-                             || res == 0 && tcase.nres == 0;
+        const bool success =    (res < 0 && tcase.nres == NPOS)
+                             || (res > 0 && tcase.nres > 0)
+                             || (res == 0 && tcase.nres == 0);
 
         rw_assert (success, 0, tcase.line,
                    "line %d. %{$FUNCALL} == %d, got %d",
diff --git a/tests/strings/21.string.io.cpp b/tests/strings/21.string.io.cpp
index 4627683..636f453 100644
--- a/tests/strings/21.string.io.cpp
+++ b/tests/strings/21.string.io.cpp
@@ -1141,8 +1141,8 @@
                        func.which_ == StringIds::getline_istream_str
                     || func.which_ == StringIds::getline_istream_str_val
 #ifndef _RWSTD_NO_EXT_KEEP_WIDTH_ON_FAILURE
-                    || func.which_ == StringIds::inserter_ostream_cstr
-                    && ret_state != Good
+                    || (   func.which_ == StringIds::inserter_ostream_cstr
+                        && ret_state != Good)
 #endif  // _RWSTD_NO_EXT_KEEP_WIDTH_ON_FAILURE
                     ? tcase.off : tcase.val;
 
diff --git a/tests/support/18.numeric.special.float.cpp b/tests/support/18.numeric.special.float.cpp
index 5940939..c2542b5 100644
--- a/tests/support/18.numeric.special.float.cpp
+++ b/tests/support/18.numeric.special.float.cpp
@@ -1259,8 +1259,8 @@
         _RWSTD_UNUSED (pf);                                                \
         /* verify value */                                                 \
         rw_assert (   FLim::member () == FVal::member ()                   \
-                   || FLim::member () != FLim::member ()                   \
-                   && FVal::member () != FVal::member (),                  \
+                   || (   FLim::member () != FLim::member ()               \
+                       && FVal::member () != FVal::member ()),             \
                    0, __LINE__,                                            \
                    "numeric_limits<%s>::" #member "() == %{@}, got %{@}",  \
                    tname, fmt, FVal::member (), fmt, FLim::member ());     \
diff --git a/util/collate.cpp b/util/collate.cpp
index e7353bc..b95b032 100644
--- a/util/collate.cpp
+++ b/util/collate.cpp
@@ -151,8 +151,8 @@
                     std::string second = ord_it->name.substr (comma_pos + 1);
 
                     // verify a valid weight ordering
-                    if ((first == "forward" && second != "position") || 
-                        first == "backward" && second != "position") {
+                    if (   (first == "forward" && second != "position")
+                        || (first == "backward" && second != "position")) {
                         issue_diag (E_COLORD, true,
                                     &*ord_it, "unrecognized collating order\n");
                         break;
diff --git a/util/exec.cpp b/util/exec.cpp
index 6f6823d..897a900 100644
--- a/util/exec.cpp
+++ b/util/exec.cpp
@@ -550,8 +550,9 @@
             else if (WIFCONTINUED (status))
                 stopped = 0;
 #endif
-            else
-                ;   /* huh? */
+            else {
+                /* huh? */
+            }
         }
         else if ((pid_t)-1 == wait_pid) {
             if (EINTR == errno && alarm_timeout) {
@@ -619,8 +620,9 @@
                 if (waitopts)
                     /* bad waitpid options, reset to 0 and try again */
                     waitopts = 0;
-                else
-                    ; /* Now what? */
+                else {
+                    /* Now what? */
+                }
             }
             else if (ECHILD == errno) {
                 /* should not happen */
diff --git a/util/locale.cpp b/util/locale.cpp
index 4d1ab5f..1ac9b53 100644
--- a/util/locale.cpp
+++ b/util/locale.cpp
@@ -865,8 +865,6 @@
                         if (n_cmap2_it != cmap->get_mb_cmap().end())
                             std::cout << cmap->get_rw_cmap().find(
                                 n_cmap2_it->second)->second;
-                        else
-                            ;
                     }
                     else {
                         for (unsigned int j = 0; j < idx; j++) {