Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot generate XML output from cppcheck

Tags:

cppcheck

I am using cppcheck for static analysis of C Code, but cannot seem to get an XML. I require the XML File to be consumed by Jenkins

Here is what i have tried so far:

runcppcheck.sh

#!/bin/sh
cd obj/msc
cppcheck --enable=all -I. -I. -I. -I. -I. -I. -I. -I. -I. -I. -I. /usr/include/ -I. obj/fap/ \
-DSUNOS -DSS -DSS_MT -DANSI -D_GNU_SOURCE -DSS_LINUX -D_REENTRANT -D__EXTENSIONS__ -DSUNOS -DCNS_PH1 -DDBG_TIMESTAMP -DLX_PRNT_TIMESTAMP \
-DDEBUGP -DLX -DLCLXT -DLXT_V1 -DLCLXUILXT -DLCXULILXT -DXU  -DLX -DLCLLX  -DSM -DLWLCLLX -DLCLXMILLX -DLCSMLXMILLX -DHR -DLX -DLCHRT \
-DLCHRUIHRT -DLCHRLIHIT -DLCLXLIHRT -DXU -DLCXULIHRT  -DLX -DLX_RTP -DLX_FASTRC -DCMINET_BSDCOMPAT -DSS_TICKS_SEC=100 -DCMFILE_REORG_1 \
-DCM_INET2 -D_GNU_SOURCE -DCMFILE_REORG_2 -DSSINT2 -DCMKV2 -DHI_MULTI_THREADED -DxCM_PASN_DBG -DxCCPU_DEBUG -DxRNC_OUTPUT_CONSOLE \
-DxCCPU_DEBUG_TRACE -DCCPU_DEBUG1 -DSS_PERF -DNO_ERRCLS -DNOERRCHK -DSS_M_PROTO_REGION -DxCCPU_DEBUG_TRACE1 -DxCCPU_DEBUG_TRACE2 \
-DCCPU_MEAS_CPU -DSTD_CCPU_IU -UMULTIPLE_CN_SUPPORT -DLONG_MSG -DTEST_CNS -UDCM_RTP_SESSID_ARRAY -DHR *.c *.h --xml ../../cppcheck-result.xml

i DO GET the XML on stdout, but just NOT in a file

like image 473
kamal Avatar asked May 16 '12 01:05

kamal


1 Answers

I am a Cppcheck developer.

You need to pipe the report to the file.

cppcheck file1.c --xml 2> cppcheck-result.xml

A small hint about your command line, in most cases it's better to use . instead of *.c *.h.

like image 161
Daniel Marjamäki Avatar answered Sep 19 '22 23:09

Daniel Marjamäki