[Cleanup] Remove our own definition of M_PI.
* This is too brittle and might clash with MSVC's M_PI. See [1]. * We only used it once (in a unit test). * We shouldn't use PI anyway [2]. Instead, pull it from <cmath> with _USE_MATH_DEFINES, like it's already done in the code base. [1] https://ci.chromium.org/p/webrtc/builders/try/win_x86_msvc_rel/6844 [2] https://tauday.com/tau-manifesto Bug: webrtc:9855 Change-Id: I7a6976240604ef367ea07478d8cb5e4020e5dfeb Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132548 Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Yves Gerey <yvesg@google.com> Cr-Commit-Position: refs/heads/master@{#27597}
This commit is contained in:
@ -7,6 +7,8 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
// MSVC++ requires this to be set before any other includes to get M_PI.
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@ -14,7 +16,6 @@
|
||||
#include "api/array_view.h"
|
||||
#include "modules/audio_processing/rms_level.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/numerics/math_utils.h"
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
|
@ -11,15 +11,11 @@
|
||||
#ifndef RTC_BASE_NUMERICS_MATH_UTILS_H_
|
||||
#define RTC_BASE_NUMERICS_MATH_UTILS_H_
|
||||
|
||||
#include <math.h>
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265359f
|
||||
#endif
|
||||
|
||||
// Given two numbers |x| and |y| such that x >= y, computes the difference
|
||||
// x - y without causing undefined behavior due to signed overflow.
|
||||
template <typename T>
|
||||
|
Reference in New Issue
Block a user