[MSVC] lib/algorithms/protocols.c
The pre-processor in MSVC does not handle #if
statements inside a macro. Thus the code
in _gnutls_version_is_supported()
:
GNUTLS_VERSION_LOOP(
if(p->id == version) {
#ifndef ENABLE_SSL3
if (p->obsolete != 0) return 0;
#endif
ret = p->supported && p->transport == session->internals.transport;
break;
}
)
fails to compile.
The fix could be to use a local variable instead of this #ifndef ENABLE_SSL3
inside this macro.
Something like:
--- a/lib/algorithms/protocols.c 2017-09-04 11:07:50
+++ b/lib/algorithms/protocols.c 2017-09-04 11:13:15
@@ -346,11 +346,18 @@
{
int ret = 0;
+#ifdef ENABLE_SSL3
+ int obsoleted = 0;
+
+ #define IS_OBSOLETED(p) obsoleted
+#else
+ #define IS_OBSOLETED(p) p->obsolete != 0
+#endif
+
GNUTLS_VERSION_LOOP(
if(p->id == version) {
-#ifndef ENABLE_SSL3
- if (p->obsolete != 0) return 0;
-#endif
+ if (IS_OBSOLETED(p))
+ return 0;
ret = p->supported && p->transport == session->internals.transport;
break;
}