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