From 32169be68e41b71018f796385be70896f1c5a24f Mon Sep 17 00:00:00 2001 From: akallabeth Date: Wed, 16 Oct 2024 11:28:43 +0200 Subject: [PATCH] [winpr] add WINPR_PRAGMA_WARNING a compiler independent version of #warning --- winpr/include/winpr/platform.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/winpr/include/winpr/platform.h b/winpr/include/winpr/platform.h index 39319ac64..07b10046d 100644 --- a/winpr/include/winpr/platform.h +++ b/winpr/include/winpr/platform.h @@ -22,6 +22,15 @@ #include +#define WINPR_DO_PRAGMA(x) _Pragma(#x) +#if defined(__GNUC__) +#define WINPR_PRAGMA_WARNING(msg) WINPR_DO_PRAGMA(GCC warning #msg) +#elif defined(__clang__) +#define WINPR_PRAGMA_WARNING(msg) WINPR_DO_PRAGMA(GCC warning #msg) +#elif defined(_MSC_VER) +#define WINPR_PRAGMA_WARNING(msg) WINPR_DO_PRAGMA(message \x28 #msg \x29) +#endif + #if defined(__clang__) #define WINPR_PRAGMA_DIAG_PUSH _Pragma("clang diagnostic push") #define WINPR_PRAGMA_DIAG_IGNORED_OVERLENGTH_STRINGS \