system_header pragma

파일의 나머지 부분을 진단 보고서의 외부로 처리합니다.

구문

#pragma system_header

설명

현재 system_headerpragma 소스 파일의 나머지 부분에 대한 옵션으로 지정된 /external:Wn 수준에서 진단 표시하도록 컴파일러에 지시합니다. 외부 파일 및 외부 경고 수준을 컴파일러에 지정하는 방법에 대한 자세한 내용은 다음을 참조하세요 /external.

현재 system_headerpragma 소스 파일의 끝을 지나서 적용되지 않습니다. 즉, 이 파일이 포함된 파일에는 적용되지 않습니다. system_headerpragma 다른 파일이 컴파일러 외부로 지정되지 않은 경우에도 적용됩니다. 그러나 옵션 수준이 지정되지 않은 /external:Wn 경우 컴파일러는 진단을 실행하고 외부가 아닌 파일에 적용되는 것과 동일한 경고 수준을 사용할 수 있습니다. 경고 동작에 영향을 주는 다른 pragma 지시문은 .system_headerpragma 효과는 #pragma system_header 다음과 유사합니다 warning pragma.

// If n represents the warning level specified by /external:Wn,
// #pragma system_header is roughly equivalent to:
#pragma warning( push, n )

// . . .

// At the end of the file:
#pragma warning( pop )

Visual system_headerpragma Studio 2019 버전 16.10부터 사용할 수 있습니다.

예시

이 샘플 헤더는 파일의 내용을 외부로 표시하는 방법을 보여 줍니다.

// library.h
// Use /external:Wn to set the compiler diagnostics level for this file's contents

#pragma once
#ifndef _LIBRARY_H // include guard for 3rd party interop
#define _LIBRARY_H
#pragma system_header
// The compiler applies the /external:Wn diagnostic level from here to the end of this file.

// . . .

// You can still override the external diagnostic level for warnings locally:
#pragma warning( push )
#pragma warning( error : 4164 )

// . . .

#pragma warning(pop)

// . . .

#endif

참고 항목

/external
warning pragma
/Wn (컴파일러 경고 수준)
Pragma 지시문 및 __pragma_Pragma 키워드(keyword)