incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Black <abl...@roguewave.com>
Subject Re: svn commit: r564059 - in /incubator/stdcxx/trunk: include/limits src/limits_bits.cpp
Date Fri, 10 Aug 2007 16:17:30 GMT
Greetings Martin

I'm not completely certain, but I believe this change is leading to
failures on most or all operating systems.  In particular, linker
warnings of
> ld: (Warning) Unsatisfied symbol "__rw::__rw_flt_infinity" in file $(BUILDDIR)/lib/libstd.sl
> ld: (Warning) Unsatisfied symbol "__rw::__rw_dbl_infinity" in file $(BUILDDIR)/lib/libstd.sl
> ld: (Warning) Unsatisfied symbol "__rw::__rw_ldbl_infinity" in file $(BUILDDIR)/lib/libstd.sl
are observed in static builds (on HPUX), and the same message is
observed when running the exec utility in dynamic builds.

--Andrew Black

sebor@apache.org wrote:
> Author: sebor
> Date: Wed Aug  8 17:47:54 2007
> New Revision: 564059
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=564059
> Log:
> 2007-08-09  Martin Sebor  <sebor@roguewave.com>
> 
> 	STDCXX-509
> 	* limits (__rw_flt_denorm_min, __rw_flt_infinity, __rw_flt_qNaN,
> 	__rw_flt_sNaN, __rw_dbl_denorm_min, __rw_dbl_infinity, __rw_dbl_qNaN,
> 	__rw_dbl_sNaN, __rw_ldbl_denorm_min, __rw_ldbl_infinity, __rw_ldbl_qNaN,
> 	__rw_ldbl_sNaN): Declared floating point constants with "C" language
> 	linkage to prevent "clever" compilers such as MSVC from mangling their
> 	type into their names and to permit them to be defined with different
> 	types.
> 	* limits_bits.cpp (__rw_flt_denorm_min, __rw_flt_infinity,
> 	__rw_flt_qNaN, __rw_flt_sNaN, __rw_dbl_denorm_min, __rw_dbl_infinity,
> 	__rw_dbl_qNaN, __rw_dbl_sNaN, __rw_ldbl_denorm_min, __rw_ldbl_infinity,
> 	__rw_ldbl_qNaN, __rw_ldbl_sNaN): Defined as statically (i.e., at load
> 	time as opposed to dynamically, at runtime) initialized unions, backed
> 	by the appropriate byte patterns, with "C" language linkage to permit
> 	the defintions to have a different type than the declarations.
> 	(__rw_flt_denorm_min_bits, __rw_flt_infinity_bits, __rw_flt_qNaN_bits,
> 	__rw_flt_sNaN_bits, __rw_dbl_denorm_min_bits, __rw_dbl_infinity_bits,
> 	__rw_dbl_qNaN_bits, __rw_dbl_sNaN_bits, __rw_ldbl_denorm_min_bits,
> 	__rw_ldbl_infinity_bits, __rw_ldbl_qNaN_bits,  __rw_ldbl_sNaN_bits):
> 	Removed.
> 
> Modified:
>     incubator/stdcxx/trunk/include/limits
>     incubator/stdcxx/trunk/src/limits_bits.cpp
> 
> Modified: incubator/stdcxx/trunk/include/limits
> URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/include/limits?view=diff&rev=564059&r1=564058&r2=564059
> ==============================================================================
> --- incubator/stdcxx/trunk/include/limits (original)
> +++ incubator/stdcxx/trunk/include/limits Wed Aug  8 17:47:54 2007
> @@ -23,7 +23,7 @@
>   * implied.   See  the License  for  the  specific language  governing
>   * permissions and limitations under the License.
>   *
> - * Copyright 1994-2006 Rogue Wave Software.
> + * Copyright 1994-2007 Rogue Wave Software, Inc.
>   * 
>   **************************************************************************/
>  
> @@ -86,7 +86,9 @@
>  #endif   // _RWSTD_IS_IEC559
>  
>  
> -_RWSTD_NAMESPACE (__rw) { 
> +_RWSTD_NAMESPACE (__rw) {
> +
> +extern "C" {
>  
>  _RWSTD_EXPORT extern const float       __rw_flt_infinity;
>  _RWSTD_EXPORT extern const double      __rw_dbl_infinity;
> @@ -108,6 +110,8 @@
>  _RWSTD_EXPORT extern const long double __rw_ldbl_denorm_min;
>  
>  #endif   // _RWSTD_NO_LONG_DOUBLE
> +
> +}   // extern "C"
>  
>  }   // namespace __rw
>  
> 
> Modified: incubator/stdcxx/trunk/src/limits_bits.cpp
> URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/src/limits_bits.cpp?view=diff&rev=564059&r1=564058&r2=564059
> ==============================================================================
> --- incubator/stdcxx/trunk/src/limits_bits.cpp (original)
> +++ incubator/stdcxx/trunk/src/limits_bits.cpp Wed Aug  8 17:47:54 2007
> @@ -22,7 +22,7 @@
>   * implied.   See  the License  for  the  specific language  governing
>   * permissions and limitations under the License.
>   *
> - * Copyright 1994-2006 Rogue Wave Software.
> + * Copyright 1994-2007 Rogue Wave Software, Inc.
>   * 
>   **************************************************************************/
>  
> @@ -30,6 +30,11 @@
>  
>  #include <float.h>    // for INFINITY, NAN
>  #include <stdlib.h>   // for atof()
> +
> +// must not #include <limits> to avoid colliding with symbols
> +// declared there with a different type than what they are
> +// defined with here
> +// #include <limits>
>                         
>  #include <rw/_defs.h>  
>                         
> @@ -42,126 +47,106 @@
>  #    error one of _RWSTD_NO_INFINITY and _RWSTD_DBL_INF_BITS must be #defined
>  #  endif
>  
> -// infinity computed at config time
> -static const union {
> -    char _C_bits [sizeof (double)];
> -    double _C_val;
> -} __rw_dbl_inf_bits = { _RWSTD_DBL_INF_BITS };
>  
> -_RWSTD_EXPORT extern const double __rw_dbl_infinity = __rw_dbl_inf_bits._C_val;
> -
> -static const union {
> -    char _C_bits [sizeof (float)];
> +union _FltBits {
> +    char  _C_bits [sizeof (float)];
>      float _C_val;
> -} __rw_flt_inf_bits = { _RWSTD_FLT_INF_BITS };
> +};
>  
> -_RWSTD_EXPORT extern const float __rw_flt_infinity = __rw_flt_inf_bits._C_val;
> +
> +union _DblBits {
> +    char   _C_bits [sizeof (double)];
> +    double _C_val;
> +};
>  
>  
>  #  ifndef _RWSTD_NO_LONG_DOUBLE
>  
> -static const union {
> -    char _C_bits [sizeof (long double)];
> +union _LDblBits {
> +    char        _C_bits [sizeof (long double)];
>      long double _C_val;
> -} __rw_ldbl_inf_bits = { _RWSTD_LDBL_INF_BITS };
> +};
> +
> +#  endif   // _RWSTD_NO_LONG_DOUBLE
> +
> +extern "C" {
> +
> +// 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.
> +
> +// infinity computed at config time
> +_RWSTD_EXPORT extern const _DblBits
> +__rw_dbl_infinity = { _RWSTD_DBL_INF_BITS };
> +
> +
> +_RWSTD_EXPORT extern const _FltBits
> +__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_EXPORT extern const long double
> -__rw_ldbl_infinity = __rw_ldbl_inf_bits._C_val;
>  
>  #  endif   // _RWSTD_NO_LONG_DOUBLE
>  
>  
>  // quiet NaN computed at config time
> -static const union {
> -    char _C_bits [sizeof (double)];
> -    double _C_val;
> -} __rw_dbl_qNaN_bits = { _RWSTD_DBL_QNAN_BITS };
> -
> -_RWSTD_EXPORT extern const double __rw_dbl_qNaN  = __rw_dbl_qNaN_bits._C_val;
> +_RWSTD_EXPORT extern const _DblBits
> +__rw_dbl_qNaN = { _RWSTD_DBL_QNAN_BITS };
>  
> -static const union {
> -    char _C_bits [sizeof (float)];
> -    float _C_val;
> -} __rw_flt_qNaN_bits = { _RWSTD_FLT_QNAN_BITS };
>  
> -_RWSTD_EXPORT extern const float __rw_flt_qNaN  = __rw_flt_qNaN_bits._C_val;
> +_RWSTD_EXPORT extern const _FltBits
> +__rw_flt_qNaN = { _RWSTD_FLT_QNAN_BITS };
>  
>  
>  #  ifndef _RWSTD_NO_LONG_DOUBLE
>  
> -static const union {
> -    char _C_bits [sizeof (long double)];
> -    long double _C_val;
> -} __rw_ldbl_qNaN_bits = { _RWSTD_LDBL_QNAN_BITS };
> -
> +_RWSTD_EXPORT extern const _LDblBits
> +__rw_ldbl_qNaN = { _RWSTD_LDBL_QNAN_BITS };
>  
> -_RWSTD_EXPORT extern const long double
> -__rw_ldbl_qNaN = __rw_ldbl_qNaN_bits._C_val;
>  
>  #  endif   // _RWSTD_NO_LONG_DOUBLE
>  
>  
>  // signaling NaN computed at config time
> -static const union {
> -    char _C_bits [sizeof (double)];
> -    double _C_val;
> -} __rw_dbl_sNaN_bits = { _RWSTD_DBL_SNAN_BITS };
> +_RWSTD_EXPORT extern const _DblBits
> +__rw_dbl_sNaN = { _RWSTD_DBL_SNAN_BITS };
>  
> -_RWSTD_EXPORT extern const double __rw_dbl_sNaN  = __rw_dbl_sNaN_bits._C_val;
> -
> -static const union {
> -    char _C_bits [sizeof (float)];
> -    float _C_val;
> -} __rw_flt_sNaN_bits = { _RWSTD_FLT_SNAN_BITS };
>  
> -_RWSTD_EXPORT extern const float __rw_flt_sNaN  = __rw_flt_sNaN_bits._C_val;
> +_RWSTD_EXPORT extern const _FltBits
> +__rw_flt_sNaN = { _RWSTD_FLT_SNAN_BITS };
>  
>  
>  #  ifndef _RWSTD_NO_LONG_DOUBLE
>  
> -static const union {
> -    char _C_bits [sizeof (long double)];
> -    long double _C_val;
> -} __rw_ldbl_sNaN_bits = { _RWSTD_LDBL_SNAN_BITS };
> -
> +_RWSTD_EXPORT extern const _LDblBits
> +__rw_ldbl_sNaN = { _RWSTD_LDBL_SNAN_BITS };
>  
> -_RWSTD_EXPORT extern const long double
> -__rw_ldbl_sNaN = __rw_ldbl_sNaN_bits._C_val;
>  
>  #  endif   // _RWSTD_NO_LONG_DOUBLE
>  
>  
>  // denormalized minima computed at config time
> -static const union {
> -    char _C_bits [sizeof (double)];
> -    double _C_val;
> -} __rw_dbl_denorm_min_bits = { _RWSTD_DBL_DENORM_MIN_BITS };
> -
> -_RWSTD_EXPORT extern const double
> -__rw_dbl_denorm_min = __rw_dbl_denorm_min_bits._C_val;
> +_RWSTD_EXPORT extern const _DblBits
> +__rw_dbl_denorm_min = { _RWSTD_DBL_DENORM_MIN_BITS };
>  
> -static const union {
> -    char _C_bits [sizeof (float)];
> -    float _C_val;
> -} __rw_flt_denorm_min_bits = { _RWSTD_FLT_DENORM_MIN_BITS };
>  
> -_RWSTD_EXPORT extern const float
> -__rw_flt_denorm_min = __rw_flt_denorm_min_bits._C_val;
> +_RWSTD_EXPORT extern const _FltBits
> +__rw_flt_denorm_min = { _RWSTD_FLT_DENORM_MIN_BITS };
>  
>  
>  #  ifndef _RWSTD_NO_LONG_DOUBLE
>  
> -static const union {
> -    char _C_bits [sizeof (long double)];
> -    long double _C_val;
> -} __rw_ldbl_denorm_min_bits = { _RWSTD_LDBL_DENORM_MIN_BITS };
> -
> +_RWSTD_EXPORT extern const _LDblBits
> +__rw_ldbl_denorm_min = { _RWSTD_LDBL_DENORM_MIN_BITS };
>  
> -_RWSTD_EXPORT extern const long double
> -__rw_ldbl_denorm_min = __rw_ldbl_denorm_min_bits._C_val;
>  
>  #  endif   // _RWSTD_NO_LONG_DOUBLE
> +
> +}   // extern "C"
>  
>  #else   // if defined (_RWSTD_NO_INFINITY)
>  
> 
> 
> 

Mime
View raw message