cdefs.h revision 9b6cc223a36835c4367a036d4cfeff14d25bc742
11dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* $NetBSD: cdefs.h,v 1.58 2004/12/11 05:59:00 christos Exp $ */ 21dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 31dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* 41dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Copyright (c) 1991, 1993 51dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * The Regents of the University of California. All rights reserved. 61dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 71dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * This code is derived from software contributed to Berkeley by 81dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Berkeley Software Design, Inc. 91dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 101dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Redistribution and use in source and binary forms, with or without 111dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * modification, are permitted provided that the following conditions 121dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * are met: 131dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 1. Redistributions of source code must retain the above copyright 141dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * notice, this list of conditions and the following disclaimer. 151dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 2. Redistributions in binary form must reproduce the above copyright 161dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * notice, this list of conditions and the following disclaimer in the 171dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * documentation and/or other materials provided with the distribution. 181dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 3. Neither the name of the University nor the names of its contributors 191dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * may be used to endorse or promote products derived from this software 201dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * without specific prior written permission. 211dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 221dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 231dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 241dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 251dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 261dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 271dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 281dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 291dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 301dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 311dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 321dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * SUCH DAMAGE. 331dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 341dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 351dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */ 361dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 371dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#ifndef _SYS_CDEFS_H_ 381dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define _SYS_CDEFS_H_ 391dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 401dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* 411dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Macro to test if we're using a GNU C compiler of a specific vintage 421dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * or later, for e.g. features that appeared in a particular version 431dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * of GNU C. Usage: 441dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 451dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * #if __GNUC_PREREQ__(major, minor) 461dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * ...cool feature... 471dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * #else 481dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * ...delete feature... 491dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * #endif 501dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */ 511dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#ifdef __GNUC__ 521dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __GNUC_PREREQ__(x, y) \ 531dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \ 541dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project (__GNUC__ > (x))) 551dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 561dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __GNUC_PREREQ__(x, y) 0 571dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 581dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 591dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#include <sys/cdefs_elf.h> 601dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 611dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if defined(__cplusplus) 621dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __BEGIN_DECLS extern "C" { 631dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __END_DECLS } 641dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __static_cast(x,y) static_cast<x>(y) 651dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 661dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __BEGIN_DECLS 671dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __END_DECLS 681dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __static_cast(x,y) (x)y 691dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 701dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 711dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* 721dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * The __CONCAT macro is used to concatenate parts of symbol names, e.g. 731dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. 741dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * The __CONCAT macro is a bit tricky -- make sure you don't put spaces 751dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * in between its arguments. __CONCAT can also concatenate double-quoted 761dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * strings produced by the __STRING macro, but this only works with ANSI C. 771dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */ 781dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 791dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define ___STRING(x) __STRING(x) 801dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define ___CONCAT(x,y) __CONCAT(x,y) 811dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 828eda21baa54977e4d164a4174d06b6aa12115fb1David 'Digit' Turner#if defined(__STDC__) || defined(__cplusplus) 831dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __P(protos) protos /* full-blown ANSI C */ 841dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __CONCAT(x,y) x ## y 851dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __STRING(x) #x 861dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 871dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __const const /* define reserved names to standard */ 881dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __signed signed 891dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __volatile volatile 901dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if defined(__cplusplus) 911dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __inline inline /* convert to C++ keyword */ 921dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 931dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if !defined(__GNUC__) && !defined(__lint__) 941dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __inline /* delete GCC keyword */ 951dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif /* !__GNUC__ && !__lint__ */ 961dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif /* !__cplusplus */ 971dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 981dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else /* !(__STDC__ || __cplusplus) */ 991dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __P(protos) () /* traditional C preprocessor */ 1001dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __CONCAT(x,y) x/**/y 1011dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __STRING(x) "x" 1021dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 1031dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#ifndef __GNUC__ 1041dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __const /* delete pseudo-ANSI C keywords */ 1051dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __inline 1061dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __signed 1071dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __volatile 1081dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif /* !__GNUC__ */ 1091dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 1101dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* 1111dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * In non-ANSI C environments, new programs will want ANSI-only C keywords 1121dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * deleted from the program and old programs will want them left alone. 1131dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Programs using the ANSI C keywords const, inline etc. as normal 1141dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * identifiers should define -DNO_ANSI_KEYWORDS. 1151dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */ 1161dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#ifndef NO_ANSI_KEYWORDS 1171dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define const __const /* convert ANSI C keywords */ 1181dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define inline __inline 1191dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define signed __signed 1201dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define volatile __volatile 1211dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif /* !NO_ANSI_KEYWORDS */ 1221dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif /* !(__STDC__ || __cplusplus) */ 1231dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 1241dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* 1251dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Used for internal auditing of the NetBSD source tree. 1261dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */ 1271dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#ifdef __AUDIT__ 1281dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __aconst __const 1291dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 1301dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __aconst 1311dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 1321dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 1331dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* 1341dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * The following macro is used to remove const cast-away warnings 1351dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * from gcc -Wcast-qual; it should be used with caution because it 1361dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * can hide valid errors; in particular most valid uses are in 1371dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * situations where the API requires it, not to cast away string 1381dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * constants. We don't use *intptr_t on purpose here and we are 1391dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * explicit about unsigned long so that we don't have additional 1401dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * dependencies. 1411dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */ 1421dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) 1431dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 1441dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* 1451dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * GCC2 provides __extension__ to suppress warnings for various GNU C 1461dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * language extensions under "-ansi -pedantic". 1471dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */ 1481dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if !__GNUC_PREREQ__(2, 0) 1491dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __extension__ /* delete __extension__ if non-gcc or gcc1 */ 1501dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 1511dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 1521dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* 1531dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * GCC1 and some versions of GCC2 declare dead (non-returning) and 1541dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * pure (no side effects) functions using "volatile" and "const"; 1551dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * unfortunately, these then cause warnings under "-ansi -pedantic". 1561dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of 1571dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * these work for GNU C++ (modulo a slight glitch in the C++ grammar 1581dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * in the distribution version of 2.5.5). 1591dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */ 1601dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if !__GNUC_PREREQ__(2, 5) 1611dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */ 1621dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 1631dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __dead __volatile 1641dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __pure __const 1651dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 1661dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 1671dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 1681dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* Delete pseudo-keywords wherever they are not available or needed. */ 1691dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#ifndef __dead 1701dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __dead 1711dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __pure 1721dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 1731dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 1741dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if __GNUC_PREREQ__(2, 7) 1751dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __unused __attribute__((__unused__)) 1761dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 1771dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __unused /* delete */ 1781dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 1791dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 1801dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if __GNUC_PREREQ__(3, 1) 1811dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __used __attribute__((__used__)) 1821dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 1831dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __used /* delete */ 1841dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 1851dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 1861dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if __GNUC_PREREQ__(2, 7) 1871dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __packed __attribute__((__packed__)) 1881dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __aligned(x) __attribute__((__aligned__(x))) 1891dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __section(x) __attribute__((__section__(x))) 1901dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#elif defined(__lint__) 1911dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __packed /* delete */ 1921dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __aligned(x) /* delete */ 1931dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __section(x) /* delete */ 1941dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 1951dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __packed error: no __packed for this compiler 1961dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __aligned(x) error: no __aligned for this compiler 1971dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __section(x) error: no __section for this compiler 1981dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 1991dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 2001dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if !__GNUC_PREREQ__(2, 8) 2011dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __extension__ 2021dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 2031dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 2041dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if __GNUC_PREREQ__(2, 8) 2051dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __statement(x) __extension__(x) 2061dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#elif defined(lint) 2071dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __statement(x) (0) 2081dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 2091dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __statement(x) (x) 2101dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 2111dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 2121dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* 2131dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * C99 defines the restrict type qualifier keyword, which was made available 2141dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * in GCC 2.92. 2151dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */ 2168eda21baa54977e4d164a4174d06b6aa12115fb1David 'Digit' Turner#if defined(__STDC__VERSION__) && __STDC_VERSION__ >= 199901L 2171dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __restrict restrict 2181dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 2191dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if !__GNUC_PREREQ__(2, 92) 2201dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __restrict /* delete __restrict when not supported */ 2211dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 2221dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 2231dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 2241dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* 2251dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * C99 defines __func__ predefined identifier, which was made available 2261dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * in GCC 2.95. 2271dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */ 2288eda21baa54977e4d164a4174d06b6aa12115fb1David 'Digit' Turner#if !defined(__STDC_VERSION__) || !(__STDC_VERSION__ >= 199901L) 2291dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if __GNUC_PREREQ__(2, 6) 2301dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __func__ __PRETTY_FUNCTION__ 2311dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#elif __GNUC_PREREQ__(2, 4) 2321dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __func__ __FUNCTION__ 2331dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 2341dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __func__ "" 2351dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 2361dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif /* !(__STDC_VERSION__ >= 199901L) */ 2371dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 2381dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if defined(_KERNEL) 2391dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if defined(NO_KERNEL_RCSIDS) 2401dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#undef __KERNEL_RCSID 2411dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __KERNEL_RCSID(_n, _s) /* nothing */ 2421dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif /* NO_KERNEL_RCSIDS */ 2431dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif /* _KERNEL */ 2441dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 2451dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if !defined(_STANDALONE) && !defined(_KERNEL) 2461dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#ifdef __GNUC__ 2471dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __RENAME(x) ___RENAME(x) 2481dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 2491dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#ifdef __lint__ 2501dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __RENAME(x) __symbolrename(x) 2511dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 2521dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#error "No function renaming possible" 2531dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif /* __lint__ */ 2541dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif /* __GNUC__ */ 2551dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else /* _STANDALONE || _KERNEL */ 2561dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __RENAME(x) no renaming in kernel or standalone environment 2571dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 2581dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 2591dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* 2601dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * A barrier to stop the optimizer from moving code or assume live 2611dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * register values. This is gcc specific, the version is more or less 2621dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * arbitrary, might work with older compilers. 2631dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */ 2641dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if __GNUC_PREREQ__(2, 95) 2651dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __insn_barrier() __asm __volatile("":::"memory") 2661dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 2671dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __insn_barrier() /* */ 2681dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 2691dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 2701dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* 2711dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * GNU C version 2.96 adds explicit branch prediction so that 2721dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * the CPU back-end can hint the processor and also so that 2731dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * code blocks can be reordered such that the predicted path 2741dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * sees a more linear flow, thus improving cache behavior, etc. 2751dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 2761dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * The following two macros provide us with a way to use this 2771dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * compiler feature. Use __predict_true() if you expect the expression 2781dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * to evaluate to true, and __predict_false() if you expect the 2791dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * expression to evaluate to false. 2801dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 2811dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * A few notes about usage: 2821dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 2831dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * * Generally, __predict_false() error condition checks (unless 2841dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * you have some _strong_ reason to do otherwise, in which case 2851dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * document it), and/or __predict_true() `no-error' condition 2861dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * checks, assuming you want to optimize for the no-error case. 2871dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 2881dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * * Other than that, if you don't know the likelihood of a test 2891dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * succeeding from empirical or other `hard' evidence, don't 2901dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * make predictions. 2911dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 2921dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * * These are meant to be used in places that are run `a lot'. 2931dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * It is wasteful to make predictions in code that is run 2941dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * seldomly (e.g. at subsystem initialization time) as the 2951dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * basic block reordering that this affects can often generate 2961dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * larger code. 2971dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */ 2981dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if __GNUC_PREREQ__(2, 96) 2991dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __predict_true(exp) __builtin_expect((exp) != 0, 1) 3001dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __predict_false(exp) __builtin_expect((exp) != 0, 0) 3011dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 3021dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __predict_true(exp) (exp) 3031dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __predict_false(exp) (exp) 3041dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 3051dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 3061dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#if __GNUC_PREREQ__(2, 96) 3071dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __noreturn __attribute__((__noreturn__)) 3081dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __mallocfunc __attribute__((malloc)) 309a677907ee8ecca034318fdb97902fa73e7392c4fNick Kralevich#define __purefunc __attribute__((pure)) 3101dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#else 3111dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __noreturn 3121dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __mallocfunc 313a677907ee8ecca034318fdb97902fa73e7392c4fNick Kralevich#define __purefunc 3141dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif 3151dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 3161dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project/* 3171dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Macros for manipulating "link sets". Link sets are arrays of pointers 3181dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * to objects, which are gathered up by the linker. 3191dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 3201dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Object format-specific code has provided us with the following macros: 3211dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 3221dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * __link_set_add_text(set, sym) 3231dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Add a reference to the .text symbol `sym' to `set'. 3241dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 3251dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * __link_set_add_rodata(set, sym) 3261dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Add a reference to the .rodata symbol `sym' to `set'. 3271dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 3281dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * __link_set_add_data(set, sym) 3291dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Add a reference to the .data symbol `sym' to `set'. 3301dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 3311dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * __link_set_add_bss(set, sym) 3321dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Add a reference to the .bss symbol `sym' to `set'. 3331dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 3341dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * __link_set_decl(set, ptype) 3351dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Provide an extern declaration of the set `set', which 3361dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * contains an array of the pointer type `ptype'. This 3371dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * macro must be used by any code which wishes to reference 3381dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * the elements of a link set. 3391dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 3401dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * __link_set_start(set) 3411dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * This points to the first slot in the link set. 3421dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 3431dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * __link_set_end(set) 3441dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * This points to the (non-existent) slot after the last 3451dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * entry in the link set. 3461dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 3471dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * __link_set_count(set) 3481dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Count the number of entries in link set `set'. 3491dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 3501dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * In addition, we provide the following macros for accessing link sets: 3511dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 3521dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * __link_set_foreach(pvar, set) 3531dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Iterate over the link set `set'. Because a link set is 3541dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * an array of pointers, pvar must be declared as "type **pvar", 3551dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * and the actual entry accessed as "*pvar". 3561dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * 3571dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * __link_set_entry(set, idx) 3581dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project * Access the link set entry at index `idx' from set `set'. 3591dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project */ 3601dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __link_set_foreach(pvar, set) \ 3611dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project for (pvar = __link_set_start(set); pvar < __link_set_end(set); pvar++) 3621dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 3631dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __link_set_entry(set, idx) (__link_set_begin(set)[idx]) 3641dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 3653527fd6f0df794207215790321824b7844cc712dDavid 'Digit' Turner/* 3663527fd6f0df794207215790321824b7844cc712dDavid 'Digit' Turner * Some of the recend FreeBSD sources used in Bionic need this. 3673527fd6f0df794207215790321824b7844cc712dDavid 'Digit' Turner * Originally, this is used to embed the rcs versions of each source file 3683527fd6f0df794207215790321824b7844cc712dDavid 'Digit' Turner * in the generated binary. We certainly don't want this in Bionic. 3693527fd6f0df794207215790321824b7844cc712dDavid 'Digit' Turner */ 3703527fd6f0df794207215790321824b7844cc712dDavid 'Digit' Turner#define __FBSDID(s) struct __hack 3713527fd6f0df794207215790321824b7844cc712dDavid 'Digit' Turner 37250ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner/*- 37350ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * The following definitions are an extension of the behavior originally 37450ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * implemented in <sys/_posix.h>, but with a different level of granularity. 37550ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * POSIX.1 requires that the macros we test be defined before any standard 37650ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * header file is included. 37750ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * 37850ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * Here's a quick run-down of the versions: 37950ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * defined(_POSIX_SOURCE) 1003.1-1988 38050ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * _POSIX_C_SOURCE == 1 1003.1-1990 38150ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option 38250ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * _POSIX_C_SOURCE == 199309 1003.1b-1993 38350ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, 38450ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * and the omnibus ISO/IEC 9945-1: 1996 38550ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * _POSIX_C_SOURCE == 200112 1003.1-2001 38650ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * _POSIX_C_SOURCE == 200809 1003.1-2008 38750ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * 38850ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * In addition, the X/Open Portability Guide, which is now the Single UNIX 38950ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * Specification, defines a feature-test macro which indicates the version of 39050ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * that specification, and which subsumes _POSIX_C_SOURCE. 39150ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * 39250ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * Our macros begin with two underscores to avoid namespace screwage. 39350ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner */ 39450ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner 39550ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */ 39650ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1 39750ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */ 39850ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define _POSIX_C_SOURCE 199009 39950ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#endif 40050ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner 40150ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */ 40250ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2 40350ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#undef _POSIX_C_SOURCE 40450ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define _POSIX_C_SOURCE 199209 40550ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#endif 40650ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner 40750ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner/* Deal with various X/Open Portability Guides and Single UNIX Spec. */ 40850ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#ifdef _XOPEN_SOURCE 40950ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#if _XOPEN_SOURCE - 0 >= 700 41050ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __XSI_VISIBLE 700 41150ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#undef _POSIX_C_SOURCE 41250ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define _POSIX_C_SOURCE 200809 41350ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#elif _XOPEN_SOURCE - 0 >= 600 41450ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __XSI_VISIBLE 600 41550ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#undef _POSIX_C_SOURCE 41650ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define _POSIX_C_SOURCE 200112 41750ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#elif _XOPEN_SOURCE - 0 >= 500 41850ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __XSI_VISIBLE 500 41950ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#undef _POSIX_C_SOURCE 42050ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define _POSIX_C_SOURCE 199506 42150ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#endif 42250ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#endif 42350ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner 42450ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner/* 42550ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * Deal with all versions of POSIX. The ordering relative to the tests above is 42650ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * important. 42750ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner */ 42850ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) 42950ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define _POSIX_C_SOURCE 198808 43050ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#endif 43150ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#ifdef _POSIX_C_SOURCE 43250ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#if _POSIX_C_SOURCE >= 200809 43350ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __POSIX_VISIBLE 200809 43450ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __ISO_C_VISIBLE 1999 43550ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#elif _POSIX_C_SOURCE >= 200112 43650ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __POSIX_VISIBLE 200112 43750ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __ISO_C_VISIBLE 1999 43850ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#elif _POSIX_C_SOURCE >= 199506 43950ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __POSIX_VISIBLE 199506 44050ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __ISO_C_VISIBLE 1990 44150ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#elif _POSIX_C_SOURCE >= 199309 44250ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __POSIX_VISIBLE 199309 44350ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __ISO_C_VISIBLE 1990 44450ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#elif _POSIX_C_SOURCE >= 199209 44550ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __POSIX_VISIBLE 199209 44650ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __ISO_C_VISIBLE 1990 44750ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#elif _POSIX_C_SOURCE >= 199009 44850ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __POSIX_VISIBLE 199009 44950ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __ISO_C_VISIBLE 1990 45050ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#else 45150ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __POSIX_VISIBLE 198808 45250ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __ISO_C_VISIBLE 0 45350ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#endif /* _POSIX_C_SOURCE */ 45450ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#else 45550ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner/*- 45650ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * Deal with _ANSI_SOURCE: 45750ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * If it is defined, and no other compilation environment is explicitly 45850ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * requested, then define our internal feature-test macros to zero. This 45950ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * makes no difference to the preprocessor (undefined symbols in preprocessing 46050ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * expressions are defined to have value zero), but makes it more convenient for 46150ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * a test program to print out the values. 46250ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * 46350ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * If a program mistakenly defines _ANSI_SOURCE and some other macro such as 46450ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * _POSIX_C_SOURCE, we will assume that it wants the broader compilation 46550ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * environment (and in fact we will never get here). 46650ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner */ 46750ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#if defined(_ANSI_SOURCE) /* Hide almost everything. */ 46850ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __POSIX_VISIBLE 0 46950ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __XSI_VISIBLE 0 47050ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __BSD_VISIBLE 0 47150ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __ISO_C_VISIBLE 1990 47250ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */ 47350ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __POSIX_VISIBLE 0 47450ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __XSI_VISIBLE 0 47550ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __BSD_VISIBLE 0 47650ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __ISO_C_VISIBLE 1999 47750ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#else /* Default environment: show everything. */ 47850ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __POSIX_VISIBLE 200809 47950ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __XSI_VISIBLE 700 48050ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __BSD_VISIBLE 1 48150ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#define __ISO_C_VISIBLE 1999 48250ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#endif 48350ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#endif 48450ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner 48550ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner/* 48650ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner * Default values. 48750ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner */ 48850ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#ifndef __XPG_VISIBLE 48950ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner# define __XPG_VISIBLE 700 49050ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#endif 49150ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#ifndef __POSIX_VISIBLE 49250ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner# define __POSIX_VISIBLE 200809 49350ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#endif 49450ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#ifndef __ISO_C_VISIBLE 49550ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner# define __ISO_C_VISIBLE 1999 49650ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#endif 49750ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#ifndef __BSD_VISIBLE 49850ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner# define __BSD_VISIBLE 1 49950ace4fec5e8cb5afcbc656a4556fa528adfd760David 'Digit' Turner#endif 5003527fd6f0df794207215790321824b7844cc712dDavid 'Digit' Turner 5011dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#define __BIONIC__ 1 50223d24394e72715ddf580726655c8ba3fbcf11bfeDavid 'Digit' Turner#include <android/api-level.h> 5031dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project 50471a18dd435e96564539b5af71b8ea5093a2109a1Nick Kralevich#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 50571a18dd435e96564539b5af71b8ea5093a2109a1Nick Kralevich#define __BIONIC_FORTIFY_INLINE \ 50671a18dd435e96564539b5af71b8ea5093a2109a1Nick Kralevich extern inline \ 50771a18dd435e96564539b5af71b8ea5093a2109a1Nick Kralevich __attribute__ ((always_inline)) \ 50871a18dd435e96564539b5af71b8ea5093a2109a1Nick Kralevich __attribute__ ((gnu_inline)) \ 50971a18dd435e96564539b5af71b8ea5093a2109a1Nick Kralevich __attribute__ ((artificial)) 5109b6cc223a36835c4367a036d4cfeff14d25bc742Nick Kralevich#define __BIONIC_FORTIFY_UNKNOWN_SIZE ((size_t) -1) 51171a18dd435e96564539b5af71b8ea5093a2109a1Nick Kralevich#endif 51271a18dd435e96564539b5af71b8ea5093a2109a1Nick Kralevich 5131dc9e472e19acfe6dc7f41e429236e7eef7ceda1The Android Open Source Project#endif /* !_SYS_CDEFS_H_ */ 514