From 70f3510a27f347693e198e4acccf46d5b492f287 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 30 May 2014 16:21:31 +0800 Subject: [PATCH 1/2] issue #5429: treat warning as eror on iOS --- build/cocos2d_libs.xcodeproj/project.pbxproj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index 26fe28a210..876ce2eb1b 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -7235,6 +7235,7 @@ "$(inherited)", CC_TARGET_OS_IPHONE, ); + GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES; HEADER_SEARCH_PATHS = ""; IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; @@ -7273,6 +7274,7 @@ "$(inherited)", CC_TARGET_OS_IPHONE, ); + GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES; HEADER_SEARCH_PATHS = ""; IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; @@ -7329,6 +7331,7 @@ "$(inherited)", CC_TARGET_OS_IPHONE, ); + GCC_TREAT_WARNINGS_AS_ERRORS = YES; HEADER_SEARCH_PATHS = ""; IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; LIBRARY_SEARCH_PATHS = "$(inherited)"; @@ -7347,6 +7350,7 @@ "$(inherited)", CC_TARGET_OS_IPHONE, ); + GCC_TREAT_WARNINGS_AS_ERRORS = YES; HEADER_SEARCH_PATHS = ""; IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; LIBRARY_SEARCH_PATHS = "$(inherited)"; @@ -7425,6 +7429,7 @@ "$(inherited)", CC_TARGET_OS_IPHONE, ); + GCC_TREAT_WARNINGS_AS_ERRORS = YES; HEADER_SEARCH_PATHS = ""; IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; SDKROOT = iphoneos; @@ -7442,6 +7447,7 @@ "$(inherited)", CC_TARGET_OS_IPHONE, ); + GCC_TREAT_WARNINGS_AS_ERRORS = YES; HEADER_SEARCH_PATHS = ""; IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; SDKROOT = iphoneos; From 4b979d67db3fab58bfc8857c966d40090bf63da8 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 30 May 2014 16:46:01 +0800 Subject: [PATCH 2/2] issue #5429: treat warning as error on Mac --- build/cocos2d_libs.xcodeproj/project.pbxproj | 6 ++++++ cocos/3d/CCObjLoader.cpp | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index 876ce2eb1b..65dd584d5d 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -7061,6 +7061,7 @@ CC_TARGET_OS_MAC, CC_KEYBOARD_SUPPORT, ); + GCC_TREAT_WARNINGS_AS_ERRORS = YES; HEADER_SEARCH_PATHS = ""; LIBRARY_SEARCH_PATHS = ( "$(inherited)", @@ -7087,6 +7088,7 @@ CC_KEYBOARD_SUPPORT, CC_TARGET_OS_MAC, ); + GCC_TREAT_WARNINGS_AS_ERRORS = YES; HEADER_SEARCH_PATHS = ""; LIBRARY_SEARCH_PATHS = ( "$(inherited)", @@ -7179,6 +7181,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; GCC_PREPROCESSOR_DEFINITIONS = CC_TARGET_OS_MAC; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; HEADER_SEARCH_PATHS = ""; USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac"; }; @@ -7189,6 +7192,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; GCC_PREPROCESSOR_DEFINITIONS = CC_TARGET_OS_MAC; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; HEADER_SEARCH_PATHS = ""; USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac"; }; @@ -7203,6 +7207,7 @@ CC_TARGET_OS_MAC, CC_KEYBOARD_SUPPORT, ); + GCC_TREAT_WARNINGS_AS_ERRORS = YES; HEADER_SEARCH_PATHS = ""; LIBRARY_SEARCH_PATHS = "$(inherited)"; USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../cocos/platform/desktop $(SRCROOT)/../external/glfw3/include/mac"; @@ -7218,6 +7223,7 @@ CC_TARGET_OS_MAC, CC_KEYBOARD_SUPPORT, ); + GCC_TREAT_WARNINGS_AS_ERRORS = YES; HEADER_SEARCH_PATHS = ""; LIBRARY_SEARCH_PATHS = "$(inherited)"; USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../cocos/platform/desktop $(SRCROOT)/../external/glfw3/include/mac"; diff --git a/cocos/3d/CCObjLoader.cpp b/cocos/3d/CCObjLoader.cpp index 939de77984..4c5da0d89e 100644 --- a/cocos/3d/CCObjLoader.cpp +++ b/cocos/3d/CCObjLoader.cpp @@ -603,7 +603,8 @@ std::string ObjLoader::LoadObj(shapes_t& shapes, const char* filename, const cha std::vector face; while (!isNewLine(token[0])) { - vertex_index vi = parseTriple(token, v.size() / 3, vn.size() / 3, vt.size() / 2); + // fix warning, cast to int, i think int is enough + vertex_index vi = parseTriple(token, (int)v.size() / 3, (int)vn.size() / 3, (int)vt.size() / 2); face.push_back(vi); auto n = strspn(token, " \t\r"); token += n;