ssize_t specialization issue is hopefully now fixed in a manner palatable for both MSC and GCC :)

This was SVN commit r6157.
This commit is contained in:
janwas 2008-06-29 21:24:46 +00:00
parent 2382899a87
commit 697ef257d5
2 changed files with 19 additions and 9 deletions

View File

@ -130,8 +130,9 @@ template<> bool ToPrimitive<size_t>( JSContext* cx, jsval v, unsigned& Storage )
return true;
}
/* (See comment in JSConversions.h)
// ssize_t
// see comment at declaration of specialization
#if !GCC_VERSION
template<> jsval ToJSVal<ssize_t>( const ssize_t& Native )
{
return( INT_TO_JSVAL( (int)Native ) );
@ -149,12 +150,9 @@ template<> bool ToPrimitive<ssize_t>( JSContext* cx, jsval v, ssize_t& Storage )
Storage = (ssize_t)tmp;
return ok == JS_TRUE;
}
*/
#if ARCH_AMD64
// size_t (= unsigned int on IA32)
template<> jsval ToJSVal<size_t>( const size_t& Native )
{
return( INT_TO_JSVAL( (int)Native ) );
@ -176,7 +174,9 @@ template<> bool ToPrimitive<size_t>( JSContext* cx, jsval v, size_t& Storage )
return true;
}
#endif
#endif // #if ARCH_AMD64
#endif // #if !GCC_VERSION
// double

View File

@ -124,19 +124,29 @@ template<> bool ToPrimitive<unsigned>( JSContext* cx, jsval v, unsigned& Storage
template<> jsval ToJSVal<unsigned>( const unsigned& Native );
template<> jsval ToJSVal<unsigned>( unsigned& Native );
// (s)size_t are considered to be identical to (unsigned) int by GCC and
// their specializations would cause conflicts there.
#if !GCC_VERSION
// ssize_t
/* PT: Disabled this since it breaks the GCC build (conflicting with int) - this
might break the build on Windows instead. TODO: find out and clean this up.
template<> bool ToPrimitive<ssize_t>( JSContext* cx, jsval v, ssize_t& Storage );
template<> jsval ToJSVal<ssize_t>( const ssize_t& Native );
template<> jsval ToJSVal<ssize_t>( ssize_t& Native );
*/
// MSC treats ssize_t as distinct but not size_t. we will surely need this
// specialization if on an LP64 system, otherwise probably not.
#if ARCH_AMD64
// size_t
template<> bool ToPrimitive<size_t>( JSContext* cx, jsval v, size_t& Storage );
template<> jsval ToJSVal<size_t>( const size_t& Native );
template<> jsval ToJSVal<size_t>( size_t& Native );
#endif
#endif
// double
template<> bool ToPrimitive<double>( JSContext* cx, jsval v, double& Storage );
template<> jsval ToJSVal<double>( const double& Native );