eliminate all warnings in non-thirdparty code on mac
Most of these issues were due to functions whose definitions appear in header files; I changed those functions to be 'static inline' instead of just 'static' or 'inline', which kills the warning for such functions.
Other functions that were static or anonymous-namespaced but were unused in cpp files were probably called at some point but are no longer; someone who knows more than I do should probably scrub all the functions I either deleted or #if 0'ed out and make sure that the right thing is happening here.
Lots of unused variables removed, and one nasty const issue handled.
There remains a single warning in thirdparty/externals/cityhash/src/city.cc on line 146 related to a signed/unsigned mismatch. I don't know if we have control over this library so I didn't fix this one, but perhaps someone could do something about that one.
BUG=
Review URL: https://codereview.appspot.com/7067044
git-svn-id: http://skia.googlecode.com/svn/trunk@7051 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkBitmapProcState_matrixProcs.cpp b/src/core/SkBitmapProcState_matrixProcs.cpp
index 9fa3cd6..d1de750 100644
--- a/src/core/SkBitmapProcState_matrixProcs.cpp
+++ b/src/core/SkBitmapProcState_matrixProcs.cpp
@@ -96,10 +96,10 @@
#endif
#define MAKENAME(suffix) GeneralXY ## suffix
-#define PREAMBLE(state) SkBitmapProcState::FixedTileProc tileProcX = (state).fTileProcX; \
- SkBitmapProcState::FixedTileProc tileProcY = (state).fTileProcY; \
- SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcX = (state).fTileLowBitsProcX; \
- SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcY = (state).fTileLowBitsProcY
+#define PREAMBLE(state) SkBitmapProcState::FixedTileProc tileProcX = (state).fTileProcX; (void) tileProcX; \
+ SkBitmapProcState::FixedTileProc tileProcY = (state).fTileProcY; (void) tileProcY; \
+ SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcX = (state).fTileLowBitsProcX; (void) tileLowBitsProcX; \
+ SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcY = (state).fTileLowBitsProcY; (void) tileLowBitsProcY
#define PREAMBLE_PARAM_X , SkBitmapProcState::FixedTileProc tileProcX, SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcX
#define PREAMBLE_PARAM_Y , SkBitmapProcState::FixedTileProc tileProcY, SkBitmapProcState::FixedTileLowBitsProc tileLowBitsProcY
#define PREAMBLE_ARG_X , tileProcX, tileLowBitsProcX
diff --git a/src/core/SkConfig8888.h b/src/core/SkConfig8888.h
index a891370..96eaef2 100644
--- a/src/core/SkConfig8888.h
+++ b/src/core/SkConfig8888.h
@@ -31,34 +31,17 @@
uint32_t g,
uint32_t b);
+///////////////////////////////////////////////////////////////////////////////
+// Implementation
+
namespace {
/**
Copies all pixels from a bitmap to a dst ptr with a given rowBytes and
Config8888. The bitmap must have kARGB_8888_Config.
*/
-inline void SkCopyBitmapToConfig8888(uint32_t* dstPixels,
- size_t dstRowBytes,
- SkCanvas::Config8888 dstConfig8888,
- const SkBitmap& srcBmp);
-/**
- Copies over all pixels in a bitmap from a src ptr with a given rowBytes and
- Config8888. The bitmap must have pixels and be kARGB_8888_Config.
- */
-inline void SkCopyConfig8888ToBitmap(const SkBitmap& dstBmp,
- const uint32_t* srcPixels,
- size_t srcRowBytes,
- SkCanvas::Config8888 srcConfig8888);
-
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Implementation
-
-namespace {
-
-inline void SkCopyBitmapToConfig8888(uint32_t* dstPixels,
+static inline void SkCopyBitmapToConfig8888(uint32_t* dstPixels,
size_t dstRowBytes,
SkCanvas::Config8888 dstConfig8888,
const SkBitmap& srcBmp) {
@@ -72,7 +55,11 @@
SkConvertConfig8888Pixels(dstPixels, dstRowBytes, dstConfig8888, srcPixels, srcRowBytes, SkCanvas::kNative_Premul_Config8888, w, h);
}
-inline void SkCopyConfig8888ToBitmap(const SkBitmap& dstBmp,
+/**
+ Copies over all pixels in a bitmap from a src ptr with a given rowBytes and
+ Config8888. The bitmap must have pixels and be kARGB_8888_Config.
+ */
+static inline void SkCopyConfig8888ToBitmap(const SkBitmap& dstBmp,
const uint32_t* srcPixels,
size_t srcRowBytes,
SkCanvas::Config8888 srcConfig8888) {
diff --git a/src/core/SkUtilsArm.h b/src/core/SkUtilsArm.h
index 9ae648a..b9a2614 100644
--- a/src/core/SkUtilsArm.h
+++ b/src/core/SkUtilsArm.h
@@ -39,11 +39,11 @@
// probes the CPU at runtime (and caches the result).
#if SK_ARM_NEON_IS_NONE
-static bool sk_cpu_arm_has_neon(void) {
+static inline bool sk_cpu_arm_has_neon(void) {
return false;
}
#elif SK_ARM_NEON_IS_ALWAYS
-static bool sk_cpu_arm_has_neon(void) {
+static inline bool sk_cpu_arm_has_neon(void) {
return true;
}
#else // SK_ARM_NEON_IS_DYNAMIC
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index 829d153..1662188 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -24,7 +24,7 @@
#define USE_DITHER_32BIT_GRADIENT
#endif
-static void sk_memset32_dither(uint32_t dst[], uint32_t v0, uint32_t v1,
+static inline void sk_memset32_dither(uint32_t dst[], uint32_t v0, uint32_t v1,
int count) {
if (count > 0) {
if (v0 == v1) {
@@ -44,13 +44,13 @@
// Clamp
-static SkFixed clamp_tileproc(SkFixed x) {
+static inline SkFixed clamp_tileproc(SkFixed x) {
return SkClampMax(x, 0xFFFF);
}
// Repeat
-static SkFixed repeat_tileproc(SkFixed x) {
+static inline SkFixed repeat_tileproc(SkFixed x) {
return x & 0xFFFF;
}
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index 7161450..2e80351 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -120,23 +120,6 @@
SkPMColor* dstC, const SkPMColor* cache,
int toggle, int count);
-// This function is deprecated, and will be replaced by
-// shadeSpan_linear_vertical_lerp() once Chrome has been weaned off of it.
-void shadeSpan_linear_vertical(TileProc proc, SkFixed dx, SkFixed fx,
- SkPMColor* SK_RESTRICT dstC,
- const SkPMColor* SK_RESTRICT cache,
- int toggle, int count) {
- // We're a vertical gradient, so no change in a span.
- // If colors change sharply across the gradient, dithering is
- // insufficient (it subsamples the color space) and we need to lerp.
- unsigned fullIndex = proc(fx);
- unsigned fi = fullIndex >> (16 - SkGradientShaderBase::kCache32Bits);
- sk_memset32_dither(dstC,
- cache[toggle + fi],
- cache[(toggle ^ SkGradientShaderBase::kDitherStride32) + fi],
- count);
-}
-
// Linear interpolation (lerp) is unnecessary if there are no sharp
// discontinuities in the gradient - which must be true if there are
// only 2 colors - but it's cheap.
@@ -256,15 +239,7 @@
LinearShadeProc shadeProc = shadeSpan_linear_repeat;
if (SkFixedNearlyZero(dx)) {
-#ifdef SK_SIMPLE_TWOCOLOR_VERTICAL_GRADIENTS
- if (fColorCount > 2) {
- shadeProc = shadeSpan_linear_vertical_lerp;
- } else {
- shadeProc = shadeSpan_linear_vertical;
- }
-#else
shadeProc = shadeSpan_linear_vertical_lerp;
-#endif
} else if (SkShader::kClamp_TileMode == fTileMode) {
shadeProc = shadeSpan_linear_clamp;
} else if (SkShader::kMirror_TileMode == fTileMode) {
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 7eab0ce..f3f773d 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -260,31 +260,6 @@
}
}
-////////////////////////////////////////////////////////////////////////////////
-bool draw_path_in_software(GrContext* context,
- GrGpu* gpu,
- const SkPath& path,
- bool doAA,
- const GrIRect& resultBounds) {
- SkStrokeRec rec(SkStrokeRec::kFill_InitStyle);
-
- SkAutoTUnref<GrTexture> texture(
- GrSWMaskHelper::DrawPathMaskToTexture(context, path,
- rec,
- resultBounds,
- doAA, NULL));
- if (NULL == texture) {
- return false;
- }
-
- // The ClipMaskManager accumulates the clip mask in the UL corner
- GrIRect rect = GrIRect::MakeWH(resultBounds.width(), resultBounds.height());
-
- GrSWMaskHelper::DrawToTargetWithPathMask(texture, gpu, rect);
-
- GrAssert(!path.isInverseFillType());
- return true;
-}
}
////////////////////////////////////////////////////////////////////////////////
@@ -632,8 +607,6 @@
SkASSERT((clipBit <= 16) && "Ganesh only handles 16b or smaller stencil buffers");
clipBit = (1 << (clipBit-1));
- GrIRect devRTRect = GrIRect::MakeWH(rt->width(), rt->height());
-
fGpu->clearStencilClip(stencilSpaceIBounds, kAllIn_InitialState == initialState);
// walk through each clip element and perform its set op
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index f80a441..976448d 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -46,8 +46,13 @@
}
/**
- * Run this function to generate the code that declares the global masks.
+ * Uncomment and run the gen_globals function to generate
+ * the code that declares the global masks.
+ *
+ * #if 0'ed out to avoid unused function warning.
*/
+
+#if 0
void gen_globals() {
GrVertexLayout stageTexCoordMasks[GrDrawState::kNumStages];
GrVertexLayout texCoordMasks[GrDrawState::kMaxTexCoords];
@@ -66,6 +71,7 @@
GrPrintf("};\n");
GrPrintf("GR_STATIC_ASSERT(GrDrawState::kMaxTexCoords == GR_ARRAY_COUNT(gTexCoordMasks));\n");
}
+#endif
/* These values were generated by the above function */
diff --git a/src/gpu/GrTDArray.h b/src/gpu/GrTDArray.h
index 0e5b6bb..33b7a63 100644
--- a/src/gpu/GrTDArray.h
+++ b/src/gpu/GrTDArray.h
@@ -14,11 +14,11 @@
#include "GrTypes.h"
#include "GrRefCnt.h"
-static int GrInitialArrayAllocationCount() {
+static inline int GrInitialArrayAllocationCount() {
return 4;
}
-static int GrNextArrayAllocationCount(int count) {
+static inline int GrNextArrayAllocationCount(int count) {
return count + ((count + 1) >> 1);
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index f4c4cf6..6a312f3 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -347,8 +347,7 @@
}
namespace {
-void purgeClipCB(int genID, void* data) {
- GrContext* context = (GrContext*) data;
+void purgeClipCB(int genID, void* ) {
if (SkClipStack::kInvalidGenID == genID ||
SkClipStack::kEmptyGenID == genID ||
@@ -1340,8 +1339,6 @@
return;
}
- GrEffectStage* stage = grPaint->colorStage(kBitmapTextureIdx);
-
GrTexture* texture;
SkAutoCachedTexture act(this, bitmap, ¶ms, &texture);
if (NULL == texture) {
diff --git a/src/gpu/gl/GrGLSL.h b/src/gpu/gl/GrGLSL.h
index c0d3d5e..4559fdd 100644
--- a/src/gpu/gl/GrGLSL.h
+++ b/src/gpu/gl/GrGLSL.h
@@ -57,7 +57,7 @@
};
namespace {
-inline int GrSLTypeToVecLength(GrSLType type) {
+static inline int GrSLTypeToVecLength(GrSLType type) {
static const int kVecLengths[] = {
0, // kVoid_GrSLType
1, // kFloat_GrSLType
@@ -72,14 +72,14 @@
return kVecLengths[type];
}
-const char* GrGLSLOnesVecf(int count) {
+static inline const char* GrGLSLOnesVecf(int count) {
static const char* kONESVEC[] = {"ERROR", "1.0", "vec2(1,1)",
"vec3(1,1,1)", "vec4(1,1,1,1)"};
GrAssert(count >= 1 && count < (int)GR_ARRAY_COUNT(kONESVEC));
return kONESVEC[count];
}
-const char* GrGLSLZerosVecf(int count) {
+static inline const char* GrGLSLZerosVecf(int count) {
static const char* kZEROSVEC[] = {"ERROR", "0.0", "vec2(0,0)",
"vec3(0,0,0)", "vec4(0,0,0,0)"};
GrAssert(count >= 1 && count < (int)GR_ARRAY_COUNT(kZEROSVEC));
diff --git a/src/opts/SkBitmapProcState_opts_SSE2.cpp b/src/opts/SkBitmapProcState_opts_SSE2.cpp
index 1e2dc93..c2de259 100644
--- a/src/opts/SkBitmapProcState_opts_SSE2.cpp
+++ b/src/opts/SkBitmapProcState_opts_SSE2.cpp
@@ -678,8 +678,6 @@
// ( 0, 0, 0, 0, 0, 0, 0, 0)
__m128i zero = _mm_setzero_si128();
- __m128i _m_shift_5 = _mm_set1_epi32((1<<5)-1);
- __m128i _m_shift_6 = _mm_set1_epi32((1<<6)-1);
do {
uint32_t XX = *xy++; // x0:14 | 4 | x1:14
unsigned x0 = XX >> 18;
diff --git a/src/views/mac/SkOptionsTableView.mm b/src/views/mac/SkOptionsTableView.mm
index 302e66e..eaa3e4c 100644
--- a/src/views/mac/SkOptionsTableView.mm
+++ b/src/views/mac/SkOptionsTableView.mm
@@ -55,10 +55,15 @@
}
}
-- (void)updateMenu:(SkOSMenu*)menu {
+- (void)updateMenu:(const SkOSMenu*)menu {
// the first menu is always assumed to be the static, the second is
// repopulated every time over and over again
- int menuIndex = fMenus->find(menu);
+
+ // seems pretty weird that we have to get rid of the const'ness here,
+ // but trying to propagate the const'ness through all the way to the fMenus
+ // vector was a non-starter.
+
+ int menuIndex = fMenus->find(const_cast<SkOSMenu *>(menu));
if (menuIndex >= 0 && menuIndex < fMenus->count()) {
NSUInteger first = 0;
for (NSInteger i = 0; i < menuIndex; ++i) {