提问人:Sazzad Hissain Khan 提问时间:1/11/2022 最后编辑:Sazzad Hissain Khan 更新时间:1/18/2022 访问量:128
为什么推断命令会产生误报错误?
Why infer command is producing false positive error?
问:
我在我的 iOS 项目中使用 CocoaLumberjack pod。
定义自定义宏,如,
#define SM_DDLogDebugConst(tag, frmt) DDLogDebug(([NSString stringWithFormat:@"[DEBUG][%@] %@", tag, frmt]), @"%@")
在代码中,我使用了如下所示的宏,
int64_t startTime = [TimeUtils NOW]; // returns timestamp // line = 10
...
int64_t tempTime = [TimeUtils NOW]; // returns timestamp // line = 20
SM_DDLogDebug(TAG_Class, @"elapsed time: %lld", (tempTime - startTime));
...
问题是,当我运行时,尽管行中的变量已在日志记录中使用,但在第 10 行和第 20 行中推断出其检测错误。如何解决此问题?DEAD_STORE
注意:我的推断命令分两步运行,
xcodebuild clean build -workspace Project.xcworkspace -scheme Main -configuration Release COMPILER_INDEX_STORE_ENABLE=NO OTHER_CFLAGS="-DNS_FORMAT_ARGUMENT(A)= -D_Nullable_result=_Nullable" | tee xcodebuild.log | /usr/local/bin/xcpretty -r json-compilation-database -o compile_commands.json
/usr/local/bin/infer run --keep-going --skip-analysis-in-path Pods --compilation-database-escaped compile_commands.json
答: 暂无答案
评论
infer
startTime
endTime
#ifdef DEBUG
SM_DEBUG_SAVE_START_TIME()
SM_DEBUG_SAVE_START_TIME()