stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r651334 - in /stdcxx/trunk: include/loc/ src/ tests/algorithms/ tests/localization/ tests/src/ util/
Date Thu, 24 Apr 2008 18:20:16 GMT
Author: sebor
Date: Thu Apr 24 11:20:08 2008
New Revision: 651334

URL: http://svn.apache.org/viewvc?rev=651334&view=rev
Log:
2008-04-24  Martin Sebor  <sebor@roguewave.com>

	Merged revs 651098, 651095, 651086, 651034, 651029, 651012, 650944,
	and 650678 from 4.2.x.

	2008-04-22  Martin Sebor  <sebor@roguewave.com>

        STDCXX-753
        * util/charmap.cpp (Charmap::convert_to_ucs): Unconditionally
        allocated (8 + 1) bytes for the longest UTF-8 character rather
        than assuming that MB_LEN_MAX is large enough.

	2008-04-23  Martin Sebor  <sebor@roguewave.com>

        STDCXX-879
        * tests/algorithms/25.random.shuffle.cpp: Changed the type used
        to explicitly instantiate the algorithm to avoid HP aCC remark
        4271: type conversion may lose sign.

	2008-04-23  Martin Sebor  <sebor@roguewave.com>

        STDCXX-775
        * test/localization/22.locale.time.get.cpp (make_LC_TIME): Asserted
        postconditions to silence HP aCC 6/cadvise warning #20200: Potential
        null pointer dereference.

	2008-04-23  Martin Sebor  <sebor@roguewave.com>

        STDCXX-771
        * test/localization/22.locale.money.put.cpp (run_test): Used volatile
        to conceal division by zero from optimizers and to silence HP aCC 6
        warning #20010-D: Floating-point DIVIDE BY ZERO exception generated.
        * test/localization/22.locale.moneypunct.cpp (lconvdup): Used
        operator new instead of the new expression to allocate a type-less
        block of memory.
        (check_moneypunct): Deallocated the block of memory allocated in
        lconvdup() using the matching operator delete() to silence HP aCC
        warning #20210-D: Mismatch in allocation and deallocation.

	2008-04-23  Martin Sebor  <sebor@roguewave.com>

        STDCXX-757
        * tests/src/value.cpp (UserClass::assign): Added a (redundant) default
        label to switch statement to shut up bogus HP aCC warning #20200-D:
        Potential null pointer dereference.
        (__rw_from_char): Asserted a trivially true precondition to silence
        the same warning.
        (_rw_fmtxarrayv): Removed an unused local variable.

	2008-04-23  Martin Sebor  <sebor@roguewave.com>

        STDCXX-745
        STDCXX-746
        STDCXX-747
        * src/locale_body.cpp [6 <= HP aCC <= 6.16]: Silenced bogus HP aCC
        6.16/cadvise warning #20200-D: Potential null pointer dereference.
        * src/locale_name.cpp: Same.
        * locale_combine.cpp: Same.

        STDCXX-879
        * src/locale_combine.cpp (_C_get_body): Used a previously computed
        value of the expected type to   silence HP aCC remark #4271 type
        conversion may lose sign.

	2008-04-23  Martin Sebor  <sebor@roguewave.com>

        STDCXX-729
        * include/loc/_money_put.cc [__GNUG__] (_C_put): Silenced bogus
        gcc -Wuninitialized warning: object may be used uninitialized in
        this function while avoiding bogus HP aCC/cadvise warning 20200:
        potential null pointer dereference.

Modified:
    stdcxx/trunk/include/loc/_money_put.cc
    stdcxx/trunk/src/locale_body.cpp
    stdcxx/trunk/src/locale_combine.cpp
    stdcxx/trunk/src/locale_name.cpp
    stdcxx/trunk/tests/algorithms/25.random.shuffle.cpp
    stdcxx/trunk/tests/localization/22.locale.money.put.cpp
    stdcxx/trunk/tests/localization/22.locale.moneypunct.cpp
    stdcxx/trunk/tests/localization/22.locale.time.get.cpp
    stdcxx/trunk/tests/src/value.cpp
    stdcxx/trunk/util/charmap.cpp

Modified: stdcxx/trunk/include/loc/_money_put.cc
URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_money_put.cc?rev=651334&r1=651333&r2=651334&view=diff
==============================================================================
--- stdcxx/trunk/include/loc/_money_put.cc (original)
+++ stdcxx/trunk/include/loc/_money_put.cc Thu Apr 24 11:20:08 2008
@@ -67,8 +67,17 @@
     typedef moneypunct<_CharT, false> _Punct0;
     typedef moneypunct<_CharT, true>  _Punct1;
 
