Skip to content

Commit 17d267b

Browse files
committed
Merge pull request AFNetworking#957 from hhartz/master
Suppressed GNU expression and Enum assignment warnings from clang
2 parents 9667b21 + cbfe5b7 commit 17d267b

7 files changed

+29
-2
lines changed

AFNetworking/AFHTTPClient.m

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,16 @@ - (id)initWithBaseURL:(NSURL *)url {
255255
*stop = q <= 0.5f;
256256
}];
257257
[self setDefaultHeader:@"Accept-Language" value:[acceptLanguagesComponents componentsJoinedByString:@", "]];
258-
258+
259+
#pragma clang diagnostic push
260+
#pragma clang diagnostic ignored "-Wgnu"
259261
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
260262
// User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
261263
[self setDefaultHeader:@"User-Agent" value:[NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey], (__bridge id)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleVersionKey) ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] ? [[UIScreen mainScreen] scale] : 1.0f)]];
262264
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
263265
[self setDefaultHeader:@"User-Agent" value:[NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey], [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]]];
264266
#endif
267+
#pragma clang diagnostic pop
265268

266269
#ifdef _SYSTEMCONFIGURATION_H
267270
self.networkReachabilityStatus = AFNetworkReachabilityStatusUnknown;
@@ -474,7 +477,10 @@ - (NSMutableURLRequest *)requestWithMethod:(NSString *)method
474477
break;
475478
case AFJSONParameterEncoding:;
476479
[request setValue:[NSString stringWithFormat:@"application/json; charset=%@", charset] forHTTPHeaderField:@"Content-Type"];
480+
#pragma clang diagnostic push
481+
#pragma clang diagnostic ignored "-Wassign-enum"
477482
[request setHTTPBody:[NSJSONSerialization dataWithJSONObject:parameters options:0 error:&error]];
483+
#pragma clang diagnostic pop
478484
break;
479485
case AFPropertyListParameterEncoding:;
480486
[request setValue:[NSString stringWithFormat:@"application/x-plist; charset=%@", charset] forHTTPHeaderField:@"Content-Type"];
@@ -565,7 +571,10 @@ - (void)enqueueHTTPRequestOperation:(AFHTTPRequestOperation *)operation {
565571
- (void)cancelAllHTTPOperationsWithMethod:(NSString *)method
566572
path:(NSString *)path
567573
{
574+
#pragma clang diagnostic push
575+
#pragma clang diagnostic ignored "-Wgnu"
568576
NSString *pathToBeMatched = [[[self requestWithMethod:(method ?: @"GET") path:path parameters:nil] URL] path];
577+
#pragma clang diagnostic pop
569578

570579
for (NSOperation *operation in [self.operationQueue operations]) {
571580
if (![operation isKindOfClass:[AFHTTPRequestOperation class]]) {
@@ -615,7 +624,10 @@ - (void)enqueueBatchOfHTTPRequestOperations:(NSArray *)operations
615624
__weak __typeof(&*operation)weakOperation = operation;
616625
operation.completionBlock = ^{
617626
__strong __typeof(&*weakOperation)strongOperation = weakOperation;
627+
#pragma clang diagnostic push
628+
#pragma clang diagnostic ignored "-Wgnu"
618629
dispatch_queue_t queue = strongOperation.successCallbackQueue ?: dispatch_get_main_queue();
630+
#pragma clang diagnostic pop
619631
dispatch_group_async(dispatchGroup, queue, ^{
620632
if (originalCompletionBlock) {
621633
originalCompletionBlock();
@@ -1329,8 +1341,11 @@ - (NSInteger)readData:(NSData *)data
13291341
intoBuffer:(uint8_t *)buffer
13301342
maxLength:(NSUInteger)length
13311343
{
1344+
#pragma clang diagnostic push
1345+
#pragma clang diagnostic ignored "-Wgnu"
13321346
NSRange range = NSMakeRange((NSUInteger)_phaseReadOffset, MIN([data length] - ((NSUInteger)_phaseReadOffset), length));
13331347
[data getBytes:buffer range:range];
1348+
#pragma clang diagnostic pop
13341349

13351350
_phaseReadOffset += range.length;
13361351

AFNetworking/AFHTTPRequestOperation.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operatio
261261
// completionBlock is manually nilled out in AFURLConnectionOperation to break the retain cycle.
262262
#pragma clang diagnostic push
263263
#pragma clang diagnostic ignored "-Warc-retain-cycles"
264+
#pragma clang diagnostic ignored "-Wgnu"
264265
self.completionBlock = ^{
265266
if (self.error) {
266267
if (failure) {

AFNetworking/AFImageRequestOperation.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ + (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
8282
if (imageProcessingBlock) {
8383
dispatch_async(image_request_operation_processing_queue(), ^(void) {
8484
UIImage *processedImage = imageProcessingBlock(image);
85-
85+
#pragma clang diagnostic push
86+
#pragma clang diagnostic ignored "-Wgnu"
8687
dispatch_async(operation.successCallbackQueue ?: dispatch_get_main_queue(), ^(void) {
8788
success(operation.request, operation.response, processedImage);
8889
});
90+
#pragma clang diagnostic pop
8991
});
9092
} else {
9193
success(operation.request, operation.response, image);
@@ -203,6 +205,8 @@ - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operatio
203205
{
204206
#pragma clang diagnostic push
205207
#pragma clang diagnostic ignored "-Warc-retain-cycles"
208+
#pragma clang diagnostic ignored "-Wgnu"
209+
206210
self.completionBlock = ^ {
207211
dispatch_async(image_request_operation_processing_queue(), ^(void) {
208212
if (self.error) {

AFNetworking/AFJSONRequestOperation.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operatio
115115
{
116116
#pragma clang diagnostic push
117117
#pragma clang diagnostic ignored "-Warc-retain-cycles"
118+
#pragma clang diagnostic ignored "-Wgnu"
119+
118120
self.completionBlock = ^ {
119121
if (self.error) {
120122
if (failure) {

AFNetworking/AFNetworkActivityIndicatorManager.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ - (void)incrementActivityCount {
126126
- (void)decrementActivityCount {
127127
[self willChangeValueForKey:@"activityCount"];
128128
@synchronized(self) {
129+
#pragma clang diagnostic push
130+
#pragma clang diagnostic ignored "-Wgnu"
129131
_activityCount = MAX(_activityCount - 1, 0);
132+
#pragma clang diagnostic pop
130133
}
131134
[self didChangeValueForKey:@"activityCount"];
132135

AFNetworking/AFPropertyListRequestOperation.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operatio
109109
{
110110
#pragma clang diagnostic push
111111
#pragma clang diagnostic ignored "-Warc-retain-cycles"
112+
#pragma clang diagnostic ignored "-Wgnu"
112113
self.completionBlock = ^ {
113114
if (self.error) {
114115
if (failure) {

AFNetworking/AFXMLRequestOperation.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operatio
141141
{
142142
#pragma clang diagnostic push
143143
#pragma clang diagnostic ignored "-Warc-retain-cycles"
144+
#pragma clang diagnostic ignored "-Wgnu"
144145
self.completionBlock = ^ {
145146
dispatch_async(xml_request_operation_processing_queue(), ^(void) {
146147
NSXMLParser *XMLParser = self.responseXMLParser;

0 commit comments

Comments
 (0)