You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2008/04/16 19:02:30 UTC
svn commit: r648752 [3/5] - in /stdcxx/branches/4.2.x: doc/stdlibref/
etc/config/ etc/config/src/ etc/config/windows/ etc/nls/ examples/manual/
examples/tutorial/ include/ include/ansi/ include/loc/ include/rw/ src/
src/ia64/ tests/algorithms/ tests/co...
Modified: stdcxx/branches/4.2.x/tests/containers/23.list.cons.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/containers/23.list.cons.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/containers/23.list.cons.cpp (original)
+++ stdcxx/branches/4.2.x/tests/containers/23.list.cons.cpp Wed Apr 16 10:01:56 2008
@@ -355,8 +355,8 @@
const ListVal* const beg = tdata.arg_ + tdata.off2_;
const ListVal* const end = beg + tdata.ext2_;
- const Iterator first = _RWSTD_CONST_CAST (const Iterator, beg);
- const Iterator last = _RWSTD_CONST_CAST (const Iterator, end);
+ const Iterator first = _RWSTD_CONST_CAST (Iterator, beg);
+ const Iterator last = _RWSTD_CONST_CAST (Iterator, end);
if (Cons (range_alloc) == tdata.func_.which_) {
ListAlloc alloc;
@@ -483,6 +483,7 @@
const bool is_class = ListIds::UserClass == func.elem_id_;
const std::size_t x_count_save = UserClass::count_;
+ const std::size_t arg_count = std::size_t (tcase.size);
try {
ListIds::OverloadId which =
@@ -507,15 +508,15 @@
break;
case Cons (size):
- ret_ptr = new List (tcase.size);
+ ret_ptr = new List (arg_count);
break;
case Cons (size_cref):
- ret_ptr = new List (tcase.size, arg_val);
+ ret_ptr = new List (arg_count, arg_val);
break;
case Cons (size_cref_alloc):
- ret_ptr = new List (tcase.size, arg_val, arg_alc);
+ ret_ptr = new List (arg_count, arg_val, arg_alc);
break;
case Cons (range):
@@ -959,7 +960,6 @@
int main (int argc, char** argv)
{
std::list<int> lst;
- std::list<int>::iterator it = lst.begin ();
static const ContainerTest
tests [] = {
Modified: stdcxx/branches/4.2.x/tests/include/21.strings.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/include/21.strings.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/include/21.strings.h (original)
+++ stdcxx/branches/4.2.x/tests/include/21.strings.h Wed Apr 16 10:01:56 2008
@@ -377,8 +377,6 @@
MEMBER_2 (ctor, str, cptr, alloc),
// basic_string (const basic_string&)
MEMBER_1 (ctor, str, cstr),
- // basic_string (const basic_string&, const allocator_type&)
- MEMBER_2 (ctor, str, cstr, alloc),
// basic_string (const_pointer, size_type)
MEMBER_2 (ctor, str, cptr, size),
// basic_string (const_pointer, size_type, const allocator_type&)
Modified: stdcxx/branches/4.2.x/tests/include/23.containers.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/include/23.containers.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/include/23.containers.h (original)
+++ stdcxx/branches/4.2.x/tests/include/23.containers.h Wed Apr 16 10:01:56 2008
@@ -2,7 +2,7 @@
*
* 23.containers.h - definitions of helpers used in clause 23 tests
*
-* $Id: 23.containers.h
+* $Id: 23.containers.h$
*
***************************************************************************
*
@@ -30,7 +30,6 @@
#include <testdefs.h>
#include <rw_value.h> // for UserClass, UserPOD
#include <rw_char.h> // for rw_expand ()
-#include <driver.h> // for rw_assert ()
/**************************************************************************/
@@ -269,55 +268,70 @@
// converts the narrow (and possibly) condensed strings to fully
// expanded wide character arrays that can be used to construct
// container objects
- ContainerTestCaseData (const ContainerFunc &func,
- const ContainerTestCase &tcase)
- : func_ (func), tcase_ (tcase) {
-
- char buf [256];
-
- strlen_ = sizeof (buf);
- char* str = rw_expand (buf, tcase.str, tcase.str_len, &strlen_);
- str_ = T::from_char (str, strlen_);
- if (str != buf)
- delete[] str;
-
- arglen_ = sizeof (buf);
- str = rw_expand (buf, tcase.arg, tcase.arg_len, &arglen_);
- arg_ = T::from_char (str, arglen_);
- if (str != buf)
- delete[] str;
-
- reslen_ = sizeof (buf);
- str = rw_expand (buf, tcase.res, tcase.nres, &reslen_);
- res_ = T::from_char (str, reslen_);
- if (str != buf)
- delete[] str;
-
- // compute the offset and extent of the container object
- // representing the controlled sequence and the offset
- // and extent of the argument of the function call
- const SizeType argl = tcase_.arg ? arglen_ : strlen_;
-
- off1_ = SizeType (tcase_.off) < strlen_ ?
- SizeType (tcase_.off) : strlen_;
+ ContainerTestCaseData (const ContainerFunc&,
+ const ContainerTestCase&);
- ext1_ = off1_ + tcase_.size < strlen_ ?
- SizeType (tcase_.size) : strlen_ - off1_;
+ ~ContainerTestCaseData ();
+};
- off2_ = SizeType (tcase_.off2) < argl ?
- SizeType (tcase_.off2) : argl;
- ext2_ = off2_ + tcase_.size2 < argl ?
- SizeType (tcase_.size2) : argl - off2_;
- }
+template <class T>
+ContainerTestCaseData<T>::
+ContainerTestCaseData (const ContainerFunc &func,
+ const ContainerTestCase &tcase)
+ : func_ (func), tcase_ (tcase)
+{
+ char buf [256];
- ~ContainerTestCaseData () {
- // clean up dynamically allocated memory
- delete[] str_;
- delete[] arg_;
- delete[] res_;
- }
-};
+ strlen_ = sizeof (buf);
+ char* str = rw_expand (buf, tcase.str, tcase.str_len, &strlen_);
+ str_ = T::from_char (str, strlen_);
+ if (str != buf)
+ delete[] str;
+
+ arglen_ = sizeof (buf);
+ str = rw_expand (buf, tcase.arg, tcase.arg_len, &arglen_);
+ arg_ = T::from_char (str, arglen_);
+ if (str != buf)
+ delete[] str;
+
+ reslen_ = sizeof (buf);
+ str = rw_expand (buf, tcase.res, tcase.nres, &reslen_);
+ res_ = T::from_char (str, reslen_);
+ if (str != buf)
+ delete[] str;
+
+ // compute the offset and extent of the container object
+ // representing the controlled sequence and the offset
+ // and extent of the argument of the function call
+ const SizeType argl = tcase_.arg ? arglen_ : strlen_;
+
+ off1_ = SizeType (tcase_.off) < strlen_ ?
+ SizeType (tcase_.off) : strlen_;
+
+ ext1_ = off1_ + tcase_.size < strlen_ ?
+ SizeType (tcase_.size) : strlen_ - off1_;
+
+ off2_ = SizeType (tcase_.off2) < argl ?
+ SizeType (tcase_.off2) : argl;
+
+ ext2_ = off2_ + tcase_.size2 < argl ?
+ SizeType (tcase_.size2) : argl - off2_;
+}
+
+
+template <class T>
+ContainerTestCaseData<T>::
+~ContainerTestCaseData ()
+{
+ // clean up dynamically allocated memory
+
+ // cast away the constness of the pointers to work around
+ // an HP aCC 6.16 and prior bug described in STDCXX-802
+ delete[] _RWSTD_CONST_CAST (T*, str_);
+ delete[] _RWSTD_CONST_CAST (T*, arg_);
+ delete[] _RWSTD_CONST_CAST (T*, res_);
+}
/**************************************************************************/
Modified: stdcxx/branches/4.2.x/tests/include/23.list.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/include/23.list.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/include/23.list.h (original)
+++ stdcxx/branches/4.2.x/tests/include/23.list.h Wed Apr 16 10:01:56 2008
@@ -28,6 +28,8 @@
#define RW_23_LIST_H_INCLUDED
#include <23.containers.h>
+#include <driver.h> // for rw_assert()
+#include <rw_sigdefs.h> // for helper macros
/**************************************************************************/
@@ -36,9 +38,6 @@
// of their signatures, and specific overloads of such member functions
struct ListIds : ContainerIds
{
-// define the helper macros
-#include <rw_sigdefs.h>
-
// unique identifiers for all overloads of each member function
// 6 bits for FuncId
// 6 * 4 bits for ArgId (at most 6 arguments including this)
Modified: stdcxx/branches/4.2.x/tests/include/driver.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/include/driver.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/include/driver.h (original)
+++ stdcxx/branches/4.2.x/tests/include/driver.h Wed Apr 16 10:01:56 2008
@@ -159,13 +159,21 @@
rw_info (int, const char*, int, const char*, ...);
/**
-* Enable/disable the specified diagnostics
-*
-* Example:
-* rw_enable (rw_error, false); // disable all rw_error diagnostics
-* rw_enable (rw_error); // enable all rw_error diagnostics
-*/
-_TEST_EXPORT void
-rw_enable (int (*) (int, const char*, int, const char*, ...), bool = true);
+ * Enable/disable the specified diagnostic.
+ *
+ * @param fun Diagnostic function to enable or disable. Must be one of
+ * rw_fatal, rw_error, rw_assert, rw_warn, rw_note or rw_info.
+ * @param enable Flag to indicate that the diagnostic function should
+ * be enabled or disabled.
+ * @return Returns the previous state of the diagnostic. If the first
+ * parameter is not an acceptable input, will return false.
+ *
+ * Example:
+ * rw_enable (rw_error, false); // disable all rw_error diagnostics
+ * rw_enable (rw_error); // enable all rw_error diagnostics
+ */
+_TEST_EXPORT bool
+rw_enable (int (*fun) (int, const char*, int, const char*, ...),
+ bool enable = true);
#endif // RW_DRIVER_H_INCLUDED
Modified: stdcxx/branches/4.2.x/tests/include/rw_locale.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/include/rw_locale.h?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/include/rw_locale.h (original)
+++ stdcxx/branches/4.2.x/tests/include/rw_locale.h Wed Apr 16 10:01:56 2008
@@ -36,6 +36,13 @@
#define _UNUSED_CAT 69
+// get a list of all native locales that match the cannonical
+// locale name query strings
+_TEST_EXPORT char*
+rw_locale_query (int = _UNUSED_CAT, const char* = 0, _RWSTD_SIZE_T = 0);
+
+
+// this function will likely be deprecated!
_TEST_EXPORT char*
rw_locales (int = _UNUSED_CAT, const char* = 0, bool = true);
Modified: stdcxx/branches/4.2.x/tests/iostream/27.istream.fmat.arith.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/iostream/27.istream.fmat.arith.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/iostream/27.istream.fmat.arith.cpp (original)
+++ stdcxx/branches/4.2.x/tests/iostream/27.istream.fmat.arith.cpp Wed Apr 16 10:01:56 2008
@@ -1247,7 +1247,7 @@
#undef TEST
#define TEST(T) \
- if (rw_note (0 == opt_ ## T, 0, __LINE__, "%s tests disabld", #T)) \
+ if (rw_note (0 == opt_ ## T, 0, __LINE__, "%s tests disabled", #T)) \
test_ ## T ((CharT*)0, (Traits*)0, cname, tname)
//////////////////////////////////////////////////////////////////
Modified: stdcxx/branches/4.2.x/tests/iostream/27.objects.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/iostream/27.objects.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/iostream/27.objects.cpp (original)
+++ stdcxx/branches/4.2.x/tests/iostream/27.objects.cpp Wed Apr 16 10:01:56 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 2000-2008 Rogue Wave Software, Inc.
*
**************************************************************************/
@@ -363,8 +363,16 @@
rw_note (noted++, 0, __LINE__,
"test of replacement operator new disabled");
}
- else if (rw_warn (1 == recursion, 0, __LINE__,
- "recursive call to replacement operator new()")) {
+ else if (1 != recursion) {
+ // avoid calling rw_warn() except when it has something
+ // to warn about in case operator new() is being called
+ // by the compiler's C++ runtime (e.g., HP aCC 6.16)
+ // when the driver hasn't been initialized yet (otherwise
+ // the driver aborts)
+ rw_warn (1 == recursion, 0, __LINE__,
+ "recursive call to replacement operator new()");
+ }
+ else {
// initialize iostreams (verifies that initialization
// succeeds and is complete even if it occurs recursively)
static std::ios_base::Init io_initializer;
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.codecvt.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.codecvt.mt.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.codecvt.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.codecvt.mt.cpp Wed Apr 16 10:01:56 2008
@@ -481,7 +481,7 @@
rw_info (0, 0, 0,
"testing std::codecvt<charT> with %d thread%{?}s%{;}, "
- "%zu iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
+ "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
rw_opt_nthreads, 1 != rw_opt_nthreads,
rw_opt_nloops, 1 != rw_opt_nloops,
nlocales, int (nlocales), "%#s", locales);
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.codecvt.out.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.codecvt.out.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.codecvt.out.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.codecvt.out.cpp Wed Apr 16 10:01:56 2008
@@ -22,7 +22,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.
*
**************************************************************************/
@@ -35,7 +35,6 @@
#include <climits> // for MB_LEN_MAX
#include <clocale> // for LC_CTYPE, setlocale()
-#include <cstdio> // for sprintf()
#include <cstdlib> // for MB_CUR_MAX, free(), size_t
#include <cstring> // for strcpy(), strlen()
#include <cwchar> // for codecvt
@@ -218,9 +217,10 @@
std::size_t (-1));
if (!mbc) {
- std::fprintf (stderr, "*** unable to find any multibyte characters "
- "in locale \"%s\" with MB_CUR_MAX = %u\n",
- std::setlocale (LC_CTYPE, 0), MB_CUR_MAX);
+ rw_fprintf (rw_stderr, "*** unable to find any multibyte characters "
+ "in locale \"%s\" with MB_CUR_MAX = %u\n",
+ std::setlocale (LC_CTYPE, 0),
+ unsigned (MB_CUR_MAX));
return 0;
}
@@ -240,9 +240,10 @@
if (0 == mbc) {
if (i < mb_cur_max) {
- std::fprintf (stderr, "*** unable to find %u-byte characters "
- "in locale \"%s\" with MB_CUR_MAX = %u\n",
- i + 1, std::setlocale (LC_CTYPE, 0), MB_CUR_MAX);
+ rw_fprintf (rw_stderr, "*** unable to find %zu-byte characters"
+ " in locale \"%s\" with MB_CUR_MAX = %u\n",
+ i + 1, std::setlocale (LC_CTYPE, 0),
+ unsigned (MB_CUR_MAX));
mb_cur_max = 0;
break;
}
@@ -265,7 +266,7 @@
RW_ASSERT (0 != mb_chars);
if (2 > MB_LEN_MAX) {
- std::fprintf (stderr, "MB_LEN_MAX = %d, giving up\n", MB_LEN_MAX);
+ rw_fprintf (rw_stderr, "MB_LEN_MAX = %d, giving up\n", MB_LEN_MAX);
return 0;
}
@@ -299,9 +300,9 @@
}
if (*mb_cur_max < 2) {
- std::fprintf (stderr, "*** unable to find a full set of multibyte "
- "characters in locale \"%s\" with MB_CUR_MAX = %u "
- "(computed)", mb_locale_name, *mb_cur_max);
+ rw_fprintf (rw_stderr, "*** unable to find a full set of multibyte "
+ "characters in locale \"%s\" with MB_CUR_MAX = %u "
+ "(computed)", mb_locale_name, *mb_cur_max);
mb_locale_name = 0;
}
else {
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.cons.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.cons.mt.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.cons.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.cons.mt.cpp Wed Apr 16 10:01:56 2008
@@ -176,7 +176,7 @@
rw_info (0, 0, 0,
"testing std::locale ctors with %d thread%{?}s%{;}, "
- "%zu iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
+ "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
opt_nthreads, 1 != opt_nthreads,
opt_nloops, 1 != opt_nloops,
nlocales, int (nlocales), "%#s", locales);
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.cpp Wed Apr 16 10:01:56 2008
@@ -67,7 +67,7 @@
#include <driver.h>
#include <file.h> // for SLASH
-#include <rw_locale.h> // for rw_locales()
+#include <rw_locale.h> // for rw_locale_query()
/**************************************************************************/
@@ -78,8 +78,16 @@
#define NLOOPS 25
#define MAX_STR_SIZE 16
+#define LOCALES "{{en-US,de-DE,fr-FR,es-ES}-*-{ISO-8859-*,UTF-8,CP125?}," \
+ "{ja-JP-*-{EUC-JP,SHIFT_JIS,UTF-8,CP125?}}," \
+ "{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) \
- for (const char* locname = rw_locales (LC_CTYPE, 0); \
+ if (!locale_list) locale_list = rw_locale_query (LC_CTYPE, LOCALES); \
+ for (const char* locname = locale_list; \
locname && *locname; locname += std::strlen (locname) + 1) { \
_TRY { \
const std::locale loc (locname); \
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.is.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.is.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.is.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.is.cpp Wed Apr 16 10:01:56 2008
@@ -67,7 +67,7 @@
#include <driver.h>
#include <file.h> // for SLASH
-#include <rw_locale.h> // for rw_locales()
+#include <rw_locale.h> // for rw_locale_query()
/**************************************************************************/
@@ -78,8 +78,16 @@
#define NLOOPS 25
#define MAX_STR_SIZE 16
+#define LOCALES "{{en-US,de-DE,fr-FR,es-ES}-*-{ISO-8859-*,UTF-8,CP125?}," \
+ "{ja-JP-*-{EUC-JP,SHIFT_JIS,UTF-8,CP125?}}," \
+ "{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) \
- for (const char* locname = rw_locales (LC_CTYPE, 0); \
+ if (!locale_list) locale_list = rw_locale_query (LC_CTYPE, LOCALES); \
+ for (const char* locname = locale_list; \
locname && *locname; locname += std::strlen (locname) + 1) { \
_TRY { \
const std::locale loc (locname); \
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.mt.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.mt.cpp Wed Apr 16 10:01:56 2008
@@ -49,9 +49,19 @@
// otherwise on the command line)
int opt_nloops = 200000;
+#if !defined (_RWSTD_OS_HP_UX) || defined (_ILP32)
+
// number of locales to use
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?
int opt_shared_locale;
@@ -238,7 +248,7 @@
rw_info (0, 0, 0,
"testing std::ctype<charT> with %d thread%{?}s%{;}, "
- "%zu iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
+ "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
opt_nthreads, 1 != opt_nthreads,
opt_nloops, 1 != opt_nloops,
nlocales, int (nlocales), "%#s", locales);
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=648752&r1=648751&r2=648752&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 Wed Apr 16 10:01:56 2008
@@ -67,7 +67,7 @@
#include <driver.h>
#include <file.h> // for SLASH
-#include <rw_locale.h> // for rw_locales()
+#include <rw_locale.h> // for rw_locale_query()
/**************************************************************************/
@@ -78,8 +78,16 @@
#define NLOOPS 25
#define MAX_STR_SIZE 16
+#define LOCALES "{{en-US,de-DE,fr-FR,es-ES}-*-{ISO-8859-*,UTF-8,CP125?}," \
+ "{ja-JP-*-{EUC-JP,SHIFT_JIS,UTF-8,CP125?}}," \
+ "{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) \
- for (const char* locname = rw_locales (LC_CTYPE, 0); \
+ if (!locale_list) locale_list = rw_locale_query (LC_CTYPE, LOCALES); \
+ for (const char* locname = locale_list; \
locname && *locname; locname += std::strlen (locname) + 1) { \
_TRY { \
const std::locale loc (locname); \
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.scan.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.scan.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.scan.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.scan.cpp Wed Apr 16 10:01:56 2008
@@ -67,7 +67,7 @@
#include <driver.h>
#include <file.h> // for SLASH
-#include <rw_locale.h> // for rw_locales()
+#include <rw_locale.h> // for rw_locale_query()
/**************************************************************************/
@@ -78,8 +78,16 @@
#define NLOOPS 25
#define MAX_STR_SIZE 16
+#define LOCALES "{{en-US,de-DE,fr-FR,es-ES}-*-{ISO-8859-*,UTF-8,CP125?}," \
+ "{ja-JP-*-{EUC-JP,SHIFT_JIS,UTF-8,CP125?}}," \
+ "{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) \
- for (const char* locname = rw_locales (LC_CTYPE, 0); \
+ if (!locale_list) locale_list = rw_locale_query (LC_CTYPE, LOCALES); \
+ for (const char* locname = locale_list; \
locname && *locname; locname += std::strlen (locname) + 1) { \
_TRY { \
const std::locale loc (locname); \
@@ -827,8 +835,8 @@
_STD_USE_FACET (std::ctype_byname<charT>, std::locale ());
}
- test_libstd (charT (), cname);
test_libc (charT (), cname);
+ test_libstd (charT (), cname);
}
/**************************************************************************/
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.tolower.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.tolower.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.tolower.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.tolower.cpp Wed Apr 16 10:01:56 2008
@@ -67,7 +67,7 @@
#include <driver.h>
#include <file.h> // for SLASH
-#include <rw_locale.h> // for rw_locales()
+#include <rw_locale.h> // for rw_locale_query()
/**************************************************************************/
@@ -78,8 +78,16 @@
#define NLOOPS 25
#define MAX_STR_SIZE 16
+#define LOCALES "{{en-US,de-DE,fr-FR,es-ES}-*-{ISO-8859-*,UTF-8,CP125?}," \
+ "{ja-JP-*-{EUC-JP,SHIFT_JIS,UTF-8,CP125?}}," \
+ "{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) \
- for (const char* locname = rw_locales (LC_CTYPE, 0); \
+ const char* locale_list = rw_locale_query (LC_CTYPE, LOCALES); \
+ for (const char* locname = locale_list; \
locname && *locname; locname += std::strlen (locname) + 1) { \
_TRY { \
const std::locale loc (locname); \
@@ -428,7 +436,7 @@
"(<U0063>,<U0043>);(<U1000>,<U1001>)\n"
"tolower (<U0041>,<U0061>);(<U0042>,<U0062>);"
"(<U0043>,<U0063>);(<U1001>,<U1000>)\n"
- "END LC_CTYPE\n"
+ "END LC_CTYPE\n"
};
//invoke rw_create_locale to build a locale to test with
@@ -460,8 +468,8 @@
_STD_USE_FACET (std::ctype_byname<charT>, std::locale ());
}
- test_libstd (charT (), cname);
test_libc (charT (), cname);
+ test_libstd (charT (), cname);
}
/**************************************************************************/
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.toupper.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.toupper.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.toupper.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.ctype.toupper.cpp Wed Apr 16 10:01:56 2008
@@ -67,7 +67,7 @@
#include <driver.h>
#include <file.h> // for SLASH
-#include <rw_locale.h> // for rw_locales()
+#include <rw_locale.h> // for rw_locale_query()
/**************************************************************************/
@@ -78,8 +78,16 @@
#define NLOOPS 25
#define MAX_STR_SIZE 16
+#define LOCALES "{{en-US,de-DE,fr-FR,es-ES}-*-{ISO-8859-*,UTF-8,CP125?}," \
+ "{ja-JP-*-{EUC-JP,SHIFT_JIS,UTF-8,CP125?}}," \
+ "{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) \
- for (const char* locname = rw_locales (LC_CTYPE, 0); \
+ if (!locale_list) locale_list = rw_locale_query (LC_CTYPE, LOCALES); \
+ for (const char* locname = locale_list; \
locname && *locname; locname += std::strlen (locname) + 1) { \
_TRY { \
const std::locale loc (locname); \
@@ -429,7 +437,7 @@
"(<U0063>,<U0043>);(<U1000>,<U1001>)\n"
"tolower (<U0041>,<U0061>);(<U0042>,<U0062>);"
"(<U0043>,<U0063>);(<U1001>,<U1000>)\n"
- "END LC_CTYPE\n"
+ "END LC_CTYPE\n"
};
//invoke rw_create_locale to build a locale to test with
@@ -461,8 +469,8 @@
_STD_USE_FACET (std::ctype_byname<charT>, std::locale ());
}
- test_libstd (charT (), cname);
test_libc (charT (), cname);
+ test_libstd (charT (), cname);
}
/**************************************************************************/
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.globals.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.globals.mt.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.globals.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.globals.mt.cpp Wed Apr 16 10:01:56 2008
@@ -288,15 +288,13 @@
const std::size_t nbases = sizeof bases / sizeof *bases;
- for (std::size_t i = 0; i != nbases; ++i) {
- RW_ASSERT (bases [i] != 0);
- RW_ASSERT (bases [i] == derived [i]);
+ for (std::size_t j = 0; j != nbases; ++j) {
+ RW_ASSERT (bases [j] != 0);
+ RW_ASSERT (bases [j] == derived [j]);
}
}
else if (0 == opt_no_exceptions) {
-#if 1 // def _RWSTD_NO_THREAD_SAFE_EXCEPTIONS
-
bool threw;
#define TEST_USE_FACET(Facet, opt) \
@@ -317,9 +315,6 @@
TEST_USE_FACET (NumpunctByname, numpunct);
TEST_USE_FACET (TimeGetByname, time_get);
TEST_USE_FACET (TimePutByname, time_put);
-
-#endif // _RWSTD_NO_THREAD_SAFE_EXCEPTIONS
-
}
}
@@ -366,15 +361,13 @@
const std::size_t nbases = sizeof bases / sizeof *bases;
- for (std::size_t i = 0; i != nbases; ++i) {
- RW_ASSERT (bases [i] != 0);
- RW_ASSERT (bases [i] == derived [i]);
+ for (std::size_t j = 0; j != nbases; ++j) {
+ RW_ASSERT (bases [j] != 0);
+ RW_ASSERT (bases [j] == derived [j]);
}
}
else if (0 == opt_no_exceptions) {
-#ifndef _RWSTD_NO_THREAD_SAFE_EXCEPTIONS
-
bool threw;
TEST_USE_FACET (WCollateByname, collate);
@@ -386,9 +379,6 @@
TEST_USE_FACET (WNumpunctByname, numpunct);
TEST_USE_FACET (WTimeGetByname, time_get);
TEST_USE_FACET (WTimePutByname, time_put);
-
-#endif // _RWSTD_NO_THREAD_SAFE_EXCEPTIONS
-
}
}
@@ -509,7 +499,7 @@
rw_info (0, 0, 0,
"testing std::locale globals with %d thread%{?}s%{;}, "
- "%zu iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
+ "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
opt_nthreads, 1 != opt_nthreads,
opt_nloops, 1 != opt_nloops,
nlocales, int (nlocales), "%#s", locales);
@@ -534,10 +524,30 @@
rw_info (0, 0, 0,
"template <class T> const T& std::use_facet (const locale&)");
+#ifdef _RWSTD_NO_DYNAMIC_CAST
+
+ // if dynamic_cast isn't supported, then [has,use]_facet()
+ // can't reliably detect if a facet is installed or not.
+ rw_warn (0 != opt_no_exceptions, 0, __LINE__,
+ "dynamic_cast not supported "
+ "(macro _RWSTD_NO_DYNAMIC_CAST is #defined), "
+ "disabling exceptions tests");
+
+ opt_no_exceptions = 1;
+
+#endif // _RWSTD_NO_DYNAMIC_CAST
+
+
#ifdef _RWSTD_NO_THREAD_SAFE_EXCEPTIONS
+ // avoid exercising exceptions (triggered by use_facet) if
+ // their implementation in the runtime isn't thread-safe
rw_warn (0, 0, 0,
- "exceptions not thread safe, skipping that part of test");
+ "exceptions not thread safe (macro "
+ "_RWSTD_NO_THREAD_SAFE_EXCEPTIONS is #defined), "
+ "disabling exceptions tests");
+
+ opt_no_exceptions = 1;
#endif // _RWSTD_NO_THREAD_SAFE_EXCEPTIONS
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.messages.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.messages.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.messages.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.messages.cpp Wed Apr 16 10:01:56 2008
@@ -821,11 +821,23 @@
#ifdef _RWSTD_OS_AIX
// must do this so that NLSPATH lookup works correctly for both
- // the C and POSIX locales.
+ // the C and POSIX locales.
const int p = rw_putenv ("LC__FASTMSG=false");
rw_note (!p, 0, __LINE__, "failed to set LC__FASTMSG");
#endif // _RWSTD_OS_AIX
+
+#ifdef _RWSTD_NO_DYNAMIC_CAST
+
+ // if dynamic_cast isn't supported then has_facet() can't
+ // reliably detect if a facet is installed or not.
+ rw_warn (0 != opt_has_facet, 0, __LINE__,
+ "dynamic_cast not supported, disabling has_facet tests");
+
+ opt_has_facet = -1;
+
+#endif // _RWSTD_NO_DYNAMIC_CAST
+
for (int i = 0; i < MAX_SETS; ++i) {
for (int j = 0; j < MAX_MESSAGES; ++j)
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.messages.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.messages.mt.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.messages.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.messages.mt.cpp Wed Apr 16 10:01:56 2008
@@ -246,7 +246,7 @@
rw_info (0, 0, 0,
"testing std::messages<charT> with %d thread%{?}s%{;}, "
- "%zu iteration%{?}s%{;} each",
+ "%d iteration%{?}s%{;} each",
rw_opt_nthreads, 1 != rw_opt_nthreads,
rw_opt_nloops, 1 != rw_opt_nloops);
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.money.get.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.money.get.mt.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.money.get.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.money.get.mt.cpp Wed Apr 16 10:01:56 2008
@@ -42,20 +42,30 @@
#define MAX_THREADS 32
#define MAX_LOOPS 100000
+// the number of times each thread should iterate (unless specified
+// otherwise on the command line)
+int opt_nloops = 100000;
+
// default number of threads (will be adjusted to the number
// of processors/cores later)
-int rw_opt_nthreads = 1;
+int opt_nthreads = 1;
-// the number of times each thread should iterate (unless specified
-// otherwise on the command line)
-int rw_opt_nloops = 100000;
+#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 a small cache size on HP-UX in LP64 mode
+// in LP64 mode (see STDCXX-812)
+int opt_nlocales = 9;
+
+#endif // HP-UX 32/64 bit mode
// should all threads share the same set of locale objects instead
// of creating their own?
-int rw_opt_shared_locale;
+int opt_shared_locale;
/**************************************************************************/
@@ -164,7 +174,7 @@
long double ldbl = 0.;
#endif // _RWSTD_NO_LONG_DOUBLE
- for (int i = 0; i != rw_opt_nloops; ++i) {
+ for (int i = 0; i != opt_nloops; ++i) {
// save the name of the locale
const MyMoneyData& data = my_money_data [i % nlocales];
@@ -172,7 +182,7 @@
// construct a named locale, get a reference to the money_get
// facet from it and use it to format a random money value
const std::locale loc =
- rw_opt_shared_locale ? data.locale_
+ opt_shared_locale ? data.locale_
: std::locale (data.locale_name_);
if (test_char) {
@@ -360,7 +370,7 @@
#endif // _RWSTD_NO_WCHAR_T
- if (rw_opt_shared_locale)
+ if (opt_shared_locale)
data.locale_ = loc;
nlocales += 1;
@@ -371,7 +381,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;
}
@@ -381,9 +391,9 @@
rw_info (0, 0, 0,
"testing std::money_get<charT> with %d thread%{?}s%{;}, "
- "%zu iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
- rw_opt_nthreads, 1 != rw_opt_nthreads,
- rw_opt_nloops, 1 != rw_opt_nloops,
+ "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
+ opt_nthreads, 1 != opt_nthreads,
+ opt_nloops, 1 != opt_nloops,
nlocales, int (nlocales), "%#s", locales);
rw_info (0, 0, 0, "exercising std::money_get<char>");
@@ -393,11 +403,11 @@
// create and start a pool of threads and wait for them to finish
int result =
- rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+ rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
rw_error (result == 0, 0, __LINE__,
"rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
- rw_opt_nthreads, thread_func);
+ opt_nthreads, thread_func);
#ifndef _RWSTD_NO_WCHAR_T
@@ -408,11 +418,11 @@
// start a pool of threads to exercise wstring thread safety
result =
- rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+ rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
rw_error (result == 0, 0, __LINE__,
"rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
- rw_opt_nthreads, thread_func);
+ opt_nthreads, thread_func);
// exercise both the char and the wchar_t specializations
// at the same time
@@ -426,11 +436,11 @@
// start a pool of threads to exercise wstring thread safety
result =
- rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+ rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
rw_error (result == 0, 0, __LINE__,
"rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
- rw_opt_nthreads, thread_func);
+ opt_nthreads, thread_func);
#endif // _RWSTD_NO_WCHAR_T
@@ -445,9 +455,9 @@
// set nthreads to the greater of the number of processors
// and 2 (for uniprocessor systems) by default
- rw_opt_nthreads = rw_get_cpus ();
- if (rw_opt_nthreads < 2)
- rw_opt_nthreads = 2;
+ opt_nthreads = rw_get_cpus ();
+ if (opt_nthreads < 2)
+ opt_nthreads = 2;
#endif // _RWSTD_REENTRANT
@@ -459,10 +469,10 @@
"|-nlocales#0 " // arg must be non-negative
"|-locales= " // must be provided
"|-shared-locale# ",
- &rw_opt_nloops,
+ &opt_nloops,
int (MAX_THREADS),
- &rw_opt_nthreads,
- &rw_opt_nlocales,
+ &opt_nthreads,
+ &opt_nlocales,
&rw_opt_setlocales,
- &rw_opt_shared_locale);
+ &opt_shared_locale);
}
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.money.put.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.money.put.mt.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.money.put.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.money.put.mt.cpp Wed Apr 16 10:01:56 2008
@@ -44,18 +44,28 @@
// default number of threads (will be adjusted to the number
// of processors/cores later)
-int rw_opt_nthreads = 1;
+int opt_nthreads = 1;
// the number of times each thread should iterate (unless specified
// otherwise on the command line)
-int rw_opt_nloops = 100000;
+int opt_nloops = 100000;
+
+#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 a small locale cache on HP-UX in LP64 mode
+// (see STDCXX-812)
+int opt_nlocales = 9;
+
+#endif // HP-UX 32/64 bit mode
// should all threads share the same set of locale objects instead
// of creating their own?
-int rw_opt_shared_locale;
+int opt_shared_locale;
/**************************************************************************/
@@ -172,7 +182,7 @@
wio.rdbuf (&wsb);
#endif // _RWSTD_NO_WCHAR_T
- for (int i = 0; i != rw_opt_nloops; ++i) {
+ for (int i = 0; i != opt_nloops; ++i) {
// save the name of the locale
const MyMoneyData& data = my_money_data [i % nlocales];
@@ -180,7 +190,7 @@
// construct a named locale, get a reference to the money_put
// facet from it and use it to format a random money value
const std::locale loc =
- rw_opt_shared_locale ? data.locale_
+ opt_shared_locale ? data.locale_
: std::locale (data.locale_name_);
if (test_char) {
@@ -366,7 +376,7 @@
#endif // _RWSTD_NO_WCHAR_T
- if (rw_opt_shared_locale)
+ if (opt_shared_locale)
data.locale_ = loc;
nlocales += 1;
@@ -377,7 +387,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;
}
@@ -387,9 +397,9 @@
rw_info (0, 0, 0,
"testing std::money_put<charT> with %d thread%{?}s%{;}, "
- "%zu iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
- rw_opt_nthreads, 1 != rw_opt_nthreads,
- rw_opt_nloops, 1 != rw_opt_nloops,
+ "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
+ opt_nthreads, 1 != opt_nthreads,
+ opt_nloops, 1 != opt_nloops,
nlocales, int (nlocales), "%#s", locales);
rw_info (0, 0, 0, "exercising std::money_put<char>");
@@ -399,11 +409,11 @@
// create and start a pool of threads and wait for them to finish
int result =
- rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+ rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
rw_error (result == 0, 0, __LINE__,
"rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
- rw_opt_nthreads, thread_func);
+ opt_nthreads, thread_func);
#ifndef _RWSTD_NO_WCHAR_T
@@ -414,11 +424,11 @@
// start a pool of threads to exercise wstring thread safety
result =
- rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+ rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
rw_error (result == 0, 0, __LINE__,
"rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
- rw_opt_nthreads, thread_func);
+ opt_nthreads, thread_func);
// exercise both the char and the wchar_t specializations
// at the same time
@@ -432,11 +442,11 @@
// start a pool of threads to exercise wstring thread safety
result =
- rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+ rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
rw_error (result == 0, 0, __LINE__,
"rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
- rw_opt_nthreads, thread_func);
+ opt_nthreads, thread_func);
#endif // _RWSTD_NO_WCHAR_T
@@ -451,9 +461,9 @@
// set nthreads to the greater of the number of processors
// and 2 (for uniprocessor systems) by default
- rw_opt_nthreads = rw_get_cpus ();
- if (rw_opt_nthreads < 2)
- rw_opt_nthreads = 2;
+ opt_nthreads = rw_get_cpus ();
+ if (opt_nthreads < 2)
+ opt_nthreads = 2;
#endif // _RWSTD_REENTRANT
@@ -465,10 +475,10 @@
"|-nlocales#0 " // arg must be non-negative
"|-locales= " // must be provided
"|-shared-locale# ",
- &rw_opt_nloops,
+ &opt_nloops,
int (MAX_THREADS),
- &rw_opt_nthreads,
- &rw_opt_nlocales,
+ &opt_nthreads,
+ &opt_nlocales,
&rw_opt_setlocales,
- &rw_opt_shared_locale);
+ &opt_shared_locale);
}
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.moneypunct.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.moneypunct.mt.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.moneypunct.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.moneypunct.mt.cpp Wed Apr 16 10:01:56 2008
@@ -401,7 +401,7 @@
rw_info (0, 0, 0,
"testing std::moneypunct<charT> with %d thread%{?}s%{;}, "
- "%zu iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
+ "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
rw_opt_nthreads, 1 != rw_opt_nthreads,
rw_opt_nloops, 1 != rw_opt_nloops,
nlocales, int (nlocales), "%#s", locales);
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.num.get.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.num.get.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.num.get.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.num.get.cpp Wed Apr 16 10:01:56 2008
@@ -56,6 +56,7 @@
/**************************************************************************/
+#include <cstddef> // for std::size_t, std::ptrdiff_t
#include <cfloat> // FLT_MAX, FLT_MIN, etc.
#include <climits> // INT_MAX, INT_MIN, etc.
#include <clocale> // for localeconv(), setlocale()
@@ -221,7 +222,7 @@
_RWSTD_CONST_CAST (charT*, gend));
}
- int gptr_off () const {
+ std::ptrdiff_t gptr_off () const {
return this->gptr () - this->eback ();
}
};
@@ -234,13 +235,6 @@
/**************************************************************************/
-// if non-zero expected to point to a maximum valid value
-// of type T that's being tested below (used for floating
-// point ranges)
-// on function return, the pointed to value is overwritten
-// with the actual extracted value
-void *pmax = 0;
-
enum IterType { iter_pointer, iter_istreambuf, iter_input };
@@ -250,6 +244,7 @@
const char *cname, // name of character type
IterType itype, // type of input iterator
const char *iname, // name of input iterator
+ void *pmax,
nativeT val, // value expected to be extracted
const char *str, // input sequence
int eat_expect = -1, // number of consumed characters
@@ -320,7 +315,7 @@
const charT *plast = pnext + std::char_traits<charT>::length (pnext);
- int consumed;
+ std::ptrdiff_t consumed;
switch (itype) {
case iter_pointer: {
@@ -443,6 +438,7 @@
const char *cname, // name of character type
IterType itype, // iterator type
const char *iname, // name of iterator type
+ void *pmax,
nativeT val, // value expected to be extracted
const char *str, // input sequence
int eat_expect = -1, // number of consumed characters
@@ -453,15 +449,15 @@
switch (ctype) {
case narrow_char:
return do_test (lineno, (char*)0, cname, itype, iname,
- val, str, eat_expect, flags, err_expect, grouping);
+ pmax, val, str, eat_expect, flags, err_expect, grouping);
case wide_char:
return do_test (lineno, (wchar_t*)0, cname, itype, iname,
- val, str, eat_expect, flags, err_expect, grouping);
+ pmax, val, str, eat_expect, flags, err_expect, grouping);
case user_char:
break;
#if 0 // disabled
return do_test (lineno, (UserChar*)0, cname, itype, iname,
- val, str, eat_expect, flags, err_expect, grouping);
+ pmax, val, str, eat_expect, flags, err_expect, grouping);
#endif // disabled
}
@@ -501,7 +497,8 @@
/*************************************************************************/
#define TEST do_test
-#define T __LINE__, ctype, cname, itype, iname
+#define T __LINE__, ctype, cname, itype, iname, 0
+#define T_MAX __LINE__, ctype, cname, itype, iname, &val
template <class numT>
@@ -2102,15 +2099,16 @@
TEST (T, PVoid (0x0000ffff), "FfFf", 4, 0, Eof);
// exercise overflow conditions
-#if ULONG_MAX == 0xffffUL
+#if defined (_RWSTD_LONG_LONG) && _RWSTD_PTR_SIZE > _RWSTD_LONG_SIZE \
+ || ULONG_MAX > 0xffffffffUL
+ const char pvmax[] = "0xffffffffffffffff";
+ const char pvmax_plus_1[] = "0x10000000000000000";
+#elif ULONG_MAX == 0xffffUL
const char pvmax[] = "0xffff";
const char pvmax_plus_1[] = "0x10000";
#elif ULONG_MAX == 0xffffffffUL
const char pvmax[] = "0xffffffff";
const char pvmax_plus_1[] = "0x100000000";
-#elif ULONG_MAX > 0xffffffffUL
- const char pvmax[] = "0xffffffffffffffff";
- const char pvmax_plus_1[] = "0x10000000000000000";
#else
// working around a SunPro bug (PR #28279)
const char pvmax[] = "0";
@@ -2196,7 +2194,7 @@
TEST (T, F (1.0e+28), "10000000000000000000000000000", 29, 0, Eof);
TEST (T, F (1.0e+29), "100000000000000000000000000000", 30, 0, Eof);
-#define VALSTR(x) floatT (x), #x, std::strlen (#x)
+#define VALSTR(x) floatT (x), #x, int (std::strlen (#x))
// exercise various forms of floating point 0
@@ -2444,7 +2442,6 @@
// exercise bahvior on underflow
float val = 0;
- pmax = &val;
// on underflow, get() follows C99 requirements on strtof()
// i.e., it stores a value in the range [0, +/-FLT_MIN]
@@ -2455,35 +2452,34 @@
// normalized positive number in the return type; whether
// errno acquires the value ERANGE is implementation-defined.
- TEST (T, (val = FLT_MIN, 0.0f), "1.111111e-9999", 14, 0, Eof);
+ TEST (T_MAX, (val = FLT_MIN, 0.0f), "1.111111e-9999", 14, 0, Eof);
rw_assert (!(val < 0.0), 0, __LINE__,
"correct sign after positive underflow");
- TEST (T, (val = 0.0f, -FLT_MIN), "-1.111111e-9999", 15, 0, Eof);
+ TEST (T_MAX, (val = 0.0f, -FLT_MIN), "-1.111111e-9999", 15, 0, Eof);
rw_assert (!(val > 0.0), 0, __LINE__,
"correct sign after negative underflow");
if (1.234567e-39 < FLT_MIN) {
- TEST (T, (val = FLT_MIN, 0.0f), "1.234567e-39", 12, 0, Eof);
- TEST (T, (val = 0.0f, -FLT_MIN), "-1.234567e-39", 13, 0, Eof);
+ TEST (T_MAX, (val = FLT_MIN, 0.0f), "1.234567e-39", 12, 0, Eof);
+ TEST (T_MAX, (val = 0.0f, -FLT_MIN), "-1.234567e-39", 13, 0, Eof);
}
if (1.234567e-49 < FLT_MIN) {
- TEST (T, (val = FLT_MIN, 0.0f), "1.234567e-49", 12, 0, Eof);
- TEST (T, (val = 0.0f, -FLT_MIN), "-1.234567e-49", 13, 0, Eof);
+ TEST (T_MAX, (val = FLT_MIN, 0.0f), "1.234567e-49", 12, 0, Eof);
+ TEST (T_MAX, (val = 0.0f, -FLT_MIN), "-1.234567e-49", 13, 0, Eof);
}
if (1.234567e-99 < FLT_MIN) {
- TEST (T, (val = FLT_MIN, 0.0f), "1.234567e-99", 12, 0, Eof);
- TEST (T, (val = 0.0f, -FLT_MIN), "-1.234567e-99", 13, 0, Eof);
+ TEST (T_MAX, (val = FLT_MIN, 0.0f), "1.234567e-99", 12, 0, Eof);
+ TEST (T_MAX, (val = 0.0f, -FLT_MIN), "-1.234567e-99", 13, 0, Eof);
}
// exercise facet's behavior on underflow:
// parsing succeeds (fail is clear), +/-min is stored
- TEST (T, FLT_MIN, _RWSTD_STRSTR ( _RWSTD_DBL_MIN), -1, 0, Eof);
- TEST (T, -FLT_MIN, _RWSTD_STRSTR (-_RWSTD_DBL_MIN), -1, 0, Eof);
+ TEST (T_MAX, FLT_MIN, _RWSTD_STRSTR ( _RWSTD_DBL_MIN), -1, 0, Eof);
+ TEST (T_MAX, -FLT_MIN, _RWSTD_STRSTR (-_RWSTD_DBL_MIN), -1, 0, Eof);
- pmax = 0; // reset before next test
rw_info (0, 0, 0, "std::num_get<%s, %s>::get (..., float&) on overflow",
@@ -2615,7 +2611,6 @@
// exercise bahvior on underflow
double val = DBL_MIN;
- pmax = &val;
// on underflow, get() follows C99 requirements on strtod()
// i.e., it stores a value in the range [0, +/-DBL_MIN]
@@ -2626,25 +2621,24 @@
// normalized positive number in the return type; whether
// errno acquires the value ERANGE is implementation-defined.
- TEST (T, (val = DBL_MIN, 0.0), "1.111111e-9999", 14, 0, Eof);
- TEST (T, (val = 0.0, -DBL_MIN), "-1.111111e-9999", 15, 0, Eof);
+ TEST (T_MAX, (val = DBL_MIN, 0.0), "1.111111e-9999", 14, 0, Eof);
+ TEST (T_MAX, (val = 0.0, -DBL_MIN), "-1.111111e-9999", 15, 0, Eof);
if (1.23456789e-309L < DBL_MIN) {
- TEST (T, (val = DBL_MIN, 0.0), "1.23456789e-309", 15, 0, Eof);
- TEST (T, (val = 0.0, -DBL_MIN), "-1.23456789e-309", 16, 0, Eof);
+ TEST (T_MAX, (val = DBL_MIN, 0.0), "1.23456789e-309", 15, 0, Eof);
+ TEST (T_MAX, (val = 0.0, -DBL_MIN), "-1.23456789e-309", 16, 0, Eof);
}
if (1.234567e-409L < DBL_MIN) {
- TEST (T, (val = DBL_MIN, 0.0), "1.23456789e-409", 15, 0, Eof);
- TEST (T, (val = 0.0, -DBL_MIN), "-1.23456789e-409", 16, 0, Eof);
+ TEST (T_MAX, (val = DBL_MIN, 0.0), "1.23456789e-409", 15, 0, Eof);
+ TEST (T_MAX, (val = 0.0, -DBL_MIN), "-1.23456789e-409", 16, 0, Eof);
}
if (1.234567e-999L < DBL_MIN) {
- TEST (T, (val = DBL_MIN, 0.0), "1.23456789e-999", 15, 0, Eof);
- TEST (T, (val = 0.0, -DBL_MIN), "-1.23456789e-999", 16, 0, Eof);
+ TEST (T_MAX, (val = DBL_MIN, 0.0), "1.23456789e-999", 15, 0, Eof);
+ TEST (T_MAX, (val = 0.0, -DBL_MIN), "-1.23456789e-999", 16, 0, Eof);
}
- pmax = 0; // reset before next test
# ifdef _RWSTD_LDBL_MAX
@@ -2738,7 +2732,6 @@
// exercise bahvior on underflow
long double val = LDBL_MIN;
- pmax = &val;
// on underflow, get() follows C99 requirements on strtold()
// i.e., it stores a value in the range [0, +/-LDBL__MIN]
@@ -2749,23 +2742,22 @@
// normalized positive number in the return type; whether
// errno acquires the value ERANGE is implementation-defined.
- TEST (T, (val = LDBL_MIN, 0.0L), "1.987654321e-99999", 18, 0, Eof);
- TEST (T, (val = 0.0L, -LDBL_MIN), "-1.987654321e-99999", 19, 0, Eof);
+ TEST (T_MAX, (val = LDBL_MIN, 0.0L), "1.987654321e-99999", 18, 0, Eof);
+ TEST (T_MAX, (val = 0.0L, -LDBL_MIN), "-1.987654321e-99999", 19, 0, Eof);
const char fmt[] = "%Lg";
long double ld = 0.0;
if (1 == std::sscanf ("3.456789e-4932", fmt, &ld) && ld < LDBL_MIN) {
- TEST (T, (val = LDBL_MIN, 0.0L), "3.456789e-4932", 14, 0, Eof);
- TEST (T, (val = 0.0L, -LDBL_MIN), "-3.456789e-4932", 15, 0, Eof);
+ TEST (T_MAX, (val = LDBL_MIN, 0.0L), "3.456789e-4932", 14, 0, Eof);
+ TEST (T_MAX, (val = 0.0L, -LDBL_MIN), "-3.456789e-4932", 15, 0, Eof);
}
if (1 == std::sscanf ("3.456789e-9999", fmt, &ld) && ld < LDBL_MIN) {
- TEST (T, (val = LDBL_MIN, 0.0L), "3.456789e-9999", 14, 0, Eof);
- TEST (T, (val = 0.0L, -LDBL_MIN), "-3.456789e-9999", 15, 0, Eof);
+ TEST (T_MAX, (val = LDBL_MIN, 0.0L), "3.456789e-9999", 14, 0, Eof);
+ TEST (T_MAX, (val = 0.0L, -LDBL_MIN), "-3.456789e-9999", 15, 0, Eof);
}
- pmax = 0; // reset before next test
# ifdef _RWSTD_LDBL_MAX
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=648752&r1=648751&r2=648752&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 Wed Apr 16 10:01:56 2008
@@ -474,7 +474,7 @@
rw_info (0, 0, 0,
"testing std::num_get<charT> with %d thread%{?}s%{;}, "
- "%zu iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
+ "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
rw_opt_nthreads, 1 != rw_opt_nthreads,
rw_opt_nloops, 1 != rw_opt_nloops,
nlocales, int (nlocales), "%#s", locales);
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.num.put.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.num.put.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.num.put.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.num.put.cpp Wed Apr 16 10:01:56 2008
@@ -337,7 +337,7 @@
// fail at most once for each specialization
rw_assert (!width_fail++, 0, lineno,
- "%line d: num_put<%s>::put (..., %s = %s) "
+ "line %d: num_put<%s>::put (..., %s = %s) "
"failed to reset width from %d; width() = %d",
__LINE__, cname, tname, TOSTR (val),
TOSTR (buf), width, ios.width ());
@@ -1576,7 +1576,7 @@
#if 0
// temporarily disabled (NAN format is platform specific
- // and subject to bugs -- see for example STDCXX-460)
+ // and subject to bugs -- see for example STDCXX-464)
const floatT nan = 0 / zero;
@@ -1720,16 +1720,16 @@
Punct<charT>::decimal_point_ = '.';
- TEST (T, 0.0, 0, 0, 0, ' ', "", "%g");
- TEST (T, -0.0, 0, 0, 0, ' ', "", "%g");
- TEST (T, 1.0, 0, 0, 0, ' ', "", "%g");
+ TEST (T, 0.0, 0, 0, 0, ' ', "", "%.0g");
+ TEST (T, -0.0, 0, 0, 0, ' ', "", "%.0g");
+ TEST (T, 1.0, 0, 0, 0, ' ', "", "%.0g");
TEST (T, 1.0, 0, 0, 0, ' ', "", "1");
- TEST (T, -1.0, 0, 0, 0, ' ', "", "%g");
+ TEST (T, -1.0, 0, 0, 0, ' ', "", "%.0g");
TEST (T, -1.0, 0, 0, 0, ' ', "", "-1");
- TEST (T, 1.1, 0, 0, 0, ' ', "", "%g");
- TEST (T, 1.1, 0, 0, 0, ' ', "", "1.1");
- TEST (T, -1.1, 0, 0, 0, ' ', "", "%g");
- TEST (T, -1.1, 0, 0, 0, ' ', "", "-1.1");
+ TEST (T, 1.1, 0, 0, 0, ' ', "", "%.0g");
+ TEST (T, 1.1, 0, 0, 0, ' ', "", "1");
+ TEST (T, -1.1, 0, 0, 0, ' ', "", "%.0g");
+ TEST (T, -1.1, 0, 0, 0, ' ', "", "-1");
// exercise formatting of very large numbers in a fixed notation
@@ -1812,25 +1812,25 @@
Punct<charT>::decimal_point_ = '.';
- TEST (T, 0.0L, 0, 0, 0, ' ', "", "%Lg");
- TEST (T, 1.0L, 0, 0, 0, ' ', "", "%Lg");
- TEST (T, 2.1L, 0, 0, 0, ' ', "", "%Lg");
- TEST (T, -3.2L, 0, 0, 0, ' ', "", "%Lg");
- TEST (T, -4.3L, 0, 0, 0, ' ', "", "%Lg");
-
- TEST (T, 1.0e+10L, 0, 0, 0, ' ', "", "%Lg");
- TEST (T, 2.0e+20L, 0, 0, 0, ' ', "", "%Lg");
- TEST (T, 4.0e+30L, 0, 0, 0, ' ', "", "%Lg");
-
- TEST (T, 1.0e-10L, 0, 0, 0, ' ', "", "%Lg");
- TEST (T, 2.0e-20L, 0, 0, 0, ' ', "", "%Lg");
- TEST (T, 4.0e-30L, 0, 0, 0, ' ', "", "%Lg");
-
- TEST (T, LDbl (CHAR_MAX), 0, 0, 0, ' ', "", "%Lg");
- TEST (T, LDbl (UCHAR_MAX), 0, 0, 0, ' ', "", "%Lg");
- TEST (T, LDbl (SCHAR_MAX), 0, 0, 0, ' ', "", "%Lg");
- TEST (T, LDbl (SHRT_MAX), 0, 0, 0, ' ', "", "%Lg");
- TEST (T, LDbl (USHRT_MAX), 0, 0, 0, ' ', "", "%Lg");
+ TEST (T, 0.0L, 0, 0, 0, ' ', "", "%.0Lg");
+ TEST (T, 1.0L, 0, 0, 0, ' ', "", "%.0Lg");
+ TEST (T, 2.1L, 0, 0, 0, ' ', "", "%.0Lg");
+ TEST (T, -3.2L, 0, 0, 0, ' ', "", "%.0Lg");
+ TEST (T, -4.3L, 0, 0, 0, ' ', "", "%.0Lg");
+
+ TEST (T, 1.0e+10L, 0, 0, 0, ' ', "", "%.0Lg");
+ TEST (T, 2.0e+20L, 0, 0, 0, ' ', "", "%.0Lg");
+ TEST (T, 4.0e+30L, 0, 0, 0, ' ', "", "%.0Lg");
+
+ TEST (T, 1.0e-10L, 0, 0, 0, ' ', "", "%.0Lg");
+ TEST (T, 2.0e-20L, 0, 0, 0, ' ', "", "%.0Lg");
+ TEST (T, 4.0e-30L, 0, 0, 0, ' ', "", "%.0Lg");
+
+ TEST (T, LDbl (CHAR_MAX), 0, 0, 0, ' ', "", "%.0Lg");
+ TEST (T, LDbl (UCHAR_MAX), 0, 0, 0, ' ', "", "%.0Lg");
+ TEST (T, LDbl (SCHAR_MAX), 0, 0, 0, ' ', "", "%.0Lg");
+ TEST (T, LDbl (SHRT_MAX), 0, 0, 0, ' ', "", "%.0Lg");
+ TEST (T, LDbl (USHRT_MAX), 0, 0, 0, ' ', "", "%.0Lg");
// specify greater precision than the default 6 for large numbers
TEST (T, LDbl (INT_MAX), 0, 32, 0, ' ', "", "%.32Lg");
@@ -1917,6 +1917,8 @@
TEST (T, Pi, SHOWALL (scientific), 0, 0, ' ', "", "+3.E+00", Eof, 3.0L);
// with {g,G}, precision indicates the number of significant digits
+ // the precision == 0 should have the same effect as precision == 1
+ TEST (T, Pi, 0, 0, 0, ' ', "", "%.0Lg", Eof, 3.0L);
TEST (T, Pi, 0, 1, 0, ' ', "", "%.1Lg", Eof, 3.0L);
TEST (T, Pi, 0, 2, 0, ' ', "", "%.2Lg", Eof, 3.1L);
TEST (T, Pi, 0, 3, 0, ' ', "", "%.3Lg", Eof, 3.14L);
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.num.put.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.num.put.mt.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.num.put.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.num.put.mt.cpp Wed Apr 16 10:01:56 2008
@@ -42,17 +42,27 @@
// default number of threads (will be adjusted to the number
// of processors/cores later)
-int rw_opt_nthreads = 1;
+int opt_nthreads = 1;
// the number of times each thread should iterate
-int rw_opt_nloops = MAX_LOOPS;
+int 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?
-int rw_opt_shared_locale;
+int opt_shared_locale;
/**************************************************************************/
@@ -226,7 +236,7 @@
wio.rdbuf (&wsb);
#endif // _RWSTD_NO_WCHAR_T
- for (int i = 0; i != rw_opt_nloops; ++i) {
+ for (int i = 0; i != opt_nloops; ++i) {
// fill in the value and results for this locale
const MyNumData& data = my_num_data [i % nlocales];
@@ -234,7 +244,7 @@
// construct a named locale and imbue it in the ios object
// so that the locale is used not only by the num_put facet
const std::locale loc =
- rw_opt_shared_locale ? data.locale_
+ opt_shared_locale ? data.locale_
: std::locale (data.locale_name_);
if (test_char) {
@@ -352,7 +362,7 @@
#endif // _RWSTD_NO_WCHAR_T
- if (rw_opt_shared_locale)
+ if (opt_shared_locale)
data.locale_ = loc;
nlocales += 1;
@@ -362,7 +372,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;
}
@@ -372,9 +382,9 @@
rw_info (0, 0, 0,
"testing std::num_put<charT> with %d thread%{?}s%{;}, "
- "%zu iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
- rw_opt_nthreads, 1 != rw_opt_nthreads,
- rw_opt_nloops, 1 != rw_opt_nloops,
+ "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
+ opt_nthreads, 1 != opt_nthreads,
+ opt_nloops, 1 != opt_nloops,
nlocales, int (nlocales), "%#s", locales);
rw_info (0, 0, 0, "exercising std::num_put<char>");
@@ -384,11 +394,11 @@
// create and start a pool of threads and wait for them to finish
int result =
- rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+ rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
rw_error (result == 0, 0, __LINE__,
"rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
- rw_opt_nthreads, thread_func);
+ opt_nthreads, thread_func);
#ifndef _RWSTD_NO_WCHAR_T
@@ -399,11 +409,11 @@
// start a pool of threads to exercise wstring thread safety
result =
- rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+ rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
rw_error (result == 0, 0, __LINE__,
"rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
- rw_opt_nthreads, thread_func);
+ opt_nthreads, thread_func);
// exercise both the char and the wchar_t specializations
// at the same time
@@ -416,11 +426,11 @@
// start a pool of threads to exercise wstring thread safety
result =
- rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+ rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
rw_error (result == 0, 0, __LINE__,
"rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
- rw_opt_nthreads, thread_func);
+ opt_nthreads, thread_func);
#endif // _RWSTD_NO_WCHAR_T
@@ -435,9 +445,9 @@
// set nthreads to the greater of the number of processors
// and 2 (for uniprocessor systems) by default
- rw_opt_nthreads = rw_get_cpus ();
- if (rw_opt_nthreads < 2)
- rw_opt_nthreads = 2;
+ opt_nthreads = rw_get_cpus ();
+ if (opt_nthreads < 2)
+ opt_nthreads = 2;
#endif // _RWSTD_REENTRANT
@@ -449,10 +459,10 @@
"|-nlocales#0 " // arg must be non-negative
"|-locales= " // must be provided
"|-shared-locale# ",
- &rw_opt_nloops,
+ &opt_nloops,
int (MAX_THREADS),
- &rw_opt_nthreads,
- &rw_opt_nlocales,
+ &opt_nthreads,
+ &opt_nlocales,
&rw_opt_setlocales,
- &rw_opt_shared_locale);
+ &opt_shared_locale);
}
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.numpunct.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.numpunct.mt.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.numpunct.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.numpunct.mt.cpp Wed Apr 16 10:01:56 2008
@@ -43,18 +43,28 @@
// default number of threads (will be adjusted to the number
// of processors/cores later)
-int rw_opt_nthreads = 1;
+int opt_nthreads = 1;
// the number of times each thread should iterate (unless specified
// otherwise on the command line)
int rw_opt_nloops = 200000;
+#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?
-int rw_opt_shared_locale;
+int opt_shared_locale;
/**************************************************************************/
@@ -109,7 +119,7 @@
// construct a named locale
const std::locale loc =
- rw_opt_shared_locale ? data.locale_
+ opt_shared_locale ? data.locale_
: std::locale (data.locale_name_);
if (test_char) {
@@ -218,7 +228,7 @@
#endif
- if (rw_opt_shared_locale)
+ if (opt_shared_locale)
data.locale_ = loc;
nlocales += 1;
@@ -228,7 +238,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;
}
@@ -238,10 +248,10 @@
rw_info (0, 0, 0,
"testing std::numpunct<charT> with %d thread%{?}s%{;}, "
- "%zu iteration%{?}s%{;} each, in locales { %{ .*A@} }",
- rw_opt_nthreads, 1 != rw_opt_nthreads,
+ "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
+ opt_nthreads, 1 != opt_nthreads,
rw_opt_nloops, 1 != rw_opt_nloops,
- int (nlocales), "%#s", locales);
+ nlocales, int (nlocales), "%#s", locales);
rw_info (0, 0, 0, "exercising std::numpunct<char>");
@@ -250,11 +260,11 @@
// create and start a pool of threads and wait for them to finish
int result =
- rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+ rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
rw_error (result == 0, 0, __LINE__,
"rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
- rw_opt_nthreads, thread_func);
+ opt_nthreads, thread_func);
#ifndef _RWSTD_NO_WCHAR_T
@@ -266,11 +276,11 @@
// start a pool of threads to exercise the thread safety
// of the wchar_t specialization
result =
- rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+ rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
rw_error (result == 0, 0, __LINE__,
"rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
- rw_opt_nthreads, thread_func);
+ opt_nthreads, thread_func);
// exercise both the char and the wchar_t specializations
// at the same time
@@ -283,11 +293,11 @@
// start a pool of threads to exercise wstring thread safety
result =
- rw_thread_pool (0, std::size_t (rw_opt_nthreads), 0, thread_func, 0);
+ rw_thread_pool (0, std::size_t (opt_nthreads), 0, thread_func, 0);
rw_error (result == 0, 0, __LINE__,
"rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
- rw_opt_nthreads, thread_func);
+ opt_nthreads, thread_func);
#endif // _RWSTD_NO_WCHAR_T
@@ -302,9 +312,9 @@
// set nthreads to the greater of the number of processors
// and 2 (for uniprocessor systems) by default
- rw_opt_nthreads = rw_get_cpus ();
- if (rw_opt_nthreads < 2)
- rw_opt_nthreads = 2;
+ opt_nthreads = rw_get_cpus ();
+ if (opt_nthreads < 2)
+ opt_nthreads = 2;
#endif // _RWSTD_REENTRANT
@@ -318,8 +328,8 @@
"|-shared-locale# ",
&rw_opt_nloops,
int (MAX_THREADS),
- &rw_opt_nthreads,
- &rw_opt_nlocales,
+ &opt_nthreads,
+ &opt_nlocales,
&rw_opt_setlocales,
- &rw_opt_shared_locale);
+ &opt_shared_locale);
}
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.statics.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.statics.mt.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.statics.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.statics.mt.cpp Wed Apr 16 10:01:56 2008
@@ -69,7 +69,9 @@
{
static volatile int nthreads;
- _RWSTD_ATOMIC_PREINCREMENT (nthreads, false);
+ // cast nthreads to int& (see STDCXX-792)
+ // casting should be removed after fixing STDCXX-794
+ _RWSTD_ATOMIC_PREINCREMENT (_RWSTD_CONST_CAST (int&, nthreads), false);
// spin until all threads have been created in order to icrease
// the odds that at least two of them will hit the tested function
@@ -88,9 +90,9 @@
static void*
test_global (void*)
{
- for (int i = 0; i != opt_nloops; ++i) {
+ for (std::size_t i = 0; i != opt_nloops; ++i) {
- const int inx = i % nlocales;
+ const std::size_t inx = i % nlocales;
const std::locale last (std::locale::global (locales [inx]));
@@ -151,7 +153,7 @@
rw_info (0, 0, 0,
"testing std::locale::global(const std::locale&) with "
- "%d thread%{?}s%{;}, %zu iteration%{?}s%{;} each, in "
+ "%d thread%{?}s%{;}, %d iteration%{?}s%{;} each, in "
"%zu locales { %{ .*A@} }",
opt_nthreads, 1 != opt_nthreads,
opt_nloops, 1 != opt_nloops,
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.time.get.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.time.get.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.time.get.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.time.get.cpp Wed Apr 16 10:01:56 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.
*
**************************************************************************/
@@ -38,7 +38,7 @@
#include <driver.h> // for rw_test()
#include <file.h> // for rw_nextfd()
-#include <rw_locale.h> // for rw_locales()
+#include <rw_locale.h> // for rw_locale_query()
#include <rw_printf.h> // for rw_snprintf()
/**************************************************************************/
@@ -1138,6 +1138,8 @@
return 0;
std::FILE *fout = std::fopen (srcfname, "w");
+ rw_fatal (0 != fout, 0, __LINE__,
+ "fopen(%#s, \"w\") failed: %{#m} - %m", srcfname);
std::fprintf (fout, "LC_TIME\n");
@@ -1228,7 +1230,7 @@
char segment [256];
- std::sprintf (segment, "%c:%u:%04d/%02d/%02d:",
+ std::sprintf (segment, "%c:%d:%04d/%02d/%02d:",
td->era [i].offset < 0 ? '-' : '+',
td->era [i].offset < 0 ? -td->era [i].offset
: td->era [i].offset,
@@ -1274,6 +1276,9 @@
return 0;
fout = std::fopen (cmfname, "w");
+ rw_fatal (0 != fout, 0, __LINE__,
+ "fopen(%#s, \"w\") failed: %{#m} - %m", cmfname);
+
pcs_write (fout, 0);
std::fclose (fout);
@@ -1282,7 +1287,7 @@
const char* const locname =
rw_localedef ("-w ", srcfname, cmfname, "test-locale");
- if (locname && (strlen(locname) < sizeof locnamebuf))
+ if (locname && (std::strlen(locname) < sizeof locnamebuf))
std::strcpy (locnamebuf, locname);
return locname;
@@ -1579,33 +1584,6 @@
/**************************************************************************/
-
-// try to find a named locale (use a grep expression if available)
-static const char*
-find_locale (const char *name)
-{
-#if !defined (_WIN32) && !defined (_WIN64)
-
- rw_locales (_UNUSED_CAT, name);
- return rw_locales (LC_ALL, name);
-
-#else // _WIN{32,64}
-
- // FIXME: handle non-UNIX systems
- for (const char *loc = rw_locales (); loc && *loc;
- loc += std::strlen (loc) + 1) {
-
- if (!std::strcmp (loc, name))
- return loc;
- }
-
- return 0;
-
-#endif // _WIN{32,64}
-}
-
-/**************************************************************************/
-
static int
run_test (int, char**)
{
@@ -1622,36 +1600,26 @@
const char *locname;
-#if !defined (_WIN32) && !defined (_WIN64)
-
- const char en_US[] = "en_US";
- const char de[] = "^de[^a-z1-9]*";
- const char da[] = "^da[^a-z1-9]*";
-
-#else // dumbass Windows
-
- const char en_US[] = "ENU";
- const char de[] = "DEU";
- const char da[] = "DAN";
-
-#endif
+ const char en[] = "en-*-*-*";
+ const char de[] = "de-*-*-*";
+ const char da[] = "da-*-*-*";
int nnamed = 0;
// try to find and exercise the english locale
- if ((locname = find_locale (en_US)) && *locname) {
+ if ((locname = rw_locale_query (LC_ALL, en, 1)) && *locname) {
test_english (char (), "char", locname);
++nnamed;
}
// try to find and exercise the german locale
- if ((locname = find_locale (de)) && *locname) {
+ if ((locname = rw_locale_query (LC_ALL, de, 1)) && *locname) {
test_german (char (), "char", locname);
++nnamed;
}
// try to find and exercise the danish locale
- if ((locname = find_locale (da)) && *locname) {
+ if ((locname = rw_locale_query (LC_ALL, da, 1)) && *locname) {
test_danish (char (), "char", locname);
++nnamed;
}
Modified: stdcxx/branches/4.2.x/tests/localization/22.locale.time.get.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/localization/22.locale.time.get.mt.cpp?rev=648752&r1=648751&r2=648752&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/localization/22.locale.time.get.mt.cpp (original)
+++ stdcxx/branches/4.2.x/tests/localization/22.locale.time.get.mt.cpp Wed Apr 16 10:01:56 2008
@@ -441,7 +441,7 @@
rw_info (0, 0, 0,
"testing std::time_get<charT> with %d thread%{?}s%{;}, "
- "%zu iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
+ "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
rw_opt_nthreads, 1 != rw_opt_nthreads,
rw_opt_nloops, 1 != rw_opt_nloops,
nlocales, int (nlocales), "%#s", locales);