Fix building against the OS X 10.8 SDK.

This is a backport of DMD commit 47bee50a39 by Justin Holewinski.

GitHub: Fixes #218.
This commit is contained in:
David Nadlinger
2012-11-17 22:24:22 +01:00
parent a2089e8c55
commit 60ebf5b968
3 changed files with 18 additions and 20 deletions

View File

@@ -377,7 +377,11 @@ PortInitializer::PortInitializer()
int Port::isNan(double r)
{
#if __APPLE__
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
return __inline_isnand(r);
#else
return __inline_isnan(r);
#endif
#elif __OpenBSD__ || __MINGW32__ || __HAIKU__
return isnan(r);
#else
@@ -389,7 +393,11 @@ int Port::isNan(double r)
int Port::isNan(longdouble r)
{
#if __APPLE__
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
return __inline_isnanl(r);
#else
return __inline_isnan(r);
#endif
#elif __OpenBSD__ || __MINGW32__ || __HAIKU__
return isnan(r);
#else

View File

@@ -24,21 +24,9 @@
extern "C" char * __cdecl __locale_decpoint;
#endif
#if __MINGW32__
#ifndef isnan
#define isnan _isnan
#endif
#endif
#ifdef __APPLE__
#ifndef isnan
int isnan(double);
#endif
#endif
#include "rmem.h"
#if IN_DMD
#include "port.h"
#if IN_DMD
#include "root.h"
#endif
@@ -2416,13 +2404,7 @@ complex_t RealExp::toComplex()
int RealEquals(real_t x1, real_t x2)
{
// return (Port::isNan(x1) && Port::isNan(x2)) ||
#if __APPLE__
return (__inline_isnan(x1) && __inline_isnan(x2)) ||
#else
return // special case nans
(isnan(x1) && isnan(x2)) ||
#endif
return (Port::isNan(x1) && Port::isNan(x2)) ||
// and zero, in order to distinguish +0 from -0
(x1 == 0 && x2 == 0 && 1./x1 == 1./x2) ||
// otherwise just compare

View File

@@ -379,7 +379,11 @@ PortInitializer::PortInitializer()
int Port::isNan(double r)
{
#if __APPLE__
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
return __inline_isnand(r);
#else
return __inline_isnan(r);
#endif
#elif defined __HAIKU__ || __OpenBSD__
return isnan(r);
#else
@@ -391,7 +395,11 @@ int Port::isNan(double r)
int Port::isNan(longdouble r)
{
#if __APPLE__
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
return __inline_isnanl(r);
#else
return __inline_isnan(r);
#endif
#elif defined __HAIKU__ || __OpenBSD__
return isnan(r);
#else