cdefs.h revision 132538
11541Srgrimes/* 21541Srgrimes * Copyright (c) 1991, 1993 31541Srgrimes * The Regents of the University of California. All rights reserved. 41541Srgrimes * 51541Srgrimes * This code is derived from software contributed to Berkeley by 61541Srgrimes * Berkeley Software Design, Inc. 71541Srgrimes * 81541Srgrimes * Redistribution and use in source and binary forms, with or without 91541Srgrimes * modification, are permitted provided that the following conditions 101541Srgrimes * are met: 111541Srgrimes * 1. Redistributions of source code must retain the above copyright 121541Srgrimes * notice, this list of conditions and the following disclaimer. 131541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141541Srgrimes * notice, this list of conditions and the following disclaimer in the 151541Srgrimes * documentation and/or other materials provided with the distribution. 161541Srgrimes * 4. Neither the name of the University nor the names of its contributors 171541Srgrimes * may be used to endorse or promote products derived from this software 181541Srgrimes * without specific prior written permission. 191541Srgrimes * 201541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 211541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 221541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 231541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 241541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 251541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 261541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 271541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 281541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 291541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 301541Srgrimes * SUCH DAMAGE. 311541Srgrimes * 3214495Shsu * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 3350477Speter * $FreeBSD: head/sys/sys/cdefs.h 132538 2004-07-22 09:20:51Z tjr $ 341541Srgrimes */ 351541Srgrimes 362165Spaul#ifndef _SYS_CDEFS_H_ 372165Spaul#define _SYS_CDEFS_H_ 381541Srgrimes 391541Srgrimes#if defined(__cplusplus) 401541Srgrimes#define __BEGIN_DECLS extern "C" { 4136449Sdt#define __END_DECLS } 421541Srgrimes#else 431541Srgrimes#define __BEGIN_DECLS 441541Srgrimes#define __END_DECLS 451541Srgrimes#endif 461541Srgrimes 471541Srgrimes/* 48120608Smux * Macro to test if we're using a specific version of gcc or later. 49120608Smux */ 50126891Strhodes#if defined(__GNUC__) && !defined(__INTEL_COMPILER) 51120608Smux#define __GNUC_PREREQ__(ma, mi) \ 52120629Smux (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)) 53120608Smux#else 54120608Smux#define __GNUC_PREREQ__(ma, mi) 0 55120608Smux#endif 56120608Smux 57120608Smux/* 581541Srgrimes * The __CONCAT macro is used to concatenate parts of symbol names, e.g. 591541Srgrimes * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. 6036971Sbde * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI 6136971Sbde * mode -- there must be no spaces between its arguments, and for nested 6236971Sbde * __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also 6336971Sbde * concatenate double-quoted strings produced by the __STRING macro, but 6436971Sbde * this only works with ANSI C. 6525083Sjdp * 6625083Sjdp * __XSTRING is like __STRING, but it expands any macros in its argument 6725083Sjdp * first. It is only available with ANSI C. 681541Srgrimes */ 691541Srgrimes#if defined(__STDC__) || defined(__cplusplus) 701541Srgrimes#define __P(protos) protos /* full-blown ANSI C */ 715012Sbde#define __CONCAT1(x,y) x ## y 725012Sbde#define __CONCAT(x,y) __CONCAT1(x,y) 7325083Sjdp#define __STRING(x) #x /* stringify without expanding x */ 7425083Sjdp#define __XSTRING(x) __STRING(x) /* expand x, then stringify */ 751541Srgrimes 761541Srgrimes#define __const const /* define reserved names to standard */ 771541Srgrimes#define __signed signed 781541Srgrimes#define __volatile volatile 791541Srgrimes#if defined(__cplusplus) 801541Srgrimes#define __inline inline /* convert to C++ keyword */ 811541Srgrimes#else 82126891Strhodes#if !(defined(__GNUC__) || defined(__INTEL_COMPILER)) 831541Srgrimes#define __inline /* delete GCC keyword */ 84126891Strhodes#endif /* !(__GNUC__ || __INTEL_COMPILER) */ 851541Srgrimes#endif /* !__cplusplus */ 861541Srgrimes 871541Srgrimes#else /* !(__STDC__ || __cplusplus) */ 881541Srgrimes#define __P(protos) () /* traditional C preprocessor */ 891541Srgrimes#define __CONCAT(x,y) x/**/y 901541Srgrimes#define __STRING(x) "x" 911541Srgrimes 92126891Strhodes#if !(defined(__GNUC__) || defined(__INTEL_COMPILER)) 931541Srgrimes#define __const /* delete pseudo-ANSI C keywords */ 941541Srgrimes#define __inline 951541Srgrimes#define __signed 961541Srgrimes#define __volatile 971541Srgrimes/* 981541Srgrimes * In non-ANSI C environments, new programs will want ANSI-only C keywords 991541Srgrimes * deleted from the program and old programs will want them left alone. 1001541Srgrimes * When using a compiler other than gcc, programs using the ANSI C keywords 1011541Srgrimes * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. 1021541Srgrimes * When using "gcc -traditional", we assume that this is the intent; if 1031541Srgrimes * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. 1041541Srgrimes */ 1051541Srgrimes#ifndef NO_ANSI_KEYWORDS 1061541Srgrimes#define const /* delete ANSI C keywords */ 1071541Srgrimes#define inline 1081541Srgrimes#define signed 1091541Srgrimes#define volatile 1105209Snate#endif /* !NO_ANSI_KEYWORDS */ 111126891Strhodes#endif /* !(__GNUC__ || __INTEL_COMPILER) */ 1121541Srgrimes#endif /* !(__STDC__ || __cplusplus) */ 1131541Srgrimes 1141541Srgrimes/* 11538509Sbde * Compiler-dependent macros to help declare dead (non-returning) and 11638509Sbde * pure (no side effects) functions, and unused variables. They are 11738509Sbde * null except for versions of gcc that are known to support the features 11838509Sbde * properly (old versions of gcc-2 supported the dead and pure features 119103845Speter * in a different (wrong) way). If we do not provide an implementation 120103845Speter * for a given compiler, let the compile fail if it is told to use 121103845Speter * a feature that we cannot live without. 1221541Srgrimes */ 123103845Speter#ifdef lint 12483443Sasmodai#define __dead2 12583443Sasmodai#define __pure2 12683443Sasmodai#define __unused 127103834Speter#define __packed 128103836Speter#define __aligned(x) 129103841Speter#define __section(x) 130103845Speter#else 131126891Strhodes#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER) 132103845Speter#define __dead2 133103845Speter#define __pure2 134103845Speter#define __unused 1352059Sdg#endif 136126891Strhodes#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER) 13783443Sasmodai#define __dead2 __attribute__((__noreturn__)) 13883443Sasmodai#define __pure2 __attribute__((__const__)) 13983443Sasmodai#define __unused 140103845Speter/* XXX Find out what to do for __packed, __aligned and __section */ 1411541Srgrimes#endif 142120608Smux#if __GNUC_PREREQ__(2, 7) 14383443Sasmodai#define __dead2 __attribute__((__noreturn__)) 14483443Sasmodai#define __pure2 __attribute__((__const__)) 14583443Sasmodai#define __unused __attribute__((__unused__)) 146103834Speter#define __packed __attribute__((__packed__)) 147103834Speter#define __aligned(x) __attribute__((__aligned__(x))) 148103836Speter#define __section(x) __attribute__((__section__(x))) 14917648Speter#endif 150126891Strhodes#if defined(__INTEL_COMPILER) 151126891Strhodes#define __dead2 __attribute__((__noreturn__)) 152126891Strhodes#define __pure2 __attribute__((__const__)) 153126891Strhodes#define __unused __attribute__((__unused__)) 154126891Strhodes#define __packed __attribute__((__packed__)) 155126891Strhodes#define __aligned(x) __attribute__((__aligned__(x))) 156126891Strhodes#define __section(x) __attribute__((__section__(x))) 157103845Speter#endif 158126891Strhodes#endif 1591541Srgrimes 160132538Stjr#if __GNUC_PREREQ__(2, 96) 161132538Stjr#define __pure __attribute__((__pure__)) 162132538Stjr#else 163132538Stjr#define __pure 164132538Stjr#endif 165132538Stjr 166126891Strhodes#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800) 167117906Speter#define __always_inline __attribute__((__always_inline__)) 168117906Speter#else 169117906Speter#define __always_inline 170117906Speter#endif 171117906Speter 172120608Smux#if __GNUC_PREREQ__(3, 3) 173117837Sphk#define __nonnull(x) __attribute__((__nonnull__(x))) 174117837Sphk#else 175117837Sphk#define __nonnull(x) 176117837Sphk#endif 177117837Sphk 17885672Smike/* XXX: should use `#if __STDC_VERSION__ < 199901'. */ 179126891Strhodes#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) 18085672Smike#define __func__ NULL 18185672Smike#endif 18285672Smike 183126891Strhodes#if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 18486302Smike#define __LONG_LONG_SUPPORTED 18586302Smike#endif 18686302Smike 18738509Sbde/* 188104591Smike * GCC 2.95 provides `__restrict' as an extension to C90 to support the 189103370Swollman * C99-specific `restrict' type qualifier. We happen to use `__restrict' as 190103370Swollman * a way to define the `restrict' type qualifier without disturbing older 191103370Swollman * software that is unaware of C99 keywords. 19286803Smike */ 19386803Smike#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95) 194121783Speter#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 19586803Smike#define __restrict 19686803Smike#else 19786803Smike#define __restrict restrict 19886803Smike#endif 19986803Smike#endif 20086803Smike 20186803Smike/* 202120609Smux * GNU C version 2.96 adds explicit branch prediction so that 203120609Smux * the CPU back-end can hint the processor and also so that 204120609Smux * code blocks can be reordered such that the predicted path 205120609Smux * sees a more linear flow, thus improving cache behavior, etc. 206120609Smux * 207120609Smux * The following two macros provide us with a way to utilize this 208120609Smux * compiler feature. Use __predict_true() if you expect the expression 209120609Smux * to evaluate to true, and __predict_false() if you expect the 210120609Smux * expression to evaluate to false. 211120609Smux * 212120609Smux * A few notes about usage: 213120609Smux * 214120609Smux * * Generally, __predict_false() error condition checks (unless 215120609Smux * you have some _strong_ reason to do otherwise, in which case 216120609Smux * document it), and/or __predict_true() `no-error' condition 217120609Smux * checks, assuming you want to optimize for the no-error case. 218120609Smux * 219120609Smux * * Other than that, if you don't know the likelihood of a test 220120609Smux * succeeding from empirical or other `hard' evidence, don't 221120609Smux * make predictions. 222120609Smux * 223120609Smux * * These are meant to be used in places that are run `a lot'. 224120609Smux * It is wasteful to make predictions in code that is run 225120609Smux * seldomly (e.g. at subsystem initialization time) as the 226120609Smux * basic block reordering that this affects can often generate 227120609Smux * larger code. 228120609Smux */ 229120609Smux#if __GNUC_PREREQ__(2, 96) 230120609Smux#define __predict_true(exp) __builtin_expect((exp), 1) 231120609Smux#define __predict_false(exp) __builtin_expect((exp), 0) 232120609Smux#else 233120609Smux#define __predict_true(exp) (exp) 234120609Smux#define __predict_false(exp) (exp) 235120609Smux#endif 236120609Smux 237120609Smux/* 23899594Smike * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h> 23999594Smike * require it. 24099594Smike */ 24199594Smike#define __offsetof(type, field) ((size_t)(&((type *)0)->field)) 24299594Smike 24399594Smike/* 24438509Sbde * Compiler-dependent macros to declare that functions take printf-like 24538509Sbde * or scanf-like arguments. They are null except for versions of gcc 24638509Sbde * that are known to support the features properly (old versions of gcc-2 24738509Sbde * didn't permit keeping the keywords out of the application namespace). 24838509Sbde */ 249126891Strhodes#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) 25037614Sbde#define __printflike(fmtarg, firstvararg) 25137614Sbde#define __scanflike(fmtarg, firstvararg) 25237614Sbde#else 25337614Sbde#define __printflike(fmtarg, firstvararg) \ 25437614Sbde __attribute__((__format__ (__printf__, fmtarg, firstvararg))) 25537614Sbde#define __scanflike(fmtarg, firstvararg) \ 25637614Sbde __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) 25737614Sbde#endif 25837614Sbde 25940716Sjdp/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ 260126891Strhodes#if __FreeBSD_cc_version >= 300001 && defined(__GNUC__) && !defined(__INTEL_COMPILER) 26140716Sjdp#define __printf0like(fmtarg, firstvararg) \ 26240716Sjdp __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) 26340716Sjdp#else 26440716Sjdp#define __printf0like(fmtarg, firstvararg) 26540716Sjdp#endif 26640716Sjdp 267126891Strhodes#if defined(__GNUC__) || defined(__INTEL_COMPILER) 268126891Strhodes#ifndef __INTEL_COMPILER 26983443Sasmodai#define __strong_reference(sym,aliassym) \ 27058256Sjasone extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))); 271126891Strhodes#endif 2725209Snate#ifdef __STDC__ 27337052Speter#define __weak_reference(sym,alias) \ 27437052Speter __asm__(".weak " #alias); \ 27537862Sdfr __asm__(".equ " #alias ", " #sym) 27637052Speter#define __warn_references(sym,msg) \ 27737052Speter __asm__(".section .gnu.warning." #sym); \ 27839502Sjdp __asm__(".asciz \"" msg "\""); \ 27937052Speter __asm__(".previous") 28037052Speter#else 28137052Speter#define __weak_reference(sym,alias) \ 28237052Speter __asm__(".weak alias"); \ 28337862Sdfr __asm__(".equ alias, sym") 28437052Speter#define __warn_references(sym,msg) \ 28537052Speter __asm__(".section .gnu.warning.sym"); \ 28639502Sjdp __asm__(".asciz \"msg\""); \ 28737052Speter __asm__(".previous") 28837052Speter#endif /* __STDC__ */ 289126891Strhodes#endif /* __GNUC__ || __INTEL_COMPILER */ 2905209Snate 291126891Strhodes#if defined(__GNUC__) || defined(__INTEL_COMPILER) 29250614Speter#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"") 29350614Speter#else 29483049Speter/* 295118023Sgad * The following definition might not work well if used in header files, 296118023Sgad * but it should be better than nothing. If you want a "do nothing" 297118023Sgad * version, then it should generate some harmless declaration, such as: 298118023Sgad * #define __IDSTRING(name,string) struct __hack 29983049Speter */ 30036971Sbde#define __IDSTRING(name,string) static const char name[] __unused = string 30150614Speter#endif 30231707Spst 30383552Sdillon/* 30483552Sdillon * Embed the rcs id of a source file in the resulting library. Note that in 30583552Sdillon * more recent ELF binutils, we use .ident allowing the ID to be stripped. 30683552Sdillon * Usage: 30783552Sdillon * __FBSDID("$FreeBSD: head/sys/sys/cdefs.h 132538 2004-07-22 09:20:51Z tjr $"); 30883552Sdillon */ 30983489Sdillon#ifndef __FBSDID 31083528Sobrien#if !defined(lint) && !defined(STRIP_FBSDID) 31183526Sobrien#define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) 31283489Sdillon#else 31383552Sdillon#define __FBSDID(s) struct __hack 31483489Sdillon#endif 31583489Sdillon#endif 31683489Sdillon 31793996Sobrien#ifndef __RCSID 31893996Sobrien#ifndef NO__RCSID 31993993Sobrien#define __RCSID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) 32093996Sobrien#else 321118023Sgad#define __RCSID(s) struct __hack 32293993Sobrien#endif 32393996Sobrien#endif 32493993Sobrien 32593996Sobrien#ifndef __RCSID_SOURCE 32693996Sobrien#ifndef NO__RCSID_SOURCE 32783049Speter#define __RCSID_SOURCE(s) __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s) 32893996Sobrien#else 329118023Sgad#define __RCSID_SOURCE(s) struct __hack 33031707Spst#endif 33193996Sobrien#endif 33231707Spst 33393996Sobrien#ifndef __SCCSID 33493996Sobrien#ifndef NO__SCCSID 33593996Sobrien#define __SCCSID(s) __IDSTRING(__CONCAT(__sccsid_,__LINE__),s) 33693996Sobrien#else 337118023Sgad#define __SCCSID(s) struct __hack 33893996Sobrien#endif 33993996Sobrien#endif 34093996Sobrien 34193996Sobrien#ifndef __COPYRIGHT 34293996Sobrien#ifndef NO__COPYRIGHT 34383049Speter#define __COPYRIGHT(s) __IDSTRING(__CONCAT(__copyright_,__LINE__),s) 34493996Sobrien#else 345118023Sgad#define __COPYRIGHT(s) struct __hack 34631707Spst#endif 34793996Sobrien#endif 34831707Spst 34974070Sbillf#ifndef __DECONST 35074070Sbillf#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) 35174070Sbillf#endif 35274070Sbillf 35374070Sbillf#ifndef __DEVOLATILE 35474070Sbillf#define __DEVOLATILE(type, var) ((type)(uintptr_t)(volatile void *)(var)) 35574070Sbillf#endif 35674070Sbillf 35774070Sbillf#ifndef __DEQUALIFY 35874070Sbillf#define __DEQUALIFY(type, var) ((type)(uintptr_t)(const volatile void *)(var)) 35974070Sbillf#endif 36074070Sbillf 36193510Smike/*- 36293510Smike * The following definitions are an extension of the behavior originally 36399904Smikeh * implemented in <sys/_posix.h>, but with a different level of granularity. 36493510Smike * POSIX.1 requires that the macros we test be defined before any standard 36593510Smike * header file is included. 36693510Smike * 36793510Smike * Here's a quick run-down of the versions: 36893510Smike * defined(_POSIX_SOURCE) 1003.1-1988 36993510Smike * _POSIX_C_SOURCE == 1 1003.1-1990 370100109Swollman * _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option 37193510Smike * _POSIX_C_SOURCE == 199309 1003.1b-1993 37293510Smike * _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, 37393510Smike * and the omnibus ISO/IEC 9945-1: 1996 37493510Smike * _POSIX_C_SOURCE == 200112 1003.1-2001 37593510Smike * 37693510Smike * In addition, the X/Open Portability Guide, which is now the Single UNIX 37793510Smike * Specification, defines a feature-test macro which indicates the version of 37893510Smike * that specification, and which subsumes _POSIX_C_SOURCE. 37993510Smike * 38093510Smike * Our macros begin with two underscores to avoid namespace screwage. 38193510Smike */ 38293510Smike 38393510Smike/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */ 384121783Speter#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1 38593510Smike#undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */ 38693510Smike#define _POSIX_C_SOURCE 199009 38793510Smike#endif 38893510Smike 389100109Swollman/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */ 390121783Speter#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2 391100109Swollman#undef _POSIX_C_SOURCE 392100109Swollman#define _POSIX_C_SOURCE 199209 393100109Swollman#endif 394100109Swollman 39593510Smike/* Deal with various X/Open Portability Guides and Single UNIX Spec. */ 39693510Smike#ifdef _XOPEN_SOURCE 39793715Speter#if _XOPEN_SOURCE - 0 >= 600 39893510Smike#define __XSI_VISIBLE 600 39993510Smike#undef _POSIX_C_SOURCE 40093510Smike#define _POSIX_C_SOURCE 200112 40193715Speter#elif _XOPEN_SOURCE - 0 >= 500 40293510Smike#define __XSI_VISIBLE 500 40393510Smike#undef _POSIX_C_SOURCE 40493510Smike#define _POSIX_C_SOURCE 199506 40593510Smike#endif 40693510Smike#endif 40793510Smike 40893510Smike/* 40993510Smike * Deal with all versions of POSIX. The ordering relative to the tests above is 41093510Smike * important. 41193510Smike */ 41293510Smike#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) 41393510Smike#define _POSIX_C_SOURCE 198808 41493510Smike#endif 41593510Smike#ifdef _POSIX_C_SOURCE 41693510Smike#if _POSIX_C_SOURCE >= 200112 41793510Smike#define __POSIX_VISIBLE 200112 41893510Smike#define __ISO_C_VISIBLE 1999 41993510Smike#elif _POSIX_C_SOURCE >= 199506 42093510Smike#define __POSIX_VISIBLE 199506 42193510Smike#define __ISO_C_VISIBLE 1990 42293510Smike#elif _POSIX_C_SOURCE >= 199309 42393510Smike#define __POSIX_VISIBLE 199309 42493510Smike#define __ISO_C_VISIBLE 1990 425100109Swollman#elif _POSIX_C_SOURCE >= 199209 426100109Swollman#define __POSIX_VISIBLE 199209 427100109Swollman#define __ISO_C_VISIBLE 1990 42893510Smike#elif _POSIX_C_SOURCE >= 199009 42993510Smike#define __POSIX_VISIBLE 199009 43093510Smike#define __ISO_C_VISIBLE 1990 43193510Smike#else 43293510Smike#define __POSIX_VISIBLE 198808 43393510Smike#define __ISO_C_VISIBLE 0 43493510Smike#endif /* _POSIX_C_SOURCE */ 43593510Smike#else 43693510Smike/*- 43793510Smike * Deal with _ANSI_SOURCE: 43893510Smike * If it is defined, and no other compilation environment is explicitly 43993510Smike * requested, then define our internal feature-test macros to zero. This 44093510Smike * makes no difference to the preprocessor (undefined symbols in preprocessing 44193510Smike * expressions are defined to have value zero), but makes it more convenient for 44293510Smike * a test program to print out the values. 44393510Smike * 44493510Smike * If a program mistakenly defines _ANSI_SOURCE and some other macro such as 44593510Smike * _POSIX_C_SOURCE, we will assume that it wants the broader compilation 44693510Smike * environment (and in fact we will never get here). 44793510Smike */ 448105654Smike#if defined(_ANSI_SOURCE) /* Hide almost everything. */ 44993510Smike#define __POSIX_VISIBLE 0 45093510Smike#define __XSI_VISIBLE 0 45193510Smike#define __BSD_VISIBLE 0 45293510Smike#define __ISO_C_VISIBLE 1990 453105654Smike#elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */ 454105654Smike#define __POSIX_VISIBLE 0 455105654Smike#define __XSI_VISIBLE 0 456105654Smike#define __BSD_VISIBLE 0 457105654Smike#define __ISO_C_VISIBLE 1999 45893510Smike#else /* Default environment: show everything. */ 45993510Smike#define __POSIX_VISIBLE 200112 46093510Smike#define __XSI_VISIBLE 600 46193510Smike#define __BSD_VISIBLE 1 46293510Smike#define __ISO_C_VISIBLE 1999 46393510Smike#endif 46493510Smike#endif 46593510Smike 4662212Sbde#endif /* !_SYS_CDEFS_H_ */ 467