Permalink
Browse files

Added -Wno-unused-parameter and a test case for it.

  • Loading branch information...
1 parent 7f87abe commit abacdd3b325262c006d10ab329e1a1ce50270ca4 Peter Hosey committed Dec 28, 2011
Showing with 10 additions and 1 deletion.
  1. +1 −1 Warnings.xcconfig
  2. +9 −0 WarningsTest/WarningsTestTests/UnusedTokenWarningTests.m
View
@@ -30,6 +30,6 @@ GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES
-OTHER_CFLAGS = -Wextra
+OTHER_CFLAGS = -Wextra -Wno-unused-parameter
GCC_TREAT_WARNINGS_AS_ERRORS = YES
RUN_CLANG_STATIC_ANALYZER = YES
@@ -25,4 +25,13 @@ - (void) testUnusedVariable {
STAssertTrue(true, @"True is not true!");
}
+//This *shouldn't* warn (since parameters often do go legitimately unused, especially in delegate methods). It is enabled by -Wextra and disabled explicitly immediately afterward.
+- (bool) thing:(NSString *)str totallyIrrelevantParameter:(double)d {
+ return (str != nil);
+}
+- (void) testUnusedParameter {
+ STAssertTrue([self thing:@"foo" totallyIrrelevantParameter:42.0], @"thing:totallyIrrelevantParameter: returned false for a non-nil string!");
+ STAssertFalse([self thing:nil totallyIrrelevantParameter:42.0], @"thing:totallyIrrelevantParameter: returned true for a nil string!");
+}
+
@end

0 comments on commit abacdd3

Please sign in to comment.