typecheck-gcc: fix _curl_is_slist_info
authorMarcel Raad <raad@teamviewer.com>
Mon, 24 Apr 2017 15:56:19 +0000 (17:56 +0200)
committerMarcel Raad <raad@teamviewer.com>
Tue, 25 Apr 2017 09:17:50 +0000 (11:17 +0200)
Info values starting with CURLINFO_SOCKET expect a curl_socket_t, not a
curl_slist argument.

This fixes the following GCC warning when building the examples with
--enable-optimize:

../../include/curl/typecheck-gcc.h:126:42: warning: call to
‘_curl_easy_getinfo_err_curl_slist’ declared with attribute warning:
curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this
info [enabled by default]
sendrecv.c:90:11: note: in expansion of macro ‘curl_easy_getinfo’
res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd);

Closes https://github.com/curl/curl/pull/1447

include/curl/typecheck-gcc.h

index 5cdc5e4d7c6a3ae6365ccb11475af72d61f3c856..32cdaf17f52e8ee12451318255326b1f2cf07cce 100644 (file)
@@ -349,7 +349,7 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
 
 /* true if info expects a pointer to struct curl_slist * argument */
 #define _curl_is_slist_info(info)                                             \
-  (CURLINFO_SLIST < (info))
+  (CURLINFO_SLIST < (info) && (info) < CURLINFO_SOCKET)
 
 
 /* typecheck helpers -- check whether given expression has requested type*/