xref: /freebsd/share/man/man9/cdefs.9 (revision 4122295afcbf4b7ad0623bbf35f36dc3278ac028)
1*4122295aSWarner Losh.\"-
2*4122295aSWarner Losh.\" Copyright (c) 2024 M. Warner Losh <imp@FreeBSD.org>
3*4122295aSWarner Losh.\"
4*4122295aSWarner Losh.\" SPDX-License-Identifier: BSD-2-Clause
5*4122295aSWarner Losh.\"
6*4122295aSWarner Losh.Dd July 8, 2024
7*4122295aSWarner Losh.Dt CDEFS 9
8*4122295aSWarner Losh.Os
9*4122295aSWarner Losh.Sh NAME
10*4122295aSWarner Losh.Nm cdefs
11*4122295aSWarner Losh.Nd compiler portability macro definitions
12*4122295aSWarner Losh.Sh DESCRIPTION
13*4122295aSWarner Losh.In sys/cdefs.h
14*4122295aSWarner Loshdefines macros for compiler, C language standard portability, POSIX standards
15*4122295aSWarner Loshcompliance and symbol visibility.
16*4122295aSWarner LoshIt defines programming interfaces for the system header files to adopt to the
17*4122295aSWarner Loshmany environments
18*4122295aSWarner Losh.Fx
19*4122295aSWarner Loshsupports compilation for.
20*4122295aSWarner LoshIt defines convenience macros for the
21*4122295aSWarner Losh.Fx
22*4122295aSWarner Loshsources, tailored to the base
23*4122295aSWarner Loshsystem's needs.
24*4122295aSWarner Losh.Pp
25*4122295aSWarner LoshMost of these macros are for use inside the
26*4122295aSWarner Losh.Fx
27*4122295aSWarner Loshsources only.
28*4122295aSWarner LoshThey are not intended as a general portability layer.
29*4122295aSWarner Losh.Sh Supported Compilers
30*4122295aSWarner Losh.Bl -tag -offset 2n -width 0
31*4122295aSWarner Losh.It Compilers supported for building programs on Fx :
32*4122295aSWarner Losh.Bl -column -offset 0n indent-two
33*4122295aSWarner Losh.It Sy Compiler Ta Sy Versions
34*4122295aSWarner Losh.It gcc Ta 9, 10, 11, 12, 13, 14
35*4122295aSWarner Losh.It clang Ta 10, 11, 12, 13, 14, 15, 16, 17, 18
36*4122295aSWarner Losh.It TinyC (tcc) Ta 0.9
37*4122295aSWarner Losh.It pcc Ta 1.1
38*4122295aSWarner Losh.El
39*4122295aSWarner Losh.Pp
40*4122295aSWarner LoshDue to testing constraints, tcc and pcc may not always work.
41*4122295aSWarner Losh.It Compilers supported for building Fx itself:
42*4122295aSWarner Losh.Bl -column -offset 0n indent-two
43*4122295aSWarner Losh.It Sy Compiler Ta Sy Versions
44*4122295aSWarner Losh.It gcc Ta 12, 13
45*4122295aSWarner Losh.It clang Ta 16, 17, 19
46*4122295aSWarner Losh.El
47*4122295aSWarner Losh.Sh Macros and Magic for Programming Environment
48*4122295aSWarner Losh.Nm
49*4122295aSWarner Loshdefines (or refrains from defining) a number of macros to increase portability
50*4122295aSWarner Loshof compiled programs.
51*4122295aSWarner LoshThese are to allow more advanced language features to appear in header files.
52*4122295aSWarner LoshThe header files assume a compiler that accepts C prototype function
53*4122295aSWarner Loshdeclarations.
54*4122295aSWarner LoshThey also assume that the compiler accepts ANSI C89 keywords for all language
55*4122295aSWarner Loshdialects.
56*4122295aSWarner Losh.Ss General Macros
57*4122295aSWarner LoshGeneral macros that facilitate multiple language environments and language
58*4122295aSWarner Loshdialects.
59*4122295aSWarner Losh.Bl -column "---------------"
60*4122295aSWarner Losh.It Sy Macro Ta Sy Description
61*4122295aSWarner Losh.It Dv __volatile Ta expands to volatile in C++ and C89 and newer environments,
62*4122295aSWarner Losh__volatile in pre-ANSI environments that support this extension or nothing
63*4122295aSWarner Loshotherwise.
64*4122295aSWarner Losh.It Dv __inline Ta expands to inline in C++ and C89 and newer environments,
65*4122295aSWarner Losh__inline in pre-ANSI environments that support this extension or nothing
66*4122295aSWarner Loshotherwise.
67*4122295aSWarner Losh.It Dv __restrict Ta expands to restrict in C99 and newer environments, or
68*4122295aSWarner Losh__restrict otherwise.
69*4122295aSWarner Losh.It Dv __CONCAT Ta used to paste two pre-processor tokens.
70*4122295aSWarner Losh.It Dv __STRING Ta used to convert the argument to a string.
71*4122295aSWarner Losh.It Dv __BEGIN_DECLS Ta Start a group of functions.
72*4122295aSWarner Losh.It Dv __END_DECLS Ta End a group of functions.
73*4122295aSWarner LoshIn a C environment, these are defined as nothing.
74*4122295aSWarner LoshIn a C++ environment, these declare the functions to have
75*4122295aSWarner Losh.Dq C
76*4122295aSWarner Loshlinkage.
77*4122295aSWarner Losh.El
78*4122295aSWarner Losh.Ss Function, Structure and Variable Modifiers
79*4122295aSWarner Losh.Bl -column "---------------"
80*4122295aSWarner Losh.It Sy Macro Ta Sy Description
81*4122295aSWarner Losh.It Sy __weak_symbol Ta Declare the symbol to be a weak symbol
82*4122295aSWarner Losh.It Sy __dead2 Ta Function will not return
83*4122295aSWarner Losh.It Sy __pure2 Ta Function has no side effects
84*4122295aSWarner Losh.It Sy __unused Ta To Variable may be unused (usually arguments), so do not warn about it
85*4122295aSWarner Losh.It Sy __used Ta Function really is used, so emit it even if it appears unused.
86*4122295aSWarner Losh.It Sy __packed Ta \&Do not have space between structure elements for natural alignment.
87*4122295aSWarner LoshUsed when communicating with external protocols.
88*4122295aSWarner Losh.It Sy __aligned(x) Ta Specify in bytes the minimum alignment for the specified field, structure or variable
89*4122295aSWarner Losh.It Sy __section(x) Ta Place function or variable in section Fa x
90*4122295aSWarner Losh.It Sy __writeonly Ta Hint that the variable is only assigned to, but do not warn about it.
91*4122295aSWarner LoshUseful for macros and other places the eventual use of the result is unknown.
92*4122295aSWarner Losh.It Sy __alloc_size(x) Ta The function always returns at least the number of
93*4122295aSWarner Loshbytes determined by argument number Fa x
94*4122295aSWarner Losh.It Sy __alloc_size2(x,n) Ta  The function always returns an array, whose size
95*4122295aSWarner Loshis at least the number of bytes determined by argument number Fa x times the
96*4122295aSWarner Loshnumber of elements specified by argument number Fa n
97*4122295aSWarner Losh.It Sy __alloc_align(x) Ta Function either returns a pointer aligned to Fa x bytes
98*4122295aSWarner Loshor Dv NULL.
99*4122295aSWarner Losh.It Sy __min_size Ta Declare the array to have a certain, minimum size
100*4122295aSWarner Losh.It Sy __malloc_like Ta Function behaves like the
101*4122295aSWarner Losh.Dq malloc
102*4122295aSWarner Loshfamily of functions.
103*4122295aSWarner Losh.It Sy __pure Ta Function has no side effects
104*4122295aSWarner Losh.It Sy __always_inline Ta Always inline this function when called
105*4122295aSWarner Losh.It Sy __fastcall Ta Use the
106*4122295aSWarner Losh.Dq fastcall
107*4122295aSWarner LoshABI to call and name mangle this function.
108*4122295aSWarner Losh.It Sy __result_use_check Ta Warn if function caller does not use it's return value
109*4122295aSWarner Losh.It Sy __result_use_or_ignore_check Ta Warn if function caller does not use it's return value.
110*4122295aSWarner LoshAllows the value to be explicitly ignored with a (void) cast.
111*4122295aSWarner Losh.It Sy __returns_twice Ta Returns multiple times, like
112*4122295aSWarner Losh.Xr fork 2
113*4122295aSWarner Losh.It Sy __unreachable Ta This code is not reachable at runtime
114*4122295aSWarner Losh.It Sy __predict_true(x) Ta Hint to the compiler that
115*4122295aSWarner Losh.Fa x
116*4122295aSWarner Loshis true most of the time.
117*4122295aSWarner LoshShould only be used when performance is improved for a frequently called bit of code.
118*4122295aSWarner Losh.It Sy __predict_false(x) Ta Hint to the compiler that
119*4122295aSWarner Losh.Fa x
120*4122295aSWarner Loshis false most of the time.
121*4122295aSWarner LoshShould only be used when performance is improved for a frequently called bit of code.
122*4122295aSWarner Losh.It Sy __null_sentinel Ta The varadic function contains a parameter that is
123*4122295aSWarner Losha NULL sentinel to mark the end of its arguments.
124*4122295aSWarner Losh.It Sy __exported Ta
125*4122295aSWarner Losh.It Sy __hidden Ta
126*4122295aSWarner Losh.It Sy __printflike(fmtarg,firstvararg) Ta Function is similar to
127*4122295aSWarner Losh.Fn printf
128*4122295aSWarner Loshwhich specifies the format argument with
129*4122295aSWarner Losh.Fa fmtarg
130*4122295aSWarner Loshand where the arguments formatted by that format start with the
131*4122295aSWarner Losh.Fa firstvararg ,
132*4122295aSWarner Loshwith 0 meaning that
133*4122295aSWarner Losh.Dv va_arg
134*4122295aSWarner Loshis used and cannot be checked.
135*4122295aSWarner Losh.It Sy __scanflike(fmtarg,firstvararg) Ta Function is similar to
136*4122295aSWarner Losh.Fn scanf
137*4122295aSWarner Loshwhich specifies the format argument with
138*4122295aSWarner Losh.Fa fmtarg
139*4122295aSWarner Loshand where the arguments formatted by that format start with the
140*4122295aSWarner Losh.Fa firstvararg ,
141*4122295aSWarner Loshwith 0 meaning that
142*4122295aSWarner Losh.Dv va_arg
143*4122295aSWarner Loshis used and cannot be checked.
144*4122295aSWarner Losh.It Sy __format_arg(f) Ta Specifies that arg
145*4122295aSWarner Losh.Fa f
146*4122295aSWarner Loshcontains a string that will be passed to a function like
147*4122295aSWarner Losh.Fn printf
148*4122295aSWarner Loshor
149*4122295aSWarner Losh.Fa scanf
150*4122295aSWarner Loshafter being translated in some way.
151*4122295aSWarner Losh.It Sy __strfmonlike(fmtarg,firstvararg) Ta Function is similar to
152*4122295aSWarner Losh.Fn scanf
153*4122295aSWarner Loshwhich specifies the format argument with
154*4122295aSWarner Losh.Fa fmtarg
155*4122295aSWarner Loshand where the arguments formatted by that format start with the
156*4122295aSWarner Losh.Fa firstvararg ,
157*4122295aSWarner Loshwith 0 meaning that
158*4122295aSWarner Losh.Dv va_arg
159*4122295aSWarner Loshis used and cannot be checked.
160*4122295aSWarner Losh.It Sy __strtimelike(fmtarg,firstvararg) Ta Function is similar to
161*4122295aSWarner Losh.Fn scanf
162*4122295aSWarner Loshwhich specifies the format argument with
163*4122295aSWarner Losh.Fa fmtarg
164*4122295aSWarner Loshand where the arguments formatted by that format start with the
165*4122295aSWarner Losh.Fa firstvararg ,
166*4122295aSWarner Loshwith 0 meaning that
167*4122295aSWarner Losh.Dv va_arg
168*4122295aSWarner Loshis used and cannot be checked.
169*4122295aSWarner Losh.It Sy __printf0like(fmtarg,firstvararg) Ta Exactly the same
170*4122295aSWarner Loshas
171*4122295aSWarner Losh.Sy __printflike
172*4122295aSWarner Loshexcept
173*4122295aSWarner Losh.Fa fmtarg
174*4122295aSWarner Loshmay be
175*4122295aSWarner Losh.Dv NULL.
176*4122295aSWarner Losh.It Sy __strong_reference(sym,aliassym) Ta
177*4122295aSWarner Losh.It Sy __weak_reference(sym,alias) Ta
178*4122295aSWarner Losh.It Sy __warn_references(sym,msg) Ta
179*4122295aSWarner Losh.It Sy __sym_compat(sym,impl,verid) Ta
180*4122295aSWarner Losh.It Sy __sym_default(sym,impl,verid) Ta
181*4122295aSWarner Losh.It Sy __GLOBAL(sym) Ta
182*4122295aSWarner Losh.It Sy __WEAK(sym) Ta
183*4122295aSWarner Losh.It Sy __DECONST(type,var) Ta
184*4122295aSWarner Losh.It Sy __DEVOLATILE(type,var) Ta
185*4122295aSWarner Losh.It Sy __DEQUALIFY(type,var) Ta
186*4122295aSWarner Losh.It Sy __RENAME(x) Ta
187*4122295aSWarner Losh.It Sy __arg_type_tag Ta
188*4122295aSWarner Losh.It Sy __datatype_type_tag Ta
189*4122295aSWarner Losh.It Sy __align_up(x,y) Ta
190*4122295aSWarner Losh.It Sy __align_down(x,y) Ta
191*4122295aSWarner Losh.It Sy __is_aligned(x,y) Ta
192*4122295aSWarner Losh.El
193*4122295aSWarner Losh.Ss Locking and Debugging Macros
194*4122295aSWarner LoshMacros for lock annotation and debugging, as well as some general debugging
195*4122295aSWarner Loshmacros for address sanitizers.
196*4122295aSWarner Losh.Bl -column "---------------"
197*4122295aSWarner Losh.It Sy __lock_annotate(x) Ta
198*4122295aSWarner Losh.It Sy __lockable Ta
199*4122295aSWarner Losh.It Sy __locks_exclusive Ta
200*4122295aSWarner Losh.It Sy __locks_shared Ta
201*4122295aSWarner Losh.It Sy __trylocks_exclusive Ta
202*4122295aSWarner Losh.It Sy __trylocks_shared Ta
203*4122295aSWarner Losh.It Sy __unlocks Ta
204*4122295aSWarner Losh.It Sy __asserts_exclusive Ta
205*4122295aSWarner Losh.It Sy __asserts_shared Ta
206*4122295aSWarner Losh.It Sy __requires_exclusive Ta
207*4122295aSWarner Losh.It Sy __requires_shared Ta
208*4122295aSWarner Losh.It Sy __requires_unlocked Ta
209*4122295aSWarner Losh.It Sy __no_lock_analysis Ta
210*4122295aSWarner Losh.It Sy __nosanitizeaddress Ta
211*4122295aSWarner Losh.It Sy __nosanitizememory Ta
212*4122295aSWarner Losh.It Sy __nosanitizethread Ta
213*4122295aSWarner Losh.It Sy __nostackprotector Ta
214*4122295aSWarner Losh.It Sy __guarded_by(x) Ta
215*4122295aSWarner Losh.It Sy __pt_guarded_by(x) Ta
216*4122295aSWarner Losh.El
217*4122295aSWarner Losh.Ss Emulated Keywords
218*4122295aSWarner LoshAs C evolves, many of the old macros we once used have been incorporated into
219*4122295aSWarner Loshthe standard language.
220*4122295aSWarner LoshAs this happens, we add support for these keywords as macros for older
221*4122295aSWarner Loshcompilation environments.
222*4122295aSWarner LoshSometimes this results in a nop in the older environment.
223*4122295aSWarner Losh.Bl -column "---------------"
224*4122295aSWarner Losh.It Sy Keyword Ta Sy Description
225*4122295aSWarner Losh.It Sy _Alignas(x) Ta
226*4122295aSWarner Losh.It Sy _Alignof(x) Ta
227*4122295aSWarner Losh.It Sy _Noreturn Ta Expands to
228*4122295aSWarner Losh.Dq [[noreturn]]
229*4122295aSWarner Loshin C++-11 and newer compilation environments, otherwise
230*4122295aSWarner Losh.Dq __dead2
231*4122295aSWarner Losh.It Sy _Static_assert(x, y) Ta Compile time assertion that
232*4122295aSWarner Losh.Fa x
233*4122295aSWarner Loshis true, otherwise emit
234*4122295aSWarner Losh.Fa y
235*4122295aSWarner Loshas the error message.
236*4122295aSWarner Losh.It Sy _Thread_local Ta Designate variable as thread local storage
237*4122295aSWarner Losh.It Sy __generic Ta implement _Generic-like features which aren't entirely possible to emulate the _Generic keyword
238*4122295aSWarner Losh.It Sy __noexcept Ta to emulate the C++11 argument-less noexcept form
239*4122295aSWarner Losh.It Sy __noexcept_if Ta to emulate the C++11 conditional noexcept form
240*4122295aSWarner Losh.It Sy _Nonnull Ta
241*4122295aSWarner Losh.It Sy _Nullable Ta
242*4122295aSWarner Losh.It Sy _Null_unspecified Ta
243*4122295aSWarner Losh.El
244*4122295aSWarner Losh.Ss Support Macros
245*4122295aSWarner LoshThe following macros are defined, or have specific values, to denote certain
246*4122295aSWarner Loshthings about the build environment.
247*4122295aSWarner Losh.Bl -column "---------------"
248*4122295aSWarner Losh.It Sy Macro Ta Sy Description
249*4122295aSWarner Losh.It Sy __LONG_LONG_SUPPORTED Ta Variables may be declared
250*4122295aSWarner Losh.Dq long long .
251*4122295aSWarner LoshThis is defined for C99 or newer and C++ environments.
252*4122295aSWarner Losh.It Sy __STDC_LIMIT_MACROS Ta
253*4122295aSWarner Losh.It Sy __STDC_CONSTANT_MACROS Ta
254*4122295aSWarner Losh.El
255*4122295aSWarner Losh.Ss Convenience Macros
256*4122295aSWarner LoshThese macros make it easier to do a number of things, even though strictly
257*4122295aSWarner Loshspeaking the standard places their normal form in another header.
258*4122295aSWarner Losh.Bl -column "---------------"
259*4122295aSWarner Losh.It Sy Macro Ta Sy Description
260*4122295aSWarner Losh.It Sy __offsetof(type,field) Ta
261*4122295aSWarner Losh.It Sy __rangeof(type,start,end) Ta
262*4122295aSWarner Losh.It Sy __containerof(x,s,m) Ta
263*4122295aSWarner Losh.El
264*4122295aSWarner Losh.Ss ID Strings
265*4122295aSWarner LoshThis section is deprecated, but is kept around because too much contrib software
266*4122295aSWarner Loshstill uses these.
267*4122295aSWarner Losh.Bl -column "---------------"
268*4122295aSWarner Losh.It Sy Macro Ta Sy Description
269*4122295aSWarner Losh.It Sy __IDSTRING(name,string) Ta
270*4122295aSWarner Losh.It Sy __FBSDID(s) Ta
271*4122295aSWarner Losh.It Sy __RCSID(s) Ta
272*4122295aSWarner Losh.It Sy __RCSID_SOURCE(s) Ta
273*4122295aSWarner Losh.It Sy __SCCSID(s) Ta
274*4122295aSWarner Losh.It Sy __COPYRIGHT(s) Ta
275*4122295aSWarner Losh.El
276*4122295aSWarner Losh.Sh Supported C Environments
277*4122295aSWarner Losh.Fx
278*4122295aSWarner Loshsupports a number C standard environments.
279*4122295aSWarner LoshSelection of the language dialect is a compiler-dependent command line option,
280*4122295aSWarner Loshthough it is usually
281*4122295aSWarner Losh.Fl cstd=XX
282*4122295aSWarner Loshwhere XX is the standard to set for compiling, such as c89 or c23.
283*4122295aSWarner Losh.Fx
284*4122295aSWarner Loshprovides a number of selection macros to control visibility of symbols.
285*4122295aSWarner LoshPlease see the section on Selection Macros for the specifics.
286*4122295aSWarner Losh.Pp
287*4122295aSWarner Losh.Bl -tag
288*4122295aSWarner Losh.It K \*(Am R
289*4122295aSWarner LoshPre-ANSI Kernighan and Ritchie C.
290*4122295aSWarner LoshSometimes called
291*4122295aSWarner Losh.Dq knr
292*4122295aSWarner Loshor
293*4122295aSWarner Losh.Dq C78
294*4122295aSWarner Loshto distinguish it from newer standards.
295*4122295aSWarner LoshSupport for this compilation environment is dependent on compilers supporting
296*4122295aSWarner Loshthis configuration.
297*4122295aSWarner LoshMost of the old forms of C have been deprecated or removed in
298*4122295aSWarner LoshISO/IEC 9899:2024 (“ISO C23”).
299*4122295aSWarner LoshCompilers make compiling in this mode increasingly difficult and support for it
300*4122295aSWarner Loshmay ultimately be removed from the tree.
301*4122295aSWarner Losh.It St -ansiC
302*4122295aSWarner Losh.Dv __STDC__
303*4122295aSWarner Loshis defined, however
304*4122295aSWarner Losh.Dv __STDC_VERSION__
305*4122295aSWarner Loshis not.
306*4122295aSWarner Losh.Pp
307*4122295aSWarner LoshStrict environment selected with
308*4122295aSWarner Losh.Dv _ANSI_SOURCE .
309*4122295aSWarner Losh.It St -isoC-99
310*4122295aSWarner Losh.Dv __STDC_VERSION__ = 199901L
311*4122295aSWarner Losh.Pp
312*4122295aSWarner LoshStrict environment selected with
313*4122295aSWarner Losh.Dv _C99_SOURCE .
314*4122295aSWarner Losh.It St -isoC-2011
315*4122295aSWarner Losh.Dv __STDC_VERSION__ = 201112L
316*4122295aSWarner Losh.Pp
317*4122295aSWarner LoshStrict environment selected with
318*4122295aSWarner Losh.Dv _C11_SOURCE .
319*4122295aSWarner Losh.It ISO/IEC 9899:2018 (“ISO C17”)
320*4122295aSWarner Losh.Dv __STDC_VERSION__ = 201710L
321*4122295aSWarner Losh.Pp
322*4122295aSWarner LoshStrict environment selected with
323*4122295aSWarner Losh.Dv _C11_SOURCE
324*4122295aSWarner Loshsince there are no new C17 only symbols or macros.
325*4122295aSWarner Losh.Pp
326*4122295aSWarner LoshThis version of the standard did not introduce any new features, only made
327*4122295aSWarner Loshminor, technical corrections.
328*4122295aSWarner Losh.It ISO/IEC 9899:2024 (“ISO C23”)
329*4122295aSWarner Losh.Dv __STDC_VERSION__ = 202311L
330*4122295aSWarner LoshStrict environment selected with
331*4122295aSWarner Losh.Dv _C23_SOURCE
332*4122295aSWarner Loshthough this is not yet implemented.
333*4122295aSWarner Losh.El
334*4122295aSWarner Losh.Pp
335*4122295aSWarner LoshFor more information on C standards, see
336*4122295aSWarner Losh.Xr c 7 .
337*4122295aSWarner Losh.Ss Programming Environment Selection Macros
338*4122295aSWarner LoshDefining the macros outlined below requests that the system header files provide
339*4122295aSWarner Loshonly the functions, structures and macros (symbols) defined by the appropriate
340*4122295aSWarner Loshstandard, while suppressing all extensions.
341*4122295aSWarner LoshHowever, system headers not defined by that standard may define extensions.
342*4122295aSWarner Losh.Bl -column "---------------"
343*4122295aSWarner Losh.It Sy Macro Ta Sy Environment
344*4122295aSWarner Losh.It Dv _POSIX_SOURCE Ta St -p1003.1-88 including St -ansiC
345*4122295aSWarner Losh.It Dv _POSIX_C_SOURCE = 1 Ta St -p1003.1-88 including St -ansiC
346*4122295aSWarner Losh.It Dv _POSIX_C_SOURCE = 2 Ta St -p1003.1-90 including St -ansiC
347*4122295aSWarner Losh.It Dv _POSIX_C_SOURCE = 199309 Ta St -p1003.1b-93 including St -ansiC
348*4122295aSWarner Losh.It Dv _POSIX_C_SOURCE = 199506 Ta St -p1003.1c-95 including St -ansiC
349*4122295aSWarner Losh.It Dv _POSIX_C_SOURCE = 200112 Ta St -p1003.1-2001 including St -isoC-99
350*4122295aSWarner Losh.It Dv _POSIX_C_SOURCE = 200809 Ta St -p1003.1-2008 including St -isoC-99
351*4122295aSWarner Losh.It Dv _POSIX_C_SOURCE = 202405 Ta in the future IEEE Std 1003.1-2024 (“POSIX.1”) including ISO/IEC 9899:2024 (“ISO C23”)
352*4122295aSWarner Losh.It Dv _XOPEN_SOURCE = 500 Ta St -p1003.1c-95 and XPG extensions to St -susv2 including St -ansiC
353*4122295aSWarner Losh.It Dv _XOPEN_SOURCE = 600 Ta St -p1003.1-2001 and XPG extensions to St -susv3 including St -isoC-99
354*4122295aSWarner Losh.It Dv _XOPEN_SOURCE = 700 Ta St -p1003.1-2008 and XPG extensions to St -susv4 including St -isoC-99
355*4122295aSWarner Losh.It Dv _XOPEN_SOURCE = 800 Ta in the future IEEE Std 1003.1-2024 (“POSIX.1”) and XPG extensions to Version 5 of the Single UNIX Specification (“SUSv5”) including ISO/IEC 9899:2024 (“ISO C23”)
356*4122295aSWarner Losh.It Dv _ANSI_SOURCE Ta St -ansiC
357*4122295aSWarner Losh.It Dv _C99_SOURCE Ta St -isoC-99
358*4122295aSWarner Losh.It Dv _C11_SOURCE Ta St -isoC-2011
359*4122295aSWarner Losh.It Dv _C23_SOURCE Ta in the future ISO/IEC 9899:2024 (“ISO C23”)
360*4122295aSWarner Losh.It Dv _BSD_SOURCE Ta Everything, including Fx extensions
361*4122295aSWarner Losh.El
362*4122295aSWarner Losh.Pp
363*4122295aSWarner LoshWhen both POSIX and C environments are selected, the POSIX environment selects
364*4122295aSWarner Loshwhich C environment is used.
365*4122295aSWarner LoshHowever, when C11 dialect is selected with
366*4122295aSWarner Losh.St -p1003.1-2008 ,
367*4122295aSWarner Loshdefinitions for
368*4122295aSWarner Losh.St -isoC-11
369*4122295aSWarner Loshare included.
370*4122295aSWarner Losh.Ss Header Visibility Macros
371*4122295aSWarner LoshThese macros are set by
372*4122295aSWarner Losh.Nm
373*4122295aSWarner Loshto control the visibility of different standards.
374*4122295aSWarner LoshUsers should not use these, but they are documented here for developers.
375*4122295aSWarner Losh.Bl -column "---------------"
376*4122295aSWarner Losh.It Dv __XSI_VISIBLE Ta Restricts the visibility of XOPEN Single Unix Standard version.
377*4122295aSWarner LoshPossible values are 500, 600, 700 or 800, corresponding to Issue 5, 6, 7, or 8
378*4122295aSWarner Loshof the Single Unix Standard.
379*4122295aSWarner LoshThese are extra functions in addition to the normal POSIX ones.
380*4122295aSWarner Losh.It Dv __POSIX_VISIBLE Ta Make symbols associated with certain standards versions visible.
381*4122295aSWarner LoshSet to the value assigned to
382*4122295aSWarner Losh.Dv _POSIX_C_SOURCE
383*4122295aSWarner Loshby convention with 199009 for
384*4122295aSWarner Losh.St -p1003.1-88
385*4122295aSWarner Loshand 199209
386*4122295aSWarner Losh.St -p1003.1-90 .
387*4122295aSWarner Losh.It Dv __ISO_C_VISIBLE Ta The C level that's visible.
388*4122295aSWarner LoshPossible values include 1990, 1999, and 2011 for
389*4122295aSWarner Losh.St -isoC-90 ,
390*4122295aSWarner Losh.St -isoC-99
391*4122295aSWarner Loshand
392*4122295aSWarner Losh.St -isoC-2011
393*4122295aSWarner Loshrespectively.
394*4122295aSWarner LoshIn the future, 2023 will be used for ISO C2023.
395*4122295aSWarner Losh.It Dv __BSD_VISIBLE Ta 1 if the
396*4122295aSWarner Losh.Fx
397*4122295aSWarner Loshextensions are visible, 0 otherwise.
398*4122295aSWarner Losh.It Dv __EXT1_VISIBLE Ta 1 if the
399*4122295aSWarner Losh.St -isoC-2011
400*4122295aSWarner LoshAppendix K 3.7.4.1
401*4122295aSWarner Loshextensions are visible, 0 otherwise.
402*4122295aSWarner Losh.Sh HISTORY
403*4122295aSWarner Losh.In sys/cdefs.h
404*4122295aSWarner Loshfirst appeared in
405*4122295aSWarner Losh.Bx 4.3 NET/2 .
406