stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: svn commit: r658487 - /stdcxx/branches/4.2.x/tests/numerics/26.c.math.cpp
Date Thu, 22 May 2008 16:07:25 GMT
elemings@apache.org wrote:
> Author: elemings
> Date: Tue May 20 16:17:54 2008
> New Revision: 658487
> 
> URL: http://svn.apache.org/viewvc?rev=658487&view=rev
> Log:
> 2008-05-20  Eric Lemings <eric.lemings@roguewave.com>
> 
> 	STDCXX-550
> 	* tests/numerics/26.c.math.cpp (test_behavior): Define SIZE(x)
> 	macro to convert (sufficiently small) size_t values to unsigned
> 	values without conversion warnings.  Replace sizeof operator
> 	with SIZE macro.  (Also replaced null pointer with __FILE__
> 	argument in rw_assert calls.)

Wouldn't changing check_bits() to take size_t as the second
argument be a simpler/cleaner fix?

Martin

> 
> 
> Modified:
>     stdcxx/branches/4.2.x/tests/numerics/26.c.math.cpp
> 
> Modified: stdcxx/branches/4.2.x/tests/numerics/26.c.math.cpp
> URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/numerics/26.c.math.cpp?rev=658487&r1=658486&r2=658487&view=diff
> ==============================================================================
> --- stdcxx/branches/4.2.x/tests/numerics/26.c.math.cpp (original)
> +++ stdcxx/branches/4.2.x/tests/numerics/26.c.math.cpp Tue May 20 16:17:54 2008
> @@ -160,6 +160,9 @@
>          char buf [sizeof (long double) * 2];
>      } u;
>  
> +#undef SIZE
> +#define SIZE(x) _RWSTD_STATIC_CAST(unsigned, sizeof x)
> +
>  #if !defined (__SUNPRO_CC) || __SUNPRO_CC > 0x530
>  
>      // make sure functions do not overflow buffer
> @@ -168,8 +171,8 @@
>      const float f = std::modf (3.141592f, &u.f);
>  
>      rw_assert (   3000 == int (u.f * 1000) && 141592 == int (f * 1000000)
> -               && check_bits (u.buf + sizeof u.f, sizeof u - sizeof u.f),
> -               0, __LINE__, "float std::modf (float)");
> +               && check_bits (u.buf + SIZE (u.f), SIZE (u) - SIZE (u.f)),
> +               __FILE__, __LINE__, "float std::modf (float)");
>  
>  #endif   // SunPro > 5.3
>  
> @@ -177,8 +180,8 @@
>      const double d = std::modf (3.1415926, &u.d);
>  
>      rw_assert (   3000 == int (u.d * 1000) && 1415926 == int (d * 10000000)
> -               && check_bits (u.buf + sizeof u.d, sizeof u - sizeof u.d),
> -               0, __LINE__, "double std::modf (double)");
> +               && check_bits (u.buf + SIZE (u.d), SIZE (u) - SIZE (u.d)),
> +               __FILE__, __LINE__, "double std::modf (double)");
>  
>  #ifndef _RWSTD_NO_LONG_DOUBLE
>  
> @@ -188,13 +191,14 @@
>      const long double l = std::modf (3.1415926L, &u.l);
>  
>      rw_assert (   3000 == int (u.l * 1000) && 1415926 == int (l * 10000000)
> -               && check_bits (u.buf + sizeof u.l, sizeof u - sizeof u.l),
> -               0, __LINE__, "long double std::modf (long double)");
> +               && check_bits (u.buf + SIZE (u.l), SIZE (u) - SIZE (u.l)),
> +               __FILE__, __LINE__, "long double std::modf (long double)");
>  
>  #  endif   // SunPro > 5.3
>  
>  #endif   // _RWSTD_NO_LONG_DOUBLE
>  
> +#undef SIZE
>  
>      // check overloads of std::pow()
>      for (int i = -10; i != 10; ++i) {
> 
> 


Mime
View raw message