From b2e1bd89973170d07cd4785659a3d351b73495cc Mon Sep 17 00:00:00 2001 From: Taiki Akita <8894805+TaikiAkita@users.noreply.github.com> Date: Mon, 2 Oct 2023 19:45:05 +0800 Subject: [PATCH] Avoid using unknown #pragma for non-MSVC compiler in public header files. (#3890) Co-authored-by: Ji WenCong --- src/inc/msquic.h | 2 +- src/inc/msquic.hpp | 7 +++++++ src/inc/msquic_posix.h | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/inc/msquic.h b/src/inc/msquic.h index 8a12585efd..05a8d488a1 100644 --- a/src/inc/msquic.h +++ b/src/inc/msquic.h @@ -23,10 +23,10 @@ Supported Platforms: #ifdef _WIN32 #pragma once -#endif #pragma warning(disable:4201) // nonstandard extension used: nameless struct/union #pragma warning(disable:4214) // nonstandard extension used: bit field types other than int +#endif #ifdef _KERNEL_MODE #include "msquic_winkernel.h" diff --git a/src/inc/msquic.hpp b/src/inc/msquic.hpp index a0b22586d3..6fc3a977f3 100644 --- a/src/inc/msquic.hpp +++ b/src/inc/msquic.hpp @@ -18,7 +18,12 @@ Supported Platforms: --*/ +#ifdef _WIN32 #pragma once +#endif + +#ifndef _MSQUIC_HPP_ +#define _MSQUIC_HPP_ #include "msquic.h" #include "msquicp.h" @@ -1552,3 +1557,5 @@ struct QuicBufferScope { operator QUIC_BUFFER* () noexcept { return Buffer; } ~QuicBufferScope() noexcept { if (Buffer) { delete[](uint8_t*) Buffer; } } }; + +#endif // _WIN32 diff --git a/src/inc/msquic_posix.h b/src/inc/msquic_posix.h index d70641b1b0..612d67afb4 100644 --- a/src/inc/msquic_posix.h +++ b/src/inc/msquic_posix.h @@ -14,7 +14,9 @@ --*/ +#ifdef _WIN32 #pragma once +#endif #ifndef _MSQUIC_POSIX_ #define _MSQUIC_POSIX_