Skip to content

Commit

Permalink
mingw: squash another warning about a cast
Browse files Browse the repository at this point in the history
MSys2's compiler is correct that casting a "void *" to a "DWORD" loses
precision, but in the case of pthread_exit() we know that the value
fits into a DWORD.

Just like casting handles to DWORDs, let's work around this issue by
casting to "intrptr_t" first, and immediately cast to the final type.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Jan 15, 2016
1 parent 7c00bc3 commit 83c90da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compat/win32/pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ extern pthread_t pthread_self(void);

static inline int pthread_exit(void *ret)
{
ExitThread((DWORD)ret);
ExitThread((DWORD)(intptr_t)ret);
}

typedef DWORD pthread_key_t;
Expand Down

0 comments on commit 83c90da

Please sign in to comment.