Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | #ifndef __CURL_CURLRULES_H |
michael@0 | 2 | #define __CURL_CURLRULES_H |
michael@0 | 3 | /*************************************************************************** |
michael@0 | 4 | * _ _ ____ _ |
michael@0 | 5 | * Project ___| | | | _ \| | |
michael@0 | 6 | * / __| | | | |_) | | |
michael@0 | 7 | * | (__| |_| | _ <| |___ |
michael@0 | 8 | * \___|\___/|_| \_\_____| |
michael@0 | 9 | * |
michael@0 | 10 | * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. |
michael@0 | 11 | * |
michael@0 | 12 | * This software is licensed as described in the file COPYING, which |
michael@0 | 13 | * you should have received as part of this distribution. The terms |
michael@0 | 14 | * are also available at http://curl.haxx.se/docs/copyright.html. |
michael@0 | 15 | * |
michael@0 | 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell |
michael@0 | 17 | * copies of the Software, and permit persons to whom the Software is |
michael@0 | 18 | * furnished to do so, under the terms of the COPYING file. |
michael@0 | 19 | * |
michael@0 | 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
michael@0 | 21 | * KIND, either express or implied. |
michael@0 | 22 | * |
michael@0 | 23 | * $Id: curlrules.h,v 1.7 2009-10-27 16:56:20 yangtse Exp $ |
michael@0 | 24 | ***************************************************************************/ |
michael@0 | 25 | |
michael@0 | 26 | /* ================================================================ */ |
michael@0 | 27 | /* COMPILE TIME SANITY CHECKS */ |
michael@0 | 28 | /* ================================================================ */ |
michael@0 | 29 | |
michael@0 | 30 | /* |
michael@0 | 31 | * NOTE 1: |
michael@0 | 32 | * ------- |
michael@0 | 33 | * |
michael@0 | 34 | * All checks done in this file are intentionally placed in a public |
michael@0 | 35 | * header file which is pulled by curl/curl.h when an application is |
michael@0 | 36 | * being built using an already built libcurl library. Additionally |
michael@0 | 37 | * this file is also included and used when building the library. |
michael@0 | 38 | * |
michael@0 | 39 | * If compilation fails on this file it is certainly sure that the |
michael@0 | 40 | * problem is elsewhere. It could be a problem in the curlbuild.h |
michael@0 | 41 | * header file, or simply that you are using different compilation |
michael@0 | 42 | * settings than those used to build the library. |
michael@0 | 43 | * |
michael@0 | 44 | * Nothing in this file is intended to be modified or adjusted by the |
michael@0 | 45 | * curl library user nor by the curl library builder. |
michael@0 | 46 | * |
michael@0 | 47 | * Do not deactivate any check, these are done to make sure that the |
michael@0 | 48 | * library is properly built and used. |
michael@0 | 49 | * |
michael@0 | 50 | * You can find further help on the libcurl development mailing list: |
michael@0 | 51 | * http://cool.haxx.se/mailman/listinfo/curl-library/ |
michael@0 | 52 | * |
michael@0 | 53 | * NOTE 2 |
michael@0 | 54 | * ------ |
michael@0 | 55 | * |
michael@0 | 56 | * Some of the following compile time checks are based on the fact |
michael@0 | 57 | * that the dimension of a constant array can not be a negative one. |
michael@0 | 58 | * In this way if the compile time verification fails, the compilation |
michael@0 | 59 | * will fail issuing an error. The error description wording is compiler |
michael@0 | 60 | * dependent but it will be quite similar to one of the following: |
michael@0 | 61 | * |
michael@0 | 62 | * "negative subscript or subscript is too large" |
michael@0 | 63 | * "array must have at least one element" |
michael@0 | 64 | * "-1 is an illegal array size" |
michael@0 | 65 | * "size of array is negative" |
michael@0 | 66 | * |
michael@0 | 67 | * If you are building an application which tries to use an already |
michael@0 | 68 | * built libcurl library and you are getting this kind of errors on |
michael@0 | 69 | * this file, it is a clear indication that there is a mismatch between |
michael@0 | 70 | * how the library was built and how you are trying to use it for your |
michael@0 | 71 | * application. Your already compiled or binary library provider is the |
michael@0 | 72 | * only one who can give you the details you need to properly use it. |
michael@0 | 73 | */ |
michael@0 | 74 | |
michael@0 | 75 | /* |
michael@0 | 76 | * Verify that some macros are actually defined. |
michael@0 | 77 | */ |
michael@0 | 78 | |
michael@0 | 79 | #ifndef CURL_SIZEOF_LONG |
michael@0 | 80 | # error "CURL_SIZEOF_LONG definition is missing!" |
michael@0 | 81 | Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing |
michael@0 | 82 | #endif |
michael@0 | 83 | |
michael@0 | 84 | #ifndef CURL_TYPEOF_CURL_SOCKLEN_T |
michael@0 | 85 | # error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!" |
michael@0 | 86 | Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing |
michael@0 | 87 | #endif |
michael@0 | 88 | |
michael@0 | 89 | #ifndef CURL_SIZEOF_CURL_SOCKLEN_T |
michael@0 | 90 | # error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!" |
michael@0 | 91 | Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing |
michael@0 | 92 | #endif |
michael@0 | 93 | |
michael@0 | 94 | #ifndef CURL_TYPEOF_CURL_OFF_T |
michael@0 | 95 | # error "CURL_TYPEOF_CURL_OFF_T definition is missing!" |
michael@0 | 96 | Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing |
michael@0 | 97 | #endif |
michael@0 | 98 | |
michael@0 | 99 | #ifndef CURL_FORMAT_CURL_OFF_T |
michael@0 | 100 | # error "CURL_FORMAT_CURL_OFF_T definition is missing!" |
michael@0 | 101 | Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing |
michael@0 | 102 | #endif |
michael@0 | 103 | |
michael@0 | 104 | #ifndef CURL_FORMAT_CURL_OFF_TU |
michael@0 | 105 | # error "CURL_FORMAT_CURL_OFF_TU definition is missing!" |
michael@0 | 106 | Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing |
michael@0 | 107 | #endif |
michael@0 | 108 | |
michael@0 | 109 | #ifndef CURL_FORMAT_OFF_T |
michael@0 | 110 | # error "CURL_FORMAT_OFF_T definition is missing!" |
michael@0 | 111 | Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing |
michael@0 | 112 | #endif |
michael@0 | 113 | |
michael@0 | 114 | #ifndef CURL_SIZEOF_CURL_OFF_T |
michael@0 | 115 | # error "CURL_SIZEOF_CURL_OFF_T definition is missing!" |
michael@0 | 116 | Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing |
michael@0 | 117 | #endif |
michael@0 | 118 | |
michael@0 | 119 | #ifndef CURL_SUFFIX_CURL_OFF_T |
michael@0 | 120 | # error "CURL_SUFFIX_CURL_OFF_T definition is missing!" |
michael@0 | 121 | Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing |
michael@0 | 122 | #endif |
michael@0 | 123 | |
michael@0 | 124 | #ifndef CURL_SUFFIX_CURL_OFF_TU |
michael@0 | 125 | # error "CURL_SUFFIX_CURL_OFF_TU definition is missing!" |
michael@0 | 126 | Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing |
michael@0 | 127 | #endif |
michael@0 | 128 | |
michael@0 | 129 | /* |
michael@0 | 130 | * Macros private to this header file. |
michael@0 | 131 | */ |
michael@0 | 132 | |
michael@0 | 133 | #define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1 |
michael@0 | 134 | |
michael@0 | 135 | #define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1 |
michael@0 | 136 | |
michael@0 | 137 | /* |
michael@0 | 138 | * Verify that the size previously defined and expected for long |
michael@0 | 139 | * is the same as the one reported by sizeof() at compile time. |
michael@0 | 140 | */ |
michael@0 | 141 | |
michael@0 | 142 | typedef char |
michael@0 | 143 | __curl_rule_01__ |
michael@0 | 144 | [CurlchkszEQ(long, CURL_SIZEOF_LONG)]; |
michael@0 | 145 | |
michael@0 | 146 | /* |
michael@0 | 147 | * Verify that the size previously defined and expected for |
michael@0 | 148 | * curl_off_t is actually the the same as the one reported |
michael@0 | 149 | * by sizeof() at compile time. |
michael@0 | 150 | */ |
michael@0 | 151 | |
michael@0 | 152 | typedef char |
michael@0 | 153 | __curl_rule_02__ |
michael@0 | 154 | [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)]; |
michael@0 | 155 | |
michael@0 | 156 | /* |
michael@0 | 157 | * Verify at compile time that the size of curl_off_t as reported |
michael@0 | 158 | * by sizeof() is greater or equal than the one reported for long |
michael@0 | 159 | * for the current compilation. |
michael@0 | 160 | */ |
michael@0 | 161 | |
michael@0 | 162 | typedef char |
michael@0 | 163 | __curl_rule_03__ |
michael@0 | 164 | [CurlchkszGE(curl_off_t, long)]; |
michael@0 | 165 | |
michael@0 | 166 | /* |
michael@0 | 167 | * Verify that the size previously defined and expected for |
michael@0 | 168 | * curl_socklen_t is actually the the same as the one reported |
michael@0 | 169 | * by sizeof() at compile time. |
michael@0 | 170 | */ |
michael@0 | 171 | |
michael@0 | 172 | typedef char |
michael@0 | 173 | __curl_rule_04__ |
michael@0 | 174 | [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)]; |
michael@0 | 175 | |
michael@0 | 176 | /* |
michael@0 | 177 | * Verify at compile time that the size of curl_socklen_t as reported |
michael@0 | 178 | * by sizeof() is greater or equal than the one reported for int for |
michael@0 | 179 | * the current compilation. |
michael@0 | 180 | */ |
michael@0 | 181 | |
michael@0 | 182 | typedef char |
michael@0 | 183 | __curl_rule_05__ |
michael@0 | 184 | [CurlchkszGE(curl_socklen_t, int)]; |
michael@0 | 185 | |
michael@0 | 186 | /* ================================================================ */ |
michael@0 | 187 | /* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */ |
michael@0 | 188 | /* ================================================================ */ |
michael@0 | 189 | |
michael@0 | 190 | /* |
michael@0 | 191 | * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow |
michael@0 | 192 | * these to be visible and exported by the external libcurl interface API, |
michael@0 | 193 | * while also making them visible to the library internals, simply including |
michael@0 | 194 | * setup.h, without actually needing to include curl.h internally. |
michael@0 | 195 | * If some day this section would grow big enough, all this should be moved |
michael@0 | 196 | * to its own header file. |
michael@0 | 197 | */ |
michael@0 | 198 | |
michael@0 | 199 | /* |
michael@0 | 200 | * Figure out if we can use the ## preprocessor operator, which is supported |
michael@0 | 201 | * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ |
michael@0 | 202 | * or __cplusplus so we need to carefully check for them too. |
michael@0 | 203 | */ |
michael@0 | 204 | |
michael@0 | 205 | #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ |
michael@0 | 206 | defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ |
michael@0 | 207 | defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ |
michael@0 | 208 | defined(__ILEC400__) |
michael@0 | 209 | /* This compiler is believed to have an ISO compatible preprocessor */ |
michael@0 | 210 | #define CURL_ISOCPP |
michael@0 | 211 | #else |
michael@0 | 212 | /* This compiler is believed NOT to have an ISO compatible preprocessor */ |
michael@0 | 213 | #undef CURL_ISOCPP |
michael@0 | 214 | #endif |
michael@0 | 215 | |
michael@0 | 216 | /* |
michael@0 | 217 | * Macros for minimum-width signed and unsigned curl_off_t integer constants. |
michael@0 | 218 | */ |
michael@0 | 219 | |
michael@0 | 220 | #ifdef CURL_ISOCPP |
michael@0 | 221 | # define __CURL_OFF_T_C_HELPER2(Val,Suffix) Val ## Suffix |
michael@0 | 222 | #else |
michael@0 | 223 | # define __CURL_OFF_T_C_HELPER2(Val,Suffix) Val/**/Suffix |
michael@0 | 224 | #endif |
michael@0 | 225 | #define __CURL_OFF_T_C_HELPER1(Val,Suffix) __CURL_OFF_T_C_HELPER2(Val,Suffix) |
michael@0 | 226 | #define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HELPER1(Val,CURL_SUFFIX_CURL_OFF_T) |
michael@0 | 227 | #define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HELPER1(Val,CURL_SUFFIX_CURL_OFF_TU) |
michael@0 | 228 | |
michael@0 | 229 | /* |
michael@0 | 230 | * Get rid of macros private to this header file. |
michael@0 | 231 | */ |
michael@0 | 232 | |
michael@0 | 233 | #undef CurlchkszEQ |
michael@0 | 234 | #undef CurlchkszGE |
michael@0 | 235 | |
michael@0 | 236 | /* |
michael@0 | 237 | * Get rid of macros not intended to exist beyond this point. |
michael@0 | 238 | */ |
michael@0 | 239 | |
michael@0 | 240 | #undef CURL_PULL_WS2TCPIP_H |
michael@0 | 241 | #undef CURL_PULL_SYS_TYPES_H |
michael@0 | 242 | #undef CURL_PULL_SYS_SOCKET_H |
michael@0 | 243 | #undef CURL_PULL_STDINT_H |
michael@0 | 244 | #undef CURL_PULL_INTTYPES_H |
michael@0 | 245 | |
michael@0 | 246 | #undef CURL_TYPEOF_CURL_SOCKLEN_T |
michael@0 | 247 | #undef CURL_TYPEOF_CURL_OFF_T |
michael@0 | 248 | |
michael@0 | 249 | #endif /* __CURL_CURLRULES_H */ |