Skip to content

Commit

Permalink
Updates stlport's cmath to provide isfinite, isinf, isnan and signbit…
Browse files Browse the repository at this point in the history
… as members of the std namespace

This is required by the latest WebKit which uses cmath and expects these
functions to be in the std namespace. We could modify WebKit to expect these
functions to be in the global namespace (as other platforms have done, see
JavaScriptCore/wtf/MathExtras.h). However, in the simulator build, these
functions are in the std namespace, as they should be. So the WebKit
modification would have to be dependent on the Android build type. Instead, it's
better to fix this in stlport.

The fix used to achieve this is copied from cmath from GNU C++ 4.2.

Change-Id: Ifdcecbf256b44c837adad370894d385198fe4603
  • Loading branch information
Steve Block committed Feb 17, 2010
1 parent e46c938 commit 066aeb1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions stlport/stl/_cmath.h
Expand Up @@ -531,6 +531,24 @@ _STLP_DEF_MATH_INLINE2(hypot, _hypot)
#endif

#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
#if defined (ANDROID)
namespace __captured {
template<typename _Tp> inline int __capture_isfinite(_Tp __f) { return isfinite(__f); }
template<typename _Tp> inline int __capture_isinf(_Tp __f) { return isinf(__f); }
template<typename _Tp> inline int __capture_isnan(_Tp __f) { return isnan(__f); }
template<typename _Tp> inline int __capture_signbit(_Tp __f) { return signbit(__f); }
}
#undef isfinite
#undef isinf
#undef isnan
#undef signbit
namespace __captured {
template<typename _Tp> inline int isfinite(_Tp __f) { return __capture_isfinite(__f); }
template<typename _Tp> inline int isinf(_Tp __f) { return __capture_isinf(__f); }
template<typename _Tp> inline int isnan(_Tp __f) { return __capture_isnan(__f); }
template<typename _Tp> inline int signbit(_Tp __f) { return __capture_signbit(__f); }
}
#endif
_STLP_BEGIN_NAMESPACE
using ::abs;
using ::acos;
Expand All @@ -555,11 +573,19 @@ using ::frexp;
#if !(defined(__HP_aCC) && defined(_STLP_DEBUG))
using ::hypot;
#endif
#if defined (ANDROID)
using __captured::isfinite;
using __captured::isinf;
using __captured::isnan;
#endif
using ::ldexp;
using ::log;
using ::log10;
using ::modf;
using ::pow;
#if defined (ANDROID)
using __captured::signbit;
#endif
using ::sin;
using ::sinh;
using ::sqrt;
Expand Down

0 comments on commit 066aeb1

Please sign in to comment.