Author: sebor
Date: Mon Apr 21 18:35:17 2008
New Revision: 650350
URL: http://svn.apache.org/viewvc?rev=650350&view=rev
Log:
2008-04-21 Martin Sebor <[EMAIL PROTECTED]>
* Merged revs 649223, 649311, 649363, 649562, 649563, 649564, 649565,
649620, 649646, and 649673 from trunk:
2008-04-17 Martin Sebor <[EMAIL PROTECTED]>
* tests/localization/22.locale.ctype.narrow.cpp: Corrected comments.
(test_narrow_widen): Used rw_info() to write out the name of each
tested locale.
(test_libstd): New function/placeholder to exercise our standalone
implementation of locale (independent of libc).
(run_test<charT>): Called test_libstd().
(run_test): Used the set of locales specified on the command line
instead of the hardcoded pattern.
Added an _RWSTD_NO_WCHAR_T guard.
(main): Used the rw_opt_setlocales handler.
2008-04-17 Martin Sebor <[EMAIL PROTECTED]>
STDCXX-700
* tests/utilities/20.temp.buffer.mt.cpp (thr_func): Used the right
formatting directive.
2008-04-17 Martin Sebor <[EMAIL PROTECTED]>
STDCXX-879
* src/facet.cpp (_C_get_data): Explicitly converted pointer difference
to size_t to avoid HP aCC remark #4271-D: type conversion may lose
sign.
* src/collate.cpp (do_transform): Same.
* src/locale_name.cpp (name): Same.
* src/locale_core.cpp (_C_get_std_facet): Same.
* src/num_put.cpp (__rw_itoa): Changed the type of a local to match
the the type of the expression it's initialized with to silence the
same remark.
(__rw_itoa): Silenced gcc (but not aCC) warning: comparison between
signed and unsigned integer expressions in an assertion.
2008-04-18 Eric Lemings <[EMAIL PROTECTED]>
STDCXX-870
* tests/strings/21.string.exceptions.cpp: Migrated new test from
old Perforce repository.
2008-04-18 Eric Lemings <[EMAIL PROTECTED]>
STDCXX-867
* tests/numerics/26.valarray.transcend.cpp: Migrated new test
from old Perforce repository.
2008-04-18 Eric Lemings <[EMAIL PROTECTED]>
STDCXX-866
* tests/localization/22.locale.ctype.widen.cpp: Migrated new
test from old Perforce repository.
2008-04-18 Eric Lemings <[EMAIL PROTECTED]>
STDCXX-865
* tests/intro/17.extensions.cpp: Migrated new test from old
Perforce repository.
2008-04-18 Martin Sebor <[EMAIL PROTECTED]>
* tests/regress/22.locale.money.get.stdcxx-62.cpp: Added regression
test for STDCXX-62.
2008-04-18 Farid Zaripov <[EMAIL PROTECTED]>
* include/rw/_defs.h: #define new general purpose config macro
_RWSTD_UWCHAR_INT_T.
* include/loc/_ctype.h (narrow): Cast __c to _RWSTD_UWCHAR_INT_T
to avoid warnings about signed/unsigned comparisons.
2008-04-18 Martin Sebor <[EMAIL PROTECTED]>
STDCXX-812
* tests/localization/22.locale.num.get.mt.cpp [_RWSTD_OS_HP_UX
|| _ILP32] (rw_opt_nlocales): Decreased from the default to 10
in order to work around an HP-UX inefficiency, and renamed to
opt_nlocales to avoid inappropriately using rwtest convention.
STDCXX-886
* tests/localization/22.locale.num.get.mt.cpp (thread_func):
Avoided appending NUL characters to the input sequence to
prevent failures in locales where the C++ thoudsands_sep is
the NUL character.
(test_get_data): Renamed function argument to match its type.
Added:
stdcxx/branches/4.2.x/tests/intro/17.extensions.cpp
- copied unchanged from r649565,
stdcxx/trunk/tests/intro/17.extensions.cpp
stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.widen.cpp
- copied unchanged from r649564,
stdcxx/trunk/tests/localization/22.locale.ctype.widen.cpp
stdcxx/branches/4.2.x/tests/numerics/26.valarray.transcend.cpp
- copied unchanged from r649563,
stdcxx/trunk/tests/numerics/26.valarray.transcend.cpp
stdcxx/branches/4.2.x/tests/regress/22.locale.money.get.stdcxx-62.cpp
- copied unchanged from r649620,
stdcxx/trunk/tests/regress/22.locale.money.get.stdcxx-62.cpp
stdcxx/branches/4.2.x/tests/strings/21.string.exceptions.cpp
- copied unchanged from r649562,
stdcxx/trunk/tests/strings/21.string.exceptions.cpp
Modified:
stdcxx/branches/4.2.x/src/collate.cpp
stdcxx/branches/4.2.x/src/facet.cpp
stdcxx/branches/4.2.x/src/locale_core.cpp
stdcxx/branches/4.2.x/src/locale_name.cpp
stdcxx/branches/4.2.x/src/num_put.cpp
stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.narrow.cpp
stdcxx/branches/4.2.x/tests/localization/22.locale.num.get.mt.cpp
stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp
Modified: stdcxx/branches/4.2.x/src/collate.cpp
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/collate.cpp?rev=650350&r1=650349&r2=650350&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/collate.cpp (original)
+++ stdcxx/branches/4.2.x/src/collate.cpp Mon Apr 21 18:35:17 2008
@@ -22,7 +22,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.
*
**************************************************************************/
@@ -867,7 +867,7 @@
_RWSTD_ASSERT (0 != __lo);
_RWSTD_ASSERT (__lo <= __hi);
- return string_type (__lo, __hi - __lo);
+ return string_type (__lo, size_t (__hi - __lo));
}
@@ -1041,7 +1041,7 @@
_RWSTD_ASSERT (0 != __lo);
_RWSTD_ASSERT (__lo <= __hi);
- return string_type (__lo, __hi - __lo);
+ return string_type (__lo, size_t (__hi - __lo));
}
Modified: stdcxx/branches/4.2.x/src/facet.cpp
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/facet.cpp?rev=650350&r1=650349&r2=650350&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/facet.cpp (original)
+++ stdcxx/branches/4.2.x/src/facet.cpp Mon Apr 21 18:35:17 2008
@@ -208,13 +208,14 @@
// for the stripping of the special suffix
_RW::__rw_chararray strip_name;
- const char* pstr = strstr (locname.data (), "@UCS");
+ const char* pstr = strstr (locname.data (), "@UCS");
+ const size_t plen = size_t (pstr - locname.data ());
+
if (pstr && !pstr [4]) {
// @UCS suffix is recognized irrespective of the size of wchar_t,
- strip_name.append (locname.data (), pstr - locname.data ());
+ strip_name.append (locname.data (), plen);
pdata = __rw_get_facet_data (cat, sz, strip_name.data ());
-
}
else if ( pstr && pstr [4] == '-' && !pstr [6]
&& ( '4' == pstr [5] && sizeof (wchar_t) == 4
@@ -223,9 +224,8 @@
// @UCS-4 is only recognized where sizeof (wchar_t) == 4
// @UCS-2 is only recognized where sizeof (wchar_t) == 2
// no other modifier is recognized
- strip_name.append (locname.data (), pstr - locname.data ());
+ strip_name.append (locname.data (), plen);
pdata = __rw_get_facet_data (cat, sz, strip_name.data ());
-
}
// if the type of the facet is codecvt_byname<wchar_t,char,mbstate_t>
@@ -275,10 +275,11 @@
__rw_chararray codeset_fname;
const char* codeset = pctype->codeset_name ();
- const char *slash = strrchr (locname.data (), _RWSTD_PATH_SEP);
+ const char* const slash = strrchr (locname.data (), _RWSTD_PATH_SEP);
if (slash) {
+ const size_t dirlen = size_t (slash - locname.data ()) + 1;
- codeset_fname.assign (locname.data (), slash - locname.data () + 1);
+ codeset_fname.assign (locname.data (), dirlen);
codeset_fname.append (codeset);
codeset = codeset_fname.data ();
}
Modified: stdcxx/branches/4.2.x/src/locale_core.cpp
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/locale_core.cpp?rev=650350&r1=650349&r2=650350&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/locale_core.cpp (original)
+++ stdcxx/branches/4.2.x/src/locale_core.cpp Mon Apr 21 18:35:17 2008
@@ -144,7 +144,10 @@
size_t i = 0;
for (; i != sizeof _RW::__rw_cats / sizeof *_RW::__rw_cats; ++i) {
if (_RW::__rw_cats [i].cat == facet_cat) {
- locname.assign (nm, next - nm);
+
+ const size_t nmlen = size_t (next - nm);
+
+ locname.assign (nm, nmlen);
locname.append ("", 1); // append a terminating NUL
break;
}
Modified: stdcxx/branches/4.2.x/src/locale_name.cpp
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/locale_name.cpp?rev=650350&r1=650349&r2=650350&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/locale_name.cpp (original)
+++ stdcxx/branches/4.2.x/src/locale_name.cpp Mon Apr 21 18:35:17 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.
*
**************************************************************************/
@@ -83,7 +83,8 @@
result += '=';
}
- result.append (catnm, next - catnm);
+ const size_t catlen = size_t (next - catnm);
+ result.append (catnm, catlen);
catnm = next + !!*next;
}
Modified: stdcxx/branches/4.2.x/src/num_put.cpp
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/num_put.cpp?rev=650350&r1=650349&r2=650350&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/num_put.cpp (original)
+++ stdcxx/branches/4.2.x/src/num_put.cpp Mon Apr 21 18:35:17 2008
@@ -522,14 +522,14 @@
const char* const pdigs = flags & _RWSTD_IOS_UPPERCASE ?
__rw_digits + 36 : __rw_digits;
- const int basemask = (flags >> _RWSTD_IOS_BASEOFF) - 1;
+ const unsigned basemask = (flags >> _RWSTD_IOS_BASEOFF) - 1;
int bits;
char *end = buf;
switch (basemask) {
- case -1: case 9:
+ case unsigned (-1): case 9:
return __rw_dtoa (end, i, flags);
case 0:
@@ -572,9 +572,9 @@
j = 0;
do {
- const int dig = int ((i >> (j * bits)) & basemask);
+ const unsigned dig = (i >> (j * bits)) & basemask;
- _RWSTD_ASSERT (dig >= 0 && dig <= basemask);
+ _RWSTD_ASSERT (dig <= basemask);
*end++ = pdigs [dig];
} while (j--);
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.narrow.cpp
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.narrow.cpp?rev=650350&r1=650349&r2=650350&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.narrow.cpp
(original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.narrow.cpp Mon Apr
21 18:35:17 2008
@@ -1,6 +1,7 @@
/***************************************************************************
*
- * 22.locale.ctype.cpp - Tests exercising the narrow() and widen() ctype facet
+ * 22.locale.ctype.narrow.cpp - tests exercising the narrow() and widen()
+ * member functions of the ctype facet
*
* $Id$
*
@@ -22,14 +23,14 @@
* 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.
*
**************************************************************************/
-// DESCRIPTION: test iterates over the locales installed on a machine,
-// calling the C character classification functions and
-// their C++ counterpart(s), comparing the results of
-// the calls against one another.
+// DESCRIPTION: The test iterates over a subset of locales installed
+// on a machine, calling the C character classification functions and
+// their C++ counterpart(s), comparing the results of the calls against
+// one another.
#include <rw/_defs.h>
@@ -203,7 +204,7 @@
return ch;
}
-// cond1() verifies condition [1] in Test::test_narrow_widen()
+// cond1() verifies condition [1] in test_narrow_widen()
// below using libc functions
bool cond1 (std::ctype_base::mask mask, char ch, const char *locname)
{
@@ -244,7 +245,7 @@
}
-// cond3() overloads verify condition [3] in Test::test_narrow_widen()
+// cond3() overloads verify condition [3] in test_narrow_widen()
// below using libc functions
bool cond3 (std::ctype_base::mask, char, const char*)
{
@@ -539,6 +540,10 @@
c_locname, curlocname);
}
+ if (0 == i)
+ rw_info (0, 0, __LINE__, "std::ctype<%s> in locale(%#s)",
+ cname, locname);
+
const char c = char (i);
const charT ch = charT (i);
@@ -653,6 +658,7 @@
/**************************************************************************/
+// exercise the behavior of the libc-based C++ locale implementation
template <class charT>
void test_libc (charT, const char *cname)
{
@@ -661,6 +667,17 @@
/**************************************************************************/
+// exercise the behavior of our own C++ locale implementation
+template <class charT>
+void test_libstd (charT, const char *cname)
+{
+ rw_warn (0, 0, __LINE__,
+ "stdcxx implementation of std::ctype<%s> not exercised",
+ cname);
+}
+
+/**************************************************************************/
+
template <class charT>
void run_test (charT, const char *cname)
{
@@ -670,7 +687,11 @@
_STD_USE_FACET (std::ctype_byname<charT>, std::locale ());
}
+ // exercise the behavior of the libc-based C++ locale implementation
test_libc (charT (), cname);
+
+ // exercise the behavior of our own C++ locale implementation
+ test_libstd (charT (), cname);
}
/**************************************************************************/
@@ -678,9 +699,20 @@
static int
run_test (int, char**)
{
+ // set the global locale_list pointer to point to the array
+ // of NUL-separated locale names set on the command line via
+ // the --locales=... option, if specified, or to 0 (in which
+ // case we'll generate our own list)
+ locale_list = rw_opt_locales;
+
run_test (char (), "char");
+
+#ifndef _RWSTD_NO_WCHAR_T
+
run_test (wchar_t (), "wchar_t");
+#endif // _RWSTD_NO_WCHAR_T
+
return 0;
}
@@ -690,8 +722,9 @@
{
return rw_test (argc, argv, __FILE__,
"lib.category.ctype",
- 0 /* no comment */,
+ "narrow and widen",
run_test,
- "",
+ "|-locales= ",
+ &rw_opt_setlocales,
(void*)0 /* sentinel */);
}
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.num.get.mt.cpp
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.num.get.mt.cpp?rev=650350&r1=650349&r2=650350&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.num.get.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.num.get.mt.cpp Mon Apr
21 18:35:17 2008
@@ -47,8 +47,18 @@
// the number of times each thread should iterate
int rw_opt_nloops = MAX_LOOPS;
+#if !defined (_RWSTD_OS_HP_UX) || defined (_ILP32)
+
// number of locales to use
-int rw_opt_nlocales = MAX_THREADS;
+int opt_nlocales = MAX_THREADS;
+
+#else // HP-UX in LP64 mode
+
+// work around an inefficiency (small cache size?) on HP-UX
+// in LP64 mode (see STDCXX-812)
+int opt_nlocales = 10;
+
+#endif // HP-UX 32/64 bit mode
// should all threads share the same set of locale objects instead
// of creating their own?
@@ -214,7 +224,7 @@
template <class charT, class Traits>
void
test_get_data (const MyNumData &data,
- const std::num_get<charT> &np,
+ const std::num_get<charT> &ng,
const std::istreambuf_iterator<charT, Traits> &iter,
const std::istreambuf_iterator<charT, Traits> &end,
std::basic_ios<charT, Traits> &io)
@@ -225,7 +235,7 @@
case MyNumData::put_bool: {
const bool expected = data.value_ < 1.f;
bool checked;
- np.get (iter, end, io, state, checked);
+ ng.get (iter, end, io, state, checked);
RW_ASSERT (! (state & std::ios_base::failbit));
RW_ASSERT (checked == expected);
}
@@ -233,7 +243,7 @@
case MyNumData::put_long: {
const long expected = (long)data.value_;
long checked;
- np.get (iter, end, io, state, checked);
+ ng.get (iter, end, io, state, checked);
RW_ASSERT (! (state & std::ios_base::failbit));
RW_ASSERT (checked == expected);
}
@@ -241,7 +251,7 @@
case MyNumData::put_ulong: {
const unsigned long expected = (unsigned long)data.value_;
unsigned long checked;
- np.get (iter, end, io, state, checked);
+ ng.get (iter, end, io, state, checked);
RW_ASSERT (! (state & std::ios_base::failbit));
RW_ASSERT (checked == expected);
}
@@ -252,7 +262,7 @@
case MyNumData::put_llong: {
const _RWSTD_LONG_LONG expected = (_RWSTD_LONG_LONG)data.value_;
_RWSTD_LONG_LONG checked;
- np.get (iter, end, io, state, checked);
+ ng.get (iter, end, io, state, checked);
RW_ASSERT (! (state & std::ios_base::failbit));
RW_ASSERT (checked == expected);
}
@@ -261,7 +271,7 @@
const unsigned _RWSTD_LONG_LONG expected
= (unsigned _RWSTD_LONG_LONG)data.value_;
unsigned _RWSTD_LONG_LONG checked;
- np.get (iter, end, io, state, checked);
+ ng.get (iter, end, io, state, checked);
RW_ASSERT (! (state & std::ios_base::failbit));
RW_ASSERT (checked == expected);
}
@@ -272,7 +282,7 @@
case MyNumData::put_dbl: {
const double expected = (double)data.value_;
double checked;
- np.get (iter, end, io, state, checked);
+ ng.get (iter, end, io, state, checked);
RW_ASSERT (! (state & std::ios_base::failbit));
RW_ASSERT (checked == expected);
}
@@ -283,7 +293,7 @@
case MyNumData::put_ldbl: {
const long double expected = (long double)data.value_;
long double checked;
- np.get (iter, end, io, state, checked);
+ ng.get (iter, end, io, state, checked);
RW_ASSERT (! (state & std::ios_base::failbit));
RW_ASSERT (checked == expected);
}
@@ -294,7 +304,7 @@
case MyNumData::put_ptr: {
const void* expected = (const void*)&data.value_;
void* checked;
- np.get (iter, end, io, state, checked);
+ ng.get (iter, end, io, state, checked);
RW_ASSERT (! (state & std::ios_base::failbit));
RW_ASSERT (checked == expected);
}
@@ -316,13 +326,15 @@
static void*
thread_func (void*)
{
- MyIos<char, std::char_traits<char> > nio;
- MyStreambuf<char, std::char_traits<char> > nsb;
+ typedef std::char_traits<char> Traits;
+ MyIos<char, Traits> nio;
+ MyStreambuf<char, Traits> nsb;
nio.rdbuf (&nsb);
#ifndef _RWSTD_NO_WCHAR_T
- MyIos<wchar_t, std::char_traits<wchar_t> > wio;
- MyStreambuf<wchar_t, std::char_traits<wchar_t> > wsb;
+ typedef std::char_traits<wchar_t> WTraits;
+ MyIos<wchar_t, WTraits> wio;
+ MyStreambuf<wchar_t, WTraits> wsb;
wio.rdbuf (&wsb);
#endif // _RWSTD_NO_WCHAR_T
@@ -340,13 +352,13 @@
if (test_char) {
// exercise the narrow char specialization of the facet
- const std::num_get<char> &np =
+ const std::num_get<char> &ng =
std::use_facet<std::num_get<char> >(loc);
nio.imbue (loc);
- nsb.pubsetg (data.ncs_, RW_COUNT_OF (data.ncs_));
+ nsb.pubsetg (data.ncs_, Traits::length (data.ncs_));
- test_get_data (data, np,
+ test_get_data (data, ng,
std::istreambuf_iterator<char>(&nsb),
std::istreambuf_iterator<char>(),
nio);
@@ -365,7 +377,7 @@
std::use_facet<std::num_get<wchar_t> >(loc);
wio.imbue (loc);
- wsb.pubsetg (data.wcs_, RW_COUNT_OF (data.wcs_));
+ wsb.pubsetg (data.wcs_, WTraits::length (data.wcs_));
test_get_data (data, wp,
std::istreambuf_iterator<wchar_t>(&wsb),
@@ -464,7 +476,7 @@
"failed to create locale(%#s)", name);
}
- if (nlocales == maxinx || nlocales == std::size_t (rw_opt_nlocales))
+ if (nlocales == maxinx || nlocales == std::size_t (opt_nlocales))
break;
}
@@ -554,7 +566,7 @@
&rw_opt_nloops,
int (MAX_THREADS),
&rw_opt_nthreads,
- &rw_opt_nlocales,
+ &opt_nlocales,
&rw_opt_setlocales,
&rw_opt_shared_locale);
}
Modified: stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp?rev=650350&r1=650349&r2=650350&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/utilities/20.temp.buffer.mt.cpp Mon Apr 21
18:35:17 2008
@@ -24,7 +24,7 @@
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
- * Copyright 2005-2006 Rogue Wave Software.
+ * Copyright 2005-2008 Rogue Wave Software, Inc.
*
**************************************************************************/
@@ -126,7 +126,7 @@
{
thr_args* const targs = (thr_args*)arg;
- std::printf ("thread %ld starting...\n", targs->threadno_);
+ std::printf ("thread %u starting...\n", targs->threadno_);
#ifndef _RWSTD_INT64_T