Hi,
new to cppcheck
version 1.88
can't supress "Redundant assignment" warnings
I tried just providing the supression value = redundantAssignment
I tried the value and *.cpp for file name
I tried the full supression as shown below
nothing works?
code (file RS232DigitalIO.cpp)
564 bool bClose = m_SIO.CloseComPort();
565 bClose = bClose;
warning:
565 Redundant assignment of 'bClose' to itself.
my suppression:
<suppressions>
<suppression symbolname="'bClose" linenumber="565" filename="RS232DigitalIO.cpp">redundantAssignment</suppression>
</suppressions>
Thanks,
ajfitz
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry for this late reply.
I have tried to understand the issue and created a small example project to reproduce the issue.
I can reproduce it with 1.88 and with HEAD (1.89 dev).
Looks like you found a bug:
When the suppressions from the project file are loaded and a file name is specified for a suppression that does not start with * then the absolute path is prepended to the file name.
But the file name that is specified in the error message during the analysis does not (always) contains the full path. So when the file name of the error message and the suppression are compared the Cppcheck wrongly thinks they are different.
I will create a ticket for that issue.
Thanks for reporting that!
Attached is my small test project for reproducing the issue.
I have created the ticket https://trac.cppcheck.net/ticket/9240
As a workaround for this bug it is possible to suppress unwanted errors in files when adding a * in front of the file name.
So with *supr_issue.cpp it works for my example project.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
new to cppcheck
version 1.88
can't supress "Redundant assignment" warnings
I tried just providing the supression value = redundantAssignment
I tried the value and *.cpp for file name
I tried the full supression as shown below
nothing works?
code (file RS232DigitalIO.cpp)
564 bool bClose = m_SIO.CloseComPort();
565 bClose = bClose;
warning:
565 Redundant assignment of 'bClose' to itself.
my suppression:
<suppressions>
<suppression symbolname="'bClose" linenumber="565" filename="RS232DigitalIO.cpp">redundantAssignment</suppression>
</suppressions>
Thanks,
ajfitz
Sorry for this late reply.
I have tried to understand the issue and created a small example project to reproduce the issue.
I can reproduce it with 1.88 and with HEAD (1.89 dev).
Looks like you found a bug:
When the suppressions from the project file are loaded and a file name is specified for a suppression that does not start with
*
then the absolute path is prepended to the file name.But the file name that is specified in the error message during the analysis does not (always) contains the full path. So when the file name of the error message and the suppression are compared the Cppcheck wrongly thinks they are different.
I will create a ticket for that issue.
Thanks for reporting that!
Attached is my small test project for reproducing the issue.
I have created the ticket https://trac.cppcheck.net/ticket/9240
As a workaround for this bug it is possible to suppress unwanted errors in files when adding a
*
in front of the file name.So with
*supr_issue.cpp
it works for my example project.