OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [posix/] [libposix/] [include/] [posix/] [sys/] [cdefs.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/* Copyright (C) 1992-2001, 2002, 2004, 2005 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 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.
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
   Lesser General Public License for more details.
13
 
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
17
   02111-1307 USA.  */
18
 
19
#ifndef _SYS_CDEFS_H
20
#define _SYS_CDEFS_H    1
21
 
22
/* We are almost always included from features.h. */
23
#ifndef _FEATURES_H
24
# include <features.h>
25
#endif
26
 
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
29
   anymore supported.  */
30
#if defined __GNUC__ && !defined __STDC__
31
# error "You need a ISO C conforming compiler to use the glibc headers"
32
#endif
33
 
34
/* Some user header file might have defined this before.  */
35
#undef  __P
36
#undef  __PMT
37
 
38
#ifdef __GNUC__
39
 
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.  For gcc 3.2 and up we even mark C functions
43
   as non-throwing using a function attribute since programs can use
44
   the -fexceptions options for C code as well.  */
45
# if !defined __cplusplus && __GNUC_PREREQ (3, 3)
46
#  define __THROW       __attribute__ ((__nothrow__))
47
#  define __NTH(fct)    __attribute__ ((__nothrow__)) fct
48
# else
49
#  if defined __cplusplus && __GNUC_PREREQ (2,8)
50
#   define __THROW      throw ()
51
#   define __NTH(fct)   fct throw ()
52
#  else
53
#   define __THROW
54
#   define __NTH(fct)   fct
55
#  endif
56
# endif
57
 
58
#else   /* Not GCC.  */
59
 
60
# define __inline               /* No inline functions.  */
61
 
62
# define __THROW
63
# define __NTH(fct)     fct
64
 
65
# define __const        const
66
# define __signed       signed
67
# define __volatile     volatile
68
 
69
#endif  /* GCC.  */
70
 
71
/* These two macros are not used in glibc anymore.  They are kept here
72
   only because some other projects expect the macros to be defined.  */
73
#define __P(args)       args
74
#define __PMT(args)     args
75
 
76
/* For these things, GCC behaves the ANSI way normally,
77
   and the non-ANSI way under -traditional.  */
78
 
79
#define __CONCAT(x,y)   x ## y
80
#define __STRING(x)     #x
81
 
82
/* This is not a typedef so `const __ptr_t' does the right thing.  */
83
#define __ptr_t void *
84
#define __long_double_t  long double
85
 
86
 
87
/* C++ needs to know that types and declarations are C, not C++.  */
88
#ifdef  __cplusplus
89
# define __BEGIN_DECLS  extern "C" {
90
# define __END_DECLS    }
91
#else
92
# define __BEGIN_DECLS
93
# define __END_DECLS
94
#endif
95
 
96
 
97
/* The standard library needs the functions from the ISO C90 standard
98
   in the std namespace.  At the same time we want to be safe for
99
   future changes and we include the ISO C99 code in the non-standard
100
   namespace __c99.  The C++ wrapper header take case of adding the
101
   definitions to the global namespace.  */
102
#if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES
103
# define __BEGIN_NAMESPACE_STD  namespace std {
104
# define __END_NAMESPACE_STD    }
105
# define __USING_NAMESPACE_STD(name) using std::name;
106
# define __BEGIN_NAMESPACE_C99  namespace __c99 {
107
# define __END_NAMESPACE_C99    }
108
# define __USING_NAMESPACE_C99(name) using __c99::name;
109
#else
110
/* For compatibility we do not add the declarations into any
111
   namespace.  They will end up in the global namespace which is what
112
   old code expects.  */
113
# define __BEGIN_NAMESPACE_STD
114
# define __END_NAMESPACE_STD
115
# define __USING_NAMESPACE_STD(name)
116
# define __BEGIN_NAMESPACE_C99
117
# define __END_NAMESPACE_C99
118
# define __USING_NAMESPACE_C99(name)
119
#endif
120
 
121
 
122
/* Support for bounded pointers.  */
123
#ifndef __BOUNDED_POINTERS__
124
# define __bounded      /* nothing */
125
# define __unbounded    /* nothing */
126
# define __ptrvalue     /* nothing */
127
#endif
128
 
129
 
130
/* Fortify support.  */
131
#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
132
#define __bos0(ptr) __builtin_object_size (ptr, 0)
133
#define __warndecl(name, msg) extern void name (void)
134
 
135
 
136
/* Support for flexible arrays.  */
137
#if __GNUC_PREREQ (2,97)
138
/* GCC 2.97 supports C99 flexible array members.  */
139
# define __flexarr      []
140
#else
141
# ifdef __GNUC__
142
#  define __flexarr     [0]
143
# else
144
#  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
145
#   define __flexarr    []
146
#  else
147
/* Some other non-C99 compiler.  Approximate with [1].  */
148
#   define __flexarr    [1]
149
#  endif
150
# endif
151
#endif
152
 
153
 
154
/* __asm__ ("xyz") is used throughout the headers to rename functions
155
   at the assembly language level.  This is wrapped by the __REDIRECT
156
   macro, in order to support compilers that can do this some other
157
   way.  When compilers don't support asm-names at all, we have to do
158
   preprocessor tricks instead (which don't have exactly the right
159
   semantics, but it's the best we can do).
160
 
161
   Example:
162
   int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
163
 
164
#if defined __GNUC__ && __GNUC__ >= 2
165
 
166
# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
167
# ifdef __cplusplus
168
#  define __REDIRECT_NTH(name, proto, alias) \
169
     name proto __THROW __asm__ (__ASMNAME (#alias))
170
# else
171
#  define __REDIRECT_NTH(name, proto, alias) \
172
     name proto __asm__ (__ASMNAME (#alias)) __THROW
173
# endif
174
# define __ASMNAME(cname)  __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
175
# define __ASMNAME2(prefix, cname) __STRING (prefix) cname
176
 
177
/*
178
#elif __SOME_OTHER_COMPILER__
179
 
180
# define __REDIRECT(name, proto, alias) name proto; \
181
        _Pragma("let " #name " = " #alias)
182
*/
183
#endif
184
 
185
/* GCC has various useful declarations that can be made with the
186
   `__attribute__' syntax.  All of the ways we use this do fine if
187
   they are omitted for compilers that don't understand it. */
188
#if !defined __GNUC__ || __GNUC__ < 2
189
# define __attribute__(xyz)     /* Ignore */
190
#endif
191
 
192
/* We make this a no-op unless it can be used as both a variable and
193
   a type attribute.  gcc 2.8 is known to support both.  */
194
#if __GNUC_PREREQ (2,8)
195
# define __attribute_aligned__(size) __attribute__ ((__aligned__ (size)))
196
#else
197
# define __attribute_aligned__(size) /* Ignore */
198
#endif
199
 
200
/* At some point during the gcc 2.96 development the `malloc' attribute
201
   for functions was introduced.  We don't want to use it unconditionally
202
   (although this would be possible) since it generates warnings.  */
203
#if __GNUC_PREREQ (2,96)
204
# define __attribute_malloc__ __attribute__ ((__malloc__))
205
#else
206
# define __attribute_malloc__ /* Ignore */
207
#endif
208
 
209
/* At some point during the gcc 2.96 development the `pure' attribute
210
   for functions was introduced.  We don't want to use it unconditionally
211
   (although this would be possible) since it generates warnings.  */
212
#if __GNUC_PREREQ (2,96)
213
# define __attribute_pure__ __attribute__ ((__pure__))
214
#else
215
# define __attribute_pure__ /* Ignore */
216
#endif
217
 
218
/* At some point during the gcc 3.1 development the `used' attribute
219
   for functions was introduced.  We don't want to use it unconditionally
220
   (although this would be possible) since it generates warnings.  */
221
#if __GNUC_PREREQ (3,1)
222
# define __attribute_used__ __attribute__ ((__used__))
223
# define __attribute_noinline__ __attribute__ ((__noinline__))
224
#else
225
# define __attribute_used__ __attribute__ ((__unused__))
226
# define __attribute_noinline__ /* Ignore */
227
#endif
228
 
229
/* gcc allows marking deprecated functions.  */
230
#if __GNUC_PREREQ (3,2) && !defined(__UCLIBC_HIDE_DEPRECATED__)
231
# define __attribute_deprecated__ __attribute__ ((__deprecated__))
232
#else
233
# define __attribute_deprecated__ /* Ignore */
234
#endif
235
 
236
/* At some point during the gcc 2.8 development the `format_arg' attribute
237
   for functions was introduced.  We don't want to use it unconditionally
238
   (although this would be possible) since it generates warnings.
239
   If several `format_arg' attributes are given for the same function, in
240
   gcc-3.0 and older, all but the last one are ignored.  In newer gccs,
241
   all designated arguments are considered.  */
242
#if __GNUC_PREREQ (2,8)
243
# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))
244
#else
245
# define __attribute_format_arg__(x) /* Ignore */
246
#endif
247
 
248
/* At some point during the gcc 2.97 development the `strfmon' format
249
   attribute for functions was introduced.  We don't want to use it
250
   unconditionally (although this would be possible) since it
251
   generates warnings.  */
252
#if __GNUC_PREREQ (2,97)
253
# define __attribute_format_strfmon__(a,b) \
254
  __attribute__ ((__format__ (__strfmon__, a, b)))
255
#else
256
# define __attribute_format_strfmon__(a,b) /* Ignore */
257
#endif
258
 
259
/* The nonull function attribute allows to mark pointer parameters which
260
   must not be NULL.  */
261
#if __GNUC_PREREQ (3,3)
262
# define __nonnull(params) __attribute__ ((__nonnull__ params))
263
#else
264
# define __nonnull(params)
265
#endif
266
 
267
/* If fortification mode, we warn about unused results of certain
268
   function calls which can lead to problems.  */
269
#if __GNUC_PREREQ (3,4)
270
# define __attribute_warn_unused_result__ \
271
   __attribute__ ((__warn_unused_result__))
272
# if __USE_FORTIFY_LEVEL > 0
273
#  define __wur __attribute_warn_unused_result__
274
# endif
275
#else
276
# define __attribute_warn_unused_result__ /* empty */
277
#endif
278
#ifndef __wur
279
# define __wur /* Ignore */
280
#endif
281
 
282
/* Forces a function to be always inlined.  */
283
#if __GNUC_PREREQ (3,2)
284
# define __always_inline __inline __attribute__ ((__always_inline__))
285
#else
286
# define __always_inline __inline
287
#endif
288
 
289
/* It is possible to compile containing GCC extensions even if GCC is
290
   run in pedantic mode if the uses are carefully marked using the
291
   `__extension__' keyword.  But this is not generally available before
292
   version 2.8.  */
293
#if !__GNUC_PREREQ (2,8)
294
# define __extension__          /* Ignore */
295
#endif
296
 
297
/* __restrict is known in EGCS 1.2 and above. */
298
#if !__GNUC_PREREQ (2,92)
299
# define __restrict     /* Ignore */
300
#endif
301
 
302
/* ISO C99 also allows to declare arrays as non-overlapping.  The syntax is
303
     array_name[restrict]
304
   GCC 3.1 supports this.  */
305
#if __GNUC_PREREQ (3,1) && !defined __GNUG__
306
# define __restrict_arr __restrict
307
#else
308
# ifdef __GNUC__
309
#  define __restrict_arr        /* Not supported in old GCC.  */
310
# else
311
#  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
312
#   define __restrict_arr       restrict
313
#  else
314
/* Some other non-C99 compiler.  */
315
#   define __restrict_arr       /* Not supported.  */
316
#  endif
317
# endif
318
#endif
319
 
320
#endif   /* sys/cdefs.h */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.