iOS编程 手动忽略clang编译器警告

在iOS开发过程中, 我们可能会碰到一些系统方法弃用, weak、循环引用、不能执行之类的警告。 有代码洁癖的孩子们很想消除他们, 今天就让我们来一次Fuck 警告!!

首先学会基本的语句

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

这里写出现警告的代码

#pragma clang diagnostic pop

这样就消除了方法弃用的警告!

同理, 大家可以在下边搜索到对应的警告, 这样 就可以把前边的字串填入上边的ignored的后边, 然后包住你的代码, 就OK了


原网址: http://fuckingclangwarnings.com/


Semantic Warnings
Warning    Message
-WCFString-literal    input conversion stopped due to an input byte that does not belong to the input codeset UTF-8
-WNSObject-attribute    __attribute ((NSObject)) may be put on a typedef only, attribute is ignored
-Wabstract-vbase-init    initializer for virtual base class %0 of abstract class %1 will never be used
-Waddress-of-array-temporary    pointer is initialized by a temporary array, which will be destroyed at the end of the full-expression
-Warc-maybe-repeated-use-of-weak    "weak %select{variable|property|implicit property|instance variable}0 %1 may be accessed multiple times in this %select{function|method|block|lambda}2 and may be unpredictably set to nil assign to a strong variable to keep the object alive
-Warc-non-pod-memaccess    %select{destination for|source of}0 this %1 call is a pointer to ownership-qualified type %2
-Warc-performSelector-leaks    performSelector may cause a leak because its selector is unknown
-Warc-repeated-use-of-weak    "weak %select{
    variable|property|implicit property|instance variable}0 %1 is accessed multiple times in this %select{
    function|method|block|lambda}2 but may be unpredictably set to nil assign to a strong variable to keep the object alive
-Warc-retain-cycles    capturing %0 strongly in this block is likely to lead to a retain cycle
-Warc-unsafe-retained-assign    assigning retained object to unsafe property object will be released after assignment
-Warc-unsafe-retained-assign    assigning %select{
    array literal|dictionary literal|numeric literal|boxed expression|should not happen|block literal}0 to a weak %select{property|variable}1 object will be released after assignment
-Warc-unsafe-retained-assign    assigning retained object to %select{weak|unsafe_unretained}0 %select{property|variable}1 object will be released after assignment
-Warray-bounds    array index %0 is past the end of the array (which contains %1 element%s2)
-Warray-bounds    array index %0 is before the beginning of the array
-Warray-bounds    'static' has no effect on zero-length arrays
-Warray-bounds    array argument is too small contains %0 elements, callee requires at least %1
-Warray-bounds-pointer-arithmetic    the pointer incremented by %0 refers past the end of the array (that contains %1 element%s2)
-Warray-bounds-pointer-arithmetic    the pointer decremented by %0 refers before the beginning of the array
-Wassign-enum    integer constant not in range of enumerated type %0
-Watomic-property-with-user-defined-accessor    writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 with a user defined %select{getter|setter}2
-Wattributes    unknown attribute %0 ignored
-Wauto-var-id    'auto' deduced as 'id' in declaration of %0
-Wavailability    unknown platform %0 in availability macro
-Wavailability    overriding method %select{introduced after|deprecated before|obsoleted before}0 overridden method on %1 (%2 vs. %3)
-Wavailability    availability does not match previous declaration
-Wavailability    overriding method cannot be unavailable on %0 when its overridden method is available
-Wavailability    feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version %2 before it was %select{introduced|deprecated|obsoleted}3 in version %4 attribute ignored
-Wbad-function-cast    cast from function call of type %0 to non-matching type %1
-Wbitfield-constant-conversion    implicit truncation from %2 to bitfield changes value from %0 to %1
-Wbitwise-op-parentheses    '&' within '|'
-Wbool-conversion    "initialization of pointer of type %0 to null from a constant boolean " "expression
-Wbridge-cast    %0 cannot bridge to %1
-Wbridge-cast    %0 bridges to %1, not %2
-Wbuiltin-requires-header    declaration of built-in function '%0' requires inclusion of the header stdio.h
-Wbuiltin-requires-header    declaration of built-in function '%0' requires inclusion of the header setjmp.h
-Wbuiltin-requires-header    declaration of built-in function '%0' requires inclusion of the header ucontext.h
-Wc++-compat    %select{|empty }0%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++
-Wc++11-compat    explicit instantiation cannot be 'inline'
-Wc++11-compat    explicit instantiation of %0 must occur at global scope
-Wc++11-compat    explicit instantiation of %0 not in a namespace enclosing %1
-Wc++11-compat    explicit instantiation of %q0 must occur in namespace %1
-Wc++11-narrowing    constant expression evaluates to %0 which cannot be narrowed to type %1 in C++11
-Wc++11-narrowing    type %0 cannot be narrowed to %1 in initializer list in C++11
-Wc++11-narrowing    non-constant-expression cannot be narrowed from type %0 to %1 in initializer list in C++11
-Wc++98-c++11-compat    type definition in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++1y
-Wc++98-c++11-compat    use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++1y
-Wc++98-c++11-compat    init-captures.def warn_cxx11_compat_init_capture : Warning "initialized lambda captures are incompatible with C++ standards " "before C++1y
-Wc++98-c++11-compat    variable declaration in a constexpr %select{
    function|constructor}0 is incompatible with C++ standards before C++1y
-Wc++98-c++11-compat    constexpr function with no return statements is incompatible with C++ standards before C++1y
-Wc++98-c++11-compat    multiple return statements in constexpr function is incompatible with C++ standards before C++1y
-Wc++98-c++11-compat    variable templates are incompatible with C++ standards before C++1y
-Wc++98-compat    substitution failure due to access control is incompatible with C++98
-Wc++98-compat    %select{anonymous struct|union}0 member %1 with a non-trivial %select{
    constructor|copy constructor|move constructor|copy assignment operator|move assignment operator|destructor}2 is incompatible with C++98
-Wc++98-compat    enumeration type in nested name specifier is incompatible with C++98
-Wc++98-compat    static data member %0 in union is incompatible with C++98
-Wc++98-compat    default template arguments for a function template are incompatible with C++98
-Wc++98-compat    scalar initialized from empty initializer list is incompatible with C++98
-Wc++98-compat    befriending %1 without '%select{struct|interface|union|class|enum}0' keyword is incompatible with C++98
-Wc++98-compat    use of null pointer as non-type template argument is incompatible with C++98
-Wc++98-compat    friend declaration naming a member of the declaring class is incompatible with C++98
-Wc++98-compat    non-class friend type %0 is incompatible with C++98
-Wc++98-compat    befriending enumeration type %0 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值