home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Utilities / date-0.2-MIHS / src / cdefs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-23  |  4.7 KB  |  135 lines

  1. /*    $NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $    */
  2.  
  3. /*
  4.  * Copyright (c) 1991, 1993
  5.  *    The Regents of the University of California.  All rights reserved.
  6.  *
  7.  * This code is derived from software contributed to Berkeley by
  8.  * Berkeley Software Design, Inc.
  9.  *
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *    notice, this list of conditions and the following disclaimer.
  15.  * 2. Redistributions in binary form must reproduce the above copyright
  16.  *    notice, this list of conditions and the following disclaimer in the
  17.  *    documentation and/or other materials provided with the distribution.
  18.  * 3. All advertising materials mentioning features or use of this software
  19.  *    must display the following acknowledgement:
  20.  *    This product includes software developed by the University of
  21.  *    California, Berkeley and its contributors.
  22.  * 4. Neither the name of the University nor the names of its contributors
  23.  *    may be used to endorse or promote products derived from this software
  24.  *    without specific prior written permission.
  25.  *
  26.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  27.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  30.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  34.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  35.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36.  * SUCH DAMAGE.
  37.  *
  38.  *    @(#)cdefs.h    8.7 (Berkeley) 1/21/94
  39.  */
  40.  
  41. #ifndef    _CDEFS_H_
  42. #define    _CDEFS_H_
  43.  
  44. /*
  45. #include <machine/cdefs.h>
  46. */
  47.  
  48. #if defined(__cplusplus)
  49. #define    __BEGIN_DECLS    extern "C" {
  50. #define    __END_DECLS    };
  51. #else
  52. #define    __BEGIN_DECLS
  53. #define    __END_DECLS
  54. #endif
  55.  
  56. /*
  57.  * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
  58.  * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
  59.  * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
  60.  * in between its arguments.  __CONCAT can also concatenate double-quoted
  61.  * strings produced by the __STRING macro, but this only works with ANSI C.
  62.  */
  63. #if defined(__STDC__) || defined(__cplusplus)
  64. #define    __P(protos)    protos        /* full-blown ANSI C */
  65. #define    __CONCAT(x,y)    x ## y
  66. #define    __STRING(x)    #x
  67.  
  68. #define    __const        const        /* define reserved names to standard */
  69. #define    __signed    signed
  70. #define    __volatile    volatile
  71. #if defined(__cplusplus)
  72. #define    __inline    inline        /* convert to C++ keyword */
  73. #else
  74. #ifndef __GNUC__
  75. #define    __inline            /* delete GCC keyword */
  76. #endif /* !__GNUC__ */
  77. #endif /* !__cplusplus */
  78.  
  79. #else    /* !(__STDC__ || __cplusplus) */
  80. #define    __P(protos)    ()        /* traditional C preprocessor */
  81. #define    __CONCAT(x,y)    x/**/y
  82. #define    __STRING(x)    "x"
  83.  
  84. #ifndef __GNUC__
  85. #define    __const                /* delete pseudo-ANSI C keywords */
  86. #define    __inline
  87. #define    __signed
  88. #define    __volatile
  89. #endif    /* !__GNUC__ */
  90.  
  91. /*
  92.  * In non-ANSI C environments, new programs will want ANSI-only C keywords
  93.  * deleted from the program and old programs will want them left alone.
  94.  * Programs using the ANSI C keywords const, inline etc. as normal
  95.  * identifiers should define -DNO_ANSI_KEYWORDS.
  96.  */
  97. #ifndef    NO_ANSI_KEYWORDS
  98. #define    const        __const        /* convert ANSI C keywords */
  99. #define    inline        __inline
  100. #define    signed        __signed
  101. #define    volatile    __volatile
  102. #endif /* !NO_ANSI_KEYWORDS */
  103. #endif    /* !(__STDC__ || __cplusplus) */
  104.  
  105. /*
  106.  * GCC1 and some versions of GCC2 declare dead (non-returning) and
  107.  * pure (no side effects) functions using "volatile" and "const";
  108.  * unfortunately, these then cause warnings under "-ansi -pedantic".
  109.  * GCC2 uses a new, peculiar __attribute__((attrs)) style.  All of
  110.  * these work for GNU C++ (modulo a slight glitch in the C++ grammar
  111.  * in the distribution version of 2.5.5).
  112.  */
  113. #if !defined(__GNUC__) || __GNUC__ < 2 || \
  114.     (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
  115. #define    __attribute__(x)    /* delete __attribute__ if non-gcc or gcc1 */
  116. #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
  117. #define    __dead        __volatile
  118. #define    __pure        __const
  119. #endif
  120. #endif
  121.  
  122. #ifdef __KPRINTF_ATTRIBUTE__
  123. #define __kprintf_attribute__(a) __attribute__(a)
  124. #else
  125. #define __kprintf_attribute__(a)
  126. #endif
  127.  
  128. /* Delete pseudo-keywords wherever they are not available or needed. */
  129. #ifndef __dead
  130. #define    __dead
  131. #define    __pure
  132. #endif
  133.  
  134. #endif /* !_CDEFS_H_ */
  135.