-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Unify code that uses GetProcAddress on Windows #12581
Conversation
pps83
commented
Dec 21, 2023
- avoid using CURLX_FUNCTION_CAST, instead dereference destination pointer to FARPROC*
- remove unnecessary function pointer typedefs required for CURLX_FUNCTION_CAST
Note, there were things like APIENTRY vs WINAPI (in case of |
I think there is some reason we are using CURLX_FUNCTION_CAST, probably to avoid some compiler's warnings. |
3c948ce
to
375b2a6
Compare
Yes, to cast from |
375b2a6
to
ed3ce14
Compare
ed3ce14
to
d98e08d
Compare
+ avoid using CURLX_FUNCTION_CAST, instead dereference destination pointer to FARPROC* + remove unnecessary function pointer typedefs required for CURLX_FUNCTION_CAST
d98e08d
to
8154940
Compare
@bagder looks like there is an assert in a test (unrelated to the change): https://github.com/curl/curl/actions/runs/7300608761/job/19895602267?pr=12581#step:21:538
|
Unfortunately, this results in strict-aliasing warnings-as-errors on MinGW-w64 with GCC 10 when targeting x64, and so does the recently merged code in a6bbc87#diff-1745e851717837ff181d2de193e6c8b077ec5ea3159a2366740cb66b9c033325. The warning shows up in the autobuilds too: |
What do you recommend? Reject this and change the existing instances to CURLX_FUNCTION_CAST? |
Yes, unless there's another way that doesn't result in new warnings, I'd consistently use |
- Use CURLX_FUNCTION_CAST to suppress a function pointer assignment warning. a6bbc87 added lookups of some Windows API functions and then cast them like *(FARPROC*)&Curl_funcname = address. Some versions of gcc warn about that as breaking strict-aliasing rules so this PR changes those assignments to use CURLX_FUNCTION_CAST. Bug: curl#12581 (comment) Reported-by: Marcel Raad Closes #xxxx
- Use CURLX_FUNCTION_CAST to suppress a function pointer assignment warning. a6bbc87 added lookups of some Windows API functions and then cast them like *(FARPROC*)&Curl_funcname = address. Some versions of gcc warn about that as breaking strict-aliasing rules so this PR changes those assignments to use CURLX_FUNCTION_CAST. Bug: curl#12581 (comment) Reported-by: Marcel Raad Closes #xxxx
- Use CURLX_FUNCTION_CAST to suppress a function pointer assignment warning. a6bbc87 added lookups of some Windows API functions and then cast them like `*(FARPROC*)&Curl_funcname = address`. Some versions of gcc warn about that as breaking strict-aliasing rules so this PR changes those assignments to use CURLX_FUNCTION_CAST. Bug: #12581 (comment) Reported-by: Marcel Raad Closes #12602
Strange, those warnings should have resulted in warnings as error in CI. IMO, CI should be patched to ensure this happens. |