Bug 1228947 - Replace mfbt/Constants.h with math.h. r=roc

This commit is contained in:
Chris Peterson 2015-11-27 20:49:55 -08:00
parent 94b02af319
commit 7f4c4d76a4
28 changed files with 15 additions and 82 deletions

View File

@ -552,6 +552,7 @@ case "$target" in
AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
if test "$_CC_MAJOR_VERSION" = "18" -a "$_CC_BUILD_VERSION" -ge "30723"; then
_CC_SUITE=12

View File

@ -5,7 +5,6 @@
#include <stdint.h>
#include <assert.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include "../AudioPacketizer.h"

View File

@ -26,16 +26,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// For M_PI
// VS2015 requires <math.h> to be used; <cmath> doesn't seem to honor
// _USE_MATH_DEFINES.
#define _USE_MATH_DEFINES
#include <math.h>
#include "Biquad.h"
#include <float.h>
#include <algorithm>
#include <math.h>
namespace WebCore {

View File

@ -25,7 +25,6 @@
#ifndef DenormalDisabler_h
#define DenormalDisabler_h
#define _USE_MATH_DEFINES
#include <cmath>
#include <float.h>

View File

@ -30,9 +30,9 @@
#include "DenormalDisabler.h"
#include <algorithm>
#include <cmath>
#include "mozilla/FloatingPoint.h"
#include "mozilla/Constants.h"
#include "WebAudioUtils.h"
using namespace std;

View File

@ -8,7 +8,6 @@
#define MOZILLA_SVGCONTENTUTILS_H
// include math.h to pick up definition of M_ maths defines e.g. M_PI
#define _USE_MATH_DEFINES
#include <math.h>
#include "mozilla/gfx/2D.h" // for StrokeOptions

View File

@ -16,12 +16,12 @@
#include "GonkGPSGeolocationProvider.h"
#include <cmath>
#include <pthread.h>
#include <hardware/gps.h>
#include "GeolocationUtil.h"
#include "mozstumbler/MozStumbler.h"
#include "mozilla/Constants.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "nsContentUtils.h"

View File

@ -11,7 +11,6 @@
#include <string.h>
#include "mozilla/CheckedInt.h"
#include "mozilla/Constants.h"
#include "2D.h"
#include "DataSurfaceHelpers.h"

View File

@ -6,8 +6,6 @@
#ifndef MOZILLA_GFX_DRAWCOMMAND_H_
#define MOZILLA_GFX_DRAWCOMMAND_H_
#define _USE_MATH_DEFINES
#include <math.h>
#include "2D.h"
@ -592,5 +590,4 @@ public:
} // namespace mozilla
#endif /* MOZILLA_GFX_DRAWCOMMAND_H_ */

View File

@ -16,12 +16,12 @@
#include "Logging.h"
#include "Tools.h"
#include <algorithm>
#include "mozilla/Constants.h"
#include "FilterNodeSoftware.h"
#include "FilterNodeD2D1.h"
#include "ExtendInputEffectD2D1.h"
#include <cmath>
#include <dwrite.h>
// decltype is not usable for overloaded functions.

View File

@ -3,8 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#define _USE_MATH_DEFINES
#include <cmath>
#include "DataSurfaceHelpers.h"
#include "FilterNodeSoftware.h"

View File

