Prevent leaking _USE_MATH_DEFINES outside of qwt_math.h
Brought to you by:
rathmann
|
From: Goran Z. <GZ...@ti...> - 2020-06-25 13:41:51
|
Hi there! In qwt_math.h there is this piece of code: #if defined(_MSC_VER) /* Microsoft says: Define _USE_MATH_DEFINES before including math.h to expose these macro definitions for common math constants. These are placed under an #ifdef since these commonly-defined names are not part of the C/C++ standards. */ #define _USE_MATH_DEFINES 1 #endif #include <qmath.h> #include "qwt_global.h" I believe one should also #undef _USE_MATH_DEFINES after qmath.h has been included so Visual Studio would not generate warnings about macro redefinitions: C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_math_defines.h:17: warning: C4005: 'M_E': macro redefinition C:\Qt\5.14.2\msvc2017_64\include\QtCore\qmath.h:155: see previous definition of 'M_E' See qmath.h how it is done. I proposed following fix to be upstreamed: // Prevent _USE_MATH_DEFINES to leak outside of this header file. #if defined(_MSC_VER) #undef _USE_MATH_DEFINES #endif /Goran |