Last active
August 20, 2018 14:45
-
-
Save holyhan/89154baf4ff60be8acab5d39f64e1fec to your computer and use it in GitHub Desktop.
Use _Pragma to replace #pragma, so that to resolve two pragmas in a single macro。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
贼啦六