Enable warnings-as-errors on Windows.
Review URL: https://codereview.appspot.com/7066054
git-svn-id: http://skia.googlecode.com/svn/trunk@7094 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/debugger/SkDebugCanvas.cpp b/debugger/SkDebugCanvas.cpp
index beb670b..5fcc076 100644
--- a/debugger/SkDebugCanvas.cpp
+++ b/debugger/SkDebugCanvas.cpp
@@ -7,12 +7,22 @@
*/
-#include <iostream>
#include "SkDebugCanvas.h"
#include "SkDrawCommand.h"
#include "SkDevice.h"
#include "SkImageWidget.h"
+#ifdef SK_BUILD_FOR_WIN
+ // iostream includes xlocale which generates warning 4530 because we're compiling without
+ // exceptions
+ #pragma warning(push)
+ #pragma warning(disable : 4530)
+#endif
+#include <iostream>
+#ifdef SK_BUILD_FOR_WIN
+ #pragma warning(pop)
+#endif
+
static SkBitmap make_noconfig_bm(int width, int height) {
SkBitmap bm;
bm.setConfig(SkBitmap::kNo_Config, width, height);
diff --git a/gm/blurrect.cpp b/gm/blurrect.cpp
index a1faf94..88863e6 100644
--- a/gm/blurrect.cpp
+++ b/gm/blurrect.cpp
@@ -164,11 +164,11 @@
virtual void onDraw(SkCanvas* canvas) {
SkRect r;
- r.setWH( fRectWidth, fRectHeight );
+ r.setWH(SkIntToScalar(fRectWidth), SkIntToScalar(fRectHeight));
SkMask mask;
- makeMask( &mask, r );
+ makeMask(&mask, r);
SkBitmap bm;
bm.setConfig(SkBitmap::kA8_Config, mask.fBounds.width(), mask.fBounds.height());
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index e313352..19adf26 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -33,7 +33,16 @@
#include "SkTileGridPicture.h"
#include "SamplePipeControllers.h"
+#ifdef SK_BUILD_FOR_WIN
+ // json includes xlocale which generates warning 4530 because we're compiling without
+ // exceptions
+ #pragma warning(push)
+ #pragma warning(disable : 4530)
+#endif
#include "json/value.h"
+#ifdef SK_BUILD_FOR_WIN
+ #pragma warning(pop)
+#endif
#if SK_SUPPORT_GPU
#include "GrContextFactory.h"
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index a14be76..e28985f 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -30,7 +30,7 @@
'msvs_settings': {
'VCCLCompilerTool': {
'WarningLevel': '1',
- 'WarnAsError': 'false',
+ 'WarnAsError': 'true',
'DebugInformationFormat': '3',
'AdditionalOptions': [ '/MP' ],
},
diff --git a/gyp/jsoncpp.gyp b/gyp/jsoncpp.gyp
index f9f5eef..34f05e5 100644
--- a/gyp/jsoncpp.gyp
+++ b/gyp/jsoncpp.gyp
@@ -53,6 +53,13 @@
]
},
}],
+ [ 'skia_os == "win"', {
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'WarnAsError': 'false',
+ },
+ },
+ }],
],
},
],
diff --git a/gyp/utils.gyp b/gyp/utils.gyp
index c76bb7e..cd44769 100644
--- a/gyp/utils.gyp
+++ b/gyp/utils.gyp
@@ -227,6 +227,13 @@
]
},
}],
+ [ 'skia_os == "win"', {
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'WarnAsError': 'false',
+ },
+ },
+ }],
],
},
],
diff --git a/include/core/SkFloatingPoint.h b/include/core/SkFloatingPoint.h
index d388cdb..96270b0 100644
--- a/include/core/SkFloatingPoint.h
+++ b/include/core/SkFloatingPoint.h
@@ -89,8 +89,9 @@
extern const uint32_t gIEEENotANumber;
extern const uint32_t gIEEEInfinity;
+extern const uint32_t gIEEENegativeInfinity;
#define SK_FloatNaN (*reinterpret_cast<const float*>(&gIEEENotANumber))
#define SK_FloatInfinity (*reinterpret_cast<const float*>(&gIEEEInfinity))
-
+#define SK_FloatNegativeInfinity (*reinterpret_cast<const float*>(&gIEEENegativeInfinity))
#endif
diff --git a/include/core/SkScalar.h b/include/core/SkScalar.h
index ea97a79..b775472 100644
--- a/include/core/SkScalar.h
+++ b/include/core/SkScalar.h
@@ -39,6 +39,9 @@
/** SK_ScalarInfinity is defined to be infinity as an SkScalar
*/
#define SK_ScalarInfinity SK_FloatInfinity
+ /** SK_ScalarNegativeInfinity is defined to be negative infinity as an SkScalar
+ */
+ #define SK_ScalarNegativeInfinity SK_FloatNegativeInfinity
/** SK_ScalarMax is defined to be the largest value representable as an SkScalar
*/
#define SK_ScalarMax (3.402823466e+38f)
@@ -220,7 +223,8 @@
#define SK_Scalar1 SK_Fixed1
#define SK_ScalarHalf SK_FixedHalf
- #define SK_ScalarInfinity SK_FixedMax
+ #define SK_ScalarInfinity SK_FixedMax
+ #define SK_ScalarNegativeInfinity SK_FixedMin
#define SK_ScalarMax SK_FixedMax
#define SK_ScalarMin SK_FixedMin
#define SK_ScalarNaN SK_FixedNaN
diff --git a/src/core/SkMath.cpp b/src/core/SkMath.cpp
index ccd96e9..9e7094c 100644
--- a/src/core/SkMath.cpp
+++ b/src/core/SkMath.cpp
@@ -15,6 +15,7 @@
#ifdef SK_SCALAR_IS_FLOAT
const uint32_t gIEEENotANumber = 0x7FFFFFFF;
const uint32_t gIEEEInfinity = 0x7F800000;
+ const uint32_t gIEEENegativeInfinity = 0xFF800000;
#endif
#define sub_shift(zeros, x, n) \
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 6f9a9e6..a83a0a4 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -239,6 +239,7 @@
static void test_path_isfinite(skiatest::Reporter* reporter) {
const SkScalar inf = SK_ScalarInfinity;
+ const SkScalar negInf = SK_ScalarNegativeInfinity;
const SkScalar nan = SK_ScalarNaN;
SkPath path;
@@ -252,7 +253,7 @@
REPORTER_ASSERT(reporter, path.isFinite());
path.reset();
- path.moveTo(inf, -inf);
+ path.moveTo(inf, negInf);
REPORTER_ASSERT(reporter, !path.isFinite());
path.reset();