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>
bb10
Thiago Macieira 2015-05-04 17:39:01 -07:00
parent 68e31e4ab9
commit 4dc597d96c
1 changed files with 10 additions and 0 deletions

View File

@ -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