@ -8,7 +8,6 @@
#include <math.h>
#include "DrawTargetD2D.h"
#include "Logging.h"
#include "mozilla/Constants.h"
namespace mozilla {
namespace gfx {

View File

@ -3,9 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#define _USE_MATH_DEFINES
#include <cmath>
#include "PathHelpers.h"
namespace mozilla {
@ -278,4 +275,3 @@ MaxStrokeExtents(const StrokeOptions& aStrokeOptions,
} // namespace gfx
} // namespace mozilla

View File

@ -7,9 +7,10 @@
#define MOZILLA_GFX_PATHHELPERS_H_
#include "2D.h"
#include "mozilla/Constants.h"
#include "UserData.h"
#include <cmath>
namespace mozilla {
namespace gfx {

View File

@ -28,7 +28,6 @@
#include "base/basictypes.h"
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cmath>
#include <limits>

View File

@ -146,6 +146,7 @@ UNIFIED_SOURCES += [
'Matrix.cpp',
'Path.cpp',
'PathCairo.cpp',
'PathHelpers.cpp',
'PathRecording.cpp',
'Quaternion.cpp',
'RecordedEvent.cpp',
@ -156,10 +157,6 @@ UNIFIED_SOURCES += [
'SourceSurfaceRawData.cpp',
]
SOURCES += [
'PathHelpers.cpp', # Uses _USE_MATH_DEFINES
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
EXPORTS.mozilla.gfx += [
'QuartzSupport.h',

View File

@ -29,7 +29,6 @@
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/BasicEvents.h" // for Modifiers, MODIFIER_*
#include "mozilla/ClearOnShutdown.h" // for ClearOnShutdown
#include "mozilla/Constants.h" // for M_PI
#include "mozilla/EventForwards.h" // for nsEventStatus_*
#include "mozilla/Preferences.h" // for Preferences
#include "mozilla/ReentrantMonitor.h" // for ReentrantMonitorAutoEnter, etc

View File

@ -3,9 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifdef _MSC_VER
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#include "mozilla/Alignment.h"

View File

@ -6,9 +6,9 @@
#ifndef GFX_PREFS_H
#define GFX_PREFS_H
#include <cmath> // for M_PI
#include <stdint.h>
#include "mozilla/Assertions.h"
#include "mozilla/Constants.h" // for M_PI
// First time gfxPrefs::GetSingleton() needs to be called on the main thread,
// before any of the methods accessing the values are used, but after

View File

@ -373,6 +373,7 @@ case "$target" in
AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
if test "$_CC_MAJOR_VERSION" = "18"; then
_CC_SUITE=12

View File

@ -10,7 +10,6 @@
#include "jsmath.h"
#include "mozilla/Constants.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/MemoryReporting.h"

View File

@ -9,32 +9,9 @@
#include "mozilla/MemoryReporting.h"
#include "NamespaceImports.h"
#include <cmath>
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
#ifndef M_E
# define M_E 2.7182818284590452354
#endif
#ifndef M_LOG2E
# define M_LOG2E 1.4426950408889634074
#endif
#ifndef M_LOG10E
# define M_LOG10E 0.43429448190325182765
#endif
#ifndef M_LN2
# define M_LN2 0.69314718055994530942
#endif
#ifndef M_LN10
# define M_LN10 2.30258509299404568402
#endif
#ifndef M_SQRT2
# define M_SQRT2 1.41421356237309504880
#endif
#ifndef M_SQRT1_2
# define M_SQRT1_2 0.70710678118654752440
#endif
#include "NamespaceImports.h"
namespace js {

View File

@ -7,7 +7,6 @@
#define NS_SVGUTILS_H
// include math.h to pick up definition of M_ maths defines e.g. M_PI
#define _USE_MATH_DEFINES
#include <math.h>
#include "DrawMode.h"
@ -25,7 +24,6 @@
#include "nsISupportsBase.h"
#include "nsMathUtils.h"
#include "nsStyleStruct.h"
#include "mozilla/Constants.h"
#include <algorithm>
class gfxContext;

View File

@ -49,6 +49,7 @@ if CONFIG['OS_TARGET'] == 'WINNT':
]
DEFINES['USE_WINMM'] = True
DEFINES['USE_WASAPI'] = True
CXXFLAGS += ['-wd4005'] # C4005: '_USE_MATH_DEFINES' : macro redefinition
if CONFIG['OS_TARGET'] == 'Android':
SOURCES += ['cubeb_opensl.c']

View File

@ -1,16 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* mfbt math constants. */
#ifndef mozilla_Constants_h
#define mozilla_Constants_h
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
#endif /* mozilla_Constants_h */

View File

@ -30,7 +30,6 @@ EXPORTS.mozilla = [
'CheckedInt.h',
'Compiler.h',
'Compression.h',
'Constants.h',
'DebugOnly.h',
'decimal/Decimal.h',
'double-conversion/double-conversion.h',

View File

@ -12,11 +12,12 @@
#include "nsUXThemeData.h"
#include "nsIDOMSimpleGestureEvent.h"
#include "nsIDOMWheelEvent.h"
#include "mozilla/Constants.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/TouchEvents.h"
#include <cmath>
using namespace mozilla;
using namespace mozilla::widget;

View File

@ -7,8 +7,6 @@
#ifndef nsMathUtils_h__
#define nsMathUtils_h__
#define _USE_MATH_DEFINES /* needed for M_ constants on Win32 */
#include "nscore.h"
#include <cmath>
#include <float.h>