source: rtems/cpukit/libcsupport/include/rtems/cdefs.h @ 4d3017a

4.104.114.84.95
Last change on this file since 4d3017a was 4d3017a, checked in by Ralf Corsepius <ralf.corsepius@…>, on Dec 2, 2004 at 6:04:55 PM

Add doxygen preamble.

  • Property mode set to 100644
File size: 6.1 KB
Line 
1/**
2 * @file rtems/cdefs.h
3 */
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 * $Id$
42 */
43
44#ifndef _RTEMS_CDEFS_H_
45#define _RTEMS_CDEFS_H_
46
47#if defined(__cplusplus)
48#define __BEGIN_DECLS   extern "C" {
49#define __END_DECLS     };
50#else
51#define __BEGIN_DECLS
52#define __END_DECLS
53#endif
54
55/*
56 * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
57 * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
58 * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
59 * in between its arguments.  __CONCAT can also concatenate double-quoted
60 * strings produced by the __STRING macro, but this only works with ANSI C.
61 *
62 * __XSTRING is like __STRING, but it expands any macros in its argument
63 * first.  It is only available with ANSI C.
64 */
65#if defined(__STDC__) || defined(__cplusplus)
66#define __P(protos)     protos          /* full-blown ANSI C */
67#define __CONCAT1(x,y)  x ## y
68#define __CONCAT(x,y)   __CONCAT1(x,y)
69#define __STRING(x)     #x              /* stringify without expanding x */
70#define __XSTRING(x)    __STRING(x)     /* expand x, then stringify */
71
72#define __const         const           /* define reserved names to standard */
73#define __signed        signed
74#define __volatile      volatile
75#if defined(__cplusplus)
76#define __inline        inline          /* convert to C++ keyword */
77#else
78#ifndef __GNUC__
79#define __inline                        /* delete GCC keyword */
80#endif /* !__GNUC__ */
81#endif /* !__cplusplus */
82
83#else   /* !(__STDC__ || __cplusplus) */
84#define __P(protos)     ()              /* traditional C preprocessor */
85#define __CONCAT(x,y)   x/**/y
86#define __STRING(x)     "x"
87
88#ifndef __GNUC__
89#define __const                         /* delete pseudo-ANSI C keywords */
90#define __inline
91#define __signed
92#define __volatile
93/*
94 * In non-ANSI C environments, new programs will want ANSI-only C keywords
95 * deleted from the program and old programs will want them left alone.
96 * When using a compiler other than gcc, programs using the ANSI C keywords
97 * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
98 * When using "gcc -traditional", we assume that this is the intent; if
99 * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
100 */
101#ifndef NO_ANSI_KEYWORDS
102#define const                           /* delete ANSI C keywords */
103#define inline
104#define signed
105#define volatile
106#endif  /* !NO_ANSI_KEYWORDS */
107#endif  /* !__GNUC__ */
108#endif  /* !(__STDC__ || __cplusplus) */
109
110/*
111 * GCC1 and some versions of GCC2 declare dead (non-returning) and
112 * pure (no side effects) functions using "volatile" and "const";
113 * unfortunately, these then cause warnings under "-ansi -pedantic".
114 * GCC2.5 uses a new, peculiar __attribute__((attrs)) style.  All of
115 * these work for GNU C++ (modulo a slight glitch in the C++ grammar
116 * in the distribution version of 2.5.5).
117 */
118#if __GNUC__ < 2
119#define __dead
120#define __dead2
121#define __pure
122#define __pure2
123#define __unused
124#define __attribute__(x)
125#endif
126#if __GNUC__ == 2 && __GNUC_MINOR__ < 5
127#define __dead          __volatile
128#define __dead2
129#define __pure          __const
130#define __pure2
131#define __unused
132#endif
133#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7
134#define __dead
135#define __dead2         __attribute__((__noreturn__))
136#define __pure
137#define __pure2         __attribute__((__const__))
138#define __unused
139#endif
140#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3
141#define __dead
142#define __dead2         __attribute__((__noreturn__))
143#define __pure
144#define __pure2         __attribute__((__const__))
145#define __unused        __attribute__((__unused__))
146#endif
147
148#ifdef __GNUC__
149#ifdef __STDC__
150#define __weak_reference(sym,alias)     \
151        __asm__(".stabs \"_" #alias "\",11,0,0,0");     \
152        __asm__(".stabs \"_" #sym "\",1,0,0,0")
153#define __warn_references(sym,msg)      \
154        __asm__(".stabs \"" msg "\",30,0,0,0");         \
155        __asm__(".stabs \"_" #sym "\",1,0,0,0")
156#else
157#define __weak_reference(sym,alias)     \
158        __asm__(".stabs \"_/**/alias\",11,0,0,0");      \
159        __asm__(".stabs \"_/**/sym\",1,0,0,0")
160#define __warn_references(sym,msg)      \
161        __asm__(".stabs msg,30,0,0,0");                 \
162        __asm__(".stabs \"_/**/sym\",1,0,0,0")
163#endif
164#endif
165
166#define __IDSTRING(name,string) \
167        static const char name[] __attribute__((__unused__)) = string
168
169#ifndef __RCSID
170#define __RCSID(s)      __IDSTRING(rcsid,s)
171#endif
172
173#ifndef __RCSID_SOURCE
174#define __RCSID_SOURCE(s) __IDSTRING(rcsid_source,s)
175#endif
176
177#ifndef __COPYRIGHT
178#define __COPYRIGHT(s)  __IDSTRING(copyright,s)
179#endif
180
181#endif /* !_RTEMS_CDEFS_H_ */
Note: See TracBrowser for help on using the repository browser.