source: trunk/sys/dietlibc/include/sys/cdefs.h @ 1

Last change on this file since 1 was 1, checked in by alain, 5 years ago

First import

File size: 2.5 KB
Line 
1#ifndef _SYS_CDEFS_H
2#define _SYS_CDEFS_H
3
4#ifndef __cplusplus
5#define __THROW
6#define __BEGIN_DECLS
7#define __END_DECLS
8#else
9#define __THROW throw ()
10#define __BEGIN_DECLS extern "C" {
11#define __END_DECLS }
12#endif
13
14#ifndef __GNUC__
15#define __attribute__(xyz)
16#define __extension__
17#endif
18
19#if (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 96))
20#define __pure __attribute__ ((__pure__))
21#else
22#define __pure
23#endif
24
25#if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95)
26#define __restrict__
27#endif
28
29#ifndef __STRICT_ANSI__
30#define restrict __restrict__
31#if __GNUC__ < 3
32#define __builtin_expect(foo,bar) (foo)
33#define __expect(foo,bar) (foo)
34#define __malloc__
35#else
36#define __expect(foo,bar) __builtin_expect((long)(foo),bar)
37#define __attribute_malloc__ __attribute__((__malloc__))
38#endif
39#endif
40
41/* idea for these macros taken from Linux kernel */
42#define __likely(foo) __expect((foo),1)
43#define __unlikely(foo) __expect((foo),0)
44
45#ifndef __attribute_malloc__
46#define __attribute_malloc__
47#endif
48
49#define __P(x) x
50
51#define __ptr_t void*
52
53#if defined(__STRICT_ANSI__) && __STDC_VERSION__ + 0 < 199900L
54#define inline
55#endif
56
57#ifndef __i386__
58#define __regparm__(x)
59#endif
60
61#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2))
62#define __attribute_dontuse__ __attribute__((__deprecated__))
63#else
64#define __attribute_dontuse__
65#define __deprecated__
66#endif
67
68#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))
69# define __nonnull(params) __attribute__ ((__nonnull__ params))
70#else
71# define __nonnull(params)
72#endif
73
74#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))
75# define __attribute_used __attribute__ ((__used__))
76#else
77# define __attribute_used
78# define __warn_unused_result__
79#endif
80
81#if (__GNUC__ >= 4)
82#define __needsNULL__(x) __sentinel__(x)
83#else
84#define __needsNULL__(x)
85#define __sentinel__
86#endif
87
88#if (__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 3))
89# define __cold__
90# define __hot__
91#endif
92
93#if (__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 3))
94#define __attribute_alloc__(x)
95#define __attribute_alloc2__(x,y)
96#else
97#define __attribute_alloc__(x) __attribute__((alloc_size(x))
98#define __attribute_alloc2__(x,y) __attribute__((alloc_size(x,y))
99#endif
100
101#if (__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ < 5))
102#define __attribute_const__
103#else
104#define __attribute_const__ __attribute__((const))
105#endif
106
107#if (__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ < 8))
108#define __attribute_formatarg__(x)
109#else
110#define __attribute_formatarg__(x) __attribute__((format_arg(x)))
111#endif
112
113#endif
Note: See TracBrowser for help on using the repository browser.