Skip to content

Commit

Permalink
Fix warning because of incompatible pointer type
Browse files Browse the repository at this point in the history
ClosureTest.c: In function 'testThreadedClosureVrV':
ClosureTest.c:102:44: warning: cast between incompatible function types from 'void * (*)(void *)' to 'void (*)(void *)' [-Wcast-function-type]
  102 |     HANDLE hThread = (HANDLE) _beginthread((void (*)(void *))threadVrV, 0, &arg);
      |                                            ^

Fixes #745
  • Loading branch information
larskanis committed Mar 28, 2020
1 parent 233a8d0 commit b3956b1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions spec/ffi/fixtures/ClosureTest.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,23 @@ static void *
threadVrV(void *arg)
{
struct ThreadVrV* t = (struct ThreadVrV *) arg;

int i;
for (i = 0; i < t->count; i++) {
(*t->closure)();
}

return NULL;
}

#ifdef _WIN32
static void
threadVrV_win32(void *arg)
{
threadVrV(arg);
}
#endif

void testThreadedClosureVrV(void (*closure)(void), int n)
{
struct ThreadVrV arg = {closure, n};
Expand All @@ -99,8 +107,8 @@ void testThreadedClosureVrV(void (*closure)(void), int n)
pthread_create(&t, NULL, threadVrV, &arg);
pthread_join(t, NULL);
#else
HANDLE hThread = (HANDLE) _beginthread((void (*)(void *))threadVrV, 0, &arg);
WaitForSingleObject(hThread, INFINITE);
HANDLE hThread = (HANDLE) _beginthread(threadVrV_win32, 0, &arg);
WaitForSingleObject(hThread, INFINITE);
#endif
}

Expand Down

0 comments on commit b3956b1

Please sign in to comment.