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
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index b23a1f8..7b2bb35 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -98,7 +98,6 @@
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 @@
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 57b7851..70e9cee 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 @@
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 8c12ad6..b1d6d4f 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -1229,9 +1229,9 @@
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 @@
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 @@
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 87bdb4a..7b3da4f 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 3d40eb3..f9d4cbb 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 @@
fLastSuccessfulStencilFmtIdx = 0;
fCanPreserveUnpremulRoundtrip = kUnknown_CanPreserveUnpremulRoundtrip;
+ if (false) { // avoid bit rot, suppress warning
+ fbo_test(this->glInterface(), 0, 0);
+ }
}
GrGpuGL::~GrGpuGL() {
@@ -526,7 +529,7 @@
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 @@
return NULL;
}
-#if GR_DEBUG
+#if 0 && GR_DEBUG
static size_t as_size_t(int x) {
return x;
}
@@ -1443,7 +1446,7 @@
}
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 @@
} 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 f383ffc..581a22a 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -249,7 +249,7 @@
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::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 3543830..9dbb708 100644
--- a/src/gpu/gl/GrGpuGL_unittest.cpp
+++ b/src/gpu/gl/GrGpuGL_unittest.cpp
@@ -113,7 +113,7 @@
bool GrGpuGL::programUnitTest() {
- GrGLSLGeneration glslGeneration =
+ // GrGLSLGeneration glslGeneration =
GrGetGLSLGeneration(this->glBinding(), this->glInterface());
static const int STAGE_OPTS[] = {
0,
@@ -206,9 +206,6 @@
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 331be8a..24ab120 100644
--- a/src/gpu/gl/debug/GrFrameBufferObj.cpp
+++ b/src/gpu/gl/debug/GrFrameBufferObj.cpp
@@ -64,4 +64,4 @@
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 4a04a38..ffeaf89 100644
--- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
+++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
@@ -30,6 +30,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 @@
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 d08d602..2ae8782 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 18b36a5..2dcf8ae 100644
--- a/src/gpu/gl/mac/SkNativeGLContext_mac.cpp
+++ b/src/gpu/gl/mac/SkNativeGLContext_mac.cpp
@@ -33,7 +33,7 @@
const GrGLInterface* SkNativeGLContext::createGLContext() {
GLint major, minor;
- AGLContext ctx;
+ // AGLContext ctx;
aglGetVersion(&major, &minor);
//SkDebugf("---- agl version %d %d\n", major, minor);