From e7856bfc6d3b27f616f996059d98ff73909abec5 Mon Sep 17 00:00:00 2001 From: Andres Amaya Garcia Date: Tue, 15 Jan 2019 20:08:12 +0000 Subject: [PATCH] Suppress visual studio preprocessor warnings on query_config.c --- programs/ssl/query_config.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/programs/ssl/query_config.c b/programs/ssl/query_config.c index b2b1f16874..afbb09cc2b 100644 --- a/programs/ssl/query_config.c +++ b/programs/ssl/query_config.c @@ -115,6 +115,19 @@ #define MACRO_NAME_TO_STR(macro) \ mbedtls_printf( "%s", strlen( #macro "" ) > 0 ? #macro "\n" : "" ) +#if defined(_MSC_VER) +/* + * Visual Studio throws the warning 4003 because many Mbed TLS feature macros + * are defined empty. This means that from the preprocessor's point of view + * the macro MBEDTLS_EXPANSION_TO_STR is being invoked without arguments as + * some macros expand to nothing. We suppress that specific warning to get a + * clean build and to ensure that tests treating warnings as errors do not + * fail. + */ +#pragma warning(push) +#pragma warning(disable:4003) +#endif /* _MSC_VER */ + int query_config( const char *config ) { #if defined(MBEDTLS_HAVE_ASM) @@ -2488,3 +2501,7 @@ int query_config( const char *config ) /* If the symbol is not found, return an error */ return( 1 ); } + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */