Planeshift
|
00001 #ifndef __CURL_CURLRULES_H 00002 #define __CURL_CURLRULES_H 00003 /*************************************************************************** 00004 * _ _ ____ _ 00005 * Project ___| | | | _ \| | 00006 * / __| | | | |_) | | 00007 * | (__| |_| | _ <| |___ 00008 * \___|\___/|_| \_\_____| 00009 * 00010 * Copyright (C) 1998 - 2009, Daniel Stenberg, <[email protected]>, et al. 00011 * 00012 * This software is licensed as described in the file COPYING, which 00013 * you should have received as part of this distribution. The terms 00014 * are also available at http://curl.haxx.se/docs/copyright.html. 00015 * 00016 * You may opt to use, copy, modify, merge, publish, distribute and/or sell 00017 * copies of the Software, and permit persons to whom the Software is 00018 * furnished to do so, under the terms of the COPYING file. 00019 * 00020 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 00021 * KIND, either express or implied. 00022 * 00023 * $Id: curlrules.h 8795 2013-09-14 06:15:05Z joelyon $ 00024 ***************************************************************************/ 00025 00026 /* ================================================================ */ 00027 /* COMPILE TIME SANITY CHECKS */ 00028 /* ================================================================ */ 00029 00030 /* 00031 * NOTE 1: 00032 * ------- 00033 * 00034 * All checks done in this file are intentionally placed in a public 00035 * header file which is pulled by curl/curl.h when an application is 00036 * being built using an already built libcurl library. Additionally 00037 * this file is also included and used when building the library. 00038 * 00039 * If compilation fails on this file it is certainly sure that the 00040 * problem is elsewhere. It could be a problem in the curlbuild.h 00041 * header file, or simply that you are using different compilation 00042 * settings than those used to build the library. 00043 * 00044 * Nothing in this file is intended to be modified or adjusted by the 00045 * curl library user nor by the curl library builder. 00046 * 00047 * Do not deactivate any check, these are done to make sure that the 00048 * library is properly built and used. 00049 * 00050 * You can find further help on the libcurl development mailing list: 00051 * http://cool.haxx.se/mailman/listinfo/curl-library/ 00052 * 00053 * NOTE 2 00054 * ------ 00055 * 00056 * Some of the following compile time checks are based on the fact 00057 * that the dimension of a constant array can not be a negative one. 00058 * In this way if the compile time verification fails, the compilation 00059 * will fail issuing an error. The error description wording is compiler 00060 * dependent but it will be quite similar to one of the following: 00061 * 00062 * "negative subscript or subscript is too large" 00063 * "array must have at least one element" 00064 * "-1 is an illegal array size" 00065 * "size of array is negative" 00066 * 00067 * If you are building an application which tries to use an already 00068 * built libcurl library and you are getting this kind of errors on 00069 * this file, it is a clear indication that there is a mismatch between 00070 * how the library was built and how you are trying to use it for your 00071 * application. Your already compiled or binary library provider is the 00072 * only one who can give you the details you need to properly use it. 00073 */ 00074 00075 /* 00076 * Verify that some macros are actually defined. 00077 */ 00078 00079 #ifndef CURL_SIZEOF_LONG 00080 # error "CURL_SIZEOF_LONG definition is missing!" 00081 Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing 00082 #endif 00083 00084 #ifndef CURL_TYPEOF_CURL_SOCKLEN_T 00085 # error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!" 00086 Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing 00087 #endif 00088 00089 #ifndef CURL_SIZEOF_CURL_SOCKLEN_T 00090 # error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!" 00091 Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing 00092 #endif 00093 00094 #ifndef CURL_TYPEOF_CURL_OFF_T 00095 # error "CURL_TYPEOF_CURL_OFF_T definition is missing!" 00096 Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing 00097 #endif 00098 00099 #ifndef CURL_FORMAT_CURL_OFF_T 00100 # error "CURL_FORMAT_CURL_OFF_T definition is missing!" 00101 Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing 00102 #endif 00103 00104 #ifndef CURL_FORMAT_CURL_OFF_TU 00105 # error "CURL_FORMAT_CURL_OFF_TU definition is missing!" 00106 Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing 00107 #endif 00108 00109 #ifndef CURL_FORMAT_OFF_T 00110 # error "CURL_FORMAT_OFF_T definition is missing!" 00111 Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing 00112 #endif 00113 00114 #ifndef CURL_SIZEOF_CURL_OFF_T 00115 # error "CURL_SIZEOF_CURL_OFF_T definition is missing!" 00116 Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing 00117 #endif 00118 00119 #ifndef CURL_SUFFIX_CURL_OFF_T 00120 # error "CURL_SUFFIX_CURL_OFF_T definition is missing!" 00121 Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing 00122 #endif 00123 00124 #ifndef CURL_SUFFIX_CURL_OFF_TU 00125 # error "CURL_SUFFIX_CURL_OFF_TU definition is missing!" 00126 Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing 00127 #endif 00128 00129 /* 00130 * Macros private to this header file. 00131 */ 00132 00133 #define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1 00134 00135 #define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1 00136 00137 /* 00138 * Verify that the size previously defined and expected for long 00139 * is the same as the one reported by sizeof() at compile time. 00140 */ 00141 00142 typedef char 00143 __curl_rule_01__ 00144 [CurlchkszEQ(long, CURL_SIZEOF_LONG)]; 00145 00146 /* 00147 * Verify that the size previously defined and expected for 00148 * curl_off_t is actually the the same as the one reported 00149 * by sizeof() at compile time. 00150 */ 00151 00152 typedef char 00153 __curl_rule_02__ 00154 [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)]; 00155 00156 /* 00157 * Verify at compile time that the size of curl_off_t as reported 00158 * by sizeof() is greater or equal than the one reported for long 00159 * for the current compilation. 00160 */ 00161 00162 typedef char 00163 __curl_rule_03__ 00164 [CurlchkszGE(curl_off_t, long)]; 00165 00166 /* 00167 * Verify that the size previously defined and expected for 00168 * curl_socklen_t is actually the the same as the one reported 00169 * by sizeof() at compile time. 00170 */ 00171 00172 typedef char 00173 __curl_rule_04__ 00174 [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)]; 00175 00176 /* 00177 * Verify at compile time that the size of curl_socklen_t as reported 00178 * by sizeof() is greater or equal than the one reported for int for 00179 * the current compilation. 00180 */ 00181 00182 typedef char 00183 __curl_rule_05__ 00184 [CurlchkszGE(curl_socklen_t, int)]; 00185 00186 /* ================================================================ */ 00187 /* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */ 00188 /* ================================================================ */ 00189 00190 /* 00191 * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow 00192 * these to be visible and exported by the external libcurl interface API, 00193 * while also making them visible to the library internals, simply including 00194 * setup.h, without actually needing to include curl.h internally. 00195 * If some day this section would grow big enough, all this should be moved 00196 * to its own header file. 00197 */ 00198 00199 /* 00200 * Figure out if we can use the ## preprocessor operator, which is supported 00201 * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ 00202 * or __cplusplus so we need to carefully check for them too. 00203 */ 00204 00205 #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ 00206 defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ 00207 defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ 00208 defined(__ILEC400__) 00209 /* This compiler is believed to have an ISO compatible preprocessor */ 00210 #define CURL_ISOCPP 00211 #else 00212 /* This compiler is believed NOT to have an ISO compatible preprocessor */ 00213 #undef CURL_ISOCPP 00214 #endif 00215 00216 /* 00217 * Macros for minimum-width signed and unsigned curl_off_t integer constants. 00218 */ 00219 00220 #ifdef CURL_ISOCPP 00221 # define __CURL_OFF_T_C_HELPER2(Val,Suffix) Val ## Suffix 00222 #else 00223 # define __CURL_OFF_T_C_HELPER2(Val,Suffix) ValSuffix 00224 #endif 00225 #define __CURL_OFF_T_C_HELPER1(Val,Suffix) __CURL_OFF_T_C_HELPER2(Val,Suffix) 00226 #define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HELPER1(Val,CURL_SUFFIX_CURL_OFF_T) 00227 #define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HELPER1(Val,CURL_SUFFIX_CURL_OFF_TU) 00228 00229 /* 00230 * Get rid of macros private to this header file. 00231 */ 00232 00233 #undef CurlchkszEQ 00234 #undef CurlchkszGE 00235 00236 /* 00237 * Get rid of macros not intended to exist beyond this point. 00238 */ 00239 00240 #undef CURL_PULL_WS2TCPIP_H 00241 #undef CURL_PULL_SYS_TYPES_H 00242 #undef CURL_PULL_SYS_SOCKET_H 00243 #undef CURL_PULL_STDINT_H 00244 #undef CURL_PULL_INTTYPES_H 00245 00246 #undef CURL_TYPEOF_CURL_SOCKLEN_T 00247 #undef CURL_TYPEOF_CURL_OFF_T 00248 00249 #endif /* __CURL_CURLRULES_H */