From 2ca98d6d6763d3e1266345eeef9bc8d0b12b5b32 Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Wed, 3 Jan 2024 20:27:25 -0800 Subject: [PATCH] misc.c pre-merge sync --- src/misc.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/misc.c b/src/misc.c index 2ca2efa8a..4cc39efbf 100644 --- a/src/misc.c +++ b/src/misc.c @@ -48,17 +48,43 @@ #else #define STATIC static #endif +/* + #define MISC_WARNING "misc.c does not need to be compiled when using inline (NO_INLINE not defined))" + #define MISC_STRINGIFY(x) #x + #define MISC_TOSTRING(x) MISC_STRINGIFY(x) + #ifdef __STDC_VERSION__ + #if __STDC_VERSION__ >= 199901L + #define PRAGMA_SUPPORTED 1 + #endif + #endif + #if (defined(__GNUC__) || defined(__clang__)) && defined(PRAGMA_SUPPORTED) + _Pragma(MISC_TOSTRING(message(MISC_WARNING))) + #elif defined(_MSC_VER) + #pragma message("warning: " MISC_WARNING) + #else + #warning MISC_WARNING + #endif + */ /* Check for if compiling misc.c when not needed. */ #if !defined(WOLFSSH_MISC_INCLUDED) && !defined(NO_INLINE) && \ !defined(WOLFSSH_IGNORE_FILE_WARN) #define MISC_WARNING "misc.c does not need to be compiled when using inline (NO_INLINE not defined))" + #define MISC_STRINGIFY(x) #x + #define MISC_TOSTRING(x) MISC_STRINGIFY(x) + #ifdef __STDC_VERSION__ + #if __STDC_VERSION__ >= 199901L + #define PRAGMA_SUPPORTED 1 + #endif + #endif - #ifndef _MSC_VER - #warning MISC_WARNING - #else + #if (defined(__GNUC__) || defined(__clang__)) && defined(PRAGMA_SUPPORTED) + _Pragma(MISC_TOSTRING(message(MISC_WARNING))) + #elif defined(_MSC_VER) #pragma message("warning: " MISC_WARNING) + #else + #warning MISC_WARNING #endif #else /* !WOLFSSL_MISC_INCLUDED && !NO_INLINE && !WOLFSSH_IGNORE_FILE_WARN */