요즘에 빌드서버를 통해서 CI 작업을 만들고 있는데,
외부에서 가져온 라이브러리를 가져다 사용하면서 생기는 warning 들을 제거하고 있었습니다.

하나하나, #pragma warning push / pop / disable 을 이용해서 제거하고 있는데,
유독 C4505 warning 은 제거가 안되더라구요..

희안한게 push / pop 으로 하면 제거가 안되고, 그냥 #pragma warning disable 구문만 적었을때에는 disable 이 되는 것이었습니다...;

라이브러리에서 발생하는 warning 잡으려다가 제가 작업하는 project 전체에 영향을 받을까봐
(참고로 4505 warning은 안쓰는 함수가 있다는 warning)
최대한 해보려고 이렇게 저렇게 막아보고 있는데 정말 push / pop 으로는 안막히더라구요 =_=;;

disable / default 로도 해보고.. 계속 해봤는데 안되서 구글링을 시도했습니다.

http://support.microsoft.com/kb/947783 


Result

When setting #pragma warning(default:4505) to reset the warning, it would enable C4505 warning for the entire CPP file even though it was disabled previsously.

Cause

This is by design.  The C4505 warning applies to a region of code not to a specific function.  The warning is actually tested for at the end of the compilation unit so selectively disabling ths warning will not work. 

Back to the top

Resolution

By design, this C4505 warning cannot be selectively disabled.

증상은 "#pragma warning(default:4505) 로 warning 을 리셋하려고 할때, 이게 모든 CPP 파일..
심지어는 전에 disable 된 것들까지 모두 enable 시키는 것 같다." 고 합니다. 저도 같은 증상~!!

원인은.. "디자인 때문"
함수 호출에 대한 워닝이라서 컴파일 끝에 테스트 되고, 그로 인해서 selectively disabling 이 동작하지 않는다는 것.

명확하네요.

어쩔 수 없이 해당 프로젝트에서는 C4505를 disable 하는 수밖에...;  다른 방법이 떠오르지 않네요..;;;

+ Recent posts