Ignore:
Timestamp:
May 19, 2003, 4:41:00 AM (22 years ago)
Author:
bird
Message:

#434: Initial tcpip header merges.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/sys/cdefs.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /*
     1/*- modified for gcc/os2 by bird 2003
     2 *
    23 * Copyright (c) 1991, 1993
    34 *      The Regents of the University of California.  All rights reserved.
     
    3435 * SUCH DAMAGE.
    3536 *
    36  *      @(#)cdefs.h     8.7 (Berkeley) 1/21/94
    37  */
    38 
    39 #ifndef _CDEFS_H_
    40 #define _CDEFS_H_
     37 *      @(#)cdefs.h     8.8 (Berkeley) 1/9/95
     38 * $FreeBSD: src/sys/sys/cdefs.h,v 1.68 2002/10/21 20:50:30 mike Exp $
     39 */
     40
     41#ifndef _SYS_CDEFS_H_
     42#define _SYS_CDEFS_H_
     43#define _CDEFS_H_ /* compatability */
    4144
    4245#if defined(__cplusplus)
    4346#define __BEGIN_DECLS   extern "C" {
    44 #define __END_DECLS     };
     47#define __END_DECLS     }
    4548#else
    4649#define __BEGIN_DECLS
     
    5154 * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
    5255 * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
    53  * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
    54  * in between its arguments.  __CONCAT can also concatenate double-quoted
    55  * strings produced by the __STRING macro, but this only works with ANSI C.
     56 * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
     57 * mode -- there must be no spaces between its arguments, and for nested
     58 * __CONCAT's, all the __CONCAT's must be at the left.  __CONCAT can also
     59 * concatenate double-quoted strings produced by the __STRING macro, but
     60 * this only works with ANSI C.
     61 *
     62 * __XSTRING is like __STRING, but it expands any macros in its argument
     63 * first.  It is only available with ANSI C.
    5664 */
    5765#if defined(__STDC__) || defined(__cplusplus)
    5866#define __P(protos)     protos          /* full-blown ANSI C */
    59 #define __CONCAT(x,y)   x ## y
    60 #define __STRING(x)     #x
     67#define __CONCAT1(x,y)  x ## y
     68#define __CONCAT(x,y)   __CONCAT1(x,y)
     69#define __STRING(x)     #x              /* stringify without expanding x */
     70#define __XSTRING(x)    __STRING(x)     /* expand x, then stringify */
    6171
    6272#define __const         const           /* define reserved names to standard */
     
    94104#define signed
    95105#define volatile
    96 #endif
     106#endif  /* !NO_ANSI_KEYWORDS */
    97107#endif  /* !__GNUC__ */
    98108#endif  /* !(__STDC__ || __cplusplus) */
    99109
    100110/*
    101  * GCC1 and some versions of GCC2 declare dead (non-returning) and
    102  * pure (no side effects) functions using "volatile" and "const";
    103  * unfortunately, these then cause warnings under "-ansi -pedantic".
    104  * GCC2 uses a new, peculiar __attribute__((attrs)) style.  All of
    105  * these work for GNU C++ (modulo a slight glitch in the C++ grammar
    106  * in the distribution version of 2.5.5).
    107  */
    108 #if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5
    109 #define __attribute__(x)        /* delete __attribute__ if non-gcc or gcc1 */
    110 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
    111 #define __dead          __volatile
    112 #define __pure          __const
    113 #endif
    114 #endif
    115 
    116 /* Delete pseudo-keywords wherever they are not available or needed. */
    117 #ifndef __dead
    118 #define __dead
    119 #define __pure
    120 #endif
    121 
    122 #endif /* !_CDEFS_H_ */
     111 * Compiler-dependent macros to help declare dead (non-returning) and
     112 * pure (no side effects) functions, and unused variables.  They are
     113 * null except for versions of gcc that are known to support the features
     114 * properly (old versions of gcc-2 supported the dead and pure features
     115 * in a different (wrong) way).  If we do not provide an implementation
     116 * for a given compiler, let the compile fail if it is told to use
     117 * a feature that we cannot live without.
     118 */
     119#ifdef lint
     120#define __dead2
     121#define __pure2
     122#define __unused
     123#define __packed
     124#define __aligned(x)
     125#define __section(x)
     126#else
     127#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5
     128#define __dead2
     129#define __pure2
     130#define __unused
     131#endif
     132#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7
     133#define __dead2         __attribute__((__noreturn__))
     134#define __pure2         __attribute__((__const__))
     135#define __unused
     136/* XXX Find out what to do for __packed, __aligned and __section */
     137#endif
     138#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3
     139#define __dead2         __attribute__((__noreturn__))
     140#define __pure2         __attribute__((__const__))
     141#define __unused        __attribute__((__unused__))
     142#define __packed        __attribute__((__packed__))
     143#define __aligned(x)    __attribute__((__aligned__(x)))
     144#define __section(x)    __attribute__((__section__(x)))
     145#endif
     146#endif
     147
     148/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
     149#if !(__GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3)
     150#define __func__        NULL
     151#endif
     152
     153#if __GNUC__ >= 2 && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
     154#define __LONG_LONG_SUPPORTED
     155#endif
     156
     157/*
     158 * GCC 2.95 provides `__restrict' as an extension to C90 to support the
     159 * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as
     160 * a way to define the `restrict' type qualifier without disturbing older
     161 * software that is unaware of C99 keywords.
     162 */
     163#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
     164#if __STDC_VERSION__ < 199901
     165#define __restrict
     166#else
     167#define __restrict      restrict
     168#endif
     169#endif
     170
     171/*
     172 * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
     173 * require it.
     174 */
     175#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
     176
     177/*
     178 * Compiler-dependent macros to declare that functions take printf-like
     179 * or scanf-like arguments.  They are null except for versions of gcc
     180 * that are known to support the features properly (old versions of gcc-2
     181 * didn't permit keeping the keywords out of the application namespace).
     182 */
     183#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 7
     184#define __printflike(fmtarg, firstvararg)
     185#define __scanflike(fmtarg, firstvararg)
     186#else
     187#define __printflike(fmtarg, firstvararg) \
     188            __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
     189#define __scanflike(fmtarg, firstvararg) \
     190            __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
     191#endif
     192
     193/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
     194#if __FreeBSD_cc_version >= 300001 && __FreeBSD_cc_version < 500003
     195#define __printf0like(fmtarg, firstvararg) \
     196            __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
     197#else
     198#define __printf0like(fmtarg, firstvararg)
     199#endif
     200
     201#if 0 /* def __GNUC__ - ELF specific, so skip everything */
     202#define __strong_reference(sym,aliassym)        \
     203        extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
     204#ifdef __STDC__
     205#define __weak_reference(sym,alias)     \
     206        __asm__(".weak " #alias);       \
     207        __asm__(".equ "  #alias ", " #sym)
     208#define __warn_references(sym,msg)      \
     209        __asm__(".section .gnu.warning." #sym); \
     210        __asm__(".asciz \"" msg "\"");  \
     211        __asm__(".previous")
     212#else
     213#define __weak_reference(sym,alias)     \
     214        __asm__(".weak alias");         \
     215        __asm__(".equ alias, sym")
     216#define __warn_references(sym,msg)      \
     217        __asm__(".section .gnu.warning.sym"); \
     218        __asm__(".asciz \"msg\"");      \
     219        __asm__(".previous")
     220#endif  /* __STDC__ */
     221#endif  /* __GNUC__ */
     222
     223#if 0 /*def __GNUC__ - ELF specific. */
     224#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")
     225#else
     226/*
     227 * This doesn't work in header files. But it may be better than nothing.
     228 * The alternative is: #define __IDSTRING(name,string)  [nothing]
     229 */
     230#define __IDSTRING(name,string) static const char name[] __unused = string
     231#endif
     232
     233/*
     234 * Embed the rcs id of a source file in the resulting library.  Note that in
     235 * more recent ELF binutils, we use .ident allowing the ID to be stripped.
     236 * Usage:
     237 *      __FBSDID("$FreeBSD: src/sys/sys/cdefs.h,v 1.68 2002/10/21 20:50:30 mike Exp $");
     238 */
     239#ifndef __FBSDID
     240#if !defined(lint) && !defined(STRIP_FBSDID)
     241#define __FBSDID(s)     __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
     242#else
     243#define __FBSDID(s)     struct __hack
     244#endif
     245#endif
     246
     247#ifndef __RCSID
     248#ifndef NO__RCSID
     249#define __RCSID(s)      __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
     250#else
     251#define __RCSID(s)
     252#endif
     253#endif
     254
     255#ifndef __RCSID_SOURCE
     256#ifndef NO__RCSID_SOURCE
     257#define __RCSID_SOURCE(s)       __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
     258#else
     259#define __RCSID_SOURCE(s)
     260#endif
     261#endif
     262
     263#ifndef __SCCSID
     264#ifndef NO__SCCSID
     265#define __SCCSID(s)     __IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
     266#else
     267#define __SCCSID(s)
     268#endif
     269#endif
     270
     271#ifndef __COPYRIGHT
     272#ifndef NO__COPYRIGHT
     273#define __COPYRIGHT(s)  __IDSTRING(__CONCAT(__copyright_,__LINE__),s)
     274#else
     275#define __COPYRIGHT(s)
     276#endif
     277#endif
     278
     279#ifndef __DECONST
     280#define __DECONST(type, var)    ((type)(uintptr_t)(const void *)(var))
     281#endif
     282
     283#ifndef __DEVOLATILE
     284#define __DEVOLATILE(type, var) ((type)(uintptr_t)(volatile void *)(var))
     285#endif
     286
     287#ifndef __DEQUALIFY
     288#define __DEQUALIFY(type, var)  ((type)(uintptr_t)(const volatile void *)(var))
     289#endif
     290
     291/*-
     292 * The following definitions are an extension of the behavior originally
     293 * implemented in <sys/_posix.h>, but with a different level of granularity.
     294 * POSIX.1 requires that the macros we test be defined before any standard
     295 * header file is included.
     296 *
     297 * Here's a quick run-down of the versions:
     298 *  defined(_POSIX_SOURCE)              1003.1-1988
     299 *  _POSIX_C_SOURCE == 1                1003.1-1990
     300 *  _POSIX_C_SOURCE == 2                1003.2-1992 C Language Binding Option
     301 *  _POSIX_C_SOURCE == 199309           1003.1b-1993
     302 *  _POSIX_C_SOURCE == 199506           1003.1c-1995, 1003.1i-1995,
     303 *                                      and the omnibus ISO/IEC 9945-1: 1996
     304 *  _POSIX_C_SOURCE == 200112           1003.1-2001
     305 *
     306 * In addition, the X/Open Portability Guide, which is now the Single UNIX
     307 * Specification, defines a feature-test macro which indicates the version of
     308 * that specification, and which subsumes _POSIX_C_SOURCE.
     309 *
     310 * Our macros begin with two underscores to avoid namespace screwage.
     311 */
     312
     313/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
     314#if _POSIX_C_SOURCE == 1
     315#undef _POSIX_C_SOURCE          /* Probably illegal, but beyond caring now. */
     316#define _POSIX_C_SOURCE         199009
     317#endif
     318
     319/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
     320#if _POSIX_C_SOURCE == 2
     321#undef _POSIX_C_SOURCE
     322#define _POSIX_C_SOURCE         199209
     323#endif
     324
     325/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
     326#ifdef _XOPEN_SOURCE
     327#if _XOPEN_SOURCE - 0 >= 600
     328#define __XSI_VISIBLE           600
     329#undef _POSIX_C_SOURCE
     330#define _POSIX_C_SOURCE         200112
     331#elif _XOPEN_SOURCE - 0 >= 500
     332#define __XSI_VISIBLE           500
     333#undef _POSIX_C_SOURCE
     334#define _POSIX_C_SOURCE         199506
     335#endif
     336#endif
     337
     338/*
     339 * Deal with all versions of POSIX.  The ordering relative to the tests above is
     340 * important.
     341 */
     342#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
     343#define _POSIX_C_SOURCE         198808
     344#endif
     345#ifdef _POSIX_C_SOURCE
     346#if _POSIX_C_SOURCE >= 200112
     347#define __POSIX_VISIBLE         200112
     348#define __ISO_C_VISIBLE         1999
     349#elif _POSIX_C_SOURCE >= 199506
     350#define __POSIX_VISIBLE         199506
     351#define __ISO_C_VISIBLE         1990
     352#elif _POSIX_C_SOURCE >= 199309
     353#define __POSIX_VISIBLE         199309
     354#define __ISO_C_VISIBLE         1990
     355#elif _POSIX_C_SOURCE >= 199209
     356#define __POSIX_VISIBLE         199209
     357#define __ISO_C_VISIBLE         1990
     358#elif _POSIX_C_SOURCE >= 199009
     359#define __POSIX_VISIBLE         199009
     360#define __ISO_C_VISIBLE         1990
     361#else
     362#define __POSIX_VISIBLE         198808
     363#define __ISO_C_VISIBLE         0
     364#endif /* _POSIX_C_SOURCE */
     365#else
     366/*-
     367 * Deal with _ANSI_SOURCE:
     368 * If it is defined, and no other compilation environment is explicitly
     369 * requested, then define our internal feature-test macros to zero.  This
     370 * makes no difference to the preprocessor (undefined symbols in preprocessing
     371 * expressions are defined to have value zero), but makes it more convenient for
     372 * a test program to print out the values.
     373 *
     374 * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
     375 * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
     376 * environment (and in fact we will never get here).
     377 */
     378#if defined(_ANSI_SOURCE)       /* Hide almost everything. */
     379#define __POSIX_VISIBLE         0
     380#define __XSI_VISIBLE           0
     381#define __BSD_VISIBLE           0
     382#define __ISO_C_VISIBLE         1990
     383#elif defined(_C99_SOURCE)      /* Localism to specify strict C99 env. */
     384#define __POSIX_VISIBLE         0
     385#define __XSI_VISIBLE           0
     386#define __BSD_VISIBLE           0
     387#define __ISO_C_VISIBLE         1999
     388#else                           /* Default environment: show everything. */
     389#define __POSIX_VISIBLE         200112
     390#define __XSI_VISIBLE           600
     391#define __BSD_VISIBLE           1
     392#define __ISO_C_VISIBLE         1999
     393#endif
     394#endif
     395
     396/* toolkit pollution */
     397#define __TCPPROTO(args) __P(args)
     398
     399#endif /* !_SYS_CDEFS_H_ */
Note: See TracChangeset for help on using the changeset viewer.