* timezone/asia: Fix rule in Asia/Nicosia entry.
[glibc/pb-stable.git] / misc / sys / cdefs.h
blobbc8d7c5cdb1f35234f4216fe45837a89a3a54cbc
1 /* Copyright (C) 1992,93,94,95,96,97,98,99 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
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 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 #ifndef _SYS_CDEFS_H
20 #define _SYS_CDEFS_H 1
22 /* We are almost always included from features.h. */
23 #ifndef _FEATURES_H
24 #include <features.h>
25 #endif
27 /* Some user header file might have defined this before. */
28 #undef __P
29 #undef __PMT
31 #ifdef __GNUC__
33 /* GCC can always grok prototypes. For C++ programs we add throw()
34 to help it optimize the function calls. But this works only with
35 gcc 2.8.x and egcs. */
36 # if defined __cplusplus && __GNUC_MINOR__ >= 8
37 # define __THROW throw ()
38 # else
39 # define __THROW
40 # endif
41 # define __P(args) args __THROW
42 /* This macro will be used for functions which might take C++ callback
43 functions. */
44 # define __PMT(args) args
45 # define __DOTS , ...
47 #else /* Not GCC. */
49 # define __inline /* No inline functions. */
51 # if (defined __STDC__ && __STDC__) || defined __cplusplus
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 , ...
60 # else /* Not ANSI C or C++. */
62 # define __P(args) () /* No prototypes. */
63 # define __PMT(args) ()
64 # define __const /* No ANSI C keywords. */
65 # define __signed
66 # define __volatile
67 # define __DOTS
69 # endif /* ANSI C or C++. */
71 #endif /* GCC. */
73 /* For these things, GCC behaves the ANSI way normally,
74 and the non-ANSI way under -traditional. */
76 #if defined __STDC__ && __STDC__
78 # define __CONCAT(x,y) x ## y
79 # define __STRING(x) #x
81 /* This is not a typedef so `const __ptr_t' does the right thing. */
82 # define __ptr_t void *
83 # define __long_double_t long double
85 #else
87 # define __CONCAT(x,y) x/**/y
88 # define __STRING(x) "x"
90 # define __ptr_t char *
91 # define __long_double_t long double
93 /* The BSD header files use the ANSI keywords unmodified (this means that
94 old programs may lose if they use the new keywords as identifiers), but
95 those names are not available under -traditional. We define them to
96 their __ versions, which are taken care of above. */
97 #ifdef __USE_BSD
98 # define const __const
99 # define signed __signed
100 # define volatile __volatile
101 #endif
103 #endif /* __STDC__ */
106 /* C++ needs to know that types and declarations are C, not C++. */
107 #ifdef __cplusplus
108 # define __BEGIN_DECLS extern "C" {
109 # define __END_DECLS }
110 #else
111 # define __BEGIN_DECLS
112 # define __END_DECLS
113 #endif
115 /* __asm__ ("xyz") is used throughout the headers to rename functions
116 at the assembly language level. This is wrapped by the __REDIRECT
117 macro, in order to support compilers that can do this some other
118 way. When compilers don't support asm-names at all, we have to do
119 preprocessor tricks instead (which don't have exactly the right
120 semantics, but it's the best we can do).
122 Example:
123 int __REDIRECT(setpgrp, __P((__pid_t pid, __pid_t pgrp)), setpgid); */
125 #if defined __GNUC__ && __GNUC__ >= 2
127 # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
128 # define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
129 # define __ASMNAME2(prefix, cname) __STRING (prefix) cname
132 #elif __SOME_OTHER_COMPILER__
134 # define __attribute__(xyz)
135 # define __REDIRECT(name, proto, alias) name proto; \
136 _Pragma("let " #name " = " #alias)
138 #endif
140 /* GCC has various useful declarations that can be made with the
141 `__attribute__' syntax. All of the ways we use this do fine if
142 they are omitted for compilers that don't understand it. */
143 #if !defined __GNUC__ || __GNUC__ < 2
145 # define __attribute__(xyz) /* Ignore. */
147 #endif
149 /* It is possible to compile containing GCC extensions even if GCC is
150 run in pedantic mode if the uses are carefully marked using the
151 `__extension__' keyword. But this is not generally available before
152 version 2.8. */
153 #if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
155 # define __extension__ /* Ignore */
157 #endif
159 /* __restrict is known in EGCS 1.2 and above. */
160 #if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 92)
162 # define __restrict /* Ignore */
164 #endif
166 #endif /* sys/cdefs.h */