GDAL
cpl_port.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  * $Id: cpl_port.h 29925 2015-08-30 12:05:05Z rouault $
00003  *
00004  * Project:  CPL - Common Portability Library
00005  * Author:   Frank Warmerdam, warmerdam@pobox.com
00006  * Purpose:  Include file providing low level portability services for CPL.  
00007  *           This should be the first include file for any CPL based code.  
00008  *
00009  ******************************************************************************
00010  * Copyright (c) 1998, 2005, Frank Warmerdam <warmerdam@pobox.com>
00011  * Copyright (c) 2008-2013, Even Rouault <even dot rouault at mines-paris dot org>
00012  *
00013  * Permission is hereby granted, free of charge, to any person obtaining a
00014  * copy of this software and associated documentation files (the "Software"),
00015  * to deal in the Software without restriction, including without limitation
00016  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00017  * and/or sell copies of the Software, and to permit persons to whom the
00018  * Software is furnished to do so, subject to the following conditions:
00019  *
00020  * The above copyright notice and this permission notice shall be included
00021  * in all copies or substantial portions of the Software.
00022  *
00023  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00024  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00025  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00026  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00027  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00028  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00029  * DEALINGS IN THE SOFTWARE.
00030  ****************************************************************************/
00031 
00032 #ifndef CPL_BASE_H_INCLUDED
00033 #define CPL_BASE_H_INCLUDED
00034 
00042 /* ==================================================================== */
00043 /*      We will use macos_pre10 to indicate compilation with MacOS      */
00044 /*      versions before MacOS X.                                        */
00045 /* ==================================================================== */
00046 #ifdef macintosh
00047 #  define macos_pre10
00048 #endif
00049 
00050 /* ==================================================================== */
00051 /*      We will use WIN32 as a standard windows define.                 */
00052 /* ==================================================================== */
00053 #if defined(_WIN32) && !defined(WIN32) && !defined(_WIN32_WCE)
00054 #  define WIN32
00055 #endif
00056 
00057 #if defined(_WINDOWS) && !defined(WIN32) && !defined(_WIN32_WCE)
00058 #  define WIN32
00059 #endif
00060 
00061 /* ==================================================================== */
00062 /*      We will use WIN32CE as a standard Windows CE (Mobile) define.   */
00063 /* ==================================================================== */
00064 #if defined(_WIN32_WCE)
00065 #  define WIN32CE
00066 #endif
00067 
00068 /* -------------------------------------------------------------------- */
00069 /*      The following apparently allow you to use strcpy() and other    */
00070 /*      functions judged "unsafe" by microsoft in VS 8 (2005).          */
00071 /* -------------------------------------------------------------------- */
00072 #ifdef _MSC_VER
00073 #  ifndef _CRT_SECURE_NO_DEPRECATE
00074 #    define _CRT_SECURE_NO_DEPRECATE
00075 #  endif
00076 #  ifndef _CRT_NONSTDC_NO_DEPRECATE
00077 #    define _CRT_NONSTDC_NO_DEPRECATE
00078 #  endif
00079 #endif
00080 
00081 #include "cpl_config.h"
00082 
00083 /* ==================================================================== */
00084 /*      A few sanity checks, mainly to detect problems that sometimes   */
00085 /*      arise with bad configured cross-compilation.                    */
00086 /* ==================================================================== */
00087 
00088 #if !defined(SIZEOF_INT) || SIZEOF_INT != 4
00089 #error "Unexpected value for SIZEOF_INT"
00090 #endif
00091 
00092 #if !defined(SIZEOF_UNSIGNED_LONG) || (SIZEOF_UNSIGNED_LONG != 4 && SIZEOF_UNSIGNED_LONG != 8)
00093 #error "Unexpected value for SIZEOF_UNSIGNED_LONG"
00094 #endif
00095 
00096 #if !defined(SIZEOF_VOIDP) || (SIZEOF_VOIDP != 4 && SIZEOF_VOIDP != 8)
00097 #error "Unexpected value for SIZEOF_VOIDP"
00098 #endif
00099 
00100 
00101 /* ==================================================================== */
00102 /*      This will disable most WIN32 stuff in a Cygnus build which      */
00103 /*      defines unix to 1.                                              */
00104 /* ==================================================================== */
00105 
00106 #ifdef unix
00107 #  undef WIN32
00108 #  undef WIN32CE
00109 #endif
00110 
00111 #if defined(VSI_NEED_LARGEFILE64_SOURCE) && !defined(_LARGEFILE64_SOURCE)
00112 #  define _LARGEFILE64_SOURCE 1
00113 #endif
00114 
00115 /* ==================================================================== */
00116 /*      If iconv() is available use extended recoding module.           */
00117 /*      Stub implementation is always compiled in, because it works     */
00118 /*      faster than iconv() for encodings it supports.                  */
00119 /* ==================================================================== */
00120 
00121 #if defined(HAVE_ICONV)
00122 #  define CPL_RECODE_ICONV
00123 #endif
00124 
00125 #define CPL_RECODE_STUB
00126 
00127 /* ==================================================================== */
00128 /*      MinGW stuff                                                     */
00129 /* ==================================================================== */
00130 
00131 /* We need __MSVCRT_VERSION__ >= 0x0601 to have "struct __stat64" */
00132 /* Latest versions of mingw32 define it, but with older ones, */
00133 /* we need to define it manually */
00134 #if defined(__MINGW32__)
00135 #ifndef __MSVCRT_VERSION__
00136 #define __MSVCRT_VERSION__ 0x0601
00137 #endif
00138 #endif
00139 
00140 /* ==================================================================== */
00141 /*      Standard include files.                                         */
00142 /* ==================================================================== */
00143 
00144 #include <stdio.h>
00145 #include <stdlib.h>
00146 #include <math.h>
00147 #include <stdarg.h>
00148 #include <string.h>
00149 #include <ctype.h>
00150 #include <limits.h>
00151 
00152 #if !defined(WIN32CE)
00153 #  include <time.h>
00154 #else
00155 #  include <wce_time.h>
00156 #  include <wce_errno.h>
00157 #endif
00158 
00159 
00160 #if defined(HAVE_ERRNO_H)
00161 #  include <errno.h>
00162 #endif 
00163 
00164 #ifdef HAVE_LOCALE_H
00165 #  include <locale.h>
00166 #endif
00167 
00168 #ifdef HAVE_DIRECT_H
00169 #  include <direct.h>
00170 #endif
00171 
00172 #if !(defined(WIN32) || defined(WIN32CE))
00173 #  include <strings.h>
00174 #endif
00175 
00176 #if defined(HAVE_LIBDBMALLOC) && defined(HAVE_DBMALLOC_H) && defined(DEBUG)
00177 #  define DBMALLOC
00178 #  include <dbmalloc.h>
00179 #endif
00180 
00181 #if !defined(DBMALLOC) && defined(HAVE_DMALLOC_H)
00182 #  define USE_DMALLOC
00183 #  include <dmalloc.h>
00184 #endif
00185 
00186 /* ==================================================================== */
00187 /*      Base portability stuff ... this stuff may need to be            */
00188 /*      modified for new platforms.                                     */
00189 /* ==================================================================== */
00190 
00191 /*---------------------------------------------------------------------
00192  *        types for 16 and 32 bits integers, etc...
00193  *--------------------------------------------------------------------*/
00194 #if UINT_MAX == 65535
00195 typedef long            GInt32;
00196 typedef unsigned long   GUInt32;
00197 #else
00198 typedef int             GInt32;
00199 typedef unsigned int    GUInt32;
00200 #endif
00201 
00202 typedef short           GInt16;
00203 typedef unsigned short  GUInt16;
00204 typedef unsigned char   GByte;
00205 /* hack for PDF driver and poppler >= 0.15.0 that defines incompatible "typedef bool GBool" */
00206 /* in include/poppler/goo/gtypes.h */
00207 #ifndef CPL_GBOOL_DEFINED
00208 #define CPL_GBOOL_DEFINED
00209 typedef int             GBool;
00210 #endif
00211 
00212 /* -------------------------------------------------------------------- */
00213 /*      64bit support                                                   */
00214 /* -------------------------------------------------------------------- */
00215 
00216 #if defined(WIN32) && defined(_MSC_VER)
00217 
00218 #define VSI_LARGE_API_SUPPORTED
00219 typedef __int64          GIntBig;
00220 typedef unsigned __int64 GUIntBig;
00221 
00222 #define GINTBIG_MIN     ((GIntBig)(0x80000000) << 32)
00223 #define GINTBIG_MAX     (((GIntBig)(0x7FFFFFFF) << 32) | 0xFFFFFFFFU)
00224 
00225 #elif HAVE_LONG_LONG
00226 
00227 typedef long long        GIntBig;
00228 typedef unsigned long long GUIntBig;
00229 
00230 #define GINTBIG_MIN     ((GIntBig)(0x80000000) << 32)
00231 #define GINTBIG_MAX     (((GIntBig)(0x7FFFFFFF) << 32) | 0xFFFFFFFFU)
00232 
00233 #else
00234 
00235 typedef long             GIntBig;
00236 typedef unsigned long    GUIntBig;
00237 
00238 #define GINTBIG_MIN     INT_MIN
00239 #define GINTBIG_MAX     INT_MAX
00240 #endif
00241 
00242 #if SIZEOF_VOIDP == 8
00243 typedef GIntBig          GPtrDiff_t;
00244 #else
00245 typedef int              GPtrDiff_t;
00246 #endif
00247 
00248 #if defined(__MSVCRT__) || (defined(WIN32) && defined(_MSC_VER))
00249   #define CPL_FRMT_GB_WITHOUT_PREFIX     "I64"
00250 #elif HAVE_LONG_LONG
00251   #define CPL_FRMT_GB_WITHOUT_PREFIX     "ll"
00252 #else
00253   #define CPL_FRMT_GB_WITHOUT_PREFIX     "l"
00254 #endif
00255 
00256 #define CPL_FRMT_GIB     "%" CPL_FRMT_GB_WITHOUT_PREFIX "d"
00257 #define CPL_FRMT_GUIB    "%" CPL_FRMT_GB_WITHOUT_PREFIX "u"
00258 
00259 /* Workaround VC6 bug */
00260 #if defined(_MSC_VER) && (_MSC_VER <= 1200)
00261 #define GUINTBIG_TO_DOUBLE(x) (double)(GIntBig)(x)
00262 #else
00263 #define GUINTBIG_TO_DOUBLE(x) (double)(x)
00264 #endif
00265 
00266 /* ==================================================================== */
00267 /*      Other standard services.                                        */
00268 /* ==================================================================== */
00269 #ifdef __cplusplus
00270 #  define CPL_C_START           extern "C" {
00271 #  define CPL_C_END             }
00272 #else
00273 #  define CPL_C_START
00274 #  define CPL_C_END
00275 #endif
00276 
00277 #ifndef CPL_DLL
00278 #if defined(_MSC_VER) && !defined(CPL_DISABLE_DLL)
00279 #  define CPL_DLL     __declspec(dllexport)
00280 #else
00281 #  if defined(USE_GCC_VISIBILITY_FLAG)
00282 #    define CPL_DLL     __attribute__ ((visibility("default")))
00283 #  else
00284 #    define CPL_DLL
00285 #  endif
00286 #endif
00287 #endif
00288 
00289 /* Should optional (normally private) interfaces be exported? */
00290 #ifdef CPL_OPTIONAL_APIS
00291 #  define CPL_ODLL CPL_DLL
00292 #else
00293 #  define CPL_ODLL
00294 #endif
00295 
00296 #ifndef CPL_STDCALL
00297 #if defined(_MSC_VER) && !defined(CPL_DISABLE_STDCALL)
00298 #  define CPL_STDCALL     __stdcall
00299 #else
00300 #  define CPL_STDCALL
00301 #endif
00302 #endif
00303 
00304 #ifdef _MSC_VER
00305 #  define FORCE_CDECL  __cdecl
00306 #else
00307 #  define FORCE_CDECL 
00308 #endif
00309 
00310 /* TODO : support for other compilers needed */
00311 #if (defined(__GNUC__) && !defined(__NO_INLINE__)) || defined(_MSC_VER)
00312 #define HAS_CPL_INLINE  1
00313 #define CPL_INLINE __inline
00314 #elif defined(__SUNPRO_CC)
00315 #define HAS_CPL_INLINE  1
00316 #define CPL_INLINE inline
00317 #else
00318 #define CPL_INLINE
00319 #endif
00320 
00321 #ifndef NULL
00322 #  define NULL  0
00323 #endif
00324 
00325 #ifndef FALSE
00326 #  define FALSE 0
00327 #endif
00328 
00329 #ifndef TRUE
00330 #  define TRUE  1
00331 #endif
00332 
00333 #ifndef MAX
00334 #  define MIN(a,b)      ((a<b) ? a : b)
00335 #  define MAX(a,b)      ((a>b) ? a : b)
00336 #endif
00337 
00338 #ifndef ABS
00339 #  define ABS(x)        ((x<0) ? (-1*(x)) : x)
00340 #endif
00341 
00342 #ifndef M_PI
00343 # define M_PI           3.14159265358979323846  /* pi */
00344 #endif
00345 
00346 /* -------------------------------------------------------------------- */
00347 /*      Macro to test equality of two floating point values.            */
00348 /*      We use fabs() function instead of ABS() macro to avoid side     */
00349 /*      effects.                                                        */
00350 /* -------------------------------------------------------------------- */
00351 #ifndef CPLIsEqual
00352 #  define CPLIsEqual(x,y) (fabs((x) - (y)) < 0.0000000000001)
00353 #endif
00354 
00355 /* -------------------------------------------------------------------- */
00356 /*      Provide macros for case insensitive string comparisons.         */
00357 /* -------------------------------------------------------------------- */
00358 #ifndef EQUAL
00359 #  if defined(WIN32) || defined(WIN32CE)
00360 #    define STRCASECMP(a,b)         (stricmp(a,b))
00361 #    define STRNCASECMP(a,b,n)      (strnicmp(a,b,n))
00362 #  else
00363 #    define STRCASECMP(a,b)         (strcasecmp(a,b))
00364 #    define STRNCASECMP(a,b,n)      (strncasecmp(a,b,n))
00365 #  endif
00366 #  define EQUALN(a,b,n)           (STRNCASECMP(a,b,n)==0)
00367 #  define EQUAL(a,b)              (STRCASECMP(a,b)==0)
00368 #endif
00369 
00370 #ifdef macos_pre10
00371 int strcasecmp(char * str1, char * str2);
00372 int strncasecmp(char * str1, char * str2, int len);
00373 char * strdup (char *instr);
00374 #endif
00375 
00376 #ifndef CPL_THREADLOCAL
00377 #  define CPL_THREADLOCAL
00378 #endif
00379 
00380 /* -------------------------------------------------------------------- */
00381 /*      Handle isnan() and isinf().  Note that isinf() and isnan()      */
00382 /*      are supposed to be macros according to C99, defined in math.h   */
00383 /*      Some systems (ie. Tru64) don't have isinf() at all, so if       */
00384 /*      the macro is not defined we just assume nothing is infinite.    */
00385 /*      This may mean we have no real CPLIsInf() on systems with isinf()*/
00386 /*      function but no corresponding macro, but I can live with        */
00387 /*      that since it isn't that important a test.                      */
00388 /* -------------------------------------------------------------------- */
00389 #ifdef _MSC_VER
00390 #  include <float.h>
00391 #  define CPLIsNan(x) _isnan(x)
00392 #  define CPLIsInf(x) (!_isnan(x) && !_finite(x))
00393 #  define CPLIsFinite(x) _finite(x)
00394 #else
00395 #  define CPLIsNan(x) isnan(x)
00396 #  ifdef isinf 
00397 #    define CPLIsInf(x) isinf(x)
00398 #    define CPLIsFinite(x) (!isnan(x) && !isinf(x))
00399 #  else
00400 #    define CPLIsInf(x)    FALSE
00401 #    define CPLIsFinite(x) (!isnan(x))
00402 #  endif
00403 #endif
00404 
00405 /*---------------------------------------------------------------------
00406  *                         CPL_LSB and CPL_MSB
00407  * Only one of these 2 macros should be defined and specifies the byte 
00408  * ordering for the current platform.  
00409  * This should be defined in the Makefile, but if it is not then
00410  * the default is CPL_LSB (Intel ordering, LSB first).
00411  *--------------------------------------------------------------------*/
00412 #if defined(WORDS_BIGENDIAN) && !defined(CPL_MSB) && !defined(CPL_LSB)
00413 #  define CPL_MSB
00414 #endif
00415 
00416 #if ! ( defined(CPL_LSB) || defined(CPL_MSB) )
00417 #define CPL_LSB
00418 #endif
00419 
00420 #if defined(CPL_LSB)
00421 #  define CPL_IS_LSB 1
00422 #else
00423 #  define CPL_IS_LSB 0
00424 #endif
00425 
00426 /*---------------------------------------------------------------------
00427  *        Little endian <==> big endian byte swap macros.
00428  *--------------------------------------------------------------------*/
00429 
00430 #define CPL_SWAP16(x) \
00431         ((GUInt16)( \
00432             (((GUInt16)(x) & 0x00ffU) << 8) | \
00433             (((GUInt16)(x) & 0xff00U) >> 8) ))
00434 
00435 #define CPL_SWAP16PTR(x) \
00436 {                                                                 \
00437     GByte       byTemp, *_pabyDataT = (GByte *) (x);              \
00438                                                                   \
00439     byTemp = _pabyDataT[0];                                       \
00440     _pabyDataT[0] = _pabyDataT[1];                                \
00441     _pabyDataT[1] = byTemp;                                       \
00442 }                                                                    
00443                                                             
00444 #define CPL_SWAP32(x) \
00445         ((GUInt32)( \
00446             (((GUInt32)(x) & (GUInt32)0x000000ffUL) << 24) | \
00447             (((GUInt32)(x) & (GUInt32)0x0000ff00UL) <<  8) | \
00448             (((GUInt32)(x) & (GUInt32)0x00ff0000UL) >>  8) | \
00449             (((GUInt32)(x) & (GUInt32)0xff000000UL) >> 24) ))
00450 
00451 #define CPL_SWAP32PTR(x) \
00452 {                                                                 \
00453     GByte       byTemp, *_pabyDataT = (GByte *) (x);              \
00454                                                                   \
00455     byTemp = _pabyDataT[0];                                       \
00456     _pabyDataT[0] = _pabyDataT[3];                                \
00457     _pabyDataT[3] = byTemp;                                       \
00458     byTemp = _pabyDataT[1];                                       \
00459     _pabyDataT[1] = _pabyDataT[2];                                \
00460     _pabyDataT[2] = byTemp;                                       \
00461 }                                                                    
00462                                                             
00463 #define CPL_SWAP64PTR(x) \
00464 {                                                                 \
00465     GByte       byTemp, *_pabyDataT = (GByte *) (x);              \
00466                                                                   \
00467     byTemp = _pabyDataT[0];                                       \
00468     _pabyDataT[0] = _pabyDataT[7];                                \
00469     _pabyDataT[7] = byTemp;                                       \
00470     byTemp = _pabyDataT[1];                                       \
00471     _pabyDataT[1] = _pabyDataT[6];                                \
00472     _pabyDataT[6] = byTemp;                                       \
00473     byTemp = _pabyDataT[2];                                       \
00474     _pabyDataT[2] = _pabyDataT[5];                                \
00475     _pabyDataT[5] = byTemp;                                       \
00476     byTemp = _pabyDataT[3];                                       \
00477     _pabyDataT[3] = _pabyDataT[4];                                \
00478     _pabyDataT[4] = byTemp;                                       \
00479 }                                                                    
00480                                                             
00481 
00482 /* Until we have a safe 64 bits integer data type defined, we'll replace
00483  * this version of the CPL_SWAP64() macro with a less efficient one.
00484  */
00485 /*
00486 #define CPL_SWAP64(x) \
00487         ((uint64)( \
00488             (uint64)(((uint64)(x) & (uint64)0x00000000000000ffULL) << 56) | \
00489             (uint64)(((uint64)(x) & (uint64)0x000000000000ff00ULL) << 40) | \
00490             (uint64)(((uint64)(x) & (uint64)0x0000000000ff0000ULL) << 24) | \
00491             (uint64)(((uint64)(x) & (uint64)0x00000000ff000000ULL) << 8) | \
00492             (uint64)(((uint64)(x) & (uint64)0x000000ff00000000ULL) >> 8) | \
00493             (uint64)(((uint64)(x) & (uint64)0x0000ff0000000000ULL) >> 24) | \
00494             (uint64)(((uint64)(x) & (uint64)0x00ff000000000000ULL) >> 40) | \
00495             (uint64)(((uint64)(x) & (uint64)0xff00000000000000ULL) >> 56) ))
00496 */
00497 
00498 #define CPL_SWAPDOUBLE(p) CPL_SWAP64PTR(p)
00499 
00500 #ifdef CPL_MSB
00501 #  define CPL_MSBWORD16(x)      (x)
00502 #  define CPL_LSBWORD16(x)      CPL_SWAP16(x)
00503 #  define CPL_MSBWORD32(x)      (x)
00504 #  define CPL_LSBWORD32(x)      CPL_SWAP32(x)
00505 #  define CPL_MSBPTR16(x)       
00506 #  define CPL_LSBPTR16(x)       CPL_SWAP16PTR(x)
00507 #  define CPL_MSBPTR32(x)       
00508 #  define CPL_LSBPTR32(x)       CPL_SWAP32PTR(x)
00509 #  define CPL_MSBPTR64(x)       
00510 #  define CPL_LSBPTR64(x)       CPL_SWAP64PTR(x)
00511 #else
00512 #  define CPL_LSBWORD16(x)      (x)
00513 #  define CPL_MSBWORD16(x)      CPL_SWAP16(x)
00514 #  define CPL_LSBWORD32(x)      (x)
00515 #  define CPL_MSBWORD32(x)      CPL_SWAP32(x)
00516 #  define CPL_LSBPTR16(x)       
00517 #  define CPL_MSBPTR16(x)       CPL_SWAP16PTR(x)
00518 #  define CPL_LSBPTR32(x)       
00519 #  define CPL_MSBPTR32(x)       CPL_SWAP32PTR(x)
00520 #  define CPL_LSBPTR64(x)       
00521 #  define CPL_MSBPTR64(x)       CPL_SWAP64PTR(x)
00522 #endif
00523 
00525 #define CPL_LSBINT16PTR(x)    ((*(GByte*)(x)) | (*(((GByte*)(x))+1) << 8))
00526 
00528 #define CPL_LSBINT32PTR(x)    ((*(GByte*)(x)) | (*(((GByte*)(x))+1) << 8) | \
00529                               (*(((GByte*)(x))+2) << 16) | (*(((GByte*)(x))+3) << 24))
00530 
00532 #define CPL_LSBSINT16PTR(x) ((GInt16) CPL_LSBINT16PTR(x))
00533 
00535 #define CPL_LSBUINT16PTR(x) ((GUInt16)CPL_LSBINT16PTR(x))
00536 
00538 #define CPL_LSBSINT32PTR(x) ((GInt32) CPL_LSBINT32PTR(x))
00539 
00541 #define CPL_LSBUINT32PTR(x) ((GUInt32)CPL_LSBINT32PTR(x))
00542 
00543 
00544 /* Utility macro to explicitly mark intentionally unreferenced parameters. */
00545 #ifndef UNREFERENCED_PARAM 
00546 #  ifdef UNREFERENCED_PARAMETER /* May be defined by Windows API */
00547 #    define UNREFERENCED_PARAM(param) UNREFERENCED_PARAMETER(param)
00548 #  else
00549 #    define UNREFERENCED_PARAM(param) ((void)param)
00550 #  endif /* UNREFERENCED_PARAMETER */
00551 #endif /* UNREFERENCED_PARAM */
00552 
00553 /***********************************************************************
00554  * Define CPL_CVSID() macro.  It can be disabled during a build by
00555  * defining DISABLE_CPLID in the compiler options.
00556  *
00557  * The cvsid_aw() function is just there to prevent reports of cpl_cvsid()
00558  * being unused.
00559  */
00560 
00561 #ifndef DISABLE_CVSID
00562 #if defined(__GNUC__) && __GNUC__ >= 4
00563 #  define CPL_CVSID(string)     static char cpl_cvsid[] __attribute__((used)) = string;
00564 #else
00565 #  define CPL_CVSID(string)     static char cpl_cvsid[] = string; \
00566 static char *cvsid_aw() { return( cvsid_aw() ? ((char *) NULL) : cpl_cvsid ); }
00567 #endif
00568 #else
00569 #  define CPL_CVSID(string)
00570 #endif
00571 
00572 /* Null terminated variadic */
00573 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP)
00574 #   define CPL_NULL_TERMINATED     __attribute__((__sentinel__))
00575 #else
00576 #   define CPL_NULL_TERMINATED
00577 #endif
00578 
00579 #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP)
00580 #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx )  __attribute__((__format__ (__printf__, format_idx, arg_idx)))
00581 #else
00582 #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx )
00583 #endif
00584 
00585 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP)
00586 #define CPL_WARN_UNUSED_RESULT                        __attribute__((warn_unused_result))
00587 #else
00588 #define CPL_WARN_UNUSED_RESULT
00589 #endif
00590 
00591 #if defined(__GNUC__) && __GNUC__ >= 4
00592 #  define CPL_UNUSED __attribute((__unused__))
00593 #else
00594 /* TODO: add cases for other compilers */
00595 #  define CPL_UNUSED
00596 #endif
00597 
00598 #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP)
00599 #define CPL_NO_RETURN                                __attribute__((noreturn))
00600 #else
00601 #define CPL_NO_RETURN
00602 #endif
00603 
00604 #if !defined(DOXYGEN_SKIP)
00605 #if defined(__has_extension)
00606   #if __has_extension(attribute_deprecated_with_message)
00607     /* Clang extension */
00608     #define CPL_WARN_DEPRECATED(x)                       __attribute__ ((deprecated(x)))
00609   #else
00610     #define CPL_WARN_DEPRECATED(x)
00611   #endif
00612 #elif defined(__GNUC__)
00613     #define CPL_WARN_DEPRECATED(x)                       __attribute__ ((deprecated))
00614 #else
00615   #define CPL_WARN_DEPRECATED(x)
00616 #endif
00617 #endif
00618 
00619 #ifdef WARN_STANDARD_PRINTF
00620 int vsnprintf(char *str, size_t size, const char* fmt, va_list args) CPL_WARN_DEPRECATED("Use CPLvsnprintf() instead");
00621 int snprintf(char *str, size_t size, const char* fmt, ...) CPL_PRINT_FUNC_FORMAT(3,4) CPL_WARN_DEPRECATED("Use CPLsnprintf() instead");
00622 int sprintf(char *str, const char* fmt, ...) CPL_PRINT_FUNC_FORMAT(2, 3) CPL_WARN_DEPRECATED("Use CPLsprintf() instead");
00623 #endif
00624 
00625 #endif /* ndef CPL_BASE_H_INCLUDED */

Generated for GDAL by doxygen 1.7.6.1.