Skip to content

Instantly share code, notes, and snippets.

@uliwitness
Created November 9, 2012 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uliwitness/4045701 to your computer and use it in GitHub Desktop.
Save uliwitness/4045701 to your computer and use it in GitHub Desktop.
Sample script that shows the warning for which I want to find the 'foo' to pass to -Werror=foo (same as you'd pass to -Wfoo)
#import <Foundation/Foundation.h>
@interface MyClass : NSObject
@end
@implementation MyClass
@end
int main(int argc, char *argv[]) {
@autoreleasepool {
MyClass* theObj = [[MyClass alloc] initWithNum: [NSNumber numberWithInt: 15]];
}
}
/*
Untitled.m:13:21: warning: instance method '-initWithNum:' not found (return type defaults to 'id')
MyClass* theObj = [[MyClass alloc] initWithNum: [NSNumber numberWithInt: 15]];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
2012-11-09 14:36:25.887 Untitled[41490:707] -[MyClass initWithNum:]: unrecognized selector sent to instance 0x7ff801c08020
2012-11-09 14:36:25.890 Untitled[41490:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MyClass initWithNum:]: unrecognized selector sent to instance 0x7ff801c08020'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff9827a0a6 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff9068e3f0 objc_exception_throw + 43
2 CoreFoundation 0x00007fff983106ea -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
3 CoreFoundation 0x00007fff982685ce ___forwarding___ + 414
4 CoreFoundation 0x00007fff982683b8 _CF_forwarding_prep_0 + 232
5 Untitled 0x000000010aad3eea main + 106
6 libdyld.dylib 0x00007fff928ed7e1 start + 0
7 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminate called throwing an exception
Run Command: line 1: 41490 Abort trap: 6 ./"$2" "${@:3}"
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment