Modified: stdcxx/trunk/src/wcodecvt.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/wcodecvt.cpp?rev=681826&r1=681825&r2=681826&view=diff ============================================================================== --- stdcxx/trunk/src/wcodecvt.cpp (original) +++ stdcxx/trunk/src/wcodecvt.cpp Fri Aug 1 14:09:45 2008 @@ -74,8 +74,8 @@ # undef _RWSTD_NO_MBRLEN -extern "C" _RWSTD_SIZE_T -mbrlen (const char*, _RWSTD_SIZE_T, _RWSTD_MBSTATE_T*) _LIBC_THROWS(); +extern "C" size_t +mbrlen (const char*, size_t, _RWSTD_MBSTATE_T*) _LIBC_THROWS(); #endif // _RWSTD_NO_MBRLEN && !_RWSTD_NO_MBRLEN_IN_LIBC @@ -87,7 +87,7 @@ # undef _RWSTD_NO_MBLEN extern "C" _RWSTD_SIZE_T -mblen (const char*, _RWSTD_SIZE_T) _LIBC_THROWS(); +mblen (const char*, size_t) _LIBC_THROWS(); #endif // _RWSTD_NO_MBLEN && !_RWSTD_NO_MBLEN_IN_LIBC @@ -99,7 +99,7 @@ # undef _RWSTD_NO_MBTOWC extern "C" int -mbtowc (wchar_t*, const char*, _RWSTD_SIZE_T) _LIBC_THROWS(); +mbtowc (wchar_t*, const char*, size_t) _LIBC_THROWS(); #endif // _RWSTD_NO_MBTOWC && !_RWSTD_NO_MBTOWC_IN_LIBC @@ -110,9 +110,8 @@ # undef _RWSTD_NO_WCSRTOMBS -extern "C" _RWSTD_SIZE_T -wcsrtombs (char*, const wchar_t**, - _RWSTD_SIZE_T, _RWSTD_MBSTATE_T*) _LIBC_THROWS(); +extern "C" size_t +wcsrtombs (char*, const wchar_t**, size_t, _RWSTD_MBSTATE_T*) _LIBC_THROWS(); #endif // _RWSTD_NO_WCSRTOMBS && !_RWSTD_NO_WCSRTOMBS_IN_LIBC @@ -123,7 +122,7 @@ # undef _RWSTD_NO_WCRTOMB -extern "C" _RWSTD_SIZE_T +extern "C" size_t wcrtomb (char*, wchar_t, _RWSTD_MBSTATE_T*) _LIBC_THROWS(); #endif // _RWSTD_NO_WCRTOMB && !_RWSTD_NO_WCRTOMB_IN_LIBC @@ -237,7 +236,7 @@ { "UCS-LE", __rw_ucs_le } }; -static const _RWSTD_SIZE_T +static const size_t __rw_n_ucsmods = sizeof __rw_ucsmods / sizeof *__rw_ucsmods; @@ -270,10 +269,10 @@ // behaves just like mbrlen(), except that if the character pointed to // by `str' is the NUL character and `emax' is non-zero, the function // returns 1 -static inline _RWSTD_SIZE_T +static inline size_t __rw_libc_mbrlen (_RWSTD_MBSTATE_T &state, const char *str, - _RWSTD_SIZE_T emax) + size_t emax) { _RWSTD_ASSERT (0 != str); @@ -313,7 +312,7 @@ // does a simple transliteration of the UTF-8 encoded character string static unsigned int __rw_xlit (const _RW::__rw_codecvt_t* impl, - const char *utf8s, _RWSTD_SIZE_T sz) + const char *utf8s, size_t sz) { const unsigned int* const ptbls = impl->get_xliteration_tab (); @@ -358,8 +357,8 @@ // compute the length of the source sequence in bytes and // the size of the destination buffer in wide characters - _RWSTD_SIZE_T src_len = from_end - from; - _RWSTD_SIZE_T dst_size = to_limit - to; + size_t src_len = from_end - from; + size_t dst_size = to_limit - to; // set the initial values to the source and destination pointers const char* psrc = from; @@ -368,7 +367,7 @@ while (dst_size && src_len) { // the number of bytes that form the next multibyte character - _RWSTD_SIZE_T nbytes; + size_t nbytes; #ifndef _RWSTD_NO_MBRTOWC nbytes = mbrtowc (pdst, psrc, src_len, &state); @@ -379,14 +378,14 @@ #endif // -1 indicates an invalid sequence (i.e., error) - if (nbytes == (_RWSTD_SIZE_T)(-1)) { + if (nbytes == size_t (-1)) { res = _STD::codecvt_base::error; break; } // -2 indicates an ambiguous but valid subsequence // (i.e., ok) - if (nbytes == (_RWSTD_SIZE_T)(-2)) + if (nbytes == size_t (-2)) break; // 0 indicates the NUL character (skip over it) @@ -410,8 +409,8 @@ // range then we have a "partial" conversion if (res == _STD::codecvt_base::ok && src_len && !dst_size) { _RWSTD_MBSTATE_T tmp_state = state; - _RWSTD_SIZE_T tmp = __rw_libc_mbrlen (tmp_state, psrc, src_len); - if (tmp < (_RWSTD_SIZE_T)(-2)) + size_t tmp = __rw_libc_mbrlen (tmp_state, psrc, src_len); + if (tmp < size_t (-2)) res = _STD::codecvt_base::partial; } @@ -442,15 +441,13 @@ // save the value of MB_CUR_MAX and avoid repeatedly using // the macro for efficiency (it may expand to a function call) - const _RWSTD_SIZE_T mb_cur_max = - _RWSTD_STATIC_CAST (_RWSTD_SIZE_T, MB_CUR_MAX); + const size_t mb_cur_max = size_t (MB_CUR_MAX); // the result of conversion _STD::codecvt_base::result res = _STD::codecvt_base::ok; // the size of the available space in the destination range - _RWSTD_SIZE_T dst_free = - _RWSTD_STATIC_CAST (_RWSTD_SIZE_T, to_limit - to_next); + size_t dst_free = size_t (to_limit - to_next); // small temporary buffer used when the space in the destination // buffer is less than MB_CUR_MAX @@ -472,7 +469,7 @@ // the number of bytes in the resulting multibyte character // sequence, not including the terminating NUL - _RWSTD_SIZE_T dst_len = 0; + size_t dst_len = 0; #ifndef _RWSTD_NO_WCRTOMB @@ -546,7 +543,7 @@ // use libc locale to obtain the shift sequence char tmp [_RWSTD_MB_LEN_MAX]; - _RWSTD_SIZE_T ret; + size_t ret; #ifndef _RWSTD_NO_WCRTOMB ret = wcrtomb (tmp, wchar_t (0), &state); @@ -559,7 +556,7 @@ if (_RWSTD_SIZE_MAX == ret) return _STD::codecvt_base::error; - if (ret > (_RWSTD_SIZE_T)(to_limit - to_next)) { + if (ret > size_t (to_limit - to_next)) { // restore the state and return partial state = tmp_state; return _STD::codecvt_base::partial; @@ -576,7 +573,7 @@ // for validity by performing a number of computationally // relatively expensive tests; used only in strict mode static bool -__rw_utf8validate (const char* from, _RWSTD_SIZE_T nbytes) +__rw_utf8validate (const char* from, size_t nbytes) { _RWSTD_ASSERT (0 != from); _RWSTD_ASSERT (1 < nbytes && 7 > nbytes); @@ -622,7 +619,7 @@ if (6 == nbytes && 0xfcU == byte [0] && (byte [1] & 0xfcU) == 0x80U) return false; - for (_RWSTD_SIZE_T i = 1; i < nbytes; ++i) { + for (size_t i = 1; i < nbytes; ++i) { if ((byte [i] & ~0x3fU) != 0x80U) return false; // invalid byte } @@ -699,7 +696,7 @@ if (strict_utf && tmp) { // perform additional expensive UTF-8 validation - const _RWSTD_SIZE_T utf_len = tmp - from; + const size_t utf_len = tmp - from; if (utf_len > 1 && !__rw_utf8validate (from, utf_len)) tmp = 0; @@ -780,9 +777,9 @@ } // compute the number of bytes available in the destination sequence - const _RWSTD_SIZE_T bytes_avail = to_limit - to_next; + const size_t bytes_avail = to_limit - to_next; - _RWSTD_SIZE_T utf8_len; + size_t utf8_len; if (impl) { @@ -861,11 +858,11 @@ // implements do_length() on top of libc mbrlen() -static _RWSTD_SIZE_T +static size_t __rw_libc_do_length (_RWSTD_MBSTATE_T &state, const char *from, const char *from_end, - _RWSTD_SIZE_T imax) + size_t imax) { const char* const from_begin = from; @@ -873,7 +870,7 @@ // compute the maximum length (in bytes) of the multibyte // character sequence starting at `from' - _RWSTD_SIZE_T nbytes = from_end - from; + size_t nbytes = from_end - from; if (_RWSTD_MB_LEN_MAX < nbytes) nbytes = _RWSTD_MB_LEN_MAX; @@ -884,7 +881,7 @@ nbytes = __rw_libc_mbrlen (state, from, nbytes); // stop when an invalid or incomplete character is encountered - if (nbytes >= (_RWSTD_SIZE_T)(-2)) + if (nbytes >= size_t (-2)) break; from += nbytes; @@ -896,10 +893,10 @@ // implements do_length() for [EMAIL PROTECTED] -static _RWSTD_SIZE_T +static size_t __rw_utf8_do_length (const char *from, const char *from_end, - _RWSTD_SIZE_T imax, + size_t imax, int flags) { _RWSTD_ASSERT (from <= from_end); @@ -924,7 +921,7 @@ _RWSTD_ASSERT (next <= from_end); // perform additional expensive UTF-8 validation in strict mode - const _RWSTD_SIZE_T utf_len = next - from_next; + const size_t utf_len = next - from_next; if ( strict_utf && utf_len > 1 && !__rw_utf8validate (from_next, utf_len)) @@ -960,10 +957,10 @@ // Note that the function returns the number of externT characters // (i.e., those of type char for the required instantiations). -static _RWSTD_SIZE_T +static size_t __rw_libstd_do_length (const char* from, const char* from_end, - _RWSTD_SIZE_T imax, + size_t imax, int flags, const _RW::__rw_codecvt_t* impl) { @@ -1028,13 +1025,22 @@ /* explicit */ codecvt<wchar_t, char, _RWSTD_MBSTATE_T>:: -codecvt (_RWSTD_SIZE_T __ref /* = 0 */) +codecvt (size_t __ref /* = 0 */) : _RW::__rw_facet (__ref) { // no-op } +// outlined to avoid generating a vtable in each translation unit +// that uses the class +/* virtual */ codecvt<wchar_t, char, _RWSTD_MBSTATE_T>:: +~codecvt () +{ + // no-op +} + + /* virtual */ bool codecvt<wchar_t, char, _RWSTD_MBSTATE_T>:: do_always_noconv () const _THROWS (()) @@ -1177,7 +1183,7 @@ do_length (state_type &state, const extern_type *from, const extern_type *from_end, - _RWSTD_SIZE_T imax) const + size_t imax) const { // 22.2.1.5.2, p9 - preconditions _RWSTD_ASSERT (from <= from_end); @@ -1192,14 +1198,14 @@ return 0; // 22.2.1.5.2, p10 - const _RWSTD_SIZE_T len = from_end - from; + const size_t len = from_end - from; return int (len < imax ? len : imax); } // codecvt_byname <wchar,char> specialization codecvt_byname<wchar_t, char, _RWSTD_MBSTATE_T>:: -codecvt_byname (const char *name, _RWSTD_SIZE_T ref) +codecvt_byname (const char *name, size_t ref) : codecvt<wchar_t, char, _RWSTD_MBSTATE_T>(ref) { _C_flags = _RW::__rw_encoding_from_name (name); @@ -1224,14 +1230,14 @@ if (mod) { const char* const mod_nam = mod + 1; - const _RWSTD_SIZE_T mod_len = strlen (mod_nam); + const size_t mod_len = strlen (mod_nam); // search for one of the known modifiers if (mod_len > 2 && !memcmp (mod_nam, "UCS", 3)) { int flags = 0; - for (_RWSTD_SIZE_T i = 0; i != _RW::__rw_n_ucsmods; ++i) { + for (size_t i = 0; i != _RW::__rw_n_ucsmods; ++i) { if (!strcmp (_RW::__rw_ucsmods [i].mod, mod_nam)) { flags = _RW::__rw_ucsmods [i].flags; break; @@ -1259,7 +1265,7 @@ // denoting an external UTF encoding with strict validation rules // but slower processing, and their relaxed but faster equivalents, // utf-8, utf-16, utf-16-be, utf-16-le - const _RWSTD_SIZE_T name_len = strlen (name); + const size_t name_len = strlen (name); if (4 < name_len) { @@ -1308,6 +1314,15 @@ } +// outlined to avoid generating a vtable in each translation unit +// that uses the class +/* virtual */ codecvt_byname<wchar_t, char, _RWSTD_MBSTATE_T>::~ +codecvt_byname () +{ + // no-op +} + + /* virtual */ codecvt_base::result codecvt_byname<wchar_t, char, _RWSTD_MBSTATE_T>:: do_in (state_type& state, @@ -1552,7 +1567,7 @@ do_length (state_type& state, const extern_type *from, const extern_type *from_end, - _RWSTD_SIZE_T cmax) const + size_t cmax) const { // 22.2.1.5.2 p1 _RWSTD_ASSERT (from <= from_end); @@ -1560,7 +1575,7 @@ // verify that the range is valid _RWSTD_ASSERT (from && from_end || !from && !from_end); - _RWSTD_SIZE_T len = 0; + size_t len = 0; // test the type of the encoding that the facet is interpreting switch (ISO2022_TYPE (_C_flags)) { @@ -1696,7 +1711,7 @@ { // returns the max value do_length (s, from, from_end, 1) can return // for any valid range [from, from_end) - see LWG issue 74 (a DR) - _RWSTD_SIZE_T max_len = 0; + size_t max_len = 0; // test the type of the encoding that the facet is interpreting switch (ISO2022_TYPE (_C_flags)) { @@ -1710,14 +1725,14 @@ // use libc locale const _RW::__rw_setlocale clocale (_C_name, LC_CTYPE); - max_len = _RWSTD_STATIC_CAST (_RWSTD_SIZE_T, MB_CUR_MAX); + max_len = size_t (MB_CUR_MAX); } else { // use own implementation if (IS_UTF8 (_C_flags)) max_len = _UTF8_MB_CUR_MAX; else if (impl) - max_len = _RWSTD_STATIC_CAST (_RWSTD_SIZE_T, impl->mb_cur_max); + max_len = size_t (impl->mb_cur_max); } break; }
Modified: stdcxx/trunk/tests/containers/23.deque.modifiers.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/containers/23.deque.modifiers.cpp?rev=681826&r1=681825&r2=681826&view=diff ============================================================================== --- stdcxx/trunk/tests/containers/23.deque.modifiers.cpp (original) +++ stdcxx/trunk/tests/containers/23.deque.modifiers.cpp Fri Aug 1 14:09:45 2008 @@ -190,10 +190,15 @@ _TRY { + // convert an int to size_type to avoid conversion + // warnings when passing it to member functions + // that expect an unsigned argument + const Deque::size_type nelems (n); + switch (mfun) { case Assign_n: _RWSTD_ASSERT (x); - deq.assign (n, *x); + deq.assign (nelems, *x); break; case AssignRange: deq.assign (first, last); @@ -214,7 +219,7 @@ break; case Insert_n: _RWSTD_ASSERT (x); - deq.insert (it, n, *x); + deq.insert (it, nelems, *x); break; case InsertRange: deq.insert (it, first, last); @@ -447,7 +452,10 @@ std::free (funcall); delete[] xins; - delete[] xseq; + + // cast away constness to work around an HP aCC 6.16 bug + // see http://issues.apache.org/jira/browse/STDCXX-802 + delete[] _RWSTD_CONST_CAST (UserClass*, xseq); } /**************************************************************************/ @@ -975,7 +983,10 @@ std::free (funcall); delete[] xasn; - delete[] xseq; + + // cast away constness to work around an HP aCC 6.16 bug + // see http://issues.apache.org/jira/browse/STDCXX-802 + delete[] _RWSTD_CONST_CAST (UserClass*, xseq); } @@ -1177,7 +1188,9 @@ std::free (funcall); - delete[] xseq; + // cast away constness to work around an HP aCC 6.16 bug + // see http://issues.apache.org/jira/browse/STDCXX-802 + delete[] _RWSTD_CONST_CAST (UserClass*, xseq); } void test_erase () Modified: stdcxx/trunk/tests/include/rw_driver.h URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/include/rw_driver.h?rev=681826&r1=681825&r2=681826&view=diff ============================================================================== --- stdcxx/trunk/tests/include/rw_driver.h (original) +++ stdcxx/trunk/tests/include/rw_driver.h Fri Aug 1 14:09:45 2008 @@ -98,7 +98,8 @@ * @param line When positive, denotes the line number of the location * relevant to the diagnostic. Negative values are ignored. * @param fmtspec A printf format specifier (with extensions) used - * to format the text of the diagnostic. + * to format the text of the diagnostic. See rwtest-fmtspec page + * for details. * @param ... Optional list of values to format. * * @return Returns the value of expr passed to it. Modified: stdcxx/trunk/tests/include/rw_file.h URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/include/rw_file.h?rev=681826&r1=681825&r2=681826&view=diff ============================================================================== --- stdcxx/trunk/tests/include/rw_file.h (original) +++ stdcxx/trunk/tests/include/rw_file.h Fri Aug 1 14:09:45 2008 @@ -33,17 +33,17 @@ #include <rw_testdefs.h> // for test config macros -#ifndef _MSC_VER +#ifndef _WIN32 // POSIX special files: // http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap10.html # define DEV_CONSOLE "/dev/console" # define DEV_NULL "/dev/null" # define DEV_TTY "/dev/tty" -#else // if defined (_MSC_VER) +#else // if defined (_WIN32) # define DEV_CONSOLE "CON:" # define DEV_NULL "NUL:" # define DEV_TTY "CON:" -#endif // _MSC_VER +#endif // _WIN32 #if _RWSTD_PATH_SEP == '/' Modified: stdcxx/trunk/tests/include/rw_printf.h URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/include/rw_printf.h?rev=681826&r1=681825&r2=681826&view=diff ============================================================================== --- stdcxx/trunk/tests/include/rw_printf.h (original) +++ stdcxx/trunk/tests/include/rw_printf.h Fri Aug 1 14:09:45 2008 @@ -79,7 +79,7 @@ /** * Prints to a dynamically allocated character buffer. * - * @param fmt Format specifier. + * @param fmt Format specifier. See rwtest-fmtspec page for details. * * @return On success, returns a pointer to the dynamically allocated * character buffer. Otherwise, returns 0. @@ -94,6 +94,7 @@ * @param buf A pointer to character buffer where the function should * store its output. * @param bufise The size of the character buffer in bytes. + * @param fmt Format specifier. See rwtest-fmtspec page for details. * * @return On success, if the size of the supplied buffer was sufficient * to format all characters including the terminating NUL, returns @@ -124,34 +125,7 @@ * to by this argument to the size of the dynamically allocated * character buffer, or leaves it unchanged if it doesn't allocate * any buffer. - * @param fmt Format specifier. - * The format specifier string has the same syntax as C99 sprintf - * (see 7.19.6.1 of ISO/IEC 9899:1999) with the following extensions: - * - * %n$ where n is a integer (see IEEE Std 1003.1) - * %m the value of strerror(errno) - * - * %{?} if clause (extracts an int) - * %{:} else clause - * %{;} end of if/else clause - * - * %{Ac} quoted array of narrow characters - * %{*Ac} quoted array of characters of width '*' each - * where '*' is an int argument extracted from - * the argument list - * %{#s} quoted narrow character string - * %{#ls} quoted wide character string - * %{$envvar} value of an environment variable envvar - * %{f} function pointer - * %{K} signal name (such as "SIGABRT") - * %{M} member pointer - * %{#m} name of the errno constant (such as "EINVAL") - * %{n} buffer size - * %{S} pointer to std::string - * %{lS} pointer to std::wstring - * %{tm} pointer to struct tm - * %{InJ} where n is one of { 8, 16, 32, 64 } - * and J is one of { d, o, x, X } + * @param fmt Format specifier. See rwtest-fmtspec page for details. * * @return On success, returns the number of characters formatted into * the buffer, otherwise -1. @@ -160,4 +134,227 @@ rw_asnprintf (char** pbuf, _RWSTD_SIZE_T *pbufsize, const char *fmt, ...); +/** + * @page rwtest-fmtspec Formated Output Directives and Conversion Specifiers + * + * The RWTest library supports all formatted output directives specified + * by the C99 standard as well as many other directive extensions. Only + * deviations, extensions, and other implmementation-defined behavior are + * described below. Consult your system and/or compiler documentation + * for specifications of the standard formatting output directives. + * + * Unless specified otherwise, the following caveats apply to all + * directives and conversions. Directives that accept a pointer argument + * will convert a null pointer into the string literal <tt>(null)</tt>. + * + * Specifiers within formatting directives are denoted by angle brackets. + * The specifiers are placeholders whose range of possible values are + * listed in the description of the directive. + * + * @section rwtest-fmtspec-c89 C89 Directives + * + * @subsection rwtest-fmtspec-c89-ptr Pointer \%p \%\#p + * + * The argument is a pointer to \c void. The value of the pointer is + * converted to a sequence of hexadecimal digits. The number of + * converted digits depends on the size of the \c void* type. The + * "alternate form" expressed by \c \%\#p immediately precedes converted + * digits with a \c 0x prefix. + * + * + * @section rwtest-fmtspec-c99 C99 Directives + * + * No known deviations or implementation-defined behavior. + * + * + * @section rwtest-fmtspec-ext RWTest Extensions + * + * @subsection rwtest-fmtspec-ext-bool Boolean \%b + * + * The argument is a value convertible to \c bool type. If the value + * of the argument is nonzero, the value is converted to the string + * literal \c true. Otherwise, the value converts to \c false. + * + * @subsection rwtest-fmtspec-ext-funptr Function Pointer \%{f} + * + * The argument is a pointer to a function. The conversion and formatting + * is performed as specified by the \c \%p directive. + * + * @subsection rwtest-fmtspec-ext-memptr Member Pointer \%{M} + * + * The argument is a pointer to a composite member. The conversion and + * formatting is performed as specified by the \c \%p directive. + * + * @subsection rwtest-fmtspec-ext-esc-c Escaped Character \%{c} \%{\#c} + * + * The argument is an integer value converted to <tt>unsigned char</tt> + * type. For non-printable characters, the resulting output is formatted + * as the corresponding escape sequence. (The value for a horizontal + * tab character for example is formatted as the string literal + * <tt>\\t</tt> and a zero value may be formatted as the string literal + * <tt>\\x00</tt>. In the alternate form, the resulting output is + * immediately surrounded with a single quotation mark <tt>'</tt>. + * + * @subsection rwtest-fmtspec-ext-esc-lc Escaped Wide Character \%{lc} \%{\#lc} + * + * Similar to the escaped character directive <tt>%{c}</tt> and quoted + * escaped character directive <tt>%{\#c}</tt> respectively, except + * that the argument is a value of <tt>wchar_t</tt> type. + * + * @subsection rwtest-fmtspec-ext-s Quoted Character String \%{\#s} + * + * Similar to the character string directive <tt>%s</tt> except that the + * resulting output is surrounded with a double quotation mark <tt>"</tt>. + * + * @subsection rwtest-fmtspec-ext-ls Quoted Wide Character String \%{\#ls} + * + * Similar to the quoted character string directive <tt>%{\#s}</tt> + * except that the argument is a pointer to a null-terminate sequence of + * <tt>wchar_t</tt> type. + * + * @subsection rwtest-fmtspec-ext-err Error Code \%m \%{\#m} + * + * The argument is an integer value representing a system-dependent error + * code. In the first form, the value is interpreted as an argument of + * the \c strerror() function. The formatted result is the return value + * of this function using this parameter value. In the second form, the + * formatted result is a character sequence representing the + * corresponding error name (e.g. \c ENOMEM) if applicable or equivalent + * numeric sequence in decimal notation otherwise. + * + * @subsection rwtest-fmtspec-ext-sig Signal \%K + * + * The argument is an integer value representing a system-dependent + * signal. The resulting output is a character sequence representing + * the name of corresponding signal (e.g. \c SIGABRT) if + * applicable or equivalent numeric sequence in decimal notation + * otherwise. + * + * @subsection rwtest-fmtspec-ext-bits Bitset \%{b} + * + * The argument is a pointer to an array of \c char. Each bit in the + * array, ordered from MSB of the first element to LSB of the last + * element is converted into a sequence of '0' or '1' characters. + * + * @subsection rwtest-fmtspec-ext-Ai Integer Array \%{Ac} \%{Ao} \%{Ad} \%{Ax} + * + * The argument is a pointer to an array of integer type. The resulting + * output is formatted as a string of comma-separated integer values. + * The notation of each integer value is specified by <tt>c</tt> for + * characters, <<tt>o</tt> for octal, <tt>d</tt> for decimal, or + * <tt>x</tt> for hexadcimal. An optional field width specifies the + * size of elements in the array (defaults to 1). An optional precision + * specifies the length of the array. In the alternate form, the + * resulting output for octal and hexidecimal integer values are + * prefixed with string literals <tt>0</tt> and <tt>0x</tt> respectively. + * + * @subsection rwtest-fmtspec-ext-I Fixed-Width Integers \%{I<wn>} + * + * The argument is a value of an integer type. The directive requires + * two specifiers: the <tt>w</tt> specifier is one of 8, 16, 32, or 64 + * specifying the width of the integer value. The <tt>n</tt> specifier + * is one of \c d, \c o, \c x, or \c X specifying the notation of the + * resulting output. + * + * @subsection rwtest-fmtspec-ext-Is Stream State \%{Is} \%{\#Is} + * + * The argument is a value of type <tt>std::ios_base::iostate</tt>. In + * the plain form, the resulting ouput is formatted as a sequence of one + * or more unqualified names corresponding to the \c iostate enumerators, + * separated by the OR operator (<tt>|</tt>). In the extended form, the + * resulting output is prefixed with the string literal + * <tt>std::ios_base::</tt> indicating the qualfied namespace. + * + * @subsection rwtest-fmtspec-ext-Io Open Mode \%{Io} \%{\#Io} + * + * Similar to the <tt>%{Is}</tt> directive except the argument is a + * value of the <tt>std::ios_base::openmode</tt> enumeration type and + * names in the resulting output correspond to enumerators of this type. + * + * @subsection rwtest-fmtspec-ext-Iw Seek Direction \%{Iw} \%{\#Iw} + * + * The argument is a value of type <tt>std::ios_base::seekdir</tt>. In + * the plain form, the resulting ouput is formatted as the unqualified + * name corresponding to one of the \c seekdir enumerators. In the + * extended form, the enumerator is qualified with the enclosing + * namespace. + * + * @subsection rwtest-fmtspec-ext-If Format Flag \%{If} \%{\#Iw} + * + * Similar to the <tt>%{Is}</tt> directive except the argument is a + * value of the <tt>std::ios_base::fmtflags</tt> enumeration type and + * names in the resulting output correspond to enumerators of this type. + * + * @subsection rwtest-fmtspec-ext-Lc Locate Category \%{Lc} \%{\#Lc} + * + * The argument is an integer type representing a constant defined by + * the C <tt><locale.h></tt> header (identified by an <tt>LC_</tt> + * prefix) or a <tt>std::locale::category</tt> constant defined by + * the C++ <tt><locale></tt> header. The resulting output is + * formatted as a character string representing the name of the C or C++ + * constant enclosed in square brackets (<tt>[</tt>) and <tt>]</tt>). + * In the alternate form, the formatted output for C++ constants is + * prefixed with the string literal <tt>std::locale::</tt> indicating + * the qualified namespace. + * + * @subsection rwtest-fmtspec-ext-LC Character Classifiers \%{LC} \%{\#LC} + * + * The argument is an integer type representing enumerators of the + * <tt>std::ctype_base::mask</tt> enumeration. The resulting output is + * formatted as a character string representing the name of the + * enumerator enclosed in square brackets (<tt>[</tt>) and <tt>]</tt>). + * In the alternate form, the enumerator is prefixed with the string + * literal <tt>std::ctype_base::</tt> indicating the qualified + * namespace. + * + * @subsection rwtest-fmtspec-ext-pid Process Identifier \%{P} + * + * The argument is a value of the portable \c rw_pid_t type. The + * resulting output is formatted as a numeric sequence of digits + * representing the corresponding process identifier. The \c P + * specifier may be preceded by optional width, justification, and + * precision qualifiers. + * + * @subsection rwtest-fmtspec-ext-str String \%{S} + * + * The argument is a pointer to an object of the \c std::string class. + * Otherwise, the pointer \c P is converted by calling the \c P->c_str() + * function and the result is formatted identical to the <tt>%s</tt> + * character string directive. + * + * @subsection rwtest-fmtspec-ext-wstr Wide String \%{lS} + * + * The argument is a pointer to an object of the \c std::wstring class. + * Conversion and formatting is performed as stated for the \c \%{S} + * directive. + * + * @subsection rwtest-fmtspec-ext-tm Time Structure \%{t} \%{\#t} + * + * The argument is a pointer to a \c tm structure. If the pointer is + * null, the resulting output is the string literal \c (null). In the + * plain form, the resulting output for a valid pointer is formatted + * similar (but not necessarily identical) to the return value of the + * \c asctime() function. If the value of any structure member is + * outside its valid range, the resulting output is formatting using the + * alternate form. In the alternate form, the resulting output is + * formatted as a comma-separated sequence of members enclosed in braces + * where each member is of the format "name=value [range]". The + * "[range]" is only shown if the value is not in the valid range for + * the respective member. + * + * @subsection rwtest-fmtspec-ext-other Other Directives + * + * The following directives are also recognized by RWTest output + * functions but are heretofore undocumented. + * + * <ul> + * <li> \%{<n>} buffer size + * <li> \%{<n>$} positional parameter + * <li> \%{$<s>} environment variable + * <li> \%{?} \%{:} \%{;} conditionals + * <li> [EMAIL PROTECTED] nested format + * <li> \%{!} user-defined format + * </ul> + */ + #endif // RW_PRINTF_H_INCLUDED Modified: stdcxx/trunk/tests/include/rw_streambuf.h URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/include/rw_streambuf.h?rev=681826&r1=681825&r2=681826&view=diff ============================================================================== --- stdcxx/trunk/tests/include/rw_streambuf.h (original) +++ stdcxx/trunk/tests/include/rw_streambuf.h Fri Aug 1 14:09:45 2008 @@ -461,10 +461,14 @@ { MyStreambuf* const self = _RWSTD_CONST_CAST (MyStreambuf*, this); - int inx = memfun_inx (which); - if (-1 == inx) + const int inx = memfun_inx (which); + if (inx < 0) return true; + // assert precondition to silence HP aCC 6/cadvise warning + // #20206-D: Out of bound access + RW_ASSERT ((_RWSTD_SIZE_T)inx < sizeof ncalls_ / sizeof *ncalls_); + // increment the counter tracking the number of calls made // to each member function; do so regardless of whether // an exception will be thrown below Modified: stdcxx/trunk/tests/localization/22.locale.cons.mt.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.cons.mt.cpp?rev=681826&r1=681825&r2=681826&view=diff ============================================================================== --- stdcxx/trunk/tests/localization/22.locale.cons.mt.cpp (original) +++ stdcxx/trunk/tests/localization/22.locale.cons.mt.cpp Fri Aug 1 14:09:45 2008 @@ -126,7 +126,7 @@ // verify that the locales were created correctly if ( std::locale::none == cat -#ifdef _MSC_VER +#if defined (_MSC_VER) || defined (__MINGW32__) || std::locale::messages == cat #endif || first == next) { @@ -141,7 +141,7 @@ const std::locale combined_2 (first, next, cat); if ( std::locale::none == cat -#ifdef _MSC_VER +#if defined (_MSC_VER) || defined (__MINGW32__) || std::locale::messages == cat #endif || first == next) { Modified: stdcxx/trunk/tests/localization/22.locale.time.put.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.time.put.cpp?rev=681826&r1=681825&r2=681826&view=diff ============================================================================== --- stdcxx/trunk/tests/localization/22.locale.time.put.cpp (original) +++ stdcxx/trunk/tests/localization/22.locale.time.put.cpp Fri Aug 1 14:09:45 2008 @@ -142,7 +142,7 @@ if (!tmb) tmb = &tmp; -#ifdef _MSC_VER +#if defined (_MSC_VER) || defined (__MINGW32__) // ms crt aborts if you use out of range values in debug if (tmb->tm_hour < 0 || 24 <= tmb->tm_hour) @@ -281,11 +281,11 @@ const std::size_t n = std::strftime (buf, bufsize, patbuf, tmb); -#else // if !defined (_MSC_VER) +#else // !_MSC_VER && !__MINGW32__ const std::size_t n = std::strftime (buf, bufsize, pat, tmb); -#endif // _MSC_VER +#endif // _MSC_VER || __MINGW32__ RW_ASSERT (n < bufsize); @@ -298,11 +298,12 @@ { static const std::tm tmp = std::tm (); -#if !defined (_RWSTD_NO_WCSFTIME_WCHAR_T_FMAT) && !defined (_MSC_VER) +#if !defined (_RWSTD_NO_WCSFTIME_WCHAR_T_FMAT) \ + && !defined (_MSC_VER) && !defined (__MINGW32__) std::size_t n = std::wcsftime (wbuf, bufsize, wpat, tmb ? tmb : &tmp); -#else // if defined (_RWSTD_NO_WCSFTIME) || defined (_MSC_VER) +#else // _RWSTD_NO_WCSFTIME || _MSC_VER || __MINGW32__ char pat [1024]; char buf [1024]; @@ -311,7 +312,7 @@ std::size_t n = rw_strftime (buf, bufsize, pat, tmb ? tmb : &tmp); widen (wbuf, buf); -#endif // _RWSTD_NO_WCSFTIME, _MSC_VER +#endif // _RWSTD_NO_WCSFTIME, _MSC_VER, __MINGW32__ RW_ASSERT (n < bufsize); Modified: stdcxx/trunk/tests/src/printf.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/printf.cpp?rev=681826&r1=681825&r2=681826&view=diff ============================================================================== --- stdcxx/trunk/tests/src/printf.cpp (original) +++ stdcxx/trunk/tests/src/printf.cpp Fri Aug 1 14:09:45 2008 @@ -1490,7 +1490,7 @@ RW_ASSERT (size_t (len) < sizeof buffer); -#ifdef _MSC_VER +#if defined (_MSC_VER) || defined (__MINGW32__) if (5 < len) { // remove redundant zeros from the exponent (if present) @@ -1502,7 +1502,7 @@ } } -#endif // _MSC_VER +#endif // _MSC_VER || __MINGW32__ if (-1 < len && 0 == _rw_bufcat (buf, buffer, size_t (len))) Modified: stdcxx/trunk/tests/strings/21.string.erase.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/strings/21.string.erase.cpp?rev=681826&r1=681825&r2=681826&view=diff ============================================================================== --- stdcxx/trunk/tests/strings/21.string.erase.cpp (original) +++ stdcxx/trunk/tests/strings/21.string.erase.cpp Fri Aug 1 14:09:45 2008 @@ -363,6 +363,8 @@ // pointer to the returned reference const String* ret_ptr = 0; + typedef typename String::size_type size_type; + try { switch (func.which_) { @@ -371,11 +373,12 @@ break; case Erase (size): - ret_ptr = &str.erase (tcase.off); + ret_ptr = &str.erase (size_type (tcase.off)); break; case Erase (size_size): - ret_ptr = &str.erase (tcase.off, tcase.size); + ret_ptr = &str.erase (size_type (tcase.off), + size_type (tcase.size)); break; case Erase (iter): Modified: stdcxx/trunk/tests/utilities/20.operators.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.operators.cpp?rev=681826&r1=681825&r2=681826&view=diff ============================================================================== --- stdcxx/trunk/tests/utilities/20.operators.cpp (original) +++ stdcxx/trunk/tests/utilities/20.operators.cpp Fri Aug 1 14:09:45 2008 @@ -397,9 +397,11 @@ typedef RandomAccessIterator I; - typedef typename std::iterator_traits<I>::difference_type DiffT; - - RandomNumberGenerator<DiffT> rndgen; +#if !defined _RWSTD_NO_DEBUG_ITER + RandomNumberGenerator<typename I::difference_type> rndgen; +#else + RandomNumberGenerator<T> rndgen; +#endif std::random_shuffle (I (), I ()); std::random_shuffle (I (), I (), rndgen); Modified: stdcxx/trunk/util/gencat.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/util/gencat.cpp?rev=681826&r1=681825&r2=681826&view=diff ============================================================================== --- stdcxx/trunk/util/gencat.cpp (original) +++ stdcxx/trunk/util/gencat.cpp Fri Aug 1 14:09:45 2008 @@ -151,7 +151,7 @@ cmd += rc_name; cmd += " -o "; cmd += res_name; - cmd += " && gcc -shared -o "; + cmd += " && gcc -shared -mno-cygwin -o "; cmd += dll_name; cmd += ' '; cmd += res_name;