source: trunk/src/emx/include/features.h@ 1298

Last change on this file since 1298 was 1298, checked in by bird, 21 years ago

-Wundef friendly.

  • Property cvs2svn:cvs-rev set to 1.6
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 12.4 KB
Line 
1/* Copyright (C) 1991-1993,1995-2000,2001,2002 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
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 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
18
19/** @file
20 * GLIBC v2.3.2
21 * @changed bird: don't define *LARGEFILE64*, but make sure to indicate that
22 * off_t is 64bits.
23 * @changed bird: not GLIBC version numbers.
24 * @chagned bird: _GNU_SOURCE should not set _POSIX_SOURCE or _POSIX_C_SOURCE as that
25 * means somewhat imporatant exclusions in EMX and BSD style headers.
26 * Some of this have been fixed by __USE_EMX/_EMX_SOURCE, but that's
27 * not gonna help enough.
28 */
29
30#ifndef _FEATURES_H
31#define _FEATURES_H 1
32
33/* These are defined by the user (or the compiler)
34 to specify the desired environment:
35
36 __STRICT_ANSI__ ISO Standard C.
37 _ISOC99_SOURCE Extensions to ISO C89 from ISO C99.
38 _POSIX_SOURCE IEEE Std 1003.1.
39 _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
40 if >=199309L, add IEEE Std 1003.1b-1993;
41 if >=199506L, add IEEE Std 1003.1c-1995
42 _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if
43 Single Unix conformance is wanted, to 600 for the
44 upcoming sixth revision.
45 _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
46 _LARGEFILE_SOURCE Some more functions for correct standard I/O.
47 _LARGEFILE64_SOURCE Additional functionality from LFS for large files.
48 _FILE_OFFSET_BITS=N Select default filesystem interface.
49 _BSD_SOURCE ISO C, POSIX, and 4.3BSD things.
50 _SVID_SOURCE ISO C, POSIX, and SVID things.
51 _GNU_SOURCE All of the above, plus GNU extensions.
52 _REENTRANT Select additionally reentrant object.
53 _THREAD_SAFE Same as _REENTRANT, often used by other systems.
54
55 The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__.
56 If none of these are defined, the default is to have _SVID_SOURCE,
57 _BSD_SOURCE, and _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
58 199506L. If more than one of these are defined, they accumulate.
59 For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE
60 together give you ISO C, 1003.1, and 1003.2, but nothing else.
61
62 These are defined by this file and are used by the
63 header files to decide what to declare or define:
64
65 __USE_ISOC99 Define ISO C99 things.
66 __USE_POSIX Define IEEE Std 1003.1 things.
67 __USE_POSIX2 Define IEEE Std 1003.2 things.
68 __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things.
69 __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things.
70 __USE_XOPEN Define XPG things.
71 __USE_XOPEN_EXTENDED Define X/Open Unix things.
72 __USE_UNIX98 Define Single Unix V2 things.
73 __USE_XOPEN2K Define XPG6 things.
74 __USE_LARGEFILE Define correct standard I/O things.
75 __USE_LARGEFILE64 Define LFS things with separate names.
76 __USE_FILE_OFFSET64 Define 64bit interface as default.
77 __USE_BSD Define 4.3BSD things.
78 __USE_SVID Define SVID things.
79 __USE_MISC Define things common to BSD and System V Unix.
80 __USE_GNU Define GNU extensions.
81 __USE_REENTRANT Define reentrant/thread-safe *_r functions.
82 __FAVOR_BSD Favor 4.3BSD things in cases of conflict.
83
84 The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
85 defined by this file unconditionally. `__GNU_LIBRARY__' is provided
86 only for compatibility. All new code should use the other symbols
87 to test for features.
88
89 All macros listed above as possibly being defined by this file are
90 explicitly undefined if they are not explicitly defined.
91 Feature-test macros that are not defined by the user or compiler
92 but are implied by the other feature-test macros defined (or by the
93 lack of any definitions) are defined by the file. */
94
95
96/* Undefine everything, so we get a clean slate. */
97#undef __USE_ISOC99
98#undef __USE_POSIX
99#undef __USE_POSIX2
100#undef __USE_POSIX199309
101#undef __USE_POSIX199506
102#undef __USE_XOPEN
103#undef __USE_XOPEN_EXTENDED
104#undef __USE_UNIX98
105#undef __USE_XOPEN2K
106#undef __USE_LARGEFILE
107#undef __USE_LARGEFILE64
108#undef __USE_FILE_OFFSET64
109#undef __USE_BSD
110#undef __USE_SVID
111#undef __USE_MISC
112#undef __USE_GNU
113#undef __USE_REENTRANT
114#undef __FAVOR_BSD
115#undef __KERNEL_STRICT_NAMES
116#ifdef __EMX__ /* bird */
117#undef __USE_EMX /* bird */
118#endif /* bird */
119
120/* Suppress kernel-name space pollution unless user expressedly asks
121 for it. */
122#ifndef _LOOSE_KERNEL_NAMES
123# define __KERNEL_STRICT_NAMES
124#endif
125
126/* Always use ISO C things. */
127#define __USE_ANSI 1
128
129
130/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */
131#if defined _BSD_SOURCE && \
132 !(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
133 defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \
134 defined _GNU_SOURCE || defined _SVID_SOURCE)
135# define __FAVOR_BSD 1
136#endif
137
138/* If _GNU_SOURCE was defined by the user, turn on all the other features. */
139#ifdef _GNU_SOURCE
140# undef _ISOC99_SOURCE
141# define _ISOC99_SOURCE 1
142/* bird: sorry, but this isn't causing huge exclusions for BSD or EMX headers. */
143#ifndef __EMX__ /* bird */
144# undef _POSIX_SOURCE
145# define _POSIX_SOURCE 1
146# undef _POSIX_C_SOURCE
147# define _POSIX_C_SOURCE 199506L
148#else /* bird */
149# define __USE_POSIX199309 1 /* bird */
150# define __USE_POSIX199506 1 /* bird */
151#endif /* bird */
152# undef _XOPEN_SOURCE
153# define _XOPEN_SOURCE 600
154# undef _XOPEN_SOURCE_EXTENDED
155# define _XOPEN_SOURCE_EXTENDED 1
156# undef _LARGEFILE64_SOURCE
157#ifndef __EMX__ /* bird */
158# define _LARGEFILE64_SOURCE 1
159#endif /* bird */
160# undef _BSD_SOURCE
161# define _BSD_SOURCE 1
162# undef _SVID_SOURCE
163# define _SVID_SOURCE 1
164# ifdef __EMX__
165# define _EMX_SOURCE 1
166# endif
167#endif
168
169/* If nothing (other than _GNU_SOURCE) is defined,
170 define _BSD_SOURCE and _SVID_SOURCE. */
171#if (!defined __STRICT_ANSI__ && !defined _ISOC99_SOURCE && \
172 !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \
173 !defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \
174 !defined _BSD_SOURCE && !defined _SVID_SOURCE)
175# define _BSD_SOURCE 1
176# define _SVID_SOURCE 1
177#endif
178
179/* This is to enable the ISO C99 extension. Also recognize the old macro
180 which was used prior to the standard acceptance. This macro will
181 eventually go away and the features enabled by default once the ISO C99
182 standard is widely adopted. */
183#if (defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE \
184 || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
185# define __USE_ISOC99 1
186#endif
187
188#ifndef __EMX__ /* bird: this messes up lot's of EMX legacy declarations. */
189/* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2
190 (and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined). */
191#if (!defined __STRICT_ANSI__ && !defined _POSIX_SOURCE && \
192 !defined _POSIX_C_SOURCE)
193# define _POSIX_SOURCE 1
194# if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500
195# define _POSIX_C_SOURCE 2
196# else
197# define _POSIX_C_SOURCE 199506L
198# endif
199#endif
200#endif /* bird */
201
202#ifdef __EMX__ /* This spawns warnings with -Wundef. */
203#if defined _POSIX_SOURCE || (defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 1) || defined _XOPEN_SOURCE
204# define __USE_POSIX 1
205#endif
206#else
207#if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE
208# define __USE_POSIX 1
209#endif
210#endif
211
212#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE
213# define __USE_POSIX2 1
214#endif
215
216#if (_POSIX_C_SOURCE - 0) >= 199309L
217# define __USE_POSIX199309 1
218#endif
219
220#if (_POSIX_C_SOURCE - 0) >= 199506L
221# define __USE_POSIX199506 1
222#endif
223
224#ifdef _XOPEN_SOURCE
225# define __USE_XOPEN 1
226# if (_XOPEN_SOURCE - 0) >= 500
227# define __USE_XOPEN_EXTENDED 1
228# define __USE_UNIX98 1
229# undef _LARGEFILE_SOURCE
230# define _LARGEFILE_SOURCE 1
231# if (_XOPEN_SOURCE - 0) >= 600
232# define __USE_XOPEN2K 1
233# undef __USE_ISOC99
234# define __USE_ISOC99 1
235# endif
236# else
237# ifdef _XOPEN_SOURCE_EXTENDED
238# define __USE_XOPEN_EXTENDED 1
239# endif
240# endif
241#endif
242
243#ifdef _LARGEFILE_SOURCE
244# define __USE_LARGEFILE 1
245#endif
246
247#ifndef __EMX__ /* bird */
248#ifdef _LARGEFILE64_SOURCE
249# define __USE_LARGEFILE64 1
250#endif
251#endif /* bird */
252
253#ifndef __EMX__ /* bird */
254#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
255# define __USE_FILE_OFFSET64 1
256#endif
257#else
258# define __USE_FILE_OFFSET64 1
259#endif /* bird */
260
261#if defined _BSD_SOURCE || defined _SVID_SOURCE
262# define __USE_MISC 1
263#endif
264
265#ifdef _BSD_SOURCE
266# define __USE_BSD 1
267/* bird: __USE_BSD == __BSD_VISIBLE, make sure it's defined. */
268# ifdef __EMX__
269# undef __BSD_VISIBLE
270# define __BSD_VISIBLE 1
271# endif
272/* bird: end */
273#endif
274
275#ifdef _SVID_SOURCE
276# define __USE_SVID 1
277#endif
278
279#ifdef _GNU_SOURCE
280# define __USE_GNU 1
281#endif
282
283#if defined(__EMX__) && defined(_EMX_SOURCE) /* bird */
284# define __USE_EMX 1 /* bird */
285#endif /* bird */
286
287#if defined _REENTRANT || defined _THREAD_SAFE
288# define __USE_REENTRANT 1
289#endif
290
291/* We do support the IEC 559 math functionality, real and complex. */
292#define __STDC_IEC_559__ 1
293#define __STDC_IEC_559_COMPLEX__ 1
294
295/* wchar_t uses ISO 10646-1 (2nd ed., published 2000-09-15) / Unicode 3.1. */
296#define __STDC_ISO_10646__ 200009L
297
298#ifndef __EMX__ /*bird: we're not GLIBC */
299/* This macro indicates that the installed library is the GNU C Library.
300 For historic reasons the value now is 6 and this will stay from now
301 on. The use of this variable is deprecated. Use __GLIBC__ and
302 __GLIBC_MINOR__ now (see below) when you want to test for a specific
303 GNU C library version and use the values in <gnu/lib-names.h> to get
304 the sonames of the shared libraries. */
305#undef __GNU_LIBRARY__
306#define __GNU_LIBRARY__ 6
307
308/* Major and minor version number of the GNU C library package. Use
309 these macros to test for features in specific releases. */
310#define __GLIBC__ 2
311#define __GLIBC_MINOR__ 3
312#endif /*bird*/
313
314/* Convenience macros to test the versions of glibc and gcc.
315 Use them like this:
316 #if __GNUC_PREREQ (2,8)
317 ... code requiring gcc 2.8 or later ...
318 #endif
319 Note - they won't work for gcc1 or glibc1, since the _MINOR macros
320 were not defined then. */
321#if defined __GNUC__ && defined __GNUC_MINOR__
322# define __GNUC_PREREQ(maj, min) \
323 ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
324#else
325# define __GNUC_PREREQ(maj, min) 0
326#endif
327
328#define __GLIBC_PREREQ(maj, min) \
329 ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
330
331/* Decide whether a compiler supports the long long datatypes. */
332#if defined __GNUC__ \
333 || (defined __PGI && defined __i386__ ) \
334 || (defined __INTEL_COMPILER && (defined __i386__ || defined __ia64__)) \
335 || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
336# define __GLIBC_HAVE_LONG_LONG 1
337#endif
338
339/* This is here only because every header file already includes this one. */
340#ifndef __ASSEMBLER__
341# ifndef _SYS_CDEFS_H
342# include <sys/cdefs.h>
343# endif
344
345/* If we don't have __REDIRECT, prototypes will be missing if
346 __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */
347# if defined __USE_FILE_OFFSET64 && !defined __REDIRECT
348# define __USE_LARGEFILE 1
349#ifndef __EMX__ /* bird */
350# define __USE_LARGEFILE64 1
351#endif /* bird */
352# endif
353
354#endif /* !ASSEMBLER */
355
356/* Decide whether we can define 'extern inline' functions in headers. */
357#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
358 && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
359# define __USE_EXTERN_INLINES 1
360#endif
361
362
363#ifndef __EMX__ /* bird */
364/* This is here only because every header file already includes this one.
365 Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
366 <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
367 that will always return failure (and set errno to ENOSYS). */
368#include <gnu/stubs.h>
369#endif /* bird */
370
371
372#endif /* features.h */
Note: See TracBrowser for help on using the repository browser.