Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 78846 invoked from network); 7 May 2008 03:30:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 May 2008 03:30:20 -0000 Received: (qmail 9760 invoked by uid 500); 7 May 2008 03:30:22 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 9744 invoked by uid 500); 7 May 2008 03:30:22 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 9731 invoked by uid 99); 7 May 2008 03:30:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 May 2008 20:30:22 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of msebor@gmail.com designates 209.85.198.225 as permitted sender) Received: from [209.85.198.225] (HELO rv-out-0506.google.com) (209.85.198.225) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 May 2008 03:29:36 +0000 Received: by rv-out-0506.google.com with SMTP id g37so135308rvb.23 for ; Tue, 06 May 2008 20:29:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=5B4m7iVhuandXYdOIWQYp5zZyKEZckdyA15fnXUcfGA=; b=hc4G/bcJpBQyJiKQCcBCWhYLpu5dFaClKtnZiGKz8ZyQrivd9uvgl2v1Q9cYdpy27cbBIq4f5TKnz7mZfcyVMcHo8wcRhyTTQLAW8GXGjEiOw/NXNkvy+zyO1T/PemW7DVXyjHkBlq8pmzmn+kFoc15yqJhJzIuqi6JnU/+S5dc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=dsLEFOJ2n9UroY/r49gbXipZjnXGbXMhZgzV6CRc7KtZJZLqj/stROymbFb8Q3Q1YPNWfO26ermUCirqMZqsFrxOL09MgDTgnSlhaCidf+D1E1sXicfO/bGoHHHhbkAVohkA1viwB5CyIqIAIDtNAHvtdD/fyke9/YTfS89sH3g= Received: by 10.114.88.1 with SMTP id l1mr1429645wab.126.1210130989302; Tue, 06 May 2008 20:29:49 -0700 (PDT) Received: from localhost.localdomain ( [71.229.200.170]) by mx.google.com with ESMTPS id q18sm2943815pog.2.2008.05.06.20.29.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 06 May 2008 20:29:49 -0700 (PDT) Message-ID: <4821222B.2070205@roguewave.com> Date: Tue, 06 May 2008 21:29:47 -0600 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: svn commit: r653965 - /stdcxx/branches/4.2.x/tests/localization/22.locale.num.get.cpp References: <20080507015432.303B52388A06@eris.apache.org> In-Reply-To: <20080507015432.303B52388A06@eris.apache.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: Martin Sebor X-Virus-Checked: Checked by ClamAV on apache.org vitek@apache.org wrote: > Author: vitek > Date: Tue May 6 18:54:31 2008 > New Revision: 653965 > > URL: http://svn.apache.org/viewvc?rev=653965&view=rev > Log: > 2008-05-06 Travis Vitek > > * tests/localization/22.locale.num.get.cpp: Revert r657262 > and apply a simpler fix. I think you might have reverted more than what you intended. We probably want to keep this: http://svn.apache.org/viewvc?view=rev&revision=644435. Martin > (test_flt_uflow): Make val static to avoid cadvise warning. > (test_dbl_uflow): Ditto. > (test_ldbl_uflow): Ditto. > > > Modified: > stdcxx/branches/4.2.x/tests/localization/22.locale.num.get.cpp > > 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=653965&r1=653964&r2=653965&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 Tue May 6 18:54:31 2008 > @@ -56,7 +56,6 @@ > > /**************************************************************************/ > > -#include // for std::size_t, std::ptrdiff_t > #include // FLT_MAX, FLT_MIN, etc. > #include // INT_MAX, INT_MIN, etc. > #include // for localeconv(), setlocale() > @@ -222,7 +221,7 @@ > _RWSTD_CONST_CAST (charT*, gend)); > } > > - std::ptrdiff_t gptr_off () const { > + int gptr_off () const { > return this->gptr () - this->eback (); > } > }; > @@ -235,6 +234,13 @@ > > /**************************************************************************/ > > +// 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 }; > > @@ -244,7 +250,6 @@ > 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 > @@ -315,7 +320,7 @@ > > const charT *plast = pnext + std::char_traits::length (pnext); > > - std::ptrdiff_t consumed; > + int consumed; > > switch (itype) { > case iter_pointer: { > @@ -438,7 +443,6 @@ > 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 > @@ -449,15 +453,15 @@ > switch (ctype) { > case narrow_char: > return do_test (lineno, (char*)0, cname, itype, iname, > - pmax, val, str, eat_expect, flags, err_expect, grouping); > + val, str, eat_expect, flags, err_expect, grouping); > case wide_char: > return do_test (lineno, (wchar_t*)0, cname, itype, iname, > - pmax, val, str, eat_expect, flags, err_expect, grouping); > + val, str, eat_expect, flags, err_expect, grouping); > case user_char: > break; > #if 0 // disabled > return do_test (lineno, (UserChar*)0, cname, itype, iname, > - pmax, val, str, eat_expect, flags, err_expect, grouping); > + val, str, eat_expect, flags, err_expect, grouping); > #endif // disabled > } > > @@ -497,8 +501,7 @@ > /*************************************************************************/ > > #define TEST do_test > -#define T __LINE__, ctype, cname, itype, iname, 0 > -#define T_MAX __LINE__, ctype, cname, itype, iname, &val > +#define T __LINE__, ctype, cname, itype, iname > > > template > @@ -2099,16 +2102,15 @@ > TEST (T, PVoid (0x0000ffff), "FfFf", 4, 0, Eof); > > // exercise overflow conditions > -#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 > +#if 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"; > @@ -2194,7 +2196,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, int (std::strlen (#x)) > +#define VALSTR(x) floatT (x), #x, std::strlen (#x) > > // exercise various forms of floating point 0 > > @@ -2441,7 +2443,8 @@ > cname, iname); > > // exercise bahvior on underflow > - float val = 0; > + static 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] > @@ -2452,34 +2455,35 @@ > // normalized positive number in the return type; whether > // errno acquires the value ERANGE is implementation-defined. > > - TEST (T_MAX, (val = FLT_MIN, 0.0f), "1.111111e-9999", 14, 0, Eof); > + TEST (T, (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_MAX, (val = 0.0f, -FLT_MIN), "-1.111111e-9999", 15, 0, Eof); > + TEST (T, (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_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); > + 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); > } > > if (1.234567e-49 < FLT_MIN) { > - 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); > + 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); > } > > if (1.234567e-99 < FLT_MIN) { > - 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); > + 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); > } > > // exercise facet's behavior on underflow: > // parsing succeeds (fail is clear), +/-min is stored > - 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); > + TEST (T, FLT_MIN, _RWSTD_STRSTR ( _RWSTD_DBL_MIN), -1, 0, Eof); > + TEST (T, -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", > @@ -2610,7 +2614,8 @@ > cname, iname); > > // exercise bahvior on underflow > - double val = DBL_MIN; > + static 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] > @@ -2621,24 +2626,25 @@ > // normalized positive number in the return type; whether > // errno acquires the value ERANGE is implementation-defined. > > - 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); > + 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); > > if (1.23456789e-309L < DBL_MIN) { > - 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); > + 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); > } > > if (1.234567e-409L < DBL_MIN) { > - 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); > + 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); > } > > if (1.234567e-999L < DBL_MIN) { > - 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); > + 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); > } > > + pmax = 0; // reset before next test > > > # ifdef _RWSTD_LDBL_MAX > @@ -2731,7 +2737,8 @@ > cname, iname); > > // exercise bahvior on underflow > - long double val = LDBL_MIN; > + static 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] > @@ -2742,22 +2749,23 @@ > // normalized positive number in the return type; whether > // errno acquires the value ERANGE is implementation-defined. > > - 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); > + 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); > > const char fmt[] = "%Lg"; > > long double ld = 0.0; > if (1 == std::sscanf ("3.456789e-4932", fmt, &ld) && ld < LDBL_MIN) { > - 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); > + 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); > } > > if (1 == std::sscanf ("3.456789e-9999", fmt, &ld) && ld < LDBL_MIN) { > - 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); > + 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); > } > > + pmax = 0; // reset before next test > > > # ifdef _RWSTD_LDBL_MAX > >