From 60390ea40cbc275067689e912ec9b19f484053bf Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 11 Oct 2023 17:03:39 +0200 Subject: [PATCH] [pragma] unify compiler diagnostics --- channels/client/tables.h | 11 ++- channels/tsmf/client/gstreamer/tsmf_X11.c | 8 +-- .../tsmf/client/gstreamer/tsmf_gstreamer.c | 8 +-- client/X11/xf_window.h | 11 ++- client/common/file.c | 10 +-- libfreerdp/codec/test/TestFreeRDPCodecClear.c | 11 ++- libfreerdp/common/test/TestCommonAssistance.c | 11 ++- rdtk/librdtk/rdtk_resources.h | 1 + winpr/include/config/wtypes.h.in | 12 ++-- winpr/include/winpr/crt.h | 11 ++- winpr/include/winpr/error.h | 11 ++- winpr/include/winpr/interlocked.h | 11 ++- winpr/include/winpr/platform.h | 53 +++++++++++--- winpr/include/winpr/smartcard.h | 11 ++- winpr/include/winpr/spec.h | 8 +-- winpr/include/winpr/sspi.h | 21 ++---- winpr/include/winpr/synch.h | 11 ++- winpr/include/winpr/winsock.h | 11 ++- winpr/libwinpr/clipboard/synthetic_file.c | 11 ++- winpr/libwinpr/interlocked/interlocked.c | 71 ++++++------------- winpr/libwinpr/sspi/sspi.c | 21 ++---- winpr/libwinpr/sspi/sspi_export.c | 12 ++-- winpr/libwinpr/synch/sleep.c | 11 ++- winpr/libwinpr/utils/wlog/Layout.c | 6 ++ 24 files changed, 153 insertions(+), 210 deletions(-) diff --git a/channels/client/tables.h b/channels/client/tables.h index f87ddb226..e67beb546 100644 --- a/channels/client/tables.h +++ b/channels/client/tables.h @@ -17,13 +17,12 @@ * limitations under the License. */ +#include #include /* The 'entry' function pointers have variable arguments. */ -#if defined(__GNUC__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstrict-prototypes" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_STRICT_PROTOTYPES typedef struct { @@ -52,6 +51,4 @@ typedef struct const STATIC_SUBSYSTEM_ENTRY* table; } STATIC_ADDIN_TABLE; -#if defined(__GNUC__) -#pragma GCC diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP diff --git a/channels/tsmf/client/gstreamer/tsmf_X11.c b/channels/tsmf/client/gstreamer/tsmf_X11.c index ae383df92..e166a63fa 100644 --- a/channels/tsmf/client/gstreamer/tsmf_X11.c +++ b/channels/tsmf/client/gstreamer/tsmf_X11.c @@ -32,15 +32,9 @@ #include #include #include +#include -#if __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wparentheses-equality" -#endif /* __clang__ */ #include -#if __clang__ -#pragma clang diagnostic pop -#endif /* __clang__ */ #if GST_VERSION_MAJOR > 0 #include diff --git a/channels/tsmf/client/gstreamer/tsmf_gstreamer.c b/channels/tsmf/client/gstreamer/tsmf_gstreamer.c index b59231260..90878765b 100644 --- a/channels/tsmf/client/gstreamer/tsmf_gstreamer.c +++ b/channels/tsmf/client/gstreamer/tsmf_gstreamer.c @@ -30,15 +30,9 @@ #include #include +#include -#if __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wparentheses-equality" -#endif /* __clang__ */ #include -#if __clang__ -#pragma clang diagnostic pop -#endif /* __clang__ */ #include #include diff --git a/client/X11/xf_window.h b/client/X11/xf_window.h index ca3837789..9f3028029 100644 --- a/client/X11/xf_window.h +++ b/client/X11/xf_window.h @@ -22,6 +22,7 @@ #include +#include #include #include @@ -35,10 +36,8 @@ typedef struct xf_window xfWindow; #include "xfreerdp.h" // Extended ICCM flags http://standards.freedesktop.org/wm-spec/wm-spec-latest.html -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO #define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0 #define _NET_WM_MOVERESIZE_SIZE_TOP 1 @@ -57,9 +56,7 @@ typedef struct xf_window xfWindow; #define _NET_WM_STATE_ADD 1 /* add/set property */ #define _NET_WM_STATE_TOGGLE 2 /* toggle property */ -#if defined(__clang__) -#pragma clang diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP enum xf_localmove_state { diff --git a/client/common/file.c b/client/common/file.c index 63c3d8517..dbe3f84ff 100644 --- a/client/common/file.c +++ b/client/common/file.c @@ -1402,12 +1402,9 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u return (status == 0) ? TRUE : FALSE; } -#if __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif +WINPR_ATTR_FORMAT_ARG(3, 4) static SSIZE_T freerdp_client_write_setting_to_buffer(char** buffer, size_t* bufferSize, - const char* fmt, ...) + WINPR_FORMAT_ARG const char* fmt, ...) { va_list ap; SSIZE_T len; @@ -1448,9 +1445,6 @@ static SSIZE_T freerdp_client_write_setting_to_buffer(char** buffer, size_t* buf return len; } -#if __GNUC__ -#pragma GCC diagnostic pop -#endif size_t freerdp_client_write_rdp_file_buffer(const rdpFile* file, char* buffer, size_t size) { diff --git a/libfreerdp/codec/test/TestFreeRDPCodecClear.c b/libfreerdp/codec/test/TestFreeRDPCodecClear.c index 2d31c7729..4317690be 100644 --- a/libfreerdp/codec/test/TestFreeRDPCodecClear.c +++ b/libfreerdp/codec/test/TestFreeRDPCodecClear.c @@ -1,18 +1,15 @@ #include #include +#include #include -#if __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-const-variable" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_UNUSED_CONST_VAR /* [MS-RDPEGFX] 4.1.1.1 Example 1 */ static const BYTE PREPARE_CLEAR_EXAMPLE_1[] = "\x03\xc3\x11\x00"; static const BYTE TEST_CLEAR_EXAMPLE_1[] = "\x03\xc3\x11\x00"; -#if __GNUC__ -#pragma GCC diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP /* [MS-RDPEGFX] 4.1.1.1 Example 2 */ static const BYTE TEST_CLEAR_EXAMPLE_2[] = diff --git a/libfreerdp/common/test/TestCommonAssistance.c b/libfreerdp/common/test/TestCommonAssistance.c index befe91305..6c5c78207 100644 --- a/libfreerdp/common/test/TestCommonAssistance.c +++ b/libfreerdp/common/test/TestCommonAssistance.c @@ -2,6 +2,7 @@ #include #include #include +#include #include @@ -21,16 +22,12 @@ static const char TEST_MSRC_INCIDENT_FILE_TYPE1[] = "L=\"0\" />" ""; -#if __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-const-variable" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_UNUSED_CONST_VAR static const BYTE TEST_MSRC_INCIDENT_EXPERT_BLOB_TYPE1[32] = "\x3C\x9C\xAE\x0B\xCE\x7A\xB1\x5C\x8A\xAC\x01\xD6\x76\x04\x5E\xDF" "\x3F\xFA\xF0\x92\xE2\xDE\x36\x8A\x20\x17\xE6\x8A\x0D\xED\x7C\x90"; -#if __GNUC__ -#pragma GCC diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP static const char TEST_MSRC_INCIDENT_PASSWORD_TYPE2[] = "48BJQ853X3B4"; diff --git a/rdtk/librdtk/rdtk_resources.h b/rdtk/librdtk/rdtk_resources.h index 10803605e..1716f00b1 100644 --- a/rdtk/librdtk/rdtk_resources.h +++ b/rdtk/librdtk/rdtk_resources.h @@ -20,6 +20,7 @@ #define RDTK_RESOURCES_PRIVATE_H #include +#include #include #include "rdtk_engine.h" diff --git a/winpr/include/config/wtypes.h.in b/winpr/include/config/wtypes.h.in index 1f0b41201..14869d81c 100644 --- a/winpr/include/config/wtypes.h.in +++ b/winpr/include/config/wtypes.h.in @@ -20,6 +20,8 @@ #ifndef WINPR_WTYPES_H #define WINPR_WTYPES_H +#include + // C99 related macros #if defined(__STDC__) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) #define WINPR_RESTRICT restrict @@ -101,10 +103,8 @@ typedef LONG_PTR SSIZE_T; #define VOID void #endif -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO #if !defined(_WIN32) && !defined(__MINGW32__) @@ -601,8 +601,6 @@ typedef const BYTE* LPCBYTE; #define _ftelli64(fp) ftello(fp) #endif -#if defined(__clang__) -#pragma clang diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP #endif /* WINPR_WTYPES_H */ diff --git a/winpr/include/winpr/crt.h b/winpr/include/winpr/crt.h index 6937f9ff1..6c155ee4f 100644 --- a/winpr/include/winpr/crt.h +++ b/winpr/include/winpr/crt.h @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -135,19 +136,15 @@ extern "C" /* Data Alignment */ -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO #ifndef _ERRNO_T_DEFINED #define _ERRNO_T_DEFINED typedef int errno_t; #endif /* _ERRNO_T_DEFINED */ -#if defined(__clang__) -#pragma clang diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP #ifndef _WIN32 diff --git a/winpr/include/winpr/error.h b/winpr/include/winpr/error.h index 1b314b7a1..5c1676a42 100644 --- a/winpr/include/winpr/error.h +++ b/winpr/include/winpr/error.h @@ -20,6 +20,7 @@ #ifndef WINPR_ERROR_H #define WINPR_ERROR_H +#include #include #include @@ -143,10 +144,8 @@ #define HRESULT_FROM_NT(x) (((x) | FACILITY_NT_BIT)) -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO #ifdef __cplusplus #define ERROR_CAST(t, val) static_cast(val) @@ -161,9 +160,7 @@ static INLINE HRESULT HRESULT_FROM_WIN32(unsigned long x) return ERROR_CAST(HRESULT, (((x)&0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000)); } -#if defined(__clang__) -#pragma clang diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP #define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1) diff --git a/winpr/include/winpr/interlocked.h b/winpr/include/winpr/interlocked.h index f6b959362..a0f952116 100644 --- a/winpr/include/winpr/interlocked.h +++ b/winpr/include/winpr/interlocked.h @@ -21,6 +21,7 @@ #define WINPR_INTERLOCKED_H #include +#include #include #include #include @@ -78,18 +79,14 @@ extern "C" #else /* _WIN64 */ -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" -#endif + WINPR_PRAGMA_DIAG_PUSH + WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO #define WINPR_SLIST_ENTRY WINPR_SINGLE_LIST_ENTRY #define _WINPR_SLIST_ENTRY _WINPR_SINGLE_LIST_ENTRY #define WINPR_PSLIST_ENTRY WINPR_PSINGLE_LIST_ENTRY -#if defined(__clang__) -#pragma clang diagnostic pop -#endif + WINPR_PRAGMA_DIAG_POP #endif /* _WIN64 */ diff --git a/winpr/include/winpr/platform.h b/winpr/include/winpr/platform.h index 4dcaff0a9..92f19c3aa 100644 --- a/winpr/include/winpr/platform.h +++ b/winpr/include/winpr/platform.h @@ -22,13 +22,52 @@ #include -#include - -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" +#if __clang__ +#define WINPR_PRAGMA_DIAG_PUSH _Pragma("clang diagnostic push") +#define WINPR_PRAGMA_DIAG_IGNORED_MISSING_PROTOTYPES \ + _Pragma("clang diagnostic ignored \"-Wmissing-prototypes\"") +#define WINPR_PRAGMA_DIAG_IGNORED_STRICT_PROTOTYPES \ + _Pragma("clang diagnostic ignored \"-Wstrict-prototypes\"") +#define WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO \ + _Pragma("clang diagnostic ignored \"-Wreserved-id-macro\"") +#define WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST \ + _Pragma("clang diagnostic ignored \"-Watomic-implicit-seq-cst\"") +#define WINPR_PRAGMA_DIAG_IGNORED_UNUSED_CONST_VAR \ + _Pragma("clang diagnostic ignored \"-Wunused-const-variable\"") +#define WINPR_PRAGMA_DIAG_IGNORED_FORMAT_SECURITY \ + _Pragma("clang diagnostic ignored \"-Wformat-security\"") +#define WINPR_PRAGMA_DIAG_POP _Pragma("clang diagnostic pop") +#elif __GNUC__ +#define WINPR_PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push") +#define WINPR_PRAGMA_DIAG_IGNORED_MISSING_PROTOTYPES \ + _Pragma("GCC diagnostic ignored \"-Wmissing-prototypes\"") +#define WINPR_PRAGMA_DIAG_IGNORED_STRICT_PROTOTYPES \ + _Pragma("GCC diagnostic ignored \"-Wstrict-prototypes\"") +#define WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO /* not supported _Pragma("GCC diagnostic \ + ignored \"-Wreserved-id-macro\"") */ +#define WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST /* not supported _Pragma("GCC diagnostic \ + ignored \ + \"-Watomic-implicit-seq-cst\"") */ +#define WINPR_PRAGMA_DIAG_IGNORED_UNUSED_CONST_VAR \ + _Pragma("GCC diagnostic ignored \"-Wunused-const-variable\"") +#define WINPR_PRAGMA_DIAG_IGNORED_FORMAT_SECURITY \ + _Pragma("GCC diagnostic ignored \"-Wformat-security\"") +#define WINPR_PRAGMA_DIAG_POP _Pragma("GCC diagnostic pop") +#else +#define WINPR_PRAGMA_DIAG_PUSH +#define WINPR_PRAGMA_DIAG_IGNORED_MISSING_PROTOTYPES +#define WINPR_PRAGMA_DIAG_IGNORED_STRICT_PROTOTYPES +#define WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO +#define WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST +#define WINPR_PRAGMA_DIAG_IGNORED_UNUSED_CONST_VAR +#define WINPR_PRAGMA_DIAG_IGNORED_FORMAT_SECURITY +#define WINPR_PRAGMA_DIAG_POP #endif +WINPR_PRAGMA_DIAG_PUSH + +WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO + /* * Processor Architectures: * http://sourceforge.net/p/predef/wiki/Architectures/ @@ -292,8 +331,6 @@ #endif /* __BYTE_ORDER */ -#if defined(__clang__) -#pragma clang diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP #endif /* WINPR_PLATFORM_H */ diff --git a/winpr/include/winpr/smartcard.h b/winpr/include/winpr/smartcard.h index 1fd8d07fd..278786cf2 100644 --- a/winpr/include/winpr/smartcard.h +++ b/winpr/include/winpr/smartcard.h @@ -22,24 +22,21 @@ #ifndef WINPR_SMARTCARD_H #define WINPR_SMARTCARD_H +#include #include #include #include #include -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO #ifndef _WINSCARD_H_ #define _WINSCARD_H_ /* do not include winscard.h */ #endif -#if defined(__clang__) -#pragma clang diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP #ifndef SCARD_S_SUCCESS diff --git a/winpr/include/winpr/spec.h b/winpr/include/winpr/spec.h index 9d28519b5..3ebf1b192 100644 --- a/winpr/include/winpr/spec.h +++ b/winpr/include/winpr/spec.h @@ -31,10 +31,8 @@ #else -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO #define DUMMYUNIONNAME u #define DUMMYUNIONNAME1 u1 @@ -960,7 +958,7 @@ extern "C++" ((type*)((PCHAR)(address) - (ULONG_PTR)(&((type*)0)->field))) #if defined(__clang__) -#pragma clang diagnostic pop +WINPR_PRAGMA_DIAG_POP #endif #endif diff --git a/winpr/include/winpr/sspi.h b/winpr/include/winpr/sspi.h index f371fbe04..e565b4046 100644 --- a/winpr/include/winpr/sspi.h +++ b/winpr/include/winpr/sspi.h @@ -20,6 +20,7 @@ #ifndef WINPR_SSPI_H #define WINPR_SSPI_H +#include #include #include #include @@ -54,19 +55,15 @@ typedef struct typedef SECURITY_INTEGER TimeStamp; typedef SECURITY_INTEGER* PTimeStamp; -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO #ifndef __SECSTATUS_DEFINED__ typedef LONG SECURITY_STATUS; #define __SECSTATUS_DEFINED__ #endif /* __SECSTATUS_DEFINED__ */ -#if defined(__clang__) -#pragma clang diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP typedef struct { @@ -669,10 +666,8 @@ typedef struct #if !defined(_WIN32) || defined(_UWP) || defined(__MINGW32__) -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO #ifndef _AUTH_IDENTITY_DEFINED #define _AUTH_IDENTITY_DEFINED @@ -812,9 +807,7 @@ typedef union _SEC_WINNT_AUTH_IDENTITY_INFO #endif /* _AUTH_IDENTITY_INFO_DEFINED */ -#if defined(__clang__) -#pragma clang diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP #if !defined(__MINGW32__) typedef struct diff --git a/winpr/include/winpr/synch.h b/winpr/include/winpr/synch.h index c9ad3c1b4..b310a3b85 100644 --- a/winpr/include/winpr/synch.h +++ b/winpr/include/winpr/synch.h @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -299,17 +300,13 @@ extern "C" InitializeCriticalSectionAndSpinCount(lpCriticalSection, dwSpinCount) #endif -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" -#endif + WINPR_PRAGMA_DIAG_PUSH + WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO #ifndef _RTL_RUN_ONCE_DEF #define _RTL_RUN_ONCE_DEF -#if defined(__clang__) -#pragma clang diagnostic pop -#endif + WINPR_PRAGMA_DIAG_POP #define RTL_RUN_ONCE_INIT \ { \ diff --git a/winpr/include/winpr/winsock.h b/winpr/include/winpr/winsock.h index f699d59eb..73dc9ae8c 100644 --- a/winpr/include/winpr/winsock.h +++ b/winpr/include/winpr/winsock.h @@ -20,6 +20,7 @@ #ifndef WINPR_WINSOCK_H #define WINPR_WINSOCK_H +#include #include #include #include @@ -185,10 +186,8 @@ typedef union sockaddr_gen struct sockaddr_in6_old AddressIn6; } sockaddr_gen; -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO #define _IFF_UP 0x00000001 #define _IFF_BROADCAST 0x00000002 @@ -196,9 +195,7 @@ typedef union sockaddr_gen #define _IFF_POINTTOPOINT 0x00000008 #define _IFF_MULTICAST 0x00000010 -#if defined(__clang__) -#pragma clang diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP typedef struct { diff --git a/winpr/libwinpr/clipboard/synthetic_file.c b/winpr/libwinpr/clipboard/synthetic_file.c index 7350a3a29..6ca1915cd 100644 --- a/winpr/libwinpr/clipboard/synthetic_file.c +++ b/winpr/libwinpr/clipboard/synthetic_file.c @@ -18,17 +18,14 @@ */ #include +#include -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO #define _FILE_OFFSET_BITS 64 -#if defined(__clang__) -#pragma clang diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP #include diff --git a/winpr/libwinpr/interlocked/interlocked.c b/winpr/libwinpr/interlocked/interlocked.c index 0fad4e254..7d1ca0f79 100644 --- a/winpr/libwinpr/interlocked/interlocked.c +++ b/winpr/libwinpr/interlocked/interlocked.c @@ -19,6 +19,7 @@ #include +#include #include #include @@ -221,14 +222,10 @@ USHORT QueryDepthSList(WINPR_PSLIST_HEADER ListHead) LONG InterlockedIncrement(LONG volatile* Addend) { #if defined(__GNUC__) || defined(__clang__) -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Watomic-implicit-seq-cst" -#endif + WINPR_PRAGMA_DIAG_PUSH + WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST return __sync_add_and_fetch(Addend, 1); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif + WINPR_PRAGMA_DIAG_POP #else return 0; #endif @@ -237,14 +234,10 @@ LONG InterlockedIncrement(LONG volatile* Addend) LONG InterlockedDecrement(LONG volatile* Addend) { #if defined(__GNUC__) || defined(__clang__) -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Watomic-implicit-seq-cst" -#endif + WINPR_PRAGMA_DIAG_PUSH + WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST return __sync_sub_and_fetch(Addend, 1); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif + WINPR_PRAGMA_DIAG_POP #else return 0; #endif @@ -253,14 +246,10 @@ LONG InterlockedDecrement(LONG volatile* Addend) LONG InterlockedExchange(LONG volatile* Target, LONG Value) { #if defined(__GNUC__) || defined(__clang__) -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Watomic-implicit-seq-cst" -#endif + WINPR_PRAGMA_DIAG_PUSH + WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST return __sync_val_compare_and_swap(Target, *Target, Value); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif + WINPR_PRAGMA_DIAG_POP #else return 0; #endif @@ -269,14 +258,10 @@ LONG InterlockedExchange(LONG volatile* Target, LONG Value) LONG InterlockedExchangeAdd(LONG volatile* Addend, LONG Value) { #if defined(__GNUC__) || defined(__clang__) -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Watomic-implicit-seq-cst" -#endif + WINPR_PRAGMA_DIAG_PUSH + WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST return __sync_fetch_and_add(Addend, Value); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif + WINPR_PRAGMA_DIAG_POP #else return 0; #endif @@ -285,14 +270,10 @@ LONG InterlockedExchangeAdd(LONG volatile* Addend, LONG Value) LONG InterlockedCompareExchange(LONG volatile* Destination, LONG Exchange, LONG Comperand) { #if defined(__GNUC__) || defined(__clang__) -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Watomic-implicit-seq-cst" -#endif + WINPR_PRAGMA_DIAG_PUSH + WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST return __sync_val_compare_and_swap(Destination, Comperand, Exchange); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif + WINPR_PRAGMA_DIAG_POP #else return 0; #endif @@ -302,14 +283,10 @@ PVOID InterlockedCompareExchangePointer(PVOID volatile* Destination, PVOID Excha PVOID Comperand) { #if defined(__GNUC__) || defined(__clang__) -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Watomic-implicit-seq-cst" -#endif + WINPR_PRAGMA_DIAG_PUSH + WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST return __sync_val_compare_and_swap(Destination, Comperand, Exchange); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif + WINPR_PRAGMA_DIAG_POP #else return 0; #endif @@ -390,14 +367,10 @@ LONGLONG InterlockedCompareExchange64(LONGLONG volatile* Destination, LONGLONG E LONGLONG Comperand) { #if defined(__GNUC__) || defined(__clang__) -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Watomic-implicit-seq-cst" -#endif + WINPR_PRAGMA_DIAG_PUSH + WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST return __sync_val_compare_and_swap(Destination, Comperand, Exchange); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif + WINPR_PRAGMA_DIAG_POP #else return 0; #endif diff --git a/winpr/libwinpr/sspi/sspi.c b/winpr/libwinpr/sspi/sspi.c index fdc0abe7a..f4cdeafad 100644 --- a/winpr/libwinpr/sspi/sspi.c +++ b/winpr/libwinpr/sspi/sspi.c @@ -17,18 +17,15 @@ * limitations under the License. */ +#include #include -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO #define _NO_KSECDD_IMPORT_ 1 -#if defined(__clang__) -#pragma clang diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP #include @@ -40,10 +37,8 @@ #include "sspi.h" -#if defined(__GNUC__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmissing-prototypes" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_MISSING_PROTOTYPES static wLog* g_Log = NULL; @@ -1112,9 +1107,7 @@ SECURITY_STATUS SEC_ENTRY sspi_VerifySignature(PCtxtHandle phContext, PSecBuffer return status; } -#if defined(__GNUC__) -#pragma GCC diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP void sspi_FreeAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity) { diff --git a/winpr/libwinpr/sspi/sspi_export.c b/winpr/libwinpr/sspi/sspi_export.c index d0ff7e3c9..32258cf5e 100644 --- a/winpr/libwinpr/sspi/sspi_export.c +++ b/winpr/libwinpr/sspi/sspi_export.c @@ -17,6 +17,8 @@ * limitations under the License. */ +#include +#include #include #ifdef _WIN32 @@ -34,10 +36,8 @@ typedef unsigned long ULONG; #endif typedef LONG SECURITY_STATUS; -#if defined(__GNUC__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmissing-prototypes" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_MISSING_PROTOTYPES #ifdef SSPI_DLL @@ -342,6 +342,4 @@ SSPI_EXPORT SECURITY_STATUS SEC_ENTRY VerifySignature(void* phContext, void* pMe #endif /* SSPI_DLL */ -#if defined(__GNUC__) -#pragma GCC diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP diff --git a/winpr/libwinpr/synch/sleep.c b/winpr/libwinpr/synch/sleep.c index 14950884a..3c19a6598 100644 --- a/winpr/libwinpr/synch/sleep.c +++ b/winpr/libwinpr/synch/sleep.c @@ -19,6 +19,7 @@ #include +#include #include #include @@ -34,10 +35,8 @@ #include -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreserved-id-macro" -#endif +WINPR_PRAGMA_DIAG_PUSH +WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO #ifdef WINPR_HAVE_UNISTD_H #ifndef _XOPEN_SOURCE @@ -46,9 +45,7 @@ #include #endif -#if defined(__clang__) -#pragma clang diagnostic pop -#endif +WINPR_PRAGMA_DIAG_POP VOID Sleep(DWORD dwMilliseconds) { diff --git a/winpr/libwinpr/utils/wlog/Layout.c b/winpr/libwinpr/utils/wlog/Layout.c index 5f091a89d..393315e9f 100644 --- a/winpr/libwinpr/utils/wlog/Layout.c +++ b/winpr/libwinpr/utils/wlog/Layout.c @@ -289,8 +289,14 @@ BOOL WLog_Layout_GetMessagePrefix(wLog* log, wLogLayout* layout, wLogMessage* me if (!replace_format_string(layout->FormatString, &recurse, format, ARRAYSIZE(format))) return FALSE; + + WINPR_PRAGMA_DIAG_PUSH + WINPR_PRAGMA_DIAG_IGNORED_FORMAT_SECURITY + WLog_PrintMessagePrefix(log, message, format); + WINPR_PRAGMA_DIAG_POP + return TRUE; }