You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by vi...@apache.org on 2008/07/31 00:55:44 UTC

svn commit: r681237 [2/2] - in /stdcxx/branches/4.3.x: ./ etc/config/ examples/manual/ include/ include/ansi/ include/loc/ include/rw/ src/ tests/containers/ tests/include/ tests/localization/ tests/regress/ tests/src/ tests/strings/ tests/utilities/ u...

Modified: stdcxx/branches/4.3.x/tests/include/rw_printf.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/include/rw_printf.h?rev=681237&r1=681236&r2=681237&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/include/rw_printf.h (original)
+++ stdcxx/branches/4.3.x/tests/include/rw_printf.h Wed Jul 30 15:55:43 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.
@@ -173,6 +147,9 @@
  * 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
  *
@@ -198,6 +175,16 @@
  * 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>
@@ -245,19 +232,29 @@
  *
  * @subsection rwtest-fmtspec-ext-bits Bitset \%{b}
  *
- * The argument is a pointer to an array of \c char.  NOT YET COMPLETE
+ * 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 \%{Ao} \%{Ad} \%{Ax}
+ * @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>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.
+ * 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}
  *
@@ -321,10 +318,15 @@
  * @subsection rwtest-fmtspec-ext-str String \%{S}
  *
  * The argument is a pointer to an object of the \c std::string class.
- * If the pointer is null, the resulting output is the string literal
- * <tt>(null)</tt>.  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.
+ * 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}
  *
@@ -340,6 +342,19 @@
  * "[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> \%{@} nested format
+ * <li> \%{!} user-defined format
+ * </ul>
  */
 
 #endif   // RW_PRINTF_H_INCLUDED

Modified: stdcxx/branches/4.3.x/tests/include/rw_streambuf.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/include/rw_streambuf.h?rev=681237&r1=681236&r2=681237&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/include/rw_streambuf.h (original)
+++ stdcxx/branches/4.3.x/tests/include/rw_streambuf.h Wed Jul 30 15:55:43 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/branches/4.3.x/tests/localization/22.locale.cons.mt.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/localization/22.locale.cons.mt.cpp?rev=681237&r1=681236&r2=681237&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/localization/22.locale.cons.mt.cpp (original)
+++ stdcxx/branches/4.3.x/tests/localization/22.locale.cons.mt.cpp Wed Jul 30 15:55:43 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/branches/4.3.x/tests/localization/22.locale.time.put.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/localization/22.locale.time.put.cpp?rev=681237&r1=681236&r2=681237&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/localization/22.locale.time.put.cpp (original)
+++ stdcxx/branches/4.3.x/tests/localization/22.locale.time.put.cpp Wed Jul 30 15:55:43 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);
 

Copied: stdcxx/branches/4.3.x/tests/regress/18.c.limits.stdcxx-988.cpp (from r674550, stdcxx/branches/4.2.x/tests/regress/18.c.limits.stdcxx-988.cpp)
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/regress/18.c.limits.stdcxx-988.cpp?p2=stdcxx/branches/4.3.x/tests/regress/18.c.limits.stdcxx-988.cpp&p1=stdcxx/branches/4.2.x/tests/regress/18.c.limits.stdcxx-988.cpp&r1=674550&r2=681237&rev=681237&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/regress/18.c.limits.stdcxx-988.cpp (original)
+++ stdcxx/branches/4.3.x/tests/regress/18.c.limits.stdcxx-988.cpp Wed Jul 30 15:55:43 2008
@@ -29,6 +29,7 @@
 #include <cassert>
 #include <limits.h>
 
