In a codebase I've spotted variable assignments in the form of "variable = variable = value" (e.g., "m_bA = m_bA = 2;"). It would be nice if cppcheck would also detect such double assignments.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@Sven The ticket http://trac.cppcheck.net/ticket/9354 has been resolved.
The unknown macros will now be reported and there is now a configuration for the MFC (mfc.cfg).
I have added another configuration for the Microsoft ATL (microsoft_atl.cfg) since Cppcheck found corresponding macros that were also missing a configuration for analyzing TortoiseGit.
Several false positives and other issues found by analyzing TortoiseGit were also fixed in the Windows configuration of Cppcheck.
So the results should be a bit better now.
BTW: I love TortoiseGit and use it very often. Thanks for such a great tool.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just installed the latest version 2.0
For a MS-Windows Visual Studio project
I still get the error
There is an unknown macro here somewhere. Configuration is required. If BEGIN_MESSAGE_MAP is a macro then please configure it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I checked the tortoisegit code and it seems we have a couple of problems. With the mfc.cfg I do not get unknown macro warnings about BEGIN_MESSAGE_MAP but I do see other problems that we should fix in Cppcheck.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In a codebase I've spotted variable assignments in the form of "variable = variable = value" (e.g., "m_bA = m_bA = 2;"). It would be nice if cppcheck would also detect such double assignments.
Could you elaborate a little.
Cppcheck output:
These cases (https://gitlab.com/tortoisegit/tortoisegit/commit/9051ad7a35165f2f45ecdcc2220c914998a655de) were not spotted by cppcheck (GUI).
hmm... I do not get these warnings neither... I think this is a real problem in Cppcheck. Thanks!
The first false negative seems to be related to the BEGIN_MESSAGE_MAP ... END_MESSAGE_MAP
Cppcheck does not know what that is.. and it is not defined anywhere in the repo.
hmm.. .you are supposed to get a information message if there is such unknown macro! So you can fix it in some way.
I have created this ticket:
https://trac.cppcheck.net/ticket/9354
@Sven The ticket http://trac.cppcheck.net/ticket/9354 has been resolved.
The unknown macros will now be reported and there is now a configuration for the MFC (mfc.cfg).
I have added another configuration for the Microsoft ATL (microsoft_atl.cfg) since Cppcheck found corresponding macros that were also missing a configuration for analyzing TortoiseGit.
Several false positives and other issues found by analyzing TortoiseGit were also fixed in the Windows configuration of Cppcheck.
So the results should be a bit better now.
BTW: I love TortoiseGit and use it very often. Thanks for such a great tool.
Where can I download mfc.cfg
I just installed the latest version 2.0
For a MS-Windows Visual Studio project
I still get the error
There is an unknown macro here somewhere. Configuration is required. If BEGIN_MESSAGE_MAP is a macro then please configure it.
I just installed version 2.1
Still same problem
How do I work around this?
You asked how to download mfc.cfg. Sorry that I did not reply. If you still wonder; feel free to download this file: https://github.com/danmar/cppcheck/raw/2.1/cfg/mfc.cfg
all cfg files:
https://github.com/danmar/cppcheck/tree/2.1/cfg
I believe the intention is to distribute all of the cfg files except "cppcheck-internal.cfg". So we need to review this.
I checked the tortoisegit code and it seems we have a couple of problems. With the
mfc.cfg
I do not get unknown macro warnings aboutBEGIN_MESSAGE_MAP
but I do see other problems that we should fix in Cppcheck.Hi Daniel
I got the mfc.cfg
How do I load this file?
I am using the GUI
if you put a cfg file in the same folder as your
<foo>.cppcheck
project file then it should be shown in the list in the GUI.There should be a way to load a cfg file from the GUI
From: "Daniel Marjamäki" danielmarjamaki@users.sourceforge.net
Sent: Sunday, June 28, 2020 2:06 AM
To: "[cppcheck:discussion]" general@discussion.cppcheck.p.re.sourceforge.net
Subject: [cppcheck:discussion] "variable = variable = value" -> should issue a warning
if you put a cfg file in the same folder as your <foo>.cppcheck project file then it should be shown in the list in the GUI.</foo>
"variable = variable = value" -> should issue a warning
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/cppcheck/discussion/general/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
please see the list in the project file dialog.