-    const _Punct0* __pun0 = 0;
-    const _Punct1* __pun1 = 0;
+    const _Punct0* __pun0;
+    const _Punct1* __pun1;
+
+#ifdef __GNUG__
+    // silence bogus gcc -Wuninitialized warning:
+    //   object may be used uninitialized in this function
+    // while avoiding bogus HP aCC/cadvise warning 20200:
+    //   potential null pointer dereference 
+    __pun0 = 0;
+    __pun1 = 0;
+#endif   // gcc
 
     if (__intl) {
         __pun1 = &_RWSTD_USE_FACET (_Punct1, __flags.getloc ());

Modified: stdcxx/trunk/src/locale_body.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/locale_body.cpp?rev=651334&r1=651333&r2=651334&view=diff
==============================================================================
--- stdcxx/trunk/src/locale_body.cpp (original)
+++ stdcxx/trunk/src/locale_body.cpp Thu Apr 24 11:20:08 2008
@@ -25,7 +25,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2006 Rogue Wave Software.
+ * Copyright 2001-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -65,6 +65,13 @@
 #endif   // _RWSTD_NO_LOCALE_NAME_FMAT
 
 
+#if 6 == _RWSTD_HP_aCC_MAJOR && _RWSTD_HP_aCC_MINOR <= 1600
+   // silence bogus HP aCC 6.16/cadvise warning #20200-D:
+   // Potential null pointer dereference
+#  pragma diag_suppress 20200
+#endif
+
+
 _RWSTD_NAMESPACE (__rw) {
 
 
@@ -819,7 +826,7 @@
             else {
                 // ginit must be volatile to prevent optimizers
                 // from turning this into an infinite loop
-                while (ginit < 1000);
+                while (ginit < 1000) { /* empty */ }
             }
         }
 

Modified: stdcxx/trunk/src/locale_combine.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/locale_combine.cpp?rev=651334&r1=651333&r2=651334&view=diff
==============================================================================
--- stdcxx/trunk/src/locale_combine.cpp (original)
+++ stdcxx/trunk/src/locale_combine.cpp Thu Apr 24 11:20:08 2008
@@ -23,7 +23,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -41,6 +41,12 @@
 #include "locale_body.h"
 #include "setlocale.h"
 
+#if 6 == _RWSTD_HP_aCC_MAJOR && _RWSTD_HP_aCC_MINOR <= 1600
+   // silence bogus HP aCC 6.16/cadvise warning #20200-D:
+   // Potential null pointer dereference
+#  pragma diag_suppress 20200
+#endif
+
 
 _RWSTD_NAMESPACE (__rw) {
 
@@ -544,7 +550,7 @@
             const _RWSTD_SIZE_T catsize = endcat - pcatnames [i];
 
             // append name followed by the libc "native" separator
-            realname.append (pcatnames [i], endcat - pcatnames [i]);
+            realname.append (pcatnames [i], catsize);
             realname.append (_RWSTD_CAT_SEP, 1);
 
             size += catsize;

Modified: stdcxx/trunk/src/locale_name.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/locale_name.cpp?rev=651334&r1=651333&r2=651334&view=diff
==============================================================================
--- stdcxx/trunk/src/locale_name.cpp (original)
+++ stdcxx/trunk/src/locale_name.cpp Thu Apr 24 11:20:08 2008
@@ -38,6 +38,12 @@
 
 #include "locale_body.h"
 
+#if 6 == _RWSTD_HP_aCC_MAJOR && _RWSTD_HP_aCC_MINOR <= 1600
+   // silence bogus HP aCC 6.16/cadvise warning #20200-D:
+   // Potential null pointer dereference
+#  pragma diag_suppress 20200
+#endif
+
 
 _RWSTD_NAMESPACE (std) { 
 

Modified: stdcxx/trunk/tests/algorithms/25.random.shuffle.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/algorithms/25.random.shuffle.cpp?rev=651334&r1=651333&r2=651334&view=diff
==============================================================================
--- stdcxx/trunk/tests/algorithms/25.random.shuffle.cpp (original)
+++ stdcxx/trunk/tests/algorithms/25.random.shuffle.cpp Thu Apr 24 11:20:08 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -49,7 +49,7 @@
 void
 random_shuffle (RandomAccessIter<assign<base<cpy_ctor> > >, 
                 RandomAccessIter<assign<base<cpy_ctor> > >,
-                func<const std::size_t >&);
+                func<const long>&);
 
 #endif // _RWSTD_NO_EXPLICIT_INSTANTIATION
 

Modified: stdcxx/trunk/tests/localization/22.locale.money.put.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.money.put.cpp?rev=651334&r1=651333&r2=651334&view=diff
==============================================================================
--- stdcxx/trunk/tests/localization/22.locale.money.put.cpp (original)
+++ stdcxx/trunk/tests/localization/22.locale.money.put.cpp Thu Apr 24 11:20:08 2008
@@ -833,7 +833,7 @@
 run_test (int, char*[])
 {
     // check to see if we can test -0.0
-    static double d = -0.0;
+    static volatile double d = -0.0;
     test_neg_zero = 1.0 / d < d;
     
     if (no_grouping)

Modified: stdcxx/trunk/tests/localization/22.locale.moneypunct.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.moneypunct.cpp?rev=651334&r1=651333&r2=651334&view=diff
==============================================================================
--- stdcxx/trunk/tests/localization/22.locale.moneypunct.cpp (original)
+++ stdcxx/trunk/tests/localization/22.locale.moneypunct.cpp Thu Apr 24 11:20:08 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1998-2006 Rogue Wave Software.
+ * Copyright 1998-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -75,7 +75,9 @@
         + positive_sign_sz
         + negative_sign_sz;
 
-    char *pbuf = new char [sizeof (std::lconv) + total_sz];
+    const std::size_t bufsize = sizeof (std::lconv) + total_sz;
+
+    char *pbuf = _RWSTD_STATIC_CAST (char*, operator new (bufsize));
 
     std::lconv *plconv2 = _RWSTD_REINTERPRET_CAST (std::lconv*, pbuf);
 
@@ -429,7 +431,7 @@
         check_format (*plconv);
 
         // cast away constness to work around compiler bugs (e.g., MSVC 6)
-        delete _RWSTD_CONST_CAST (std::lconv*, plconv);
+        operator delete (_RWSTD_CONST_CAST (std::lconv*, plconv));
     }
     _CATCH (...) {
         return false;

Modified: stdcxx/trunk/tests/localization/22.locale.time.get.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.time.get.cpp?rev=651334&r1=651333&r2=651334&view=diff
==============================================================================
--- stdcxx/trunk/tests/localization/22.locale.time.get.cpp (original)
+++ stdcxx/trunk/tests/localization/22.locale.time.get.cpp Thu Apr 24 11:20:08 2008
@@ -1141,6 +1141,9 @@
     rw_fatal (0 != fout, 0, __LINE__,
               "fopen(%#s, \"w\") failed: %{#m} - %m", srcfname);
 
+    // rw_fatal() doesn't return on failure
+    RW_ASSERT (0 != fout);
+
     std::fprintf (fout, "LC_TIME\n");
 
     unsigned i;
@@ -1278,6 +1281,9 @@
     fout = std::fopen (cmfname, "w");
     rw_fatal (0 != fout, 0, __LINE__,
               "fopen(%#s, \"w\") failed: %{#m} - %m", cmfname);
+
+    // rw_fatal() doesn't return on failure
+    RW_ASSERT (0 != fout);
 
     pcs_write (fout, 0);
 

Modified: stdcxx/trunk/tests/src/value.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/value.cpp?rev=651334&r1=651333&r2=651334&view=diff
==============================================================================
--- stdcxx/trunk/tests/src/value.cpp (original)
+++ stdcxx/trunk/tests/src/value.cpp Thu Apr 24 11:20:08 2008
@@ -244,6 +244,12 @@
         pex        = &ex_div_assign;
         new_val    = data_.val_ / rhs.data_.val_;
         break;
+
+    default:
+        // should never get here (silences bogus HP aCC/cadvise
+        // warning #20200-D: Potential null pointer dereference)
+        RW_ASSERT (!"unhandled case");
+        return;
     }
 
     // increment the number of invocations of the operator
@@ -494,6 +500,11 @@
 
     typedef unsigned char UChar;
 
+    // this should trivially hold given the above but the assert
+    // silences bogus HP aCC/cadvise warning #20200-D: Potential
+    // null pointer dereference
+    RW_ASSERT (0 != array);
+
     for (size_t i = 0; i < strlen_; ++i)
         array [i].data_.val_ = UChar (str_ [i]);
 
@@ -680,7 +691,6 @@
     bool     fl_plus  =  false;
     bool     fl_pound =  false;
     int      nelems   = -1;
-    int      paramno  = -1;
     int      cursor   = -1;
 
     const UserClass* pelem    = 0;
@@ -731,9 +741,7 @@
         // process positional parameter or width
         char* end = 0;
         const int arg = strtol (fmt, &end, 10);
-        if ('$' == *end)
-            paramno = arg;
-        else
+        if ('$' != *end)
             nelems = arg;
 
         fmt = end;

Modified: stdcxx/trunk/util/charmap.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/util/charmap.cpp?rev=651334&r1=651333&r2=651334&view=diff
==============================================================================
--- stdcxx/trunk/util/charmap.cpp (original)
+++ stdcxx/trunk/util/charmap.cpp Thu Apr 24 11:20:08 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2007 Rogue Wave Software, Inc.
+ * Copyright 2001-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -671,7 +671,8 @@
         return true;
     }
 
-    char utf8_enc [_RWSTD_MB_LEN_MAX + 1];
+    // allocate enough space for the longest possible UTF-8 character
+    char utf8_enc [8 + 1 /* NUL */];
 
     const char* const ch_end =
         convert_to_utf8  (encoding.c_str (), encoding.size (),



Mime
View raw message