ipodipad / cppcheclipse

Automatically exported from code.google.com/p/cppcheclipse
0 stars 0 forks source link

Cppcheclipse do not show the same things as running cpp check from command line #43

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run from command line : cppcheck --all --style --unused-functions .
2. Output shows some member variables not initialized in the constructor and an 
unused private function.
3. Running cppcheck from eclipse does not give any output. Preferences -> 
cppcheclipse -> Settings is ticked on "Check for all known issues (all)".
I have also tried changing Project -> Properties -> cppcheclipse to use project 
setting, and defined in Advanced command line arguments: -enable=style 
--enable=unusedFunction --enable=all. Still no output.

What is the expected output? What do you see instead? Please provide output
of the console view of cppcheclipse as well as the Eclipse error log.

...

[./utils/TestClass.cpp:3]: (style) Member variable not initialized in the 
constructor 'TestClass::m_reducedValue'
[./utils/TestClass.cpp:3]: (style) Member variable not initialized in the 
constructor 'TestClass::m_smoothRate'
32/35 files checked 91% done
...

Checking ./utils/Config.cpp...
[./utils/Config.h:373]: (style) Unused private function 'Config::parseDocument'
35/35 files checked 100% done
Checking usage of global functions..

What version of the cppcheclipse, cppcheck, Eclipse and Java are you using?
On what operating system?
cppcheclipse: 0.9.7
cppcheck: 1.52
Eclipse: Helios Service Release 2

Please provide any additional information below.

Original issue reported on code.google.com by hmabraha...@gmail.com on 14 Dec 2011 at 11:57

GoogleCodeExporter commented 8 years ago
Please give me the directory with the sources, otherwise I can't reproduce the 
error. Probably one file is enough (Config.cpp or TestClass.cpp). Thanks

Original comment by konra...@gmx.de on 15 Dec 2011 at 10:59

GoogleCodeExporter commented 8 years ago
Hi!

I've modified the files somewhat, but it's still the same. Running them
from command line with
cppcheck --all --style --unused-functions .
generates the following:

Checking ./utils/Config.cpp...
[./utils/Config.cpp:23]: (style) Member variable not initialized in the
constructor 'Config::a'
[./utils/Config.h:31]: (style) Unused private function
'Config::parseDocument'
Checking usage of global functions..

Running from eclipse generates nothing.

Original comment by hmabraha...@gmail.com on 15 Dec 2011 at 1:22

GoogleCodeExporter commented 8 years ago
Please attach that file here.

Original comment by konra...@gmx.de on 15 Dec 2011 at 7:59

GoogleCodeExporter commented 8 years ago

Original comment by hmabraha...@gmail.com on 16 Dec 2011 at 7:58

Attachments:

GoogleCodeExporter commented 8 years ago
When I execute cppcheck (1.52) from within Eclipse I see the following output 
in the Eclipse console:

== Running cppcheck at 26.12.11 13:27 ==
Command line: /usr/local/cppcheck/cppcheck-1.52/cppcheck --template 
{file};{line};{severity};{id};{message} --enable=all src/Config.cpp
src/Config.cpp;3;warning;uninitVar;Member variable 'Config::a' is not 
initialized in the constructor.
src/Config.h;11;style;unusedPrivateFunction;Unused private function 
'Config::parseDocument'
Checking src/Config.cpp...
Checking usage of global functions..
Duration 110 ms.

Also the warning markers are correctly added to the sources. It is the same 
output as directly on the command line. 
Please give the output from the Eclipse console when running cppcheck from 
Eclipse.

Original comment by konra...@gmx.de on 26 Dec 2011 at 12:30

GoogleCodeExporter commented 8 years ago
Output from Eclipse console:

== Running cppcheck at 1/3/12 10:20 AM ==
Command line: /home/user/install/eclipse/dropins/cppcheck-1.52/cppcheck 
--template {file};{line};{severity};{id};{message} --enable=all --enable=style 
--enable=unusedFunction --enable=all --check-config utils/Config.cpp
Checking utils/Config.cpp...
Checking usage of global functions..
Duration 108 ms.

Original comment by hmabraha...@gmail.com on 3 Jan 2012 at 9:24

GoogleCodeExporter commented 8 years ago
I'm not sure if this is related, but I discovered that --template 
{file};{line};{severity};{id};{message} isn't compliant to what cppcheck shows 
me in the help.
It should be --template='{file};{line};{severity};{id};{message}'.
Otherwise it seems like other parameters like --enable=all are ignored.

Although it works from eclipse: it might be a good idea to surround the path of 
the file to check with a double quote.

I'm using eclipse 3.7 with the latest cppcheclipse.
cppcheck is provided by cygwin in version 1.53.
The OS is WinXP.

Regards,
Manuel

Original comment by TheNinj...@gmail.com on 21 Mar 2012 at 9:13

GoogleCodeExporter commented 8 years ago
Cppcheclipse shows no issues as it is called with --check-config. Obviously 
this additional parameter was given in the configuration. As soon as you remove 
it, cppcheclipse will give out the correct warnings. This behaviour is equal to 
the one on the command line. If you call cppcheck with --check-config, it will 
not give out any warnings for the attached file.
Although the syntax --template=<format> was introduced with cppcheck 1.52 even 
with the current version, the old format --template <format> is still 
supported. Nevertheless I will use the new format --template=<format> with the 
upcoming version of cppcheclipse and increase the minimal supported version of 
cppcheck to 1.52.

Original comment by konra...@gmx.de on 16 Jul 2012 at 6:55

GoogleCodeExporter commented 8 years ago

Original comment by konra...@gmx.de on 1 Sep 2012 at 3:39