| Issue |
203700
|
| Summary |
Clang-tidy - anomalous error message
|
| Labels |
clang-tidy
|
| Assignees |
|
| Reporter |
DerellLicht
|
I am using clang-tidy (LLVM version 21.0.0git) on Windows 10 Pro.
I recently ran it on a new project, and got this error:
D:/SourceCode/Git/binclock_redux/config.cpp:90:8: note: Assuming ‘result’ is equal to 0
90 | if (result != 0)
| ^~~~~~~~~~~
D:/SourceCode/Git/binclock_redux/config.cpp:90:4: note: Taking false branch
90 | if (result != 0)
| ^
yet this is the code at line 90:
LRESULT result = derive_filename_from_exec(ini_name, (TCHAR ) _T(“.ini”)) ;
if (result != 0) {
return result;
}
and that function is definitely capable of returning either 0 or non-0 results…
Why do I get these reports (there are several of them) ??
==================================================
Later note:
Actually, these spurious warnings are apparently caused by another (valid) warning:
D:/SourceCode/Git/binclock_redux/config.cpp:140:11: note: Opened stream never closed. Potential resource leak
140 | return 0;
Once I added
fclose(fd);
to the end of this function, all of the other 12 warnings went away…
still… were these other warnings desirable, for some reason??
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs