Skip to content

Commit 9e5dd5e

Browse files
committed
Adding __unused declarations to fix warnings
1 parent 3b11c60 commit 9e5dd5e

9 files changed

Lines changed: 50 additions & 39 deletions

File tree

AFNetworking/AFHTTPSessionManager.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ - (NSURLSessionDataTask *)GET:(NSString *)URLString
114114
{
115115
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"GET" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters];
116116

117-
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
117+
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
118118
if (error) {
119119
if (failure) {
120120
failure(task, error);
@@ -138,7 +138,7 @@ - (NSURLSessionDataTask *)HEAD:(NSString *)URLString
138138
{
139139
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"HEAD" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters];
140140

141-
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
141+
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id __unused responseObject, NSError *error) {
142142
if (error) {
143143
if (failure) {
144144
failure(task, error);
@@ -162,7 +162,7 @@ - (NSURLSessionDataTask *)POST:(NSString *)URLString
162162
{
163163
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters];
164164

165-
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
165+
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
166166
if (error) {
167167
if (failure) {
168168
failure(task, error);
@@ -187,7 +187,7 @@ - (NSURLSessionDataTask *)POST:(NSString *)URLString
187187
{
188188
NSMutableURLRequest *request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters constructingBodyWithBlock:block];
189189

190-
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
190+
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
191191
if (error) {
192192
if (failure) {
193193
failure(task, error);
@@ -211,7 +211,7 @@ - (NSURLSessionDataTask *)PUT:(NSString *)URLString
211211
{
212212
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"PUT" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters];
213213

214-
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
214+
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
215215
if (error) {
216216
if (failure) {
217217
failure(task, error);
@@ -235,7 +235,7 @@ - (NSURLSessionDataTask *)PATCH:(NSString *)URLString
235235
{
236236
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"PATCH" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters];
237237

238-
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
238+
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
239239
if (error) {
240240
if (failure) {
241241
failure(task, error);
@@ -259,7 +259,7 @@ - (NSURLSessionDataTask *)DELETE:(NSString *)URLString
259259
{
260260
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"DELETE" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters];
261261

262-
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
262+
__block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
263263
if (error) {
264264
if (failure) {
265265
failure(task, error);

AFNetworking/AFURLRequestSerialization.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ - (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method
284284

285285
__block AFStreamingMultipartFormData *formData = [[AFStreamingMultipartFormData alloc] initWithURLRequest:request stringEncoding:NSUTF8StringEncoding];
286286

287-
[parameters enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
287+
[parameters enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL * __unused stop) {
288288
NSData *data = nil;
289289
if ([obj isKindOfClass:[NSData class]]) {
290290
data = obj;
@@ -317,7 +317,7 @@ - (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
317317

318318
NSMutableURLRequest *mutableRequest = [request mutableCopy];
319319

320-
[self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL *stop) {
320+
[self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {
321321
[mutableRequest setValue:value forHTTPHeaderField:field];
322322
}];
323323

@@ -1030,7 +1030,7 @@ - (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
10301030

10311031
NSMutableURLRequest *mutableRequest = [request mutableCopy];
10321032

1033-
[self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL *stop) {
1033+
[self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {
10341034
[mutableRequest setValue:value forHTTPHeaderField:field];
10351035
}];
10361036

@@ -1080,7 +1080,7 @@ - (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
10801080

10811081
NSMutableURLRequest *mutableRequest = [request mutableCopy];
10821082

1083-
[self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL *stop) {
1083+
[self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) {
10841084
[mutableRequest setValue:value forHTTPHeaderField:field];
10851085
}];
10861086

AFNetworking/AFURLSessionManager.m

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,17 @@ - (instancetype)init {
119119

120120
#pragma mark - NSURLSessionTaskDelegate
121121

122-
- (void)URLSession:(NSURLSession *)session
123-
task:(NSURLSessionTask *)task
124-
didSendBodyData:(int64_t)bytesSent
122+
- (void)URLSession:(__unused NSURLSession *)session
123+
task:(__unused NSURLSessionTask *)task
124+
didSendBodyData:(__unused int64_t)bytesSent
125125
totalBytesSent:(int64_t)totalBytesSent
126126
totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend
127127
{
128128
self.uploadProgress.completedUnitCount = totalBytesSent;
129129
self.uploadProgress.totalUnitCount = totalBytesExpectedToSend;
130130
}
131131

132-
- (void)URLSession:(NSURLSession *)session
132+
- (void)URLSession:(__unused NSURLSession *)session
133133
task:(NSURLSessionTask *)task
134134
didCompleteWithError:(NSError *)error
135135
{
@@ -186,8 +186,8 @@ - (void)URLSession:(NSURLSession *)session
186186

187187
#pragma mark - NSURLSessionDataTaskDelegate
188188

189-
- (void)URLSession:(NSURLSession *)session
190-
dataTask:(NSURLSessionDataTask *)dataTask
189+
- (void)URLSession:(__unused NSURLSession *)session
190+
dataTask:(__unused NSURLSessionDataTask *)dataTask
191191
didReceiveData:(NSData *)data
192192
{
193193
[self.mutableData appendData:data];
@@ -216,20 +216,23 @@ - (void)URLSession:(NSURLSession *)session
216216
}
217217
}
218218

219-
- (void)URLSession:(NSURLSession *)session
220-
downloadTask:(NSURLSessionDownloadTask *)downloadTask
221-
didWriteData:(int64_t)bytesWritten
219+
- (void)URLSession:(__unused NSURLSession *)session
220+
downloadTask:(__unused NSURLSessionDownloadTask *)downloadTask
221+
didWriteData:(__unused int64_t)bytesWritten
222222
totalBytesWritten:(int64_t)totalBytesWritten
223223
totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
224224
{
225225
self.downloadProgress.completedUnitCount = totalBytesWritten;
226226
self.downloadProgress.totalUnitCount = totalBytesExpectedToWrite;
227227
}
228228

229-
- (void)URLSession:(NSURLSession *)session
230-
downloadTask:(NSURLSessionDownloadTask *)downloadTask
231-
didResumeAtOffset:(int64_t)fileOffset
232-
expectedTotalBytes:(int64_t)expectedTotalBytes {}
229+
- (void)URLSession:(__unused NSURLSession *)session
230+
downloadTask:(__unused NSURLSessionDownloadTask *)downloadTask
231+
didResumeAtOffset:(__unused int64_t)fileOffset
232+
expectedTotalBytes:(__unused int64_t)expectedTotalBytes {
233+
self.downloadProgress.completedUnitCount = fileOffset;
234+
self.downloadProgress.totalUnitCount = expectedTotalBytes;
235+
}
233236

234237
@end
235238

@@ -451,7 +454,7 @@ - (NSURLSessionDownloadTask *)downloadTaskWithTask:(NSURLSessionDownloadTask *)d
451454
completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler
452455
{
453456
AFURLSessionManagerTaskDelegate *delegate = [AFURLSessionManagerTaskDelegate delegateForManager:self completionHandler:completionHandler];
454-
delegate.downloadTaskDidFinishDownloading = ^ NSURL * (NSURLSession *session, NSURLSessionDownloadTask *task, NSURL *location) {
457+
delegate.downloadTaskDidFinishDownloading = ^NSURL * (NSURLSession * __unused session, NSURLSessionDownloadTask *task, NSURL *location) {
455458
if (destination) {
456459
return destination(location, task.response);
457460
}

Example/AFNetworking iOS Example.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@
498498
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
499499
GCC_WARN_SHADOW = YES;
500500
GCC_WARN_SIGN_COMPARE = YES;
501-
GCC_WARN_UNUSED_PARAMETER = NO;
501+
GCC_WARN_UNUSED_PARAMETER = YES;
502502
INFOPLIST_FILE = "iOS-Info.plist";
503503
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
504504
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -518,7 +518,7 @@
518518
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
519519
GCC_WARN_SHADOW = YES;
520520
GCC_WARN_SIGN_COMPARE = YES;
521-
GCC_WARN_UNUSED_PARAMETER = NO;
521+
GCC_WARN_UNUSED_PARAMETER = YES;
522522
INFOPLIST_FILE = "iOS-Info.plist";
523523
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
524524
PRODUCT_NAME = "$(TARGET_NAME)";

Example/AppDelegate.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030
@implementation AppDelegate
3131

32-
- (BOOL)application:(UIApplication *)application
33-
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
32+
- (BOOL)application:(__unused UIApplication *)application
33+
didFinishLaunchingWithOptions:(__unused NSDictionary *)launchOptions
3434
{
3535
NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil];
3636
[NSURLCache setSharedURLCache:URLCache];

Example/Classes/Controllers/GlobalTimelineViewController.m

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ @implementation GlobalTimelineViewController {
3838
NSArray *_posts;
3939
}
4040

41-
- (void)reload:(id)sender {
41+
- (void)reload:(__unused id)sender {
4242
self.navigationItem.rightBarButtonItem.enabled = NO;
4343

4444
NSURLSessionTask *task = [Post globalTimelinePostsWithBlock:^(NSArray *posts, NSError *error) {
@@ -74,11 +74,15 @@ - (void)viewDidLoad {
7474

7575
#pragma mark - UITableViewDataSource
7676

77-
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
77+
- (NSInteger)tableView:(__unused UITableView *)tableView
78+
numberOfRowsInSection:(__unused NSInteger)section
79+
{
7880
return [_posts count];
7981
}
8082

81-
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
83+
- (UITableViewCell *)tableView:(UITableView *)tableView
84+
cellForRowAtIndexPath:(NSIndexPath *)indexPath
85+
{
8286
static NSString *CellIdentifier = @"Cell";
8387

8488
PostTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
@@ -93,11 +97,15 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
9397

9498
#pragma mark - UITableViewDelegate
9599

96-
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
100+
- (CGFloat)tableView:(__unused UITableView *)tableView
101+
heightForRowAtIndexPath:(NSIndexPath *)indexPath
102+
{
97103
return [PostTableViewCell heightForCellWithPost:[_posts objectAtIndex:indexPath.row]];
98104
}
99105

100-
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
106+
- (void)tableView:(UITableView *)tableView
107+
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
108+
{
101109
[tableView deselectRowAtIndexPath:indexPath animated:YES];
102110
}
103111

Example/Classes/Models/Post.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ - (instancetype)initWithAttributes:(NSDictionary *)attributes {
4444
#pragma mark -
4545

4646
+ (NSURLSessionDataTask *)globalTimelinePostsWithBlock:(void (^)(NSArray *posts, NSError *error))block {
47-
return [[AFAppDotNetAPIClient sharedClient] GET:@"stream/0/posts/stream/global" parameters:nil success:^(NSURLSessionDataTask *task, id JSON) {
47+
return [[AFAppDotNetAPIClient sharedClient] GET:@"stream/0/posts/stream/global" parameters:nil success:^(NSURLSessionDataTask * __unused task, id JSON) {
4848
NSArray *postsFromResponse = [JSON valueForKeyPath:@"data"];
4949
NSMutableArray *mutablePosts = [NSMutableArray arrayWithCapacity:[postsFromResponse count]];
5050
for (NSDictionary *attributes in postsFromResponse) {
@@ -55,7 +55,7 @@ + (NSURLSessionDataTask *)globalTimelinePostsWithBlock:(void (^)(NSArray *posts,
5555
if (block) {
5656
block([NSArray arrayWithArray:mutablePosts], nil);
5757
}
58-
} failure:^(NSURLSessionDataTask *task, NSError *error) {
58+
} failure:^(NSURLSessionDataTask *__unused task, NSError *error) {
5959
if (block) {
6060
block([NSArray array], error);
6161
}

UIKit+AFNetworking/UIImageView+AFNetworking.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ + (AFImageCache *)af_sharedImageCache {
7070
dispatch_once(&oncePredicate, ^{
7171
_af_imageCache = [[AFImageCache alloc] init];
7272

73-
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidReceiveMemoryWarningNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
73+
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidReceiveMemoryWarningNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * __unused notification) {
7474
[_af_imageCache removeAllObjects];
7575
}];
7676
});

UIKit+AFNetworking/UIWebView+AFNetworking.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ - (void)loadRequest:(NSURLRequest *)request
6363

6464
__weak __typeof(self)weakSelf = self;
6565
[self.af_HTTPRequestOperation setDownloadProgressBlock:progress];
66-
[self.af_HTTPRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
66+
[self.af_HTTPRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id __unused responseObject) {
6767
NSString *HTML = success ? success(operation.response, operation.responseString) : operation.responseString;
6868
[weakSelf loadHTMLString:HTML baseURL:[operation.response URL]];
69-
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
69+
} failure:^(AFHTTPRequestOperation * __unused operation, NSError *error) {
7070
if (failure) {
7171
failure(error);
7272
}

0 commit comments

Comments
 (0)