diff --git a/src/ssl.c b/src/ssl.c index de07fef82..af7a5bd1a 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -14458,13 +14458,9 @@ int wolfSSL_set_compression(WOLFSSL* ssl) } /* myBuffer may not initialized fully, but the sending length will be */ -#if defined(__GNUC__) && __GNUC__ > 5 - _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\""); -#endif + PRAGMA_GCC_IGNORE("GCC diagnostic ignored \"-Wmaybe-uninitialized\""); ret = wolfSSL_write(ssl, myBuffer, sending); -#if defined(__GNUC__) && __GNUC__ > 5 - _Pragma("GCC diagnostic pop"); -#endif + PRAGMA_GCC_POP; if (dynamic) XFREE(myBuffer, ssl->heap, DYNAMIC_TYPE_WRITEV); diff --git a/src/tls13.c b/src/tls13.c index 0c4180ecf..7a8cd42b7 100644 --- a/src/tls13.c +++ b/src/tls13.c @@ -437,15 +437,11 @@ static int DeriveKey(WOLFSSL* ssl, byte* output, int outputLen, hashOutSz = hashSz; /* myBuffer may not initialized fully, but the sending length will be */ -#if defined(__GNUC__) && __GNUC__ > 5 - _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\""); -#endif + PRAGMA_GCC_IGNORE("GCC diagnostic ignored \"-Wmaybe-uninitialized\""); return HKDF_Expand_Label(output, outputLen, secret, hashSz, protocol, protocolLen, label, labelLen, hash, hashOutSz, digestAlg); -#if defined(__GNUC__) && __GNUC__ > 5 - _Pragma("GCC diagnostic pop"); -#endif + PRAGMA_GCC_POP; } #ifndef NO_PSK diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index fd75cd3b2..7fce14e7e 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -1053,6 +1053,14 @@ decouple library dependencies with standard string, memory and so on. #define WC_MP_TO_RADIX #endif + #if defined(__GNUC__) && __GNUC__ > 5 + #define PRAGMA_GCC_IGNORE(str) _Pragma(str); + #define PRAGMA_GCC_POP _Pragma("GCC diagnostic pop"); + #else + #define PRAGMA_GCC_IGNORE(str) + #define PRAGMA_GCC_POP + #endif + #ifdef __cplusplus } /* extern "C" */ #endif