fixes for some warnings:
- #if of something that was not defined
- explicit constructor call for baseclass in copy-constructor of subclass
http://code.google.com/p/skia/issues/detail?id=112
git-svn-id: http://skia.googlecode.com/svn/trunk@727 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/Makefile b/Makefile
index 3c3e824..4817d50 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,7 @@
C_INCLUDES := -Iinclude/config -Iinclude/core -Iinclude/effects -Iinclude/images -Iinclude/gpu -Iinclude/utils -Igpu/include
CFLAGS := -Wall -fstrict-aliasing
+#CFLAGS += -W -Wextra -Wcast-align -Wchar-subscripts -Wformat -Wformat-security -Wno-format-y2k -Wno-parentheses -Wno-unused-parameter -Wpointer-arith -Wreturn-type -Wundef -Wwrite-strings
CFLAGS_SSE2 = $(CFLAGS) -msse2
LINKER_OPTS := -lpthread -lz
DEFINES := -DSK_CAN_USE_FLOAT
@@ -19,9 +20,9 @@
ifeq ($(SKIA_DEBUG),true)
DEFINES += -DSK_DEBUG -DSK_SUPPORT_UNIT -DGR_DEBUG=1
- CFLAGS := -g
+ CFLAGS += -g
else
- CFLAGS := -O2
+ CFLAGS += -O2
DEFINES += -DSK_RELEASE -DGR_DEBUG=0
endif
diff --git a/gpu/include/GrConfig.h b/gpu/include/GrConfig.h
index 9c18f60..e933b03 100644
--- a/gpu/include/GrConfig.h
+++ b/gpu/include/GrConfig.h
@@ -68,7 +68,7 @@
#undef GR_IOS_BUILD
#define GR_IOS_BUILD 1
// #error "IOS"
- #elif ANDROID_NDK || defined(ANDROID)
+ #elif (defined(ANDROID_NDK) && ANDROID_NDK) || defined(ANDROID)
#undef GR_ANDROID_BUILD
#define GR_ANDROID_BUILD 1
// #error "ANDROID"
@@ -87,15 +87,28 @@
#endif
#endif
-#if !defined(GR_DEBUG) && !defined(GR_RELEASE)
- #ifdef NDEBUG
- #define GR_DEBUG 0
+// we need both GR_DEBUG and GR_RELEASE to be defined as 0 or 1
+//
+#ifndef GR_DEBUG
+ #ifdef GR_RELEASE
+ #define GR_DEBUG !GR_RELEASE
#else
- #define GR_DEBUG 1
+ #ifdef NDEBUG
+ #define GR_DEBUG 0
+ #else
+ #define GR_DEBUG 1
+ #endif
#endif
+#endif
+
+#ifndef GR_RELEASE
#define GR_RELEASE !GR_DEBUG
#endif
+#if GR_DEBUG == GR_RELEASE
+ #error "GR_DEBUG and GR_RELEASE must not be the same
+#endif
+
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
@@ -159,7 +172,7 @@
* particular compiler.
* To insert compiler warnings use "#pragma message GR_WARN(<string>)"
*/
-#if _MSC_VER
+#if defined(_MSC_VER) && _MSC_VER
#define GR_WARN(MSG) (GR_FILE_AND_LINE_STR "WARNING: " MSG)
#else//__GNUC__ - may need other defines for different compilers
#define GR_WARN(MSG) ("WARNING: " MSG)
@@ -239,7 +252,7 @@
// VS 2010 and GCC compiled with c++0x or gnu++0x support the new
// static_assert.
#if !defined(GR_STATIC_ASSERT)
- #if (_MSC_VER >= 1600) || __GXX_EXPERIMENTAL_CXX0X__
+ #if (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)
#define GR_STATIC_ASSERT(CONDITION) static_assert(CONDITION, "bug")
#else
template <bool> class GR_STATIC_ASSERT_FAILURE;
diff --git a/gpu/include/GrPath.h b/gpu/include/GrPath.h
index a9b7566..cf7b97f 100644
--- a/gpu/include/GrPath.h
+++ b/gpu/include/GrPath.h
@@ -78,6 +78,8 @@
}
friend class Iter;
+
+ typedef GrPathSink INHERITED;
};
#endif
diff --git a/gpu/src/GrGLUtil.cpp b/gpu/src/GrGLUtil.cpp
index c1ed0f4..360e84e 100644
--- a/gpu/src/GrGLUtil.cpp
+++ b/gpu/src/GrGLUtil.cpp
@@ -104,7 +104,7 @@
bool fboFound = false;
#if GR_SUPPORT_GLDESKTOP
- #if GL_VERSION_3_0
+ #if defined(GL_VERSION_3_0) && GL_VERSION_3_0
if (!fboFound && major >= 3) { // all of ARB_fbo is in 3.x
exts->GenFramebuffers = glGenFramebuffers;
exts->BindFramebuffer = glBindFramebuffer;
diff --git a/gpu/src/GrGpuGL.cpp b/gpu/src/GrGpuGL.cpp
index f0c7cff..ae27189 100644
--- a/gpu/src/GrGpuGL.cpp
+++ b/gpu/src/GrGpuGL.cpp
@@ -1166,12 +1166,6 @@
GR_GL(DrawArrays(gPrimitiveType2GLMode[type], 0, vertexCount));
}
-#if !defined(SK_GL_HAS_COLOR4UB)
-static inline GrFixed byte2fixed(unsigned value) {
- return (value + (value >> 7)) << 8;
-}
-#endif
-
void GrGpuGL::resolveTextureRenderTarget(GrGLTexture* texture) {
GrGLRenderTarget* rt = (GrGLRenderTarget*) texture->asRenderTarget();
diff --git a/gpu/src/GrGpuGL.h b/gpu/src/GrGpuGL.h
index dbc5de3..0ba405d 100644
--- a/gpu/src/GrGpuGL.h
+++ b/gpu/src/GrGpuGL.h
@@ -177,10 +177,6 @@
#define GrGL_RestoreResetRowLength()
#endif
-#if SK_TextGLType != GL_FIXED
- #define SK_GL_HAS_COLOR4UB
-#endif
-
/*
* Some drivers want the var-int arg to be zero-initialized on input.
*/
diff --git a/gpu/src/GrGpuGLShaders.cpp b/gpu/src/GrGpuGLShaders.cpp
index c7baf1f..053479f 100644
--- a/gpu/src/GrGpuGLShaders.cpp
+++ b/gpu/src/GrGpuGLShaders.cpp
@@ -192,11 +192,7 @@
"void main() {\n"
// On Brian's PC laptop with Intel Gfx texture2DProj seems to be broken
// but it works everywhere else tested.
-#if GR_GLSL_2DPROJ_BROKEN
- " gl_FragColor = vColor * texture2D(sTexture, vTexture.xy / vTexture.z);\n"
-#else
" gl_FragColor = vColor * texture2DProj(sTexture, vTexture);\n"
-#endif
"}\n",
diff --git a/gpu/src/GrPath.cpp b/gpu/src/GrPath.cpp
index 7b117eb..554b3b9 100644
--- a/gpu/src/GrPath.cpp
+++ b/gpu/src/GrPath.cpp
@@ -2,7 +2,7 @@
GrPath::GrPath() {}
-GrPath::GrPath(const GrPath& src) {
+GrPath::GrPath(const GrPath& src) : INHERITED() {
}
GrPath::GrPath(GrPathIter& iter) {
diff --git a/include/utils/SkLayer.h b/include/utils/SkLayer.h
index c42261f..80a2137 100644
--- a/include/utils/SkLayer.h
+++ b/include/utils/SkLayer.h
@@ -128,6 +128,8 @@
uint32_t fFlags;
SkTDArray<SkLayer*> m_children;
+
+ typedef SkRefCnt INHERITED;
};
#endif
diff --git a/src/utils/SkLayer.cpp b/src/utils/SkLayer.cpp
index 5c68261..1c484bd 100644
--- a/src/utils/SkLayer.cpp
+++ b/src/utils/SkLayer.cpp
@@ -27,7 +27,7 @@
#endif
}
-SkLayer::SkLayer(const SkLayer& src) {
+SkLayer::SkLayer(const SkLayer& src) : INHERITED() {
fParent = NULL;
m_opacity = src.m_opacity;
m_size = src.m_size;