Commit add44e68 authored by Sergei Golubchik's avatar Sergei Golubchik

compilation failure in oqgraph after 4aaa38d2

on many builders oqgraph failed to compile because isfinite wasn't defined.

fix this mess of ifdefs/defines to work properly no matter
whether isfinite/isnan/isinf is a function or a macro
and whether stl header undefines it or not.

and remove the hackish workaround from oqgraph.
parent 578b2b05
...@@ -803,26 +803,35 @@ inline unsigned long long my_double2ulonglong(double d) ...@@ -803,26 +803,35 @@ inline unsigned long long my_double2ulonglong(double d)
#define SIZE_T_MAX (~((size_t) 0)) #define SIZE_T_MAX (~((size_t) 0))
#endif #endif
#ifndef HAVE_FINITE
#define finite(x) (1.0 / fabs(x) > 0.0)
#endif
#ifndef isfinite #ifndef isfinite
#ifdef HAVE_FINITE
#define isfinite(x) finite(x) #define isfinite(x) finite(x)
#else #endif
#define finite(x) (1.0 / fabs(x) > 0.0)
#endif /* HAVE_FINITE */
#elif (__cplusplus >= 201103L)
#include <cmath>
static inline bool isfinite(double x) { return std::isfinite(x); }
#endif /* isfinite */
#ifndef HAVE_ISNAN #ifndef HAVE_ISNAN
#define isnan(x) ((x) != (x)) #define isnan(x) ((x) != (x))
#endif #endif
#define my_isnan(x) isnan(x) #define my_isnan(x) isnan(x)
#ifdef HAVE_ISINF #ifndef HAVE_ISINF
#define isinf(X) (!isfinite(X) && !isnan(X))
#endif
#define my_isinf(X) isinf(X) #define my_isinf(X) isinf(X)
#else /* !HAVE_ISINF */
#define my_isinf(X) (!finite(X) && !isnan(X)) #ifdef __cplusplus
#include <cmath>
#ifndef isfinite
#define isfinite(X) std::isfinite(X)
#endif
#ifndef isnan
#define isnan(X) std::isnan(X)
#endif
#ifndef isinf
#define isinf(X) std::isinf(X)
#endif
#endif #endif
/* Define missing math constants. */ /* Define missing math constants. */
......
...@@ -28,18 +28,6 @@ ...@@ -28,18 +28,6 @@
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
/* This is needed as boost undef's isfinite */
#ifndef isfinite
#ifdef HAVE_FINITE
#define isfinite(x) finite(x)
#else
#define isfinite(x) (1.0 / fabs(x) > 0.0)
#endif /* HAVE_FINITE */
#elif (__cplusplus >= 201103L)
#include <cmath>
static inline bool isfinite(double x) { return std::isfinite(x); }
#endif /* isfinite */
#include "unireg.h" #include "unireg.h"
#include "sql_base.h" #include "sql_base.h"
#include "table.h" #include "table.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment