incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: Fwd: Re: svn commit: r564059 - in /incubator/stdcxx/trunk: include/limits src/limits_bits.cpp
Date Wed, 29 Aug 2007 01:31:03 GMT
Mark Brown wrote:
> For some reason this post bounced. It's probably my fault for using two
> email accounts. I should use the same one.

I think I saw an email about the Apache infrastructure having
some issues recently so it's possible that your post got dropped
as a result. Thanks for following up!

The change was supposed to be binary compatible -- 4.2 is meant
to be binary compatible with 4.1.3. Changing the language linkage
of the helper constants from "C++" to "C" to work around the MSVC
mangling "feature" (unlike other compilers, MSVC mangles the type
of objects into their names) caused them to lose the namespace
prefix and broke binary compatibility. I'll need to go back and
devise a different solution.

Thanks again for pointing it out! It underscores how easy it
is to break binary compatibility and how badly we need to test
for such breakage.

Martin

> 
> -- Mark
> 
> ---------- Forwarded message ----------
> From: mark.g.brown <mark.g.brown@gmail.com>
> Date: Aug 14, 2007 11:09 PM
> Subject: Re: Re: svn commit: r564059 - in /incubator/stdcxx/trunk:
> include/limits src/limits_bits.cpp
> To: stdcxx-dev@incubator.apache.org
> 
> Martin Sebor wrote:
>> Andrew Black wrote:
>>> 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
>> Drat! The patch is incomplete. I forgot to commit a change
>> to another library file that forward declares the symbol.
>> This should fix it:
>> http://svn.apache.org/viewvc?view=rev&rev=564664
> 
> I'm curious, is this change meant to be binary compatible? I ask because
> some of my programs have started to fail to link since I updated to the
> latest stdcxx sources.
> 
> -- Mark
> 
>> Thanks for letting me know!
>> Martin
>>
>>>> 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