1feature_test_macros(7) Miscellaneous Information Manual feature_test_macros(7)
2
3
4
6 feature_test_macros - feature test macros
7
9 Feature test macros allow the programmer to control the definitions
10 that are exposed by system header files when a program is compiled.
11
12 NOTE: In order to be effective, a feature test macro must be defined
13 before including any header files. This can be done either in the com‐
14 pilation command (cc -DMACRO=value) or by defining the macro within the
15 source code before including any headers. The requirement that the
16 macro must be defined before including any header file exists because
17 header files may freely include one another. Thus, for example, in the
18 following lines, defining the _GNU_SOURCE macro may have no effect be‐
19 cause the header <abc.h> itself includes <xyz.h> (POSIX explicitly al‐
20 lows this):
21
22 #include <abc.h>
23 #define _GNU_SOURCE
24 #include <xyz.h>
25
26 Some feature test macros are useful for creating portable applications,
27 by preventing nonstandard definitions from being exposed. Other macros
28 can be used to expose nonstandard definitions that are not exposed by
29 default.
30
31 The precise effects of each of the feature test macros described below
32 can be ascertained by inspecting the <features.h> header file. Note:
33 applications do not need to directly include <features.h>; indeed, do‐
34 ing so is actively discouraged. See NOTES.
35
36 Specification of feature test macro requirements in manual pages
37 When a function requires that a feature test macro is defined, the man‐
38 ual page SYNOPSIS typically includes a note of the following form (this
39 example from the acct(2) manual page):
40
41 #include <unistd.h>
42
43 int acct(const char *filename);
44
45 Feature Test Macro Requirements for glibc (see
46 feature_test_macros(7)):
47
48 acct(): _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
49
50 The || means that in order to obtain the declaration of acct(2) from
51 <unistd.h>, either of the following macro definitions must be made be‐
52 fore including any header files:
53
54 #define _BSD_SOURCE
55 #define _XOPEN_SOURCE /* or any value < 500 */
56
57 Alternatively, equivalent definitions can be included in the compila‐
58 tion command:
59
60 cc -D_BSD_SOURCE
61 cc -D_XOPEN_SOURCE # Or any value < 500
62
63 Note that, as described below, some feature test macros are defined by
64 default, so that it may not always be necessary to explicitly specify
65 the feature test macro(s) shown in the SYNOPSIS.
66
67 In a few cases, manual pages use a shorthand for expressing the feature
68 test macro requirements (this example from readahead(2)):
69
70 #define _GNU_SOURCE
71 #define _FILE_OFFSET_BITS 64
72 #include <fcntl.h>
73
74 ssize_t readahead(int fd, off_t *offset, size_t count);
75
76 This format is employed when the feature test macros ensure that the
77 proper function declarations are visible, and the macros are not de‐
78 fined by default.
79
80 Feature test macros understood by glibc
81 The paragraphs below explain how feature test macros are handled in
82 glibc 2.x, x > 0.
83
84 First, though, a summary of a few details for the impatient:
85
86 • The macros that you most likely need to use in modern source code
87 are _POSIX_C_SOURCE (for definitions from various versions of
88 POSIX.1), _XOPEN_SOURCE (for definitions from various versions of
89 SUS), _GNU_SOURCE (for GNU and/or Linux specific stuff), and _DE‐
90 FAULT_SOURCE (to get definitions that would normally be provided by
91 default).
92
93 • Certain macros are defined with default values. Thus, although one
94 or more macros may be indicated as being required in the SYNOPSIS of
95 a man page, it may not be necessary to define them explicitly. Full
96 details of the defaults are given later in this man page.
97
98 • Defining _XOPEN_SOURCE with a value of 600 or greater produces the
99 same effects as defining _POSIX_C_SOURCE with a value of 200112L or
100 greater. Where one sees
101
102 _POSIX_C_SOURCE >= 200112L
103
104 in the feature test macro requirements in the SYNOPSIS of a man
105 page, it is implicit that the following has the same effect:
106
107 _XOPEN_SOURCE >= 600
108
109 • Defining _XOPEN_SOURCE with a value of 700 or greater produces the
110 same effects as defining _POSIX_C_SOURCE with a value of 200809L or
111 greater. Where one sees
112
113 _POSIX_C_SOURCE >= 200809L
114
115 in the feature test macro requirements in the SYNOPSIS of a man
116 page, it is implicit that the following has the same effect:
117
118 _XOPEN_SOURCE >= 700
119
120 glibc understands the following feature test macros:
121
122 __STRICT_ANSI__
123 ISO Standard C. This macro is implicitly defined by gcc(1) when
124 invoked with, for example, the -std=c99 or -ansi flag.
125
126 _POSIX_C_SOURCE
127 Defining this macro causes header files to expose definitions as
128 follows:
129
130 • The value 1 exposes definitions conforming to POSIX.1-1990
131 and ISO C (1990).
132
133 • The value 2 or greater additionally exposes definitions for
134 POSIX.2-1992.
135
136 • The value 199309L or greater additionally exposes definitions
137 for POSIX.1b (real-time extensions).
138
139 • The value 199506L or greater additionally exposes definitions
140 for POSIX.1c (threads).
141
142 • (Since glibc 2.3.3) The value 200112L or greater additionally
143 exposes definitions corresponding to the POSIX.1-2001 base
144 specification (excluding the XSI extension). This value also
145 causes C95 (since glibc 2.12) and C99 (since glibc 2.10) fea‐
146 tures to be exposed (in other words, the equivalent of defin‐
147 ing _ISOC99_SOURCE).
148
149 • (Since glibc 2.10) The value 200809L or greater additionally
150 exposes definitions corresponding to the POSIX.1-2008 base
151 specification (excluding the XSI extension).
152
153 _POSIX_SOURCE
154 Defining this obsolete macro with any value is equivalent to
155 defining _POSIX_C_SOURCE with the value 1.
156
157 Since this macro is obsolete, its usage is generally not docu‐
158 mented when discussing feature test macro requirements in the
159 man pages.
160
161 _XOPEN_SOURCE
162 Defining this macro causes header files to expose definitions as
163 follows:
164
165 • Defining with any value exposes definitions conforming to
166 POSIX.1, POSIX.2, and XPG4.
167
168 • The value 500 or greater additionally exposes definitions for
169 SUSv2 (UNIX 98).
170
171 • (Since glibc 2.2) The value 600 or greater additionally ex‐
172 poses definitions for SUSv3 (UNIX 03; i.e., the POSIX.1-2001
173 base specification plus the XSI extension) and C99 defini‐
174 tions.
175
176 • (Since glibc 2.10) The value 700 or greater additionally ex‐
177 poses definitions for SUSv4 (i.e., the POSIX.1-2008 base
178 specification plus the XSI extension).
179
180 If __STRICT_ANSI__ is not defined, or _XOPEN_SOURCE is defined
181 with a value greater than or equal to 500 and neither
182 _POSIX_SOURCE nor _POSIX_C_SOURCE is explicitly defined, then
183 the following macros are implicitly defined:
184
185 • _POSIX_SOURCE is defined with the value 1.
186
187 • _POSIX_C_SOURCE is defined, according to the value of
188 _XOPEN_SOURCE:
189
190 _XOPEN_SOURCE < 500
191 _POSIX_C_SOURCE is defined with the value 2.
192
193 500 <= _XOPEN_SOURCE < 600
194 _POSIX_C_SOURCE is defined with the value 199506L.
195
196 600 <= _XOPEN_SOURCE < 700
197 _POSIX_C_SOURCE is defined with the value 200112L.
198
199 700 <= _XOPEN_SOURCE (since glibc 2.10)
200 _POSIX_C_SOURCE is defined with the value 200809L.
201
202 In addition, defining _XOPEN_SOURCE with a value of 500 or
203 greater produces the same effects as defining _XOPEN_SOURCE_EX‐
204 TENDED.
205
206 _XOPEN_SOURCE_EXTENDED
207 If this macro is defined, and _XOPEN_SOURCE is defined, then ex‐
208 pose definitions corresponding to the XPG4v2 (SUSv1) UNIX exten‐
209 sions (UNIX 95). Defining _XOPEN_SOURCE with a value of 500 or
210 more also produces the same effect as defining _XOPEN_SOURCE_EX‐
211 TENDED. Use of _XOPEN_SOURCE_EXTENDED in new source code should
212 be avoided.
213
214 Since defining _XOPEN_SOURCE with a value of 500 or more has the
215 same effect as defining _XOPEN_SOURCE_EXTENDED, the latter (ob‐
216 solete) feature test macro is generally not described in the
217 SYNOPSIS in man pages.
218
219 _ISOC99_SOURCE (since glibc 2.1.3)
220 Exposes declarations consistent with the ISO C99 standard.
221
222 Earlier glibc 2.1.x versions recognized an equivalent macro
223 named _ISOC9X_SOURCE (because the C99 standard had not then been
224 finalized). Although the use of this macro is obsolete, glibc
225 continues to recognize it for backward compatibility.
226
227 Defining _ISOC99_SOURCE also exposes ISO C (1990) Amendment 1
228 ("C95") definitions. (The primary change in C95 was support for
229 international character sets.)
230
231 Invoking the C compiler with the option -std=c99 produces the
232 same effects as defining this macro.
233
234 _ISOC11_SOURCE (since glibc 2.16)
235 Exposes declarations consistent with the ISO C11 standard.
236 Defining this macro also enables C99 and C95 features (like
237 _ISOC99_SOURCE).
238
239 Invoking the C compiler with the option -std=c11 produces the
240 same effects as defining this macro.
241
242 _LARGEFILE64_SOURCE
243 Expose definitions for the alternative API specified by the LFS
244 (Large File Summit) as a "transitional extension" to the Single
245 UNIX Specification. (See ⟨http://opengroup.org/platform
246 /lfs.html⟩.) The alternative API consists of a set of new ob‐
247 jects (i.e., functions and types) whose names are suffixed with
248 "64" (e.g., off64_t versus off_t, lseek64() versus lseek(),
249 etc.). New programs should not employ this macro; instead
250 _FILE_OFFSET_BITS=64 should be employed.
251
252 _LARGEFILE_SOURCE
253 This macro was historically used to expose certain functions
254 (specifically fseeko(3) and ftello(3)) that address limitations
255 of earlier APIs (fseek(3) and ftell(3)) that use long for file
256 offsets. This macro is implicitly defined if _XOPEN_SOURCE is
257 defined with a value greater than or equal to 500. New programs
258 should not employ this macro; defining _XOPEN_SOURCE as just de‐
259 scribed or defining _FILE_OFFSET_BITS with the value 64 is the
260 preferred mechanism to achieve the same result.
261
262 _FILE_OFFSET_BITS
263 Defining this macro with the value 64 automatically converts
264 references to 32-bit functions and data types related to file
265 I/O and filesystem operations into references to their 64-bit
266 counterparts. This is useful for performing I/O on large files
267 (> 2 Gigabytes) on 32-bit systems. It is also useful when call‐
268 ing functions like copy_file_range(2) that were added more re‐
269 cently and that come only in 64-bit flavors. (Defining this
270 macro permits correctly written programs to use large files with
271 only a recompilation being required.)
272
273 64-bit systems naturally permit file sizes greater than 2 Giga‐
274 bytes, and on those systems this macro has no effect.
275
276 _TIME_BITS
277 Defining this macro with the value 64 changes the width of
278 time_t(3type) to 64-bit which allows handling of timestamps be‐
279 yond 2038. It is closely related to _FILE_OFFSET_BITS and de‐
280 pending on implementation, may require it set. This macro is
281 available as of glibc 2.34.
282
283 _BSD_SOURCE (deprecated since glibc 2.20)
284 Defining this macro with any value causes header files to expose
285 BSD-derived definitions.
286
287 In glibc versions up to and including 2.18, defining this macro
288 also causes BSD definitions to be preferred in some situations
289 where standards conflict, unless one or more of _SVID_SOURCE,
290 _POSIX_SOURCE, _POSIX_C_SOURCE, _XOPEN_SOURCE, _XOPEN_SOURCE_EX‐
291 TENDED, or _GNU_SOURCE is defined, in which case BSD definitions
292 are disfavored. Since glibc 2.19, _BSD_SOURCE no longer causes
293 BSD definitions to be preferred in case of conflicts.
294
295 Since glibc 2.20, this macro is deprecated. It now has the same
296 effect as defining _DEFAULT_SOURCE, but generates a compile-time
297 warning (unless _DEFAULT_SOURCE is also defined). Use _DE‐
298 FAULT_SOURCE instead. To allow code that requires _BSD_SOURCE
299 in glibc 2.19 and earlier and _DEFAULT_SOURCE in glibc 2.20 and
300 later to compile without warnings, define both _BSD_SOURCE and
301 _DEFAULT_SOURCE.
302
303 _SVID_SOURCE (deprecated since glibc 2.20)
304 Defining this macro with any value causes header files to expose
305 System V-derived definitions. (SVID == System V Interface Defi‐
306 nition; see standards(7).)
307
308 Since glibc 2.20, this macro is deprecated in the same fashion
309 as _BSD_SOURCE.
310
311 _DEFAULT_SOURCE (since glibc 2.19)
312 This macro can be defined to ensure that the "default" defini‐
313 tions are provided even when the defaults would otherwise be
314 disabled, as happens when individual macros are explicitly de‐
315 fined, or the compiler is invoked in one of its "standard" modes
316 (e.g., cc -std=c99). Defining _DEFAULT_SOURCE without defining
317 other individual macros or invoking the compiler in one of its
318 "standard" modes has no effect.
319
320 The "default" definitions comprise those required by
321 POSIX.1-2008 and ISO C99, as well as various definitions origi‐
322 nally derived from BSD and System V. On glibc 2.19 and earlier,
323 these defaults were approximately equivalent to explicitly
324 defining the following:
325
326 cc -D_BSD_SOURCE -D_SVID_SOURCE -D_POSIX_C_SOURCE=200809
327
328 _ATFILE_SOURCE (since glibc 2.4)
329 Defining this macro with any value causes header files to expose
330 declarations of a range of functions with the suffix "at"; see
331 openat(2). Since glibc 2.10, this macro is also implicitly de‐
332 fined if _POSIX_C_SOURCE is defined with a value greater than or
333 equal to 200809L.
334
335 _GNU_SOURCE
336 Defining this macro (with any value) implicitly defines _AT‐
337 FILE_SOURCE, _LARGEFILE64_SOURCE, _ISOC99_SOURCE,
338 _XOPEN_SOURCE_EXTENDED, _POSIX_SOURCE, _POSIX_C_SOURCE with the
339 value 200809L (200112L before glibc 2.10; 199506L before glibc
340 2.5; 199309L before glibc 2.1) and _XOPEN_SOURCE with the value
341 700 (600 before glibc 2.10; 500 before glibc 2.2). In addition,
342 various GNU-specific extensions are also exposed.
343
344 Since glibc 2.19, defining _GNU_SOURCE also has the effect of
345 implicitly defining _DEFAULT_SOURCE. Before glibc 2.20, defin‐
346 ing _GNU_SOURCE also had the effect of implicitly defining
347 _BSD_SOURCE and _SVID_SOURCE.
348
349 _REENTRANT
350 Historically, on various C libraries it was necessary to define
351 this macro in all multithreaded code. (Some C libraries may
352 still require this.) In glibc, this macro also exposed defini‐
353 tions of certain reentrant functions.
354
355 However, glibc has been thread-safe by default for many years;
356 since glibc 2.3, the only effect of defining _REENTRANT has been
357 to enable one or two of the same declarations that are also en‐
358 abled by defining _POSIX_C_SOURCE with a value of 199606L or
359 greater.
360
361 _REENTRANT is now obsolete. In glibc 2.25 and later, defining
362 _REENTRANT is equivalent to defining _POSIX_C_SOURCE with the
363 value 199606L. If a higher POSIX conformance level is selected
364 by any other means (such as _POSIX_C_SOURCE itself,
365 _XOPEN_SOURCE, _DEFAULT_SOURCE, or _GNU_SOURCE), then defining
366 _REENTRANT has no effect.
367
368 This macro is automatically defined if one compiles with
369 cc -pthread.
370
371 _THREAD_SAFE
372 Synonym for the (deprecated) _REENTRANT, provided for compati‐
373 bility with some other implementations.
374
375 _FORTIFY_SOURCE (since glibc 2.3.4)
376 Defining this macro causes some lightweight checks to be per‐
377 formed to detect some buffer overflow errors when employing var‐
378 ious string and memory manipulation functions (for example, mem‐
379 cpy(3), memset(3), stpcpy(3), strcpy(3), strncpy(3), strcat(3),
380 strncat(3), sprintf(3), snprintf(3), vsprintf(3), vsnprintf(3),
381 gets(3), and wide character variants thereof). For some func‐
382 tions, argument consistency is checked; for example, a check is
383 made that open(2) has been supplied with a mode argument when
384 the specified flags include O_CREAT. Not all problems are de‐
385 tected, just some common cases.
386
387 If _FORTIFY_SOURCE is set to 1, with compiler optimization level
388 1 (gcc -O1) and above, checks that shouldn't change the behavior
389 of conforming programs are performed. With _FORTIFY_SOURCE set
390 to 2, some more checking is added, but some conforming programs
391 might fail.
392
393 Some of the checks can be performed at compile time (via macros
394 logic implemented in header files), and result in compiler warn‐
395 ings; other checks take place at run time, and result in a run-
396 time error if the check fails.
397
398 With _FORTIFY_SOURCE set to 3, additional checking is added to
399 intercept some function calls used with an argument of variable
400 size where the compiler can deduce an upper bound for its value.
401 For example, a program where malloc(3)'s size argument is vari‐
402 able can now be fortified.
403
404 Use of this macro requires compiler support, available since gcc
405 4.0 and clang 2.6. Use of _FORTIFY_SOURCE set to 3 requires gcc
406 12.0 or later, or clang 9.0 or later, in conjunction with glibc
407 2.33 or later.
408
409 Default definitions, implicit definitions, and combining definitions
410 If no feature test macros are explicitly defined, then the following
411 feature test macros are defined by default: _BSD_SOURCE (in glibc 2.19
412 and earlier), _SVID_SOURCE (in glibc 2.19 and earlier), _DEFAULT_SOURCE
413 (since glibc 2.19), _POSIX_SOURCE, and _POSIX_C_SOURCE=200809L (200112L
414 before glibc 2.10; 199506L before glibc 2.4; 199309L before glibc 2.1).
415
416 If any of __STRICT_ANSI__, _ISOC99_SOURCE, _ISOC11_SOURCE (since glibc
417 2.18), _POSIX_SOURCE, _POSIX_C_SOURCE, _XOPEN_SOURCE, _XOPEN_SOURCE_EX‐
418 TENDED (in glibc 2.11 and earlier), _BSD_SOURCE (in glibc 2.19 and ear‐
419 lier), or _SVID_SOURCE (in glibc 2.19 and earlier) is explicitly de‐
420 fined, then _BSD_SOURCE, _SVID_SOURCE, and _DEFAULT_SOURCE are not de‐
421 fined by default.
422
423 If _POSIX_SOURCE and _POSIX_C_SOURCE are not explicitly defined, and
424 either __STRICT_ANSI__ is not defined or _XOPEN_SOURCE is defined with
425 a value of 500 or more, then
426
427 • _POSIX_SOURCE is defined with the value 1; and
428
429 • _POSIX_C_SOURCE is defined with one of the following values:
430
431 • 2, if _XOPEN_SOURCE is defined with a value less than 500;
432
433 • 199506L, if _XOPEN_SOURCE is defined with a value greater than or
434 equal to 500 and less than 600; or
435
436 • (since glibc 2.4) 200112L, if _XOPEN_SOURCE is defined with a
437 value greater than or equal to 600 and less than 700.
438
439 • (Since glibc 2.10) 200809L, if _XOPEN_SOURCE is defined with a
440 value greater than or equal to 700.
441
442 • Older versions of glibc do not know about the values 200112L and
443 200809L for _POSIX_C_SOURCE, and the setting of this macro will
444 depend on the glibc version.
445
446 • If _XOPEN_SOURCE is undefined, then the setting of
447 _POSIX_C_SOURCE depends on the glibc version: 199506L, before
448 glibc 2.4; 200112L, since glibc 2.4 to glibc 2.9; and 200809L,
449 since glibc 2.10.
450
451 Multiple macros can be defined; the results are additive.
452
454 POSIX.1 specifies _POSIX_C_SOURCE, _POSIX_SOURCE, and _XOPEN_SOURCE.
455
456 _FILE_OFFSET_BITS is not specified by any standard, but is employed on
457 some other implementations.
458
459 _BSD_SOURCE, _SVID_SOURCE, _DEFAULT_SOURCE, _ATFILE_SOURCE,
460 _GNU_SOURCE, _FORTIFY_SOURCE, _REENTRANT, and _THREAD_SAFE are specific
461 to glibc.
462
464 _XOPEN_SOURCE_EXTENDED was specified by XPG4v2 (aka SUSv1), but is not
465 present in SUSv2 and later.
466
468 <features.h> is a Linux/glibc-specific header file. Other systems have
469 an analogous file, but typically with a different name. This header
470 file is automatically included by other header files as required: it is
471 not necessary to explicitly include it in order to employ feature test
472 macros.
473
474 According to which of the above feature test macros are defined, <fea‐
475 tures.h> internally defines various other macros that are checked by
476 other glibc header files. These macros have names prefixed by two un‐
477 derscores (e.g., __USE_MISC). Programs should never define these
478 macros directly: instead, the appropriate feature test macro(s) from
479 the list above should be employed.
480
482 The program below can be used to explore how the various feature test
483 macros are set depending on the glibc version and what feature test
484 macros are explicitly set. The following shell session, on a system
485 with glibc 2.10, shows some examples of what we would see:
486
487 $ cc ftm.c
488 $ ./a.out
489 _POSIX_SOURCE defined
490 _POSIX_C_SOURCE defined: 200809L
491 _BSD_SOURCE defined
492 _SVID_SOURCE defined
493 _ATFILE_SOURCE defined
494 $ cc -D_XOPEN_SOURCE=500 ftm.c
495 $ ./a.out
496 _POSIX_SOURCE defined
497 _POSIX_C_SOURCE defined: 199506L
498 _XOPEN_SOURCE defined: 500
499 $ cc -D_GNU_SOURCE ftm.c
500 $ ./a.out
501 _POSIX_SOURCE defined
502 _POSIX_C_SOURCE defined: 200809L
503 _ISOC99_SOURCE defined
504 _XOPEN_SOURCE defined: 700
505 _XOPEN_SOURCE_EXTENDED defined
506 _LARGEFILE64_SOURCE defined
507 _BSD_SOURCE defined
508 _SVID_SOURCE defined
509 _ATFILE_SOURCE defined
510 _GNU_SOURCE defined
511
512 Program source
513
514 /* ftm.c */
515
516 #include <stdint.h>
517 #include <stdio.h>
518 #include <unistd.h>
519 #include <stdlib.h>
520
521 int
522 main(int argc, char *argv[])
523 {
524 #ifdef _POSIX_SOURCE
525 printf("_POSIX_SOURCE defined\n");
526 #endif
527
528 #ifdef _POSIX_C_SOURCE
529 printf("_POSIX_C_SOURCE defined: %jdL\n",
530 (intmax_t) _POSIX_C_SOURCE);
531 #endif
532
533 #ifdef _ISOC99_SOURCE
534 printf("_ISOC99_SOURCE defined\n");
535 #endif
536
537 #ifdef _ISOC11_SOURCE
538 printf("_ISOC11_SOURCE defined\n");
539 #endif
540
541 #ifdef _XOPEN_SOURCE
542 printf("_XOPEN_SOURCE defined: %d\n", _XOPEN_SOURCE);
543 #endif
544
545 #ifdef _XOPEN_SOURCE_EXTENDED
546 printf("_XOPEN_SOURCE_EXTENDED defined\n");
547 #endif
548
549 #ifdef _LARGEFILE64_SOURCE
550 printf("_LARGEFILE64_SOURCE defined\n");
551 #endif
552
553 #ifdef _FILE_OFFSET_BITS
554 printf("_FILE_OFFSET_BITS defined: %d\n", _FILE_OFFSET_BITS);
555 #endif
556
557 #ifdef _TIME_BITS
558 printf("_TIME_BITS defined: %d\n", _TIME_BITS);
559 #endif
560
561 #ifdef _BSD_SOURCE
562 printf("_BSD_SOURCE defined\n");
563 #endif
564
565 #ifdef _SVID_SOURCE
566 printf("_SVID_SOURCE defined\n");
567 #endif
568
569 #ifdef _DEFAULT_SOURCE
570 printf("_DEFAULT_SOURCE defined\n");
571 #endif
572
573 #ifdef _ATFILE_SOURCE
574 printf("_ATFILE_SOURCE defined\n");
575 #endif
576
577 #ifdef _GNU_SOURCE
578 printf("_GNU_SOURCE defined\n");
579 #endif
580
581 #ifdef _REENTRANT
582 printf("_REENTRANT defined\n");
583 #endif
584
585 #ifdef _THREAD_SAFE
586 printf("_THREAD_SAFE defined\n");
587 #endif
588
589 #ifdef _FORTIFY_SOURCE
590 printf("_FORTIFY_SOURCE defined\n");
591 #endif
592
593 exit(EXIT_SUCCESS);
594 }
595
597 libc(7), standards(7), system_data_types(7)
598
599 The section "Feature Test Macros" under info libc.
600
601 /usr/include/features.h
602
603
604
605Linux man-pages 6.05 2023-07-15 feature_test_macros(7)