Skip to content

Instantly share code, notes, and snippets.

@holyhan
Last active Aug 20, 2018
Embed
What would you like to do?
Use _Pragma to replace #pragma, so that to resolve two pragmas in a single macro。
#define LEAK_PRAGMA_BEGIN \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic warning \"-Warc-performSelector-leaks\"")
#define LEAK_PRAGMA_END \
_Pragma("clang diagnostic pop")
@interface AClass : NSObject
- (void)doSomething;
@end
@implementation AClass
- (void)doSomething
{
NSLog(@"Do something!");
}
@end
int main(int argc, char const *argv[])
{
LEAK_PRAGMA_BEGIN
[[AClass new] performSelector:@selector(doSomething)];
LEAK_PRAGMA_BEGIN
return 0;
}
@hdw09

This comment has been minimized.

Copy link

@hdw09 hdw09 commented Aug 20, 2018

贼啦六

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment