Enable more compiler warnings in the Xcode projects (based on Xcode 8's suggestion), made some integer downcasts explicit.
authorAlex Szpakowski <slime73@gmail.com>
Tue, 13 Sep 2016 19:51:10 -0300
changeset 10339826c707b4e7d
parent 10338 638ec32cfcce
child 10340 5724f5087acd
Enable more compiler warnings in the Xcode projects (based on Xcode 8's suggestion), made some integer downcasts explicit.
Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
Xcode/SDL/SDL.xcodeproj/project.pbxproj
src/video/cocoa/SDL_cocoakeyboard.m
src/video/cocoa/SDL_cocoamodes.m
src/video/cocoa/SDL_cocoawindow.m
     1.1 --- a/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj	Tue Sep 13 00:09:21 2016 -0700
     1.2 +++ b/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj	Tue Sep 13 19:51:10 2016 -0300
     1.3 @@ -1091,7 +1091,7 @@
     1.4  		29B97313FDCFA39411CA2CEA /* Project object */ = {
     1.5  			isa = PBXProject;
     1.6  			attributes = {
     1.7 -				LastUpgradeCheck = 0630;
     1.8 +				LastUpgradeCheck = 0800;
     1.9  			};
    1.10  			buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SDL" */;
    1.11  			compatibilityVersion = "Xcode 3.2";
    1.12 @@ -1259,10 +1259,27 @@
    1.13  		C01FCF4F08A954540054247B /* Debug */ = {
    1.14  			isa = XCBuildConfiguration;
    1.15  			buildSettings = {
    1.16 +				CLANG_WARN_BOOL_CONVERSION = YES;
    1.17 +				CLANG_WARN_CONSTANT_CONVERSION = YES;
    1.18 +				CLANG_WARN_EMPTY_BODY = YES;
    1.19 +				CLANG_WARN_ENUM_CONVERSION = YES;
    1.20 +				CLANG_WARN_INFINITE_RECURSION = YES;
    1.21 +				CLANG_WARN_INT_CONVERSION = YES;
    1.22 +				CLANG_WARN_SUSPICIOUS_MOVE = YES;
    1.23 +				CLANG_WARN_UNREACHABLE_CODE = YES;
    1.24 +				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
    1.25  				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
    1.26 +				ENABLE_STRICT_OBJC_MSGSEND = YES;
    1.27 +				ENABLE_TESTABILITY = YES;
    1.28 +				GCC_NO_COMMON_BLOCKS = YES;
    1.29  				GCC_OPTIMIZATION_LEVEL = 0;
    1.30  				GCC_SYMBOLS_PRIVATE_EXTERN = YES;
    1.31 +				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
    1.32  				GCC_WARN_ABOUT_RETURN_TYPE = YES;
    1.33 +				GCC_WARN_UNDECLARED_SELECTOR = YES;
    1.34 +				GCC_WARN_UNINITIALIZED_AUTOS = YES;
    1.35 +				GCC_WARN_UNUSED_FUNCTION = YES;
    1.36 +				GCC_WARN_UNUSED_VARIABLE = YES;
    1.37  				IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
    1.38  				ONLY_ACTIVE_ARCH = YES;
    1.39  				SDKROOT = iphoneos;
    1.40 @@ -1273,9 +1290,25 @@
    1.41  		C01FCF5008A954540054247B /* Release */ = {
    1.42  			isa = XCBuildConfiguration;
    1.43  			buildSettings = {
    1.44 +				CLANG_WARN_BOOL_CONVERSION = YES;
    1.45 +				CLANG_WARN_CONSTANT_CONVERSION = YES;
    1.46 +				CLANG_WARN_EMPTY_BODY = YES;
    1.47 +				CLANG_WARN_ENUM_CONVERSION = YES;
    1.48 +				CLANG_WARN_INFINITE_RECURSION = YES;
    1.49 +				CLANG_WARN_INT_CONVERSION = YES;
    1.50 +				CLANG_WARN_SUSPICIOUS_MOVE = YES;
    1.51 +				CLANG_WARN_UNREACHABLE_CODE = YES;
    1.52 +				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
    1.53  				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
    1.54 +				ENABLE_STRICT_OBJC_MSGSEND = YES;
    1.55 +				GCC_NO_COMMON_BLOCKS = YES;
    1.56  				GCC_SYMBOLS_PRIVATE_EXTERN = YES;
    1.57 +				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
    1.58  				GCC_WARN_ABOUT_RETURN_TYPE = YES;
    1.59 +				GCC_WARN_UNDECLARED_SELECTOR = YES;
    1.60 +				GCC_WARN_UNINITIALIZED_AUTOS = YES;
    1.61 +				GCC_WARN_UNUSED_FUNCTION = YES;
    1.62 +				GCC_WARN_UNUSED_VARIABLE = YES;
    1.63  				IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
    1.64  				SDKROOT = iphoneos;
    1.65  				TARGETED_DEVICE_FAMILY = "1,2";
     2.1 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Tue Sep 13 00:09:21 2016 -0700
     2.2 +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Tue Sep 13 19:51:10 2016 -0300
     2.3 @@ -2315,7 +2315,7 @@
     2.4  		0867D690FE84028FC02AAC07 /* Project object */ = {
     2.5  			isa = PBXProject;
     2.6  			attributes = {
     2.7 -				LastUpgradeCheck = 0630;
     2.8 +				LastUpgradeCheck = 0800;
     2.9  				TargetAttributes = {
    2.10  					BECDF5FE0761BA81005FE872 = {
    2.11  						DevelopmentTeam = EH385AYQ6F;
    2.12 @@ -2759,13 +2759,30 @@
    2.13  		00CFA621106A567900758660 /* Release */ = {
    2.14  			isa = XCBuildConfiguration;
    2.15  			buildSettings = {
    2.16 +				CLANG_WARN_BOOL_CONVERSION = YES;
    2.17 +				CLANG_WARN_CONSTANT_CONVERSION = YES;
    2.18 +				CLANG_WARN_EMPTY_BODY = YES;
    2.19 +				CLANG_WARN_ENUM_CONVERSION = YES;
    2.20 +				CLANG_WARN_INFINITE_RECURSION = YES;
    2.21 +				CLANG_WARN_INT_CONVERSION = YES;
    2.22 +				CLANG_WARN_SUSPICIOUS_MOVE = YES;
    2.23 +				CLANG_WARN_UNREACHABLE_CODE = YES;
    2.24 +				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
    2.25  				DEPLOYMENT_POSTPROCESSING = YES;
    2.26 +				ENABLE_STRICT_OBJC_MSGSEND = YES;
    2.27  				GCC_ALTIVEC_EXTENSIONS = YES;
    2.28  				GCC_AUTO_VECTORIZATION = YES;
    2.29  				GCC_ENABLE_SSE3_EXTENSIONS = YES;
    2.30  				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
    2.31 +				GCC_NO_COMMON_BLOCKS = YES;
    2.32  				GCC_OPTIMIZATION_LEVEL = 3;
    2.33  				GCC_SYMBOLS_PRIVATE_EXTERN = YES;
    2.34 +				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
    2.35 +				GCC_WARN_ABOUT_RETURN_TYPE = YES;
    2.36 +				GCC_WARN_UNDECLARED_SELECTOR = YES;
    2.37 +				GCC_WARN_UNINITIALIZED_AUTOS = YES;
    2.38 +				GCC_WARN_UNUSED_FUNCTION = YES;
    2.39 +				GCC_WARN_UNUSED_VARIABLE = YES;
    2.40  				MACOSX_DEPLOYMENT_TARGET = 10.6;
    2.41  				SDKROOT = macosx;
    2.42  				STRIP_STYLE = "non-global";
    2.43 @@ -2819,11 +2836,29 @@
    2.44  		00CFA627106A568900758660 /* Debug */ = {
    2.45  			isa = XCBuildConfiguration;
    2.46  			buildSettings = {
    2.47 +				CLANG_WARN_BOOL_CONVERSION = YES;
    2.48 +				CLANG_WARN_CONSTANT_CONVERSION = YES;
    2.49 +				CLANG_WARN_EMPTY_BODY = YES;
    2.50 +				CLANG_WARN_ENUM_CONVERSION = YES;
    2.51 +				CLANG_WARN_INFINITE_RECURSION = YES;
    2.52 +				CLANG_WARN_INT_CONVERSION = YES;
    2.53 +				CLANG_WARN_SUSPICIOUS_MOVE = YES;
    2.54 +				CLANG_WARN_UNREACHABLE_CODE = YES;
    2.55 +				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
    2.56 +				ENABLE_STRICT_OBJC_MSGSEND = YES;
    2.57 +				ENABLE_TESTABILITY = YES;
    2.58  				GCC_ALTIVEC_EXTENSIONS = YES;
    2.59  				GCC_AUTO_VECTORIZATION = YES;
    2.60  				GCC_ENABLE_SSE3_EXTENSIONS = YES;
    2.61 +				GCC_NO_COMMON_BLOCKS = YES;
    2.62  				GCC_OPTIMIZATION_LEVEL = 0;
    2.63  				GCC_SYMBOLS_PRIVATE_EXTERN = YES;
    2.64 +				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
    2.65 +				GCC_WARN_ABOUT_RETURN_TYPE = YES;
    2.66 +				GCC_WARN_UNDECLARED_SELECTOR = YES;
    2.67 +				GCC_WARN_UNINITIALIZED_AUTOS = YES;
    2.68 +				GCC_WARN_UNUSED_FUNCTION = YES;
    2.69 +				GCC_WARN_UNUSED_VARIABLE = YES;
    2.70  				MACOSX_DEPLOYMENT_TARGET = 10.6;
    2.71  				ONLY_ACTIVE_ARCH = YES;
    2.72  				SDKROOT = macosx;
     3.1 --- a/src/video/cocoa/SDL_cocoakeyboard.m	Tue Sep 13 00:09:21 2016 -0700
     3.2 +++ b/src/video/cocoa/SDL_cocoakeyboard.m	Tue Sep 13 19:51:10 2016 -0300
     3.3 @@ -112,7 +112,7 @@
     3.4      _markedRange = NSMakeRange(0, [aString length]);
     3.5  
     3.6      SDL_SendEditingText([aString UTF8String],
     3.7 -                        selectedRange.location, selectedRange.length);
     3.8 +                        (int) selectedRange.location, (int) selectedRange.length);
     3.9  
    3.10      DEBUG_IME(@"setMarkedText: %@, (%d, %d)", _markedText,
    3.11            selRange.location, selRange.length);
     4.1 --- a/src/video/cocoa/SDL_cocoamodes.m	Tue Sep 13 00:09:21 2016 -0700
     4.2 +++ b/src/video/cocoa/SDL_cocoamodes.m	Tue Sep 13 19:51:10 2016 -0300
     4.3 @@ -103,10 +103,10 @@
     4.4  GetDisplayMode(_THIS, CGDisplayModeRef vidmode, CVDisplayLinkRef link, SDL_DisplayMode *mode)
     4.5  {
     4.6      SDL_DisplayModeData *data;
     4.7 -    long width = 0;
     4.8 -    long height = 0;
     4.9 -    long bpp = 0;
    4.10 -    long refreshRate = 0;
    4.11 +    int width = 0;
    4.12 +    int height = 0;
    4.13 +    int bpp = 0;
    4.14 +    int refreshRate = 0;
    4.15      CFStringRef fmt;
    4.16  
    4.17      data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data));
    4.18 @@ -116,9 +116,9 @@
    4.19      data->moderef = vidmode;
    4.20  
    4.21      fmt = CGDisplayModeCopyPixelEncoding(vidmode);
    4.22 -    width = (long) CGDisplayModeGetWidth(vidmode);
    4.23 -    height = (long) CGDisplayModeGetHeight(vidmode);
    4.24 -    refreshRate = (long) (CGDisplayModeGetRefreshRate(vidmode) + 0.5);
    4.25 +    width = (int) CGDisplayModeGetWidth(vidmode);
    4.26 +    height = (int) CGDisplayModeGetHeight(vidmode);
    4.27 +    refreshRate = (int) (CGDisplayModeGetRefreshRate(vidmode) + 0.5);
    4.28  
    4.29      if (CFStringCompare(fmt, CFSTR(IO32BitDirectPixels),
    4.30                          kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
    4.31 @@ -139,7 +139,7 @@
    4.32      if (refreshRate == 0 && link != NULL) {
    4.33          CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(link);
    4.34          if ((time.flags & kCVTimeIsIndefinite) == 0 && time.timeValue != 0) {
    4.35 -            refreshRate = (long) ((time.timeScale / (double) time.timeValue) + 0.5);
    4.36 +            refreshRate = (int) ((time.timeScale / (double) time.timeValue) + 0.5);
    4.37          }
    4.38      }
    4.39  
    4.40 @@ -320,8 +320,8 @@
    4.41      SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
    4.42  
    4.43      CGSize displaySize = CGDisplayScreenSize(data->display);
    4.44 -    size_t pixelWidth = CGDisplayPixelsWide(data->display);
    4.45 -    size_t pixelHeight = CGDisplayPixelsHigh(data->display);
    4.46 +    int pixelWidth =  (int) CGDisplayPixelsWide(data->display);
    4.47 +    int pixelHeight = (int) CGDisplayPixelsHigh(data->display);
    4.48  
    4.49      if (ddpi) {
    4.50          *ddpi = SDL_ComputeDiagonalDPI(pixelWidth, pixelHeight, displaySize.width / MM_IN_INCH, displaySize.height / MM_IN_INCH);
     5.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Tue Sep 13 00:09:21 2016 -0700
     5.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Tue Sep 13 19:51:10 2016 -0300
     5.3 @@ -855,7 +855,7 @@
     5.4          button = SDL_BUTTON_MIDDLE;
     5.5          break;
     5.6      default:
     5.7 -        button = [theEvent buttonNumber] + 1;
     5.8 +        button = (int) [theEvent buttonNumber] + 1;
     5.9          break;
    5.10      }
    5.11      SDL_SendMouseButton(_data->window, 0, SDL_PRESSED, button);
    5.12 @@ -896,7 +896,7 @@
    5.13          button = SDL_BUTTON_MIDDLE;
    5.14          break;
    5.15      default:
    5.16 -        button = [theEvent buttonNumber] + 1;
    5.17 +        button = (int) [theEvent buttonNumber] + 1;
    5.18          break;
    5.19      }
    5.20      SDL_SendMouseButton(_data->window, 0, SDL_RELEASED, button);
    5.21 @@ -1209,7 +1209,7 @@
    5.22      SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
    5.23      NSRect rect;
    5.24      SDL_Rect bounds;
    5.25 -    unsigned int style;
    5.26 +    NSUInteger style;
    5.27      NSArray *screens = [NSScreen screens];
    5.28  
    5.29      Cocoa_GetDisplayBounds(_this, display, &bounds);