-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
tool_operate: typecheck-gcc warning #1403
Comments
Ah, I suppose I need to build without |
I think the key is |
Oh yes, that's it. |
All the callbacks passed to curl_easy_setopt are defined as function pointers. The possibility to pass both functions and function pointers was handled for the callbacks that typecheck-gcc.h defined as compatible, but not for the public callback types themselves. This makes all compatible callback types defined in typecheck-gcc.h function pointers too and checks all functions uniformly with _curl_callback_compatible, which handles both functions and function pointers. A symptom of the problem was a warning in tool_operate.c with --disable-libcurl-option as that file passes the callback functions to curl_easy_setopt directly. Fixes curl#1403
We should write a libcurl test that actually uses every single libcurl option, so that we can see that typecheck-gcc at least works for the valid sets... |
Absolutely. I'll try, but it will take some days. So it has to be in the "tests/unit" directory, right? And I guess there are no compile-time tests yet, are there? |
All the callbacks passed to curl_easy_setopt are defined as function pointers. The possibility to pass both functions and function pointers was handled for the callbacks that typecheck-gcc.h defined as compatible, but not for the public callback types themselves. This makes all compatible callback types defined in typecheck-gcc.h function pointers too and checks all functions uniformly with _curl_callback_compatible, which handles both functions and function pointers. A symptom of the problem was a warning in tool_operate.c with --disable-libcurl-option as that file passes the callback functions to curl_easy_setopt directly. Fixes curl#1403
All the callbacks passed to curl_easy_setopt are defined as function pointers. The possibility to pass both functions and function pointers was handled for the callbacks that typecheck-gcc.h defined as compatible, but not for the public callback types themselves. This makes all compatible callback types defined in typecheck-gcc.h function pointers too and checks all functions uniformly with _curl_callback_compatible, which handles both functions and function pointers. A symptom of the problem was a warning in tool_operate.c with --disable-libcurl-option as that file passes the callback functions to curl_easy_setopt directly. Fixes curl#1403
All the callbacks passed to curl_easy_setopt are defined as function pointers. The possibility to pass both functions and function pointers was handled for the callbacks that typecheck-gcc.h defined as compatible, but not for the public callback types themselves. This makes all compatible callback types defined in typecheck-gcc.h function pointers too and checks all functions uniformly with _curl_callback_compatible, which handles both functions and function pointers. A symptom of the problem was a warning in tool_operate.c with --disable-libcurl-option and without --enable-debug as that file passes the callback functions to curl_easy_setopt directly. Fixes curl#1403 Closes curl#1404
I did this
Compiled with
--disable-libcurl-option --enable-werror
.With MinGW / GCC 6.3.0, I got:
Passing a function pointer to
my_setopt
fixes the issue (but all the othermy_setopt
calls, which compile successfully, don't do that either):my_setopt(curl, CURLOPT_SEEKFUNCTION, &tool_seek_cb);
I also noticed that
_curl_conv_callback
* and_curl_seek_callback
* are defined as pointers in typecheck-gcc.h, but all other function types aren't. Removing the*
from them works around the issue too (and should be done because of_curl_callback_compatible
checking for a pointer to the argument in addition to the argument itself), but choosing one of the alternatives returningCURLcode
is probably not what is intended when the function declaration exactly matches the return type and parameters of curl_seek_callback, also returning an int.Probably every
__builtin_types_compatible_p(__typeof__(expr), curl_*_callback)
in_curl_is_*_cb
should also have a__builtin_types_compatible_p(__typeof__(expr) *, curl_*_callback)
?(I'll also prepare a pull request.)
I expected the following
Successful compilation without warnings.
curl/libcurl version
git master f9d1e9a
operating system
Windows / MSYS2
The text was updated successfully, but these errors were encountered: