Re-fix the build with ICC and cmath & math.h
Commit c35fef9d3b 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>
bb10
parent
5b8957247f
commit
4c0760d327
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue