Fix some analyzer warnings

Reviewed By: majak

Differential Revision: D3683672

fbshipit-source-id: 879578b050186bc779d01a17822d41bf7e473123
This commit is contained in:
Pieter De Baets 2016-08-09 03:53:59 -07:00 committed by Facebook Github Bot 6
parent 910d0e1d8b
commit 335132ad63
6 changed files with 27 additions and 17 deletions

View File

@ -220,9 +220,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
if (!RCTIsMainQueue()) {
RCTLogWarn(@"RCTBridge required dispatch_sync to load %@. This may lead to deadlocks", _moduleClass);
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
RCTExecuteOnMainThread(^{
[self setUpInstanceAndBridge];
}, YES);
#pragma clang diagnostic pop
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
} else {
[self setUpInstanceAndBridge];
@ -285,9 +288,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init);
if (!RCTIsMainQueue()) {
RCTLogWarn(@"Required dispatch_sync to load constants for %@. This may lead to deadlocks", _moduleClass);
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
RCTExecuteOnMainThread(^{
self->_constantsToExport = [self->_instance constantsToExport] ?: @{};
}, YES);
#pragma clang diagnostic pop
}
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"", nil);
}

View File

@ -457,7 +457,7 @@ static NSThread *newJavaScriptThread(void)
context[@"nativeTraceBeginAsyncFlow"] = ^(__unused uint64_t tag, __unused NSString *name, int64_t cookie) {
if (RCTProfileIsProfiling()) {
[weakBridge.flowIDMapLock lock];
int64_t newCookie = [_RCTProfileBeginFlowEvent() longLongValue];
NSUInteger newCookie = _RCTProfileBeginFlowEvent();
CFDictionarySetValue(weakBridge.flowIDMap, (const void *)cookie, (const void *)newCookie);
[weakBridge.flowIDMapLock unlock];
}
@ -466,8 +466,8 @@ static NSThread *newJavaScriptThread(void)
context[@"nativeTraceEndAsyncFlow"] = ^(__unused uint64_t tag, __unused NSString *name, int64_t cookie) {
if (RCTProfileIsProfiling()) {
[weakBridge.flowIDMapLock lock];
int64_t newCookie = (int64_t)CFDictionaryGetValue(weakBridge.flowIDMap, (const void *)cookie);
_RCTProfileEndFlowEvent(@(newCookie));
NSUInteger newCookie = (int64_t)CFDictionaryGetValue(weakBridge.flowIDMap, (const void *)cookie);
_RCTProfileEndFlowEvent(newCookie);
CFDictionaryRemoveValue(weakBridge.flowIDMap, (const void *)cookie);
[weakBridge.flowIDMapLock unlock];
}

View File

@ -33,7 +33,7 @@ RCT_EXTERN const uint64_t RCTProfileTagAlways;
#define RCTProfileBeginFlowEvent() \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
NSNumber *__rct_profile_flow_id = _RCTProfileBeginFlowEvent(); \
NSUInteger __rct_profile_flow_id = _RCTProfileBeginFlowEvent(); \
_Pragma("clang diagnostic pop")
#define RCTProfileEndFlowEvent() \
@ -41,8 +41,8 @@ _RCTProfileEndFlowEvent(__rct_profile_flow_id)
RCT_EXTERN dispatch_queue_t RCTProfileGetQueue(void);
RCT_EXTERN NSNumber *_RCTProfileBeginFlowEvent(void);
RCT_EXTERN void _RCTProfileEndFlowEvent(NSNumber *);
RCT_EXTERN NSUInteger _RCTProfileBeginFlowEvent(void);
RCT_EXTERN void _RCTProfileEndFlowEvent(NSUInteger);
/**
* Returns YES if the profiling information is currently being collected

View File

@ -693,18 +693,16 @@ void RCTProfileImmediateEvent(
});
}
NSNumber *_RCTProfileBeginFlowEvent(void)
NSUInteger _RCTProfileBeginFlowEvent(void)
{
static NSUInteger flowID = 0;
CHECK(@0);
unsigned int cookie = ++flowID;
NSNumber *currentID = @(cookie);
NSUInteger cookie = ++flowID;
if (callbacks != NULL) {
callbacks->begin_async_flow(1, "flow", cookie);
return currentID;
return @(cookie);
}
NSTimeInterval time = CACurrentMediaTime();
@ -714,7 +712,7 @@ NSNumber *_RCTProfileBeginFlowEvent(void)
RCTProfileAddEvent(RCTProfileTraceEvents,
@"tid": threadName,
@"name": @"flow",
@"id": currentID,
@"id": @(cookie),
@"cat": @"flow",
@"ph": @"s",
@"ts": RCTProfileTimestamp(time),
@ -722,15 +720,15 @@ NSNumber *_RCTProfileBeginFlowEvent(void)
});
return currentID;
return cookie;
}
void _RCTProfileEndFlowEvent(NSNumber *flowID)
void _RCTProfileEndFlowEvent(NSUInteger cookie)
{
CHECK();
if (callbacks != NULL) {
callbacks->end_async_flow(1, "flow", [flowID integerValue]);
callbacks->end_async_flow(1, "flow", cookie);
return;
}
@ -741,7 +739,7 @@ void _RCTProfileEndFlowEvent(NSNumber *flowID)
RCTProfileAddEvent(RCTProfileTraceEvents,
@"tid": threadName,
@"name": @"flow",
@"id": flowID,
@"id": @(cookie),
@"cat": @"flow",
@"ph": @"f",
@"ts": RCTProfileTimestamp(time),

View File

@ -368,9 +368,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
- (NSDictionary<NSString *, id> *)viewConfig
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
NSMutableArray<NSString *> *directEvents = [NSMutableArray new];
if (RCTClassOverridesInstanceMethod(_managerClass, @selector(customDirectEventTypes))) {
NSArray<NSString *> *events = [self.manager customDirectEventTypes];
#pragma clang diagnostic pop
if (RCT_DEBUG) {
RCTAssert(!events || [events isKindOfClass:[NSArray class]],
@"customDirectEventTypes must return an array, but %@ returned %@",
@ -381,8 +384,11 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
}
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
NSMutableArray<NSString *> *bubblingEvents = [NSMutableArray new];
if (RCTClassOverridesInstanceMethod(_managerClass, @selector(customBubblingEventTypes))) {
#pragma clang diagnostic pop
NSArray<NSString *> *events = [self.manager customBubblingEventTypes];
if (RCT_DEBUG) {
RCTAssert(!events || [events isKindOfClass:[NSArray class]],

View File

@ -365,7 +365,7 @@ DEFINE_PROCESS_META_PROPS(Border);
{
[_reactSubviews insertObject:subview atIndex:atIndex];
if (![self isCSSLeafNode]) {
CSSNodeInsertChild(_cssNode, subview.cssNode, atIndex);
CSSNodeInsertChild(_cssNode, subview.cssNode, (uint32_t)atIndex);
}
subview->_superview = self;
_didUpdateSubviews = YES;