diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-05-04 17:39:01 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-06-22 15:13:13 +0000 |
commit | 4dc597d96c26445a892cfc8f10d0f1da3d8decf1 (patch) | |
tree | abecf1b6f5232adcc00de16fae661bc03f3cc942 /src/corelib | |
parent | 68e31e4ab9fb3fdd544bc402e7654e2ac1f5eb53 (diff) |
Force Visual C++ math.h to define the M_ constants
That header defines those constants outside of the math.h include guard,
so if someone #define'd _USE_MATH_DEFINES and #include'd math.h later,
they would get VC++ warnings about constants like M_PI being redefined
with different values (ours have parentheses, VS2010's math.h don't).
Instead, let's define _USE_MATH_DEFINES ourselves so we get the M_*
macros from math.h. That way, we won't redefine them outselves.
Task-number: QTBUG-45935
Change-Id: Idf715b895bac4d56b4afffff13db2c98ba8345c2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/kernel/qmath.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h index 5cc3ec586e..e60561c05f 100644 --- a/src/corelib/kernel/qmath.h +++ b/src/corelib/kernel/qmath.h @@ -40,8 +40,18 @@ #include <QtCore/qglobal.h> +#ifndef _USE_MATH_DEFINES +# define _USE_MATH_DEFINES +# define undef_USE_MATH_DEFINES +#endif + #include <cmath> +#ifdef undef_USE_MATH_DEFINES +# undef _USE_MATH_DEFINES +# undef undef_USE_MATH_DEFINES +#endif + QT_BEGIN_NAMESPACE #define QT_SINE_TABLE_SIZE 256 |