Skip to content

-Wattribute-warning compiler warnings in cover-thumbnailer with curl master

Description

Compiling tumbler with curl master starting with curl@fd2ca2399e79e triggers the following warnings:

[25/131] Compiling C object plugins/tumbler-cover-thumbnailer.so.p/cover-thumbnailer_cover-thumbnailer.c.o
../plugins/cover-thumbnailer/cover-thumbnailer.c:227:3: warning: call to '_curl_easy_setopt_err_long' declared with 'warning' attribute: curl_easy_setopt expects a long argument [-Wattribute-warning]
  227 |   curl_easy_setopt (curl_handle, CURLOPT_TCP_KEEPALIVE, TRUE);
      |   ^
/usr/local/include/curl/typecheck-gcc.h:50:15: note: expanded from macro 'curl_easy_setopt'
   50 |               _curl_easy_setopt_err_long();                             \
      |               ^
../plugins/cover-thumbnailer/cover-thumbnailer.c:231:3: warning: call to '_curl_easy_setopt_err_xferinfo_cb' declared with 'warning' attribute: curl_easy_setopt expects a curl_xferinfo_callback argument [-Wattribute-warning]
  231 |   curl_easy_setopt (curl_handle, CURLOPT_XFERINFOFUNCTION, cover_thumbnailer_check_progress);
      |   ^
/usr/local/include/curl/typecheck-gcc.h:84:15: note: expanded from macro 'curl_easy_setopt'
   84 |               _curl_easy_setopt_err_xferinfo_cb();                      \
      |               ^
../plugins/cover-thumbnailer/cover-thumbnailer.c:233:3: warning: call to '_curl_easy_setopt_err_long' declared with 'warning' attribute: curl_easy_setopt expects a long argument [-Wattribute-warning]
  233 |   curl_easy_setopt (curl_handle, CURLOPT_NOPROGRESS, FALSE);
      |   ^
/usr/local/include/curl/typecheck-gcc.h:50:15: note: expanded from macro 'curl_easy_setopt'
   50 |               _curl_easy_setopt_err_long();                             \
      |               ^
3 warnings generated.

API docs

The libcurl docs state that numeric options should be longs:

Since curl_easy_setopt() is a vararg function where the 3rd argument can use different types depending on the situation, normal C language type conversion cannot be done. You must make sure that you truly pass a long and not an int if the documentation tells you so. -- https://everything.curl.dev/transfers/options/num.html

The docs also state that the CURLOPT_XFERINFOFUNCTION callback must match this prototype:

int xfer_callback(void *clientp, curl_off_t dltotal, curl_off_t dlnow,
                  curl_off_t ultotal, curl_off_t ulnow);

-- https://everything.curl.dev/transfers/callbacks/progress.html

Version info

d8032b31 compiled on Arch Linux