File: /usr/include/sys/cdefs.h

Green shading in the line number column means the source is part of the translation unit, red means it is conditionally excluded. Highlighted line numbers link to the translation unit page. Highlighted macros link to the macro page.

       1: /*
       2:  * Copyright (c) 2000-2012 Apple Inc. All rights reserved.
       3:  *
       4:  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
       5:  * 
       6:  * This file contains Original Code and/or Modifications of Original Code
       7:  * as defined in and that are subject to the Apple Public Source License
       8:  * Version 2.0 (the 'License'). You may not use this file except in
       9:  * compliance with the License. The rights granted to you under the License
      10:  * may not be used to create, or enable the creation or redistribution of,
      11:  * unlawful or unlicensed copies of an Apple operating system, or to
      12:  * circumvent, violate, or enable the circumvention or violation of, any
      13:  * terms of an Apple operating system software license agreement.
      14:  * 
      15:  * Please obtain a copy of the License at
      16:  * http://www.opensource.apple.com/apsl/ and read it before using this file.
      17:  * 
      18:  * The Original Code and all software distributed under the License are
      19:  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
      20:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
      21:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
      22:  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
      23:  * Please see the License for the specific language governing rights and
      24:  * limitations under the License.
      25:  * 
      26:  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
      27:  */
      28: /* Copyright 1995 NeXT Computer, Inc. All rights reserved. */
      29: /*
      30:  * Copyright (c) 1991, 1993
      31:  *    The Regents of the University of California.  All rights reserved.
      32:  *
      33:  * This code is derived from software contributed to Berkeley by
      34:  * Berkeley Software Design, Inc.
      35:  *
      36:  * Redistribution and use in source and binary forms, with or without
      37:  * modification, are permitted provided that the following conditions
      38:  * are met:
      39:  * 1. Redistributions of source code must retain the above copyright
      40:  *    notice, this list of conditions and the following disclaimer.
      41:  * 2. Redistributions in binary form must reproduce the above copyright
      42:  *    notice, this list of conditions and the following disclaimer in the
      43:  *    documentation and/or other materials provided with the distribution.
      44:  * 3. All advertising materials mentioning features or use of this software
      45:  *    must display the following acknowledgement:
      46:  *    This product includes software developed by the University of
      47:  *    California, Berkeley and its contributors.
      48:  * 4. Neither the name of the University nor the names of its contributors
      49:  *    may be used to endorse or promote products derived from this software
      50:  *    without specific prior written permission.
      51:  *
      52:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
      53:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
      54:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
      55:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
      56:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
      57:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
      58:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
      59:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
      60:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
      61:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
      62:  * SUCH DAMAGE.
      63:  *
      64:  *    @(#)cdefs.h    8.8 (Berkeley) 1/9/95
      65:  */
      66: 
      67: #ifndef    _CDEFS_H_
      68: #define    _CDEFS_H_
      69: 
      70: #if defined(__cplusplus)
      71: #define    __BEGIN_DECLS    extern "C" {
      72: #define    __END_DECLS    }
      73: #else
      74: #define    __BEGIN_DECLS
      75: #define    __END_DECLS
      76: #endif
      77: 
      78: /* This SDK is designed to work with clang and specific versions of
      79:  * gcc >= 4.0 with Apple's patch sets */
      80: #if !defined(__GNUC__) || __GNUC__ < 4
      81: #warning "Unsupported compiler detected"
      82: #endif
      83: 
      84: /*
      85:  * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
      86:  * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
      87:  * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
      88:  * in between its arguments.  __CONCAT can also concatenate double-quoted
      89:  * strings produced by the __STRING macro, but this only works with ANSI C.
      90:  */
      91: #if defined(__STDC__) || defined(__cplusplus)
      92: #define    __P(protos)    protos        /* full-blown ANSI C */
      93: #define    __CONCAT(x,y)    x ## y
      94: #define    __STRING(x)    #x
      95: 
      96: #define    __const        const        /* define reserved names to standard */
      97: #define    __signed    signed
      98: #define    __volatile    volatile
      99: #if defined(__cplusplus)
     100: #define    __inline    inline        /* convert to C++ keyword */
     101: #else
     102: #ifndef __GNUC__
     103: #define    __inline            /* delete GCC keyword */
     104: #endif /* !__GNUC__ */
     105: #endif /* !__cplusplus */
     106: 
     107: #else    /* !(__STDC__ || __cplusplus) */
     108: #define    __P(protos)    ()        /* traditional C preprocessor */
     109: #define    __CONCAT(x,y)    x/**/y
     110: #define    __STRING(x)    "x"
     111: 
     112: #ifndef __GNUC__
     113: #define    __const                /* delete pseudo-ANSI C keywords */
     114: #define    __inline
     115: #define    __signed
     116: #define    __volatile
     117: #endif    /* !__GNUC__ */
     118: 
     119: /*
     120:  * In non-ANSI C environments, new programs will want ANSI-only C keywords
     121:  * deleted from the program and old programs will want them left alone.
     122:  * When using a compiler other than gcc, programs using the ANSI C keywords
     123:  * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
     124:  * When using "gcc -traditional", we assume that this is the intent; if
     125:  * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
     126:  */
     127: #ifndef    NO_ANSI_KEYWORDS
     128: #define    const        __const            /* convert ANSI C keywords */
     129: #define    inline        __inline
     130: #define    signed        __signed
     131: #define    volatile    __volatile
     132: #endif /* !NO_ANSI_KEYWORDS */
     133: #endif /* !(__STDC__ || __cplusplus) */
     134: 
     135: #define __dead2        __attribute__((noreturn))
     136: #define __pure2        __attribute__((const))
     137: 
     138: /* __unused denotes variables and functions that may not be used, preventing
     139:  * the compiler from warning about it if not used.
     140:  */
     141: #define __unused    __attribute__((unused))
     142: 
     143: /* __used forces variables and functions to be included even if it appears
     144:  * to the compiler that they are not used (and would thust be discarded).
     145:  */
     146: #define __used        __attribute__((used))
     147: 
     148: /* __deprecated causes the compiler to produce a warning when encountering
     149:  * code using the deprecated functionality.
     150:  * __deprecated_msg() does the same, and compilers that support it will print
     151:  * a message along with the deprecation warning.
     152:  * This may require turning on such warning with the -Wdeprecated flag.
     153:  * __deprecated_enum_msg() should be used on enums, and compilers that support
     154:  * it will print the deprecation warning.
     155:  */
     156: #define __deprecated    __attribute__((deprecated))
     157: 
     158: #ifdef __has_extension
     159:     #if __has_extension(attribute_deprecated_with_message)
     160:         #define __deprecated_msg(_msg) __attribute__((deprecated(_msg)))
     161:     #else
     162:         #define __deprecated_msg(_msg) __attribute__((deprecated))
     163:     #endif
     164: #elif defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)))
     165:     #define __deprecated_msg(_msg) __attribute__((deprecated(_msg)))
     166: #else
     167:     #define __deprecated_msg(_msg) __attribute__((deprecated))
     168: #endif
     169: 
     170: #ifdef __has_extension
     171:     #if __has_extension(enumerator_attributes)
     172:         #define __deprecated_enum_msg(_msg) __deprecated_msg(_msg)
     173:     #else
     174:         #define __deprecated_enum_msg(_msg)
     175:     #endif
     176: #else
     177:     #define __deprecated_enum_msg(_msg)
     178: #endif
     179: 
     180: /* __unavailable causes the compiler to error out when encountering
     181:  * code using the tagged function of variable.
     182:  */
     183: #define __unavailable    __attribute__((unavailable))
     184: 
     185: /* Delete pseudo-keywords wherever they are not available or needed. */
     186: #ifndef __dead
     187: #define    __dead
     188: #define    __pure
     189: #endif
     190: 
     191: /*
     192:  * We use `__restrict' as a way to define the `restrict' type qualifier
     193:  * without disturbing older software that is unaware of C99 keywords.
     194:  */
     195: #if __STDC_VERSION__ < 199901
     196: #define __restrict
     197: #else
     198: #define __restrict    restrict
     199: #endif
     200: 
     201: /* Declaring inline functions within headers is error-prone due to differences
     202:  * across various versions of the C language and extensions.  __header_inline
     203:  * can be used to declare inline functions within system headers.  In cases
     204:  * where you want to force inlining instead of letting the compiler make
     205:  * the decision, you can use __header_always_inline.
     206:  *
     207:  * Be aware that using inline for functions which compilers may also provide
     208:  * builtins can behave differently under various compilers.  If you intend to
     209:  * provide an inline version of such a function, you may want to use a macro
     210:  * instead.
     211:  *
     212:  * The check for !__GNUC__ || __clang__ is because gcc doesn't correctly
     213:  * support c99 inline in some cases:
     214:  * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55965
     215:  */
     216: 
     217: #if defined(__cplusplus) || \
     218:     (__STDC_VERSION__ >= 199901L && \
     219:      !defined(__GNUC_GNU_INLINE__) && \
     220:      (!defined(__GNUC__) || defined(__clang__)))
     221: # define __header_inline           inline
     222: #elif defined(__GNUC__) && defined(__GNUC_STDC_INLINE__)
     223: # define __header_inline           extern __inline __attribute__((__gnu_inline__))
     224: #elif defined(__GNUC__)
     225: # define __header_inline           extern __inline
     226: #else
     227:   /* If we land here, we've encountered an unsupported compiler,
     228:    * so hopefully it understands static __inline as a fallback.
     229:    */
     230: # define __header_inline           static __inline
     231: #endif
     232: 
     233: #ifdef __GNUC__
     234: # define __header_always_inline    __header_inline __attribute__ ((__always_inline__))
     235: #else
     236:   /* Unfortunately, we're using a compiler that we don't know how to force to
     237:    * inline.  Oh well.
     238:    */
     239: # define __header_always_inline    __header_inline
     240: #endif
     241: 
     242: /*
     243:  * Compiler-dependent macros to declare that functions take printf-like
     244:  * or scanf-like arguments.  They are null except for versions of gcc
     245:  * that are known to support the features properly.  Functions declared
     246:  * with these attributes will cause compilation warnings if there is a
     247:  * mismatch between the format string and subsequent function parameter
     248:  * types.
     249:  */
     250: #define __printflike(fmtarg, firstvararg) \
     251:         __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
     252: #define __scanflike(fmtarg, firstvararg) \
     253:         __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
     254: 
     255: #define __IDSTRING(name,string) static const char name[] __used = string
     256: 
     257: #ifndef __COPYRIGHT
     258: #define __COPYRIGHT(s) __IDSTRING(copyright,s)
     259: #endif
     260: 
     261: #ifndef __RCSID
     262: #define __RCSID(s) __IDSTRING(rcsid,s)
     263: #endif
     264: 
     265: #ifndef __SCCSID
     266: #define __SCCSID(s) __IDSTRING(sccsid,s)
     267: #endif
     268: 
     269: #ifndef __PROJECT_VERSION
     270: #define __PROJECT_VERSION(s) __IDSTRING(project_version,s)
     271: #endif
     272: 
     273: /* Source compatibility only, ID string not emitted in object file */
     274: #ifndef __FBSDID
     275: #define __FBSDID(s) 
     276: #endif
     277: 
     278: #ifndef    __DECONST
     279: #define    __DECONST(type, var)    __CAST_AWAY_QUALIFIER(var, const, type)
     280: #endif
     281: 
     282: #ifndef    __DEVOLATILE
     283: #define    __DEVOLATILE(type, var)    __CAST_AWAY_QUALIFIER(var, volatile, type)
     284: #endif
     285: 
     286: #ifndef    __DEQUALIFY
     287: #define    __DEQUALIFY(type, var)    __CAST_AWAY_QUALIFIER(var, const volatile, type)
     288: #endif
     289: 
     290: /*
     291:  * COMPILATION ENVIRONMENTS -- see compat(5) for additional detail
     292:  *
     293:  * DEFAULT    By default newly complied code will get POSIX APIs plus
     294:  *        Apple API extensions in scope.
     295:  *
     296:  *        Most users will use this compilation environment to avoid
     297:  *        behavioral differences between 32 and 64 bit code.
     298:  *
     299:  * LEGACY    Defining _NONSTD_SOURCE will get pre-POSIX APIs plus Apple
     300:  *        API extensions in scope.
     301:  *
     302:  *        This is generally equivalent to the Tiger release compilation
     303:  *        environment, except that it cannot be applied to 64 bit code;
     304:  *        its use is discouraged.
     305:  *
     306:  *        We expect this environment to be deprecated in the future.
     307:  *
     308:  * STRICT    Defining _POSIX_C_SOURCE or _XOPEN_SOURCE restricts the
     309:  *        available APIs to exactly the set of APIs defined by the
     310:  *        corresponding standard, based on the value defined.
     311:  *
     312:  *        A correct, portable definition for _POSIX_C_SOURCE is 200112L.
     313:  *        A correct, portable definition for _XOPEN_SOURCE is 600L.
     314:  *
     315:  *        Apple API extensions are not visible in this environment,
     316:  *        which can cause Apple specific code to fail to compile,
     317:  *        or behave incorrectly if prototypes are not in scope or
     318:  *        warnings about missing prototypes are not enabled or ignored.
     319:  *
     320:  * In any compilation environment, for correct symbol resolution to occur,
     321:  * function prototypes must be in scope.  It is recommended that all Apple
     322:  * tools users add either the "-Wall" or "-Wimplicit-function-declaration"
     323:  * compiler flags to their projects to be warned when a function is being
     324:  * used without a prototype in scope.
     325:  */
     326: 
     327: /* These settings are particular to each product. */
     328: /* Platform: MacOSX */
     329: #define __DARWIN_ONLY_64_BIT_INO_T    0
     330: /* #undef __DARWIN_ONLY_UNIX_CONFORMANCE (automatically set for 64-bit) */
     331: #define __DARWIN_ONLY_VERS_1050        0
     332: 
     333: /*
     334:  * The __DARWIN_ALIAS macros are used to do symbol renaming; they allow
     335:  * legacy code to use the old symbol, thus maintaining binary compatibility
     336:  * while new code can use a standards compliant version of the same function.
     337:  *
     338:  * __DARWIN_ALIAS is used by itself if the function signature has not
     339:  * changed, it is used along with a #ifdef check for __DARWIN_UNIX03
     340:  * if the signature has changed.  Because the __LP64__ environment
     341:  * only supports UNIX03 semantics it causes __DARWIN_UNIX03 to be
     342:  * defined, but causes __DARWIN_ALIAS to do no symbol mangling.
     343:  *
     344:  * As a special case, when XCode is used to target a specific version of the
     345:  * OS, the manifest constant __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
     346:  * will be defined by the compiler, with the digits representing major version
     347:  * time 100 + minor version times 10 (e.g. 10.5 := 1050).  If we are targeting
     348:  * pre-10.5, and it is the default compilation environment, revert the
     349:  * compilation environment to pre-__DARWIN_UNIX03.
     350:  */
     351: #if !defined(__DARWIN_ONLY_UNIX_CONFORMANCE)
     352: #  if defined(__LP64__)
     353: #    define __DARWIN_ONLY_UNIX_CONFORMANCE 1
     354: #  else /* !__LP64__ */
     355: #    define __DARWIN_ONLY_UNIX_CONFORMANCE 0
     356: #  endif /* __LP64__ */
     357: #endif /* !__DARWIN_ONLY_UNIX_CONFORMANCE */
     358: 
     359: #if !defined(__DARWIN_UNIX03)
     360: #  if   __DARWIN_ONLY_UNIX_CONFORMANCE
     361: #    if defined(_NONSTD_SOURCE)
     362: #      error "Can't define _NONSTD_SOURCE when only UNIX conformance is available."
     363: #    endif /* _NONSTD_SOURCE */
     364: #    define __DARWIN_UNIX03    1
     365: #  elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) < 1040)
     366: #    define __DARWIN_UNIX03    0
     367: #  elif defined(_DARWIN_C_SOURCE) || defined(_XOPEN_SOURCE) || defined(_POSIX_C_SOURCE)
     368: #    if defined(_NONSTD_SOURCE)
     369: #      error "Can't define both _NONSTD_SOURCE and any of _DARWIN_C_SOURCE, _XOPEN_SOURCE or _POSIX_C_SOURCE."
     370: #    endif /* _NONSTD_SOURCE */
     371: #    define __DARWIN_UNIX03    1
     372: #  elif defined(_NONSTD_SOURCE)
     373: #    define __DARWIN_UNIX03    0
     374: #  else /* default */
     375: #    if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) < 1050)
     376: #      define __DARWIN_UNIX03    0
     377: #    else /* __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 */
     378: #      define __DARWIN_UNIX03    1
     379: #    endif /* __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 */
     380: #  endif /* _DARWIN_C_SOURCE || _XOPEN_SOURCE || _POSIX_C_SOURCE || __LP64__ */
     381: #endif /* !__DARWIN_UNIX03 */
     382: 
     383: #if !defined(__DARWIN_64_BIT_INO_T)
     384: #  if   defined(_DARWIN_USE_64_BIT_INODE)
     385: #    if defined(_DARWIN_NO_64_BIT_INODE)
     386: #      error "Can't define both _DARWIN_USE_64_BIT_INODE and _DARWIN_NO_64_BIT_INODE."
     387: #    endif /* _DARWIN_NO_64_BIT_INODE */
     388: #    define __DARWIN_64_BIT_INO_T 1
     389: #  elif defined(_DARWIN_NO_64_BIT_INODE)
     390: #    if __DARWIN_ONLY_64_BIT_INO_T
     391: #      error "Can't define _DARWIN_NO_64_BIT_INODE when only 64-bit inodes are available."
     392: #    endif /* __DARWIN_ONLY_64_BIT_INO_T */
     393: #    define __DARWIN_64_BIT_INO_T 0
     394: #  else /* default */
     395: #    if __DARWIN_ONLY_64_BIT_INO_T
     396: #      define __DARWIN_64_BIT_INO_T 1
     397: #    elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) < 1060) || __DARWIN_UNIX03 == 0
     398: #      define __DARWIN_64_BIT_INO_T 0
     399: #    else /* default */
     400: #      define __DARWIN_64_BIT_INO_T 1
     401: #    endif /* __DARWIN_ONLY_64_BIT_INO_T */
     402: #  endif
     403: #endif /* !__DARWIN_64_BIT_INO_T */
     404: 
     405: #if !defined(__DARWIN_VERS_1050)
     406: #  if   __DARWIN_ONLY_VERS_1050
     407: #    define __DARWIN_VERS_1050 1
     408: #  elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) < 1050) || __DARWIN_UNIX03 == 0
     409: #    define __DARWIN_VERS_1050 0
     410: #  else /* default */
     411: #    define __DARWIN_VERS_1050 1
     412: #  endif
     413: #endif /* !__DARWIN_VERS_1050 */
     414: 
     415: #if !defined(__DARWIN_NON_CANCELABLE)
     416: #    define __DARWIN_NON_CANCELABLE 0
     417: #endif /* !__DARWIN_NON_CANCELABLE */
     418: 
     419: /*
     420:  * symbol suffixes used for symbol versioning
     421:  */
     422: #if __DARWIN_UNIX03
     423: #  if __DARWIN_ONLY_UNIX_CONFORMANCE
     424: #    define __DARWIN_SUF_UNIX03        /* nothing */
     425: #  else /* !__DARWIN_ONLY_UNIX_CONFORMANCE */
     426: #    define __DARWIN_SUF_UNIX03        "$UNIX2003"
     427: #  endif /* __DARWIN_ONLY_UNIX_CONFORMANCE */
     428: 
     429: #  if __DARWIN_64_BIT_INO_T
     430: #    if __DARWIN_ONLY_64_BIT_INO_T
     431: #      define __DARWIN_SUF_64_BIT_INO_T    /* nothing */
     432: #    else /* !__DARWIN_ONLY_64_BIT_INO_T */
     433: #      define __DARWIN_SUF_64_BIT_INO_T    "$INODE64"
     434: #    endif /* __DARWIN_ONLY_64_BIT_INO_T */
     435: #  else /* !__DARWIN_64_BIT_INO_T */
     436: #    define __DARWIN_SUF_64_BIT_INO_T    /* nothing */
     437: #  endif /* __DARWIN_64_BIT_INO_T */
     438: 
     439: #  if __DARWIN_VERS_1050
     440: #    if __DARWIN_ONLY_VERS_1050
     441: #      define __DARWIN_SUF_1050        /* nothing */
     442: #    else /* !__DARWIN_ONLY_VERS_1050 */
     443: #      define __DARWIN_SUF_1050        "$1050"
     444: #    endif /* __DARWIN_ONLY_VERS_1050 */
     445: #  else /* !__DARWIN_VERS_1050 */
     446: #    define __DARWIN_SUF_1050        /* nothing */
     447: #  endif /* __DARWIN_VERS_1050 */
     448: 
     449: #  if __DARWIN_NON_CANCELABLE
     450: #    define __DARWIN_SUF_NON_CANCELABLE    "$NOCANCEL"
     451: #  else /* !__DARWIN_NON_CANCELABLE */
     452: #    define __DARWIN_SUF_NON_CANCELABLE    /* nothing */
     453: #  endif /* __DARWIN_NON_CANCELABLE */
     454: 
     455: #else /* !__DARWIN_UNIX03 */
     456: #  define __DARWIN_SUF_UNIX03        /* nothing */
     457: #  define __DARWIN_SUF_64_BIT_INO_T    /* nothing */
     458: #  define __DARWIN_SUF_NON_CANCELABLE    /* nothing */
     459: #  define __DARWIN_SUF_1050        /* nothing */
     460: #endif /* __DARWIN_UNIX03 */
     461: 
     462: #define __DARWIN_SUF_EXTSN        "$DARWIN_EXTSN"
     463: 
     464: /*
     465:  * symbol versioning macros
     466:  */
     467: #define __DARWIN_ALIAS(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_UNIX03)
     468: #define __DARWIN_ALIAS_C(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_NON_CANCELABLE __DARWIN_SUF_UNIX03)
     469: #define __DARWIN_ALIAS_I(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_64_BIT_INO_T __DARWIN_SUF_UNIX03)
     470: #define __DARWIN_INODE64(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_64_BIT_INO_T)
     471: 
     472: #define __DARWIN_1050(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_1050)
     473: #define __DARWIN_1050ALIAS(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_UNIX03)
     474: #define __DARWIN_1050ALIAS_C(sym)    __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_NON_CANCELABLE __DARWIN_SUF_UNIX03)
     475: #define __DARWIN_1050ALIAS_I(sym)    __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_64_BIT_INO_T __DARWIN_SUF_UNIX03)
     476: #define __DARWIN_1050INODE64(sym)    __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_64_BIT_INO_T)
     477: 
     478: #define __DARWIN_EXTSN(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_EXTSN)
     479: #define __DARWIN_EXTSN_C(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_EXTSN __DARWIN_SUF_NON_CANCELABLE)
     480: 
     481: /*
     482:  * symbol release macros
     483:  */
     484: #include <sys/_symbol_aliasing.h>
     485: 
     486: #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
     487: #define __DARWIN_ALIAS_STARTING(_mac, _iphone, x)   __DARWIN_ALIAS_STARTING_IPHONE_##_iphone(x)
     488: #elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
     489: #define __DARWIN_ALIAS_STARTING(_mac, _iphone, x)   __DARWIN_ALIAS_STARTING_MAC_##_mac(x)
     490: #else
     491: #define __DARWIN_ALIAS_STARTING(_mac, _iphone, x)
     492: #endif
     493: 
     494: 
     495: /*
     496:  * POSIX.1 requires that the macros we test be defined before any standard
     497:  * header file is included.  This permits us to convert values for feature
     498:  * testing, as necessary, using only _POSIX_C_SOURCE.
     499:  *
     500:  * Here's a quick run-down of the versions:
     501:  *  defined(_POSIX_SOURCE)        1003.1-1988
     502:  *  _POSIX_C_SOURCE == 1L        1003.1-1990
     503:  *  _POSIX_C_SOURCE == 2L        1003.2-1992 C Language Binding Option
     504:  *  _POSIX_C_SOURCE == 199309L        1003.1b-1993
     505:  *  _POSIX_C_SOURCE == 199506L        1003.1c-1995, 1003.1i-1995,
     506:  *                    and the omnibus ISO/IEC 9945-1: 1996
     507:  *  _POSIX_C_SOURCE == 200112L        1003.1-2001
     508:  *  _POSIX_C_SOURCE == 200809L        1003.1-2008
     509:  *
     510:  * In addition, the X/Open Portability Guide, which is now the Single UNIX
     511:  * Specification, defines a feature-test macro which indicates the version of
     512:  * that specification, and which subsumes _POSIX_C_SOURCE.
     513:  */
     514: 
     515: /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1L. */
     516: #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1L
     517: #undef _POSIX_C_SOURCE
     518: #define    _POSIX_C_SOURCE        199009L
     519: #endif
     520: 
     521: /* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2L. */
     522: #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2L
     523: #undef _POSIX_C_SOURCE
     524: #define    _POSIX_C_SOURCE        199209L
     525: #endif
     526: 
     527: /* Deal with various X/Open Portability Guides and Single UNIX Spec. */
     528: #ifdef _XOPEN_SOURCE
     529: #if _XOPEN_SOURCE - 0L >= 700L && (!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE - 0L < 200809L)
     530: #undef _POSIX_C_SOURCE
     531: #define _POSIX_C_SOURCE         200809L
     532: #elif _XOPEN_SOURCE - 0L >= 600L && (!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE - 0L < 200112L)
     533: #undef _POSIX_C_SOURCE
     534: #define    _POSIX_C_SOURCE        200112L
     535: #elif _XOPEN_SOURCE - 0L >= 500L && (!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE - 0L < 199506L)
     536: #undef _POSIX_C_SOURCE
     537: #define    _POSIX_C_SOURCE        199506L
     538: #endif
     539: #endif
     540: 
     541: /*
     542:  * Deal with all versions of POSIX.  The ordering relative to the tests above is
     543:  * important.
     544:  */
     545: #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
     546: #define _POSIX_C_SOURCE         198808L
     547: #endif
     548: 
     549: /* POSIX C deprecation macros */
     550: #include <sys/_posix_availability.h>
     551: 
     552: #define __POSIX_C_DEPRECATED(ver) ___POSIX_C_DEPRECATED_STARTING_##ver
     553: 
     554: /*
     555:  * Set a single macro which will always be defined and can be used to determine
     556:  * the appropriate namespace.  For POSIX, these values will correspond to
     557:  * _POSIX_C_SOURCE value.  Currently there are two additional levels corresponding
     558:  * to ANSI (_ANSI_SOURCE) and Darwin extensions (_DARWIN_C_SOURCE)
     559:  */
     560: #define __DARWIN_C_ANSI         010000L
     561: #define __DARWIN_C_FULL         900000L
     562: 
     563: #if   defined(_ANSI_SOURCE)
     564: #define __DARWIN_C_LEVEL        __DARWIN_C_ANSI
     565: #elif defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE) && !defined(_NONSTD_SOURCE)
     566: #define __DARWIN_C_LEVEL        _POSIX_C_SOURCE
     567: #else
     568: #define __DARWIN_C_LEVEL        __DARWIN_C_FULL
     569: #endif
     570: 
     571: /* If the developer has neither requested a strict language mode nor a version
     572:  * of POSIX, turn on functionality provided by __STDC_WANT_LIB_EXT1__ as part
     573:  * of __DARWIN_C_FULL.
     574:  */
     575: #if !defined(__STDC_WANT_LIB_EXT1__) && !defined(__STRICT_ANSI__) && __DARWIN_C_LEVEL >= __DARWIN_C_FULL
     576: #define __STDC_WANT_LIB_EXT1__ 1
     577: #endif
     578: 
     579: /*
     580:  * long long is not supported in c89 (__STRICT_ANSI__), but g++ -ansi and
     581:  * c99 still want long longs.  While not perfect, we allow long longs for
     582:  * g++.
     583:  */
     584: #define    __DARWIN_NO_LONG_LONG    (defined(__STRICT_ANSI__) \
     585:                 && (__STDC_VERSION__-0 < 199901L) \
     586:                 && !defined(__GNUG__))
     587: 
     588: /*****************************************
     589:  *  Public darwin-specific feature macros
     590:  *****************************************/
     591: 
     592: /*
     593:  * _DARWIN_FEATURE_64_BIT_INODE indicates that the ino_t type is 64-bit, and
     594:  * structures modified for 64-bit inodes (like struct stat) will be used.
     595:  */
     596: #if __DARWIN_64_BIT_INO_T
     597: #define _DARWIN_FEATURE_64_BIT_INODE        1
     598: #endif
     599: 
     600: /*
     601:  * _DARWIN_FEATURE_64_ONLY_BIT_INODE indicates that the ino_t type may only
     602:  * be 64-bit; there is no support for 32-bit ino_t when this macro is defined
     603:  * (and non-zero).  There is no struct stat64 either, as the regular
     604:  * struct stat will already be the 64-bit version.
     605:  */
     606: #if __DARWIN_ONLY_64_BIT_INO_T
     607: #define _DARWIN_FEATURE_ONLY_64_BIT_INODE    1
     608: #endif
     609: 
     610: /*
     611:  * _DARWIN_FEATURE_ONLY_VERS_1050 indicates that only those APIs updated
     612:  * in 10.5 exists; no pre-10.5 variants are available.
     613:  */
     614: #if __DARWIN_ONLY_VERS_1050
     615: #define _DARWIN_FEATURE_ONLY_VERS_1050        1
     616: #endif
     617: 
     618: /*
     619:  * _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE indicates only UNIX conforming API
     620:  * are available (the legacy BSD APIs are not available)
     621:  */
     622: #if __DARWIN_ONLY_UNIX_CONFORMANCE
     623: #define _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE    1
     624: #endif
     625: 
     626: /*
     627:  * _DARWIN_FEATURE_UNIX_CONFORMANCE indicates whether UNIX conformance is on,
     628:  * and specifies the conformance level (3 is SUSv3)
     629:  */
     630: #if __DARWIN_UNIX03
     631: #define _DARWIN_FEATURE_UNIX_CONFORMANCE    3
     632: #endif
     633: 
     634: /* 
     635:  * This macro casts away the qualifier from the variable
     636:  *
     637:  * Note: use at your own risk, removing qualifiers can result in
     638:  * catastrophic run-time failures.
     639:  */
     640: #ifndef __CAST_AWAY_QUALIFIER
     641: #define __CAST_AWAY_QUALIFIER(variable, qualifier, type)  (type) (long)(variable)
     642: #endif
     643: 
     644: /*
     645:  * __XNU_PRIVATE_EXTERN is a linkage decoration indicating that a symbol can be
     646:  * used from other compilation units, but not other libraries or executables.
     647:  */
     648: #ifndef __XNU_PRIVATE_EXTERN
     649: #define __XNU_PRIVATE_EXTERN __attribute__((visibility("hidden")))
     650: #endif
     651: 
     652: /*
     653:  * Architecture validation for current SDK
     654:  */
     655: #if !defined(__sys_cdefs_arch_unknown__) && defined(__i386__)
     656: #elif !defined(__sys_cdefs_arch_unknown__) && defined(__x86_64__)
     657: #else
     658: #error Unsupported architecture
     659: #endif
     660: 
     661: #endif /* !_CDEFS_H_ */
     662: