合理利用xcode中的warning来标记todo事项。

  • 忽略某一句的warning
    1
    2
    3
    4
    5
    #pragma clang diagnostic push
    #pragma clang diagnostic ignored "-Wdeprecated-declarations"
    //code ...
    #pragma clang diagnostic pop
  • 忽略某一文件的的warning
忽略某一文件的的warning
Flags
1
2
-Wno-shorten-64-to-32
//shorten-64-to-32 为warning类型
  • 设置TODO等自定义格式为warning
script
add script
1
2
TAGS="TODO:|FIXME:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"