summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-08-25 11:28:44 +0200
committerSergei Golubchik <serg@mariadb.org>2017-08-26 00:06:02 +0200
commitadd44e684cb9f1b46d1d5facdf6255360fa7b656 (patch)
tree8986fbe6dd3d48d61903de7d229db834a9552639
parent578b2b05b8f734217336b9dde35b47d52d96de34 (diff)
downloadmariadb-git-add44e684cb9f1b46d1d5facdf6255360fa7b656.tar.gz
compilation failure in oqgraph after 4aaa38d26ed9
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.
-rw-r--r--include/my_global.h31
-rw-r--r--storage/oqgraph/oqgraph_thunk.cc12
2 files changed, 20 insertions, 23 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 7e31783e326..fa9270893e1 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -803,26 +803,35 @@ inline unsigned long long my_double2ulonglong(double d)
#define SIZE_T_MAX (~((size_t) 0))
#endif
+#ifndef HAVE_FINITE
+#define finite(x) (1.0 / fabs(x) > 0.0)
+#endif
+
#ifndef isfinite
-#ifdef HAVE_FINITE
#define isfinite(x) finite(x)
-#else
-#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 */
+#endif
#ifndef HAVE_ISNAN
#define isnan(x) ((x) != (x))
#endif
#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)
-#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
/* Define missing math constants. */
diff --git a/storage/oqgraph/oqgraph_thunk.cc b/storage/oqgraph/oqgraph_thunk.cc
index 1d0c651bec4..5e254450a2b 100644
--- a/storage/oqgraph/oqgraph_thunk.cc
+++ b/storage/oqgraph/oqgraph_thunk.cc
@@ -28,18 +28,6 @@
#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 "sql_base.h"
#include "table.h"