Enable more compiler warnings in the Xcode projects (based on Xcode 8's suggestion), made some integer downcasts explicit.

This commit is contained in:
Alex Szpakowski 2016-09-13 19:51:10 -03:00
parent 00791f3a87
commit 86708c3cd8
5 changed files with 84 additions and 16 deletions

View File

@ -1091,7 +1091,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = { 29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0630; LastUpgradeCheck = 0800;
}; };
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SDL" */; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SDL" */;
compatibilityVersion = "Xcode 3.2"; compatibilityVersion = "Xcode 3.2";
@ -1259,10 +1259,27 @@
C01FCF4F08A954540054247B /* Debug */ = { C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos; SDKROOT = iphoneos;
@ -1273,9 +1290,25 @@
C01FCF5008A954540054247B /* Release */ = { C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
SDKROOT = iphoneos; SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";

View File

@ -2315,7 +2315,7 @@
0867D690FE84028FC02AAC07 /* Project object */ = { 0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0630; LastUpgradeCheck = 0800;
TargetAttributes = { TargetAttributes = {
BECDF5FE0761BA81005FE872 = { BECDF5FE0761BA81005FE872 = {
DevelopmentTeam = EH385AYQ6F; DevelopmentTeam = EH385AYQ6F;
@ -2759,13 +2759,30 @@
00CFA621106A567900758660 /* Release */ = { 00CFA621106A567900758660 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEPLOYMENT_POSTPROCESSING = YES; DEPLOYMENT_POSTPROCESSING = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ALTIVEC_EXTENSIONS = YES; GCC_ALTIVEC_EXTENSIONS = YES;
GCC_AUTO_VECTORIZATION = YES; GCC_AUTO_VECTORIZATION = YES;
GCC_ENABLE_SSE3_EXTENSIONS = YES; GCC_ENABLE_SSE3_EXTENSIONS = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 3; GCC_OPTIMIZATION_LEVEL = 3;
GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6; MACOSX_DEPLOYMENT_TARGET = 10.6;
SDKROOT = macosx; SDKROOT = macosx;
STRIP_STYLE = "non-global"; STRIP_STYLE = "non-global";
@ -2819,11 +2836,29 @@
00CFA627106A568900758660 /* Debug */ = { 00CFA627106A568900758660 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_ALTIVEC_EXTENSIONS = YES; GCC_ALTIVEC_EXTENSIONS = YES;
GCC_AUTO_VECTORIZATION = YES; GCC_AUTO_VECTORIZATION = YES;
GCC_ENABLE_SSE3_EXTENSIONS = YES; GCC_ENABLE_SSE3_EXTENSIONS = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6; MACOSX_DEPLOYMENT_TARGET = 10.6;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx; SDKROOT = macosx;

View File

@ -112,7 +112,7 @@
_markedRange = NSMakeRange(0, [aString length]); _markedRange = NSMakeRange(0, [aString length]);
SDL_SendEditingText([aString UTF8String], SDL_SendEditingText([aString UTF8String],
selectedRange.location, selectedRange.length); (int) selectedRange.location, (int) selectedRange.length);
DEBUG_IME(@"setMarkedText: %@, (%d, %d)", _markedText, DEBUG_IME(@"setMarkedText: %@, (%d, %d)", _markedText,
selRange.location, selRange.length); selRange.location, selRange.length);

View File

@ -103,10 +103,10 @@ static SDL_bool
GetDisplayMode(_THIS, CGDisplayModeRef vidmode, CVDisplayLinkRef link, SDL_DisplayMode *mode) GetDisplayMode(_THIS, CGDisplayModeRef vidmode, CVDisplayLinkRef link, SDL_DisplayMode *mode)
{ {
SDL_DisplayModeData *data; SDL_DisplayModeData *data;
long width = 0; int width = 0;
long height = 0; int height = 0;
long bpp = 0; int bpp = 0;
long refreshRate = 0; int refreshRate = 0;
CFStringRef fmt; CFStringRef fmt;
data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data)); data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data));
@ -116,9 +116,9 @@ GetDisplayMode(_THIS, CGDisplayModeRef vidmode, CVDisplayLinkRef link, SDL_Displ
data->moderef = vidmode; data->moderef = vidmode;
fmt = CGDisplayModeCopyPixelEncoding(vidmode); fmt = CGDisplayModeCopyPixelEncoding(vidmode);
width = (long) CGDisplayModeGetWidth(vidmode); width = (int) CGDisplayModeGetWidth(vidmode);
height = (long) CGDisplayModeGetHeight(vidmode); height = (int) CGDisplayModeGetHeight(vidmode);
refreshRate = (long) (CGDisplayModeGetRefreshRate(vidmode) + 0.5); refreshRate = (int) (CGDisplayModeGetRefreshRate(vidmode) + 0.5);
if (CFStringCompare(fmt, CFSTR(IO32BitDirectPixels), if (CFStringCompare(fmt, CFSTR(IO32BitDirectPixels),
kCFCompareCaseInsensitive) == kCFCompareEqualTo) { kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
@ -139,7 +139,7 @@ GetDisplayMode(_THIS, CGDisplayModeRef vidmode, CVDisplayLinkRef link, SDL_Displ
if (refreshRate == 0 && link != NULL) { if (refreshRate == 0 && link != NULL) {
CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(link); CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(link);
if ((time.flags & kCVTimeIsIndefinite) == 0 && time.timeValue != 0) { if ((time.flags & kCVTimeIsIndefinite) == 0 && time.timeValue != 0) {
refreshRate = (long) ((time.timeScale / (double) time.timeValue) + 0.5); refreshRate = (int) ((time.timeScale / (double) time.timeValue) + 0.5);
} }
} }
@ -320,8 +320,8 @@ Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdp
SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
CGSize displaySize = CGDisplayScreenSize(data->display); CGSize displaySize = CGDisplayScreenSize(data->display);
size_t pixelWidth = CGDisplayPixelsWide(data->display); int pixelWidth = (int) CGDisplayPixelsWide(data->display);
size_t pixelHeight = CGDisplayPixelsHigh(data->display); int pixelHeight = (int) CGDisplayPixelsHigh(data->display);
if (ddpi) { if (ddpi) {
*ddpi = SDL_ComputeDiagonalDPI(pixelWidth, pixelHeight, displaySize.width / MM_IN_INCH, displaySize.height / MM_IN_INCH); *ddpi = SDL_ComputeDiagonalDPI(pixelWidth, pixelHeight, displaySize.width / MM_IN_INCH, displaySize.height / MM_IN_INCH);

View File

@ -855,7 +855,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
button = SDL_BUTTON_MIDDLE; button = SDL_BUTTON_MIDDLE;
break; break;
default: default:
button = [theEvent buttonNumber] + 1; button = (int) [theEvent buttonNumber] + 1;
break; break;
} }
SDL_SendMouseButton(_data->window, 0, SDL_PRESSED, button); SDL_SendMouseButton(_data->window, 0, SDL_PRESSED, button);
@ -896,7 +896,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
button = SDL_BUTTON_MIDDLE; button = SDL_BUTTON_MIDDLE;
break; break;
default: default:
button = [theEvent buttonNumber] + 1; button = (int) [theEvent buttonNumber] + 1;
break; break;
} }
SDL_SendMouseButton(_data->window, 0, SDL_RELEASED, button); SDL_SendMouseButton(_data->window, 0, SDL_RELEASED, button);
@ -1209,7 +1209,7 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window)
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
NSRect rect; NSRect rect;
SDL_Rect bounds; SDL_Rect bounds;
unsigned int style; NSUInteger style;
NSArray *screens = [NSScreen screens]; NSArray *screens = [NSScreen screens];
Cocoa_GetDisplayBounds(_this, display, &bounds); Cocoa_GetDisplayBounds(_this, display, &bounds);