lint를 실제 업무에 적용하여 사용하시는 분들 있으신가요?

greatkgc의 이미지

각종 책이나 문서들을 보면 lint에 대한 이야기가 많이 나옵니다.
문법 검사기 정도가 아닌, 코드의 오류를 줄여줄 수 있는 많은
일들을 하는 것 같습니다.

그런데.. 제가 lint를 사용하는 프로그래머 분들을 한번도 본적이
없습니다. 아직 사용하지 않은 저로서는 분명 lint 가 잇점이
있다고 생각되긴 하는데요. 왜이렇게 사용하는 사람들이 그리
많지 않을까요? 그냥 컴파일러의 -Wall 정도로 충분한걸까요?

제가 사용해본 것은 splint 입니다.

http://www.splint.org/

ed.netdiver의 이미지

상용 스택같은걸 보면, lint를 거의 항상 쓰는것 같던데,
저는 한번도 실제 과제에서 써본적은 없네요.
처음 lint란걸 들어본적도 없을때, comment가
/* ... keep lint happy ... */
뭐 이런식으로 되어있는 src를 보고는, 와 lint가 무서운 사람인가보다.
이런 식으로 생각해버렸다는..ㅋㅋ.

--------------------------------------------------------------------------------
\(´∇`)ノ \(´∇`)ノ \(´∇`)ノ \(´∇`)ノ
def ed():neTdiVeR in range(thEeArTh)

비행소년의 이미지

lint 라는 걸 오늘 첨 본듯 합니다. :D
뭔가 볼라고 하니 간략한 설명이 나와 있네요.

Quote:

Splint is a tool for statically checking C programs for security vulnerabilities and coding mistakes.

뭔가 매우 유용한 듯한 느낌이 팍 하고 오는데. lint에 대해서 누가 설명종 해주실 분 계신가요?
아니면 검색은 셀프 인가요? :oops:

높이 날다 떨어지면.
아푸다 ㅡ,.ㅡ

greatkgc의 이미지

비행소년 wrote:
lint 라는 걸 오늘 첨 본듯 합니다. :D
뭔가 볼라고 하니 간략한 설명이 나와 있네요.

Quote:

Splint is a tool for statically checking C programs for security vulnerabilities and coding mistakes.

뭔가 매우 유용한 듯한 느낌이 팍 하고 오는데. lint에 대해서 누가 설명종 해주실 분 계신가요?
아니면 검색은 셀프 인가요? :oops:

그 다음 라인에 자세한 설명이 나와 있는데요. ^^
간단히 말하면 똑똑한 상용 컴파일러에서 해주고 있는 코드 체크 작업과
유사한 일을 해줍니다. splint 매뉴얼에 나와 있는데로..

Quote:

· Dereferencing a possibly null pointer (Section 2);

· Using possibly undefined storage or returning storage that is not properly defined (Section 3);

· Type mismatches, with greater precision and flexibility than provided by C compilers (Section 4.1–4.2);

· Violations of information hiding (Section 4.3);

· Memory management errors including uses of dangling references and memory leaks (Section 5);

· Dangerous aliasing (Section 6);

· Modifications and global variable uses that are inconsistent with specified interfaces (Section 7);

· Problematic control flow such as likely infinite loops (Section 8.3.1), fall through cases or incomplete switches (Section 8.3.2), and suspicious statements (Section 8.4);

· Buffer overflow vulnerabilities (Section 9);

· Dangerous macro implementations or invocations (Section 11); and

· Violations of customized naming conventions. (Section 12).

요새 컴파일러들은 좋아져서 lint가 해주는 많은 일들을 옵션에 따라
warning을 내주고 있는 것 같습니다.

저의 경우는 embedded 환경에서는 컴파일러가 그리 똑똑하지 않는
경우가 많을 것 같아 lint를 사용하려고 한 것입니다.

더 자세한 것은 splint 매뉴얼의 예제들을 살펴보면 splint가 어떻게
"영리하게" 발생할 수 있는 버그들에 대해 경고하고 있는지 알려줍니다.

saxboy의 이미지

Quote:
뭔가 매우 유용한 듯한 느낌이 팍 하고 오는데. lint에 대해서 누가 설명종 해주실 분 계신가요?

gcc -Wall 의 하드코어버전 이라고 생각하시면 될 것 같은데요.

약간 더 부연해보자면 런타임에서나 찾을 수 있을 듯한 버그들을 가능하면 컴파일타임에 찾아보자는 노력의 일환입니다. static analysis 로 구글링해보시면 좋은 정보를 많이 찾으실 수 있을듯합니다.