-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
warning: cast between incompatible function types from FARPROC_ to gettickcount64_t #225
Comments
Hi, thanks for reporting this. It seems there is yet an issue when we moved to winapi. |
The only thing I can suggest is to silence or work around the warning. The code is correct, AFAICS, this is the intended usage pattern of |
It is weird to cast between "potentially different types of function pointers", isn't it? |
Not so weird, not really. This may not be a well defined standard C++, but, well, that's now 95% of system programming works. |
So it's really harmless. I'm happy to hear that. |
Ok, I would accept a PR that silent this warning. Sorry, I don't have a Windows platform to test it. |
…to gettickcount64_t On Windows, GetProcAddress must be cast to something useful which generates a warning with gcc. This patch silents the warning. Fixes issue boostorg#225
Any idea why PR #227 failed some tests in appveyor? |
…to gettickcount64_t On Windows, GetProcAddress must be cast to something useful which generates a warning with gcc. This patch silents the warning. Fixes issue boostorg#225
See #227 |
I ll spam a bit by pushing a couple of prs fixing warnings on mingw builds. I wanted to push in one but it is better if i do it separately for you to check their validity better 1st warning line 155 - GCC is warning that adding const to the static cast type doesn't do anything. True. Remove it. 2nd - 3rd same warnings lines 333, 386 - GetProcAddress returns a pointer to some function. It can return pointers to different functions, so it has to return something that is suitable to store any pointer to function. Microsoft chose FARPROC, which is int (WINAPI *)() on 32-bit Windows. The user is supposed to know the signature of the function he requests and perform a cast (which is a nop on this platform). The result is a pointer to function with the required signature, which is bitwise equal to what GetProcAddress returned. However, gcc >= 8 warns about that and it shouldnt. There is nothing to fix here so silence the warning explicitly. Related to this boostorg/thread#225
While building 1.68.0 beta 1 on x86_64 cross-compiling to Windows 32 bits with mingw-w64 + g++ 8.2.0, I get the following warning:
The text was updated successfully, but these errors were encountered: