diff options
| author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2015-10-01 13:36:15 +0100 |
|---|---|---|
| committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2015-10-01 13:36:15 +0100 |
| commit | ca90fb27910b8a649207ce8cd5b8057be6ea8cf2 (patch) | |
| tree | 9f456ec94913aa494e187195c6ac28d780d24ae4 | |
| parent | abf1f28c44b222df78b71f79e807a716cb5e7b43 (diff) | |
| parent | 9fd5def484bd5b0561edb73001328bc1afea45d7 (diff) | |
| download | psycopg2-ca90fb27910b8a649207ce8cd5b8057be6ea8cf2.tar.gz | |
Merge branch 'msvc-2015-support' into maint_2_6
| -rw-r--r-- | psycopg/config.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/psycopg/config.h b/psycopg/config.h index b6cd419..f8e17a9 100644 --- a/psycopg/config.h +++ b/psycopg/config.h @@ -129,28 +129,33 @@ static int pthread_mutex_init(pthread_mutex_t *mutex, void* fake) /* remove the inline keyword, since it doesn't work unless C++ file */ #define inline -/* Hmmm, MSVC doesn't have a isnan/isinf function, but has _isnan function */ +/* Hmmm, MSVC <2015 doesn't have a isnan/isinf function, but has _isnan function */ #if defined (_MSC_VER) +#if !defined(isnan) #define isnan(x) (_isnan(x)) /* The following line was hacked together from simliar code by Bjorn Reese * in libxml2 code */ #define isinf(x) ((_fpclass(x) == _FPCLASS_PINF) ? 1 \ : ((_fpclass(x) == _FPCLASS_NINF) ? -1 : 0)) - +#endif #define strcasecmp(x, y) lstrcmpi(x, y) #endif #endif +/* what's this, we have no round function either? */ #if (defined(__FreeBSD__) && __FreeBSD_version < 503000) \ || (defined(_WIN32) && !defined(__GNUC__)) \ || (defined(sun) || defined(__sun__)) \ && (defined(__SunOS_5_8) || defined(__SunOS_5_9)) -/* what's this, we have no round function either? */ + +/* round has been added in the standard library with MSVC 2015 */ +#if _MSC_VER < 1900 static double round(double num) { return (num >= 0) ? floor(num + 0.5) : ceil(num - 0.5); } #endif +#endif /* resolve missing isinf() function for Solaris */ #if defined (__SVR4) && defined (__sun) |
