From 9fd5def484bd5b0561edb73001328bc1afea45d7 Mon Sep 17 00:00:00 2001 From: Photonios Date: Tue, 22 Sep 2015 18:26:14 +0200 Subject: [PATCH] Fix for MSVC 2015: round has been added to this version --- psycopg/config.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/psycopg/config.h b/psycopg/config.h index 255fc3a7..f8e17a9a 100644 --- a/psycopg/config.h +++ b/psycopg/config.h @@ -142,16 +142,20 @@ static int pthread_mutex_init(pthread_mutex_t *mutex, void* fake) #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)