infer
infer copied to clipboard
DEAD_STORE - False Positive
Please make sure your issue is not addressed in the FAQ.
infer version 1.1.1_0 OS: Catalina
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];
SM_DDLogDebug(TAG_Class, @"elapsed time: %lld", (tempTime - startTime));
...
The problem is when I run infer its detecting DEAD_STORE
error in line 10 through the variable in the line has been used in the logging. How to resolve this issue?
Could it be that the macro is compiled out so infer doesn't see the use of the variable inside of it? Is there a way for you to build with logging enabled when using infer?
@jvillard I also suspect that the macros are creating problems. But I am building with below command,
xcodebuild clean build -workspace Project.xcworkspace -scheme Main -configuration CustomDebug 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
infer run --keep-going --skip-analysis-in-path Pods --compilation-database-escaped compile_commands.json
And in CustomDebug configuration logging is already enabled. So how can I check other options and resolve it?