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

Last change on this file since 2200 was 2187, checked in by bird, 20 years ago

Updated features.h and the gnu cdefs.h to 2.3.x CVS. level

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