Increased warning levels to -Wall -Wextra, and fixed Xcode 7 beta issues

Summary:
@public

I've increased the warning levels in the OSS frameworks, which caught a bunch of minor issues. I also fixed some new errors in Xcode 7 relating to designated initializers and TLS security.

Test Plan:
* Test the sample apps and make sure they still work.
* Run tests.
This commit is contained in:
Nick Lockwood
2015-06-15 07:53:45 -07:00
parent d270dca210
commit 650fc9de4c
86 changed files with 715 additions and 349 deletions

View File

@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.facebook.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

@@ -158,7 +158,9 @@ RCT_EXPORT_MODULE();
- (void)testContentViewIsInvalidated
{
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:nil moduleProvider:nil launchOptions:nil];
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:nil
moduleProvider:nil
launchOptions:nil];
__weak id rootContentView;
@autoreleasepool {
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@""];

View File

@@ -42,17 +42,17 @@ RCT_EXPORT_MODULE()
return YES;
}
- (void)executeJSCall:(NSString *)name
method:(NSString *)method
arguments:(NSArray *)arguments
context:(NSNumber *)executorID
- (void)executeJSCall:(__unused NSString *)name
method:(__unused NSString *)method
arguments:(__unused NSArray *)arguments
context:(__unused NSNumber *)executorID
callback:(RCTJavaScriptCallback)onComplete
{
onComplete(nil, nil);
}
- (void)executeApplicationScript:(NSString *)script
sourceURL:(NSURL *)url
- (void)executeApplicationScript:(__unused NSString *)script
sourceURL:(__unused NSURL *)url
onComplete:(RCTJavaScriptCompleteBlock)onComplete
{
onComplete(nil);

View File

@@ -30,7 +30,7 @@
dispatch_semaphore_t doneSem = dispatch_semaphore_create(0);
[_executor executeApplicationScript:@"var x = {toString: function() { throw 1; }}; nativeLoggingHook(x);"
sourceURL:[NSURL URLWithString:@"file://"]
onComplete:^(id error){
onComplete:^(__unused id error){
dispatch_semaphore_signal(doneSem);
}];
dispatch_semaphore_wait(doneSem, DISPATCH_TIME_FOREVER);
@@ -39,7 +39,7 @@
static uint64_t _get_time_nanoseconds(void)
{
static struct mach_timebase_info tb_info = {0};
static struct mach_timebase_info tb_info = {0, 0};
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
int ret = mach_timebase_info(&tb_info);
@@ -114,7 +114,7 @@ static uint64_t _get_time_nanoseconds(void)
} \
";
[_executor executeApplicationScript:script sourceURL:[NSURL URLWithString:@"http://localhost:8081/"] onComplete:^(NSError *error) {
[_executor executeApplicationScript:script sourceURL:[NSURL URLWithString:@"http://localhost:8081/"] onComplete:^(__unused NSError *error) {
NSMutableArray *params = [[NSMutableArray alloc] init];
id data = @1;
for (int i = 0; i < 4; i++) {
@@ -128,8 +128,8 @@ static uint64_t _get_time_nanoseconds(void)
method:@"method"
arguments:params
context:RCTGetExecutorID(_executor)
callback:^(id json, NSError *__error) {
RCTAssert([json isEqual:@YES], @"Invalid return");
callback:^(id json, __unused NSError *unused) {
XCTAssert([json isEqual:@YES], @"Invalid return");
}];
double run = _get_time_nanoseconds() - start;
if ((j % frequency) == frequency - 1) { // Warmup

View File

@@ -13,7 +13,7 @@
#define TEST_URL(name, _input, _expectedURL) \
- (void)test_##name { \
NSURL *result = [RCTConvert NSURL:_input]; \
NSURL *expected = [NSURL URLWithString:_expectedURL]; \
NSURL *expected = (_expectedURL) ? [NSURL URLWithString:_expectedURL ?: @""] : nil; \
XCTAssertEqualObjects(result.absoluteURL, expected); \
} \

View File

@@ -136,7 +136,7 @@
// We need to keep these in array to keep them around
NSMutableArray *viewsToRemove = [NSMutableArray array];
for (NSInteger i = 0; i < removeAtIndices.count; i++) {
for (NSUInteger i = 0; i < removeAtIndices.count; i++) {
NSNumber *reactTagToRemove = @([removeAtIndices[i] integerValue] + 1);
UIView *viewToRemove = _uiManager.viewRegistry[reactTagToRemove];
[viewsToRemove addObject:viewToRemove];
@@ -160,7 +160,7 @@
instead have the following subviews %@", [containerView reactSubviews]);
NSArray *expectedReactTags = @[@11, @5, @1, @2, @7, @8, @12, @10];
for (NSInteger i = 0; i < [[containerView subviews] count]; i++) {
for (NSUInteger i = 0; i < containerView.subviews.count; i++) {
XCTAssertEqualObjects([[containerView reactSubviews][i] reactTag], expectedReactTags[i],
@"Expected subview at index %ld to have react tag #%@ but has tag #%@",
(long)i, expectedReactTags[i], [[containerView reactSubviews][i] reactTag]);