Sazzad Hissain Khan
Sazzad Hissain Khan

Reputation: 40247

Why infer command is producing false positive error?

I am using CocoaLumberjack pod in my iOS project.

Defined custom macro like,

#define SM_DDLogDebugConst(tag, frmt)   DDLogDebug(([NSString stringWithFormat:@"[DEBUG][%@] %@", tag, frmt]), @"%@")

In code I used the macro like following,

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));
...

The problem is when I run infer its detecting DEAD_STORE error in lines 10 & 20 though the variables in the lines have been used in the logging. How to resolve this issue?

Note: my infer command runs in two steps,

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

Upvotes: 1

Views: 157

Answers (0)

Related Questions