본문 바로가기

Testing Tools

MISRA C:2012 를 위한 공개SW(CppCheck) 사용

공개 SW 정적분석 자동화 도구인 CppCheck(http://cppcheck.sourceforge.net/)에서 1.83 버전부터 misra 플러그인을 제공하고 있고, 홈페이지를 확인해보니까 MISRA로부터 정식 라이선스를 구매하여 서비스를 제공하고 있단다. 이 정도 도구를 무료로 사용할 수 있다니 공개SW 만세!

 

 

cppcheck / Discussion / General Discussion: Use MISRA rules from the GUI?

Use MISRA rules from the GUI? Log in to post a comment. © 2019 Slashdot Media. All Rights Reserved. Terms Privacy Opt Out Advertise Oh no! Some styles failed to load. Please try reloading this page, or contact support. Get latest updates about Open Source

sourceforge.net

요런 글이 올라와 있었다. 이게 벌써 2018년 1월 일이었구만.

 

 

 

MISRA Web site > Links

The following list of sites which may be of interest to visitors to the MISRA site is provided without any endorsement or recommendation by MISRA. All links open in a new window. Safety-related systems sites The World Wide Web Virtual Library: Safety-Criti

www.misra.org.uk

 

다만, MISRA C 각 Guideline 별 Text는 별도로 제공해줘야 한다.

 

MISRA C:2012 pdf를 보유하고 있다면, pdftotext 같은 툴로 별도의 txt 파일로 만들어줘야 하며, text 파일 포멧은 아래와 같아야 제대로 보인다.

 

  • MISRA_C2012.txt 예제
Appendix A Summary of guidelines
Rule 1.1
The program shall contain no violations of the standard C syntax and constraints, and shall not exceed the implementation’s translation limits (Rule 1.1)
Rule 1.2
Language extensions should not be used (Rule 1.2)
Rule 1.3
There shall be no occurrence of undefined or critical unspecified behaviour (Rule 1.3)
...

※ MISRA Text만 사용할 경우, MISRA 관련 룰 위반인지 다른 룰 위반인지 구분이 안간다. 이거저거 다 해봤는데, 구분자를 앞에붙이면 분석 결과에서 사라진다. 왜 이런지는 잘 모르겠다.

 

관련 CppCheck 설정 및 구동 화면은 아래와 같다.

 

1) Global 설정 선택

 

2) Addons 설정을 아래와 같이 수정한다.

 

3) Project 별 설정에서 아래와 같이 추가 설정한다.

 

4) 분석을 수행하면 아래와 같이 MISRA C:2012 관련 위반사항들을 확인할 수 있다.