[EMAIL PROTECTED] wrote:
Author: elemings
Date: Thu May 22 13:54:39 2008
New Revision: 659253

URL: http://svn.apache.org/viewvc?rev=659253&view=rev
Log:
2008-05-22  Eric Lemings <[EMAIL PROTECTED]>

        STDCXX-550
[...]
        * tests/localization/22.locale.num.get.cpp (test_errno)
        [TEST_ERRNO]: Fourth from last parameter type in do_test()
        function is an `int'.  Cast `size_t' result of sizeof operator.
          (test_long): Cast `size_t' result from sizeof operator to
        `int' type of local `NC' variable.  Define INTSIZE() macro to
        cast `size_t' result from sizeof operator to `int' type in test
        cases.  (This parameter defaults to negative value or its type
        would be changed to `size_t' type.)
          (test_pvoid) [PVOIDSTR], (test_ldbl): Use INSTIZE() macro.

This change doubles the number of assertion failures in the
test on HP-UX/PA.


[...]
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=659253&r1=659252&r2=659253&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 Thu May 22 
13:54:39 2008
@@ -528,7 +528,7 @@
     for (i = 0; i != sizeof errnos / sizeof *errnos; ++i) {          \
         errno = errnos [i];                                          \
         TEST (T, numT (val), _RWSTD_STR (val),                       \
-              sizeof (_RWSTD_STR (val)) -1, 0, Eof);                 \
+              int (sizeof (_RWSTD_STR (val))) -1, 0, Eof);           \

I wonder if it would be cleaner and less intrusive to change
do_test() to take a size_t argument instead. I realize the
argument is allowed to be negative (-1) so we would need to
weigh the impact of this change against the casts, but if
there are more casts than the number of calls with a negative
argument the size_t change should be better.

         rw_assert (errnos [i] == errno, 0, __LINE__,                 \
                    "%d. errno unexpectedly changed from %d to %d",   \
                     i, errnos [i], errno);                           \
@@ -1174,7 +1174,7 @@
             "1"
         };
- static const std::size_t NC = sizeof many_groups - 1;
+        static const int NC = int (sizeof many_groups - 1);
const int nfail = TEST (T, 1L, many_groups + i, NC - i, dec, Eof, "\1"); @@ -1322,18 +1322,20 @@
     const char vflow_1[]      = "999999999999999999990";
 #endif
- TEST (T, LONG_MIN, lmin, sizeof lmin - 1, 0, Eof);
-    TEST (T, LONG_MIN, lmin_minus_1, sizeof lmin_minus_1 - 1, 0, Eof | Fail);
-    TEST (T, LONG_MIN, lmin_minus_2, sizeof lmin_minus_2 - 1, 0, Eof | Fail);
-    TEST (T, LONG_MIN, lmin_minus_3, sizeof lmin_minus_3 - 1, 0, Eof | Fail);
-
-    TEST (T, LONG_MAX, lmax,         sizeof lmax - 1,         0, Eof);
-    TEST (T, LONG_MAX, lmax_plus_1,  sizeof lmax_plus_1 - 1,  0, Eof | Fail);
-    TEST (T, LONG_MAX, lmax_plus_2,  sizeof lmax_plus_2 - 1,  0, Eof | Fail);
-    TEST (T, LONG_MAX, lmax_plus_3,  sizeof lmax_plus_3 - 1,  0, Eof | Fail);
-    TEST (T, LONG_MAX, lmax_x_f,     sizeof lmax_x_f - 1,     0, Eof | Fail);
+#define INTSIZE(x) _RWSTD_STATIC_CAST(int, sizeof (x))
- TEST (T, LONG_MAX, vflow_1, sizeof vflow_1 - 1, 0, Eof | Fail);
+    TEST (T, LONG_MIN, lmin,         INTSIZE (lmin - 1),         0, Eof);
+    TEST (T, LONG_MIN, lmin_minus_1, INTSIZE (lmin_minus_1 - 1), 0, Eof | 
Fail);

I'm guessing this is the bug that's causing the new assertions,
because:

    sizeof (x - 1) != sizeof x - 1

Martin

Reply via email to