summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2016-11-30 15:29:45 -0800
committerThiago Macieira <thiago.macieira@intel.com>2016-12-10 19:31:45 +0000
commit4c0760d327e390a37d0d6ce2016d3a8c5b87a119 (patch)
treec47ebf133a4a7f36f8af76ea22e56d87e9f74b6e /src/corelib
parent5b8957247f5e2845dd9f59545ba567d051c4e436 (diff)
Re-fix the build with ICC and cmath & math.h
Commit c35fef9d3b8bb77a7f303e3cd62c86cd00e57f5b wasn't sufficient. The problem is that there's a complex combination of libc headers (math.h), C++ headers (cmath), which may be provided by three different sources on Linux (glibc, gcc and ICC). On some combinations, the isnan macro leaks from math.h or cmath and that's what the the commit above tried to fix. On some other combinations, there's no macro but there's an ::isnan function defined. When we do "using namespace std; return isnan(x);", that causes a compilation error. This commit solves that by detecting whether there is a macro defined. error: more than one instance of overloaded function "isnan" matches the argument list function "isnan(double)" function "std::isnan(double)" argument types are: (double) Change-Id: Iaeecaffe26af4535b416fffd148bf71826541bdd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qnumeric_p.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h
index 23fcf340f1..01b8772ee1 100644
--- a/src/corelib/global/qnumeric_p.h
+++ b/src/corelib/global/qnumeric_p.h
@@ -68,7 +68,8 @@
#if !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || defined(Q_CC_INTEL) || !defined(__cplusplus))
# include <math.h>
-# define QT_MATH_H_DEFINES_MACROS
+# ifdef isnan
+# define QT_MATH_H_DEFINES_MACROS
QT_BEGIN_NAMESPACE
namespace qnumeric_std_wrapper {
// the 'using namespace std' below is cases where the stdlib already put the math.h functions in the std namespace and undefined the macros.
@@ -81,10 +82,11 @@ static inline bool math_h_isfinite(float f) { using namespace std; return isfini
}
QT_END_NAMESPACE
// These macros from math.h conflict with the real functions in the std namespace.
-#undef signbit
-#undef isnan
-#undef isinf
-#undef isfinite
+# undef signbit
+# undef isnan
+# undef isinf
+# undef isfinite
+# endif // defined(isnan)
#endif
QT_BEGIN_NAMESPACE