Programming/C Win32 MFC2015. 9. 30. 15:00

그냥 콘솔창에서도 사용이 가능해 보이니 돌려볼까..


[링크 : http://linuxpoison.blogspot.kr/2010/06/cppcheck-tool-for-static-c-c-code.html]

[링크 : http://cppcheck.sourceforge.net/]

[링크 : http://cppcheck.sourceforge.net/demo/]


우분투에서는 cppcheck 라는 이름으로 있군..

[링크 : http://packages.ubuntu.com/precise/devel/cppcheck]


$ sudo apt-get install cppcheck

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following extra packages will be installed:

  libtinyxml2.6.2

The following NEW packages will be installed:

  cppcheck libtinyxml2.6.2

0 upgraded, 2 newly installed, 0 to remove and 81 not upgraded.

Need to get 604 kB of archives.

After this operation, 1,466 kB of additional disk space will be used.

Do you want to continue [Y/n]?

Get:1 http://archive.ubuntu.com/ubuntu/ precise/universe libtinyxml2.6.2 amd64 2                                      .6.2-1build1 [35.3 kB]

Get:2 http://archive.ubuntu.com/ubuntu/ precise/universe cppcheck amd64 1.52-1 [                                      569 kB]

Fetched 604 kB in 2s (225 kB/s)

Selecting previously unselected package libtinyxml2.6.2.

(Reading database ... 213921 files and directories currently installed.)

Unpacking libtinyxml2.6.2 (from .../libtinyxml2.6.2_2.6.2-1build1_amd64.deb) ...

Selecting previously unselected package cppcheck.

Unpacking cppcheck (from .../cppcheck_1.52-1_amd64.deb) ...

Processing triggers for man-db ...

Setting up libtinyxml2.6.2 (2.6.2-1build1) ...

Setting up cppcheck (1.52-1) ...

Processing triggers for libc-bin ...

ldconfig deferred processing now taking place 


Example usage:

  # Recursively check the current folder. Print the progress on the screen and

    write errors to a file:

    cppcheck . 2> err.txt

  # Recursively check ../myproject/ and don't print progress:

    cppcheck --quiet ../myproject/

  # Check only files one.cpp and two.cpp and give all information there is:

    cppcheck -v -s one.cpp two.cpp

  # Check f.cpp and search include files from inc1/ and inc2/:

    cppcheck -I inc1/ -I inc2/ f.cpp


For more information:

    http://cppcheck.sf.net/manual.pdf


-s를 써보라고 예제가 써있어서 해봤더니 style 체크.. 하지만 deprecated라 경고가 뜬다.

    -s, --style          Deprecated, please use '--enable=style' instead

    -v, --verbose        Output more detailed error information.
    -j <jobs>            Start [jobs] threads to do the checking simultaneously.

의외로 경고 뿜뿜을 안해서 실망.. 복잡한 코드를 돌려봐야 하려나?

암튼. make 처럼 -j 옵션을 지원한다.

'Programming > C Win32 MFC' 카테고리의 다른 글

"\n" 의 cpu 점유율?  (0) 2015.10.12
rand()와 RAND_MAX  (0) 2015.10.05
void형 포인터 ++  (0) 2015.07.14
가변인자를 다시 넘겨주기  (2) 2015.07.07
printf 가변인자의 비밀?  (0) 2015.06.18
Posted by 구차니