1 /* Copyright (C) 1992,93,94,95,96,97,98,99,2000,2001,2002 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
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 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #define _SYS_CDEFS_H 1
22 /* We are almost always included from features.h. */
24 # include <features.h>
27 /* The GNU libc does not support any K&R compilers or the traditional mode
28 of ISO C compilers anymore. Check for some of the combinations not
30 #if defined __GNUC__ && !defined __STDC__
31 # error "You need a ISO C conforming compiler to use the glibc headers"
34 /* Some user header file might have defined this before. */
40 /* GCC can always grok prototypes. For C++ programs we add throw()
41 to help it optimize the function calls. But this works only with
42 gcc 2.8.x and egcs. */
43 # if defined __cplusplus && __GNUC_PREREQ (2,8)
44 # define __THROW throw ()
48 # define __P(args) args __THROW
49 /* This macro will be used for functions which might take C++ callback
51 # define __PMT(args) args
55 # define __inline /* No inline functions. */
58 # define __P(args) args
59 # define __PMT(args) args
61 # define __const const
62 # define __signed signed
63 # define __volatile volatile
67 /* For these things, GCC behaves the ANSI way normally,
68 and the non-ANSI way under -traditional. */
70 #define __CONCAT(x,y) x ## y
71 #define __STRING(x) #x
73 /* This is not a typedef so `const __ptr_t' does the right thing. */
74 #define __ptr_t void *
75 #define __long_double_t long double
78 /* C++ needs to know that types and declarations are C, not C++. */
80 # define __BEGIN_DECLS extern "C" {
81 # define __END_DECLS }
83 # define __BEGIN_DECLS
88 /* Support for bounded pointers. */
89 #ifndef __BOUNDED_POINTERS__
90 # define __bounded /* nothing */
91 # define __unbounded /* nothing */
92 # define __ptrvalue /* nothing */
96 /* Support for flexible arrays. */
97 #if __GNUC_PREREQ (2,97)
98 /* GCC 2.97 supports C99 flexible array members. */
102 # define __flexarr [0]
104 # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
105 # define __flexarr []
107 /* Some other non-C99 compiler. Approximate with [1]. */
108 # define __flexarr [1]
114 /* __asm__ ("xyz") is used throughout the headers to rename functions
115 at the assembly language level. This is wrapped by the __REDIRECT
116 macro, in order to support compilers that can do this some other
117 way. When compilers don't support asm-names at all, we have to do
118 preprocessor tricks instead (which don't have exactly the right
119 semantics, but it's the best we can do).
122 int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
124 #if defined __GNUC__ && __GNUC__ >= 2
126 # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
127 # define __ASMNAME(cname) __C_SYMBOL_PREFIX__ cname
130 #elif __SOME_OTHER_COMPILER__
132 # define __REDIRECT(name, proto, alias) name proto; \
133 _Pragma("let " #name " = " #alias)
137 /* GCC has various useful declarations that can be made with the
138 `__attribute__' syntax. All of the ways we use this do fine if
139 they are omitted for compilers that don't understand it. */
140 #if !defined __GNUC__ || __GNUC__ < 2
141 # define __attribute__(xyz) /* Ignore */
144 /* At some point during the gcc 2.96 development the `malloc' attribute
145 for functions was introduced. We don't want to use it unconditionally
146 (although this would be possible) since it generates warnings. */
147 #if __GNUC_PREREQ (2,96)
148 # define __attribute_malloc__ __attribute__ ((__malloc__))
150 # define __attribute_malloc__ /* Ignore */
153 /* At some point during the gcc 2.96 development the `pure' attribute
154 for functions was introduced. We don't want to use it unconditionally
155 (although this would be possible) since it generates warnings. */
156 #if __GNUC_PREREQ (2,96)
157 # define __attribute_pure__ __attribute__ ((__pure__))
159 # define __attribute_pure__ /* Ignore */
162 /* At some point during the gcc 2.8 development the `format_arg' attribute
163 for functions was introduced. We don't want to use it unconditionally
164 (although this would be possible) since it generates warnings.
165 If several `format_arg' attributes are given for the same function, in
166 gcc-3.0 and older, all but the last one are ignored. In newer gccs,
167 all designated arguments are considered. */
168 #if __GNUC_PREREQ (2,8)
169 # define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))
171 # define __attribute_format_arg__(x) /* Ignore */
174 /* At some point during the gcc 2.97 development the `strfmon' format
175 attribute for functions was introduced. We don't want to use it
176 unconditionally (although this would be possible) since it
177 generates warnings. */
178 #if __GNUC_PREREQ (2,97)
179 # define __attribute_format_strfmon__(a,b) \
180 __attribute__ ((__format__ (__strfmon__, a, b)))
182 # define __attribute_format_strfmon__(a,b) /* Ignore */
185 /* It is possible to compile containing GCC extensions even if GCC is
186 run in pedantic mode if the uses are carefully marked using the
187 `__extension__' keyword. But this is not generally available before
189 #if !__GNUC_PREREQ (2,8)
190 # define __extension__ /* Ignore */
193 /* __restrict is known in EGCS 1.2 and above. */
194 #if !__GNUC_PREREQ (2,92)
195 # define __restrict /* Ignore */
198 /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
200 GCC 3.1 supports this. */
201 #if __GNUC_PREREQ (3,1) && !defined __GNUG__
202 # define __restrict_arr __restrict
205 # define __restrict_arr /* Not supported in old GCC. */
207 # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
208 # define __restrict_arr restrict
210 /* Some other non-C99 compiler. */
211 # define __restrict_arr /* Not supported. */
216 #endif /* sys/cdefs.h */