From 4dc597d96c26445a892cfc8f10d0f1da3d8decf1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 4 May 2015 17:39:01 -0700 Subject: [PATCH] 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 Reviewed-by: Marc Mutz --- src/corelib/kernel/qmath.h | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 +#ifndef _USE_MATH_DEFINES +# define _USE_MATH_DEFINES +# define undef_USE_MATH_DEFINES +#endif + #include +#ifdef undef_USE_MATH_DEFINES +# undef _USE_MATH_DEFINES +# undef undef_USE_MATH_DEFINES +#endif + QT_BEGIN_NAMESPACE #define QT_SINE_TABLE_SIZE 256