diff options
Diffstat (limited to 'man7/feature_test_macros.7')
-rw-r--r-- | man7/feature_test_macros.7 | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/man7/feature_test_macros.7 b/man7/feature_test_macros.7 index 4e264d8..ee414dd 100644 --- a/man7/feature_test_macros.7 +++ b/man7/feature_test_macros.7 @@ -2,13 +2,13 @@ .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" -.TH feature_test_macros 7 2023-07-15 "Linux man-pages 6.05.01" +.TH feature_test_macros 7 2023-10-31 "Linux man-pages 6.7" .SH NAME feature_test_macros \- feature test macros .SH DESCRIPTION Feature test macros allow the programmer to control the definitions that are exposed by system header files when a program is compiled. -.PP +.P .B NOTE: In order to be effective, a feature test macro .IR "must be defined before including any header files" . @@ -25,7 +25,7 @@ macro may have no effect because the header itself includes .I <xyz.h> (POSIX explicitly allows this): -.PP +.P .in +4n .EX #include <abc.h> @@ -33,12 +33,12 @@ itself includes #include <xyz.h> .EE .in -.PP +.P Some feature test macros are useful for creating portable applications, by preventing nonstandard definitions from being exposed. Other macros can be used to expose nonstandard definitions that are not exposed by default. -.PP +.P The precise effects of each of the feature test macros described below can be ascertained by inspecting the .I <features.h> @@ -56,23 +56,23 @@ the manual page SYNOPSIS typically includes a note of the following form (this example from the .BR acct (2) manual page): -.PP +.P .RS .B #include <unistd.h> -.PP +.P .BI "int acct(const char *" filename ); -.PP +.P .RS -4 .EX Feature Test Macro Requirements for glibc (see .BR feature_test_macros (7)): .EE .RE -.PP +.P .BR acct (): _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) .RE -.PP +.P The .B || means that in order to obtain the declaration of @@ -82,44 +82,44 @@ from .I either of the following macro definitions must be made before including any header files: -.PP +.P .in +4n .EX #define _BSD_SOURCE #define _XOPEN_SOURCE /* or any value < 500 */ .EE .in -.PP +.P Alternatively, equivalent definitions can be included in the compilation command: -.PP +.P .in +4n .EX cc \-D_BSD_SOURCE cc \-D_XOPEN_SOURCE # Or any value < 500 .EE .in -.PP +.P Note that, as described below, .BR "some feature test macros are defined by default" , so that it may not always be necessary to explicitly specify the feature test macro(s) shown in the SYNOPSIS. -.PP +.P In a few cases, manual pages use a shorthand for expressing the feature test macro requirements (this example from .BR readahead (2)): -.PP +.P .RS +4 .EX .B #define _GNU_SOURCE .B #define _FILE_OFFSET_BITS 64 .B #include <fcntl.h> -.PP +.P .BI "ssize_t readahead(int " fd ", off_t *" offset ", size_t " count ); .EE .RE -.PP +.P This format is employed when the feature test macros ensure that the proper function declarations are visible, and the macros are not defined by default. @@ -128,7 +128,7 @@ The paragraphs below explain how feature test macros are handled in glibc 2.\fIx\fP, .I x > 0. -.PP +.P First, though, a summary of a few details for the impatient: .IP \[bu] 3 The macros that you most likely need to use in modern source code are @@ -193,7 +193,7 @@ _XOPEN_SOURCE >= 700 .\" The details in glibc 2.0 are simpler, but combining a .\" a description of them with the details in later glibc versions .\" would make for a complicated description. -.PP +.P glibc understands the following feature test macros: .TP .B __STRICT_ANSI__ @@ -683,7 +683,7 @@ and (200112L before glibc 2.10; 199506L before glibc 2.4; 199309L before glibc 2.1). -.PP +.P If any of .BR __STRICT_ANSI__ , .BR _ISOC99_SOURCE , @@ -705,7 +705,7 @@ is explicitly defined, then and .B _DEFAULT_SOURCE are not defined by default. -.PP +.P If .B _POSIX_SOURCE and @@ -722,7 +722,7 @@ is defined with the value 1; and .IP \[bu] .B _POSIX_C_SOURCE is defined with one of the following values: -.RS 3 +.RS .IP \[bu] 3 2, if @@ -760,7 +760,7 @@ depends on the glibc version: 200112L, since glibc 2.4 to glibc 2.9; and 200809L, since glibc 2.10. .RE -.PP +.P Multiple macros can be defined; the results are additive. .SH STANDARDS POSIX.1 specifies @@ -768,11 +768,11 @@ POSIX.1 specifies .BR _POSIX_SOURCE , and .BR _XOPEN_SOURCE . -.PP +.P .B _FILE_OFFSET_BITS is not specified by any standard, but is employed on some other implementations. -.PP +.P .BR _BSD_SOURCE , .BR _SVID_SOURCE , .BR _DEFAULT_SOURCE , @@ -793,7 +793,7 @@ Other systems have an analogous file, but typically with a different name. This header file is automatically included by other header files as required: it is not necessary to explicitly include it in order to employ feature test macros. -.PP +.P According to which of the above feature test macros are defined, .I <features.h> internally defines various other macros that are checked by @@ -811,7 +811,7 @@ feature test macros are set depending on the glibc version and what feature test macros are explicitly set. The following shell session, on a system with glibc 2.10, shows some examples of what we would see: -.PP +.P .in +4n .EX $ \fBcc ftm.c\fP @@ -929,9 +929,9 @@ main(int argc, char *argv[]) .BR libc (7), .BR standards (7), .BR system_data_types (7) -.PP +.P The section "Feature Test Macros" under .IR "info libc" . .\" But beware: the info libc document is out of date (Jul 07, mtk) -.PP +.P .I /usr/include/features.h |