Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sys / platform / pc32 / boot / dosboot / cdefs.h
1 /*\r
2  * Copyright (c) 1991, 1993\r
3  *      The Regents of the University of California.  All rights reserved.\r
4  *\r
5  * Redistribution and use in source and binary forms, with or without\r
6  * modification, are permitted provided that the following conditions\r
7  * are met:\r
8  * 1. Redistributions of source code must retain the above copyright\r
9  *    notice, this list of conditions and the following disclaimer.\r
10  * 2. Redistributions in binary form must reproduce the above copyright\r
11  *    notice, this list of conditions and the following disclaimer in the\r
12  *    documentation and/or other materials provided with the distribution.\r
13  * 3. All advertising materials mentioning features or use of this software\r
14  *    must display the following acknowledgement:\r
15  *      This product includes software developed by the University of\r
16  *      California, Berkeley and its contributors.\r
17  * 4. Neither the name of the University nor the names of its contributors\r
18  *    may be used to endorse or promote products derived from this software\r
19  *    without specific prior written permission.\r
20  *\r
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
31  * SUCH DAMAGE.\r
32  *\r
33  *      from: @(#)cdefs.h       8.1 (Berkeley) 6/2/93\r
34  * $FreeBSD: src/sys/i386/boot/dosboot/cdefs.h,v 1.5 1999/08/28 00:43:21 peter Exp $\r
35  */\r
36 \r
37 #ifndef _CDEFS_H_\r
38 #define _CDEFS_H_\r
39 \r
40 #if defined(__cplusplus)\r
41 #define __BEGIN_DECLS   extern "C" {\r
42 #define __END_DECLS     };\r
43 #else\r
44 #define __BEGIN_DECLS\r
45 #define __END_DECLS\r
46 #endif\r
47 \r
48 /*\r
49  * The __CONCAT macro is used to concatenate parts of symbol names, e.g.\r
50  * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.\r
51  * The __CONCAT macro is a bit tricky -- make sure you don't put spaces\r
52  * in between its arguments.  __CONCAT can also concatenate double-quoted\r
53  * strings produced by the __STRING macro, but this only works with ANSI C.\r
54  */\r
55 #if defined(__STDC__) || defined(__cplusplus)\r
56 #if defined(__P)\r
57 #undef __P\r
58 #endif  /* defined(__P) */\r
59 #define __P(protos)     protos          /* full-blown ANSI C */\r
60 #define __CONCAT(x,y)   x ## y\r
61 #define __STRING(x)     #x\r
62 \r
63 #else   /* !(__STDC__ || __cplusplus) */\r
64 #if defined(__P)\r
65 #undef __P\r
66 #endif  /* defined(__P) */\r
67 #define __P(protos)     ()              /* traditional C preprocessor */\r
68 #define __CONCAT(x,y)   x/**/y\r
69 #define __STRING(x)     "x"\r
70 \r
71 /* delete ANSI C keywords */\r
72 #define const                           \r
73 #define inline\r
74 #define signed\r
75 #define volatile\r
76 #endif  /* !(__STDC__ || __cplusplus) */\r
77 \r
78 /*\r
79  * GCC has extensions for declaring functions as const (`pure' - always returns\r
80  * the same value given the same inputs, i.e., has no external state and\r
81  * no side effects) and volatile (nonreturning or `dead').\r
82  * These mainly affect optimization and warnings.  \r
83  *\r
84  * To facilitate portability of a non-standard extension we define __pure\r
85  * and __dead and use these for qualifying functions. Non-gcc compilers\r
86  * which have similar extensions can then define these appropriately.\r
87  *\r
88  * Unfortunately, GCC complains if these are used under strict ANSI mode \r
89  * (`gcc -ansi -pedantic'), hence we need to define them only if compiling \r
90  * without this.\r
91  */\r
92 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)\r
93 #define __dead __volatile\r
94 #define __pure __const\r
95 #else\r
96 #define __dead\r
97 #define __pure\r
98 #endif\r
99 \r
100 #endif /* !_CDEFS_H_ */\r