@@ -59,10 +59,18 @@ int zend_sprintf(char *buffer, const char *format, ...);
5959# define zend_sprintf sprintf
6060#endif
6161
62+ #if defined(__cplusplus) && __cplusplus >= 201103L
63+ extern "C++" {
64+ #include <cmath>
65+ #define zend_isnan std::isnan
66+ #define zend_isinf std::isinf
67+ #define zend_finite std::isfinite
68+ }
69+ #else
6270#include <math.h>
6371
6472#ifndef zend_isnan
65- #if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L)
73+ #if HAVE_DECL_ISNAN
6674#define zend_isnan(a) isnan(a)
6775#elif defined(HAVE_FPCLASS)
6876#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
@@ -71,7 +79,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
7179#endif
7280#endif
7381
74- #if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L)
82+ #if HAVE_DECL_ISINF
7583#define zend_isinf(a) isinf(a)
7684#elif defined(INFINITY)
7785/* Might not work, but is required by ISO C99 */
@@ -82,7 +90,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
8290#define zend_isinf(a) 0
8391#endif
8492
85- #if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L)
93+ #if HAVE_DECL_ISFINITE
8694#define zend_finite(a) isfinite(a)
8795#elif defined(HAVE_FINITE)
8896#define zend_finite(a) finite(a)
@@ -92,6 +100,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
92100#define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1)
93101#endif
94102
103+ #endif
95104#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */
96105
97106#undef PTHREADS
0 commit comments