On Sat, 12 Feb 2022, Andrea Monaco via Gcc wrote:

 #include <curl/curl.h>

 int
 main (void)
 {
   float a;

   curl_easy_setopt (NULL, 0, (void *) a);
 }


with "gcc -c bug.c" gives


 bug.c: In function ‘main’:
 bug.c:15:3: error: cannot convert to a pointer type
    curl_easy_setopt (NULL, 0, (void *) a);
    ^~~~~~~~~~~~~~~~
 bug.c:15:3: error: cannot convert to a pointer type
 bug.c:15:3: error: cannot convert to a pointer type
 bug.c:15:3: error: cannot convert to a pointer type
 [...]
 bug.c:15:3: error: cannot convert to a pointer type
 In file included from /usr/include/x86_64-linux-gnu/curl/curl.h:2826,
                  from bug.c:1:
 bug.c:15:3: error: cannot convert to a pointer type
    curl_easy_setopt (NULL, 0, (void *) a);
    ^~~~~~~~~~~~~~~~
 bug.c:15:3: error: cannot convert to a pointer type
    curl_easy_setopt (NULL, 0, (void *) a);
    ^~~~~~~~~~~~~~~~
 bug.c:15:3: error: cannot convert to a pointer type
    curl_easy_setopt (NULL, 0, (void *) a);
    ^~~~~~~~~~~~~~~~


The error message is correct, but is repeated tens of times.
The function is declared this way in curl.h

 CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option,
 ...);

No, curl_easy_setopt is a macro. If you look at the preprocessed code, you get many statements doing the same wrong operation, and one warning for each of them.

(wrong list, should be gcc-help, or an issue on bugzilla)

--
Marc Glisse

Reply via email to