libcxx clashing with newlib re: '__x' , '__y'

Robert Lytton robert at xmos.com
Wed Jul 30 03:26:36 PDT 2014


Hi,

I have built libcxx using the newlib library.
However, in libcxx's cmath, there are several times that identifiers clash with those in newlib's math.h

For example, new lib defines signbit using '__x':
    #define signbit(x) \
              (__extension__ ({__typeof__(x) __x = (x); \
                               (sizeof(__x) == sizeof(float)) ? __signbitf(__x) : __signbitd(__x);}))

and libcxx uses this macro but also uses '__x':
    template <class _A1>
    _LIBCPP_ALWAYS_INLINE
    bool
    __libcpp_signbit(_A1 __x) _NOEXCEPT
    {
        return signbit(__x);
    }

Resulting in self initializations of "__x":
    template <class _A1>
    __attribute__ ((__visibility__("hidden"), __always_inline__))
    bool
    __libcpp_signbit(_A1 __x) noexcept
    {
        return (__extension__ ({__typeof__(__x) __x = (__x); (sizeof(__x) == sizeof(float)) ? __signbitf(__x) : __signbitd(__x);}));
    }


How should this be remedied?
How about changing the symbols from __x,  __y, __z, __e  to __libcpp_x, __libcpp_y, __libcpp_z, __libcpp_e?

I have not yet checked for similar problems else where, but will.

Thank you

Robert


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140730/87971195/attachment.html>


More information about the llvm-commits mailing list