Fix query_config macro expansion for windows
diff --git a/scripts/data_files/query_config.fmt b/scripts/data_files/query_config.fmt
index 7ea4b5a..0e4659a 100644
--- a/scripts/data_files/query_config.fmt
+++ b/scripts/data_files/query_config.fmt
@@ -106,13 +106,14 @@
#include <string.h>
-/* Helper macros to convert a macro or its expansion into a string */
-#if defined(_MSC_VER)
-#define MACRO_EXPANSION_TO_STR(macro) strlen( #macro ) > 0 ? #macro "\n" : ""
-#else
+/*
+ * Helper macros to convert a macro or its expansion into a string
+ * WARNING: This does not work for expanding function-like macros. However,
+ * Mbed TLS does not currently have configuration options used in this fashion.
+ */
#define MACRO_EXPANSION_TO_STR(macro) MACRO_NAME_TO_STR(macro)
-#define MACRO_NAME_TO_STR(macro) strlen( #macro ) > 0 ? #macro "\n" : ""
-#endif /* _MSC_VER */
+#define MACRO_NAME_TO_STR(macro) \
+ mbedtls_printf( "%s", strlen( #macro "" ) > 0 ? #macro "\n" : "" )
int query_config( const char *config )
{
diff --git a/scripts/generate_query_config.pl b/scripts/generate_query_config.pl
index 492780d..747001a 100755
--- a/scripts/generate_query_config.pl
+++ b/scripts/generate_query_config.pl
@@ -39,7 +39,7 @@
$config_check .= "#if defined($name)\n";
$config_check .= " if( strcmp( \"$name\", config ) == 0 )\n";
$config_check .= " {\n";
- $config_check .= " mbedtls_printf( \"%s\", MACRO_EXPANSION_TO_STR( $name ) );\n";
+ $config_check .= " MACRO_EXPANSION_TO_STR( $name );\n";
$config_check .= " return( 0 );\n";
$config_check .= " }\n";
$config_check .= "#endif /* $name */\n";