为什么Xcode / clang将我的“-fno-objc-arc”翻译为“-fno_objc_arc”?

时间:2012-06-06 23:08:37

标签: objective-c xcode automatic-ref-counting clang

我试图按照SF的建议关闭一个文件的每个文件的Objective-C arc,方法是在“编译源”部分的文件的编译标志中放置“-fno-objc-arc”。我的项目的构建阶段。

这对我不起作用,因为仍然会生成与ARC相关的错误。

我在日志中看到我尝试执行此操作的文件时出现以下警告:

“clang:warning:编译期间未使用的参数:' - fno_objc_arc'”

我注意到它显示的是下划线而不是破折号。当我查看生成的编译行时,它还会显示下划线而不是破折号。

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c
-arch armv7 -fmessage-length=0 -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -O0
-Werror-implicit-function-declaration -Wmissing-field-initializers -Wno-missing-prototypes -Wreturn-type
-Wno-implicit-atomic-properties -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function
-Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wuninitialized -Wno-unknown-pragmas
-Wno-shadow -Wno-four-char-constants -Wno-sign-compare -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof
-Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DDEBUG=1
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
-Wprotocol -Wdeprecated-declarations -g -Wno-conversion -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))"
"-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)"
-miphoneos-version-min=5.1 -iquote /x/xcode/DerivedData/myproj-eqyvffptnyujnsgcmhlqunfmfytp/Build/Intermediates/myproj.build/Debug-iphoneos/myproj.build/myproj-generated-files.hmap
-I/x/xcode/DerivedData/myproj-eqyvffptnyujnsgcmhlqunfmfytp/Build/Intermediates/myproj.build/Debug-iphoneos/myproj.build/myproj-own-target-headers.hmap
-I/x/xcode/DerivedData/myproj-eqyvffptnyujnsgcmhlqunfmfytp/Build/Intermediates/myproj.build/Debug-iphoneos/myproj.build/myproj-all-target-headers.hmap
-iquote /x/xcode/DerivedData/myproj-eqyvffptnyujnsgcmhlqunfmfytp/Build/Intermediates/myproj.build/Debug-iphoneos/Voyeur.build/myproj-project-headers.hmap
-I/x/xcode/DerivedData/myproj-eqyvffptnyujnsgcmhlqunfmfytp/Build/Products/Debug-iphoneos/include
-I/x/xcode/DerivedData/myproj-eqyvffptnyujnsgcmhlqunfmfytp/Build/Intermediates/myproj.build/Debug-iphoneos/myproj.build/DerivedSources/armv7
-I/x/xcode/DerivedData/myproj-eqyvffptnyujnsgcmhlqunfmfytp/Build/Intermediates/myproj.build/Debug-iphoneos/myproj.build/DerivedSources
-F/x/xcode/DerivedData/myproj-eqyvffptnyujnsgcmhlqunfmfytp/Build/Products/Debug-iphoneos -fno_objc_arc
-include /x/xcode/DerivedData/myproj-eqyvffptnyujnsgcmhlqunfmfytp/Build/Intermediates/PrecompiledHeaders/myproj-Prefix-adnhewmpoabuzebrrqoplkebnugj/myproj-Prefix.pch
-MMD -MT dependencies -MF /x/xcode/DerivedData/myproj-eqyvffptnyujnsgcmhlqunfmfytp/Build/Intermediates/myproj.build/Debug-iphoneos/myproj.build/Objects-normal/armv7/mySource.d
--serialize-diagnostics /x/xcode/DerivedData/myproj-eqyvffptnyujnsgcmhlqunfmfytp/Build/Intermediates/myproj.build/Debug-iphoneos/myproj.build/Objects-normal/armv7/mySource.dia
-c /x/git/myproj/subdir/mySource.m
-o /x/xcode/DerivedData/myproj-eqyvffptnyujnsgcmhlqunfmfytp/Build/Intermediates/myproj.build/Debug-iphoneos/myproj.build/Objects-normal/armv7/mySource.o

1 个答案:

答案 0 :(得分:6)

回答我自己的问题,下划线可能是一开始就输入不好的遗留物,忘了我已经完成了这个,但是在导出的数据缓存中被卡住了。

快速修复此问题

  1. 在Xcode中关闭项目
  2. 删除文件夹/ x / xcode / DerivedData / myproj-eqyvffptnyujnsgcmhlqunfmfytp
  3. 在Xcode中重新打开项目
  4. 重新构建并重新运行
  5. 在查看进行这些更改后生成的日志时,其值适当地为“-fno-objc-arc”,出现的时间晚于“-fobjc-arc”,并且根据另一个stackoverflow.com回答,最后一个在命令行上获胜。