+
 int main ()
 {
 #if    (defined __unix__ || defined __unix || defined unix) \
@@ -73,37 +74,41 @@
     // shall provide values at least this large. A strictly conforming
     // application must not require a larger value for correct operation.
 
-    assert (_POSIX_ARG_MAX        ==  4096);
-    assert (_POSIX_CHILD_MAX      ==    25);
-    assert (_POSIX_HOST_NAME_MAX  ==   255);
-    assert (_POSIX_LINK_MAX       ==     8);
-    assert (_POSIX_LOGIN_NAME_MAX ==     9);
-    assert (_POSIX_MAX_CANON      ==   255);
-    assert (_POSIX_MAX_INPUT      ==   255);
-    assert (_POSIX_NAME_MAX       ==    14);
-    assert (_POSIX_NGROUPS_MAX    ==     8);
-    assert (_POSIX_OPEN_MAX       ==    20);
-    assert (_POSIX_PATH_MAX       ==   256);
-    assert (_POSIX_PIPE_BUF       ==   512);
-    assert (_POSIX_RE_DUP_MAX     ==   255);
-    assert (_POSIX_SSIZE_MAX      == 32767);
-    assert (_POSIX_STREAM_MAX     ==     8);
-    assert (_POSIX_SYMLINK_MAX    ==   255);
-    assert (_POSIX_SYMLOOP_MAX    ==     8);
-    assert (_POSIX_TTY_NAME_MAX   ==     9);
-    assert (_POSIX_TZNAME_MAX     ==     6);
+    // avoid testing specific values since they're not important here
+    // all we care is that the macros be defined (i.e., that thet are
+    // not somehow hidden or #undef'd by our implementation)
+
+    assert (_POSIX_ARG_MAX        != 0 /* ==  4096 */);
+    assert (_POSIX_CHILD_MAX      != 0 /* ==    25 */);
+    assert (_POSIX_HOST_NAME_MAX  != 0 /* ==   255 */);
+    assert (_POSIX_LINK_MAX       != 0 /* ==     8 */);
+    assert (_POSIX_LOGIN_NAME_MAX != 0 /* ==     9 */);
+    assert (_POSIX_MAX_CANON      != 0 /* ==   255 */);
+    assert (_POSIX_MAX_INPUT      != 0 /* ==   255 */);
+    assert (_POSIX_NAME_MAX       != 0 /* ==    14 */);
+    assert (_POSIX_NGROUPS_MAX    != 0 /* ==     8 */);
+    assert (_POSIX_OPEN_MAX       != 0 /* ==    20 */);
+    assert (_POSIX_PATH_MAX       != 0 /* ==   256 */);
+    assert (_POSIX_PIPE_BUF       != 0 /* ==   512 */);
+    assert (_POSIX_RE_DUP_MAX     != 0 /* ==   255 */);
+    assert (_POSIX_SSIZE_MAX      != 0 /* == 32767 */);
+    assert (_POSIX_STREAM_MAX     != 0 /* ==     8 */);
+    assert (_POSIX_SYMLINK_MAX    != 0 /* ==   255 */);
+    assert (_POSIX_SYMLOOP_MAX    != 0 /* ==     8 */);
+    assert (_POSIX_TTY_NAME_MAX   != 0 /* ==     9 */);
+    assert (_POSIX_TZNAME_MAX     != 0 /* ==     6 */);
 
 #  ifdef _POSIX2_VERSION
 
-    assert (_POSIX2_BC_BASE_MAX        ==   99);
-    assert (_POSIX2_BC_DIM_MAX         == 2048);
-    assert (_POSIX2_BC_SCALE_MAX       ==   99);
-    assert (_POSIX2_BC_STRING_MAX      == 1000);
-    assert (_POSIX2_CHARCLASS_NAME_MAX ==   14);
-    assert (_POSIX2_COLL_WEIGHTS_MAX   ==    2);
-    assert (_POSIX2_EXPR_NEST_MAX      ==   32);
-    assert (_POSIX2_LINE_MAX           == 2048);
-    assert (_POSIX2_RE_DUP_MAX         ==  255);
+    assert (_POSIX2_BC_BASE_MAX        != 0 /* ==   99 */);
+    assert (_POSIX2_BC_DIM_MAX         != 0 /* == 2048 */);
+    assert (_POSIX2_BC_SCALE_MAX       != 0 /* ==   99 */);
+    assert (_POSIX2_BC_STRING_MAX      != 0 /* == 1000 */);
+    assert (_POSIX2_CHARCLASS_NAME_MAX != 0 /* ==   14 */);
+    assert (_POSIX2_COLL_WEIGHTS_MAX   != 0 /* ==    2 */);
+    assert (_POSIX2_EXPR_NEST_MAX      != 0 /* ==   32 */);
+    assert (_POSIX2_LINE_MAX           != 0 /* == 2048 */);
+    assert (_POSIX2_RE_DUP_MAX         != 0 /* ==  255 */);
 
 #  endif   // _POSIX2_VERSION
 
@@ -153,10 +158,17 @@
 
 #ifndef _RWSTD_NO_LONG_LONG
 
+#  if !defined __HP_aCC || 199901L <= __STDC_VERSION__
+
+    // HP aCC defines LLONG_MAX and LLONG_MIN only in C99 mode
+    // i.e., with -AC99
+
     assert (LLONG_MIN  != 0);
     assert (LLONG_MAX  >= +9223372036854775807LL);
     assert (ULLONG_MAX >= 18446744073709551615ULL);
 
+#  endif
+
 #endif   // _RWSTD_NO_LONG_LONG
 
     return 0;

Modified: stdcxx/branches/4.3.x/tests/src/printf.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/src/printf.cpp?rev=681237&r1=681236&r2=681237&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/src/printf.cpp (original)
+++ stdcxx/branches/4.3.x/tests/src/printf.cpp Wed Jul 30 15:55:43 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/branches/4.3.x/tests/strings/21.string.erase.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/strings/21.string.erase.cpp?rev=681237&r1=681236&r2=681237&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/strings/21.string.erase.cpp (original)
+++ stdcxx/branches/4.3.x/tests/strings/21.string.erase.cpp Wed Jul 30 15:55:43 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/branches/4.3.x/tests/utilities/20.meta.rel.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.meta.rel.cpp?rev=681237&r1=681236&r2=681237&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.meta.rel.cpp (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.meta.rel.cpp Wed Jul 30 15:55:43 2008
@@ -392,7 +392,7 @@
 
     TEST (std::is_convertible, int*, void*, true);
 
-#ifdef _MSC_VER
+#if defined (_MSC_VER) || defined (__IBMCPP__)
     // microsoft language extension allows this conversion, and that
     // extension is enabled by default.
     TEST (std::is_convertible, int (*)(), void*, true);

Modified: stdcxx/branches/4.3.x/tests/utilities/20.operators.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.operators.cpp?rev=681237&r1=681236&r2=681237&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.operators.cpp (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.operators.cpp Wed Jul 30 15:55:43 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/branches/4.3.x/util/gencat.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/util/gencat.cpp?rev=681237&r1=681236&r2=681237&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/util/gencat.cpp (original)
+++ stdcxx/branches/4.3.x/util/gencat.cpp Wed Jul 30 15:55:43 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;