# cpl_port.h

Go to the documentation of this file.

    00001 /******************************************************************************
    00002  * $Id: cpl_port.h 27044 2014-03-16 23:41:27Z 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 #elif HAVE_LONG_LONG
    00223
    00224 typedef long long        GIntBig;
    00225 typedef unsigned long long GUIntBig;
    00226
    00227 #else
    00228
    00229 typedef long             GIntBig;
    00230 typedef unsigned long    GUIntBig;
    00231
    00232 #endif
    00233
    00234 #if defined(__MSVCRT__) || (defined(WIN32) && defined(_MSC_VER))
    00235   #define CPL_FRMT_GB_WITHOUT_PREFIX     "I64"
    00236 #elif HAVE_LONG_LONG
    00237   #define CPL_FRMT_GB_WITHOUT_PREFIX     "ll"
    00238 #else
    00239   #define CPL_FRMT_GB_WITHOUT_PREFIX     "l"
    00240 #endif
    00241
    00242 #define CPL_FRMT_GIB     "%" CPL_FRMT_GB_WITHOUT_PREFIX "d"
    00243 #define CPL_FRMT_GUIB    "%" CPL_FRMT_GB_WITHOUT_PREFIX "u"
    00244
    00245 /* Workaround VC6 bug */
    00246 #if defined(_MSC_VER) && (_MSC_VER <= 1200)
    00247 #define GUINTBIG_TO_DOUBLE(x) (double)(GIntBig)(x)
    00248 #else
    00249 #define GUINTBIG_TO_DOUBLE(x) (double)(x)
    00250 #endif
    00251
    00252 /* ==================================================================== */
    00253 /*      Other standard services.                                        */
    00254 /* ==================================================================== */
    00255 #ifdef __cplusplus
    00256 #  define CPL_C_START           extern "C" {
    00257 #  define CPL_C_END             }
    00258 #else
    00259 #  define CPL_C_START
    00260 #  define CPL_C_END
    00261 #endif
    00262
    00263 #ifndef CPL_DLL
    00264 #if defined(_MSC_VER) && !defined(CPL_DISABLE_DLL)
    00265 #  define CPL_DLL     __declspec(dllexport)
    00266 #else
    00267 #  if defined(USE_GCC_VISIBILITY_FLAG)
    00268 #    define CPL_DLL     __attribute__ ((visibility("default")))
    00269 #  else
    00270 #    define CPL_DLL
    00271 #  endif
    00272 #endif
    00273 #endif
    00274
    00275 /* Should optional (normally private) interfaces be exported? */
    00276 #ifdef CPL_OPTIONAL_APIS
    00277 #  define CPL_ODLL CPL_DLL
    00278 #else
    00279 #  define CPL_ODLL
    00280 #endif
    00281
    00282 #ifndef CPL_STDCALL
    00283 #if defined(_MSC_VER) && !defined(CPL_DISABLE_STDCALL)
    00284 #  define CPL_STDCALL     __stdcall
    00285 #else
    00286 #  define CPL_STDCALL
    00287 #endif
    00288 #endif
    00289
    00290 #ifdef _MSC_VER
    00291 #  define FORCE_CDECL  __cdecl
    00292 #else
    00293 #  define FORCE_CDECL
    00294 #endif
    00295
    00296 /* TODO : support for other compilers needed */
    00297 #if defined(__GNUC__) || defined(_MSC_VER)
    00298 #define HAS_CPL_INLINE  1
    00299 #define CPL_INLINE __inline
    00300 #elif defined(__SUNPRO_CC)
    00301 #define HAS_CPL_INLINE  1
    00302 #define CPL_INLINE inline
    00303 #else
    00304 #define CPL_INLINE
    00305 #endif
    00306
    00307 #ifndef NULL
    00308 #  define NULL  0
    00309 #endif
    00310
    00311 #ifndef FALSE
    00312 #  define FALSE 0
    00313 #endif
    00314
    00315 #ifndef TRUE
    00316 #  define TRUE  1
    00317 #endif
    00318
    00319 #ifndef MAX
    00320 #  define MIN(a,b)      ((a<b) ? a : b)
    00321 #  define MAX(a,b)      ((a>b) ? a : b)
    00322 #endif
    00323
    00324 #ifndef ABS
    00325 #  define ABS(x)        ((x<0) ? (-1*(x)) : x)
    00326 #endif
    00327
    00328 #ifndef M_PI
    00329 # define M_PI           3.14159265358979323846  /* pi */
    00330 #endif
    00331
    00332 /* -------------------------------------------------------------------- */
    00333 /*      Macro to test equality of two floating point values.            */
    00334 /*      We use fabs() function instead of ABS() macro to avoid side     */
    00335 /*      effects.                                                        */
    00336 /* -------------------------------------------------------------------- */
    00337 #ifndef CPLIsEqual
    00338 #  define CPLIsEqual(x,y) (fabs((x) - (y)) < 0.0000000000001)
    00339 #endif
    00340
    00341 /* -------------------------------------------------------------------- */
    00342 /*      Provide macros for case insensitive string comparisons.         */
    00343 /* -------------------------------------------------------------------- */
    00344 #ifndef EQUAL
    00345 #  if defined(WIN32) || defined(WIN32CE)
    00346 #    define STRCASECMP(a,b)         (stricmp(a,b))
    00347 #    define STRNCASECMP(a,b,n)      (strnicmp(a,b,n))
    00348 #  else
    00349 #    define STRCASECMP(a,b)         (strcasecmp(a,b))
    00350 #    define STRNCASECMP(a,b,n)      (strncasecmp(a,b,n))
    00351 #  endif
    00352 #  define EQUALN(a,b,n)           (STRNCASECMP(a,b,n)==0)
    00353 #  define EQUAL(a,b)              (STRCASECMP(a,b)==0)
    00354 #endif
    00355
    00356 #ifdef macos_pre10
    00357 int strcasecmp(char * str1, char * str2);
    00358 int strncasecmp(char * str1, char * str2, int len);
    00359 char * strdup (char *instr);
    00360 #endif
    00361
    00362 #ifndef CPL_THREADLOCAL
    00363 #  define CPL_THREADLOCAL
    00364 #endif
    00365
    00366 /* -------------------------------------------------------------------- */
    00367 /*      Handle isnan() and isinf().  Note that isinf() and isnan()      */
    00368 /*      are supposed to be macros according to C99, defined in math.h   */
    00369 /*      Some systems (ie. Tru64) don't have isinf() at all, so if       */
    00370 /*      the macro is not defined we just assume nothing is infinite.    */
    00371 /*      This may mean we have no real CPLIsInf() on systems with isinf()*/
    00372 /*      function but no corresponding macro, but I can live with        */
    00373 /*      that since it isn't that important a test.                      */
    00374 /* -------------------------------------------------------------------- */
    00375 #ifdef _MSC_VER
    00376 #  include <float.h>
    00377 #  define CPLIsNan(x) _isnan(x)
    00378 #  define CPLIsInf(x) (!_isnan(x) && !_finite(x))
    00379 #  define CPLIsFinite(x) _finite(x)
    00380 #else
    00381 #  define CPLIsNan(x) isnan(x)
    00382 #  ifdef isinf
    00383 #    define CPLIsInf(x) isinf(x)
    00384 #    define CPLIsFinite(x) (!isnan(x) && !isinf(x))
    00385 #  else
    00386 #    define CPLIsInf(x)    FALSE
    00387 #    define CPLIsFinite(x) (!isnan(x))
    00388 #  endif
    00389 #endif
    00390
    00391 /*---------------------------------------------------------------------
    00392  *                         CPL_LSB and CPL_MSB
    00393  * Only one of these 2 macros should be defined and specifies the byte
    00394  * ordering for the current platform.
    00395  * This should be defined in the Makefile, but if it is not then
    00396  * the default is CPL_LSB (Intel ordering, LSB first).
    00397  *--------------------------------------------------------------------*/
    00398 #if defined(WORDS_BIGENDIAN) && !defined(CPL_MSB) && !defined(CPL_LSB)
    00399 #  define CPL_MSB
    00400 #endif
    00401
    00402 #if ! ( defined(CPL_LSB) || defined(CPL_MSB) )
    00403 #define CPL_LSB
    00404 #endif
    00405
    00406 #if defined(CPL_LSB)
    00407 #  define CPL_IS_LSB 1
    00408 #else
    00409 #  define CPL_IS_LSB 0
    00410 #endif
    00411
    00412 /*---------------------------------------------------------------------
    00413  *        Little endian <==> big endian byte swap macros.
    00414  *--------------------------------------------------------------------*/
    00415
    00416 #define CPL_SWAP16(x) \
    00417         ((GUInt16)( \
    00418             (((GUInt16)(x) & 0x00ffU) << 8) | \
    00419             (((GUInt16)(x) & 0xff00U) >> 8) ))
    00420
    00421 #define CPL_SWAP16PTR(x) \
    00422 {                                                                 \
    00423     GByte       byTemp, *_pabyDataT = (GByte *) (x);              \
    00424                                                                   \
    00425     byTemp = _pabyDataT[0];                                       \
    00426     _pabyDataT[0] = _pabyDataT[1];                                \
    00427     _pabyDataT[1] = byTemp;                                       \
    00428 }
    00429
    00430 #define CPL_SWAP32(x) \
    00431         ((GUInt32)( \
    00432             (((GUInt32)(x) & (GUInt32)0x000000ffUL) << 24) | \
    00433             (((GUInt32)(x) & (GUInt32)0x0000ff00UL) <<  8) | \
    00434             (((GUInt32)(x) & (GUInt32)0x00ff0000UL) >>  8) | \
    00435             (((GUInt32)(x) & (GUInt32)0xff000000UL) >> 24) ))
    00436
    00437 #define CPL_SWAP32PTR(x) \
    00438 {                                                                 \
    00439     GByte       byTemp, *_pabyDataT = (GByte *) (x);              \
    00440                                                                   \
    00441     byTemp = _pabyDataT[0];                                       \
    00442     _pabyDataT[0] = _pabyDataT[3];                                \
    00443     _pabyDataT[3] = byTemp;                                       \
    00444     byTemp = _pabyDataT[1];                                       \
    00445     _pabyDataT[1] = _pabyDataT[2];                                \
    00446     _pabyDataT[2] = byTemp;                                       \
    00447 }
    00448
    00449 #define CPL_SWAP64PTR(x) \
    00450 {                                                                 \
    00451     GByte       byTemp, *_pabyDataT = (GByte *) (x);              \
    00452                                                                   \
    00453     byTemp = _pabyDataT[0];                                       \
    00454     _pabyDataT[0] = _pabyDataT[7];                                \
    00455     _pabyDataT[7] = byTemp;                                       \
    00456     byTemp = _pabyDataT[1];                                       \
    00457     _pabyDataT[1] = _pabyDataT[6];                                \
    00458     _pabyDataT[6] = byTemp;                                       \
    00459     byTemp = _pabyDataT[2];                                       \
    00460     _pabyDataT[2] = _pabyDataT[5];                                \
    00461     _pabyDataT[5] = byTemp;                                       \
    00462     byTemp = _pabyDataT[3];                                       \
    00463     _pabyDataT[3] = _pabyDataT[4];                                \
    00464     _pabyDataT[4] = byTemp;                                       \
    00465 }
    00466
    00467
    00468 /* Until we have a safe 64 bits integer data type defined, we'll replace
    00469  * this version of the CPL_SWAP64() macro with a less efficient one.
    00470  */
    00471 /*
    00472 #define CPL_SWAP64(x) \
    00473         ((uint64)( \
    00474             (uint64)(((uint64)(x) & (uint64)0x00000000000000ffULL) << 56) | \
    00475             (uint64)(((uint64)(x) & (uint64)0x000000000000ff00ULL) << 40) | \
    00476             (uint64)(((uint64)(x) & (uint64)0x0000000000ff0000ULL) << 24) | \
    00477             (uint64)(((uint64)(x) & (uint64)0x00000000ff000000ULL) << 8) | \
    00478             (uint64)(((uint64)(x) & (uint64)0x000000ff00000000ULL) >> 8) | \
    00479             (uint64)(((uint64)(x) & (uint64)0x0000ff0000000000ULL) >> 24) | \
    00480             (uint64)(((uint64)(x) & (uint64)0x00ff000000000000ULL) >> 40) | \
    00481             (uint64)(((uint64)(x) & (uint64)0xff00000000000000ULL) >> 56) ))
    00482 */
    00483
    00484 #define CPL_SWAPDOUBLE(p) CPL_SWAP64PTR(p)
    00485
    00486 #ifdef CPL_MSB
    00487 #  define CPL_MSBWORD16(x)      (x)
    00488 #  define CPL_LSBWORD16(x)      CPL_SWAP16(x)
    00489 #  define CPL_MSBWORD32(x)      (x)
    00490 #  define CPL_LSBWORD32(x)      CPL_SWAP32(x)
    00491 #  define CPL_MSBPTR16(x)
    00492 #  define CPL_LSBPTR16(x)       CPL_SWAP16PTR(x)
    00493 #  define CPL_MSBPTR32(x)
    00494 #  define CPL_LSBPTR32(x)       CPL_SWAP32PTR(x)
    00495 #  define CPL_MSBPTR64(x)
    00496 #  define CPL_LSBPTR64(x)       CPL_SWAP64PTR(x)
    00497 #else
    00498 #  define CPL_LSBWORD16(x)      (x)
    00499 #  define CPL_MSBWORD16(x)      CPL_SWAP16(x)
    00500 #  define CPL_LSBWORD32(x)      (x)
    00501 #  define CPL_MSBWORD32(x)      CPL_SWAP32(x)
    00502 #  define CPL_LSBPTR16(x)
    00503 #  define CPL_MSBPTR16(x)       CPL_SWAP16PTR(x)
    00504 #  define CPL_LSBPTR32(x)
    00505 #  define CPL_MSBPTR32(x)       CPL_SWAP32PTR(x)
    00506 #  define CPL_LSBPTR64(x)
    00507 #  define CPL_MSBPTR64(x)       CPL_SWAP64PTR(x)
    00508 #endif
    00509
    00511 #define CPL_LSBINT16PTR(x)    ((*(GByte*)(x)) | ((*(GByte*)((x)+1)) << 8))
    00512
    00514 #define CPL_LSBINT32PTR(x)    ((*(GByte*)(x)) | ((*(GByte*)((x)+1)) << 8) | \
    00515                               ((*(GByte*)((x)+2)) << 16) | ((*(GByte*)((x)+3)) << 24))
    00516
    00518 #define CPL_LSBSINT16PTR(x) ((GInt16) CPL_LSBINT16PTR(x))
    00519
    00521 #define CPL_LSBUINT16PTR(x) ((GUInt16)CPL_LSBINT16PTR(x))
    00522
    00524 #define CPL_LSBSINT32PTR(x) ((GInt32) CPL_LSBINT32PTR(x))
    00525
    00527 #define CPL_LSBUINT32PTR(x) ((GUInt32)CPL_LSBINT32PTR(x))
    00528
    00529
    00530 /* Utility macro to explicitly mark intentionally unreferenced parameters. */
    00531 #ifndef UNREFERENCED_PARAM
    00532 #  ifdef UNREFERENCED_PARAMETER /* May be defined by Windows API */
    00533 #    define UNREFERENCED_PARAM(param) UNREFERENCED_PARAMETER(param)
    00534 #  else
    00535 #    define UNREFERENCED_PARAM(param) ((void)param)
    00536 #  endif /* UNREFERENCED_PARAMETER */
    00537 #endif /* UNREFERENCED_PARAM */
    00538
    00539 /***********************************************************************
    00540  * Define CPL_CVSID() macro.  It can be disabled during a build by
    00541  * defining DISABLE_CPLID in the compiler options.
    00542  *
    00543  * The cvsid_aw() function is just there to prevent reports of cpl_cvsid()
    00544  * being unused.
    00545  */
    00546
    00547 #ifndef DISABLE_CVSID
    00548 #if defined(__GNUC__) && __GNUC__ >= 4
    00549 #  define CPL_CVSID(string)     static char cpl_cvsid[] __attribute__((used)) = string;
    00550 #else
    00551 #  define CPL_CVSID(string)     static char cpl_cvsid[] = string; \
    00552 static char *cvsid_aw() { return( cvsid_aw() ? ((char *) NULL) : cpl_cvsid ); }
    00553 #endif
    00554 #else
    00555 #  define CPL_CVSID(string)
    00556 #endif
    00557
    00558 /* Null terminated variadic */
    00559 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP)
    00560 #   define CPL_NULL_TERMINATED     __attribute__((__sentinel__))
    00561 #else
    00562 #   define CPL_NULL_TERMINATED
    00563 #endif
    00564
    00565 #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP)
    00566 #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx )  __attribute__((__format__ (__printf__, format_idx, arg_idx)))
    00567 #else
    00568 #define CPL_PRINT_FUNC_FORMAT( format_idx, arg_idx )
    00569 #endif
    00570
    00571 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(DOXYGEN_SKIP)
    00572 #define CPL_WARN_UNUSED_RESULT                        __attribute__((warn_unused_result))
    00573 #else
    00574 #define CPL_WARN_UNUSED_RESULT
    00575 #endif
    00576
    00577 #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(DOXYGEN_SKIP)
    00578 #define CPL_NO_RETURN                                __attribute__((noreturn))
    00579 #else
    00580 #define CPL_NO_RETURN
    00581 #endif
    00582
    00583 #if !defined(DOXYGEN_SKIP)
    00584 #if defined(__has_extension)
    00585   #if __has_extension(attribute_deprecated_with_message)
    00586     /* Clang extension */
    00587     #define CPL_WARN_DEPRECATED(x)                       __attribute__ ((deprecated(x)))
    00588   #else
    00589     #define CPL_WARN_DEPRECATED(x)
    00590   #endif
    00591 #elif defined(__GNUC__)
    00592     #define CPL_WARN_DEPRECATED(x)                       __attribute__ ((deprecated))
    00593 #else
    00594   #define CPL_WARN_DEPRECATED(x)
    00595 #endif
    00596 #endif
    00597
    00598 #endif /* ndef CPL_BASE_H_INCLUDED */

Generated for GDAL by 1.7.1.