stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: [PATCH] __rw_dbl_infinity ABI change with MSVC
Date Thu, 18 Oct 2007 14:43:14 GMT
Thanks!

Farid, does this patch look okay to you?

Travis, please double-check the patch for missing whitespace
and post a ChangeLog entry. Unless there are objections from
Farid or anyone else, I'll go ahead and commit it as soon as
I get it.

Martin

Travis Vitek wrote:
> This patch attempts to fix the binary incompatibility of
> __rw_dbl_infinity when compiled with MSVC on Windows, introduced while
> fixing STDCXX-509 (MSVC mangles the access specifier into the names of
> class members):
> 
>    https://issues.apache.org/jira/browse/STDCXX-509
> 
> As with Martin's patch, I've opted to just enable the workaround when
> _MSC_VER is defined.
> 
> Travis
> 
> 
> 
> 
> Index: include/limits
> ===================================================================
> --- include/limits	(revision 585687)
> +++ include/limits	(working copy)
> @@ -88,7 +88,9 @@
>  
>  _RWSTD_NAMESPACE (__rw) {
>  
> +#ifndef _MSC_VER
>  extern "C" {
> +#endif // _MSC_VER
>  
>  _RWSTD_EXPORT extern const float       __rw_flt_infinity;
>  _RWSTD_EXPORT extern const double      __rw_dbl_infinity;
> @@ -111,7 +113,9 @@
>  
>  #endif   // _RWSTD_NO_LONG_DOUBLE
>  
> +#ifndef _MSC_VER
>  }   // extern "C"
> +#endif // _MSC_VER
>  
>  }   // namespace __rw
>  
> Index: src/limits_bits.cpp
> ===================================================================
> --- src/limits_bits.cpp	(revision 585687)
> +++ src/limits_bits.cpp	(working copy)
> @@ -69,43 +69,50 @@
>  
>  #  endif   // _RWSTD_NO_LONG_DOUBLE
>  
> +#ifndef _MSC_VER
>  extern "C" {
> +#endif // _MSC_VER
>  
>  // The constants below are declared in <limits> but with a different
>  // type. C linkage is used to defeat MSVC and other "clever" compilers
>  // that mangle the type of objects into their names.
>  
> +#ifdef _MSC_VER
> +#  define _RWSTD_BITS_NAME(b) _RWSTD_PASTE(b,_bits)
> +#else
> +#  define _RWSTD_BITS_NAME(b) b
> +#endif // _MSC_VER
> +
>  // infinity computed at config time
>  _RWSTD_EXPORT extern const _DblBits
> -__rw_dbl_infinity = { _RWSTD_DBL_INF_BITS };
> +_RWSTD_BITS_NAME(__rw_dbl_infinity) = { _RWSTD_DBL_INF_BITS };
>  
>  
>  _RWSTD_EXPORT extern const _FltBits
> -__rw_flt_infinity = { _RWSTD_FLT_INF_BITS };
> +_RWSTD_BITS_NAME(__rw_flt_infinity) = { _RWSTD_FLT_INF_BITS };
>  
>  
>  #  ifndef _RWSTD_NO_LONG_DOUBLE
>  
>  _RWSTD_EXPORT extern const _LDblBits
> -__rw_ldbl_infinity = { _RWSTD_LDBL_INF_BITS };
> +_RWSTD_BITS_NAME(__rw_ldbl_infinity) = { _RWSTD_LDBL_INF_BITS };
>  
> -
>  #  endif   // _RWSTD_NO_LONG_DOUBLE
>  
>  
>  // quiet NaN computed at config time
>  _RWSTD_EXPORT extern const _DblBits
> -__rw_dbl_qNaN = { _RWSTD_DBL_QNAN_BITS };
> +_RWSTD_BITS_NAME(__rw_dbl_qNaN) = { _RWSTD_DBL_QNAN_BITS };
>  
>  
>  _RWSTD_EXPORT extern const _FltBits
> -__rw_flt_qNaN = { _RWSTD_FLT_QNAN_BITS };
> +_RWSTD_BITS_NAME(__rw_flt_qNaN) = { _RWSTD_FLT_QNAN_BITS };
>  
>  
>  #  ifndef _RWSTD_NO_LONG_DOUBLE
>  
>  _RWSTD_EXPORT extern const _LDblBits
> -__rw_ldbl_qNaN = { _RWSTD_LDBL_QNAN_BITS };
> +_RWSTD_BITS_NAME(__rw_ldbl_qNaN) = { _RWSTD_LDBL_QNAN_BITS };
>  
>  
>  #  endif   // _RWSTD_NO_LONG_DOUBLE
> @@ -113,17 +120,17 @@
>  
>  // signaling NaN computed at config time
>  _RWSTD_EXPORT extern const _DblBits
> -__rw_dbl_sNaN = { _RWSTD_DBL_SNAN_BITS };
> +_RWSTD_BITS_NAME(__rw_dbl_sNaN) = { _RWSTD_DBL_SNAN_BITS };
>  
>  
>  _RWSTD_EXPORT extern const _FltBits
> -__rw_flt_sNaN = { _RWSTD_FLT_SNAN_BITS };
> +_RWSTD_BITS_NAME(__rw_flt_sNaN) = { _RWSTD_FLT_SNAN_BITS };
>  
>  
>  #  ifndef _RWSTD_NO_LONG_DOUBLE
>  
>  _RWSTD_EXPORT extern const _LDblBits
> -__rw_ldbl_sNaN = { _RWSTD_LDBL_SNAN_BITS };
> +_RWSTD_BITS_NAME(__rw_ldbl_sNaN) = { _RWSTD_LDBL_SNAN_BITS };
>  
>  
>  #  endif   // _RWSTD_NO_LONG_DOUBLE
> @@ -131,22 +138,70 @@
>  
>  // denormalized minima computed at config time
>  _RWSTD_EXPORT extern const _DblBits
> -__rw_dbl_denorm_min = { _RWSTD_DBL_DENORM_MIN_BITS };
> +_RWSTD_BITS_NAME(__rw_dbl_denorm_min) = { _RWSTD_DBL_DENORM_MIN_BITS };
>  
>  
>  _RWSTD_EXPORT extern const _FltBits
> -__rw_flt_denorm_min = { _RWSTD_FLT_DENORM_MIN_BITS };
> +_RWSTD_BITS_NAME(__rw_flt_denorm_min) = { _RWSTD_FLT_DENORM_MIN_BITS };
>  
>  
>  #  ifndef _RWSTD_NO_LONG_DOUBLE
>  
>  _RWSTD_EXPORT extern const _LDblBits
> -__rw_ldbl_denorm_min = { _RWSTD_LDBL_DENORM_MIN_BITS };
> +_RWSTD_BITS_NAME(__rw_ldbl_denorm_min) = { _RWSTD_LDBL_DENORM_MIN_BITS
> };
>  
>  
>  #  endif   // _RWSTD_NO_LONG_DOUBLE
>  
> +
> +#ifdef _MSC_VER
> +
> +_RWSTD_EXPORT extern const float
> +__rw_flt_infinity = _RWSTD_BITS_NAME(__rw_flt_infinity)._C_val;
> +
> +_RWSTD_EXPORT extern const double
> +__rw_dbl_infinity = _RWSTD_BITS_NAME(__rw_dbl_infinity)._C_val;
> +
> +_RWSTD_EXPORT extern const float
> +__rw_flt_qNaN = _RWSTD_BITS_NAME(__rw_flt_qNaN)._C_val;
> +
> +_RWSTD_EXPORT extern const double
> +__rw_dbl_qNaN = _RWSTD_BITS_NAME(__rw_dbl_qNaN)._C_val;
> +
> +_RWSTD_EXPORT extern const float
> +__rw_flt_sNaN = _RWSTD_BITS_NAME(__rw_flt_sNaN)._C_val;
> +
> +_RWSTD_EXPORT extern const double
> +__rw_dbl_sNaN = _RWSTD_BITS_NAME(__rw_dbl_sNaN)._C_val;
> +
> +_RWSTD_EXPORT extern const float
> +__rw_flt_denorm_min = _RWSTD_BITS_NAME(__rw_flt_denorm_min)._C_val;
> +
> +_RWSTD_EXPORT extern const double
> +__rw_dbl_denorm_min = _RWSTD_BITS_NAME(__rw_dbl_denorm_min)._C_val;
> +
> +
> +#  ifndef _RWSTD_NO_LONG_DOUBLE
> +
> +_RWSTD_EXPORT extern const long double
> +__rw_ldbl_infinity = _RWSTD_BITS_NAME(__rw_ldbl_infinity)._C_val;
> +
> +_RWSTD_EXPORT extern const long double
> +__rw_ldbl_qNaN = _RWSTD_BITS_NAME(__rw_ldbl_qNaN)._C_val;
> +
> +_RWSTD_EXPORT extern const long double
> +__rw_ldbl_sNaN = _RWSTD_BITS_NAME(__rw_ldbl_sNaN)._C_val;
> +
> +_RWSTD_EXPORT extern const long double
> +__rw_ldbl_denorm_min = _RWSTD_BITS_NAME(__rw_ldbl_denorm_min)._C_val;
> +
> +#  endif   // _RWSTD_NO_LONG_DOUBLE
> +
> +#endif  // _MSC_VER
> +
> +#ifndef _MSC_VER
>  }   // extern "C"
> +#endif // _MSC_VER
>  
>  #else   // if defined (_RWSTD_NO_INFINITY)
>  
> Index: src/num_get.cpp
> ===================================================================
> --- src/num_get.cpp	(revision 585687)
> +++ src/num_get.cpp	(working copy)
> @@ -83,8 +83,9 @@
>  
>  typedef unsigned char UChar;
>  
> -
> +#ifndef _MSC_VER
>  extern "C" {
> +#endif // _MSC_VER
>  
>  extern const float       __rw_flt_infinity;
>  extern const double      __rw_dbl_infinity;
> @@ -95,7 +96,9 @@
>  
>  #endif   // _RWSTD_NO_LONG_DOUBLE
>  
> +#ifndef _MSC_VER
>  }   // extern "C"
> +#endif // _MSC_VER
>  
>  
>  const char*


Mime
View raw message