OSDN Git Service

fedbc9e80d76a2644ba11519ae4006eea8de9f1e
[linuxjm/LDP_man-pages.git] / original / man7 / feature_test_macros.7
1 .\" This manpage is Copyright (C) 2006, Michael Kerrisk
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .TH FEATURE_TEST_MACROS 7 2014-03-20 "Linux" "Linux Programmer's Manual"
26 .SH NAME
27 feature_test_macros \- feature test macros
28 .SH SYNOPSIS
29 .nf
30 .B #include <features.h>
31 .fi
32 .SH DESCRIPTION
33 Feature test macros allow the programmer to control the definitions that
34 are exposed by system header files when a program is compiled.
35
36 .B NOTE:
37 In order to be effective, a feature test macro
38 .IR "must be defined before including any header files" .
39 This can be done either in the compilation command
40 .RI ( "cc \-DMACRO=value" )
41 or by defining the macro within the source code before
42 including any headers.
43
44 Some feature test macros are useful for creating portable applications,
45 by preventing nonstandard definitions from being exposed.
46 Other macros can be used to expose nonstandard definitions that
47 are not exposed by default.
48 The precise effects of each of the feature test macros described below
49 can be ascertained by inspecting the
50 .I <features.h>
51 header file.
52 .SS Specification of feature test macro requirements in manual pages
53 When a function requires that a feature test macro is defined,
54 the manual page SYNOPSIS typically includes a note of the following form
55 (this example from the
56 .BR acct (2)
57 manual page):
58 .RS 8
59 .sp
60 .B #include <unistd.h>
61 .sp
62 .BI "int acct(const char *" filename );
63 .sp
64 .nf
65 .in -4n
66 Feature Test Macro Requirements for glibc (see
67 .BR feature_test_macros (7)):
68 .fi
69 .in
70 .sp
71 .BR acct ():
72 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
73 .RE
74 .PP
75 The
76 .B ||
77 means that in order to obtain the declaration of
78 .BR acct (2)
79 from
80 .IR <unistd.h> ,
81 .I either
82 of the following macro
83 definitions must be made before including any header files:
84 .RS
85 .nf
86
87 #define _BSD_SOURCE
88 #define _XOPEN_SOURCE        /* or any value < 500 */
89 .fi
90 .RE
91 .PP
92 Alternatively, equivalent definitions can be included in the
93 compilation command:
94 .RS
95 .nf
96
97 cc \-D_BSD_SOURCE
98 cc \-D_XOPEN_SOURCE           # Or any value < 500
99 .fi
100 .RE
101 .PP
102 Note that, as described below,
103 .BR "some feature test macros are defined by default" ,
104 so that it may not always be necessary to
105 explicitly specify the feature test macro(s) shown in the
106 SYNOPSIS.
107
108 In a few cases, manual pages use a shorthand for expressing the
109 feature test macro requirements (this example from
110 .BR readahead (2)):
111 .RS
112 .nf
113
114 .B #define _GNU_SOURCE
115 .B #include <fcntl.h>
116 .sp
117 .BI "ssize_t readahead(int " fd ", off64_t *" offset ", size_t " count );
118 .fi
119 .RE
120 .PP
121 This format is employed in cases where only a single
122 feature test macro can be used to expose the function
123 declaration, and that macro is not defined by default.
124 .SS Feature test macros understood by glibc
125 The following paragraphs explain how feature test macros are handled
126 in Linux glibc 2.\fIx\fP,
127 .I x
128 > 0.
129 .\" The details in glibc 2.0 are simpler, but combining a
130 .\" a description of them with the details in later glibc versions
131 .\" would make for a complicated description.
132
133 Linux glibc understands the following feature test macros:
134 .TP
135 .B __STRICT_ANSI__
136 ISO Standard C.
137 This macro is implicitly defined by
138 .BR gcc (1)
139 when invoked with, for example, the
140 .I -std=c99
141 or
142 .I -ansi
143 flag.
144 .TP
145 .B _POSIX_C_SOURCE
146 Defining this macro causes header files to expose definitions as follows:
147 .RS
148 .IP \(bu 3
149 The value 1 exposes definitions conforming to POSIX.1-1990 and
150 ISO C (1990).
151 .IP \(bu
152 The value 2 or greater additionally exposes
153 definitions for POSIX.2-1992.
154 .IP \(bu
155 The value 199309L or greater additionally exposes
156 definitions for POSIX.1b (real-time extensions).
157 .\" 199506L functionality is available only since glibc 2.1
158 .IP \(bu
159 The value 199506L or greater additionally exposes
160 definitions for POSIX.1c (threads).
161 .IP \(bu
162 (Since glibc 2.3.3)
163 The value 200112L or greater additionally exposes definitions corresponding
164 to the POSIX.1-2001 base specification (excluding the XSI extension)
165 and also causes C95 (since glibc 2.12) and
166 C99 (since glibc 2.10) features to be exposed.
167 .IP \(bu
168 (Since glibc 2.10)
169 The value 200809L or greater additionally exposes definitions corresponding
170 to the POSIX.1-2008 base specification (excluding the XSI extension).
171 .RE
172 .TP
173 .B _POSIX_SOURCE
174 Defining this obsolete macro with any value is equivalent to defining
175 .B _POSIX_C_SOURCE
176 with the value 1.
177 .TP
178 .B _XOPEN_SOURCE
179 Defining this macro causes header files to expose definitions as follows:
180 .RS
181 .IP \(bu 3
182 Defining with any value exposes
183 definitions conforming to POSIX.1, POSIX.2, and XPG4.
184 .IP \(bu
185 The value 500 or greater additionally exposes
186 definitions for SUSv2 (UNIX 98).
187 .IP \(bu
188 (Since glibc 2.2) The value 600 or greater additionally exposes
189 definitions for SUSv3 (UNIX 03; i.e., the POSIX.1-2001 base specification
190 plus the XSI extension) and C99 definitions.
191 .IP \(bu
192 (Since glibc 2.10) The value 700 or greater additionally exposes
193 definitions for SUSv4 (i.e., the POSIX.1-2008 base specification
194 plus the XSI extension).
195 .RE
196 .IP
197 If
198 .B __STRICT_ANSI__
199 is not defined, or
200 .BR _XOPEN_SOURCE
201 is defined with a value greater than or equal to 500
202 .I and
203 neither
204 .B _POSIX_SOURCE
205 not
206 .B _POSIX_C_SOURCE
207 is explicitly defined, then
208 the following macros are implicitly defined:
209 .RS
210 .IP \(bu 3
211 .B _POSIX_SOURCE
212 is defined with the value 1.
213 .IP \(bu
214 .B _POSIX_C_SOURCE
215 is defined, according to the value of
216 .BR _XOPEN_SOURCE :
217 .RS 7
218 .TP
219 .BR _XOPEN_SOURCE " < 500"
220 .B _POSIX_C_SOURCE
221 is defined with the value 2.
222 .TP
223 .RB "500 <= " _XOPEN_SOURCE " < 600"
224 .B _POSIX_C_SOURCE
225 is defined with the value 199506L.
226 .TP
227 .RB "600 <= " _XOPEN_SOURCE " < 700"
228 .B _POSIX_C_SOURCE
229 is defined with the value 200112L.
230 .TP
231 .RB "700 <= " _XOPEN_SOURCE " (since glibc 2.10)"
232 .B _POSIX_C_SOURCE
233 is defined with the value 200809L.
234 .RE
235 .RE
236 .TP
237 .B _XOPEN_SOURCE_EXTENDED
238 If this macro is defined, and
239 .B _XOPEN_SOURCE
240 is defined, then expose definitions corresponding to the XPG4v2
241 (SUSv1) UNIX extensions (UNIX 95).
242 This macro is also implicitly defined if
243 .B _XOPEN_SOURCE
244 is defined with a value of 500 or more.
245 .TP
246 .BR _ISOC99_SOURCE " (since glibc 2.1.3)"
247 Exposes declarations consistent with the ISO C99 standard.
248
249 Earlier glibc 2.1.x versions recognized an equivalent macro named
250 .B _ISOC9X_SOURCE
251 (because the C99 standard had not then been finalized).
252 Although the use of this macro is obsolete, glibc continues
253 to recognize it for backward compatibility.
254
255 Defining
256 .B _ISOC99_SOURCE
257 also exposes ISO C (1990) Amendment 1 ("C95") definitions.
258 (The primary change in C95 was support for international character sets.)
259 .TP
260 .BR _ISOC11_SOURCE " (since glibc 2.16)"
261 Exposes declarations consistent with the ISO C11 standard.
262 Defining this macro also enables C99 and C95 features (like
263 .BR _ISOC99_SOURCE ).
264 .TP
265 .B _LARGEFILE64_SOURCE
266 Expose definitions for the alternative API specified by the
267 LFS (Large File Summit) as a "transitional extension" to the
268 Single UNIX Specification.
269 (See
270 .UR http:\:/\:/opengroup.org\:/platform\:/lfs.html
271 .UE .)
272 The alternative API consists of a set of new objects
273 (i.e., functions and types) whose names are suffixed with "64"
274 (e.g.,
275 .I off64_t
276 versus
277 .IR off_t ,
278 .BR lseek64 ()
279 versus
280 .BR lseek (),
281 etc.).
282 New programs should not employ this macro; instead
283 .I _FILE_OFFSET_BITS=64
284 should be employed.
285 .TP
286 .BR _LARGEFILE_SOURCE
287 This macro was historically used to expose certain functions (specifically
288 .BR fseeko (3)
289 and
290 .BR ftello (3))
291 that address limitations of earlier APIs
292 .RB ( feek (3)
293 and
294 .BR ftell (3))
295 that use
296 .IR "long int"
297 for file offsets.
298 This macro is implicitly defined if
299 .BR _XOPEN_SOURCE
300 is defined with a value greater than or equal to 500.
301 New programs should not employ this macro;
302 defining
303 .BR _XOPEN_SOURCE
304 as just described or defining
305 .B _FILE_OFFSET_BITS
306 with the value 64 is the preferred mechanism to achieve the same result.
307 .TP
308 .B _FILE_OFFSET_BITS
309 Defining this macro with the value 64
310 automatically converts references to 32-bit functions and data types
311 related to file I/O and filesystem operations into references to
312 their 64-bit counterparts.
313 This is useful for performing I/O on large files (> 2 Gigabytes)
314 on 32-bit systems.
315 (Defining this macro permits correctly written programs to use
316 large files with only a recompilation being required.)
317
318 64-bit systems naturally permit file sizes greater than 2 Gigabytes,
319 and on those systems this macro has no effect.
320 .TP
321 .BR _BSD_SOURCE " (deprecated since glibc 2.20)"
322 Defining this macro with any value causes header files to expose
323 BSD-derived definitions.
324
325 In glibc versions up to and including 2.18,
326 defining this macro also causes BSD definitions to be preferred in
327 some situations where standards conflict, unless one or more of
328 .BR _SVID_SOURCE ,
329 .BR _POSIX_SOURCE ,
330 .BR _POSIX_C_SOURCE ,
331 .BR _XOPEN_SOURCE ,
332 .BR _XOPEN_SOURCE_EXTENDED ,
333 or
334 .B _GNU_SOURCE
335 is defined, in which case BSD definitions are disfavored.
336 Since glibc 2.19,
337 .B _BSD_SOURCE
338 no longer causes BSD definitions to be preferred in case of conflicts.
339
340 Since glibc 2.20, this macro is deprecated.
341 .\" commit c941736c92fa3a319221f65f6755659b2a5e0a20
342 .\" commit 498afc54dfee41d33ba519f496e96480badace8e
343 .\" commit acd7f096d79c181866d56d4aaf3b043e741f1e2c
344 It now has the same effect as defining
345 .BR _DEFAULT_SOURCE ,
346 but generates a compile-time warning (unless
347 .BR _DEFAULT_SOURCE
348 .\" commit ade40b10ff5fa59a318cf55b9d8414b758e8df78
349 is also defined).
350 Use
351 .B _DEFAULT_SOURCE
352 instead.
353 To allow code that requires
354 .BR _BSD_SOURCE
355 in glibc 2.19 and earlier and
356 .BR _DEFAULT_SOURCE
357 in glibc 2.20 and later to compile without warnings, define
358 .I both
359 .B _BSD_SOURCE
360 and
361 .BR _DEFAULT_SOURCE .
362 .TP
363 .BR _SVID_SOURCE " (deprecated since glibc 2.20)"
364 Defining this macro with any value causes header files to expose
365 System V-derived definitions.
366 (SVID == System V Interface Definition; see
367 .BR standards (7).)
368
369 Since glibc 2.20, this macro is deprecated in the same fashion as
370 .BR _BSD_SOURCE .
371 .TP
372 .BR _DEFAULT_SOURCE " (since glibc 2.19)"
373 This macro can be defined to ensure that the "default"
374 definitions are provided even when the defaults would otherwise
375 be disabled,
376 as happens when individual macros are explicitly defined,
377 or the compiler is invoked in one of its "standard" modes (e.g.,
378 .IR "cc\ \-std=c99" ).
379 Defining
380 .B _DEFAULT_SOURCE
381 without defining other individual macros
382 or invoking the compiler in one of its "standard" modes has no effect.
383
384 The "default" definitions comprise those required by POSIX.1-2008
385 as well as various definitions derived from BSD and System V.
386 On glibc 2.19 and earlier, these defaults were approximately equivalent
387 to explicitly defining the following:
388
389     cc \-D_BSD_SOURCE \-D_SVID_SOURCE \-D_POSIX_C_SOURCE=200809
390
391 .TP
392 .BR _ATFILE_SOURCE " (since glibc 2.4)"
393 Defining this macro with any value causes header files to expose
394 declarations of a range of functions with the suffix "at";
395 see
396 .BR openat (2).
397 Since glibc 2.10, this macro is also implicitly defined if
398 .BR _POSIX_C_SOURCE
399 is defined with a value greater than or equal to 200809L.
400 .TP
401 .B _GNU_SOURCE
402 Defining this macro (with any value) implicitly defines
403 .BR _ATFILE_SOURCE ,
404 .BR _LARGEFILE64_SOURCE ,
405 .BR _ISOC99_SOURCE ,
406 .BR _XOPEN_SOURCE_EXTENDED ,
407 .BR _POSIX_SOURCE ,
408 .B _POSIX_C_SOURCE
409 with the value 200809L
410 (200112L in glibc versions before 2.10;
411 199506L in glibc versions before 2.5;
412 199309L in glibc versions before 2.1)
413 and
414 .B _XOPEN_SOURCE
415 with the value 700
416 (600 in glibc versions before 2.10;
417 500 in glibc versions before 2.2).
418 In addition, various GNU-specific extensions are also exposed.
419
420 Since glibc 2.19, defining
421 .BR _GNU_SOURCE
422 also has the effect of implicitly defining
423 .BR _DEFAULT_SOURCE .
424 In glibc versions before 2.20, defining
425 .BR _GNU_SOURCE
426 also had the effect of implicitly defining
427 .BR _BSD_SOURCE
428 and
429 .BR _SVID_SOURCE .
430 .TP
431 .B _REENTRANT
432 Defining this macro exposes definitions of certain reentrant functions.
433 For multithreaded programs, use
434 .I "cc\ \-pthread"
435 instead.
436 .TP
437 .B _THREAD_SAFE
438 Synonym for
439 .BR _REENTRANT ,
440 provided for compatibility with some other implementations.
441 .TP
442 .BR _FORTIFY_SOURCE " (since glibc 2.3.4)"
443 .\" For more detail, see:
444 .\" http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html
445 .\" [PATCH] Object size checking to prevent (some) buffer overflows
446 .\" * From: Jakub Jelinek <jakub at redhat dot com>
447 .\" * To: gcc-patches at gcc dot gnu dot org
448 .\" * Date: Tue, 21 Sep 2004 04:16:40 -0400
449 Defining this macro causes some lightweight checks to be performed
450 to detect some buffer overflow errors when employing
451 various string and memory manipulation functions.
452 Not all buffer overflows are detected, just some common cases.
453
454 In the current implementation, checks are added for
455 calls to
456 .BR memcpy (3),
457 .BR mempcpy (3),
458 .BR memmove (3),
459 .BR memset (3),
460 .BR stpcpy (3),
461 .BR strcpy (3),
462 .BR strncpy (3),
463 .BR strcat (3),
464 .BR strncat (3),
465 .BR sprintf (3),
466 .BR snprintf (3),
467 .BR vsprintf (3),
468 .BR vsnprintf (3),
469 and
470 .BR gets (3).
471
472 If
473 .B _FORTIFY_SOURCE
474 is set to 1, with compiler optimization level 1
475 .RI ( "gcc\ \-O1" )
476 and above, checks that shouldn't change the behavior of
477 conforming programs are performed.
478 With
479 .B _FORTIFY_SOURCE
480 set to 2 some more checking is added, but
481 some conforming programs might fail.
482 Some of the checks can be performed at compile time,
483 and result in compiler warnings;
484 other checks take place at run time,
485 and result in a run-time error if the check fails.
486
487 Use of this macro requires compiler support, available with
488 .BR gcc (1)
489 since version 4.0.
490 .SS Default definitions, implicit definitions, and combining definitions
491 .PP
492 If no feature test macros are explicitly defined,
493 then the following feature test macros are defined by default:
494 .BR _BSD_SOURCE
495 (in glibc 2.19 and earlier),
496 .BR _SVID_SOURCE
497 (in glibc 2.19 and earlier),
498 .BR _DEFAULT_SOURCE
499 (since glibc 2.19),
500 .BR _POSIX_SOURCE ,
501 and
502 .BR _POSIX_C_SOURCE =200809L
503 (200112L in glibc versions before 2.10;
504 199506L in glibc versions before 2.4;
505 199309L in glibc versions before 2.1).
506 .PP
507 If any of
508 .BR __STRICT_ANSI__ ,
509 .BR _ISOC99_SOURCE ,
510 .BR _POSIX_SOURCE ,
511 .BR _POSIX_C_SOURCE  ,
512 .BR _XOPEN_SOURCE ,
513 .BR _XOPEN_SOURCE_EXTENDED ,
514 .BR _BSD_SOURCE
515 (in glibc 2.19 and earlier),
516 or
517 .B _SVID_SOURCE
518 (in glibc 2.19 and earlier)
519 is explicitly defined, then
520 .BR _BSD_SOURCE ,
521 .BR _SVID_SOURCE ,
522 and
523 .BR _DEFAULT_SOURCE
524 are not defined by default.
525
526 If
527 .B _POSIX_SOURCE
528 and
529 .B _POSIX_C_SOURCE
530 are not explicitly defined,
531 and either
532 .B __STRICT_ANSI__
533 is not defined or
534 .B _XOPEN_SOURCE
535 is defined with a value of 500 or more, then
536 .IP * 3
537 .B _POSIX_SOURCE
538 is defined with the value 1; and
539 .IP *
540 .B _POSIX_C_SOURCE
541 is defined with one of the following values:
542 .RS 3
543 .IP \(bu 3
544 2,
545 if
546 .B _XOPEN_SOURCE
547 is defined with a value less than 500;
548 .IP \(bu
549 199506L,
550 if
551 .B _XOPEN_SOURCE
552 is defined with a value greater than or equal to 500 and less than 600;
553 or
554 .IP \(bu
555 (since glibc 2.4) 200112L,
556 if
557 .B _XOPEN_SOURCE
558 is defined with a value greater than or equal to 600 and less than 700.
559 .IP \(bu
560 (Since glibc 2.10)
561 200809L,
562 if
563 .B _XOPEN_SOURCE
564 is defined with a value greater than or equal to 700.
565 .IP \(bu
566 Older versions of glibc do not know about the values
567 200112L and 200809L for
568 .BR _POSIX_C_SOURCE ,
569 and the setting of this macro will depend on the glibc version.
570 .IP \(bu
571 If
572 .B _XOPEN_SOURCE
573 is undefined, then the setting of
574 .B _POSIX_C_SOURCE
575 depends on the glibc version:
576 199506L, in glibc versions before 2.4;
577 200112L, in glibc 2.4 to 2.9; and
578 200809L, since glibc 2.10.
579 .RE
580 .PP
581 Multiple macros can be defined; the results are additive.
582 .SH CONFORMING TO
583 POSIX.1 specifies
584 .BR _POSIX_C_SOURCE ,
585 .BR _POSIX_SOURCE ,
586 and
587 .BR _XOPEN_SOURCE .
588 .B _XOPEN_SOURCE_EXTENDED
589 was specified by XPG4v2 (aka SUSv1).
590
591 .B _FILE_OFFSET_BITS
592 is not specified by any standard,
593 but is employed on some other implementations.
594
595 .BR _BSD_SOURCE ,
596 .BR _SVID_SOURCE ,
597 .BR _DEFAULT_SOURCE ,
598 .BR _ATFILE_SOURCE ,
599 .BR _GNU_SOURCE ,
600 .BR _FORTIFY_SOURCE ,
601 .BR _REENTRANT ,
602 and
603 .B _THREAD_SAFE
604 are specific to Linux (glibc).
605 .SH NOTES
606 .I <features.h>
607 is a Linux/glibc-specific header file.
608 Other systems have an analogous file, but typically with a different name.
609 This header file is automatically included by other header files as
610 required: it is not necessary to explicitly include it in order to
611 employ feature test macros.
612
613 According to which of the above feature test macros are defined,
614 .I <features.h>
615 internally defines various other macros that are checked by
616 other glibc header files.
617 These macros have names prefixed by two underscores (e.g.,
618 .BR __USE_MISC ).
619 Programs should
620 .I never
621 define these macros directly:
622 instead, the appropriate feature test macro(s) from the
623 list above should be employed.
624 .SH EXAMPLE
625 The program below can be used to explore how the various
626 feature test macros are set depending on the glibc version
627 and what feature test macros are explicitly set.
628 The following shell session, on a system with glibc 2.10,
629 shows some examples of what we would see:
630 .in +4n
631 .nf
632
633 $ \fBcc ftm.c\fP
634 $ \fB./a.out\fP
635 _POSIX_SOURCE defined
636 _POSIX_C_SOURCE defined: 200809L
637 _BSD_SOURCE defined
638 _SVID_SOURCE defined
639 _ATFILE_SOURCE defined
640 $ \fBcc \-D_XOPEN_SOURCE=500 ftm.c\fP
641 $ \fB./a.out\fP
642 _POSIX_SOURCE defined
643 _POSIX_C_SOURCE defined: 199506L
644 _XOPEN_SOURCE defined: 500
645 $ \fBcc \-D_GNU_SOURCE ftm.c\fP
646 $ \fB./a.out\fP
647 _POSIX_SOURCE defined
648 _POSIX_C_SOURCE defined: 200809L
649 _ISOC99_SOURCE defined
650 _XOPEN_SOURCE defined: 700
651 _XOPEN_SOURCE_EXTENDED defined
652 _LARGEFILE64_SOURCE defined
653 _BSD_SOURCE defined
654 _SVID_SOURCE defined
655 _ATFILE_SOURCE defined
656 _GNU_SOURCE defined
657 .fi
658 .in
659 .SS Program source
660 \&
661 .nf
662 /* ftm.c */
663
664 #include <stdio.h>
665 #include <unistd.h>
666 #include <stdlib.h>
667
668 int
669 main(int argc, char *argv[])
670 {
671 #ifdef _POSIX_SOURCE
672     printf("_POSIX_SOURCE defined\\n");
673 #endif
674
675 #ifdef _POSIX_C_SOURCE
676     printf("_POSIX_C_SOURCE defined: %ldL\\n", (long) _POSIX_C_SOURCE);
677 #endif
678
679 #ifdef _ISOC99_SOURCE
680     printf("_ISOC99_SOURCE defined\\n");
681 #endif
682
683 #ifdef _ISOC11_SOURCE
684     printf("_ISOC11_SOURCE defined\\n");
685 #endif
686
687 #ifdef _XOPEN_SOURCE
688     printf("_XOPEN_SOURCE defined: %d\\n", _XOPEN_SOURCE);
689 #endif
690
691 #ifdef _XOPEN_SOURCE_EXTENDED
692     printf("_XOPEN_SOURCE_EXTENDED defined\\n");
693 #endif
694
695 #ifdef _LARGEFILE64_SOURCE
696     printf("_LARGEFILE64_SOURCE defined\\n");
697 #endif
698
699 #ifdef _FILE_OFFSET_BITS
700     printf("_FILE_OFFSET_BITS defined: %d\\n", _FILE_OFFSET_BITS);
701 #endif
702
703 #ifdef _BSD_SOURCE
704     printf("_BSD_SOURCE defined\\n");
705 #endif
706
707 #ifdef _SVID_SOURCE
708     printf("_SVID_SOURCE defined\\n");
709 #endif
710
711 #ifdef _DEFAULT_SOURCE
712     printf("_DEFAULT_SOURCE defined\\n");
713 #endif
714
715 #ifdef _ATFILE_SOURCE
716     printf("_ATFILE_SOURCE defined\\n");
717 #endif
718
719 #ifdef _GNU_SOURCE
720     printf("_GNU_SOURCE defined\\n");
721 #endif
722
723 #ifdef _REENTRANT
724     printf("_REENTRANT defined\\n");
725 #endif
726
727 #ifdef _THREAD_SAFE
728     printf("_THREAD_SAFE defined\\n");
729 #endif
730
731 #ifdef _FORTIFY_SOURCE
732     printf("_FORTIFY_SOURCE defined\\n");
733 #endif
734
735     exit(EXIT_SUCCESS);
736 }
737 .fi
738 .SH SEE ALSO
739 .BR libc (7),
740 .BR standards (7)
741
742 The section "Feature Test Macros" under
743 .IR "info libc" .
744 .\" But beware: the info libc document is out of date (Jul 07, mtk)
745
746 .I /usr/include/features.h
747 .SH COLOPHON
748 This page is part of release 3.64 of the Linux
749 .I man-pages
750 project.
751 A description of the project,
752 and information about reporting bugs,
753 can be found at
754 \%http://www.kernel.org/doc/man\-pages/.