나는 새 프로젝트를 시작했으며/Wall 옵션을 활성화 한 상태로 완전히 빌드되었는지 확인하기로 결정했습니다. 유일한 문제는 경고없이 컴파일 (부스트 등) 모든 제 3 자 라이브러리없는, 그래서 공유 헤더이 일에 의지 한이 충분히 잘 작동플러그 - 마를 사용하여 모든 경고를 비활성화하는 방법이 있습니까?
#pragma warning(push)
#pragma warning(disable:4820)
#pragma warning(disable:4619)
#pragma warning(disable:4668)
#pragma warning(disable:4625)
#pragma warning(disable:4626)
#pragma warning(disable:4571)
#pragma warning(disable:4347)
#pragma warning(disable:4640)
#pragma warning(disable:4365)
#pragma warning(disable:4710)
#pragma warning(disable:4820)
#pragma warning(disable:4350)
#pragma warning(disable:4686)
#pragma warning(disable:4711)
#pragma warning(disable:4548)
#include <boost/array.hpp>
#include <boost/assert.hpp>
#include <boost/assign.hpp>
#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
#include <boost/function.hpp>
#include <boost/integer.hpp>
#include <boost/optional.hpp>
#include <boost/regex.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/utility.hpp>
#include <boost/variant.hpp>
#pragma warning(pop)
하지만 때마다 나는 새로운 부스트 헤더를 추가 그들이 생성하는 경고를 목록에 추가해야합니다. 이 코드 스트레치에 대해 모든 경고를 해제하는 방법이 있습니까?
#pragma warning(push, 0)
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
// ...
#pragma warning(pop)
을하지만 모든 경고를 비활성화 할 수 없습니다 것을 알고 :
여기에서 나는 경고의 푸시/팝과 1 대 1 관계를 참조하십시오. N 개의 경고를 비활성화하면 N 번 팝해야합니다. 다시 말하지만, 오래된 스레드를 유감스럽게 생각합니다. – wheaties
해제하는 경고의 수는 부적합합니다. '푸시'의 수는 모두 '팝'의 수와 일치해야합니다. –
또한,'#pragma warning (pop)'을 사용하면 일부 경고 (4514가 예임)가 여전히 발행된다는 사실이 흥미 롭습니다. 아마도 이러한 경고 조건이 일부 컴파일 후 컨텍스트에서 감지 되었기 때문일 수 있습니다. – alecov