AIX build failure in protocols.c
I'm trying to build GnuTLS 3.5.16 on AIX 6.1 using the system compiler IBM XL C/C++ 13.1.3. It fails here:
CC protocols.lo
"protocols.c", line 351.1: 1506-191 (E) The character # is not a valid C source character.
"protocols.c", line 351.9: 1506-277 (S) Syntax error: possible missing ';' or ','?
"protocols.c", line 353.1: 1506-191 (E) The character # is not a valid C source character.
"protocols.c", line 354.25: 1506-277 (S) Syntax error: possible missing ';' or ','?
"protocols.c", line 353.2: 1506-045 (S) Undeclared identifier endif.
The error messages are not very helpful but it's objecting to this:
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;
}
)
... because, as the GNU CPP manual puts it:
Occasionally it is convenient to use preprocessor directives within the arguments of a macro. The C and C++ standards declare that behavior in these cases is undefined.
This fixes it for me, though you may not like the duplication:
#ifdef ENABLE_SSL3
GNUTLS_VERSION_LOOP(
if(p->id == version) {
ret = p->supported && p->transport == session->internals.transport;
break;
}
)
#else
GNUTLS_VERSION_LOOP(
if(p->id == version) {
if (p->obsolete != 0) return 0;
ret = p->supported && p->transport == session->internals.transport;
break;
}
)
#endif