From 4de2bc1b1db4d3109d54d2b58ba433e2574fa675 Mon Sep 17 00:00:00 2001 From: Charlie Savage Date: Thu, 20 Apr 2023 00:39:51 -0700 Subject: CreateNamedPipe and CreateFile map to CreateNamedPipeW and CreateFileW when compiling with MSVC 22. These apis take a widechar - LPCWSTR. Thus these tests fail because Windows considers the pipe names to be invalid. Thus switch to the Ansi versions. --- spec/ffi/fixtures/PipeHelperWindows.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/ffi/fixtures/PipeHelperWindows.c b/spec/ffi/fixtures/PipeHelperWindows.c index 0bdbd2e..31b4a2a 100644 --- a/spec/ffi/fixtures/PipeHelperWindows.c +++ b/spec/ffi/fixtures/PipeHelperWindows.c @@ -16,7 +16,7 @@ int pipeHelperCreatePipe(FD_TYPE pipefd[2]) sprintf( name, "\\\\.\\Pipe\\pipeHelper-%u-%i", (unsigned int)GetCurrentProcessId(), pipe_idx++ ); - pipefd[0] = CreateNamedPipe( name, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, + pipefd[0] = CreateNamedPipeA( name, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE | PIPE_WAIT, 1, // Number of pipes 5, // Out buffer size @@ -26,7 +26,7 @@ int pipeHelperCreatePipe(FD_TYPE pipefd[2]) if(pipefd[0] == INVALID_HANDLE_VALUE) return -1; - pipefd[1] = CreateFile( name, GENERIC_WRITE, 0, NULL, + pipefd[1] = CreateFileA( name, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -- cgit v1.2.1 From 75ff5ddcd39ed0ab5030ca7d3a9b200347b579b2 Mon Sep 17 00:00:00 2001 From: Charlie Savage Date: Thu, 20 Apr 2023 00:44:45 -0700 Subject: Visual Studio 22 does not compile va_arg that are function pointers. Instead, the function pointers must be a typdef. For what its worth, see https://stackoverflow.com/a/37114318. --- spec/ffi/fixtures/ClosureTest.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/ffi/fixtures/ClosureTest.c b/spec/ffi/fixtures/ClosureTest.c index 16f72c4..47273e8 100644 --- a/spec/ffi/fixtures/ClosureTest.c +++ b/spec/ffi/fixtures/ClosureTest.c @@ -16,10 +16,10 @@ double testClosureVrDva(double d, ...) { va_list args; - double (*closure)(void); + typedef double (*closure_fun)(void); va_start(args, d); - closure = va_arg(args, double (*)(void)); + closure_fun closure = va_arg(args, closure_fun); va_end(args); return d + closure(); @@ -27,12 +27,12 @@ double testClosureVrDva(double d, ...) { long testClosureVrILva(int i, long l, ...) { va_list args; - int (*cl1)(int); - long (*cl2)(long); + typedef int (*cl1_fun)(int); + typedef long (*cl2_fun)(long); va_start(args, l); - cl1 = va_arg(args, int (*)(int)); - cl2 = va_arg(args, long (*)(long)); + cl1_fun cl1 = va_arg(args, cl1_fun); + cl2_fun cl2 = va_arg(args, cl2_fun); va_end(args); return cl1(i) + cl2(l); -- cgit v1.2.1 From 2589b0a4b931be9e61e1c279d1a577a492f18dfc Mon Sep 17 00:00:00 2001 From: Charlie Savage Date: Thu, 20 Apr 2023 00:45:21 -0700 Subject: MSVC does not include --- spec/ffi/fixtures/PointerTest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/ffi/fixtures/PointerTest.c b/spec/ffi/fixtures/PointerTest.c index a7f392a..02dbc27 100644 --- a/spec/ffi/fixtures/PointerTest.c +++ b/spec/ffi/fixtures/PointerTest.c @@ -5,7 +5,9 @@ */ #include +#ifndef _MSC_VER #include +#endif #include #include #include -- cgit v1.2.1