wut  1.0.0-beta9
Wii U Toolchain
typecheck-gcc.h
Go to the documentation of this file.
1 #ifndef __CURL_TYPECHECK_GCC_H
2 #define __CURL_TYPECHECK_GCC_H
3 /***************************************************************************
4  * _ _ ____ _
5  * Project ___| | | | _ \| |
6  * / __| | | | |_) | |
7  * | (__| |_| | _ <| |___
8  * \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
11  *
12  * This software is licensed as described in the file COPYING, which
13  * you should have received as part of this distribution. The terms
14  * are also available at http://curl.haxx.se/docs/copyright.html.
15  *
16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17  * copies of the Software, and permit persons to whom the Software is
18  * furnished to do so, under the terms of the COPYING file.
19  *
20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21  * KIND, either express or implied.
22  *
23  ***************************************************************************/
24 
25 /* wraps curl_easy_setopt() with typechecking */
26 
27 /* To add a new kind of warning, add an
28  * if(_curl_is_sometype_option(_curl_opt))
29  * if(!_curl_is_sometype(value))
30  * _curl_easy_setopt_err_sometype();
31  * block and define _curl_is_sometype_option, _curl_is_sometype and
32  * _curl_easy_setopt_err_sometype below
33  *
34  * NOTE: We use two nested 'if' statements here instead of the && operator, in
35  * order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x
36  * when compiling with -Wlogical-op.
37  *
38  * To add an option that uses the same type as an existing option, you'll just
39  * need to extend the appropriate _curl_*_option macro
40  */
41 #define curl_easy_setopt(handle, option, value) \
42 __extension__ ({ \
43  __typeof__ (option) _curl_opt = option; \
44  if(__builtin_constant_p(_curl_opt)) { \
45  if(_curl_is_long_option(_curl_opt)) \
46  if(!_curl_is_long(value)) \
47  _curl_easy_setopt_err_long(); \
48  if(_curl_is_off_t_option(_curl_opt)) \
49  if(!_curl_is_off_t(value)) \
50  _curl_easy_setopt_err_curl_off_t(); \
51  if(_curl_is_string_option(_curl_opt)) \
52  if(!_curl_is_string(value)) \
53  _curl_easy_setopt_err_string(); \
54  if(_curl_is_write_cb_option(_curl_opt)) \
55  if(!_curl_is_write_cb(value)) \
56  _curl_easy_setopt_err_write_callback(); \
57  if((_curl_opt) == CURLOPT_READFUNCTION) \
58  if(!_curl_is_read_cb(value)) \
59  _curl_easy_setopt_err_read_cb(); \
60  if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \
61  if(!_curl_is_ioctl_cb(value)) \
62  _curl_easy_setopt_err_ioctl_cb(); \
63  if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \
64  if(!_curl_is_sockopt_cb(value)) \
65  _curl_easy_setopt_err_sockopt_cb(); \
66  if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \
67  if(!_curl_is_opensocket_cb(value)) \
68  _curl_easy_setopt_err_opensocket_cb(); \
69  if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \
70  if(!_curl_is_progress_cb(value)) \
71  _curl_easy_setopt_err_progress_cb(); \
72  if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \
73  if(!_curl_is_debug_cb(value)) \
74  _curl_easy_setopt_err_debug_cb(); \
75  if(_curl_is_conv_cb_option(_curl_opt)) \
76  if(!_curl_is_conv_cb(value)) \
77  _curl_easy_setopt_err_conv_cb(); \
78  if((_curl_opt) == CURLOPT_SEEKFUNCTION) \
79  if(!_curl_is_seek_cb(value)) \
80  _curl_easy_setopt_err_seek_cb(); \
81  if(_curl_is_cb_data_option(_curl_opt)) \
82  if(!_curl_is_cb_data(value)) \
83  _curl_easy_setopt_err_cb_data(); \
84  if((_curl_opt) == CURLOPT_ERRORBUFFER) \
85  if(!_curl_is_error_buffer(value)) \
86  _curl_easy_setopt_err_error_buffer(); \
87  if((_curl_opt) == CURLOPT_STDERR) \
88  if(!_curl_is_FILE(value)) \
89  _curl_easy_setopt_err_FILE(); \
90  if(_curl_is_postfields_option(_curl_opt)) \
91  if(!_curl_is_postfields(value)) \
92  _curl_easy_setopt_err_postfields(); \
93  if((_curl_opt) == CURLOPT_HTTPPOST) \
94  if(!_curl_is_arr((value), struct curl_httppost)) \
95  _curl_easy_setopt_err_curl_httpost(); \
96  if(_curl_is_slist_option(_curl_opt)) \
97  if(!_curl_is_arr((value), struct curl_slist)) \
98  _curl_easy_setopt_err_curl_slist(); \
99  if((_curl_opt) == CURLOPT_SHARE) \
100  if(!_curl_is_ptr((value), CURLSH)) \
101  _curl_easy_setopt_err_CURLSH(); \
102  } \
103  curl_easy_setopt(handle, _curl_opt, value); \
104 })
105 
106 /* wraps curl_easy_getinfo() with typechecking */
107 /* FIXME: don't allow const pointers */
108 #define curl_easy_getinfo(handle, info, arg) \
109 __extension__ ({ \
110  __typeof__ (info) _curl_info = info; \
111  if(__builtin_constant_p(_curl_info)) { \
112  if(_curl_is_string_info(_curl_info)) \
113  if(!_curl_is_arr((arg), char *)) \
114  _curl_easy_getinfo_err_string(); \
115  if(_curl_is_long_info(_curl_info)) \
116  if(!_curl_is_arr((arg), long)) \
117  _curl_easy_getinfo_err_long(); \
118  if(_curl_is_double_info(_curl_info)) \
119  if(!_curl_is_arr((arg), double)) \
120  _curl_easy_getinfo_err_double(); \
121  if(_curl_is_slist_info(_curl_info)) \
122  if(!_curl_is_arr((arg), struct curl_slist *)) \
123  _curl_easy_getinfo_err_curl_slist(); \
124  } \
125  curl_easy_getinfo(handle, _curl_info, arg); \
126 })
127 
128 /* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),
129  * for now just make sure that the functions are called with three
130  * arguments
131  */
132 #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
133 #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
134 
135 
136 /* the actual warnings, triggered by calling the _curl_easy_setopt_err*
137  * functions */
138 
139 /* To define a new warning, use _CURL_WARNING(identifier, "message") */
140 #define _CURL_WARNING(id, message) \
141  static void __attribute__((warning(message))) __attribute__((unused)) \
142  __attribute__((noinline)) id(void) { __asm__(""); }
143 
144 _CURL_WARNING(_curl_easy_setopt_err_long,
145  "curl_easy_setopt expects a long argument for this option")
146 _CURL_WARNING(_curl_easy_setopt_err_curl_off_t,
147  "curl_easy_setopt expects a curl_off_t argument for this option")
148 _CURL_WARNING(_curl_easy_setopt_err_string,
149  "curl_easy_setopt expects a "
150  "string (char* or char[]) argument for this option"
151  )
152 _CURL_WARNING(_curl_easy_setopt_err_write_callback,
153  "curl_easy_setopt expects a curl_write_callback argument for this option")
154 _CURL_WARNING(_curl_easy_setopt_err_read_cb,
155  "curl_easy_setopt expects a curl_read_callback argument for this option")
156 _CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,
157  "curl_easy_setopt expects a curl_ioctl_callback argument for this option")
158 _CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,
159  "curl_easy_setopt expects a curl_sockopt_callback argument for this option")
160 _CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,
161  "curl_easy_setopt expects a "
162  "curl_opensocket_callback argument for this option"
163  )
164 _CURL_WARNING(_curl_easy_setopt_err_progress_cb,
165  "curl_easy_setopt expects a curl_progress_callback argument for this option")
166 _CURL_WARNING(_curl_easy_setopt_err_debug_cb,
167  "curl_easy_setopt expects a curl_debug_callback argument for this option")
168 _CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,
169  "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
170 _CURL_WARNING(_curl_easy_setopt_err_conv_cb,
171  "curl_easy_setopt expects a curl_conv_callback argument for this option")
172 _CURL_WARNING(_curl_easy_setopt_err_seek_cb,
173  "curl_easy_setopt expects a curl_seek_callback argument for this option")
174 _CURL_WARNING(_curl_easy_setopt_err_cb_data,
175  "curl_easy_setopt expects a "
176  "private data pointer as argument for this option")
177 _CURL_WARNING(_curl_easy_setopt_err_error_buffer,
178  "curl_easy_setopt expects a "
179  "char buffer of CURL_ERROR_SIZE as argument for this option")
180 _CURL_WARNING(_curl_easy_setopt_err_FILE,
181  "curl_easy_setopt expects a FILE* argument for this option")
182 _CURL_WARNING(_curl_easy_setopt_err_postfields,
183  "curl_easy_setopt expects a void* or char* argument for this option")
184 _CURL_WARNING(_curl_easy_setopt_err_curl_httpost,
185  "curl_easy_setopt expects a struct curl_httppost* argument for this option")
186 _CURL_WARNING(_curl_easy_setopt_err_curl_slist,
187  "curl_easy_setopt expects a struct curl_slist* argument for this option")
188 _CURL_WARNING(_curl_easy_setopt_err_CURLSH,
189  "curl_easy_setopt expects a CURLSH* argument for this option")
190 
191 _CURL_WARNING(_curl_easy_getinfo_err_string,
192  "curl_easy_getinfo expects a pointer to char * for this info")
193 _CURL_WARNING(_curl_easy_getinfo_err_long,
194  "curl_easy_getinfo expects a pointer to long for this info")
195 _CURL_WARNING(_curl_easy_getinfo_err_double,
196  "curl_easy_getinfo expects a pointer to double for this info")
197 _CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
198  "curl_easy_getinfo expects a pointer to struct curl_slist * for this info")
199 
200 /* groups of curl_easy_setops options that take the same type of argument */
201 
202 /* To add a new option to one of the groups, just add
203  * (option) == CURLOPT_SOMETHING
204  * to the or-expression. If the option takes a long or curl_off_t, you don't
205  * have to do anything
206  */
207 
208 /* evaluates to true if option takes a long argument */
209 #define _curl_is_long_option(option) \
210  (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
211 
212 #define _curl_is_off_t_option(option) \
213  ((option) > CURLOPTTYPE_OFF_T)
214 
215 /* evaluates to true if option takes a char* argument */
216 #define _curl_is_string_option(option) \
217  ((option) == CURLOPT_URL || \
218  (option) == CURLOPT_PROXY || \
219  (option) == CURLOPT_INTERFACE || \
220  (option) == CURLOPT_NETRC_FILE || \
221  (option) == CURLOPT_USERPWD || \
222  (option) == CURLOPT_USERNAME || \
223  (option) == CURLOPT_PASSWORD || \
224  (option) == CURLOPT_PROXYUSERPWD || \
225  (option) == CURLOPT_PROXYUSERNAME || \
226  (option) == CURLOPT_PROXYPASSWORD || \
227  (option) == CURLOPT_NOPROXY || \
228  (option) == CURLOPT_ACCEPT_ENCODING || \
229  (option) == CURLOPT_REFERER || \
230  (option) == CURLOPT_USERAGENT || \
231  (option) == CURLOPT_COOKIE || \
232  (option) == CURLOPT_COOKIEFILE || \
233  (option) == CURLOPT_COOKIEJAR || \
234  (option) == CURLOPT_COOKIELIST || \
235  (option) == CURLOPT_FTPPORT || \
236  (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \
237  (option) == CURLOPT_FTP_ACCOUNT || \
238  (option) == CURLOPT_RANGE || \
239  (option) == CURLOPT_CUSTOMREQUEST || \
240  (option) == CURLOPT_KRBLEVEL || \
241  (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \
242  (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \
243  (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \
244  (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \
245  (option) == CURLOPT_SSH_KNOWNHOSTS || \
246  (option) == CURLOPT_MAIL_FROM || \
247  (option) == CURLOPT_RTSP_SESSION_ID || \
248  (option) == CURLOPT_RTSP_STREAM_URI || \
249  (option) == CURLOPT_RTSP_TRANSPORT || \
250  0)
251 
252 /* evaluates to true if option takes a curl_write_callback argument */
253 #define _curl_is_write_cb_option(option) \
254  ((option) == CURLOPT_HEADERFUNCTION || \
255  (option) == CURLOPT_WRITEFUNCTION)
256 
257 /* evaluates to true if option takes a curl_conv_callback argument */
258 #define _curl_is_conv_cb_option(option) \
259  ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \
260  (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \
261  (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
262 
263 /* evaluates to true if option takes a data argument to pass to a callback */
264 #define _curl_is_cb_data_option(option) \
265  ((option) == CURLOPT_WRITEDATA || \
266  (option) == CURLOPT_READDATA || \
267  (option) == CURLOPT_IOCTLDATA || \
268  (option) == CURLOPT_SOCKOPTDATA || \
269  (option) == CURLOPT_OPENSOCKETDATA || \
270  (option) == CURLOPT_PROGRESSDATA || \
271  (option) == CURLOPT_WRITEHEADER || \
272  (option) == CURLOPT_DEBUGDATA || \
273  (option) == CURLOPT_SEEKDATA || \
274  (option) == CURLOPT_PRIVATE || \
275  (option) == CURLOPT_SSH_KEYDATA || \
276  (option) == CURLOPT_INTERLEAVEDATA || \
277  (option) == CURLOPT_CHUNK_DATA || \
278  (option) == CURLOPT_FNMATCH_DATA || \
279  0)
280 
281 /* evaluates to true if option takes a POST data argument (void* or char*) */
282 #define _curl_is_postfields_option(option) \
283  ((option) == CURLOPT_POSTFIELDS || \
284  (option) == CURLOPT_COPYPOSTFIELDS || \
285  0)
286 
287 /* evaluates to true if option takes a struct curl_slist * argument */
288 #define _curl_is_slist_option(option) \
289  ((option) == CURLOPT_HTTPHEADER || \
290  (option) == CURLOPT_HTTP200ALIASES || \
291  (option) == CURLOPT_QUOTE || \
292  (option) == CURLOPT_POSTQUOTE || \
293  (option) == CURLOPT_PREQUOTE || \
294  (option) == CURLOPT_TELNETOPTIONS || \
295  (option) == CURLOPT_MAIL_RCPT || \
296  0)
297 
298 /* groups of curl_easy_getinfo infos that take the same type of argument */
299 
300 /* evaluates to true if info expects a pointer to char * argument */
301 #define _curl_is_string_info(info) \
302  (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)
303 
304 /* evaluates to true if info expects a pointer to long argument */
305 #define _curl_is_long_info(info) \
306  (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
307 
308 /* evaluates to true if info expects a pointer to double argument */
309 #define _curl_is_double_info(info) \
310  (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
311 
312 /* true if info expects a pointer to struct curl_slist * argument */
313 #define _curl_is_slist_info(info) \
314  (CURLINFO_SLIST < (info))
315 
316 
317 /* typecheck helpers -- check whether given expression has requested type*/
318 
319 /* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,
320  * otherwise define a new macro. Search for __builtin_types_compatible_p
321  * in the GCC manual.
322  * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
323  * the actual expression passed to the curl_easy_setopt macro. This
324  * means that you can only apply the sizeof and __typeof__ operators, no
325  * == or whatsoever.
326  */
327 
328 /* XXX: should evaluate to true iff expr is a pointer */
329 #define _curl_is_any_ptr(expr) \
330  (sizeof(expr) == sizeof(void*))
331 
332 /* evaluates to true if expr is NULL */
333 /* XXX: must not evaluate expr, so this check is not accurate */
334 #define _curl_is_NULL(expr) \
335  (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
336 
337 /* evaluates to true if expr is type*, const type* or NULL */
338 #define _curl_is_ptr(expr, type) \
339  (_curl_is_NULL(expr) || \
340  __builtin_types_compatible_p(__typeof__(expr), type *) || \
341  __builtin_types_compatible_p(__typeof__(expr), const type *))
342 
343 /* evaluates to true if expr is one of type[], type*, NULL or const type* */
344 #define _curl_is_arr(expr, type) \
345  (_curl_is_ptr((expr), type) || \
346  __builtin_types_compatible_p(__typeof__(expr), type []))
347 
348 /* evaluates to true if expr is a string */
349 #define _curl_is_string(expr) \
350  (_curl_is_arr((expr), char) || \
351  _curl_is_arr((expr), signed char) || \
352  _curl_is_arr((expr), unsigned char))
353 
354 /* evaluates to true if expr is a long (no matter the signedness)
355  * XXX: for now, int is also accepted (and therefore short and char, which
356  * are promoted to int when passed to a variadic function) */
357 #define _curl_is_long(expr) \
358  (__builtin_types_compatible_p(__typeof__(expr), long) || \
359  __builtin_types_compatible_p(__typeof__(expr), signed long) || \
360  __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \
361  __builtin_types_compatible_p(__typeof__(expr), int) || \
362  __builtin_types_compatible_p(__typeof__(expr), signed int) || \
363  __builtin_types_compatible_p(__typeof__(expr), unsigned int) || \
364  __builtin_types_compatible_p(__typeof__(expr), short) || \
365  __builtin_types_compatible_p(__typeof__(expr), signed short) || \
366  __builtin_types_compatible_p(__typeof__(expr), unsigned short) || \
367  __builtin_types_compatible_p(__typeof__(expr), char) || \
368  __builtin_types_compatible_p(__typeof__(expr), signed char) || \
369  __builtin_types_compatible_p(__typeof__(expr), unsigned char))
370 
371 /* evaluates to true if expr is of type curl_off_t */
372 #define _curl_is_off_t(expr) \
373  (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
374 
375 /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
376 /* XXX: also check size of an char[] array? */
377 #define _curl_is_error_buffer(expr) \
378  (__builtin_types_compatible_p(__typeof__(expr), char *) || \
379  __builtin_types_compatible_p(__typeof__(expr), char[]))
380 
381 /* evaluates to true if expr is of type (const) void* or (const) FILE* */
382 #if 0
383 #define _curl_is_cb_data(expr) \
384  (_curl_is_ptr((expr), void) || \
385  _curl_is_ptr((expr), FILE))
386 #else /* be less strict */
387 #define _curl_is_cb_data(expr) \
388  _curl_is_any_ptr(expr)
389 #endif
390 
391 /* evaluates to true if expr is of type FILE* */
392 #define _curl_is_FILE(expr) \
393  (__builtin_types_compatible_p(__typeof__(expr), FILE *))
394 
395 /* evaluates to true if expr can be passed as POST data (void* or char*) */
396 #define _curl_is_postfields(expr) \
397  (_curl_is_ptr((expr), void) || \
398  _curl_is_arr((expr), char))
399 
400 /* FIXME: the whole callback checking is messy...
401  * The idea is to tolerate char vs. void and const vs. not const
402  * pointers in arguments at least
403  */
404 /* helper: __builtin_types_compatible_p distinguishes between functions and
405  * function pointers, hide it */
406 #define _curl_callback_compatible(func, type) \
407  (__builtin_types_compatible_p(__typeof__(func), type) || \
408  __builtin_types_compatible_p(__typeof__(func), type*))
409 
410 /* evaluates to true if expr is of type curl_read_callback or "similar" */
411 #define _curl_is_read_cb(expr) \
412  (_curl_is_NULL(expr) || \
413  __builtin_types_compatible_p(__typeof__(expr), __typeof__(fread)) || \
414  __builtin_types_compatible_p(__typeof__(expr), curl_read_callback) || \
415  _curl_callback_compatible((expr), _curl_read_callback1) || \
416  _curl_callback_compatible((expr), _curl_read_callback2) || \
417  _curl_callback_compatible((expr), _curl_read_callback3) || \
418  _curl_callback_compatible((expr), _curl_read_callback4) || \
419  _curl_callback_compatible((expr), _curl_read_callback5) || \
420  _curl_callback_compatible((expr), _curl_read_callback6))
421 typedef size_t (_curl_read_callback1)(char *, size_t, size_t, void*);
422 typedef size_t (_curl_read_callback2)(char *, size_t, size_t, const void*);
423 typedef size_t (_curl_read_callback3)(char *, size_t, size_t, FILE*);
424 typedef size_t (_curl_read_callback4)(void *, size_t, size_t, void*);
425 typedef size_t (_curl_read_callback5)(void *, size_t, size_t, const void*);
426 typedef size_t (_curl_read_callback6)(void *, size_t, size_t, FILE*);
427 
428 /* evaluates to true if expr is of type curl_write_callback or "similar" */
429 #define _curl_is_write_cb(expr) \
430  (_curl_is_read_cb(expr) || \
431  __builtin_types_compatible_p(__typeof__(expr), __typeof__(fwrite)) || \
432  __builtin_types_compatible_p(__typeof__(expr), curl_write_callback) || \
433  _curl_callback_compatible((expr), _curl_write_callback1) || \
434  _curl_callback_compatible((expr), _curl_write_callback2) || \
435  _curl_callback_compatible((expr), _curl_write_callback3) || \
436  _curl_callback_compatible((expr), _curl_write_callback4) || \
437  _curl_callback_compatible((expr), _curl_write_callback5) || \
438  _curl_callback_compatible((expr), _curl_write_callback6))
439 typedef size_t (_curl_write_callback1)(const char *, size_t, size_t, void*);
440 typedef size_t (_curl_write_callback2)(const char *, size_t, size_t,
441  const void*);
442 typedef size_t (_curl_write_callback3)(const char *, size_t, size_t, FILE*);
443 typedef size_t (_curl_write_callback4)(const void *, size_t, size_t, void*);
444 typedef size_t (_curl_write_callback5)(const void *, size_t, size_t,
445  const void*);
446 typedef size_t (_curl_write_callback6)(const void *, size_t, size_t, FILE*);
447 
448 /* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
449 #define _curl_is_ioctl_cb(expr) \
450  (_curl_is_NULL(expr) || \
451  __builtin_types_compatible_p(__typeof__(expr), curl_ioctl_callback) || \
452  _curl_callback_compatible((expr), _curl_ioctl_callback1) || \
453  _curl_callback_compatible((expr), _curl_ioctl_callback2) || \
454  _curl_callback_compatible((expr), _curl_ioctl_callback3) || \
455  _curl_callback_compatible((expr), _curl_ioctl_callback4))
456 typedef curlioerr (_curl_ioctl_callback1)(CURL *, int, void*);
457 typedef curlioerr (_curl_ioctl_callback2)(CURL *, int, const void*);
459 typedef curlioerr (_curl_ioctl_callback4)(CURL *, curliocmd, const void*);
460 
461 /* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
462 #define _curl_is_sockopt_cb(expr) \
463  (_curl_is_NULL(expr) || \
464  __builtin_types_compatible_p(__typeof__(expr), curl_sockopt_callback) || \
465  _curl_callback_compatible((expr), _curl_sockopt_callback1) || \
466  _curl_callback_compatible((expr), _curl_sockopt_callback2))
468 typedef int (_curl_sockopt_callback2)(const void *, curl_socket_t,
469  curlsocktype);
470 
471 /* evaluates to true if expr is of type curl_opensocket_callback or
472  "similar" */
473 #define _curl_is_opensocket_cb(expr) \
474  (_curl_is_NULL(expr) || \
475  __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\
476  _curl_callback_compatible((expr), _curl_opensocket_callback1) || \
477  _curl_callback_compatible((expr), _curl_opensocket_callback2) || \
478  _curl_callback_compatible((expr), _curl_opensocket_callback3) || \
479  _curl_callback_compatible((expr), _curl_opensocket_callback4))
481  (void *, curlsocktype, struct curl_sockaddr *);
483  (void *, curlsocktype, const struct curl_sockaddr *);
485  (const void *, curlsocktype, struct curl_sockaddr *);
487  (const void *, curlsocktype, const struct curl_sockaddr *);
488 
489 /* evaluates to true if expr is of type curl_progress_callback or "similar" */
490 #define _curl_is_progress_cb(expr) \
491  (_curl_is_NULL(expr) || \
492  __builtin_types_compatible_p(__typeof__(expr), curl_progress_callback) || \
493  _curl_callback_compatible((expr), _curl_progress_callback1) || \
494  _curl_callback_compatible((expr), _curl_progress_callback2))
495 typedef int (_curl_progress_callback1)(void *,
496  double, double, double, double);
497 typedef int (_curl_progress_callback2)(const void *,
498  double, double, double, double);
499 
500 /* evaluates to true if expr is of type curl_debug_callback or "similar" */
501 #define _curl_is_debug_cb(expr) \
502  (_curl_is_NULL(expr) || \
503  __builtin_types_compatible_p(__typeof__(expr), curl_debug_callback) || \
504  _curl_callback_compatible((expr), _curl_debug_callback1) || \
505  _curl_callback_compatible((expr), _curl_debug_callback2) || \
506  _curl_callback_compatible((expr), _curl_debug_callback3) || \
507  _curl_callback_compatible((expr), _curl_debug_callback4))
508 typedef int (_curl_debug_callback1) (CURL *,
509  curl_infotype, char *, size_t, void *);
510 typedef int (_curl_debug_callback2) (CURL *,
511  curl_infotype, char *, size_t, const void *);
512 typedef int (_curl_debug_callback3) (CURL *,
513  curl_infotype, const char *, size_t, void *);
514 typedef int (_curl_debug_callback4) (CURL *,
515  curl_infotype, const char *, size_t, const void *);
516 
517 /* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
518 /* this is getting even messier... */
519 #define _curl_is_ssl_ctx_cb(expr) \
520  (_curl_is_NULL(expr) || \
521  __builtin_types_compatible_p(__typeof__(expr), curl_ssl_ctx_callback) || \
522  _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) || \
523  _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) || \
524  _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) || \
525  _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) || \
526  _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) || \
527  _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) || \
528  _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) || \
529  _curl_callback_compatible((expr), _curl_ssl_ctx_callback8))
530 typedef CURLcode (_curl_ssl_ctx_callback1)(CURL *, void *, void *);
531 typedef CURLcode (_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
532 typedef CURLcode (_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
533 typedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *);
534 #ifdef HEADER_SSL_H
535 /* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
536  * this will of course break if we're included before OpenSSL headers...
537  */
538 typedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);
539 typedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);
540 typedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);
541 typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,
542  const void *);
543 #else
548 #endif
549 
550 /* evaluates to true if expr is of type curl_conv_callback or "similar" */
551 #define _curl_is_conv_cb(expr) \
552  (_curl_is_NULL(expr) || \
553  __builtin_types_compatible_p(__typeof__(expr), curl_conv_callback) || \
554  _curl_callback_compatible((expr), _curl_conv_callback1) || \
555  _curl_callback_compatible((expr), _curl_conv_callback2) || \
556  _curl_callback_compatible((expr), _curl_conv_callback3) || \
557  _curl_callback_compatible((expr), _curl_conv_callback4))
558 typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
559 typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
560 typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
561 typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
562 
563 /* evaluates to true if expr is of type curl_seek_callback or "similar" */
564 #define _curl_is_seek_cb(expr) \
565  (_curl_is_NULL(expr) || \
566  __builtin_types_compatible_p(__typeof__(expr), curl_seek_callback) || \
567  _curl_callback_compatible((expr), _curl_seek_callback1) || \
568  _curl_callback_compatible((expr), _curl_seek_callback2))
569 typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
570 typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
571 
572 
573 #endif /* __CURL_TYPECHECK_GCC_H */
_curl_ssl_ctx_callback4
CURLcode() _curl_ssl_ctx_callback4(CURL *, const void *, const void *)
Definition: typecheck-gcc.h:533
_curl_ioctl_callback2
curlioerr() _curl_ioctl_callback2(CURL *, int, const void *)
Definition: typecheck-gcc.h:457
_curl_ioctl_callback3
curlioerr() _curl_ioctl_callback3(CURL *, curliocmd, void *)
Definition: typecheck-gcc.h:458
_curl_write_callback1
size_t() _curl_write_callback1(const char *, size_t, size_t, void *)
Definition: typecheck-gcc.h:439
_curl_read_callback4
size_t() _curl_read_callback4(void *, size_t, size_t, void *)
Definition: typecheck-gcc.h:424
_curl_progress_callback2
int() _curl_progress_callback2(const void *, double, double, double, double)
Definition: typecheck-gcc.h:497
_curl_conv_callback1
CURLcode(* _curl_conv_callback1)(char *, size_t length)
Definition: typecheck-gcc.h:558
_curl_progress_callback1
int() _curl_progress_callback1(void *, double, double, double, double)
Definition: typecheck-gcc.h:495
_curl_conv_callback3
CURLcode(* _curl_conv_callback3)(void *, size_t length)
Definition: typecheck-gcc.h:560
curl_write_callback
size_t(* curl_write_callback)(char *buffer, size_t size, size_t nitems, void *outstream)
Definition: curl.h:125
_curl_read_callback5
size_t() _curl_read_callback5(void *, size_t, size_t, const void *)
Definition: typecheck-gcc.h:425
curl_infotype
curl_infotype
Definition: curl.h:304
curl_read_callback
size_t(* curl_read_callback)(char *buffer, size_t size, size_t nitems, void *instream)
Definition: curl.h:236
_curl_write_callback5
size_t() _curl_write_callback5(const void *, size_t, size_t, const void *)
Definition: typecheck-gcc.h:444
_curl_ssl_ctx_callback3
CURLcode() _curl_ssl_ctx_callback3(CURL *, const void *, void *)
Definition: typecheck-gcc.h:532
_curl_ioctl_callback1
curlioerr() _curl_ioctl_callback1(CURL *, int, void *)
Definition: typecheck-gcc.h:456
_curl_sockopt_callback2
int() _curl_sockopt_callback2(const void *, curl_socket_t, curlsocktype)
Definition: typecheck-gcc.h:468
curl_opensocket_callback
curl_socket_t(* curl_opensocket_callback)(void *clientp, curlsocktype purpose, struct curl_sockaddr *address)
Definition: curl.h:267
CURLSH
void CURLSH
Definition: curl.h:1861
_curl_ssl_ctx_callback1
CURLcode() _curl_ssl_ctx_callback1(CURL *, void *, void *)
Definition: typecheck-gcc.h:530
_curl_sockopt_callback1
int() _curl_sockopt_callback1(void *, curl_socket_t, curlsocktype)
Definition: typecheck-gcc.h:467
curlioerr
curlioerr
Definition: curl.h:274
_curl_seek_callback2
CURLcode(* _curl_seek_callback2)(const void *, curl_off_t, int)
Definition: typecheck-gcc.h:570
CURL_ERROR_SIZE
#define CURL_ERROR_SIZE
Definition: curl.h:542
_curl_opensocket_callback4
curl_socket_t() _curl_opensocket_callback4(const void *, curlsocktype, const struct curl_sockaddr *)
Definition: typecheck-gcc.h:487
curl_slist
Definition: curl.h:1702
_curl_write_callback4
size_t() _curl_write_callback4(const void *, size_t, size_t, void *)
Definition: typecheck-gcc.h:443
curl_easy_getinfo
#define curl_easy_getinfo(handle, info, arg)
Definition: typecheck-gcc.h:108
curl_easy_setopt
#define curl_easy_setopt(handle, option, value)
Definition: typecheck-gcc.h:41
curl_sockaddr
Definition: curl.h:256
curl_ssl_ctx_callback
CURLcode(* curl_ssl_ctx_callback)(CURL *curl, void *ssl_ctx, void *userptr)
Definition: curl.h:505
_curl_conv_callback2
CURLcode(* _curl_conv_callback2)(const char *, size_t length)
Definition: typecheck-gcc.h:559
curlsocktype
curlsocktype
Definition: curl.h:241
_curl_write_callback3
size_t() _curl_write_callback3(const char *, size_t, size_t, FILE *)
Definition: typecheck-gcc.h:442
_curl_ioctl_callback4
curlioerr() _curl_ioctl_callback4(CURL *, curliocmd, const void *)
Definition: typecheck-gcc.h:459
curl_socket_t
int curl_socket_t
Definition: curl.h:64
curliocmd
curliocmd
Definition: curl.h:281
_curl_ssl_ctx_callback6
_curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6
Definition: typecheck-gcc.h:545
curl_httppost
Definition: curl.h:69
_curl_debug_callback1
int() _curl_debug_callback1(CURL *, curl_infotype, char *, size_t, void *)
Definition: typecheck-gcc.h:508
_curl_write_callback2
size_t() _curl_write_callback2(const char *, size_t, size_t, const void *)
Definition: typecheck-gcc.h:440
_curl_write_callback6
size_t() _curl_write_callback6(const void *, size_t, size_t, FILE *)
Definition: typecheck-gcc.h:446
_curl_ssl_ctx_callback7
_curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7
Definition: typecheck-gcc.h:546
_curl_seek_callback1
CURLcode(* _curl_seek_callback1)(void *, curl_off_t, int)
Definition: typecheck-gcc.h:569
curl_progress_callback
int(* curl_progress_callback)(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
Definition: curl.h:98
_curl_ssl_ctx_callback2
CURLcode() _curl_ssl_ctx_callback2(CURL *, void *, const void *)
Definition: typecheck-gcc.h:531
curl_off_t
CURL_TYPEOF_CURL_OFF_T curl_off_t
Definition: curlbuild.h:172
_curl_read_callback2
size_t() _curl_read_callback2(char *, size_t, size_t, const void *)
Definition: typecheck-gcc.h:422
CURL
void CURL
Definition: curl.h:48
curl_seek_callback
int(* curl_seek_callback)(void *instream, curl_off_t offset, int origin)
Definition: curl.h:225
_CURL_WARNING
#define _CURL_WARNING(id, message)
Definition: typecheck-gcc.h:140
_curl_read_callback6
size_t() _curl_read_callback6(void *, size_t, size_t, FILE *)
Definition: typecheck-gcc.h:426
_curl_debug_callback4
int() _curl_debug_callback4(CURL *, curl_infotype, const char *, size_t, const void *)
Definition: typecheck-gcc.h:514
_curl_read_callback3
size_t() _curl_read_callback3(char *, size_t, size_t, FILE *)
Definition: typecheck-gcc.h:423
_curl_debug_callback2
int() _curl_debug_callback2(CURL *, curl_infotype, char *, size_t, const void *)
Definition: typecheck-gcc.h:510
curl_debug_callback
int(* curl_debug_callback)(CURL *handle, curl_infotype type, char *data, size_t size, void *userptr)
Definition: curl.h:316
curl_sockopt_callback
int(* curl_sockopt_callback)(void *clientp, curl_socket_t curlfd, curlsocktype purpose)
Definition: curl.h:252
CURLMsg::data
union CURLMsg::@4 data
curl_conv_callback
CURLcode(* curl_conv_callback)(char *buffer, size_t length)
Definition: curl.h:503
_curl_opensocket_callback3
curl_socket_t() _curl_opensocket_callback3(const void *, curlsocktype, struct curl_sockaddr *)
Definition: typecheck-gcc.h:485
curl_ioctl_callback
curlioerr(* curl_ioctl_callback)(CURL *handle, int cmd, void *clientp)
Definition: curl.h:287
_curl_read_callback1
size_t() _curl_read_callback1(char *, size_t, size_t, void *)
Definition: typecheck-gcc.h:421
_curl_opensocket_callback1
curl_socket_t() _curl_opensocket_callback1(void *, curlsocktype, struct curl_sockaddr *)
Definition: typecheck-gcc.h:481
_curl_debug_callback3
int() _curl_debug_callback3(CURL *, curl_infotype, const char *, size_t, void *)
Definition: typecheck-gcc.h:512
_curl_conv_callback4
CURLcode(* _curl_conv_callback4)(const void *, size_t length)
Definition: typecheck-gcc.h:561
CURLcode
CURLcode
Definition: curl.h:329
_curl_opensocket_callback2
curl_socket_t() _curl_opensocket_callback2(void *, curlsocktype, const struct curl_sockaddr *)
Definition: typecheck-gcc.h:483
_curl_ssl_ctx_callback5
_curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5
Definition: typecheck-gcc.h:544
_curl_ssl_ctx_callback8
_curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8
Definition: typecheck-gcc.h:547