aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-06 12:09:01 +0000
committerGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-06 12:09:01 +0000
commitcf6285b89b8820641ffb6871d4b3275bfe783f51 (patch)
tree6494e0064186c8b01651c45c02f0c64efa6bfc3f /src
parent2a2cc2057347553f07d933b021876ba5502e55cd (diff)
fix warnings on Mac in src/gpu and include/gpu
Fix these class of warnings: - unused functions - unused locals - sign mismatch - missing function prototypes - missing newline at end of file - 64 to 32 bit truncation The changes prefer to link in dead code in the debug build with 'if (false)' than to comment it out, but trivial cases are commented out or sometimes deleted if it appears to be a copy/paste error. Review URL: https://codereview.appspot.com/6296044 git-svn-id: http://skia.googlecode.com/svn/trunk@4180 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrDefaultPathRenderer.cpp2
-rw-r--r--src/gpu/GrDrawState.h2
-rw-r--r--src/gpu/GrDrawTarget.cpp1
-rw-r--r--src/gpu/GrMemory.cpp1
-rw-r--r--src/gpu/GrResourceCache.cpp4
-rw-r--r--src/gpu/GrTexture.cpp4
-rw-r--r--src/gpu/effects/GrConvolutionEffect.cpp4
-rw-r--r--src/gpu/effects/GrMorphologyEffect.cpp4
-rw-r--r--src/gpu/gl/GrGLCaps.cpp3
-rw-r--r--src/gpu/gl/GrGLCreateNullInterface.cpp4
-rw-r--r--src/gpu/gl/GrGLProgram.cpp14
-rw-r--r--src/gpu/gl/GrGLStencilBuffer.h4
-rw-r--r--src/gpu/gl/GrGpuGL.cpp13
-rw-r--r--src/gpu/gl/GrGpuGL_program.cpp4
-rw-r--r--src/gpu/gl/GrGpuGL_unittest.cpp5
-rw-r--r--src/gpu/gl/debug/GrFrameBufferObj.cpp2
-rw-r--r--src/gpu/gl/debug/GrGLCreateDebugInterface.cpp4
-rw-r--r--src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp2
-rw-r--r--src/gpu/gl/mac/SkNativeGLContext_mac.cpp2
-rw-r--r--src/gpu/gr_unittests.cpp3
20 files changed, 45 insertions, 37 deletions
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index 27e3fa89a5..e0f36a3b85 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -307,7 +307,7 @@ bool GrDefaultPathRenderer::createGeom(const SkPath& path,
case kClose_PathCmd:
break;
case kEnd_PathCmd:
- uint16_t currIdx = (uint16_t) (vert - base);
+ // uint16_t currIdx = (uint16_t) (vert - base);
goto FINISHED;
}
first = false;
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index 5342d9a4c7..23d05bc5da 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -804,7 +804,7 @@ private:
sizeof(fPodEndMarker);
}
- static const StageMask kIllegalStageMaskBits = ~((1 << kNumStages)-1);
+ static const StageMask kIllegalStageMaskBits = ~((1U << kNumStages)-1);
// @{ these fields can be initialized with memset to 0
union {
GrColor fBlendConstant;
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 35d50e9e77..2f7bf84a75 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -723,7 +723,6 @@ void GrDrawTarget::pushGeometrySource() {
}
void GrDrawTarget::popGeometrySource() {
- const GeometrySrcState& geoSrc = this->getGeomSrc();
// if popping last element then pops are unbalanced with pushes
GrAssert(fGeoSrcStateStack.count() > 1);
diff --git a/src/gpu/GrMemory.cpp b/src/gpu/GrMemory.cpp
index fa6ee2fda3..f6d3c7f06e 100644
--- a/src/gpu/GrMemory.cpp
+++ b/src/gpu/GrMemory.cpp
@@ -9,6 +9,7 @@
#include <stdlib.h>
+#include "GrTypes.h"
void* GrMalloc(size_t bytes) {
void* ptr = ::malloc(bytes);
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index ba6452dd59..848a9227e5 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -292,15 +292,13 @@ void GrResourceCache::purgeAsNeeded() {
void GrResourceCache::removeAll() {
GrAutoResourceCacheValidate atcv(this);
- GrResourceEntry* entry = fHead;
-
// we can have one GrResource holding a lock on another
// so we don't want to just do a simple loop kicking each
// entry out. Instead change the budget and purge.
int savedMaxBytes = fMaxBytes;
int savedMaxCount = fMaxCount;
- fMaxBytes = -1;
+ fMaxBytes = (size_t) -1;
fMaxCount = 0;
this->purgeAsNeeded();
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index e05b62ba5b..8dd0b0bcb7 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -124,8 +124,8 @@ void gen_texture_key_values(const GrGpu* gpu,
// assert that texture creation will fail anyway if this assumption
// would cause key collisions.
GrAssert(gpu->getCaps().fMaxTextureSize <= SK_MaxU16);
- v[0] = clientKey & 0xffffffffUL;
- v[1] = (clientKey >> 32) & 0xffffffffUL;
+ v[0] = (uint32_t) (clientKey & 0xffffffffUL);
+ v[1] = (uint32_t) ((clientKey >> 32) & 0xffffffffUL);
v[2] = desc.fWidth | (desc.fHeight << 16);
v[3] = (desc.fSampleCnt << 24);
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index 9296ecc93e..14e817fcec 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -84,8 +84,8 @@ void GrGLConvolutionEffect::emitFS(GrGLShaderBuilder* state,
const char* inputColor,
const char* samplerName) {
GrStringBuilder* code = &state->fFSCode;
- const char* texFunc = "texture2D";
- bool complexCoord = false;
+ // const char* texFunc = "texture2D";
+ // bool complexCoord = false;
state->fFSCode.appendf("\t\tvec4 sum = vec4(0, 0, 0, 0);\n");
diff --git a/src/gpu/effects/GrMorphologyEffect.cpp b/src/gpu/effects/GrMorphologyEffect.cpp
index 906758d991..991e11b720 100644
--- a/src/gpu/effects/GrMorphologyEffect.cpp
+++ b/src/gpu/effects/GrMorphologyEffect.cpp
@@ -82,8 +82,8 @@ void GrGLMorphologyEffect ::emitFS(GrGLShaderBuilder* state,
const char* inputColor,
const char* samplerName) {
GrStringBuilder* code = &state->fFSCode;
- const char* texFunc = "texture2D";
- bool complexCoord = false;
+ // const char* texFunc = "texture2D";
+ // bool complexCoord = false;
const char* func;
switch (fType) {
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index b23a1f8153..7b2bb35ead 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -98,7 +98,6 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo) {
fBGRAFormatSupport = version >= GR_GL_VER(1,2) ||
ctxInfo.hasExtension("GL_EXT_bgra");
} else {
- bool hasBGRAExt = false;
if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) {
fBGRAFormatSupport = true;
} else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) {
@@ -256,7 +255,7 @@ void GrGLCaps::initStencilFormats(const GrGLContextInfo& ctxInfo) {
gS16 = {GR_GL_STENCIL_INDEX16, 16, 16, false},
gD24S8 = {GR_GL_DEPTH24_STENCIL8, 8, 32, true },
gS4 = {GR_GL_STENCIL_INDEX4, 4, 4, false},
- gS = {GR_GL_STENCIL_INDEX, kUnknownBitCount, kUnknownBitCount, false},
+ // gS = {GR_GL_STENCIL_INDEX, kUnknownBitCount, kUnknownBitCount, false},
gDS = {GR_GL_DEPTH_STENCIL, kUnknownBitCount, kUnknownBitCount, true };
if (kDesktop_GrGLBinding == ctxInfo.binding()) {
diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp
index 57b7851722..70e9cee904 100644
--- a/src/gpu/gl/GrGLCreateNullInterface.cpp
+++ b/src/gpu/gl/GrGLCreateNullInterface.cpp
@@ -10,6 +10,8 @@
#include "GrTDArray.h"
#include "GrGLDefines.h"
+namespace { // added to suppress 'no previous prototype' warning
+
GrGLvoid GR_GL_FUNCTION_TYPE nullGLActiveTexture(GrGLenum texture) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLAttachShader(GrGLuint program, GrGLuint shader) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBeginQuery(GrGLenum target, GrGLuint id) {}
@@ -376,6 +378,8 @@ GrGLint GR_GL_FUNCTION_TYPE nullGLGetUniformLocation(GrGLuint program, const cha
return ++gUniLocation;
}
+} // end anonymous namespace
+
const GrGLInterface* GrGLCreateNullInterface() {
// The gl functions are not context-specific so we create one global
// interface
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 8c12ad6c7d..b1d6d4fbf5 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -1229,9 +1229,9 @@ void GrGLProgram::genStageCode(const GrGLContextInfo& gl,
GrStringBuilder samplerName;
sampler_name(stageNum, &samplerName);
- const GrGLShaderVar* sampler = &segments->addUniform(
- GrGLShaderBuilder::kFragment_VariableLifetime, kSampler2D_GrSLType,
- samplerName.c_str());
+ // const GrGLShaderVar* sampler = &
+ segments->addUniform(GrGLShaderBuilder::kFragment_VariableLifetime,
+ kSampler2D_GrSLType, samplerName.c_str());
locations->fSamplerUni = kUseUniform;
const char *varyingVSName, *varyingFSName;
@@ -1251,8 +1251,8 @@ void GrGLProgram::genStageCode(const GrGLContextInfo& gl,
vector_all_coords(segments->fVaryingDims));
}
- GrGLShaderVar* kernel = NULL;
- const char* imageIncrementName = NULL;
+ // GrGLShaderVar* kernel = NULL;
+ // const char* imageIncrementName = NULL;
if (NULL != customStage) {
segments->fVSCode.appendf("\t{ // stage %d %s\n",
stageNum, customStage->name());
@@ -1284,8 +1284,8 @@ void GrGLProgram::genStageCode(const GrGLContextInfo& gl,
if (desc.fOptFlags & StageDesc::kCustomTextureDomain_OptFlagBit) {
GrStringBuilder texDomainName;
tex_domain_name(stageNum, &texDomainName);
- const GrGLShaderVar* texDomain =
- &segments->addUniform(
+ // const GrGLShaderVar* texDomain = &
+ segments->addUniform(
GrGLShaderBuilder::kFragment_VariableLifetime,
kVec4f_GrSLType, texDomainName.c_str());
GrStringBuilder coordVar("clampCoord");
diff --git a/src/gpu/gl/GrGLStencilBuffer.h b/src/gpu/gl/GrGLStencilBuffer.h
index 87bdb4a819..7b3da4f34a 100644
--- a/src/gpu/gl/GrGLStencilBuffer.h
+++ b/src/gpu/gl/GrGLStencilBuffer.h
@@ -14,8 +14,8 @@
class GrGLStencilBuffer : public GrStencilBuffer {
public:
- static const GrGLenum kUnknownInternalFormat = ~0;
- static const GrGLuint kUnknownBitCount = ~0;
+ static const GrGLenum kUnknownInternalFormat = ~0U;
+ static const GrGLuint kUnknownBitCount = ~0U;
struct Format {
GrGLenum fInternalFormat;
GrGLuint fStencilBits;
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 3d40eb3c3f..f9d4cbb569 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -11,7 +11,7 @@
#include "GrTypes.h"
#include "SkTemplates.h"
-static const GrGLuint GR_MAX_GLUINT = ~0;
+static const GrGLuint GR_MAX_GLUINT = ~0U;
static const GrGLint GR_INVAL_GLINT = ~0;
#define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
@@ -176,6 +176,9 @@ GrGpuGL::GrGpuGL(const GrGLContextInfo& ctxInfo) : fGLContextInfo(ctxInfo) {
fLastSuccessfulStencilFmtIdx = 0;
fCanPreserveUnpremulRoundtrip = kUnknown_CanPreserveUnpremulRoundtrip;
+ if (false) { // avoid bit rot, suppress warning
+ fbo_test(this->glInterface(), 0, 0);
+ }
}
GrGpuGL::~GrGpuGL() {
@@ -526,7 +529,7 @@ void GrGpuGL::onResetContext() {
GL_CALL(PixelStorei(GR_GL_PACK_REVERSE_ROW_ORDER, GR_GL_FALSE));
}
- fHWGeometryState.fVertexOffset = ~0;
+ fHWGeometryState.fVertexOffset = ~0U;
// Third party GL code may have left vertex attributes enabled. Some GL
// implementations (osmesa) may read vetex attributes that are not required
@@ -989,7 +992,7 @@ static GrTexture* return_null_texture() {
return NULL;
}
-#if GR_DEBUG
+#if 0 && GR_DEBUG
static size_t as_size_t(int x) {
return x;
}
@@ -1443,7 +1446,7 @@ void GrGpuGL::clearStencilClip(const GrIRect& rect, bool insideClip) {
}
this->flushRenderTarget(&GrIRect::EmptyIRect());
this->enableScissoring(rect);
- GL_CALL(StencilMask(clipStencilMask));
+ GL_CALL(StencilMask((uint32_t) clipStencilMask));
GL_CALL(ClearStencil(value));
GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT));
fHWStencilSettings.invalidate();
@@ -1583,7 +1586,7 @@ bool GrGpuGL::onReadPixels(GrRenderTarget* target,
} else {
GrAssert(readDst != buffer); GrAssert(rowBytes != tightRowBytes);
// copy from readDst to buffer while flipping y
- const int halfY = height >> 1;
+ // const int halfY = height >> 1;
const char* src = reinterpret_cast<const char*>(readDst);
char* dst = reinterpret_cast<char*>(buffer);
if (!invertY) {
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index f383ffceb8..581a22a68f 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -249,7 +249,7 @@ void GrGpuGL::flushTextureMatrixAndDomain(int s) {
void GrGpuGL::flushColorMatrix() {
- const ProgramDesc& desc = fCurrentProgram.getDesc();
+ // const ProgramDesc& desc = fCurrentProgram.getDesc();
int matrixUni = fProgramData->fUniLocations.fColorMatrixUni;
int vecUni = fProgramData->fUniLocations.fColorMatrixVecUni;
if (GrGLProgram::kUnusedUniform != matrixUni
@@ -330,7 +330,7 @@ void GrGpuGL::flushColor(GrColor color) {
void GrGpuGL::flushCoverage(GrColor coverage) {
const ProgramDesc& desc = fCurrentProgram.getDesc();
- const GrDrawState& drawState = this->getDrawState();
+ // const GrDrawState& drawState = this->getDrawState();
if (this->getVertexLayout() & kCoverage_VertexLayoutBit) {
diff --git a/src/gpu/gl/GrGpuGL_unittest.cpp b/src/gpu/gl/GrGpuGL_unittest.cpp
index 3543830730..9dbb708e1b 100644
--- a/src/gpu/gl/GrGpuGL_unittest.cpp
+++ b/src/gpu/gl/GrGpuGL_unittest.cpp
@@ -113,7 +113,7 @@ GrCustomStage* create_random_effect(StageDesc* stageDesc,
bool GrGpuGL::programUnitTest() {
- GrGLSLGeneration glslGeneration =
+ // GrGLSLGeneration glslGeneration =
GrGetGLSLGeneration(this->glBinding(), this->glInterface());
static const int STAGE_OPTS[] = {
0,
@@ -206,9 +206,6 @@ bool GrGpuGL::programUnitTest() {
stage.fOptFlags = STAGE_OPTS[random_int(&random, GR_ARRAY_COUNT(STAGE_OPTS))];
stage.fInConfigFlags = IN_CONFIG_FLAGS[random_int(&random, GR_ARRAY_COUNT(IN_CONFIG_FLAGS))];
stage.setEnabled(VertexUsesStage(s, pdesc.fVertexLayout));
- static const uint32_t kMulByAlphaMask =
- StageDesc::kMulRGBByAlpha_RoundUp_InConfigFlag |
- StageDesc::kMulRGBByAlpha_RoundDown_InConfigFlag;
bool useCustomEffect = random_bool(&random);
if (useCustomEffect) {
diff --git a/src/gpu/gl/debug/GrFrameBufferObj.cpp b/src/gpu/gl/debug/GrFrameBufferObj.cpp
index 331be8a702..24ab12056a 100644
--- a/src/gpu/gl/debug/GrFrameBufferObj.cpp
+++ b/src/gpu/gl/debug/GrFrameBufferObj.cpp
@@ -64,4 +64,4 @@ void GrFrameBufferObj::setStencil(GrFBBindableObj *buffer) {
GrAlwaysAssert(!fStencilBuffer->getStencilBound(this));
fStencilBuffer->setStencilBound(this);
}
-} \ No newline at end of file
+}
diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
index 4a04a385c9..ffeaf89fc0 100644
--- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
+++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
@@ -30,6 +30,8 @@ static const GrGLint kDefaultMaxVertexAttribs = 8;
// the OpenGLES 2.0 spec says this must be >= 8
static const GrGLint kDefaultMaxVaryingVectors = 8;
+namespace { // suppress no previsous prototype warning
+
////////////////////////////////////////////////////////////////////////////////
GrGLvoid GR_GL_FUNCTION_TYPE debugGLActiveTexture(GrGLenum texture) {
@@ -862,6 +864,8 @@ GrGLint GR_GL_FUNCTION_TYPE debugGLGetUniformLocation(GrGLuint program, const ch
return ++gUniLocation;
}
+} // end of namespace
+
////////////////////////////////////////////////////////////////////////////////
struct GrDebugGLInterface : public GrGLInterface {
diff --git a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
index d08d6022f6..2ae8782e5c 100644
--- a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
+++ b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
@@ -15,7 +15,7 @@
#include <dlfcn.h>
-void* GetProcAddress(const char* name) {
+static void* GetProcAddress(const char* name) {
return dlsym(RTLD_DEFAULT, name);
}
diff --git a/src/gpu/gl/mac/SkNativeGLContext_mac.cpp b/src/gpu/gl/mac/SkNativeGLContext_mac.cpp
index 18b36a5608..2dcf8ae09c 100644
--- a/src/gpu/gl/mac/SkNativeGLContext_mac.cpp
+++ b/src/gpu/gl/mac/SkNativeGLContext_mac.cpp
@@ -33,7 +33,7 @@ void SkNativeGLContext::destroyGLContext() {
const GrGLInterface* SkNativeGLContext::createGLContext() {
GLint major, minor;
- AGLContext ctx;
+ // AGLContext ctx;
aglGetVersion(&major, &minor);
//SkDebugf("---- agl version %d %d\n", major, minor);
diff --git a/src/gpu/gr_unittests.cpp b/src/gpu/gr_unittests.cpp
index 4adc7e9c82..d55486130d 100644
--- a/src/gpu/gr_unittests.cpp
+++ b/src/gpu/gr_unittests.cpp
@@ -14,6 +14,9 @@
#include "GrRedBlackTree.h"
#include "GrTDArray.h"
+// FIXME: needs to be in a header
+void gr_run_unittests();
+
// If we aren't inheriting these as #defines from elsewhere,
// clang demands they be declared before we #include the template
// that relies on them.