diff --git a/library/entropy_poll.c b/library/entropy_poll.c index 8fb7f9eeed..e5cf97034b 100644 --- a/library/entropy_poll.c +++ b/library/entropy_poll.c @@ -52,6 +52,9 @@ #if _WIN32_WINNT >= 0x0501 /* _WIN32_WINNT_WINXP */ #include #if defined(_MSC_VER) && _MSC_VER <= 1600 +#define MBEDTLS_POP_TARGET_PRAGMA +#endif +#if defined(MBEDTLS_POP_TARGET_PRAGMA) /* Visual Studio 2010 and earlier issue a warning when both and * are included, as they redefine a number of _MAX constants. * These constants are guaranteed to be the same, though, so we suppress the @@ -61,7 +64,7 @@ #pragma warning(disable : 4005) #endif #include -#if defined(_MSC_VER) && _MSC_VER <= 1600 +#if defined(MBEDTLS_POP_TARGET_PRAGMA) #pragma warning(pop) #endif @@ -253,4 +256,8 @@ int mbedtls_nv_seed_poll(void *data, } #endif /* MBEDTLS_ENTROPY_NV_SEED */ +#if defined(MBEDTLS_POP_TARGET_PRAGMA) +#undef MBEDTLS_POP_TARGET_PRAGMA +#endif + #endif /* MBEDTLS_ENTROPY_C */ diff --git a/library/x509_crt.c b/library/x509_crt.c index d4a6dbb777..4beda54cbd 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -62,6 +62,9 @@ #define WIN32_LEAN_AND_MEAN #include #if defined(_MSC_VER) && _MSC_VER <= 1600 +#define MBEDTLS_POP_TARGET_PRAGMA +#endif +#if defined(MBEDTLS_POP_TARGET_PRAGMA) /* Visual Studio 2010 and earlier issue a warning when both and * are included, as they redefine a number of _MAX constants. * These constants are guaranteed to be the same, though, so we suppress the @@ -71,7 +74,7 @@ #pragma warning(disable : 4005) #endif #include -#if defined(_MSC_VER) && _MSC_VER <= 1600 +#if defined(MBEDTLS_POP_TARGET_PRAGMA) #pragma warning(pop) #endif #else @@ -3333,4 +3336,8 @@ void mbedtls_x509_crt_restart_free(mbedtls_x509_crt_restart_ctx *ctx) } #endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */ +#if defined(MBEDTLS_POP_TARGET_PRAGMA) +#undef MBEDTLS_POP_TARGET_PRAGMA +#endif + #endif /* MBEDTLS_X509_CRT_PARSE_C */