update from main archive 961119
[platform/upstream/glibc.git] / misc / sys / cdefs.h
1 /* Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
8
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
13
14    You should have received a copy of the GNU Library General Public
15    License along with the GNU C Library; see the file COPYING.LIB.  If not,
16    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17    Boston, MA 02111-1307, USA.  */
18
19 #ifndef _SYS_CDEFS_H
20
21 #define _SYS_CDEFS_H    1
22 #include <features.h>
23
24 /* Some user header file might have defined this before.  */
25 #undef  __P
26
27 #ifdef __GNUC__
28
29 #define __P(args)       args    /* GCC can always grok prototypes.  */
30 #define __DOTS          , ...
31
32 #else   /* Not GCC.  */
33
34 #define __inline                /* No inline functions.  */
35
36 #if (defined (__STDC__) && __STDC__) || defined (__cplusplus)
37
38 #define __P(args)       args
39 #define __const         const
40 #define __signed        signed
41 #define __volatile      volatile
42 #define __DOTS          , ...
43
44 #else   /* Not ANSI C or C++.  */
45
46 #define __P(args)       ()      /* No prototypes.  */
47 #define __const                 /* No ANSI C keywords.  */
48 #define __signed
49 #define __volatile
50 #define __DOTS
51
52 #endif  /* ANSI C or C++.  */
53
54 #endif  /* GCC.  */
55
56 /* For these things, GCC behaves the ANSI way normally,
57    and the non-ANSI way under -traditional.  */
58
59 #if defined (__STDC__) && __STDC__
60
61 #define __CONCAT(x,y)   x ## y
62 #define __STRING(x)     #x
63
64 /* This is not a typedef so `const __ptr_t' does the right thing.  */
65 #define __ptr_t void *
66 #define __long_double_t  long double
67
68 #else
69
70 #define __CONCAT(x,y)   x/**/y
71 #define __STRING(x)     "x"
72
73 #define __ptr_t char *
74 #define __long_double_t  long double
75
76 /* The BSD header files use the ANSI keywords unmodified (this means that
77    old programs may lose if they use the new keywords as identifiers), but
78    those names are not available under -traditional.  We define them to
79    their __ versions, which are taken care of above.  */
80 #ifdef  __USE_BSD
81 #define const           __const
82 #define signed          __signed
83 #define volatile        __volatile
84 #endif
85
86 #endif  /* __STDC__ */
87
88
89 /* C++ needs to know that types and declarations are C, not C++.  */
90 #ifdef  __cplusplus
91 #define __BEGIN_DECLS   extern "C" {
92 #define __END_DECLS     }
93 #else
94 #define __BEGIN_DECLS
95 #define __END_DECLS
96 #endif
97
98 /* GCC2 has various useful declarations that can be made with the
99    `__attribute__' syntax.  All of the ways we use this do fine if
100    they are omitted for compilers that don't understand it.  */
101 #if !defined (__GNUC__) || __GNUC__ < 2
102 #define __attribute__(xyz)      /* Ignore.  */
103 #endif
104
105 #endif   /* sys/cdefs.h */