使用格式
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-相关命令"
# //需要操作的代码
#pragma clang diagnostic pop
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
UIAlertView *alertViewTmp = [[UIAlertView alloc]initWithTitle:@"" message:@"" delegate:nil cancelButtonTitle:@"" otherButtonTitles:@"", nil];
[alertViewTmp show];
#pragma clang diagnostic pop
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
//
#pragma clang diagnostic pop
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-retain-cycles"
// self.completionBlock = ^ {
// ...
// };
#pragma clang diagnostic pop
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"
int a;
#pragma clang diagnostic pop
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcovered-switch-default"
// switch (style) {
// case UITableViewCellStyleDefault:
// default:
// return;
// }
#pragma clang diagnostic pop
参考 Clang's source code
网友评论