CppCheck 사용하기

Tools -> External Tools에 항목 추가

  • -j [job count] : multithread로 체크

파일 검사

  • Title : cppcheck_file
  • Command : C:\Program Files\Cppcheck\cppcheck.exe
  • Arguments : -j 8 --platform=win64 --std=c++14 --enable=warning,style,performance,portability,information --inline-suppr --quiet --template="{file}({line}): {severity} ({id}): {message}" $(ItemPath)
  • Initial directory : $(ItemDir)
  • Use Output window : Checking

프로젝트 검사

  • Title : cppcheck_project
  • Command : C:\Program Files\Cppcheck\cppcheck.exe
  • Arguments : -j 8 --platform=win64 --std=c++14 --enable=warning,style,performance,portability,information --inline-suppr --quiet --template="{file}({line}): {severity} ({id}): {message}" $(ProjectDir)
  • Initial directory : $(ProjectDir)
  • Use Output window : Checking

파일 검사(시간 측정 포함)

  • Title : cppcheck_file_with_elapsetime
  • Command : C:\elapsetime.cmd
  • Arguments : "C:\Program Files\Cppcheck\cppcheck.exe" --force -j 8 --platform=win64 --std=c++14 --enable=warning,style,performance,portability,information --inline-suppr --suppress=unusedPrivateFunction --quiet --template="{file}({line}): {severity} ({id}): {message}" $(ItemPath)
  • Initial directory : $(ItemDir)
  • Use Output window : Checking

프로젝트 검사(시간 측정 포함)

  • Title : cppcheck_project_with_elapsetime
  • Command : C:\elapsetime.cmd
  • Arguments : "C:\Program Files\Cppcheck\cppcheck.exe" -j 8 --platform=win64 --std=c++14 --enable=warning,style,performance,portability,information --inline-suppr --suppress=unusedPrivateFunction --quiet --template="{file}({line}): {severity} ({id}): {message}" $(ProjectDir)
  • Initial directory : $(ProjectDir)
  • Use Output window : Checking

elapsetime.cmd

@echo off

set STARTTIME=%TIME%

rem Execute parameter
%*

set ENDTIME=%TIME%

rem Change formatting for the start and end times
for /F "tokens=1-4 delims=:.," %%a in ("%STARTTIME%") do (
   set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)

for /F "tokens=1-4 delims=:.," %%a in ("%ENDTIME%") do (
   set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)

rem Calculate the elapsed time by subtracting values
set /A elapsed=end-start

rem Format the results for output
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%

set DURATION=%hh%:%mm%:%ss%,%cc%

echo Start    : %STARTTIME%
echo Finish   : %ENDTIME%
echo          ---------------
echo Duration : %DURATION% 
2013/07/25 17:30 2013/07/25 17:30

글 걸기 주소 : 이 글에는 트랙백을 보낼 수 없습니다

덧글을 달아 주세요