More fixes for building x86 in Visual Studio for non-windows OS#8098
More fixes for building x86 in Visual Studio for non-windows OS#8098douzzer merged 4 commits intowolfSSL:masterfrom
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
| #ifdef __WATCOMC__ | ||
| #define SAVE_VECTOR_REGISTERS() WC_DO_NOTHING |
There was a problem hiding this comment.
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.
| #define CAN_GET_SIZE() 0 | ||
| #define CAN_WRITE() 0 | ||
| #define CAN_PARSE() 0 |
There was a problem hiding this comment.
These should be defined to take one dummy arg, as explained in my comment below.
…_VECTOR_REGISTERS`.
|
retest this please ("FAIL: scripts/external.test") |
| 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.
req should be cast to (void *) here.
|
|
||
| len = wolfSSL_BIO_get_mem_data(ctx->reqResp, &resp); | ||
| len = wolfSSL_BIO_get_mem_data(ctx->reqResp, | ||
| (unsigned char*)&resp); |
| #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.
this should also take one dummy arg.
| #define TLSX_GET_MIN_SIZE_SERVER TLSX_GetMinSize_Server | ||
| #else | ||
| #define TLSX_GET_MIN_SIZE_SERVER(...) 0 | ||
| #define TLSX_GET_MIN_SIZE_SERVER() 0 |
| #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.
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_APIimprovement 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_REGISTERSandRESTORE_VECTOR_REGISTERS.Testing
Worked with customer
Checklist