gicho / cppcheclipse

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

Pass include directories to cppcheck #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Sometimes it is necessary to pass additional include directories. I have
attached an example of why this is necessary and the different results are
found below.  Basically if cppcheck can't find a header file that includes
a typedef it does not include that variable for check as uninitialized (I'm
not sure what else it would miss).

Executing '"C:\Program Files\Cppcheck\cppcheck.exe" --xml "-j 1"
--enable=style,possibleError --force
C:\ide-4.6-workspace\cppcheck_example\src\main.c'
<?xml version="1.0"?>
Checking C:\ide-4.6-workspace\cppcheck_example\src\main.c...
<results>
<error file="C:\ide-4.6-workspace\cppcheck_example\src\main.c" line="8"
id="unassignedVariable" severity="style" msg="Variable 'uninit_i32' is not
assigned a value"/>
<error file="C:\ide-4.6-workspace\cppcheck_example\src\main.c" line="12"
id="uninitvar" severity="error" msg="Uninitialized variable: uninit_i32"/>
</results>
Duration 110 ms.

Compared with calling it from console with the includes directory passed as
argument.

C:\ide-4.6-workspace\cppcheck_example>"C:\Program
Files\Cppcheck\cppcheck.exe" --force --enable=style,possibleError -I
includes src/main.c
Checking src\main.c...
[src\main.c:8]: (style) Variable 'uninit_i32' is not assigned a value
[src\main.c:8]: (style) Variable 'uninit_i32_header' is not assigned a value
[src\main.c:12]: (error) Uninitialized variable: uninit_i32
[src\main.c:15]: (error) Uninitialized variable: uninit_i32_header

Original issue reported on code.google.com by konra...@gmx.de on 16 May 2010 at 11:31

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by konra...@gmx.de on 16 May 2010 at 11:31

GoogleCodeExporter commented 8 years ago
In the next version there will be the possibility to give cppcheck all the 
additional
headers the user has defined within CDT (in Project properties->C/C++ 
General->Paths
and Symbols->Includes). Due to ticket 878 in cppcheck
(http://sourceforge.net/apps/trac/cppcheck/ticket/878) only the additonal 
includes
(not the standard include directories) are given to cppcheck. There will be a 
little
checkbox to switch on  dispatching the additional includes to cppcheck.

Original comment by konra...@gmx.de on 16 May 2010 at 11:50