From 14b6a046a3b8a9328a91921d44ecb99ba5358c00 Mon Sep 17 00:00:00 2001 From: James Chen Date: Sun, 11 May 2014 12:14:17 +0800 Subject: [PATCH] Warning fix in CCDeprecated.cpp and CCGLProgramState.h --- cocos/deprecated/CCDeprecated.cpp | 35 +++++++++++++++++++++++++++---- cocos/deprecated/CCDeprecated.h | 34 +++++++++++++++--------------- cocos/renderer/CCGLProgramState.h | 4 ++-- 3 files changed, 50 insertions(+), 23 deletions(-) diff --git a/cocos/deprecated/CCDeprecated.cpp b/cocos/deprecated/CCDeprecated.cpp index b95b106742..0faa03ca17 100644 --- a/cocos/deprecated/CCDeprecated.cpp +++ b/cocos/deprecated/CCDeprecated.cpp @@ -1,19 +1,19 @@ /**************************************************************************** Copyright (c) 2013 cocos2d-x.org Copyright (c) 2013-2014 Chukong Technologies Inc. - + http://www.cocos2d-x.org - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -25,6 +25,13 @@ #include "cocos2d.h" +#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#elif _MSC_VER >= 1400 //vs 2005 or higher +#pragma warning (push) +#pragma warning (disable: 4996) +#endif + NS_CC_BEGIN const Vector2 CCPointZero = Vector2::ZERO; @@ -568,4 +575,24 @@ Vector4* kmVec4Transform(Vector4* pOut, const Vector4* pV, const Matrix* pM) return pOut; } +const Vector3 KM_VEC3_NEG_Z = Vector3(0, 0, -1); +const Vector3 KM_VEC3_POS_Z = Vector3(0, 0, 1); +const Vector3 KM_VEC3_POS_Y = Vector3(0, 1, 0); +const Vector3 KM_VEC3_NEG_Y = Vector3(0, -1, 0); +const Vector3 KM_VEC3_NEG_X = Vector3(-1, 0, 0); +const Vector3 KM_VEC3_POS_X = Vector3(1, 0, 0); +const Vector3 KM_VEC3_ZERO = Vector3(0, 0, 0); + +const Vector2 KM_VEC2_POS_Y = Vector2(0, 1); +const Vector2 KM_VEC2_NEG_Y = Vector2(0, -1); +const Vector2 KM_VEC2_NEG_X = Vector2(-1, 0); +const Vector2 KM_VEC2_POS_X = Vector2(1, 0); +const Vector2 KM_VEC2_ZERO = Vector2(0, 0); + NS_CC_END + +#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) +#pragma GCC diagnostic warning "-Wdeprecated-declarations" +#elif _MSC_VER >= 1400 //vs 2005 or higher +#pragma warning (pop) +#endif diff --git a/cocos/deprecated/CCDeprecated.h b/cocos/deprecated/CCDeprecated.h index 7c302b0f05..b471ed1a98 100644 --- a/cocos/deprecated/CCDeprecated.h +++ b/cocos/deprecated/CCDeprecated.h @@ -1,19 +1,19 @@ /**************************************************************************** Copyright (c) 2013 cocos2d-x.org Copyright (c) 2013-2014 Chukong Technologies Inc. - + http://www.cocos2d-x.org - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -446,7 +446,7 @@ CC_DEPRECATED_ATTRIBUTE static inline Color4F ccc4FFromccc4B(Color4B c) CC_DEPRECATED_ATTRIBUTE static inline Color4B ccc4BFromccc4F(Color4F c) { - return Color4B((GLubyte)(c.r*255), (GLubyte)(c.g*255), (GLubyte)(c.b*255), (GLubyte)(c.a*255)); + return Color4B((GLubyte)(c.r*255), (GLubyte)(c.g*255), (GLubyte)(c.b*255), (GLubyte)(c.a*255)); } CC_DEPRECATED_ATTRIBUTE static inline bool ccc4FEqual(Color4F a, Color4F b) @@ -1110,13 +1110,13 @@ CC_DEPRECATED_ATTRIBUTE CC_DLL Vector3* kmVec3Scale(Vector3* pOut, const Vector3 CC_DEPRECATED_ATTRIBUTE CC_DLL Vector3* kmVec3Assign(Vector3* pOut, const Vector3* pIn); CC_DEPRECATED_ATTRIBUTE CC_DLL Vector3* kmVec3Zero(Vector3* pOut); -CC_DEPRECATED_ATTRIBUTE const Vector3 KM_VEC3_NEG_Z = Vector3(0, 0, -1); -CC_DEPRECATED_ATTRIBUTE const Vector3 KM_VEC3_POS_Z = Vector3(0, 0, 1); -CC_DEPRECATED_ATTRIBUTE const Vector3 KM_VEC3_POS_Y = Vector3(0, 1, 0); -CC_DEPRECATED_ATTRIBUTE const Vector3 KM_VEC3_NEG_Y = Vector3(0, -1, 0); -CC_DEPRECATED_ATTRIBUTE const Vector3 KM_VEC3_NEG_X = Vector3(-1, 0, 0); -CC_DEPRECATED_ATTRIBUTE const Vector3 KM_VEC3_POS_X = Vector3(1, 0, 0); -CC_DEPRECATED_ATTRIBUTE const Vector3 KM_VEC3_ZERO = Vector3(0, 0, 0); +CC_DEPRECATED_ATTRIBUTE extern const Vector3 KM_VEC3_NEG_Z; +CC_DEPRECATED_ATTRIBUTE extern const Vector3 KM_VEC3_POS_Z; +CC_DEPRECATED_ATTRIBUTE extern const Vector3 KM_VEC3_POS_Y; +CC_DEPRECATED_ATTRIBUTE extern const Vector3 KM_VEC3_NEG_Y; +CC_DEPRECATED_ATTRIBUTE extern const Vector3 KM_VEC3_NEG_X; +CC_DEPRECATED_ATTRIBUTE extern const Vector3 KM_VEC3_POS_X; +CC_DEPRECATED_ATTRIBUTE extern const Vector3 KM_VEC3_ZERO; //kmVec2 CC_DEPRECATED_ATTRIBUTE typedef Vector2 kmVec2; @@ -1131,11 +1131,11 @@ CC_DEPRECATED_ATTRIBUTE CC_DLL Vector2* kmVec2Subtract(Vector2* pOut, const Vect CC_DEPRECATED_ATTRIBUTE CC_DLL Vector2* kmVec2Scale(Vector2* pOut, const Vector2* pIn, const float s); CC_DEPRECATED_ATTRIBUTE CC_DLL Vector2* kmVec2Assign(Vector2* pOut, const Vector2* pIn); -CC_DEPRECATED_ATTRIBUTE const Vector2 KM_VEC2_POS_Y = Vector2(0, 1); -CC_DEPRECATED_ATTRIBUTE const Vector2 KM_VEC2_NEG_Y = Vector2(0, -1); -CC_DEPRECATED_ATTRIBUTE const Vector2 KM_VEC2_NEG_X = Vector2(-1, 0); -CC_DEPRECATED_ATTRIBUTE const Vector2 KM_VEC2_POS_X = Vector2(1, 0); -CC_DEPRECATED_ATTRIBUTE const Vector2 KM_VEC2_ZERO = Vector2(0, 0); +CC_DEPRECATED_ATTRIBUTE extern const Vector2 KM_VEC2_POS_Y; +CC_DEPRECATED_ATTRIBUTE extern const Vector2 KM_VEC2_NEG_Y; +CC_DEPRECATED_ATTRIBUTE extern const Vector2 KM_VEC2_NEG_X; +CC_DEPRECATED_ATTRIBUTE extern const Vector2 KM_VEC2_POS_X; +CC_DEPRECATED_ATTRIBUTE extern const Vector2 KM_VEC2_ZERO; //kmVec4 CC_DEPRECATED_ATTRIBUTE typedef Vector4 kmVec4; diff --git a/cocos/renderer/CCGLProgramState.h b/cocos/renderer/CCGLProgramState.h index 355bb959f6..613a81aa6b 100644 --- a/cocos/renderer/CCGLProgramState.h +++ b/cocos/renderer/CCGLProgramState.h @@ -36,8 +36,8 @@ THE SOFTWARE. NS_CC_BEGIN class GLProgram; -class Uniform; -class VertexAttrib; +struct Uniform; +struct VertexAttrib; // //