-
Notifications
You must be signed in to change notification settings - Fork 835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More fixes for building x86 in Visual Studio for non-windows OS #8098
Conversation
|
socat Tests: FAILED: 146 216 309 310 326 386 399 402 459 460 467 468 478 492 528 530 |
194e26b
to
08502ce
Compare
…om C compiler). Followup to PR wolfSSL#7884. Fixes ZD 18465 * Consolidate the USE_WINDOWS_API to a single place. * Expand the `WOLFSSL_NOT_WINDOWS_API` improvement for intrinsics and word sizes. * Fix for macro variadic `...` when no variables are used (some compilers like Watcom C have issue with this). * Fix for Watcom C compiler "long long" -> "__int64". * Fix a couple of minor cast warnings reported from VS.
7f0d820
to
84b5d66
Compare
wolfssl/wolfcrypt/types.h
Outdated
#ifdef __WATCOMC__ | ||
#define SAVE_VECTOR_REGISTERS() WC_DO_NOTHING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
turns out there's a fallthrough definition that works for both:
@@ -1758,7 +1758,7 @@ typedef struct w64wrapper {
#endif
#ifndef SAVE_VECTOR_REGISTERS
- #define SAVE_VECTOR_REGISTERS(...) WC_DO_NOTHING
+ #define SAVE_VECTOR_REGISTERS(fail_clause) WC_DO_NOTHING
#endif
#ifndef SAVE_VECTOR_REGISTERS2
#define SAVE_VECTOR_REGISTERS2() 0
@@ -1772,10 +1772,10 @@ typedef struct w64wrapper {
#define WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(x) WC_DO_NOTHING
#endif
#ifndef ASSERT_SAVED_VECTOR_REGISTERS
- #define ASSERT_SAVED_VECTOR_REGISTERS(...) WC_DO_NOTHING
+ #define ASSERT_SAVED_VECTOR_REGISTERS(fail_clause) WC_DO_NOTHING
#endif
#ifndef ASSERT_RESTORED_VECTOR_REGISTERS
- #define ASSERT_RESTORED_VECTOR_REGISTERS(...) WC_DO_NOTHING
+ #define ASSERT_RESTORED_VECTOR_REGISTERS(fail_clause) WC_DO_NOTHING
#endif
#ifndef RESTORE_VECTOR_REGISTERS
#define RESTORE_VECTOR_REGISTERS() WC_DO_NOTHING
on the other hand, defining it to take no args doesn't work on C99, for example:
wolfcrypt/src/sp_int.c:19625:5: error: 'SAVE_VECTOR_REGISTERS' undeclared (first use in this function)
19625 | SAVE_VECTOR_REGISTERS(err = _svr_ret;);
| ^~~~~~~~~~~~~~~~~~~~~
wolfcrypt/src/rsa.c:4754:46: error: macro "SAVE_VECTOR_REGISTERS" passed 1 arguments, but takes just 0
4754 | SAVE_VECTOR_REGISTERS(ret = _svr_ret;);
| ^
The reason the always-expect-one-arg works even when some invocations pass no args is that (I've just learned from research) invoking a cpp macro with ()
for args actually passes a single no-tokens arg implicitly. wild stuff.
src/tls.c
Outdated
#define CAN_GET_SIZE() 0 | ||
#define CAN_WRITE() 0 | ||
#define CAN_PARSE() 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be defined to take one dummy arg, as explained in my comment below.
…_VECTOR_REGISTERS`.
retest this please ("FAIL: scripts/external.test") |
src/ocsp.c
Outdated
@@ -1634,7 +1634,8 @@ int wolfSSL_OCSP_REQ_CTX_nbio(WOLFSSL_OCSP_REQ_CTX *ctx) | |||
case ORIOS_WRITE: | |||
{ | |||
const unsigned char *req; | |||
int reqLen = wolfSSL_BIO_get_mem_data(ctx->reqResp, &req); | |||
int reqLen = wolfSSL_BIO_get_mem_data(ctx->reqResp, | |||
(unsigned char*)&req); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
req
should be cast to (void *)
here.
src/ocsp.c
Outdated
@@ -1710,7 +1711,8 @@ int wolfSSL_OCSP_sendreq_nbio(OcspResponse **presp, WOLFSSL_OCSP_REQ_CTX *ctx) | |||
if (ret != WOLFSSL_SUCCESS) | |||
return ret; | |||
|
|||
len = wolfSSL_BIO_get_mem_data(ctx->reqResp, &resp); | |||
len = wolfSSL_BIO_get_mem_data(ctx->reqResp, | |||
(unsigned char*)&resp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for resp
here.
src/tls.c
Outdated
@@ -14764,7 +14764,7 @@ static word16 TLSX_GetMinSize_Client(word16* type) | |||
} | |||
#define TLSX_GET_MIN_SIZE_CLIENT TLSX_GetMinSize_Client | |||
#else | |||
#define TLSX_GET_MIN_SIZE_CLIENT(...) 0 | |||
#define TLSX_GET_MIN_SIZE_CLIENT() 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should also take one dummy arg.
src/tls.c
Outdated
@@ -14833,7 +14833,7 @@ static word16 TLSX_GetMinSize_Server(const word16 *type) | |||
} | |||
#define TLSX_GET_MIN_SIZE_SERVER TLSX_GetMinSize_Server | |||
#else | |||
#define TLSX_GET_MIN_SIZE_SERVER(...) 0 | |||
#define TLSX_GET_MIN_SIZE_SERVER() 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this.
wolfssl/wolfcrypt/logging.h
Outdated
@@ -178,7 +178,7 @@ WOLFSSL_API void wolfSSL_SetLoggingPrefix(const char* prefix); | |||
WOLFSSL_API void WOLFSSL_MSG_EX(const char* fmt, ...); | |||
#define HAVE_WOLFSSL_MSG_EX | |||
#else | |||
#define WOLFSSL_MSG_EX(...) WC_DO_NOTHING | |||
#define WOLFSSL_MSG_EX() WC_DO_NOTHING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this is going to cause problems, given that WOLFSSL_MSG_EX()
always has at least 1 arg, and sometimes has more than 1.
can we gate the WOLFSSL_MSG_EX()
definition in some way, so that WOLFSSL_MSG_EX(...)
is kept on targets that support variadic macros?
Description
More fixes for building x86 in Visual Studio for non-windows OS (Watcom C compiler). Followup to PR #7884. Fixes ZD 18465
WOLFSSL_NOT_WINDOWS_API
improvement for intrinsics and word sizes....
when no variables are used (some compilers like Watcom C have issue with this).SAVE_VECTOR_REGISTERS
,ASSERT_SAVED_VECTOR_REGISTERS
andRESTORE_VECTOR_REGISTERS
.Testing
Worked with customer
Checklist