diff options
author | Robert Adam <dev@robert-adam.de> | 2021-03-04 20:39:19 +0300 |
---|---|---|
committer | Robert Adam <dev@robert-adam.de> | 2021-03-06 20:57:22 +0300 |
commit | 678e872c2124ec5175106616881f7df41be66647 (patch) | |
tree | e34cd09698bf7034b1cb52c9ce055c8688052301 /src | |
parent | ff40c92ab4eec3b5d006809f162480e422d3babc (diff) |
BUILD(cmake): Always define _USE_MATH_DEFINES
This is needed in order for the <cmath> header to also define constants
like M_PI. Instead of manually defining the macro every time before
including <cmath>, the macro is now defined via cmake and thus always
defined.
Diffstat (limited to 'src')
-rw-r--r-- | src/mumble/AudioOutput.cpp | 10 | ||||
-rw-r--r-- | src/mumble/AudioOutputSpeech.cpp | 12 | ||||
-rw-r--r-- | src/mumble/ManualPlugin.cpp | 5 | ||||
-rw-r--r-- | src/murmur/murmur_pch.h | 4 | ||||
-rw-r--r-- | src/tests/Resample.cpp | 2 |
5 files changed, 5 insertions, 28 deletions
diff --git a/src/mumble/AudioOutput.cpp b/src/mumble/AudioOutput.cpp index a52cc393b..d177103c9 100644 --- a/src/mumble/AudioOutput.cpp +++ b/src/mumble/AudioOutput.cpp @@ -3,14 +3,6 @@ // that can be found in the LICENSE file at the root of the // Mumble source tree or at <https://www.mumble.info/LICENSE>. -// <cmath> includes <math.h>, but only if it isn't already included. -// We include <cmath> as first header to make sure that we include <math.h> with _USE_MATH_DEFINES. -#ifdef _MSC_VER -# define _USE_MATH_DEFINES -#endif - -#include <cmath> - #include "AudioOutput.h" #include "AudioInput.h" @@ -29,6 +21,8 @@ #include "VoiceRecorder.h" #include "Global.h" +#include <cmath> + // Remember that we cannot use static member classes that are not pointers, as the constructor // for AudioOutputRegistrar() might be called before they are initialized, as the constructor // is called from global initialization. diff --git a/src/mumble/AudioOutputSpeech.cpp b/src/mumble/AudioOutputSpeech.cpp index a0f28579d..ee7426a1e 100644 --- a/src/mumble/AudioOutputSpeech.cpp +++ b/src/mumble/AudioOutputSpeech.cpp @@ -3,16 +3,6 @@ // that can be found in the LICENSE file at the root of the // Mumble source tree or at <https://www.mumble.info/LICENSE>. -// We want to include <math.h> with _USE_MATH_DEFINES defined. -// To make sure we do so before anything else includes the header without it -// (triggering the guard and effectively preventing a "fix include") -// we define and include before anything else. -#ifdef _MSC_VER -# define _USE_MATH_DEFINES -#endif - -#include <cmath> - #include "AudioOutputSpeech.h" #include "Audio.h" @@ -26,6 +16,8 @@ #include "Utils.h" #include "Global.h" +#include <cmath> + AudioOutputSpeech::AudioOutputSpeech(ClientUser *user, unsigned int freq, MessageHandler::UDPMessageType type, unsigned int systemMaxBufferSize) : AudioOutputUser(user->qsName) { diff --git a/src/mumble/ManualPlugin.cpp b/src/mumble/ManualPlugin.cpp index 38eae17c1..34e185f65 100644 --- a/src/mumble/ManualPlugin.cpp +++ b/src/mumble/ManualPlugin.cpp @@ -3,8 +3,6 @@ // that can be found in the LICENSE file at the root of the // Mumble source tree or at <https://www.mumble.info/LICENSE>. -#define _USE_MATH_DEFINES - #include <QtCore/QtCore> #include <QtGui/QtGui> #include <QtWidgets/QMessageBox> @@ -14,6 +12,7 @@ #include <QPointer> #include <float.h> +#include <cmath> #include "../../plugins/mumble_plugin.h" #include "Global.h" @@ -416,5 +415,3 @@ MumblePlugin *ManualPlugin_getMumblePlugin() { MumblePluginQt *ManualPlugin_getMumblePluginQt() { return &manualqt; } - -#undef _USE_MATH_DEFINES diff --git a/src/murmur/murmur_pch.h b/src/murmur/murmur_pch.h index b900346a0..f10f718a8 100644 --- a/src/murmur/murmur_pch.h +++ b/src/murmur/murmur_pch.h @@ -7,10 +7,6 @@ # ifndef MUMBLE_MURMUR_MURMUR_PCH_H_ # define MUMBLE_MURMUR_MURMUR_PCH_H_ -# ifdef _MSC_VER -# define _USE_MATH_DEFINES -# endif - # include <QtCore/QtGlobal> # ifdef Q_OS_WIN diff --git a/src/tests/Resample.cpp b/src/tests/Resample.cpp index ec0f256cd..be9fe30d8 100644 --- a/src/tests/Resample.cpp +++ b/src/tests/Resample.cpp @@ -15,7 +15,6 @@ #include <QtCore> -#define _USE_MATH_DEFINES #include <cmath> #include <speex/speex_resampler.h> @@ -132,5 +131,4 @@ int main(int argc, char **argv) { return 0; } -#undef _USE_MATH_DEFINES #undef ITER |