This is most likely because we do not recognize reset or release as methods that can change the variable. I wonder if its as easy as updating std.cfg about these methods.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The only configuration regarding unique_ptr in std.cfg is currently:
<smart-pointerclass-name="std::unique_ptr"/>
I guess that Cppcheck should assume that variables are changed if the function is unknown/not configured. So IMHO this looks like an issue in Cppcheck.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
With the following code, I receive a condition is always true at line 17
cppcheck.exe --enable=all --template=vs --library=std.cfg --library=windows.cfg -DOS_NT -DWIN32 -D_WIN32 -DNDEBUG -D_cppcheck --inline-suppr test.cpp
Checking test.cpp ...
Checking test.cpp: OS_NT=1;WIN32=1;_WIN32=1;NDEBUG=1;_cppcheck=1...
test.cpp(17): style: Condition '!ptr' is always true
nofile(0): information: Cppcheck cannot find all the include files (use --check-config for details)
It's new with version 1.88
This is most likely because we do not recognize
reset
orrelease
as methods that can change the variable. I wonder if its as easy as updating std.cfg about these methods.The only configuration regarding
unique_ptr
in std.cfg is currently:I guess that Cppcheck should assume that variables are changed if the function is unknown/not configured. So IMHO this looks like an issue in Cppcheck.