且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

缺少桥强制转换会导致预处理源中出现错误,但不会导致实际源中出现错误

更新时间:2022-11-07 22:17:09

比较 ARC-隐式桥接 : "CFString.h"和其他Core Foundation标头包含宏

Compare ARC - implicit bridging: "CFString.h" and other Core Foundation headers contain the macros

CF_IMPLICIT_BRIDGING_ENABLED
...
CF_IMPLICIT_BRIDGING_DISABLED

展开为

_Pragma("clang arc_cf_code_audited begin")
...
_Pragma("clang arc_cf_code_audited end")

,这会使Clang不再抱怨缺少__bridge强制类型转换.

and that causes Clang to not complain about missing __bridge casts.

杂物由预处理器消耗",因此不在预处理中 文件. 由于无论如何都要转换预处理的源,因此您可以添加 这些实用程序再次到达预处理文件的开头/结尾. 这样编译时就不会发出警告.

The pragmas are "consumed" by the preprocessor and therefore not in the preprocessed file. Since you are transforming the preprocessed source anyway, you can add these pragmas to the start/end of the preprocessed file again. Then there will be no warnings when compiling it.