aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bench/DashBench.cpp2
-rw-r--r--gm/convex_all_line_paths.cpp2
-rw-r--r--gm/pixelsnap.cpp2
-rw-r--r--gm/variedtext.cpp2
-rw-r--r--include/core/SkImageInfo.h4
-rw-r--r--include/core/SkPath.h16
-rw-r--r--include/core/SkTypes.h16
-rw-r--r--include/gpu/GrTypes.h8
-rw-r--r--include/private/SkRecords.h2
-rw-r--r--samplecode/SampleApp.cpp10
-rw-r--r--src/core/SkCanvas.cpp20
-rw-r--r--src/core/SkClipStack.cpp24
-rw-r--r--src/core/SkConvolver.h2
-rw-r--r--src/core/SkImageFilter.cpp4
-rw-r--r--src/core/SkMatrix.cpp10
-rw-r--r--src/core/SkPaint.cpp4
-rw-r--r--src/core/SkPictureRecord.cpp3
-rw-r--r--src/core/SkResourceCache.cpp6
-rw-r--r--src/core/SkStroke.cpp14
-rw-r--r--src/core/SkTextBlob.cpp6
-rw-r--r--src/core/SkTextFormatParams.h10
-rw-r--r--src/core/SkVarAlloc.h2
-rw-r--r--src/core/SkXfermode.cpp2
-rw-r--r--src/effects/SkDropShadowImageFilter.cpp2
-rw-r--r--src/effects/gradients/SkRadialGradient.cpp2
-rw-r--r--src/gpu/GrAtlasTextContext.cpp4
-rw-r--r--src/gpu/GrBatchFontCache.h4
-rw-r--r--src/gpu/GrPath.cpp16
-rw-r--r--src/gpu/GrStrokeInfo.cpp6
-rw-r--r--src/gpu/gl/GrGLPath.cpp2
-rw-r--r--src/images/SkScaledBitmapSampler.cpp4
-rw-r--r--src/pdf/SkPDFDevice.cpp25
-rw-r--r--src/pdf/SkPDFFont.cpp3
-rw-r--r--src/pdf/SkPDFGraphicState.cpp16
-rw-r--r--src/pdf/SkPDFResourceDict.cpp12
-rw-r--r--src/pdf/SkPDFTypes.h2
-rwxr-xr-xsrc/ports/SkFontHost_win.cpp2
-rw-r--r--src/ports/SkFontMgr_android_parser.h8
-rw-r--r--src/ports/SkFontMgr_fontconfig.cpp2
-rw-r--r--src/ports/SkOSFile_posix.cpp2
-rw-r--r--src/ports/SkOSFile_win.cpp2
-rw-r--r--src/sfnt/SkIBMFamilyClass.h2
-rw-r--r--src/sfnt/SkOTTableTypes.h4
-rw-r--r--src/sfnt/SkOTTable_OS_2.h12
-rw-r--r--src/sfnt/SkOTTable_OS_2_V0.h2
-rw-r--r--src/sfnt/SkOTTable_OS_2_V1.h2
-rw-r--r--src/sfnt/SkOTTable_OS_2_V2.h2
-rw-r--r--src/sfnt/SkOTTable_OS_2_V3.h2
-rw-r--r--src/sfnt/SkOTTable_OS_2_V4.h2
-rw-r--r--src/sfnt/SkOTTable_OS_2_VA.h2
-rw-r--r--src/sfnt/SkOTTable_gasp.h4
-rw-r--r--src/sfnt/SkOTTable_head.h4
-rw-r--r--src/sfnt/SkOTTable_hhea.h4
-rw-r--r--src/sfnt/SkOTTable_maxp_CFF.h4
-rw-r--r--src/sfnt/SkOTTable_maxp_TT.h4
-rw-r--r--src/sfnt/SkOTTable_name.h8
-rw-r--r--src/sfnt/SkOTTable_post.h4
-rw-r--r--src/sfnt/SkPanose.h2
-rw-r--r--src/sfnt/SkSFNTHeader.h4
-rw-r--r--src/sfnt/SkTTCFHeader.h2
-rw-r--r--src/svg/SkSVGDevice.cpp8
-rw-r--r--src/utils/SkTFitsIn.h8
-rw-r--r--src/views/mac/SkNSView.mm2
-rw-r--r--src/views/mac/SkOSWindow_Mac.mm2
-rw-r--r--tests/ImageDecodingTest.cpp4
-rw-r--r--tools/PictureRenderer.h11
66 files changed, 181 insertions, 209 deletions
diff --git a/bench/DashBench.cpp b/bench/DashBench.cpp
index bf0d456143..e54d038768 100644
--- a/bench/DashBench.cpp
+++ b/bench/DashBench.cpp
@@ -311,7 +311,7 @@ public:
static const char* LineTypeName(LineType lt) {
static const char* gNames[] = { "hori", "vert", "diag" };
- SK_COMPILE_ASSERT(kLineTypeCount == SK_ARRAY_COUNT(gNames), names_wrong_size);
+ static_assert(kLineTypeCount == SK_ARRAY_COUNT(gNames), "names_wrong_size");
return gNames[lt];
}
diff --git a/gm/convex_all_line_paths.cpp b/gm/convex_all_line_paths.cpp
index a93a7f6e47..435a37a10a 100644
--- a/gm/convex_all_line_paths.cpp
+++ b/gm/convex_all_line_paths.cpp
@@ -163,7 +163,7 @@ protected:
SK_ARRAY_COUNT(gPoints9),
SK_ARRAY_COUNT(gPoints10),
};
- SK_COMPILE_ASSERT(SK_ARRAY_COUNT(gSizes) == SK_ARRAY_COUNT(gPoints), array_mismatch);
+ static_assert(SK_ARRAY_COUNT(gSizes) == SK_ARRAY_COUNT(gPoints), "array_mismatch");
SkAutoTDeleteArray<SkPoint> data(NULL);
const SkPoint* points;
diff --git a/gm/pixelsnap.cpp b/gm/pixelsnap.cpp
index 3358e9d410..ea85a948ac 100644
--- a/gm/pixelsnap.cpp
+++ b/gm/pixelsnap.cpp
@@ -23,7 +23,7 @@ protected:
static const int kSubPixelSteps = 8;
static const int kLabelTextSize = 9;
- SK_COMPILE_ASSERT(kSubPixelSteps < 99, label_offset_too_small);
+ static_assert(kSubPixelSteps < 99, "label_offset_too_small");
static const int kLabelOffsetX = 2 * kLabelTextSize + kLabelPad;
static const int kLabelOffsetY = kLabelTextSize + kLabelPad;
diff --git a/gm/variedtext.cpp b/gm/variedtext.cpp
index 97b3f577e5..887a7c30d0 100644
--- a/gm/variedtext.cpp
+++ b/gm/variedtext.cpp
@@ -58,7 +58,7 @@ protected:
SkScalar w = SkIntToScalar(size.fWidth);
SkScalar h = SkIntToScalar(size.fHeight);
- SK_COMPILE_ASSERT(4 == SK_ARRAY_COUNT(fTypefacesToUnref), typeface_cnt);
+ static_assert(4 == SK_ARRAY_COUNT(fTypefacesToUnref), "typeface_cnt");
fTypefacesToUnref[0] = sk_tool_utils::create_portable_typeface("sans-serif", SkTypeface::kNormal);
fTypefacesToUnref[1] = sk_tool_utils::create_portable_typeface("sans-serif", SkTypeface::kBold);
fTypefacesToUnref[2] = sk_tool_utils::create_portable_typeface("serif", SkTypeface::kNormal);
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h
index 7b48c3a430..0218a74310 100644
--- a/include/core/SkImageInfo.h
+++ b/include/core/SkImageInfo.h
@@ -112,8 +112,8 @@ static int SkColorTypeBytesPerPixel(SkColorType ct) {
1, // kIndex_8
1, // kGray_8
};
- SK_COMPILE_ASSERT(SK_ARRAY_COUNT(gSize) == (size_t)(kLastEnum_SkColorType + 1),
- size_mismatch_with_SkColorType_enum);
+ static_assert(SK_ARRAY_COUNT(gSize) == (size_t)(kLastEnum_SkColorType + 1),
+ "size_mismatch_with_SkColorType_enum");
SkASSERT((size_t)ct < SK_ARRAY_COUNT(gSize));
return gSize[ct];
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index dc50ae76c3..caf4cfe5ec 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -505,10 +505,10 @@ public:
* kInverseEvenOdd_FillType -> true
*/
static bool IsInverseFillType(FillType fill) {
- SK_COMPILE_ASSERT(0 == kWinding_FillType, fill_type_mismatch);
- SK_COMPILE_ASSERT(1 == kEvenOdd_FillType, fill_type_mismatch);
- SK_COMPILE_ASSERT(2 == kInverseWinding_FillType, fill_type_mismatch);
- SK_COMPILE_ASSERT(3 == kInverseEvenOdd_FillType, fill_type_mismatch);
+ static_assert(0 == kWinding_FillType, "fill_type_mismatch");
+ static_assert(1 == kEvenOdd_FillType, "fill_type_mismatch");
+ static_assert(2 == kInverseWinding_FillType, "fill_type_mismatch");
+ static_assert(3 == kInverseEvenOdd_FillType, "fill_type_mismatch");
return (fill & 2) != 0;
}
@@ -521,10 +521,10 @@ public:
* kInverseEvenOdd_FillType -> kEvenOdd_FillType
*/
static FillType ConvertToNonInverseFillType(FillType fill) {
- SK_COMPILE_ASSERT(0 == kWinding_FillType, fill_type_mismatch);
- SK_COMPILE_ASSERT(1 == kEvenOdd_FillType, fill_type_mismatch);
- SK_COMPILE_ASSERT(2 == kInverseWinding_FillType, fill_type_mismatch);
- SK_COMPILE_ASSERT(3 == kInverseEvenOdd_FillType, fill_type_mismatch);
+ static_assert(0 == kWinding_FillType, "fill_type_mismatch");
+ static_assert(1 == kEvenOdd_FillType, "fill_type_mismatch");
+ static_assert(2 == kInverseWinding_FillType, "fill_type_mismatch");
+ static_assert(3 == kInverseEvenOdd_FillType, "fill_type_mismatch");
return (FillType)(fill & 1);
}
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index 2e495117d8..bed33fb8b2 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -154,20 +154,6 @@ inline void operator delete(void* p) {
#define SK_TO_STRING_OVERRIDE() void toString(SkString* str) const override;
#endif
-template <bool>
-struct SkCompileAssert {
-};
-
-// Uses static_cast<bool>(expr) instead of bool(expr) due to
-// https://connect.microsoft.com/VisualStudio/feedback/details/832915
-
-// The extra parentheses in SkCompileAssert<(...)> are a work around for
-// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57771
-// which was fixed in gcc 4.8.2.
-#define SK_COMPILE_ASSERT(expr, msg) \
- typedef SkCompileAssert<(static_cast<bool>(expr))> \
- msg[static_cast<bool>(expr) ? 1 : -1] SK_UNUSED
-
/*
* Usage: SK_MACRO_CONCAT(a, b) to construct the symbol ab
*
@@ -209,7 +195,7 @@ struct SkCompileAssert {
* Take a look at SkAutoFree and SkAutoMalloc in this file for examples.
*/
#define SK_REQUIRE_LOCAL_VAR(classname) \
- SK_COMPILE_ASSERT(false, missing_name_for_##classname)
+ static_assert(false, "missing name for " #classname)
///////////////////////////////////////////////////////////////////////
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index f516388874..ed4827d627 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -185,10 +185,10 @@ static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) {
// kA565 (1) -> 2
// kARGB (2) -> 4
static const int sBytesPerPixel[] = { 1, 2, 4 };
- SK_COMPILE_ASSERT(SK_ARRAY_COUNT(sBytesPerPixel) == kMaskFormatCount, array_size_mismatch);
- SK_COMPILE_ASSERT(kA8_GrMaskFormat == 0, enum_order_dependency);
- SK_COMPILE_ASSERT(kA565_GrMaskFormat == 1, enum_order_dependency);
- SK_COMPILE_ASSERT(kARGB_GrMaskFormat == 2, enum_order_dependency);
+ static_assert(SK_ARRAY_COUNT(sBytesPerPixel) == kMaskFormatCount, "array_size_mismatch");
+ static_assert(kA8_GrMaskFormat == 0, "enum_order_dependency");
+ static_assert(kA565_GrMaskFormat == 1, "enum_order_dependency");
+ static_assert(kARGB_GrMaskFormat == 2, "enum_order_dependency");
return sBytesPerPixel[(int) format];
}
diff --git a/include/private/SkRecords.h b/include/private/SkRecords.h
index 1f2807842c..4268bb469c 100644
--- a/include/private/SkRecords.h
+++ b/include/private/SkRecords.h
@@ -247,7 +247,7 @@ struct RegionOpAndAA {
SkRegion::Op op : 31; // This really only needs to be 3, but there's no win today to do so.
unsigned aa : 1; // MSVC won't pack an enum with an bool, so we call this an unsigned.
};
-SK_COMPILE_ASSERT(sizeof(RegionOpAndAA) == 4, RegionOpAndAASize);
+static_assert(sizeof(RegionOpAndAA) == 4, "RegionOpAndAASize");
RECORD3(ClipPath, SkIRect, devBounds, PreCachedPath, path, RegionOpAndAA, opAA);
RECORD3(ClipRRect, SkIRect, devBounds, SkRRect, rrect, RegionOpAndAA, opAA);
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index c985b1eb09..1d4bd1e705 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -598,8 +598,8 @@ static const struct TilingInfo gTilingInfo[] = {
{ "1/1x1/16" , SK_Scalar1 , SK_Scalar1 / 16 }, // kRel_1x16_Tiling
{ "1/16x1/1" , SK_Scalar1 / 16 , SK_Scalar1 }, // kRel_16x1_Tiling
};
-SK_COMPILE_ASSERT((SK_ARRAY_COUNT(gTilingInfo) == kLast_TilingMode_Enum),
- Incomplete_tiling_labels);
+static_assert((SK_ARRAY_COUNT(gTilingInfo) == kLast_TilingMode_Enum),
+ "Incomplete_tiling_labels");
SkSize SampleWindow::tileSize() const {
SkASSERT((TilingMode)fTilingMode < kLast_TilingMode_Enum);
@@ -673,7 +673,7 @@ static inline SampleWindow::DeviceType cycle_devicetype(SampleWindow::DeviceType
#endif // SK_SUPPORT_GPU
SampleWindow::kRaster_DeviceType,
};
- SK_COMPILE_ASSERT(SK_ARRAY_COUNT(gCT) == SampleWindow::kDeviceTypeCnt, array_size_mismatch);
+ static_assert(SK_ARRAY_COUNT(gCT) == SampleWindow::kDeviceTypeCnt, "array_size_mismatch");
return gCT[ct];
}
@@ -1942,8 +1942,8 @@ static const char* gDeviceTypePrefix[] = {
#endif // SK_ANGLE
#endif // SK_SUPPORT_GPU
};
-SK_COMPILE_ASSERT(SK_ARRAY_COUNT(gDeviceTypePrefix) == SampleWindow::kDeviceTypeCnt,
- array_size_mismatch);
+static_assert(SK_ARRAY_COUNT(gDeviceTypePrefix) == SampleWindow::kDeviceTypeCnt,
+ "array_size_mismatch");
static const char* trystate_str(SkOSMenu::TriState state,
const char trueStr[], const char falseStr[]) {
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index fe6694d154..02afe92e33 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -48,15 +48,15 @@
*/
bool SkCanvas::wouldOverwriteEntireSurface(const SkRect* rect, const SkPaint* paint,
ShaderOverrideOpacity overrideOpacity) const {
- SK_COMPILE_ASSERT((int)SkPaintPriv::kNone_ShaderOverrideOpacity ==
- (int)kNone_ShaderOverrideOpacity,
- need_matching_enums0);
- SK_COMPILE_ASSERT((int)SkPaintPriv::kOpaque_ShaderOverrideOpacity ==
- (int)kOpaque_ShaderOverrideOpacity,
- need_matching_enums1);
- SK_COMPILE_ASSERT((int)SkPaintPriv::kNotOpaque_ShaderOverrideOpacity ==
- (int)kNotOpaque_ShaderOverrideOpacity,
- need_matching_enums2);
+ static_assert((int)SkPaintPriv::kNone_ShaderOverrideOpacity ==
+ (int)kNone_ShaderOverrideOpacity,
+ "need_matching_enums0");
+ static_assert((int)SkPaintPriv::kOpaque_ShaderOverrideOpacity ==
+ (int)kOpaque_ShaderOverrideOpacity,
+ "need_matching_enums1");
+ static_assert((int)SkPaintPriv::kNotOpaque_ShaderOverrideOpacity ==
+ (int)kNotOpaque_ShaderOverrideOpacity,
+ "need_matching_enums2");
const SkISize size = this->getBaseLayerSize();
const SkRect bounds = SkRect::MakeIWH(size.width(), size.height());
@@ -2791,7 +2791,7 @@ void SkCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix,
///////////////////////////////////////////////////////////////////////////////
SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) {
- SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small);
+ static_assert(sizeof(fStorage) >= sizeof(SkDrawIter), "fStorage_too_small");
SkASSERT(canvas);
diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp
index c4c68ced08..c359e87f21 100644
--- a/src/core/SkClipStack.cpp
+++ b/src/core/SkClipStack.cpp
@@ -862,11 +862,11 @@ void SkClipStack::Element::dump() const {
"rrect",
"path"
};
- SK_COMPILE_ASSERT(0 == kEmpty_Type, type_str);
- SK_COMPILE_ASSERT(1 == kRect_Type, type_str);
- SK_COMPILE_ASSERT(2 == kRRect_Type, type_str);
- SK_COMPILE_ASSERT(3 == kPath_Type, type_str);
- SK_COMPILE_ASSERT(SK_ARRAY_COUNT(kTypeStrings) == kTypeCnt, type_str);
+ static_assert(0 == kEmpty_Type, "type_str");
+ static_assert(1 == kRect_Type, "type_str");
+ static_assert(2 == kRRect_Type, "type_str");
+ static_assert(3 == kPath_Type, "type_str");
+ static_assert(SK_ARRAY_COUNT(kTypeStrings) == kTypeCnt, "type_str");
static const char* kOpStrings[] = {
"difference",
@@ -876,13 +876,13 @@ void SkClipStack::Element::dump() const {
"reverse-difference",
"replace",
};
- SK_COMPILE_ASSERT(0 == SkRegion::kDifference_Op, op_str);
- SK_COMPILE_ASSERT(1 == SkRegion::kIntersect_Op, op_str);
- SK_COMPILE_ASSERT(2 == SkRegion::kUnion_Op, op_str);
- SK_COMPILE_ASSERT(3 == SkRegion::kXOR_Op, op_str);
- SK_COMPILE_ASSERT(4 == SkRegion::kReverseDifference_Op, op_str);
- SK_COMPILE_ASSERT(5 == SkRegion::kReplace_Op, op_str);
- SK_COMPILE_ASSERT(SK_ARRAY_COUNT(kOpStrings) == SkRegion::kOpCnt, op_str);
+ static_assert(0 == SkRegion::kDifference_Op, "op_str");
+ static_assert(1 == SkRegion::kIntersect_Op, "op_str");
+ static_assert(2 == SkRegion::kUnion_Op, "op_str");
+ static_assert(3 == SkRegion::kXOR_Op, "op_str");
+ static_assert(4 == SkRegion::kReverseDifference_Op, "op_str");
+ static_assert(5 == SkRegion::kReplace_Op, "op_str");
+ static_assert(SK_ARRAY_COUNT(kOpStrings) == SkRegion::kOpCnt, "op_str");
SkDebugf("Type: %s, Op: %s, AA: %s, Save Count: %d\n", kTypeStrings[fType],
kOpStrings[fOp], (fDoAA ? "yes" : "no"), fSaveCount);
diff --git a/src/core/SkConvolver.h b/src/core/SkConvolver.h
index 21419a9400..4beb7550f7 100644
--- a/src/core/SkConvolver.h
+++ b/src/core/SkConvolver.h
@@ -46,7 +46,7 @@ public:
// The cast relies on ConvolutionFixed being a short, implying that on
// the platforms we care about all (16) bits will fit into
// the mantissa of a (32-bit) float.
- SK_COMPILE_ASSERT(sizeof(ConvolutionFixed) == 2, ConvolutionFixed_type_should_fit_in_float_mantissa);
+ static_assert(sizeof(ConvolutionFixed) == 2, "ConvolutionFixed_type_should_fit_in_float_mantissa");
float raw = static_cast<float>(x);
return ldexpf(raw, -kShiftBits);
}
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 5f9fa64110..5157db2dc9 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -106,8 +106,8 @@ struct SkImageFilter::Cache::Key {
Key(const uint32_t uniqueID, const SkMatrix& matrix, const SkIRect& clipBounds, uint32_t srcGenID)
: fUniqueID(uniqueID), fMatrix(matrix), fClipBounds(clipBounds), fSrcGenID(srcGenID) {
// Assert that Key is tightly-packed, since it is hashed.
- SK_COMPILE_ASSERT(sizeof(Key) == sizeof(uint32_t) + sizeof(SkMatrix) + sizeof(SkIRect) +
- sizeof(uint32_t), image_filter_key_tight_packing);
+ static_assert(sizeof(Key) == sizeof(uint32_t) + sizeof(SkMatrix) + sizeof(SkIRect) +
+ sizeof(uint32_t), "image_filter_key_tight_packing");
fMatrix.getType(); // force initialization of type, so hashes match
}
uint32_t fUniqueID;
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index 31ff4b15e3..e030560626 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -1592,13 +1592,13 @@ struct PODMatrix {
const SkMatrix& asSkMatrix() const { return *reinterpret_cast<const SkMatrix*>(this); }
};
-SK_COMPILE_ASSERT(sizeof(PODMatrix) == sizeof(SkMatrix), PODMatrixSizeMismatch);
+static_assert(sizeof(PODMatrix) == sizeof(SkMatrix), "PODMatrixSizeMismatch");
} // namespace
const SkMatrix& SkMatrix::I() {
- SK_COMPILE_ASSERT(offsetof(SkMatrix, fMat) == offsetof(PODMatrix, matrix), BadfMat);
- SK_COMPILE_ASSERT(offsetof(SkMatrix, fTypeMask) == offsetof(PODMatrix, typemask), BadfTypeMask);
+ static_assert(offsetof(SkMatrix, fMat) == offsetof(PODMatrix, matrix), "BadfMat");
+ static_assert(offsetof(SkMatrix, fTypeMask) == offsetof(PODMatrix, typemask), "BadfTypeMask");
static const PODMatrix identity = { {SK_Scalar1, 0, 0,
0, SK_Scalar1, 0,
@@ -1609,8 +1609,8 @@ const SkMatrix& SkMatrix::I() {
}
const SkMatrix& SkMatrix::InvalidMatrix() {
- SK_COMPILE_ASSERT(offsetof(SkMatrix, fMat) == offsetof(PODMatrix, matrix), BadfMat);
- SK_COMPILE_ASSERT(offsetof(SkMatrix, fTypeMask) == offsetof(PODMatrix, typemask), BadfTypeMask);
+ static_assert(offsetof(SkMatrix, fMat) == offsetof(PODMatrix, matrix), "BadfMat");
+ static_assert(offsetof(SkMatrix, fTypeMask) == offsetof(PODMatrix, typemask), "BadfTypeMask");
static const PODMatrix invalid =
{ {SK_ScalarMax, SK_ScalarMax, SK_ScalarMax,
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 4ab8927114..4400994000 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -2429,8 +2429,8 @@ bool SkPaint::nothingToDraw() const {
uint32_t SkPaint::getHash() const {
// We're going to hash 10 pointers and 7 32-bit values, finishing up with fBitfields,
// so fBitfields should be 10 pointers and 6 32-bit values from the start.
- SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * sizeof(uint32_t),
- SkPaint_notPackedTightly);
+ static_assert(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * sizeof(uint32_t),
+ "SkPaint_notPackedTightly");
return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this),
offsetof(SkPaint, fBitfields) + sizeof(fBitfields));
}
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 55262ad571..2281d16145 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -105,8 +105,7 @@ static inline size_t get_paint_offset(DrawType op, size_t opSize) {
1, // DRAW_IMAGE_RECT - right after op code
};
- SK_COMPILE_ASSERT(sizeof(gPaintOffsets) == LAST_DRAWTYPE_ENUM + 1,
- need_to_be_in_sync);
+ static_assert(sizeof(gPaintOffsets) == LAST_DRAWTYPE_ENUM + 1, "need_to_be_in_sync");
SkASSERT((unsigned)op <= (unsigned)LAST_DRAWTYPE_ENUM);
int overflow = 0;
diff --git a/src/core/SkResourceCache.cpp b/src/core/SkResourceCache.cpp
index 6febbd2971..70dc8f97d8 100644
--- a/src/core/SkResourceCache.cpp
+++ b/src/core/SkResourceCache.cpp
@@ -36,9 +36,9 @@ void SkResourceCache::Key::init(void* nameSpace, uint64_t sharedID, size_t lengt
static const int kHashedLocal32s = kSharedIDLocal32s + (sizeof(fNamespace) >> 2);
static const int kLocal32s = kUnhashedLocal32s + kHashedLocal32s;
- SK_COMPILE_ASSERT(sizeof(Key) == (kLocal32s << 2), unaccounted_key_locals);
- SK_COMPILE_ASSERT(sizeof(Key) == offsetof(Key, fNamespace) + sizeof(fNamespace),
- namespace_field_must_be_last);
+ static_assert(sizeof(Key) == (kLocal32s << 2), "unaccounted_key_locals");
+ static_assert(sizeof(Key) == offsetof(Key, fNamespace) + sizeof(fNamespace),
+ "namespace_field_must_be_last");
fCount32 = SkToS32(kLocal32s + (length >> 2));
fSharedID_lo = (uint32_t)sharedID;
diff --git a/src/core/SkStroke.cpp b/src/core/SkStroke.cpp
index d21dc96713..ede3d21055 100644
--- a/src/core/SkStroke.cpp
+++ b/src/core/SkStroke.cpp
@@ -21,10 +21,10 @@ enum {
// largest seen for normal quads : 11
static const int kRecursiveLimits[] = { 5*3, 26*3, 11*3, 11*3 }; // 3x limits seen in practice
-SK_COMPILE_ASSERT(0 == kTangent_RecursiveLimit, cubic_stroke_relies_on_tangent_equalling_zero);
-SK_COMPILE_ASSERT(1 == kCubic_RecursiveLimit, cubic_stroke_relies_on_cubic_equalling_one);
-SK_COMPILE_ASSERT(SK_ARRAY_COUNT(kRecursiveLimits) == kQuad_RecursiveLimit + 1,
- recursive_limits_mismatch);
+static_assert(0 == kTangent_RecursiveLimit, "cubic_stroke_relies_on_tangent_equalling_zero");
+static_assert(1 == kCubic_RecursiveLimit, "cubic_stroke_relies_on_cubic_equalling_one");
+static_assert(SK_ARRAY_COUNT(kRecursiveLimits) == kQuad_RecursiveLimit + 1,
+ "recursive_limits_mismatch");
#ifdef SK_DEBUG
int gMaxRecursion[SK_ARRAY_COUNT(kRecursiveLimits)] = { 0 };
@@ -544,9 +544,9 @@ SkPathStroker::ReductionType SkPathStroker::CheckCubicLinear(const SkPoint cubic
SkScalar t = tValues[index];
SkEvalCubicAt(cubic, t, &reduction[index], NULL, NULL);
}
- SK_COMPILE_ASSERT(kQuad_ReductionType + 1 == kDegenerate_ReductionType, enum_out_of_whack);
- SK_COMPILE_ASSERT(kQuad_ReductionType + 2 == kDegenerate2_ReductionType, enum_out_of_whack);
- SK_COMPILE_ASSERT(kQuad_ReductionType + 3 == kDegenerate3_ReductionType, enum_out_of_whack);
+ static_assert(kQuad_ReductionType + 1 == kDegenerate_ReductionType, "enum_out_of_whack");
+ static_assert(kQuad_ReductionType + 2 == kDegenerate2_ReductionType, "enum_out_of_whack");
+ static_assert(kQuad_ReductionType + 3 == kDegenerate3_ReductionType, "enum_out_of_whack");
return (ReductionType) (kQuad_ReductionType + count);
}
diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp
index d1a77e74f7..d2b1605e95 100644
--- a/src/core/SkTextBlob.cpp
+++ b/src/core/SkTextBlob.cpp
@@ -73,9 +73,9 @@ private:
SkAutoTUnref<SkTypeface> fTypeface;
SkScalar fSkewX;
- SK_COMPILE_ASSERT(SkPaint::kFull_Hinting < 4, insufficient_hinting_bits);
+ static_assert(SkPaint::kFull_Hinting < 4, "insufficient_hinting_bits");
uint32_t fHinting : 2;
- SK_COMPILE_ASSERT((kFlagsMask & 0xffff) == kFlagsMask, insufficient_flags_bits);
+ static_assert((kFlagsMask & 0xffff) == kFlagsMask, "insufficient_flags_bits");
uint32_t fFlags : 16;
typedef SkNoncopyable INHERITED;
@@ -87,7 +87,7 @@ struct RunFontStorageEquivalent {
SkScalar fSkewX;
uint32_t fFlags;
};
-SK_COMPILE_ASSERT(sizeof(RunFont) == sizeof(RunFontStorageEquivalent), runfont_should_stay_packed);
+static_assert(sizeof(RunFont) == sizeof(RunFontStorageEquivalent), "runfont_should_stay_packed");
} // anonymous namespace
diff --git a/src/core/SkTextFormatParams.h b/src/core/SkTextFormatParams.h
index dac4aefd62..f41c4de1d5 100644
--- a/src/core/SkTextFormatParams.h
+++ b/src/core/SkTextFormatParams.h
@@ -30,12 +30,10 @@ static const SkScalar kStdFakeBoldInterpKeys[] = {
};
static const SkScalar kStdFakeBoldInterpValues[] = {
SK_Scalar1/24,
- SK_Scalar1/32
+ SK_Scalar1/32,
};
-SK_COMPILE_ASSERT(SK_ARRAY_COUNT(kStdFakeBoldInterpKeys) ==
- SK_ARRAY_COUNT(kStdFakeBoldInterpValues),
- mismatched_array_size);
-static const int kStdFakeBoldInterpLength =
- SK_ARRAY_COUNT(kStdFakeBoldInterpKeys);
+static_assert(SK_ARRAY_COUNT(kStdFakeBoldInterpKeys) == SK_ARRAY_COUNT(kStdFakeBoldInterpValues),
+ "mismatched_array_size");
+static const int kStdFakeBoldInterpLength = SK_ARRAY_COUNT(kStdFakeBoldInterpKeys);
#endif //SkTextFormatParams_DEFINES
diff --git a/src/core/SkVarAlloc.h b/src/core/SkVarAlloc.h
index e8236cf992..0d0984285b 100644
--- a/src/core/SkVarAlloc.h
+++ b/src/core/SkVarAlloc.h
@@ -50,6 +50,6 @@ private:
struct Block;
Block* fBlock;
};
-SK_COMPILE_ASSERT(sizeof(SkVarAlloc) <= 32, SkVarAllocSize);
+static_assert(sizeof(SkVarAlloc) <= 32, "SkVarAllocSize");
#endif//SkVarAlloc_DEFINED
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index 59b689ceeb..c9a81226a4 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -966,7 +966,7 @@ const char* SkXfermode::ModeName(Mode mode) {
"Multiply", "Hue", "Saturation", "Color", "Luminosity"
};
return gModeStrings[mode];
- SK_COMPILE_ASSERT(SK_ARRAY_COUNT(gModeStrings) == kLastMode + 1, mode_count);
+ static_assert(SK_ARRAY_COUNT(gModeStrings) == kLastMode + 1, "mode_count");
}
#ifndef SK_IGNORE_TO_STRING
diff --git a/src/effects/SkDropShadowImageFilter.cpp b/src/effects/SkDropShadowImageFilter.cpp
index c453411d80..fb3ea319c6 100644
--- a/src/effects/SkDropShadowImageFilter.cpp
+++ b/src/effects/SkDropShadowImageFilter.cpp
@@ -153,7 +153,7 @@ void SkDropShadowImageFilter::toString(SkString* str) const {
"kDrawShadowAndForeground", "kDrawShadowOnly"
};
- SK_COMPILE_ASSERT(kShadowModeCount == SK_ARRAY_COUNT(gModeStrings), enum_mismatch);
+ static_assert(kShadowModeCount == SK_ARRAY_COUNT(gModeStrings), "enum_mismatch");
str->appendf(" mode: %s", gModeStrings[fShadowMode]);
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index a6a00cdf7b..1b995cb44f 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -13,7 +13,7 @@
#define kSQRT_TABLE_BITS 11
#define kSQRT_TABLE_SIZE (1 << kSQRT_TABLE_BITS)
-SK_COMPILE_ASSERT(sizeof(gSqrt8Table) == kSQRT_TABLE_SIZE, SqrtTableSizesMatch);
+static_assert(sizeof(gSqrt8Table) == kSQRT_TABLE_SIZE, "SqrtTableSizesMatch");
#if 0
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index a556128be5..aa4c51d85a 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -103,8 +103,8 @@ GrAtlasTextContext::GrAtlasTextContext(GrContext* context,
, fDistanceAdjustTable(SkNEW(DistanceAdjustTable)) {
// We overallocate vertices in our textblobs based on the assumption that A8 has the greatest
// vertexStride
- SK_COMPILE_ASSERT(kGrayTextVASize >= kColorTextVASize && kGrayTextVASize >= kLCDTextVASize,
- vertex_attribute_changed);
+ static_assert(kGrayTextVASize >= kColorTextVASize && kGrayTextVASize >= kLCDTextVASize,
+ "vertex_attribute_changed");
fCurrStrike = NULL;
fCache = context->getTextBlobCache();
}
diff --git a/src/gpu/GrBatchFontCache.h b/src/gpu/GrBatchFontCache.h
index fc2f3b7a29..32c3281a71 100644
--- a/src/gpu/GrBatchFontCache.h
+++ b/src/gpu/GrBatchFontCache.h
@@ -179,7 +179,7 @@ private:
kRGB_565_GrPixelConfig,
kSkia8888_GrPixelConfig
};
- SK_COMPILE_ASSERT(SK_ARRAY_COUNT(kPixelConfigs) == kMaskFormatCount, array_size_mismatch);
+ static_assert(SK_ARRAY_COUNT(kPixelConfigs) == kMaskFormatCount, "array_size_mismatch");
return kPixelConfigs[format];
}
@@ -191,7 +191,7 @@ private:
kA565_GrMaskFormat,
kARGB_GrMaskFormat,
};
- SK_COMPILE_ASSERT(SK_ARRAY_COUNT(sAtlasIndices) == kMaskFormatCount, array_size_mismatch);
+ static_assert(SK_ARRAY_COUNT(sAtlasIndices) == kMaskFormatCount, "array_size_mismatch");
SkASSERT(sAtlasIndices[format] < kMaskFormatCount);
return sAtlasIndices[format];
diff --git a/src/gpu/GrPath.cpp b/src/gpu/GrPath.cpp
index 421edd32ea..4e1119dfbb 100644
--- a/src/gpu/GrPath.cpp
+++ b/src/gpu/GrPath.cpp
@@ -18,8 +18,8 @@ inline static bool compute_key_for_line_path(const SkPath& path, const GrStrokeI
if (!path.isLine(pts)) {
return false;
}
- SK_COMPILE_ASSERT((sizeof(pts) % sizeof(uint32_t)) == 0 && sizeof(pts) > sizeof(uint32_t),
- pts_needs_padding);
+ static_assert((sizeof(pts) % sizeof(uint32_t)) == 0 && sizeof(pts) > sizeof(uint32_t),
+ "pts_needs_padding");
const int kBaseData32Cnt = 1 + sizeof(pts) / sizeof(uint32_t);
int strokeDataCnt = stroke.computeUniqueKeyFragmentData32Cnt();
@@ -39,8 +39,8 @@ inline static bool compute_key_for_oval_path(const SkPath& path, const GrStrokeI
if (!path.isOval(&rect)) {
return false;
}
- SK_COMPILE_ASSERT((sizeof(rect) % sizeof(uint32_t)) == 0 && sizeof(rect) > sizeof(uint32_t),
- rect_needs_padding);
+ static_assert((sizeof(rect) % sizeof(uint32_t)) == 0 && sizeof(rect) > sizeof(uint32_t),
+ "rect_needs_padding");
const int kBaseData32Cnt = 1 + sizeof(rect) / sizeof(uint32_t);
int strokeDataCnt = stroke.computeUniqueKeyFragmentData32Cnt();
@@ -69,8 +69,8 @@ inline static bool compute_key_for_simple_path(const SkPath& path, const GrStrok
}
// If somebody goes wild with the constant, it might cause an overflow.
- SK_COMPILE_ASSERT(kSimpleVolatilePathVerbLimit <= 100,
- big_simple_volatile_path_verb_limit_may_cause_overflow);
+ static_assert(kSimpleVolatilePathVerbLimit <= 100,
+ "big_simple_volatile_path_verb_limit_may_cause_overflow");
const int pointCnt = path.countPoints();
if (pointCnt < 0) {
@@ -121,8 +121,8 @@ inline static bool compute_key_for_simple_path(const SkPath& path, const GrStrok
path.getVerbs(reinterpret_cast<uint8_t*>(&builder[i]), verbCnt);
i += verbData32Cnt;
- SK_COMPILE_ASSERT(((sizeof(SkPoint) % sizeof(uint32_t)) == 0) &&
- sizeof(SkPoint) > sizeof(uint32_t), skpoint_array_needs_padding);
+ static_assert(((sizeof(SkPoint) % sizeof(uint32_t)) == 0) && sizeof(SkPoint) > sizeof(uint32_t),
+ "skpoint_array_needs_padding");
// Here we assume getPoints does a memcpy, so that we do not need to worry about the alignment.
path.getPoints(reinterpret_cast<SkPoint*>(&builder[i]), pointCnt);
diff --git a/src/gpu/GrStrokeInfo.cpp b/src/gpu/GrStrokeInfo.cpp
index 0ad4179add..03483afec7 100644
--- a/src/gpu/GrStrokeInfo.cpp
+++ b/src/gpu/GrStrokeInfo.cpp
@@ -36,9 +36,9 @@ void GrStrokeInfo::asUniqueKeyFragment(uint32_t* data) const {
kCapShift = kJoinShift + kJoinBits,
};
- SK_COMPILE_ASSERT(SkStrokeRec::kStyleCount <= (1 << kStyleBits), style_shift_will_be_wrong);
- SK_COMPILE_ASSERT(SkPaint::kJoinCount <= (1 << kJoinBits), cap_shift_will_be_wrong);
- SK_COMPILE_ASSERT(SkPaint::kCapCount <= (1 << kCapBits), cap_does_not_fit);
+ static_assert(SkStrokeRec::kStyleCount <= (1 << kStyleBits), "style_shift_will_be_wrong");
+ static_assert(SkPaint::kJoinCount <= (1 << kJoinBits), "cap_shift_will_be_wrong");
+ static_assert(SkPaint::kCapCount <= (1 << kCapBits), "cap_does_not_fit");
uint32_t styleKey = this->getStyle();
if (this->needToApply()) {
styleKey |= this->getJoin() << kJoinShift;
diff --git a/src/gpu/gl/GrGLPath.cpp b/src/gpu/gl/GrGLPath.cpp
index 0b35a7007f..9a4aa0cbef 100644
--- a/src/gpu/gl/GrGLPath.cpp
+++ b/src/gpu/gl/GrGLPath.cpp
@@ -105,7 +105,7 @@ void GrGLPath::InitPathObject(GrGLGpu* gpu,
if ((skPath.getSegmentMasks() & SkPath::kConic_SegmentMask) == 0) {
// This branch does type punning, converting SkPoint* to GrGLfloat*.
- SK_COMPILE_ASSERT(sizeof(SkPoint) == sizeof(GrGLfloat) * 2, sk_point_not_two_floats);
+ static_assert(sizeof(SkPoint) == sizeof(GrGLfloat) * 2, "sk_point_not_two_floats");
// This branch does not convert with SkScalarToFloat.
#ifndef SK_SCALAR_IS_FLOAT
#error Need SK_SCALAR_IS_FLOAT.
diff --git a/src/images/SkScaledBitmapSampler.cpp b/src/images/SkScaledBitmapSampler.cpp
index f79eb6f905..1d8d98dafd 100644
--- a/src/images/SkScaledBitmapSampler.cpp
+++ b/src/images/SkScaledBitmapSampler.cpp
@@ -660,8 +660,8 @@ bool SkScaledBitmapSampler::begin(SkBitmap* dst, SrcConfig sc,
// The jump between dst configs in the table
static const int gProcDstConfigSpan = 5;
- SK_COMPILE_ASSERT(SK_ARRAY_COUNT(gProcChoosers) == 5 * gProcDstConfigSpan,
- gProcs_has_the_wrong_number_of_entries);
+ static_assert(SK_ARRAY_COUNT(gProcChoosers) == 5 * gProcDstConfigSpan,
+ "gProcs_has_the_wrong_number_of_entries");
fCTable = ctable;
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index fa3bc4afcc..179e02b846 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -353,17 +353,12 @@ static bool calculate_inverse_path(const SkRect& bounds, const SkPath& invPath,
// enums so region_op_to_pathops_op can do a straight passthrough cast.
// If these are failing, it may be necessary to make region_op_to_pathops_op
// do more.
-SK_COMPILE_ASSERT(SkRegion::kDifference_Op == (int)kDifference_SkPathOp,
- region_pathop_mismatch);
-SK_COMPILE_ASSERT(SkRegion::kIntersect_Op == (int)kIntersect_SkPathOp,
- region_pathop_mismatch);
-SK_COMPILE_ASSERT(SkRegion::kUnion_Op == (int)kUnion_SkPathOp,
- region_pathop_mismatch);
-SK_COMPILE_ASSERT(SkRegion::kXOR_Op == (int)kXOR_SkPathOp,
- region_pathop_mismatch);
-SK_COMPILE_ASSERT(SkRegion::kReverseDifference_Op ==
- (int)kReverseDifference_SkPathOp,
- region_pathop_mismatch);
+static_assert(SkRegion::kDifference_Op == (int)kDifference_SkPathOp, "region_pathop_mismatch");
+static_assert(SkRegion::kIntersect_Op == (int)kIntersect_SkPathOp, "region_pathop_mismatch");
+static_assert(SkRegion::kUnion_Op == (int)kUnion_SkPathOp, "region_pathop_mismatch");
+static_assert(SkRegion::kXOR_Op == (int)kXOR_SkPathOp, "region_pathop_mismatch");
+static_assert(SkRegion::kReverseDifference_Op == (int)kReverseDifference_SkPathOp,
+ "region_pathop_mismatch");
static SkPathOp region_op_to_pathops_op(SkRegion::Op op) {
SkASSERT(op >= 0);
@@ -559,11 +554,9 @@ void GraphicStackState::updateDrawingState(const GraphicStateEntry& state) {
currentEntry()->fTextScaleX = state.fTextScaleX;
}
if (state.fTextFill != currentEntry()->fTextFill) {
- SK_COMPILE_ASSERT(SkPaint::kFill_Style == 0, enum_must_match_value);
- SK_COMPILE_ASSERT(SkPaint::kStroke_Style == 1,
- enum_must_match_value);
- SK_COMPILE_ASSERT(SkPaint::kStrokeAndFill_Style == 2,
- enum_must_match_value);
+ static_assert(SkPaint::kFill_Style == 0, "enum_must_match_value");
+ static_assert(SkPaint::kStroke_Style == 1, "enum_must_match_value");
+ static_assert(SkPaint::kStrokeAndFill_Style == 2, "enum_must_match_value");
fContentStream->writeDecAsText(state.fTextFill);
fContentStream->writeText(" Tr\n");
currentEntry()->fTextFill = state.fTextFill;
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index 017b0168b0..17623c7c3b 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -603,8 +603,7 @@ static size_t get_subset_font_stream(const char* fontName,
unsigned char* subsetFont = NULL;
// sfntly requires unsigned int* to be passed in, as far as we know,
// unsigned int is equivalent to uint32_t on all platforms.
- SK_COMPILE_ASSERT(sizeof(unsigned int) == sizeof(uint32_t),
- unsigned_int_not_32_bits);
+ static_assert(sizeof(unsigned int) == sizeof(uint32_t), "unsigned_int_not_32_bits");
int subsetFontSize = SfntlyWrapper::SubsetFont(fontName,
originalFont.begin(),
fontSize,
diff --git a/src/pdf/SkPDFGraphicState.cpp b/src/pdf/SkPDFGraphicState.cpp
index 55f3b3929f..c4b6c20fe4 100644
--- a/src/pdf/SkPDFGraphicState.cpp
+++ b/src/pdf/SkPDFGraphicState.cpp
@@ -210,17 +210,17 @@ void SkPDFGraphicState::emitObject(
SkPaint::Join strokeJoin = (SkPaint::Join)fStrokeJoin;
SkXfermode::Mode xferMode = (SkXfermode::Mode)fMode;
- SK_COMPILE_ASSERT(SkPaint::kButt_Cap == 0, paint_cap_mismatch);
- SK_COMPILE_ASSERT(SkPaint::kRound_Cap == 1, paint_cap_mismatch);
- SK_COMPILE_ASSERT(SkPaint::kSquare_Cap == 2, paint_cap_mismatch);
- SK_COMPILE_ASSERT(SkPaint::kCapCount == 3, paint_cap_mismatch);
+ static_assert(SkPaint::kButt_Cap == 0, "paint_cap_mismatch");
+ static_assert(SkPaint::kRound_Cap == 1, "paint_cap_mismatch");
+ static_assert(SkPaint::kSquare_Cap == 2, "paint_cap_mismatch");
+ static_assert(SkPaint::kCapCount == 3, "paint_cap_mismatch");
SkASSERT(strokeCap >= 0 && strokeCap <= 2);
dict->insertInt("LC", strokeCap);
- SK_COMPILE_ASSERT(SkPaint::kMiter_Join == 0, paint_join_mismatch);
- SK_COMPILE_ASSERT(SkPaint::kRound_Join == 1, paint_join_mismatch);
- SK_COMPILE_ASSERT(SkPaint::kBevel_Join == 2, paint_join_mismatch);
- SK_COMPILE_ASSERT(SkPaint::kJoinCount == 3, paint_join_mismatch);
+ static_assert(SkPaint::kMiter_Join == 0, "paint_join_mismatch");
+ static_assert(SkPaint::kRound_Join == 1, "paint_join_mismatch");
+ static_assert(SkPaint::kBevel_Join == 2, "paint_join_mismatch");
+ static_assert(SkPaint::kJoinCount == 3, "paint_join_mismatch");
SkASSERT(strokeJoin >= 0 && strokeJoin <= 2);
dict->insertInt("LJ", strokeJoin);
diff --git a/src/pdf/SkPDFResourceDict.cpp b/src/pdf/SkPDFResourceDict.cpp
index 1f5bceac9c..dbe733e765 100644
--- a/src/pdf/SkPDFResourceDict.cpp
+++ b/src/pdf/SkPDFResourceDict.cpp
@@ -12,14 +12,10 @@
// expected values as defined in the arrays below.
// If these are failing, you may need to update the resource_type_prefixes
// and resource_type_names arrays below.
-SK_COMPILE_ASSERT(SkPDFResourceDict::kExtGState_ResourceType == 0,
- resource_type_mismatch);
-SK_COMPILE_ASSERT(SkPDFResourceDict::kPattern_ResourceType == 1,
- resource_type_mismatch);
-SK_COMPILE_ASSERT(SkPDFResourceDict::kXObject_ResourceType == 2,
- resource_type_mismatch);
-SK_COMPILE_ASSERT(SkPDFResourceDict::kFont_ResourceType == 3,
- resource_type_mismatch);
+static_assert(SkPDFResourceDict::kExtGState_ResourceType == 0, "resource_type_mismatch");
+static_assert(SkPDFResourceDict::kPattern_ResourceType == 1, "resource_type_mismatch");
+static_assert(SkPDFResourceDict::kXObject_ResourceType == 2, "resource_type_mismatch");
+static_assert(SkPDFResourceDict::kFont_ResourceType == 3, "resource_type_mismatch");
static const char resource_type_prefixes[] = {
'G',
diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h
index 23a30b9a2b..56e534bd5e 100644
--- a/src/pdf/SkPDFTypes.h
+++ b/src/pdf/SkPDFTypes.h
@@ -158,7 +158,7 @@ private:
SkPDFUnion& operator=(const SkPDFUnion&) = delete;
SkPDFUnion(const SkPDFUnion&) = delete;
};
-SK_COMPILE_ASSERT(sizeof(SkString) == sizeof(void*), SkString_size);
+static_assert(sizeof(SkString) == sizeof(void*), "SkString_size");
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index e45a485372..d19ab1adba 100755
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -1855,7 +1855,7 @@ ReturnInfo:
//Length of GUID representation from create_id, including NULL terminator.
#define BASE64_GUID_ID_LEN SK_ARRAY_COUNT(BASE64_GUID_ID)
-SK_COMPILE_ASSERT(BASE64_GUID_ID_LEN < LF_FACESIZE, GUID_longer_than_facesize);
+static_assert(BASE64_GUID_ID_LEN < LF_FACESIZE, "GUID_longer_than_facesize");
/**
NameID 6 Postscript names cannot have the character '/'.
diff --git a/src/ports/SkFontMgr_android_parser.h b/src/ports/SkFontMgr_android_parser.h
index 175a6fa1fe..ca66c43410 100644
--- a/src/ports/SkFontMgr_android_parser.h
+++ b/src/ports/SkFontMgr_android_parser.h
@@ -126,7 +126,7 @@ void GetCustomFontFamilies(SkTDArray<FontFamily*>& fontFamilies,
* If the string cannot be parsed into 'value', returns false and does not change 'value'.
*/
template <typename T> static bool parse_non_negative_integer(const char* s, T* value) {
- SK_COMPILE_ASSERT(std::numeric_limits<T>::is_integer, T_must_be_integer);
+ static_assert(std::numeric_limits<T>::is_integer, "T_must_be_integer");
if (*s == '\0') {
return false;
@@ -163,9 +163,9 @@ template <typename T> static bool parse_non_negative_integer(const char* s, T* v
* If the string cannot be parsed into 'value', returns false and does not change 'value'.
*/
template <int N, typename T> static bool parse_fixed(const char* s, T* value) {
- SK_COMPILE_ASSERT(std::numeric_limits<T>::is_integer, T_must_be_integer);
- SK_COMPILE_ASSERT(std::numeric_limits<T>::is_signed, T_must_be_signed);
- SK_COMPILE_ASSERT(sizeof(T) * CHAR_BIT - N >= 5, N_must_leave_four_bits_plus_sign);
+ static_assert(std::numeric_limits<T>::is_integer, "T_must_be_integer");
+ static_assert(std::numeric_limits<T>::is_signed, "T_must_be_signed");
+ static_assert(sizeof(T) * CHAR_BIT - N >= 5, "N_must_leave_four_bits_plus_sign");
bool negate = false;
if (*s == '-') {
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp
index e98bd01995..5a34455546 100644
--- a/src/ports/SkFontMgr_fontconfig.cpp
+++ b/src/ports/SkFontMgr_fontconfig.cpp
@@ -301,7 +301,7 @@ static int map_ranges(int val, MapRanges const ranges[], int rangesCount) {
}
template<int n> struct SkTFixed {
- SK_COMPILE_ASSERT(-32768 <= n && n <= 32767, SkTFixed_n_not_in_range);
+ static_assert(-32768 <= n && n <= 32767, "SkTFixed_n_not_in_range");
static const SkFixed value = static_cast<SkFixed>(n << 16);
};
diff --git a/src/ports/SkOSFile_posix.cpp b/src/ports/SkOSFile_posix.cpp
index 6f64478d04..b7cf583440 100644
--- a/src/ports/SkOSFile_posix.cpp
+++ b/src/ports/SkOSFile_posix.cpp
@@ -102,7 +102,7 @@ struct SkOSFileIterData {
DIR* fDIR;
SkString fPath, fSuffix;
};
-SK_COMPILE_ASSERT(sizeof(SkOSFileIterData) <= SkOSFile::Iter::kStorageSize, not_enough_space);
+static_assert(sizeof(SkOSFileIterData) <= SkOSFile::Iter::kStorageSize, "not_enough_space");
SkOSFile::Iter::Iter() {
SkNEW_PLACEMENT(fSelf.get(), SkOSFileIterData);
diff --git a/src/ports/SkOSFile_win.cpp b/src/ports/SkOSFile_win.cpp
index a544168c84..62510e7a4e 100644
--- a/src/ports/SkOSFile_win.cpp
+++ b/src/ports/SkOSFile_win.cpp
@@ -128,7 +128,7 @@ struct SkOSFileIterData {
HANDLE fHandle;
uint16_t* fPath16;
};
-SK_COMPILE_ASSERT(sizeof(SkOSFileIterData) <= SkOSFile::Iter::kStorageSize, not_enough_space);
+static_assert(sizeof(SkOSFileIterData) <= SkOSFile::Iter::kStorageSize, "not_enough_space");
static uint16_t* concat_to_16(const char src[], const char suffix[]) {
size_t i, len = strlen(src);
diff --git a/src/sfnt/SkIBMFamilyClass.h b/src/sfnt/SkIBMFamilyClass.h
index 45d9822f50..1572011215 100644
--- a/src/sfnt/SkIBMFamilyClass.h
+++ b/src/sfnt/SkIBMFamilyClass.h
@@ -169,6 +169,6 @@ struct SkIBMFamilyClass {
#pragma pack(pop)
-SK_COMPILE_ASSERT(sizeof(SkIBMFamilyClass) == 2, sizeof_SkIBMFamilyClass_not_2);
+static_assert(sizeof(SkIBMFamilyClass) == 2, "sizeof_SkIBMFamilyClass_not_2");
#endif
diff --git a/src/sfnt/SkOTTableTypes.h b/src/sfnt/SkOTTableTypes.h
index fa76b207ea..119f17ef77 100644
--- a/src/sfnt/SkOTTableTypes.h
+++ b/src/sfnt/SkOTTableTypes.h
@@ -47,14 +47,14 @@ public:
/** SkOTSetUSHORTBit<N>::value is an SK_OT_USHORT with the Nth BE bit set. */
template <unsigned N> struct SkOTSetUSHORTBit {
- SK_COMPILE_ASSERT(N < 16, NTooBig);
+ static_assert(N < 16, "NTooBig");
static const uint16_t bit = 1u << N;
static const SK_OT_USHORT value = SkTEndian_SwapBE16(bit);
};
/** SkOTSetULONGBit<N>::value is an SK_OT_ULONG with the Nth BE bit set. */
template <unsigned N> struct SkOTSetULONGBit {
- SK_COMPILE_ASSERT(N < 32, NTooBig);
+ static_assert(N < 32, "NTooBig");
static const uint32_t bit = 1u << N;
static const SK_OT_ULONG value = SkTEndian_SwapBE32(bit);
};
diff --git a/src/sfnt/SkOTTable_OS_2.h b/src/sfnt/SkOTTable_OS_2.h
index c4dbc5336c..4a09a78605 100644
--- a/src/sfnt/SkOTTable_OS_2.h
+++ b/src/sfnt/SkOTTable_OS_2.h
@@ -42,11 +42,11 @@ struct SkOTTableOS2 {
#pragma pack(pop)
-SK_COMPILE_ASSERT(sizeof(SkOTTableOS2::Version::VA) == 68, sizeof_SkOTTableOS2__VA_not_68);
-SK_COMPILE_ASSERT(sizeof(SkOTTableOS2::Version::V0) == 78, sizeof_SkOTTableOS2__V0_not_78);
-SK_COMPILE_ASSERT(sizeof(SkOTTableOS2::Version::V1) == 86, sizeof_SkOTTableOS2__V1_not_86);
-SK_COMPILE_ASSERT(sizeof(SkOTTableOS2::Version::V2) == 96, sizeof_SkOTTableOS2__V2_not_96);
-SK_COMPILE_ASSERT(sizeof(SkOTTableOS2::Version::V3) == 96, sizeof_SkOTTableOS2__V3_not_96);
-SK_COMPILE_ASSERT(sizeof(SkOTTableOS2::Version::V4) == 96, sizeof_SkOTTableOS2__V4_not_96);
+static_assert(sizeof(SkOTTableOS2::Version::VA) == 68, "sizeof_SkOTTableOS2__VA_not_68");
+static_assert(sizeof(SkOTTableOS2::Version::V0) == 78, "sizeof_SkOTTableOS2__V0_not_78");
+static_assert(sizeof(SkOTTableOS2::Version::V1) == 86, "sizeof_SkOTTableOS2__V1_not_86");
+static_assert(sizeof(SkOTTableOS2::Version::V2) == 96, "sizeof_SkOTTableOS2__V2_not_96");
+static_assert(sizeof(SkOTTableOS2::Version::V3) == 96, "sizeof_SkOTTableOS2__V3_not_96");
+static_assert(sizeof(SkOTTableOS2::Version::V4) == 96, "sizeof_SkOTTableOS2__V4_not_96");
#endif
diff --git a/src/sfnt/SkOTTable_OS_2_V0.h b/src/sfnt/SkOTTable_OS_2_V0.h
index b65bcf7f63..4dff413770 100644
--- a/src/sfnt/SkOTTable_OS_2_V0.h
+++ b/src/sfnt/SkOTTable_OS_2_V0.h
@@ -144,6 +144,6 @@ struct SkOTTableOS2_V0 {
#pragma pack(pop)
-SK_COMPILE_ASSERT(sizeof(SkOTTableOS2_V0) == 78, sizeof_SkOTTableOS2_V0_not_78);
+static_assert(sizeof(SkOTTableOS2_V0) == 78, "sizeof_SkOTTableOS2_V0_not_78");
#endif
diff --git a/src/sfnt/SkOTTable_OS_2_V1.h b/src/sfnt/SkOTTable_OS_2_V1.h
index e53c0e67a5..43e61d41cc 100644
--- a/src/sfnt/SkOTTable_OS_2_V1.h
+++ b/src/sfnt/SkOTTable_OS_2_V1.h
@@ -513,6 +513,6 @@ struct SkOTTableOS2_V1 {
#pragma pack(pop)
-SK_COMPILE_ASSERT(sizeof(SkOTTableOS2_V1) == 86, sizeof_SkOTTableOS2_V1_not_86);
+static_assert(sizeof(SkOTTableOS2_V1) == 86, "sizeof_SkOTTableOS2_V1_not_86");
#endif
diff --git a/src/sfnt/SkOTTable_OS_2_V2.h b/src/sfnt/SkOTTable_OS_2_V2.h
index 52f946057a..30ad016790 100644
--- a/src/sfnt/SkOTTable_OS_2_V2.h
+++ b/src/sfnt/SkOTTable_OS_2_V2.h
@@ -535,6 +535,6 @@ struct SkOTTableOS2_V2 {
#pragma pack(pop)
-SK_COMPILE_ASSERT(sizeof(SkOTTableOS2_V2) == 96, sizeof_SkOTTableOS2_V2_not_96);
+static_assert(sizeof(SkOTTableOS2_V2) == 96, "sizeof_SkOTTableOS2_V2_not_96");
#endif
diff --git a/src/sfnt/SkOTTable_OS_2_V3.h b/src/sfnt/SkOTTable_OS_2_V3.h
index 8d4fa6b574..00df2891f1 100644
--- a/src/sfnt/SkOTTable_OS_2_V3.h
+++ b/src/sfnt/SkOTTable_OS_2_V3.h
@@ -545,6 +545,6 @@ struct SkOTTableOS2_V3 {
#pragma pack(pop)
-SK_COMPILE_ASSERT(sizeof(SkOTTableOS2_V3) == 96, sizeof_SkOTTableOS2_V3_not_96);
+static_assert(sizeof(SkOTTableOS2_V3) == 96, "sizeof_SkOTTableOS2_V3_not_96");
#endif
diff --git a/src/sfnt/SkOTTable_OS_2_V4.h b/src/sfnt/SkOTTable_OS_2_V4.h
index fc64b2257b..3d22a1b2d1 100644
--- a/src/sfnt/SkOTTable_OS_2_V4.h
+++ b/src/sfnt/SkOTTable_OS_2_V4.h
@@ -580,6 +580,6 @@ struct SkOTTableOS2_V4 {
#pragma pack(pop)
-SK_COMPILE_ASSERT(sizeof(SkOTTableOS2_V4) == 96, sizeof_SkOTTableOS2_V4_not_96);
+static_assert(sizeof(SkOTTableOS2_V4) == 96, "sizeof_SkOTTableOS2_V4_not_96");
#endif
diff --git a/src/sfnt/SkOTTable_OS_2_VA.h b/src/sfnt/SkOTTable_OS_2_VA.h
index bc45da2021..1dc95b5af7 100644
--- a/src/sfnt/SkOTTable_OS_2_VA.h
+++ b/src/sfnt/SkOTTable_OS_2_VA.h
@@ -137,6 +137,6 @@ struct SkOTTableOS2_VA {
#pragma pack(pop)
-SK_COMPILE_ASSERT(sizeof(SkOTTableOS2_VA) == 68, sizeof_SkOTTableOS2_VA_not_68);
+static_assert(sizeof(SkOTTableOS2_VA) == 68, "sizeof_SkOTTableOS2_VA_not_68");
#endif
diff --git a/src/sfnt/SkOTTable_gasp.h b/src/sfnt/SkOTTable_gasp.h
index ca2d265e22..c6d8aa6550 100644
--- a/src/sfnt/SkOTTable_gasp.h
+++ b/src/sfnt/SkOTTable_gasp.h
@@ -67,7 +67,7 @@ struct SkOTTableGridAndScanProcedure {
#include <stddef.h>
-SK_COMPILE_ASSERT(offsetof(SkOTTableGridAndScanProcedure, numRanges) == 2, SkOTTableGridAndScanProcedure_numRanges_not_at_2);
-SK_COMPILE_ASSERT(sizeof(SkOTTableGridAndScanProcedure) == 4, sizeof_SkOTTableGridAndScanProcedure_not_4);
+static_assert(offsetof(SkOTTableGridAndScanProcedure, numRanges) == 2, "SkOTTableGridAndScanProcedure_numRanges_not_at_2");
+static_assert(sizeof(SkOTTableGridAndScanProcedure) == 4, "sizeof_SkOTTableGridAndScanProcedure_not_4");
#endif
diff --git a/src/sfnt/SkOTTable_head.h b/src/sfnt/SkOTTable_head.h
index 3d2c0f1113..52970b0f3b 100644
--- a/src/sfnt/SkOTTable_head.h
+++ b/src/sfnt/SkOTTable_head.h
@@ -144,7 +144,7 @@ struct SkOTTableHead {
#include <stddef.h>
-SK_COMPILE_ASSERT(offsetof(SkOTTableHead, glyphDataFormat) == 52, SkOTTableHead_glyphDataFormat_not_at_52);
-SK_COMPILE_ASSERT(sizeof(SkOTTableHead) == 54, sizeof_SkOTTableHead_not_54);
+static_assert(offsetof(SkOTTableHead, glyphDataFormat) == 52, "SkOTTableHead_glyphDataFormat_not_at_52");
+static_assert(sizeof(SkOTTableHead) == 54, "sizeof_SkOTTableHead_not_54");
#endif
diff --git a/src/sfnt/SkOTTable_hhea.h b/src/sfnt/SkOTTable_hhea.h
index b8a2070199..a3b9cad725 100644
--- a/src/sfnt/SkOTTable_hhea.h
+++ b/src/sfnt/SkOTTable_hhea.h
@@ -50,7 +50,7 @@ struct SkOTTableHorizontalHeader {
#include <stddef.h>
-SK_COMPILE_ASSERT(offsetof(SkOTTableHorizontalHeader, numberOfHMetrics) == 34, SkOTTableHorizontalHeader_numberOfHMetrics_not_at_34);
-SK_COMPILE_ASSERT(sizeof(SkOTTableHorizontalHeader) == 36, sizeof_SkOTTableHorizontalHeader_not_36);
+static_assert(offsetof(SkOTTableHorizontalHeader, numberOfHMetrics) == 34, "SkOTTableHorizontalHeader_numberOfHMetrics_not_at_34");
+static_assert(sizeof(SkOTTableHorizontalHeader) == 36, "sizeof_SkOTTableHorizontalHeader_not_36");
#endif
diff --git a/src/sfnt/SkOTTable_maxp_CFF.h b/src/sfnt/SkOTTable_maxp_CFF.h
index f97bff9efc..435d823886 100644
--- a/src/sfnt/SkOTTable_maxp_CFF.h
+++ b/src/sfnt/SkOTTable_maxp_CFF.h
@@ -24,7 +24,7 @@ struct SkOTTableMaximumProfile_CFF {
#include <stddef.h>
-SK_COMPILE_ASSERT(offsetof(SkOTTableMaximumProfile_CFF, numGlyphs) == 4, SkOTTableMaximumProfile_CFF_numGlyphs_not_at_4);
-SK_COMPILE_ASSERT(sizeof(SkOTTableMaximumProfile_CFF) == 6, sizeof_SkOTTableMaximumProfile_CFF_not_6);
+static_assert(offsetof(SkOTTableMaximumProfile_CFF, numGlyphs) == 4, "SkOTTableMaximumProfile_CFF_numGlyphs_not_at_4");
+static_assert(sizeof(SkOTTableMaximumProfile_CFF) == 6, "sizeof_SkOTTableMaximumProfile_CFF_not_6");
#endif
diff --git a/src/sfnt/SkOTTable_maxp_TT.h b/src/sfnt/SkOTTable_maxp_TT.h
index 9aa557ff30..1fdd0edc83 100644
--- a/src/sfnt/SkOTTable_maxp_TT.h
+++ b/src/sfnt/SkOTTable_maxp_TT.h
@@ -44,7 +44,7 @@ struct SkOTTableMaximumProfile_TT {
#include <stddef.h>
-SK_COMPILE_ASSERT(offsetof(SkOTTableMaximumProfile_TT, maxComponentDepth) == 30, SkOTTableMaximumProfile_TT_maxComponentDepth_not_at_30);
-SK_COMPILE_ASSERT(sizeof(SkOTTableMaximumProfile_TT) == 32, sizeof_SkOTTableMaximumProfile_TT_not_32);
+static_assert(offsetof(SkOTTableMaximumProfile_TT, maxComponentDepth) == 30, "SkOTTableMaximumProfile_TT_maxComponentDepth_not_at_30");
+static_assert(sizeof(SkOTTableMaximumProfile_TT) == 32, "sizeof_SkOTTableMaximumProfile_TT_not_32");
#endif
diff --git a/src/sfnt/SkOTTable_name.h b/src/sfnt/SkOTTable_name.h
index ab38d72992..6b25a2d1c8 100644
--- a/src/sfnt/SkOTTable_name.h
+++ b/src/sfnt/SkOTTable_name.h
@@ -576,9 +576,9 @@ struct SkOTTableName {
#pragma pack(pop)
-SK_COMPILE_ASSERT(sizeof(SkOTTableName) == 6, sizeof_SkOTTableName_not_6);
-SK_COMPILE_ASSERT(sizeof(SkOTTableName::Format1Ext) == 2, sizeof_SkOTTableNameF1_not_2);
-SK_COMPILE_ASSERT(sizeof(SkOTTableName::Format1Ext::LangTagRecord) == 4, sizeof_SkOTTableNameLangTagRecord_not_4);
-SK_COMPILE_ASSERT(sizeof(SkOTTableName::Record) == 12, sizeof_SkOTTableNameRecord_not_12);
+static_assert(sizeof(SkOTTableName) == 6, "sizeof_SkOTTableName_not_6");
+static_assert(sizeof(SkOTTableName::Format1Ext) == 2, "sizeof_SkOTTableNameF1_not_2");
+static_assert(sizeof(SkOTTableName::Format1Ext::LangTagRecord) == 4, "sizeof_SkOTTableNameLangTagRecord_not_4");
+static_assert(sizeof(SkOTTableName::Record) == 12, "sizeof_SkOTTableNameRecord_not_12");
#endif
diff --git a/src/sfnt/SkOTTable_post.h b/src/sfnt/SkOTTable_post.h
index f563b08b22..7461d5283e 100644
--- a/src/sfnt/SkOTTable_post.h
+++ b/src/sfnt/SkOTTable_post.h
@@ -46,7 +46,7 @@ struct SkOTTablePostScript {
#include <stddef.h>
-SK_COMPILE_ASSERT(offsetof(SkOTTablePostScript, maxMemType1) == 28, SkOTTablePostScript_maxMemType1_not_at_28);
-SK_COMPILE_ASSERT(sizeof(SkOTTablePostScript) == 32, sizeof_SkOTTablePostScript_not_32);
+static_assert(offsetof(SkOTTablePostScript, maxMemType1) == 28, "SkOTTablePostScript_maxMemType1_not_at_28");
+static_assert(sizeof(SkOTTablePostScript) == 32, "sizeof_SkOTTablePostScript_not_32");
#endif
diff --git a/src/sfnt/SkPanose.h b/src/sfnt/SkPanose.h
index 873c093f5e..9561e56fb0 100644
--- a/src/sfnt/SkPanose.h
+++ b/src/sfnt/SkPanose.h
@@ -634,6 +634,6 @@ struct SkPanose {
#pragma pack(pop)
-SK_COMPILE_ASSERT(sizeof(SkPanose) == 10, sizeof_SkPanose_not_10);
+static_assert(sizeof(SkPanose) == 10, "sizeof_SkPanose_not_10");
#endif
diff --git a/src/sfnt/SkSFNTHeader.h b/src/sfnt/SkSFNTHeader.h
index 9071696c99..c2ea1e0b25 100644
--- a/src/sfnt/SkSFNTHeader.h
+++ b/src/sfnt/SkSFNTHeader.h
@@ -64,7 +64,7 @@ struct SkSFNTHeader {
#pragma pack(pop)
-SK_COMPILE_ASSERT(sizeof(SkSFNTHeader) == 12, sizeof_SkSFNTHeader_not_12);
-SK_COMPILE_ASSERT(sizeof(SkSFNTHeader::TableDirectoryEntry) == 16, sizeof_SkSFNTHeader_TableDirectoryEntry_not_16);
+static_assert(sizeof(SkSFNTHeader) == 12, "sizeof_SkSFNTHeader_not_12");
+static_assert(sizeof(SkSFNTHeader::TableDirectoryEntry) == 16, "sizeof_SkSFNTHeader_TableDirectoryEntry_not_16");
#endif
diff --git a/src/sfnt/SkTTCFHeader.h b/src/sfnt/SkTTCFHeader.h
index 8f53c03229..2dc77eea57 100644
--- a/src/sfnt/SkTTCFHeader.h
+++ b/src/sfnt/SkTTCFHeader.h
@@ -51,6 +51,6 @@ struct SkTTCFHeader {
#pragma pack(pop)
-SK_COMPILE_ASSERT(sizeof(SkTTCFHeader) == 12, sizeof_SkTTCFHeader_not_12);
+static_assert(sizeof(SkTTCFHeader) == 12, "sizeof_SkTTCFHeader_not_12");
#endif
diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp
index 9fd7ce737b..64f74c8b5b 100644
--- a/src/svg/SkSVGDevice.cpp
+++ b/src/svg/SkSVGDevice.cpp
@@ -42,7 +42,7 @@ static const char* cap_map[] = {
"round", // kRound_Cap
"square" // kSquare_Cap
};
-SK_COMPILE_ASSERT(SK_ARRAY_COUNT(cap_map) == SkPaint::kCapCount, missing_cap_map_entry);
+static_assert(SK_ARRAY_COUNT(cap_map) == SkPaint::kCapCount, "missing_cap_map_entry");
static const char* svg_cap(SkPaint::Cap cap) {
SkASSERT(cap < SK_ARRAY_COUNT(cap_map));
@@ -55,7 +55,7 @@ static const char* join_map[] = {
"round", // kRound_Join
"bevel" // kBevel_Join
};
-SK_COMPILE_ASSERT(SK_ARRAY_COUNT(join_map) == SkPaint::kJoinCount, missing_join_map_entry);
+static_assert(SK_ARRAY_COUNT(join_map) == SkPaint::kJoinCount, "missing_join_map_entry");
static const char* svg_join(SkPaint::Join join) {
SkASSERT(join < SK_ARRAY_COUNT(join_map));
@@ -68,8 +68,8 @@ static const char* text_align_map[] = {
"middle", // kCenter_Align
"end" // kRight_Align
};
-SK_COMPILE_ASSERT(SK_ARRAY_COUNT(text_align_map) == SkPaint::kAlignCount,
- missing_text_align_map_entry);
+static_assert(SK_ARRAY_COUNT(text_align_map) == SkPaint::kAlignCount,
+ "missing_text_align_map_entry");
static const char* svg_text_align(SkPaint::Align align) {
SkASSERT(align < SK_ARRAY_COUNT(text_align_map));
return text_align_map[align];
diff --git a/src/utils/SkTFitsIn.h b/src/utils/SkTFitsIn.h
index 1d04981c06..bbc22d410d 100644
--- a/src/utils/SkTFitsIn.h
+++ b/src/utils/SkTFitsIn.h
@@ -39,7 +39,7 @@ template <typename D, typename S> struct SkTOutOfRange_LT_MinD {
typedef S source_type;
static bool apply(S s) {
typedef typename SkTHasMoreDigits<S, D>::type precondition;
- SK_COMPILE_ASSERT(precondition::value, SkTOutOfRange_LT_MinD__minS_gt_minD);
+ static_assert(precondition::value, "SkTOutOfRange_LT_MinD__minS_gt_minD");
return s < static_cast<S>((std::numeric_limits<D>::min)());
}
@@ -62,7 +62,7 @@ template <typename D, typename S> struct SkTOutOfRange_GT_MaxD {
typedef S source_type;
static bool apply(S s) {
typedef typename SkTHasMoreDigits<S, D>::type precondition;
- SK_COMPILE_ASSERT(precondition::value, SkTOutOfRange_GT_MaxD__maxS_lt_maxD);
+ static_assert(precondition::value, "SkTOutOfRange_GT_MaxD__maxS_lt_maxD");
return s > static_cast<S>((std::numeric_limits<D>::max)());
}
@@ -200,8 +200,8 @@ template<typename D, typename S> struct SkTFitsIn {
/** Returns true if the integer source value 's' will fit in the integer destination type 'D'. */
template <typename D, typename S> inline bool SkTFitsIn(S s) {
- SK_COMPILE_ASSERT(std::numeric_limits<S>::is_integer, SkTFitsIn_source_must_be_integer);
- SK_COMPILE_ASSERT(std::numeric_limits<D>::is_integer, SkTFitsIn_destination_must_be_integer);
+ static_assert(std::numeric_limits<S>::is_integer, "SkTFitsIn_source_must_be_integer");
+ static_assert(std::numeric_limits<D>::is_integer, "SkTFitsIn_destination_must_be_integer");
return !sktfitsin::Private::SkTFitsIn<D, S>::type::OutOfRange(s);
}
diff --git a/src/views/mac/SkNSView.mm b/src/views/mac/SkNSView.mm
index fd26e8a5b9..a8376e62c9 100644
--- a/src/views/mac/SkNSView.mm
+++ b/src/views/mac/SkNSView.mm
@@ -10,7 +10,7 @@
#include "SkSurface.h"
#include "SkCGUtils.h"
#include "SkEvent.h"
-SK_COMPILE_ASSERT(SK_SUPPORT_GPU, not_implemented_for_non_gpu_build);
+static_assert(SK_SUPPORT_GPU, "not_implemented_for_non_gpu_build");
#include <OpenGL/gl.h>
//#define FORCE_REDRAW
diff --git a/src/views/mac/SkOSWindow_Mac.mm b/src/views/mac/SkOSWindow_Mac.mm
index 2b11ffcbd3..9dbbe5bfc2 100644
--- a/src/views/mac/SkOSWindow_Mac.mm
+++ b/src/views/mac/SkOSWindow_Mac.mm
@@ -16,7 +16,7 @@
#import "SkEventNotifier.h"
#define kINVAL_NSVIEW_EventType "inval-nsview"
-SK_COMPILE_ASSERT(SK_SUPPORT_GPU, not_implemented_for_non_gpu_build);
+static_assert(SK_SUPPORT_GPU, "not_implemented_for_non_gpu_build");
SkOSWindow::SkOSWindow(void* hWnd) : fHWND(hWnd) {
fInvalEventIsPending = false;
diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp
index e3861d2aac..1348ded448 100644
--- a/tests/ImageDecodingTest.cpp
+++ b/tests/ImageDecodingTest.cpp
@@ -358,8 +358,8 @@ static const SkColor kExpectedPixels[] = {
0xffb07222, 0xff2e23f8, 0xfff089d9, 0xffb35738,
0xffa86022, 0xff3340fe, 0xff95fe71, 0xff6a71df
};
-SK_COMPILE_ASSERT((kExpectedWidth * kExpectedHeight)
- == SK_ARRAY_COUNT(kExpectedPixels), array_size_mismatch);
+static_assert((kExpectedWidth * kExpectedHeight) == SK_ARRAY_COUNT(kExpectedPixels),
+ "array_size_mismatch");
DEF_TEST(WebP, reporter) {
const unsigned char encodedWebP[] = {
diff --git a/tools/PictureRenderer.h b/tools/PictureRenderer.h
index ca36961b43..a06604bc87 100644
--- a/tools/PictureRenderer.h
+++ b/tools/PictureRenderer.h
@@ -71,11 +71,12 @@ public:
kMaskFilter_DrawFilterFlag = 0x80000, // toggles on/off mask filters (e.g., blurs)
};
- SK_COMPILE_ASSERT(!(kMaskFilter_DrawFilterFlag & SkPaint::kAllFlags), maskfilter_flag_must_be_greater);
- SK_COMPILE_ASSERT(!(kHinting_DrawFilterFlag & SkPaint::kAllFlags),
- hinting_flag_must_be_greater);
- SK_COMPILE_ASSERT(!(kSlightHinting_DrawFilterFlag & SkPaint::kAllFlags),
- slight_hinting_flag_must_be_greater);
+ static_assert(!(kMaskFilter_DrawFilterFlag & SkPaint::kAllFlags),
+ "maskfilter_flag_must_be_greater");
+ static_assert(!(kHinting_DrawFilterFlag & SkPaint::kAllFlags),
+ "hinting_flag_must_be_greater");
+ static_assert(!(kSlightHinting_DrawFilterFlag & SkPaint::kAllFlags),
+ "slight_hinting_flag_must_be_greater");
/**
* Called with each new SkPicture to render.