Rev 1693 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1693 | serge | 1 | /* libc/sys/linux/sys/cdefs.h - Helper macros for K&R vs. ANSI C compat. */ |
2 | |||
3 | /* Written 2000 by Werner Almesberger */ |
||
4 | |||
5 | /* |
||
6 | * Copyright (c) 1991, 1993 |
||
7 | * The Regents of the University of California. All rights reserved. |
||
8 | * |
||
9 | * This code is derived from software contributed to Berkeley by |
||
10 | * Berkeley Software Design, Inc. |
||
11 | * |
||
12 | * Redistribution and use in source and binary forms, with or without |
||
13 | * modification, are permitted provided that the following conditions |
||
14 | * are met: |
||
15 | * 1. Redistributions of source code must retain the above copyright |
||
16 | * notice, this list of conditions and the following disclaimer. |
||
17 | * 2. Redistributions in binary form must reproduce the above copyright |
||
18 | * notice, this list of conditions and the following disclaimer in the |
||
19 | * documentation and/or other materials provided with the distribution. |
||
20 | * 3. All advertising materials mentioning features or use of this software |
||
21 | * must display the following acknowledgement: |
||
22 | * This product includes software developed by the University of |
||
23 | * California, Berkeley and its contributors. |
||
24 | * 4. Neither the name of the University nor the names of its contributors |
||
25 | * may be used to endorse or promote products derived from this software |
||
26 | * without specific prior written permission. |
||
27 | * |
||
28 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
||
29 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
30 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
31 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
||
32 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||
33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||
34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||
35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||
36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||
37 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||
38 | * SUCH DAMAGE. |
||
39 | * |
||
40 | * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 |
||
41 | * $FreeBSD: src/sys/sys/cdefs.h,v 1.54 2002/05/11 03:58:24 alfred Exp $ |
||
42 | */ |
||
43 | |||
44 | #ifndef _SYS_CDEFS_H |
||
45 | #define _SYS_CDEFS_H |
||
46 | |||
47 | #define __FBSDID(x) /* nothing */ |
||
48 | /* |
||
49 | * Note: the goal here is not compatibility to K&R C. Since we know that we |
||
50 | * have GCC which understands ANSI C perfectly well, we make use of this. |
||
51 | */ |
||
52 | |||
53 | #define __P(args) args |
||
54 | #define __PMT(args) args |
||
55 | #define __const const |
||
56 | #define __signed signed |
||
57 | #define __volatile volatile |
||
58 | #define __DOTS , ... |
||
59 | #define __THROW |
||
60 | |||
3065 | serge | 61 | /* |
62 | * The __CONCAT macro is used to concatenate parts of symbol names, e.g. |
||
63 | * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. |
||
64 | * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI |
||
65 | * mode -- there must be no spaces between its arguments, and for nested |
||
66 | * __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also |
||
67 | * concatenate double-quoted strings produced by the __STRING macro, but |
||
68 | * this only works with ANSI C. |
||
69 | * |
||
70 | * __XSTRING is like __STRING, but it expands any macros in its argument |
||
71 | * first. It is only available with ANSI C. |
||
72 | */ |
||
73 | #define __CONCAT1(x,y) x ## y |
||
74 | #define __CONCAT(x,y) __CONCAT1(x,y) |
||
75 | #define __STRING(x) #x /* stringify without expanding x */ |
||
76 | #define __XSTRING(x) __STRING(x) /* expand x, then stringify */ |
||
77 | |||
78 | #ifdef __GNUC__ |
||
79 | # define __ASMNAME(cname) __XSTRING (__USER_LABEL_PREFIX__) cname |
||
80 | #endif |
||
81 | |||
1693 | serge | 82 | #define __ptr_t void * |
83 | #define __long_double_t long double |
||
84 | |||
85 | #define __attribute_malloc__ |
||
86 | #define __attribute_pure__ |
||
87 | #define __attribute_format_strfmon__(a,b) |
||
88 | #define __flexarr [0] |
||
89 | |||
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 | #ifndef __BOUNDED_POINTERS__ |
||
99 | # define __bounded /* nothing */ |
||
100 | # define __unbounded /* nothing */ |
||
101 | # define __ptrvalue /* nothing */ |
||
102 | #endif |
||
103 | |||
104 | #ifdef __GNUC__ |
||
105 | #define __strong_reference(sym,aliassym) \ |
||
106 | extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))); |
||
107 | #ifdef __ELF__ |
||
108 | #ifdef __STDC__ |
||
109 | #define __weak_reference(sym,alias) \ |
||
110 | __asm__(".weak " #alias); \ |
||
111 | __asm__(".equ " #alias ", " #sym) |
||
112 | #define __warn_references(sym,msg) \ |
||
113 | __asm__(".section .gnu.warning." #sym); \ |
||
114 | __asm__(".asciz \"" msg "\""); \ |
||
115 | __asm__(".previous") |
||
116 | #else |
||
117 | #define __weak_reference(sym,alias) \ |
||
118 | __asm__(".weak alias"); \ |
||
119 | __asm__(".equ alias, sym") |
||
120 | #define __warn_references(sym,msg) \ |
||
121 | __asm__(".section .gnu.warning.sym"); \ |
||
122 | __asm__(".asciz \"msg\""); \ |
||
123 | __asm__(".previous") |
||
124 | #endif /* __STDC__ */ |
||
125 | #else /* !__ELF__ */ |
||
126 | #ifdef __STDC__ |
||
127 | #define __weak_reference(sym,alias) \ |
||
128 | __asm__(".stabs \"_" #alias "\",11,0,0,0"); \ |
||
129 | __asm__(".stabs \"_" #sym "\",1,0,0,0") |
||
130 | #define __warn_references(sym,msg) \ |
||
131 | __asm__(".stabs \"" msg "\",30,0,0,0"); \ |
||
132 | __asm__(".stabs \"_" #sym "\",1,0,0,0") |
||
133 | #else |
||
134 | #define __weak_reference(sym,alias) \ |
||
135 | __asm__(".stabs \"_/**/alias\",11,0,0,0"); \ |
||
136 | __asm__(".stabs \"_/**/sym\",1,0,0,0") |
||
137 | #define __warn_references(sym,msg) \ |
||
138 | __asm__(".stabs msg,30,0,0,0"); \ |
||
139 | __asm__(".stabs \"_/**/sym\",1,0,0,0") |
||
140 | #endif /* __STDC__ */ |
||
141 | #endif /* __ELF__ */ |
||
142 | #endif /* __GNUC__ */ |
||
143 | |||
144 | #endif /* _SYS_CDEFS_H */ |