-
Notifications
You must be signed in to change notification settings - Fork 78
Description
@rdinnager reports the following warnings when building tskit (actually tskit's code inside SLiM, but it's the same code) on Windows using the Ming64 compiler:
F:/SLiM/treerec/tskit/core.c: In function 'get_random_bytes':
F:/SLiM/treerec/tskit/core.c:47:29: warning: initialization of 'HCRYPTPROV' {aka 'long long unsigned int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
47 | HCRYPTPROV hCryptProv = NULL;
| ^~~~
F:/SLiM/treerec/tskit/core.c:57:20: warning: assignment to 'HCRYPTPROV' {aka 'long long unsigned int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
57 | hCryptProv = NULL;
| ^
F:/SLiM/treerec/tskit/core.c:60:16: warning: assignment to 'HCRYPTPROV' {aka 'long long unsigned int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
60 | hCryptProv = NULL;
| ^
F:/SLiM/treerec/tskit/core.c:63:20: warning: comparison between pointer and integer
63 | if (hCryptProv != NULL) {
| ^~
According to the Microsoft docs (https://docs.microsoft.com/en-us/windows/win32/seccrypto/hcryptprov) HCRYPTPROV is supposed to be a pointer to unsigned long:
typedef ULONG_PTR HCRYPTPROV;
It looks like whatever headers are coming from Russell's toolchain define it as long long unsigned int instead; I have no idea why. I would suggest that maybe tskit ought to change those four assignments above, of NULL, to be assignments of (HCRYPTPROV)NULL so that it builds without warnings regardless of what type HCRYPTPROV is defined to be. Should be a trivial fix. Thanks!
This was originally discussed in MesserLab/SLiM#66 but there's no need to read through that, it just says the same things I say above. :->