congmomo / cppcheclipse

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

Command line arguments not correctly transmitted to cppcheck #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
"What steps will reproduce the problem?"

Run cppcheck on a source file that contains errors, warnings, and style issues.

"What is the expected output? What do you see instead?"

The application should report errors, warnings, and style issues in the
Problems Tab of Eclipse.  However, only errors are being reported. 

For Reference, I ran the CppCheck 1.4 GUI where it displayed all three
types of issues.

"What version of the product are you using? On what operating system?"

cppcheck =  version 0.94
Eclipse: Galileo CDT, version 3.5
OS: Windows XP

Original issue reported on code.google.com by jpe...@micros-retail.com on 4 Feb 2010 at 4:00

GoogleCodeExporter commented 9 years ago
To help me resolve that issue, please provide further information. 
1. What is the output you see in console, when running cppcheck. 
2. Are there any errors in the error.log? 
3. Could you attach a sample source which produces issues with cppcheck GUI but 
not
with cppcheclipse.

Original comment by konra...@gmx.de on 4 Feb 2010 at 4:06

GoogleCodeExporter commented 9 years ago
The source code doesn't matter. For a quick test, the following will do

int main()
{
    char a;
    char b = 0;
    char c[10];
    char *d = 0;

    strcpy(d, "something"); // Produces error

    a = c[b]; // Produces warning
}

The Java console shows: 
Executing '"C:\Program Files\Cppcheck\cppcheck.exe" --xml --enable=all  
C:\junk.cpp'
<?xml version="1.0"?>
Checking C:\junk.cpp...
<results>
<error file="C:\junk.cpp" line="10" id="nullPointer" severity="error" 
msg="Possible
null pointer dereference: d"/>
</results>
Duration 125 ms.

However, running the same command in a DOS command prompt will yield something 
different.

c:\projects>"C:\Program Files\Cppcheck\cppcheck.exe" --xml --enable=all  
C:\junk.cpp
<?xml version="1.0"?>
<results>
Checking C:\junk.cpp...
<error file="C:\junk.cpp" line="12" id="charArrayIndex" severity="style" 
msg="Warning
- using char
 variable as array index"/>
<error file="C:\junk.cpp" line="10" id="nullPointer" severity="error" 
msg="Possible
null pointer d
ereference: d"/>
Checking usage of global functions..
</results>

Original comment by jpe...@micros-retail.com on 4 Feb 2010 at 5:47

GoogleCodeExporter commented 9 years ago
Thanks for that example, I could now reproduce it. This is caused by how the 
command
line arguments are given to cppcheck with Java. There were some spaces too much,
which lead to some options not being recognized by cppcheck. In your example, 
only
the --xml was evaluated by cppcheck, but not the --enable=all. 
After spotting that bug, I will try to upload a new version as soon as possible.

Original comment by konra...@gmx.de on 4 Feb 2010 at 7:51

GoogleCodeExporter commented 9 years ago

Original comment by konra...@gmx.de on 4 Feb 2010 at 9:28

GoogleCodeExporter commented 9 years ago
Thanks for the fix.

Original comment by jpe...@micros-retail.com on 5 Feb 2010 at 6:23