File indexing completed on 2025-01-18 09:55:12
0001 #ifndef CURLINC_TYPECHECK_GCC_H
0002 #define CURLINC_TYPECHECK_GCC_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 #define curl_easy_setopt(handle, option, value) \
0044 __extension__({ \
0045 CURLoption _curl_opt = (option); \
0046 if(__builtin_constant_p(_curl_opt)) { \
0047 CURL_IGNORE_DEPRECATION( \
0048 if(curlcheck_long_option(_curl_opt)) \
0049 if(!curlcheck_long(value)) \
0050 _curl_easy_setopt_err_long(); \
0051 if(curlcheck_off_t_option(_curl_opt)) \
0052 if(!curlcheck_off_t(value)) \
0053 _curl_easy_setopt_err_curl_off_t(); \
0054 if(curlcheck_string_option(_curl_opt)) \
0055 if(!curlcheck_string(value)) \
0056 _curl_easy_setopt_err_string(); \
0057 if(curlcheck_write_cb_option(_curl_opt)) \
0058 if(!curlcheck_write_cb(value)) \
0059 _curl_easy_setopt_err_write_callback(); \
0060 if((_curl_opt) == CURLOPT_RESOLVER_START_FUNCTION) \
0061 if(!curlcheck_resolver_start_callback(value)) \
0062 _curl_easy_setopt_err_resolver_start_callback(); \
0063 if((_curl_opt) == CURLOPT_READFUNCTION) \
0064 if(!curlcheck_read_cb(value)) \
0065 _curl_easy_setopt_err_read_cb(); \
0066 if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \
0067 if(!curlcheck_ioctl_cb(value)) \
0068 _curl_easy_setopt_err_ioctl_cb(); \
0069 if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \
0070 if(!curlcheck_sockopt_cb(value)) \
0071 _curl_easy_setopt_err_sockopt_cb(); \
0072 if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \
0073 if(!curlcheck_opensocket_cb(value)) \
0074 _curl_easy_setopt_err_opensocket_cb(); \
0075 if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \
0076 if(!curlcheck_progress_cb(value)) \
0077 _curl_easy_setopt_err_progress_cb(); \
0078 if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \
0079 if(!curlcheck_debug_cb(value)) \
0080 _curl_easy_setopt_err_debug_cb(); \
0081 if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \
0082 if(!curlcheck_ssl_ctx_cb(value)) \
0083 _curl_easy_setopt_err_ssl_ctx_cb(); \
0084 if(curlcheck_conv_cb_option(_curl_opt)) \
0085 if(!curlcheck_conv_cb(value)) \
0086 _curl_easy_setopt_err_conv_cb(); \
0087 if((_curl_opt) == CURLOPT_SEEKFUNCTION) \
0088 if(!curlcheck_seek_cb(value)) \
0089 _curl_easy_setopt_err_seek_cb(); \
0090 if(curlcheck_cb_data_option(_curl_opt)) \
0091 if(!curlcheck_cb_data(value)) \
0092 _curl_easy_setopt_err_cb_data(); \
0093 if((_curl_opt) == CURLOPT_ERRORBUFFER) \
0094 if(!curlcheck_error_buffer(value)) \
0095 _curl_easy_setopt_err_error_buffer(); \
0096 if((_curl_opt) == CURLOPT_STDERR) \
0097 if(!curlcheck_FILE(value)) \
0098 _curl_easy_setopt_err_FILE(); \
0099 if(curlcheck_postfields_option(_curl_opt)) \
0100 if(!curlcheck_postfields(value)) \
0101 _curl_easy_setopt_err_postfields(); \
0102 if((_curl_opt) == CURLOPT_HTTPPOST) \
0103 if(!curlcheck_arr((value), struct curl_httppost)) \
0104 _curl_easy_setopt_err_curl_httpost(); \
0105 if((_curl_opt) == CURLOPT_MIMEPOST) \
0106 if(!curlcheck_ptr((value), curl_mime)) \
0107 _curl_easy_setopt_err_curl_mimepost(); \
0108 if(curlcheck_slist_option(_curl_opt)) \
0109 if(!curlcheck_arr((value), struct curl_slist)) \
0110 _curl_easy_setopt_err_curl_slist(); \
0111 if((_curl_opt) == CURLOPT_SHARE) \
0112 if(!curlcheck_ptr((value), CURLSH)) \
0113 _curl_easy_setopt_err_CURLSH(); \
0114 ) \
0115 } \
0116 curl_easy_setopt(handle, _curl_opt, value); \
0117 })
0118
0119
0120 #define curl_easy_getinfo(handle, info, arg) \
0121 __extension__({ \
0122 CURLINFO _curl_info = (info); \
0123 if(__builtin_constant_p(_curl_info)) { \
0124 CURL_IGNORE_DEPRECATION( \
0125 if(curlcheck_string_info(_curl_info)) \
0126 if(!curlcheck_arr((arg), char *)) \
0127 _curl_easy_getinfo_err_string(); \
0128 if(curlcheck_long_info(_curl_info)) \
0129 if(!curlcheck_arr((arg), long)) \
0130 _curl_easy_getinfo_err_long(); \
0131 if(curlcheck_double_info(_curl_info)) \
0132 if(!curlcheck_arr((arg), double)) \
0133 _curl_easy_getinfo_err_double(); \
0134 if(curlcheck_slist_info(_curl_info)) \
0135 if(!curlcheck_arr((arg), struct curl_slist *)) \
0136 _curl_easy_getinfo_err_curl_slist(); \
0137 if(curlcheck_tlssessioninfo_info(_curl_info)) \
0138 if(!curlcheck_arr((arg), struct curl_tlssessioninfo *)) \
0139 _curl_easy_getinfo_err_curl_tlssesssioninfo(); \
0140 if(curlcheck_certinfo_info(_curl_info)) \
0141 if(!curlcheck_arr((arg), struct curl_certinfo *)) \
0142 _curl_easy_getinfo_err_curl_certinfo(); \
0143 if(curlcheck_socket_info(_curl_info)) \
0144 if(!curlcheck_arr((arg), curl_socket_t)) \
0145 _curl_easy_getinfo_err_curl_socket(); \
0146 if(curlcheck_off_t_info(_curl_info)) \
0147 if(!curlcheck_arr((arg), curl_off_t)) \
0148 _curl_easy_getinfo_err_curl_off_t(); \
0149 ) \
0150 } \
0151 curl_easy_getinfo(handle, _curl_info, arg); \
0152 })
0153
0154
0155
0156
0157 #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
0158 #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
0159
0160
0161
0162
0163
0164
0165 #define CURLWARNING(id, message) \
0166 static void __attribute__((__warning__(message))) \
0167 __attribute__((__unused__)) __attribute__((__noinline__)) \
0168 id(void) { __asm__(""); }
0169
0170 CURLWARNING(_curl_easy_setopt_err_long,
0171 "curl_easy_setopt expects a long argument for this option")
0172 CURLWARNING(_curl_easy_setopt_err_curl_off_t,
0173 "curl_easy_setopt expects a curl_off_t argument for this option")
0174 CURLWARNING(_curl_easy_setopt_err_string,
0175 "curl_easy_setopt expects a "
0176 "string ('char *' or char[]) argument for this option"
0177 )
0178 CURLWARNING(_curl_easy_setopt_err_write_callback,
0179 "curl_easy_setopt expects a curl_write_callback argument for this option")
0180 CURLWARNING(_curl_easy_setopt_err_resolver_start_callback,
0181 "curl_easy_setopt expects a "
0182 "curl_resolver_start_callback argument for this option"
0183 )
0184 CURLWARNING(_curl_easy_setopt_err_read_cb,
0185 "curl_easy_setopt expects a curl_read_callback argument for this option")
0186 CURLWARNING(_curl_easy_setopt_err_ioctl_cb,
0187 "curl_easy_setopt expects a curl_ioctl_callback argument for this option")
0188 CURLWARNING(_curl_easy_setopt_err_sockopt_cb,
0189 "curl_easy_setopt expects a curl_sockopt_callback argument for this option")
0190 CURLWARNING(_curl_easy_setopt_err_opensocket_cb,
0191 "curl_easy_setopt expects a "
0192 "curl_opensocket_callback argument for this option"
0193 )
0194 CURLWARNING(_curl_easy_setopt_err_progress_cb,
0195 "curl_easy_setopt expects a curl_progress_callback argument for this option")
0196 CURLWARNING(_curl_easy_setopt_err_debug_cb,
0197 "curl_easy_setopt expects a curl_debug_callback argument for this option")
0198 CURLWARNING(_curl_easy_setopt_err_ssl_ctx_cb,
0199 "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
0200 CURLWARNING(_curl_easy_setopt_err_conv_cb,
0201 "curl_easy_setopt expects a curl_conv_callback argument for this option")
0202 CURLWARNING(_curl_easy_setopt_err_seek_cb,
0203 "curl_easy_setopt expects a curl_seek_callback argument for this option")
0204 CURLWARNING(_curl_easy_setopt_err_cb_data,
0205 "curl_easy_setopt expects a "
0206 "private data pointer as argument for this option")
0207 CURLWARNING(_curl_easy_setopt_err_error_buffer,
0208 "curl_easy_setopt expects a "
0209 "char buffer of CURL_ERROR_SIZE as argument for this option")
0210 CURLWARNING(_curl_easy_setopt_err_FILE,
0211 "curl_easy_setopt expects a 'FILE *' argument for this option")
0212 CURLWARNING(_curl_easy_setopt_err_postfields,
0213 "curl_easy_setopt expects a 'void *' or 'char *' argument for this option")
0214 CURLWARNING(_curl_easy_setopt_err_curl_httpost,
0215 "curl_easy_setopt expects a 'struct curl_httppost *' "
0216 "argument for this option")
0217 CURLWARNING(_curl_easy_setopt_err_curl_mimepost,
0218 "curl_easy_setopt expects a 'curl_mime *' "
0219 "argument for this option")
0220 CURLWARNING(_curl_easy_setopt_err_curl_slist,
0221 "curl_easy_setopt expects a 'struct curl_slist *' argument for this option")
0222 CURLWARNING(_curl_easy_setopt_err_CURLSH,
0223 "curl_easy_setopt expects a CURLSH* argument for this option")
0224
0225 CURLWARNING(_curl_easy_getinfo_err_string,
0226 "curl_easy_getinfo expects a pointer to 'char *' for this info")
0227 CURLWARNING(_curl_easy_getinfo_err_long,
0228 "curl_easy_getinfo expects a pointer to long for this info")
0229 CURLWARNING(_curl_easy_getinfo_err_double,
0230 "curl_easy_getinfo expects a pointer to double for this info")
0231 CURLWARNING(_curl_easy_getinfo_err_curl_slist,
0232 "curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info")
0233 CURLWARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo,
0234 "curl_easy_getinfo expects a pointer to "
0235 "'struct curl_tlssessioninfo *' for this info")
0236 CURLWARNING(_curl_easy_getinfo_err_curl_certinfo,
0237 "curl_easy_getinfo expects a pointer to "
0238 "'struct curl_certinfo *' for this info")
0239 CURLWARNING(_curl_easy_getinfo_err_curl_socket,
0240 "curl_easy_getinfo expects a pointer to curl_socket_t for this info")
0241 CURLWARNING(_curl_easy_getinfo_err_curl_off_t,
0242 "curl_easy_getinfo expects a pointer to curl_off_t for this info")
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253 #define curlcheck_long_option(option) \
0254 (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
0255
0256 #define curlcheck_off_t_option(option) \
0257 (((option) > CURLOPTTYPE_OFF_T) && ((option) < CURLOPTTYPE_BLOB))
0258
0259
0260 #define curlcheck_string_option(option) \
0261 ((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \
0262 (option) == CURLOPT_ACCEPT_ENCODING || \
0263 (option) == CURLOPT_ALTSVC || \
0264 (option) == CURLOPT_CAINFO || \
0265 (option) == CURLOPT_CAPATH || \
0266 (option) == CURLOPT_COOKIE || \
0267 (option) == CURLOPT_COOKIEFILE || \
0268 (option) == CURLOPT_COOKIEJAR || \
0269 (option) == CURLOPT_COOKIELIST || \
0270 (option) == CURLOPT_CRLFILE || \
0271 (option) == CURLOPT_CUSTOMREQUEST || \
0272 (option) == CURLOPT_DEFAULT_PROTOCOL || \
0273 (option) == CURLOPT_DNS_INTERFACE || \
0274 (option) == CURLOPT_DNS_LOCAL_IP4 || \
0275 (option) == CURLOPT_DNS_LOCAL_IP6 || \
0276 (option) == CURLOPT_DNS_SERVERS || \
0277 (option) == CURLOPT_DOH_URL || \
0278 (option) == CURLOPT_ECH || \
0279 (option) == CURLOPT_EGDSOCKET || \
0280 (option) == CURLOPT_FTP_ACCOUNT || \
0281 (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \
0282 (option) == CURLOPT_FTPPORT || \
0283 (option) == CURLOPT_HSTS || \
0284 (option) == CURLOPT_HAPROXY_CLIENT_IP || \
0285 (option) == CURLOPT_INTERFACE || \
0286 (option) == CURLOPT_ISSUERCERT || \
0287 (option) == CURLOPT_KEYPASSWD || \
0288 (option) == CURLOPT_KRBLEVEL || \
0289 (option) == CURLOPT_LOGIN_OPTIONS || \
0290 (option) == CURLOPT_MAIL_AUTH || \
0291 (option) == CURLOPT_MAIL_FROM || \
0292 (option) == CURLOPT_NETRC_FILE || \
0293 (option) == CURLOPT_NOPROXY || \
0294 (option) == CURLOPT_PASSWORD || \
0295 (option) == CURLOPT_PINNEDPUBLICKEY || \
0296 (option) == CURLOPT_PRE_PROXY || \
0297 (option) == CURLOPT_PROTOCOLS_STR || \
0298 (option) == CURLOPT_PROXY || \
0299 (option) == CURLOPT_PROXY_CAINFO || \
0300 (option) == CURLOPT_PROXY_CAPATH || \
0301 (option) == CURLOPT_PROXY_CRLFILE || \
0302 (option) == CURLOPT_PROXY_ISSUERCERT || \
0303 (option) == CURLOPT_PROXY_KEYPASSWD || \
0304 (option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \
0305 (option) == CURLOPT_PROXY_SERVICE_NAME || \
0306 (option) == CURLOPT_PROXY_SSL_CIPHER_LIST || \
0307 (option) == CURLOPT_PROXY_SSLCERT || \
0308 (option) == CURLOPT_PROXY_SSLCERTTYPE || \
0309 (option) == CURLOPT_PROXY_SSLKEY || \
0310 (option) == CURLOPT_PROXY_SSLKEYTYPE || \
0311 (option) == CURLOPT_PROXY_TLS13_CIPHERS || \
0312 (option) == CURLOPT_PROXY_TLSAUTH_PASSWORD || \
0313 (option) == CURLOPT_PROXY_TLSAUTH_TYPE || \
0314 (option) == CURLOPT_PROXY_TLSAUTH_USERNAME || \
0315 (option) == CURLOPT_PROXYPASSWORD || \
0316 (option) == CURLOPT_PROXYUSERNAME || \
0317 (option) == CURLOPT_PROXYUSERPWD || \
0318 (option) == CURLOPT_RANDOM_FILE || \
0319 (option) == CURLOPT_RANGE || \
0320 (option) == CURLOPT_REDIR_PROTOCOLS_STR || \
0321 (option) == CURLOPT_REFERER || \
0322 (option) == CURLOPT_REQUEST_TARGET || \
0323 (option) == CURLOPT_RTSP_SESSION_ID || \
0324 (option) == CURLOPT_RTSP_STREAM_URI || \
0325 (option) == CURLOPT_RTSP_TRANSPORT || \
0326 (option) == CURLOPT_SASL_AUTHZID || \
0327 (option) == CURLOPT_SERVICE_NAME || \
0328 (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \
0329 (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \
0330 (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 || \
0331 (option) == CURLOPT_SSH_KNOWNHOSTS || \
0332 (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \
0333 (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \
0334 (option) == CURLOPT_SSLCERT || \
0335 (option) == CURLOPT_SSLCERTTYPE || \
0336 (option) == CURLOPT_SSLENGINE || \
0337 (option) == CURLOPT_SSLKEY || \
0338 (option) == CURLOPT_SSLKEYTYPE || \
0339 (option) == CURLOPT_SSL_CIPHER_LIST || \
0340 (option) == CURLOPT_TLS13_CIPHERS || \
0341 (option) == CURLOPT_TLSAUTH_PASSWORD || \
0342 (option) == CURLOPT_TLSAUTH_TYPE || \
0343 (option) == CURLOPT_TLSAUTH_USERNAME || \
0344 (option) == CURLOPT_UNIX_SOCKET_PATH || \
0345 (option) == CURLOPT_URL || \
0346 (option) == CURLOPT_USERAGENT || \
0347 (option) == CURLOPT_USERNAME || \
0348 (option) == CURLOPT_AWS_SIGV4 || \
0349 (option) == CURLOPT_USERPWD || \
0350 (option) == CURLOPT_XOAUTH2_BEARER || \
0351 (option) == CURLOPT_SSL_EC_CURVES || \
0352 0)
0353
0354
0355 #define curlcheck_write_cb_option(option) \
0356 ((option) == CURLOPT_HEADERFUNCTION || \
0357 (option) == CURLOPT_WRITEFUNCTION)
0358
0359
0360 #define curlcheck_conv_cb_option(option) \
0361 ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \
0362 (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \
0363 (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
0364
0365
0366 #define curlcheck_cb_data_option(option) \
0367 ((option) == CURLOPT_CHUNK_DATA || \
0368 (option) == CURLOPT_CLOSESOCKETDATA || \
0369 (option) == CURLOPT_DEBUGDATA || \
0370 (option) == CURLOPT_FNMATCH_DATA || \
0371 (option) == CURLOPT_HEADERDATA || \
0372 (option) == CURLOPT_HSTSREADDATA || \
0373 (option) == CURLOPT_HSTSWRITEDATA || \
0374 (option) == CURLOPT_INTERLEAVEDATA || \
0375 (option) == CURLOPT_IOCTLDATA || \
0376 (option) == CURLOPT_OPENSOCKETDATA || \
0377 (option) == CURLOPT_PREREQDATA || \
0378 (option) == CURLOPT_PROGRESSDATA || \
0379 (option) == CURLOPT_READDATA || \
0380 (option) == CURLOPT_SEEKDATA || \
0381 (option) == CURLOPT_SOCKOPTDATA || \
0382 (option) == CURLOPT_SSH_KEYDATA || \
0383 (option) == CURLOPT_SSL_CTX_DATA || \
0384 (option) == CURLOPT_WRITEDATA || \
0385 (option) == CURLOPT_RESOLVER_START_DATA || \
0386 (option) == CURLOPT_TRAILERDATA || \
0387 (option) == CURLOPT_SSH_HOSTKEYDATA || \
0388 0)
0389
0390
0391 #define curlcheck_postfields_option(option) \
0392 ((option) == CURLOPT_POSTFIELDS || \
0393 (option) == CURLOPT_COPYPOSTFIELDS || \
0394 0)
0395
0396
0397 #define curlcheck_slist_option(option) \
0398 ((option) == CURLOPT_HTTP200ALIASES || \
0399 (option) == CURLOPT_HTTPHEADER || \
0400 (option) == CURLOPT_MAIL_RCPT || \
0401 (option) == CURLOPT_POSTQUOTE || \
0402 (option) == CURLOPT_PREQUOTE || \
0403 (option) == CURLOPT_PROXYHEADER || \
0404 (option) == CURLOPT_QUOTE || \
0405 (option) == CURLOPT_RESOLVE || \
0406 (option) == CURLOPT_TELNETOPTIONS || \
0407 (option) == CURLOPT_CONNECT_TO || \
0408 0)
0409
0410
0411
0412
0413 #define curlcheck_string_info(info) \
0414 (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG && \
0415 (info) != CURLINFO_PRIVATE)
0416
0417
0418 #define curlcheck_long_info(info) \
0419 (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
0420
0421
0422 #define curlcheck_double_info(info) \
0423 (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
0424
0425
0426 #define curlcheck_slist_info(info) \
0427 (((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST))
0428
0429
0430 #define curlcheck_tlssessioninfo_info(info) \
0431 (((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION))
0432
0433
0434 #define curlcheck_certinfo_info(info) ((info) == CURLINFO_CERTINFO)
0435
0436
0437 #define curlcheck_socket_info(info) \
0438 (CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T)
0439
0440
0441 #define curlcheck_off_t_info(info) \
0442 (CURLINFO_OFF_T < (info))
0443
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456
0457 #define curlcheck_any_ptr(expr) \
0458 (sizeof(expr) == sizeof(void *))
0459
0460
0461
0462 #define curlcheck_NULL(expr) \
0463 (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
0464
0465
0466 #define curlcheck_ptr(expr, type) \
0467 (curlcheck_NULL(expr) || \
0468 __builtin_types_compatible_p(__typeof__(expr), type *) || \
0469 __builtin_types_compatible_p(__typeof__(expr), const type *))
0470
0471
0472 #define curlcheck_arr(expr, type) \
0473 (curlcheck_ptr((expr), type) || \
0474 __builtin_types_compatible_p(__typeof__(expr), type []))
0475
0476
0477 #define curlcheck_string(expr) \
0478 (curlcheck_arr((expr), char) || \
0479 curlcheck_arr((expr), signed char) || \
0480 curlcheck_arr((expr), unsigned char))
0481
0482
0483
0484
0485 #define curlcheck_long(expr) \
0486 (__builtin_types_compatible_p(__typeof__(expr), long) || \
0487 __builtin_types_compatible_p(__typeof__(expr), signed long) || \
0488 __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \
0489 __builtin_types_compatible_p(__typeof__(expr), int) || \
0490 __builtin_types_compatible_p(__typeof__(expr), signed int) || \
0491 __builtin_types_compatible_p(__typeof__(expr), unsigned int) || \
0492 __builtin_types_compatible_p(__typeof__(expr), short) || \
0493 __builtin_types_compatible_p(__typeof__(expr), signed short) || \
0494 __builtin_types_compatible_p(__typeof__(expr), unsigned short) || \
0495 __builtin_types_compatible_p(__typeof__(expr), char) || \
0496 __builtin_types_compatible_p(__typeof__(expr), signed char) || \
0497 __builtin_types_compatible_p(__typeof__(expr), unsigned char))
0498
0499
0500 #define curlcheck_off_t(expr) \
0501 (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
0502
0503
0504
0505 #define curlcheck_error_buffer(expr) \
0506 (curlcheck_NULL(expr) || \
0507 __builtin_types_compatible_p(__typeof__(expr), char *) || \
0508 __builtin_types_compatible_p(__typeof__(expr), char[]))
0509
0510
0511 #if 0
0512 #define curlcheck_cb_data(expr) \
0513 (curlcheck_ptr((expr), void) || \
0514 curlcheck_ptr((expr), FILE))
0515 #else
0516 #define curlcheck_cb_data(expr) \
0517 curlcheck_any_ptr(expr)
0518 #endif
0519
0520
0521 #define curlcheck_FILE(expr) \
0522 (curlcheck_NULL(expr) || \
0523 (__builtin_types_compatible_p(__typeof__(expr), FILE *)))
0524
0525
0526 #define curlcheck_postfields(expr) \
0527 (curlcheck_ptr((expr), void) || \
0528 curlcheck_arr((expr), char) || \
0529 curlcheck_arr((expr), unsigned char))
0530
0531
0532
0533 #define curlcheck_cb_compatible(func, type) \
0534 (__builtin_types_compatible_p(__typeof__(func), type) || \
0535 __builtin_types_compatible_p(__typeof__(func) *, type))
0536
0537
0538 #define curlcheck_resolver_start_callback(expr) \
0539 (curlcheck_NULL(expr) || \
0540 curlcheck_cb_compatible((expr), curl_resolver_start_callback))
0541
0542
0543 #define curlcheck_read_cb(expr) \
0544 (curlcheck_NULL(expr) || \
0545 curlcheck_cb_compatible((expr), __typeof__(fread) *) || \
0546 curlcheck_cb_compatible((expr), curl_read_callback) || \
0547 curlcheck_cb_compatible((expr), _curl_read_callback1) || \
0548 curlcheck_cb_compatible((expr), _curl_read_callback2) || \
0549 curlcheck_cb_compatible((expr), _curl_read_callback3) || \
0550 curlcheck_cb_compatible((expr), _curl_read_callback4) || \
0551 curlcheck_cb_compatible((expr), _curl_read_callback5) || \
0552 curlcheck_cb_compatible((expr), _curl_read_callback6))
0553 typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *);
0554 typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *);
0555 typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *);
0556 typedef size_t (*_curl_read_callback4)(void *, size_t, size_t, void *);
0557 typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *);
0558 typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *);
0559
0560
0561 #define curlcheck_write_cb(expr) \
0562 (curlcheck_read_cb(expr) || \
0563 curlcheck_cb_compatible((expr), __typeof__(fwrite) *) || \
0564 curlcheck_cb_compatible((expr), curl_write_callback) || \
0565 curlcheck_cb_compatible((expr), _curl_write_callback1) || \
0566 curlcheck_cb_compatible((expr), _curl_write_callback2) || \
0567 curlcheck_cb_compatible((expr), _curl_write_callback3) || \
0568 curlcheck_cb_compatible((expr), _curl_write_callback4) || \
0569 curlcheck_cb_compatible((expr), _curl_write_callback5) || \
0570 curlcheck_cb_compatible((expr), _curl_write_callback6))
0571 typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *);
0572 typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t,
0573 const void *);
0574 typedef size_t (*_curl_write_callback3)(const char *, size_t, size_t, FILE *);
0575 typedef size_t (*_curl_write_callback4)(const void *, size_t, size_t, void *);
0576 typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t,
0577 const void *);
0578 typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *);
0579
0580
0581 #define curlcheck_ioctl_cb(expr) \
0582 (curlcheck_NULL(expr) || \
0583 curlcheck_cb_compatible((expr), curl_ioctl_callback) || \
0584 curlcheck_cb_compatible((expr), _curl_ioctl_callback1) || \
0585 curlcheck_cb_compatible((expr), _curl_ioctl_callback2) || \
0586 curlcheck_cb_compatible((expr), _curl_ioctl_callback3) || \
0587 curlcheck_cb_compatible((expr), _curl_ioctl_callback4))
0588 typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *);
0589 typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *);
0590 typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *);
0591 typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *);
0592
0593
0594 #define curlcheck_sockopt_cb(expr) \
0595 (curlcheck_NULL(expr) || \
0596 curlcheck_cb_compatible((expr), curl_sockopt_callback) || \
0597 curlcheck_cb_compatible((expr), _curl_sockopt_callback1) || \
0598 curlcheck_cb_compatible((expr), _curl_sockopt_callback2))
0599 typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
0600 typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t,
0601 curlsocktype);
0602
0603
0604
0605 #define curlcheck_opensocket_cb(expr) \
0606 (curlcheck_NULL(expr) || \
0607 curlcheck_cb_compatible((expr), curl_opensocket_callback) || \
0608 curlcheck_cb_compatible((expr), _curl_opensocket_callback1) || \
0609 curlcheck_cb_compatible((expr), _curl_opensocket_callback2) || \
0610 curlcheck_cb_compatible((expr), _curl_opensocket_callback3) || \
0611 curlcheck_cb_compatible((expr), _curl_opensocket_callback4))
0612 typedef curl_socket_t (*_curl_opensocket_callback1)
0613 (void *, curlsocktype, struct curl_sockaddr *);
0614 typedef curl_socket_t (*_curl_opensocket_callback2)
0615 (void *, curlsocktype, const struct curl_sockaddr *);
0616 typedef curl_socket_t (*_curl_opensocket_callback3)
0617 (const void *, curlsocktype, struct curl_sockaddr *);
0618 typedef curl_socket_t (*_curl_opensocket_callback4)
0619 (const void *, curlsocktype, const struct curl_sockaddr *);
0620
0621
0622 #define curlcheck_progress_cb(expr) \
0623 (curlcheck_NULL(expr) || \
0624 curlcheck_cb_compatible((expr), curl_progress_callback) || \
0625 curlcheck_cb_compatible((expr), _curl_progress_callback1) || \
0626 curlcheck_cb_compatible((expr), _curl_progress_callback2))
0627 typedef int (*_curl_progress_callback1)(void *,
0628 double, double, double, double);
0629 typedef int (*_curl_progress_callback2)(const void *,
0630 double, double, double, double);
0631
0632
0633 #define curlcheck_debug_cb(expr) \
0634 (curlcheck_NULL(expr) || \
0635 curlcheck_cb_compatible((expr), curl_debug_callback) || \
0636 curlcheck_cb_compatible((expr), _curl_debug_callback1) || \
0637 curlcheck_cb_compatible((expr), _curl_debug_callback2) || \
0638 curlcheck_cb_compatible((expr), _curl_debug_callback3) || \
0639 curlcheck_cb_compatible((expr), _curl_debug_callback4) || \
0640 curlcheck_cb_compatible((expr), _curl_debug_callback5) || \
0641 curlcheck_cb_compatible((expr), _curl_debug_callback6) || \
0642 curlcheck_cb_compatible((expr), _curl_debug_callback7) || \
0643 curlcheck_cb_compatible((expr), _curl_debug_callback8))
0644 typedef int (*_curl_debug_callback1) (CURL *,
0645 curl_infotype, char *, size_t, void *);
0646 typedef int (*_curl_debug_callback2) (CURL *,
0647 curl_infotype, char *, size_t, const void *);
0648 typedef int (*_curl_debug_callback3) (CURL *,
0649 curl_infotype, const char *, size_t, void *);
0650 typedef int (*_curl_debug_callback4) (CURL *,
0651 curl_infotype, const char *, size_t, const void *);
0652 typedef int (*_curl_debug_callback5) (CURL *,
0653 curl_infotype, unsigned char *, size_t, void *);
0654 typedef int (*_curl_debug_callback6) (CURL *,
0655 curl_infotype, unsigned char *, size_t, const void *);
0656 typedef int (*_curl_debug_callback7) (CURL *,
0657 curl_infotype, const unsigned char *, size_t, void *);
0658 typedef int (*_curl_debug_callback8) (CURL *,
0659 curl_infotype, const unsigned char *, size_t, const void *);
0660
0661
0662
0663 #define curlcheck_ssl_ctx_cb(expr) \
0664 (curlcheck_NULL(expr) || \
0665 curlcheck_cb_compatible((expr), curl_ssl_ctx_callback) || \
0666 curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback1) || \
0667 curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback2) || \
0668 curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback3) || \
0669 curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback4) || \
0670 curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback5) || \
0671 curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback6) || \
0672 curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback7) || \
0673 curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback8))
0674 typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *);
0675 typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
0676 typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
0677 typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *,
0678 const void *);
0679 #ifdef HEADER_SSL_H
0680
0681
0682
0683 typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX *, void *);
0684 typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX *, const void *);
0685 typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX *, void *);
0686 typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX *,
0687 const void *);
0688 #else
0689 typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
0690 typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
0691 typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;
0692 typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
0693 #endif
0694
0695
0696 #define curlcheck_conv_cb(expr) \
0697 (curlcheck_NULL(expr) || \
0698 curlcheck_cb_compatible((expr), curl_conv_callback) || \
0699 curlcheck_cb_compatible((expr), _curl_conv_callback1) || \
0700 curlcheck_cb_compatible((expr), _curl_conv_callback2) || \
0701 curlcheck_cb_compatible((expr), _curl_conv_callback3) || \
0702 curlcheck_cb_compatible((expr), _curl_conv_callback4))
0703 typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
0704 typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
0705 typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
0706 typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
0707
0708
0709 #define curlcheck_seek_cb(expr) \
0710 (curlcheck_NULL(expr) || \
0711 curlcheck_cb_compatible((expr), curl_seek_callback) || \
0712 curlcheck_cb_compatible((expr), _curl_seek_callback1) || \
0713 curlcheck_cb_compatible((expr), _curl_seek_callback2))
0714 typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
0715 typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
0716
0717
0718 #endif