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-2015 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:  * Compatibility with compilers and environments that don't support compiler
      86:  * feature checking function-like macros.
      87:  */
      88: #ifndef __has_builtin
      89: #define __has_builtin(x) 0
      90: #endif
      91: #ifndef __has_include
      92: #define __has_include(x) 0
      93: #endif
      94: #ifndef __has_feature
      95: #define __has_feature(x) 0
      96: #endif
      97: #ifndef __has_attribute
      98: #define __has_attribute(x) 0
      99: #endif
     100: #ifndef __has_extension
     101: #define __has_extension(x) 0
     102: #endif
     103: 
     104: /*
     105:  * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
     106:  * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
     107:  * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
     108:  * in between its arguments.  __CONCAT can also concatenate double-quoted
     109:  * strings produced by the __STRING macro, but this only works with ANSI C.
     110:  */
     111: #if defined(__STDC__) || defined(__cplusplus)
     112: #define    __P(protos)    protos        /* full-blown ANSI C */
     113: #define    __CONCAT(x,y)    x ## y
     114: #define    __STRING(x)    #x
     115: 
     116: #define    __const        const        /* define reserved names to standard */
     117: #define    __signed    signed
     118: #define    __volatile    volatile
     119: #if defined(__cplusplus)
     120: #define    __inline    inline        /* convert to C++ keyword */
     121: #else
     122: #ifndef __GNUC__
     123: #define    __inline            /* delete GCC keyword */
     124: #endif /* !__GNUC__ */
     125: #endif /* !__cplusplus */
     126: 
     127: #else    /* !(__STDC__ || __cplusplus) */
     128: #define    __P(protos)    ()        /* traditional C preprocessor */
     129: #define    __CONCAT(x,y)    x/**/y
     130: #define    __STRING(x)    "x"
     131: 
     132: #ifndef __GNUC__
     133: #define    __const                /* delete pseudo-ANSI C keywords */
     134: #define    __inline
     135: #define    __signed
     136: #define    __volatile
     137: #endif    /* !__GNUC__ */
     138: 
     139: /*
     140:  * In non-ANSI C environments, new programs will want ANSI-only C keywords
     141:  * deleted from the program and old programs will want them left alone.
     142:  * When using a compiler other than gcc, programs using the ANSI C keywords
     143:  * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
     144:  * When using "gcc -traditional", we assume that this is the intent; if
     145:  * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
     146:  */
     147: #ifndef    NO_ANSI_KEYWORDS
     148: #define    const        __const            /* convert ANSI C keywords */
     149: #define    inline        __inline
     150: #define    signed        __signed
     151: #define    volatile    __volatile
     152: #endif /* !NO_ANSI_KEYWORDS */
     153: #endif /* !(__STDC__ || __cplusplus) */
     154: 
     155: #define __dead2        __attribute__((noreturn))
     156: #define __pure2        __attribute__((const))
     157: 
     158: /* __unused denotes variables and functions that may not be used, preventing
     159:  * the compiler from warning about it if not used.
     160:  */
     161: #define __unused    __attribute__((unused))
     162: 
     163: /* __used forces variables and functions to be included even if it appears
     164:  * to the compiler that they are not used (and would thust be discarded).
     165:  */
     166: #define __used        __attribute__((used))
     167: 
     168: /* __deprecated causes the compiler to produce a warning when encountering
     169:  * code using the deprecated functionality.
     170:  * __deprecated_msg() does the same, and compilers that support it will print
     171:  * a message along with the deprecation warning.
     172:  * This may require turning on such warning with the -Wdeprecated flag.
     173:  * __deprecated_enum_msg() should be used on enums, and compilers that support
     174:  * it will print the deprecation warning.
     175:  */
     176: #define __deprecated    __attribute__((deprecated))
     177: 
     178: #if __has_extension(attribute_deprecated_with_message) || \
     179:         (defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))))
     180:     #define __deprecated_msg(_msg) __attribute__((deprecated(_msg)))
     181: #else
     182:     #define __deprecated_msg(_msg) __attribute__((deprecated))
     183: #endif
     184: 
     185: #if __has_extension(enumerator_attributes)
     186:     #define __deprecated_enum_msg(_msg) __deprecated_msg(_msg)
     187: #else
     188:     #define __deprecated_enum_msg(_msg)
     189: #endif
     190: 
     191: /* __unavailable causes the compiler to error out when encountering
     192:  * code using the tagged function of variable.
     193:  */
     194: #define __unavailable    __attribute__((unavailable))
     195: 
     196: /* Delete pseudo-keywords wherever they are not available or needed. */
     197: #ifndef __dead
     198: #define    __dead
     199: #define    __pure
     200: #endif
     201: 
     202: /*
     203:  * We use `__restrict' as a way to define the `restrict' type qualifier
     204:  * without disturbing older software that is unaware of C99 keywords.
     205:  */
     206: #if __STDC_VERSION__ < 199901
     207: #define __restrict
     208: #else
     209: #define __restrict    restrict
     210: #endif
     211: 
     212: /* Compatibility with compilers and environments that don't support the
     213:  * nullability feature.
     214:  */
     215: 
     216: #if !__has_feature(nullability)
     217: #ifndef __nullable
     218: #define __nullable
     219: #endif
     220: #ifndef __nonnull
     221: #define __nonnull
     222: #endif
     223: #ifndef __null_unspecified
     224: #define __null_unspecified
     225: #endif
     226: #endif
     227: 
     228: /* Declaring inline functions within headers is error-prone due to differences
     229:  * across various versions of the C language and extensions.  __header_inline
     230:  * can be used to declare inline functions within system headers.  In cases
     231:  * where you want to force inlining instead of letting the compiler make
     232:  * the decision, you can use __header_always_inline.
     233:  *
     234:  * Be aware that using inline for functions which compilers may also provide
     235:  * builtins can behave differently under various compilers.  If you intend to
     236:  * provide an inline version of such a function, you may want to use a macro
     237:  * instead.
     238:  *
     239:  * The check for !__GNUC__ || __clang__ is because gcc doesn't correctly
     240:  * support c99 inline in some cases:
     241:  * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55965
     242:  */
     243: 
     244: #if defined(__cplusplus) || \
     245:     (__STDC_VERSION__ >= 199901L && \
     246:      !defined(__GNUC_GNU_INLINE__) && \
     247:      (!defined(__GNUC__) || defined(__clang__)))
     248: # define __header_inline           inline
     249: #elif defined(__GNUC__) && defined(__GNUC_STDC_INLINE__)
     250: # define __header_inline           extern __inline __attribute__((__gnu_inline__))
     251: #elif defined(__GNUC__)
     252: # define __header_inline           extern __inline
     253: #else
     254:   /* If we land here, we've encountered an unsupported compiler,
     255:    * so hopefully it understands static __inline as a fallback.
     256:    */
     257: # define __header_inline           static __inline
     258: #endif
     259: 
     260: #ifdef __GNUC__
     261: # define __header_always_inline    __header_inline __attribute__ ((__always_inline__))
     262: #else
     263:   /* Unfortunately, we're using a compiler that we don't know how to force to
     264:    * inline.  Oh well.
     265:    */
     266: # define __header_always_inline    __header_inline
     267: #endif
     268: 
     269: /*
     270:  * Compiler-dependent macros that bracket portions of code where the
     271:  * "-Wunreachable-code" warning should be ignored. Please use sparingly.
     272:  */
     273: #if defined(__clang__)
     274: # define __unreachable_ok_push \
     275:          _Pragma("clang diagnostic push") \
     276:          _Pragma("clang diagnostic ignored \"-Wunreachable-code\"")
     277: # define __unreachable_ok_pop \
     278:          _Pragma("clang diagnostic pop")
     279: #elif defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
     280: # define __unreachable_ok_push \
     281:          _Pragma("GCC diagnostic push") \
     282:          _Pragma("GCC diagnostic ignored \"-Wunreachable-code\"")
     283: # define __unreachable_ok_pop \
     284:          _Pragma("GCC diagnostic pop")
     285: #else
     286: # define __unreachable_ok_push
     287: # define __unreachable_ok_pop
     288: #endif
     289: 
     290: /*
     291:  * Compiler-dependent macros to declare that functions take printf-like
     292:  * or scanf-like arguments.  They are null except for versions of gcc
     293:  * that are known to support the features properly.  Functions declared
     294:  * with these attributes will cause compilation warnings if there is a
     295:  * mismatch between the format string and subsequent function parameter
     296:  * types.
     297:  */
     298: #define __printflike(fmtarg, firstvararg) \
     299:         __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
     300: #define __scanflike(fmtarg, firstvararg) \
     301:         __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
     302: 
     303: #define __IDSTRING(name,string) static const char name[] __used = string
     304: 
     305: #ifndef __COPYRIGHT
     306: #define __COPYRIGHT(s) __IDSTRING(copyright,s)
     307: #endif
     308: 
     309: #ifndef __RCSID
     310: #define __RCSID(s) __IDSTRING(rcsid,s)
     311: #endif
     312: 
     313: #ifndef __SCCSID
     314: #define __SCCSID(s) __IDSTRING(sccsid,s)
     315: #endif
     316: 
     317: #ifndef __PROJECT_VERSION
     318: #define __PROJECT_VERSION(s) __IDSTRING(project_version,s)
     319: #endif
     320: 
     321: /* Source compatibility only, ID string not emitted in object file */
     322: #ifndef __FBSDID
     323: #define __FBSDID(s) 
     324: #endif
     325: 
     326: #ifndef    __DECONST
     327: #define    __DECONST(type, var)    __CAST_AWAY_QUALIFIER(var, const, type)
     328: #endif
     329: 
     330: #ifndef    __DEVOLATILE
     331: #define    __DEVOLATILE(type, var)    __CAST_AWAY_QUALIFIER(var, volatile, type)
     332: #endif
     333: 
     334: #ifndef    __DEQUALIFY
     335: #define    __DEQUALIFY(type, var)    __CAST_AWAY_QUALIFIER(var, const volatile, type)
     336: #endif
     337: 
     338: /*
     339:  * COMPILATION ENVIRONMENTS -- see compat(5) for additional detail
     340:  *
     341:  * DEFAULT    By default newly complied code will get POSIX APIs plus
     342:  *        Apple API extensions in scope.
     343:  *
     344:  *        Most users will use this compilation environment to avoid
     345:  *        behavioral differences between 32 and 64 bit code.
     346:  *
     347:  * LEGACY    Defining _NONSTD_SOURCE will get pre-POSIX APIs plus Apple
     348:  *        API extensions in scope.
     349:  *
     350:  *        This is generally equivalent to the Tiger release compilation
     351:  *        environment, except that it cannot be applied to 64 bit code;
     352:  *        its use is discouraged.
     353:  *
     354:  *        We expect this environment to be deprecated in the future.
     355:  *
     356:  * STRICT    Defining _POSIX_C_SOURCE or _XOPEN_SOURCE restricts the
     357:  *        available APIs to exactly the set of APIs defined by the
     358:  *        corresponding standard, based on the value defined.
     359:  *
     360:  *        A correct, portable definition for _POSIX_C_SOURCE is 200112L.
     361:  *        A correct, portable definition for _XOPEN_SOURCE is 600L.
     362:  *
     363:  *        Apple API extensions are not visible in this environment,
     364:  *        which can cause Apple specific code to fail to compile,
     365:  *        or behave incorrectly if prototypes are not in scope or
     366:  *        warnings about missing prototypes are not enabled or ignored.
     367:  *
     368:  * In any compilation environment, for correct symbol resolution to occur,
     369:  * function prototypes must be in scope.  It is recommended that all Apple
     370:  * tools users add either the "-Wall" or "-Wimplicit-function-declaration"
     371:  * compiler flags to their projects to be warned when a function is being
     372:  * used without a prototype in scope.
     373:  */
     374: 
     375: /* These settings are particular to each product. */
     376: /* Platform: MacOSX */
     377: #define __DARWIN_ONLY_64_BIT_INO_T    0
     378: /* #undef __DARWIN_ONLY_UNIX_CONFORMANCE (automatically set for 64-bit) */
     379: #define __DARWIN_ONLY_VERS_1050        0
     380: 
     381: /*
     382:  * The __DARWIN_ALIAS macros are used to do symbol renaming; they allow
     383:  * legacy code to use the old symbol, thus maintaining binary compatibility
     384:  * while new code can use a standards compliant version of the same function.
     385:  *
     386:  * __DARWIN_ALIAS is used by itself if the function signature has not
     387:  * changed, it is used along with a #ifdef check for __DARWIN_UNIX03
     388:  * if the signature has changed.  Because the __LP64__ environment
     389:  * only supports UNIX03 semantics it causes __DARWIN_UNIX03 to be
     390:  * defined, but causes __DARWIN_ALIAS to do no symbol mangling.
     391:  *
     392:  * As a special case, when XCode is used to target a specific version of the
     393:  * OS, the manifest constant __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
     394:  * will be defined by the compiler, with the digits representing major version
     395:  * time 100 + minor version times 10 (e.g. 10.5 := 1050).  If we are targeting
     396:  * pre-10.5, and it is the default compilation environment, revert the
     397:  * compilation environment to pre-__DARWIN_UNIX03.
     398:  */
     399: #if !defined(__DARWIN_ONLY_UNIX_CONFORMANCE)
     400: #  if defined(__LP64__)
     401: #    define __DARWIN_ONLY_UNIX_CONFORMANCE 1
     402: #  else /* !__LP64__ */
     403: #    define __DARWIN_ONLY_UNIX_CONFORMANCE 0
     404: #  endif /* __LP64__ */
     405: #endif /* !__DARWIN_ONLY_UNIX_CONFORMANCE */
     406: 
     407: #if !defined(__DARWIN_UNIX03)
     408: #  if   __DARWIN_ONLY_UNIX_CONFORMANCE
     409: #    if defined(_NONSTD_SOURCE)
     410: #      error "Can't define _NONSTD_SOURCE when only UNIX conformance is available."
     411: #    endif /* _NONSTD_SOURCE */
     412: #    define __DARWIN_UNIX03    1
     413: #  elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) < 1040)
     414: #    define __DARWIN_UNIX03    0
     415: #  elif defined(_DARWIN_C_SOURCE) || defined(_XOPEN_SOURCE) || defined(_POSIX_C_SOURCE)
     416: #    if defined(_NONSTD_SOURCE)
     417: #      error "Can't define both _NONSTD_SOURCE and any of _DARWIN_C_SOURCE, _XOPEN_SOURCE or _POSIX_C_SOURCE."
     418: #    endif /* _NONSTD_SOURCE */
     419: #    define __DARWIN_UNIX03    1
     420: #  elif defined(_NONSTD_SOURCE)
     421: #    define __DARWIN_UNIX03    0
     422: #  else /* default */
     423: #    if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) < 1050)
     424: #      define __DARWIN_UNIX03    0
     425: #    else /* __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 */
     426: #      define __DARWIN_UNIX03    1
     427: #    endif /* __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 */
     428: #  endif /* _DARWIN_C_SOURCE || _XOPEN_SOURCE || _POSIX_C_SOURCE || __LP64__ */
     429: #endif /* !__DARWIN_UNIX03 */
     430: 
     431: #if !defined(__DARWIN_64_BIT_INO_T)
     432: #  if   defined(_DARWIN_USE_64_BIT_INODE)
     433: #    if defined(_DARWIN_NO_64_BIT_INODE)
     434: #      error "Can't define both _DARWIN_USE_64_BIT_INODE and _DARWIN_NO_64_BIT_INODE."
     435: #    endif /* _DARWIN_NO_64_BIT_INODE */
     436: #    define __DARWIN_64_BIT_INO_T 1
     437: #  elif defined(_DARWIN_NO_64_BIT_INODE)
     438: #    if __DARWIN_ONLY_64_BIT_INO_T
     439: #      error "Can't define _DARWIN_NO_64_BIT_INODE when only 64-bit inodes are available."
     440: #    endif /* __DARWIN_ONLY_64_BIT_INO_T */
     441: #    define __DARWIN_64_BIT_INO_T 0
     442: #  else /* default */
     443: #    if __DARWIN_ONLY_64_BIT_INO_T
     444: #      define __DARWIN_64_BIT_INO_T 1
     445: #    elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) < 1060) || __DARWIN_UNIX03 == 0
     446: #      define __DARWIN_64_BIT_INO_T 0
     447: #    else /* default */
     448: #      define __DARWIN_64_BIT_INO_T 1
     449: #    endif /* __DARWIN_ONLY_64_BIT_INO_T */
     450: #  endif
     451: #endif /* !__DARWIN_64_BIT_INO_T */
     452: 
     453: #if !defined(__DARWIN_VERS_1050)
     454: #  if   __DARWIN_ONLY_VERS_1050
     455: #    define __DARWIN_VERS_1050 1
     456: #  elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) < 1050) || __DARWIN_UNIX03 == 0
     457: #    define __DARWIN_VERS_1050 0
     458: #  else /* default */
     459: #    define __DARWIN_VERS_1050 1
     460: #  endif
     461: #endif /* !__DARWIN_VERS_1050 */
     462: 
     463: #if !defined(__DARWIN_NON_CANCELABLE)
     464: #    define __DARWIN_NON_CANCELABLE 0
     465: #endif /* !__DARWIN_NON_CANCELABLE */
     466: 
     467: /*
     468:  * symbol suffixes used for symbol versioning
     469:  */
     470: #if __DARWIN_UNIX03
     471: #  if __DARWIN_ONLY_UNIX_CONFORMANCE
     472: #    define __DARWIN_SUF_UNIX03        /* nothing */
     473: #  else /* !__DARWIN_ONLY_UNIX_CONFORMANCE */
     474: #    define __DARWIN_SUF_UNIX03        "$UNIX2003"
     475: #  endif /* __DARWIN_ONLY_UNIX_CONFORMANCE */
     476: 
     477: #  if __DARWIN_64_BIT_INO_T
     478: #    if __DARWIN_ONLY_64_BIT_INO_T
     479: #      define __DARWIN_SUF_64_BIT_INO_T    /* nothing */
     480: #    else /* !__DARWIN_ONLY_64_BIT_INO_T */
     481: #      define __DARWIN_SUF_64_BIT_INO_T    "$INODE64"
     482: #    endif /* __DARWIN_ONLY_64_BIT_INO_T */
     483: #  else /* !__DARWIN_64_BIT_INO_T */
     484: #    define __DARWIN_SUF_64_BIT_INO_T    /* nothing */
     485: #  endif /* __DARWIN_64_BIT_INO_T */
     486: 
     487: #  if __DARWIN_VERS_1050
     488: #    if __DARWIN_ONLY_VERS_1050
     489: #      define __DARWIN_SUF_1050        /* nothing */
     490: #    else /* !__DARWIN_ONLY_VERS_1050 */
     491: #      define __DARWIN_SUF_1050        "$1050"
     492: #    endif /* __DARWIN_ONLY_VERS_1050 */
     493: #  else /* !__DARWIN_VERS_1050 */
     494: #    define __DARWIN_SUF_1050        /* nothing */
     495: #  endif /* __DARWIN_VERS_1050 */
     496: 
     497: #  if __DARWIN_NON_CANCELABLE
     498: #    define __DARWIN_SUF_NON_CANCELABLE    "$NOCANCEL"
     499: #  else /* !__DARWIN_NON_CANCELABLE */
     500: #    define __DARWIN_SUF_NON_CANCELABLE    /* nothing */
     501: #  endif /* __DARWIN_NON_CANCELABLE */
     502: 
     503: #else /* !__DARWIN_UNIX03 */
     504: #  define __DARWIN_SUF_UNIX03        /* nothing */
     505: #  define __DARWIN_SUF_64_BIT_INO_T    /* nothing */
     506: #  define __DARWIN_SUF_NON_CANCELABLE    /* nothing */
     507: #  define __DARWIN_SUF_1050        /* nothing */
     508: #endif /* __DARWIN_UNIX03 */
     509: 
     510: #define __DARWIN_SUF_EXTSN        "$DARWIN_EXTSN"
     511: 
     512: /*
     513:  * symbol versioning macros
     514:  */
     515: #define __DARWIN_ALIAS(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_UNIX03)
     516: #define __DARWIN_ALIAS_C(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_NON_CANCELABLE __DARWIN_SUF_UNIX03)
     517: #define __DARWIN_ALIAS_I(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_64_BIT_INO_T __DARWIN_SUF_UNIX03)
     518: #define __DARWIN_NOCANCEL(sym)      __asm("_" __STRING(sym) __DARWIN_SUF_NON_CANCELABLE)
     519: #define __DARWIN_INODE64(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_64_BIT_INO_T)
     520: 
     521: #define __DARWIN_1050(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_1050)
     522: #define __DARWIN_1050ALIAS(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_UNIX03)
     523: #define __DARWIN_1050ALIAS_C(sym)    __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_NON_CANCELABLE __DARWIN_SUF_UNIX03)
     524: #define __DARWIN_1050ALIAS_I(sym)    __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_64_BIT_INO_T __DARWIN_SUF_UNIX03)
     525: #define __DARWIN_1050INODE64(sym)    __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_64_BIT_INO_T)
     526: 
     527: #define __DARWIN_EXTSN(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_EXTSN)
     528: #define __DARWIN_EXTSN_C(sym)        __asm("_" __STRING(sym) __DARWIN_SUF_EXTSN __DARWIN_SUF_NON_CANCELABLE)
     529: 
     530: /*
     531:  * symbol release macros
     532:  */
     533: #include <sys/_symbol_aliasing.h>
     534: 
     535: #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
     536: #define __DARWIN_ALIAS_STARTING(_mac, _iphone, x)   __DARWIN_ALIAS_STARTING_IPHONE_##_iphone(x)
     537: #elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
     538: #define __DARWIN_ALIAS_STARTING(_mac, _iphone, x)   __DARWIN_ALIAS_STARTING_MAC_##_mac(x)
     539: #else
     540: #define __DARWIN_ALIAS_STARTING(_mac, _iphone, x)   x
     541: #endif
     542: 
     543: 
     544: /*
     545:  * POSIX.1 requires that the macros we test be defined before any standard
     546:  * header file is included.  This permits us to convert values for feature
     547:  * testing, as necessary, using only _POSIX_C_SOURCE.
     548:  *
     549:  * Here's a quick run-down of the versions:
     550:  *  defined(_POSIX_SOURCE)        1003.1-1988
     551:  *  _POSIX_C_SOURCE == 1L        1003.1-1990
     552:  *  _POSIX_C_SOURCE == 2L        1003.2-1992 C Language Binding Option
     553:  *  _POSIX_C_SOURCE == 199309L        1003.1b-1993
     554:  *  _POSIX_C_SOURCE == 199506L        1003.1c-1995, 1003.1i-1995,
     555:  *                    and the omnibus ISO/IEC 9945-1: 1996
     556:  *  _POSIX_C_SOURCE == 200112L        1003.1-2001
     557:  *  _POSIX_C_SOURCE == 200809L        1003.1-2008
     558:  *
     559:  * In addition, the X/Open Portability Guide, which is now the Single UNIX
     560:  * Specification, defines a feature-test macro which indicates the version of
     561:  * that specification, and which subsumes _POSIX_C_SOURCE.
     562:  */
     563: 
     564: /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1L. */
     565: #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1L
     566: #undef _POSIX_C_SOURCE
     567: #define    _POSIX_C_SOURCE        199009L
     568: #endif
     569: 
     570: /* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2L. */
     571: #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2L
     572: #undef _POSIX_C_SOURCE
     573: #define    _POSIX_C_SOURCE        199209L
     574: #endif
     575: 
     576: /* Deal with various X/Open Portability Guides and Single UNIX Spec. */
     577: #ifdef _XOPEN_SOURCE
     578: #if _XOPEN_SOURCE - 0L >= 700L && (!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE - 0L < 200809L)
     579: #undef _POSIX_C_SOURCE
     580: #define _POSIX_C_SOURCE         200809L
     581: #elif _XOPEN_SOURCE - 0L >= 600L && (!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE - 0L < 200112L)
     582: #undef _POSIX_C_SOURCE
     583: #define    _POSIX_C_SOURCE        200112L
     584: #elif _XOPEN_SOURCE - 0L >= 500L && (!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE - 0L < 199506L)
     585: #undef _POSIX_C_SOURCE
     586: #define    _POSIX_C_SOURCE        199506L
     587: #endif
     588: #endif
     589: 
     590: /*
     591:  * Deal with all versions of POSIX.  The ordering relative to the tests above is
     592:  * important.
     593:  */
     594: #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
     595: #define _POSIX_C_SOURCE         198808L
     596: #endif
     597: 
     598: /* POSIX C deprecation macros */
     599: #include <sys/_posix_availability.h>
     600: 
     601: #define __POSIX_C_DEPRECATED(ver) ___POSIX_C_DEPRECATED_STARTING_##ver
     602: 
     603: /*
     604:  * Set a single macro which will always be defined and can be used to determine
     605:  * the appropriate namespace.  For POSIX, these values will correspond to
     606:  * _POSIX_C_SOURCE value.  Currently there are two additional levels corresponding
     607:  * to ANSI (_ANSI_SOURCE) and Darwin extensions (_DARWIN_C_SOURCE)
     608:  */
     609: #define __DARWIN_C_ANSI         010000L
     610: #define __DARWIN_C_FULL         900000L
     611: 
     612: #if   defined(_ANSI_SOURCE)
     613: #define __DARWIN_C_LEVEL        __DARWIN_C_ANSI
     614: #elif defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE) && !defined(_NONSTD_SOURCE)
     615: #define __DARWIN_C_LEVEL        _POSIX_C_SOURCE
     616: #else
     617: #define __DARWIN_C_LEVEL        __DARWIN_C_FULL
     618: #endif
     619: 
     620: /* If the developer has neither requested a strict language mode nor a version
     621:  * of POSIX, turn on functionality provided by __STDC_WANT_LIB_EXT1__ as part
     622:  * of __DARWIN_C_FULL.
     623:  */
     624: #if !defined(__STDC_WANT_LIB_EXT1__) && !defined(__STRICT_ANSI__) && __DARWIN_C_LEVEL >= __DARWIN_C_FULL
     625: #define __STDC_WANT_LIB_EXT1__ 1
     626: #endif
     627: 
     628: /*
     629:  * long long is not supported in c89 (__STRICT_ANSI__), but g++ -ansi and
     630:  * c99 still want long longs.  While not perfect, we allow long longs for
     631:  * g++.
     632:  */
     633: #define    __DARWIN_NO_LONG_LONG    (defined(__STRICT_ANSI__) \
     634:                 && (__STDC_VERSION__-0 < 199901L) \
     635:                 && !defined(__GNUG__))
     636: 
     637: /*****************************************
     638:  *  Public darwin-specific feature macros
     639:  *****************************************/
     640: 
     641: /*
     642:  * _DARWIN_FEATURE_64_BIT_INODE indicates that the ino_t type is 64-bit, and
     643:  * structures modified for 64-bit inodes (like struct stat) will be used.
     644:  */
     645: #if __DARWIN_64_BIT_INO_T
     646: #define _DARWIN_FEATURE_64_BIT_INODE        1
     647: #endif
     648: 
     649: /*
     650:  * _DARWIN_FEATURE_64_ONLY_BIT_INODE indicates that the ino_t type may only
     651:  * be 64-bit; there is no support for 32-bit ino_t when this macro is defined
     652:  * (and non-zero).  There is no struct stat64 either, as the regular
     653:  * struct stat will already be the 64-bit version.
     654:  */
     655: #if __DARWIN_ONLY_64_BIT_INO_T
     656: #define _DARWIN_FEATURE_ONLY_64_BIT_INODE    1
     657: #endif
     658: 
     659: /*
     660:  * _DARWIN_FEATURE_ONLY_VERS_1050 indicates that only those APIs updated
     661:  * in 10.5 exists; no pre-10.5 variants are available.
     662:  */
     663: #if __DARWIN_ONLY_VERS_1050
     664: #define _DARWIN_FEATURE_ONLY_VERS_1050        1
     665: #endif
     666: 
     667: /*
     668:  * _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE indicates only UNIX conforming API
     669:  * are available (the legacy BSD APIs are not available)
     670:  */
     671: #if __DARWIN_ONLY_UNIX_CONFORMANCE
     672: #define _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE    1
     673: #endif
     674: 
     675: /*
     676:  * _DARWIN_FEATURE_UNIX_CONFORMANCE indicates whether UNIX conformance is on,
     677:  * and specifies the conformance level (3 is SUSv3)
     678:  */
     679: #if __DARWIN_UNIX03
     680: #define _DARWIN_FEATURE_UNIX_CONFORMANCE    3
     681: #endif
     682: 
     683: /* 
     684:  * This macro casts away the qualifier from the variable
     685:  *
     686:  * Note: use at your own risk, removing qualifiers can result in
     687:  * catastrophic run-time failures.
     688:  */
     689: #ifndef __CAST_AWAY_QUALIFIER
     690: #define __CAST_AWAY_QUALIFIER(variable, qualifier, type)  (type) (long)(variable)
     691: #endif
     692: 
     693: /*
     694:  * __XNU_PRIVATE_EXTERN is a linkage decoration indicating that a symbol can be
     695:  * used from other compilation units, but not other libraries or executables.
     696:  */
     697: #ifndef __XNU_PRIVATE_EXTERN
     698: #define __XNU_PRIVATE_EXTERN __attribute__((visibility("hidden")))
     699: #endif
     700: 
     701: /*
     702:  * Architecture validation for current SDK
     703:  */
     704: #if !defined(__sys_cdefs_arch_unknown__) && defined(__i386__)
     705: #elif !defined(__sys_cdefs_arch_unknown__) && defined(__x86_64__)
     706: #else
     707: #error Unsupported architecture
     708: #endif
     709: 
     710: 
     711: #endif /* !_CDEFS_H_ */
     712: