summaryrefslogtreecommitdiffstats
path: root/gl
diff options
context:
space:
mode:
Diffstat (limited to 'gl')
-rw-r--r--gl/arg-nonnull.h26
-rw-r--r--gl/arpa/inet.h657
-rw-r--r--gl/c++defs.h331
-rw-r--r--gl/sys/socket.h1241
-rw-r--r--gl/sys/stat.h1461
-rw-r--r--gl/sys/types.h107
-rw-r--r--gl/sys/uio.h64
-rw-r--r--gl/warn-on-use.h149
8 files changed, 4036 insertions, 0 deletions
diff --git a/gl/arg-nonnull.h b/gl/arg-nonnull.h
new file mode 100644
index 0000000..e4513ef
--- /dev/null
+++ b/gl/arg-nonnull.h
@@ -0,0 +1,26 @@
1/* A C macro for declaring that specific arguments must not be NULL.
2 Copyright (C) 2009-2022 Free Software Foundation, Inc.
3
4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU Lesser General Public License as published
6 by the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
18 that the values passed as arguments n, ..., m must be non-NULL pointers.
19 n = 1 stands for the first argument, n = 2 for the second argument etc. */
20#ifndef _GL_ARG_NONNULL
21# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
22# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
23# else
24# define _GL_ARG_NONNULL(params)
25# endif
26#endif
diff --git a/gl/arpa/inet.h b/gl/arpa/inet.h
new file mode 100644
index 0000000..ec1c725
--- /dev/null
+++ b/gl/arpa/inet.h
@@ -0,0 +1,657 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* A GNU-like <arpa/inet.h>.
3
4 Copyright (C) 2005-2006, 2008-2022 Free Software Foundation, Inc.
5
6 This file is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
10
11 This file is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18
19#ifndef _GL_ARPA_INET_H
20
21#if __GNUC__ >= 3
22#pragma GCC system_header
23#endif
24
25
26#if 1
27# include <features.h> /* for __GLIBC__ */
28#endif
29
30/* Gnulib's sys/socket.h is responsible for defining socklen_t (used below) and
31 for pulling in winsock2.h etc. under MinGW.
32 But avoid namespace pollution on glibc systems. */
33#ifndef __GLIBC__
34# include <sys/socket.h>
35#endif
36
37/* On NonStop Kernel, inet_ntop and inet_pton are declared in <netdb.h>.
38 But avoid namespace pollution on glibc systems. */
39#if defined __TANDEM && !defined __GLIBC__
40# include <netdb.h>
41#endif
42
43#if 1
44
45/* The include_next requires a split double-inclusion guard. */
46# include_next <arpa/inet.h>
47
48#endif
49
50#ifndef _GL_ARPA_INET_H
51#define _GL_ARPA_INET_H
52
53/* Get all possible declarations of inet_ntop() and inet_pton(). */
54#if (1 || 0 || defined GNULIB_POSIXCHECK) \
55 && 0
56# include <ws2tcpip.h>
57#endif
58
59/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
60/* C++ compatible function declaration macros.
61 Copyright (C) 2010-2022 Free Software Foundation, Inc.
62
63 This program is free software: you can redistribute it and/or modify it
64 under the terms of the GNU Lesser General Public License as published
65 by the Free Software Foundation; either version 2 of the License, or
66 (at your option) any later version.
67
68 This program is distributed in the hope that it will be useful,
69 but WITHOUT ANY WARRANTY; without even the implied warranty of
70 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
71 Lesser General Public License for more details.
72
73 You should have received a copy of the GNU Lesser General Public License
74 along with this program. If not, see <https://www.gnu.org/licenses/>. */
75
76#ifndef _GL_CXXDEFS_H
77#define _GL_CXXDEFS_H
78
79/* Begin/end the GNULIB_NAMESPACE namespace. */
80#if defined __cplusplus && defined GNULIB_NAMESPACE
81# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
82# define _GL_END_NAMESPACE }
83#else
84# define _GL_BEGIN_NAMESPACE
85# define _GL_END_NAMESPACE
86#endif
87
88/* The three most frequent use cases of these macros are:
89
90 * For providing a substitute for a function that is missing on some
91 platforms, but is declared and works fine on the platforms on which
92 it exists:
93
94 #if @GNULIB_FOO@
95 # if !@HAVE_FOO@
96 _GL_FUNCDECL_SYS (foo, ...);
97 # endif
98 _GL_CXXALIAS_SYS (foo, ...);
99 _GL_CXXALIASWARN (foo);
100 #elif defined GNULIB_POSIXCHECK
101 ...
102 #endif
103
104 * For providing a replacement for a function that exists on all platforms,
105 but is broken/insufficient and needs to be replaced on some platforms:
106
107 #if @GNULIB_FOO@
108 # if @REPLACE_FOO@
109 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
110 # undef foo
111 # define foo rpl_foo
112 # endif
113 _GL_FUNCDECL_RPL (foo, ...);
114 _GL_CXXALIAS_RPL (foo, ...);
115 # else
116 _GL_CXXALIAS_SYS (foo, ...);
117 # endif
118 _GL_CXXALIASWARN (foo);
119 #elif defined GNULIB_POSIXCHECK
120 ...
121 #endif
122
123 * For providing a replacement for a function that exists on some platforms
124 but is broken/insufficient and needs to be replaced on some of them and
125 is additionally either missing or undeclared on some other platforms:
126
127 #if @GNULIB_FOO@
128 # if @REPLACE_FOO@
129 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
130 # undef foo
131 # define foo rpl_foo
132 # endif
133 _GL_FUNCDECL_RPL (foo, ...);
134 _GL_CXXALIAS_RPL (foo, ...);
135 # else
136 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
137 _GL_FUNCDECL_SYS (foo, ...);
138 # endif
139 _GL_CXXALIAS_SYS (foo, ...);
140 # endif
141 _GL_CXXALIASWARN (foo);
142 #elif defined GNULIB_POSIXCHECK
143 ...
144 #endif
145*/
146
147/* _GL_EXTERN_C declaration;
148 performs the declaration with C linkage. */
149#if defined __cplusplus
150# define _GL_EXTERN_C extern "C"
151#else
152# define _GL_EXTERN_C extern
153#endif
154
155/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
156 declares a replacement function, named rpl_func, with the given prototype,
157 consisting of return type, parameters, and attributes.
158 Example:
159 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
160 _GL_ARG_NONNULL ((1)));
161 */
162#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
163 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
164#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
165 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
166
167/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
168 declares the system function, named func, with the given prototype,
169 consisting of return type, parameters, and attributes.
170 Example:
171 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
172 _GL_ARG_NONNULL ((1)));
173 */
174#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
175 _GL_EXTERN_C rettype func parameters_and_attributes
176
177/* _GL_CXXALIAS_RPL (func, rettype, parameters);
178 declares a C++ alias called GNULIB_NAMESPACE::func
179 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
180 Example:
181 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
182
183 Wrapping rpl_func in an object with an inline conversion operator
184 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
185 actually used in the program. */
186#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
187 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
188#if defined __cplusplus && defined GNULIB_NAMESPACE
189# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
190 namespace GNULIB_NAMESPACE \
191 { \
192 static const struct _gl_ ## func ## _wrapper \
193 { \
194 typedef rettype (*type) parameters; \
195 \
196 inline operator type () const \
197 { \
198 return ::rpl_func; \
199 } \
200 } func = {}; \
201 } \
202 _GL_EXTERN_C int _gl_cxxalias_dummy
203#else
204# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
205 _GL_EXTERN_C int _gl_cxxalias_dummy
206#endif
207
208/* _GL_CXXALIAS_MDA (func, rettype, parameters);
209 is to be used when func is a Microsoft deprecated alias, on native Windows.
210 It declares a C++ alias called GNULIB_NAMESPACE::func
211 that redirects to _func, if GNULIB_NAMESPACE is defined.
212 Example:
213 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
214 */
215#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
216 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
217
218/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
219 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
220 except that the C function rpl_func may have a slightly different
221 declaration. A cast is used to silence the "invalid conversion" error
222 that would otherwise occur. */
223#if defined __cplusplus && defined GNULIB_NAMESPACE
224# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
225 namespace GNULIB_NAMESPACE \
226 { \
227 static const struct _gl_ ## func ## _wrapper \
228 { \
229 typedef rettype (*type) parameters; \
230 \
231 inline operator type () const \
232 { \
233 return reinterpret_cast<type>(::rpl_func); \
234 } \
235 } func = {}; \
236 } \
237 _GL_EXTERN_C int _gl_cxxalias_dummy
238#else
239# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
240 _GL_EXTERN_C int _gl_cxxalias_dummy
241#endif
242
243/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
244 is like _GL_CXXALIAS_MDA (func, rettype, parameters);
245 except that the C function func may have a slightly different declaration.
246 A cast is used to silence the "invalid conversion" error that would
247 otherwise occur. */
248#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
249 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
250
251/* _GL_CXXALIAS_SYS (func, rettype, parameters);
252 declares a C++ alias called GNULIB_NAMESPACE::func
253 that redirects to the system provided function func, if GNULIB_NAMESPACE
254 is defined.
255 Example:
256 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
257
258 Wrapping func in an object with an inline conversion operator
259 avoids a reference to func unless GNULIB_NAMESPACE::func is
260 actually used in the program. */
261#if defined __cplusplus && defined GNULIB_NAMESPACE
262# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
263 namespace GNULIB_NAMESPACE \
264 { \
265 static const struct _gl_ ## func ## _wrapper \
266 { \
267 typedef rettype (*type) parameters; \
268 \
269 inline operator type () const \
270 { \
271 return ::func; \
272 } \
273 } func = {}; \
274 } \
275 _GL_EXTERN_C int _gl_cxxalias_dummy
276#else
277# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
278 _GL_EXTERN_C int _gl_cxxalias_dummy
279#endif
280
281/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
282 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
283 except that the C function func may have a slightly different declaration.
284 A cast is used to silence the "invalid conversion" error that would
285 otherwise occur. */
286#if defined __cplusplus && defined GNULIB_NAMESPACE
287# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
288 namespace GNULIB_NAMESPACE \
289 { \
290 static const struct _gl_ ## func ## _wrapper \
291 { \
292 typedef rettype (*type) parameters; \
293 \
294 inline operator type () const \
295 { \
296 return reinterpret_cast<type>(::func); \
297 } \
298 } func = {}; \
299 } \
300 _GL_EXTERN_C int _gl_cxxalias_dummy
301#else
302# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
303 _GL_EXTERN_C int _gl_cxxalias_dummy
304#endif
305
306/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
307 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
308 except that the C function is picked among a set of overloaded functions,
309 namely the one with rettype2 and parameters2. Two consecutive casts
310 are used to silence the "cannot find a match" and "invalid conversion"
311 errors that would otherwise occur. */
312#if defined __cplusplus && defined GNULIB_NAMESPACE
313 /* The outer cast must be a reinterpret_cast.
314 The inner cast: When the function is defined as a set of overloaded
315 functions, it works as a static_cast<>, choosing the designated variant.
316 When the function is defined as a single variant, it works as a
317 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
318# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
319 namespace GNULIB_NAMESPACE \
320 { \
321 static const struct _gl_ ## func ## _wrapper \
322 { \
323 typedef rettype (*type) parameters; \
324 \
325 inline operator type () const \
326 { \
327 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
328 } \
329 } func = {}; \
330 } \
331 _GL_EXTERN_C int _gl_cxxalias_dummy
332#else
333# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
334 _GL_EXTERN_C int _gl_cxxalias_dummy
335#endif
336
337/* _GL_CXXALIASWARN (func);
338 causes a warning to be emitted when ::func is used but not when
339 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
340 variants. */
341#if defined __cplusplus && defined GNULIB_NAMESPACE
342# define _GL_CXXALIASWARN(func) \
343 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
344# define _GL_CXXALIASWARN_1(func,namespace) \
345 _GL_CXXALIASWARN_2 (func, namespace)
346/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
347 we enable the warning only when not optimizing. */
348# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
349# define _GL_CXXALIASWARN_2(func,namespace) \
350 _GL_WARN_ON_USE (func, \
351 "The symbol ::" #func " refers to the system function. " \
352 "Use " #namespace "::" #func " instead.")
353# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
354# define _GL_CXXALIASWARN_2(func,namespace) \
355 extern __typeof__ (func) func
356# else
357# define _GL_CXXALIASWARN_2(func,namespace) \
358 _GL_EXTERN_C int _gl_cxxalias_dummy
359# endif
360#else
361# define _GL_CXXALIASWARN(func) \
362 _GL_EXTERN_C int _gl_cxxalias_dummy
363#endif
364
365/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
366 causes a warning to be emitted when the given overloaded variant of ::func
367 is used but not when GNULIB_NAMESPACE::func is used. */
368#if defined __cplusplus && defined GNULIB_NAMESPACE
369# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
370 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
371 GNULIB_NAMESPACE)
372# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
373 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
374/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
375 we enable the warning only when not optimizing. */
376# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
377# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
378 _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
379 "The symbol ::" #func " refers to the system function. " \
380 "Use " #namespace "::" #func " instead.")
381# else
382# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
383 _GL_EXTERN_C int _gl_cxxalias_dummy
384# endif
385#else
386# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
387 _GL_EXTERN_C int _gl_cxxalias_dummy
388#endif
389
390#endif /* _GL_CXXDEFS_H */
391
392/* The definition of _GL_ARG_NONNULL is copied here. */
393/* A C macro for declaring that specific arguments must not be NULL.
394 Copyright (C) 2009-2022 Free Software Foundation, Inc.
395
396 This program is free software: you can redistribute it and/or modify it
397 under the terms of the GNU Lesser General Public License as published
398 by the Free Software Foundation; either version 2 of the License, or
399 (at your option) any later version.
400
401 This program is distributed in the hope that it will be useful,
402 but WITHOUT ANY WARRANTY; without even the implied warranty of
403 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
404 Lesser General Public License for more details.
405
406 You should have received a copy of the GNU Lesser General Public License
407 along with this program. If not, see <https://www.gnu.org/licenses/>. */
408
409/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
410 that the values passed as arguments n, ..., m must be non-NULL pointers.
411 n = 1 stands for the first argument, n = 2 for the second argument etc. */
412#ifndef _GL_ARG_NONNULL
413# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
414# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
415# else
416# define _GL_ARG_NONNULL(params)
417# endif
418#endif
419
420/* The definition of _GL_WARN_ON_USE is copied here. */
421/* A C macro for emitting warnings if a function is used.
422 Copyright (C) 2010-2022 Free Software Foundation, Inc.
423
424 This program is free software: you can redistribute it and/or modify it
425 under the terms of the GNU Lesser General Public License as published
426 by the Free Software Foundation; either version 2 of the License, or
427 (at your option) any later version.
428
429 This program is distributed in the hope that it will be useful,
430 but WITHOUT ANY WARRANTY; without even the implied warranty of
431 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
432 Lesser General Public License for more details.
433
434 You should have received a copy of the GNU Lesser General Public License
435 along with this program. If not, see <https://www.gnu.org/licenses/>. */
436
437/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
438 for FUNCTION which will then trigger a compiler warning containing
439 the text of "literal string" anywhere that function is called, if
440 supported by the compiler. If the compiler does not support this
441 feature, the macro expands to an unused extern declaration.
442
443 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
444 attribute used in _GL_WARN_ON_USE. If the compiler does not support
445 this feature, it expands to empty.
446
447 These macros are useful for marking a function as a potential
448 portability trap, with the intent that "literal string" include
449 instructions on the replacement function that should be used
450 instead.
451 _GL_WARN_ON_USE is for functions with 'extern' linkage.
452 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
453 linkage.
454
455 However, one of the reasons that a function is a portability trap is
456 if it has the wrong signature. Declaring FUNCTION with a different
457 signature in C is a compilation error, so this macro must use the
458 same type as any existing declaration so that programs that avoid
459 the problematic FUNCTION do not fail to compile merely because they
460 included a header that poisoned the function. But this implies that
461 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
462 have a declaration. Use of this macro implies that there must not
463 be any other macro hiding the declaration of FUNCTION; but
464 undefining FUNCTION first is part of the poisoning process anyway
465 (although for symbols that are provided only via a macro, the result
466 is a compilation error rather than a warning containing
467 "literal string"). Also note that in C++, it is only safe to use if
468 FUNCTION has no overloads.
469
470 For an example, it is possible to poison 'getline' by:
471 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
472 [getline]) in configure.ac, which potentially defines
473 HAVE_RAW_DECL_GETLINE
474 - adding this code to a header that wraps the system <stdio.h>:
475 #undef getline
476 #if HAVE_RAW_DECL_GETLINE
477 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
478 "not universally present; use the gnulib module getline");
479 #endif
480
481 It is not possible to directly poison global variables. But it is
482 possible to write a wrapper accessor function, and poison that
483 (less common usage, like &environ, will cause a compilation error
484 rather than issue the nice warning, but the end result of informing
485 the developer about their portability problem is still achieved):
486 #if HAVE_RAW_DECL_ENVIRON
487 static char ***
488 rpl_environ (void) { return &environ; }
489 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
490 # undef environ
491 # define environ (*rpl_environ ())
492 #endif
493 or better (avoiding contradictory use of 'static' and 'extern'):
494 #if HAVE_RAW_DECL_ENVIRON
495 static char ***
496 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
497 rpl_environ (void) { return &environ; }
498 # undef environ
499 # define environ (*rpl_environ ())
500 #endif
501 */
502#ifndef _GL_WARN_ON_USE
503
504# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
505/* A compiler attribute is available in gcc versions 4.3.0 and later. */
506# define _GL_WARN_ON_USE(function, message) \
507_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
508# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
509 __attribute__ ((__warning__ (message)))
510# elif __clang_major__ >= 4
511/* Another compiler attribute is available in clang. */
512# define _GL_WARN_ON_USE(function, message) \
513_GL_WARN_EXTERN_C __typeof__ (function) function \
514 __attribute__ ((__diagnose_if__ (1, message, "warning")))
515# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
516 __attribute__ ((__diagnose_if__ (1, message, "warning")))
517# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
518/* Verify the existence of the function. */
519# define _GL_WARN_ON_USE(function, message) \
520_GL_WARN_EXTERN_C __typeof__ (function) function
521# define _GL_WARN_ON_USE_ATTRIBUTE(message)
522# else /* Unsupported. */
523# define _GL_WARN_ON_USE(function, message) \
524_GL_WARN_EXTERN_C int _gl_warn_on_use
525# define _GL_WARN_ON_USE_ATTRIBUTE(message)
526# endif
527#endif
528
529/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
530 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
531 function is declared with the given prototype, consisting of return type,
532 parameters, and attributes.
533 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
534 not work in this case. */
535#ifndef _GL_WARN_ON_USE_CXX
536# if !defined __cplusplus
537# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
538 _GL_WARN_ON_USE (function, msg)
539# else
540# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
541/* A compiler attribute is available in gcc versions 4.3.0 and later. */
542# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
543extern rettype_gcc function parameters_and_attributes \
544 __attribute__ ((__warning__ (msg)))
545# elif __clang_major__ >= 4
546/* Another compiler attribute is available in clang. */
547# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
548extern rettype_clang function parameters_and_attributes \
549 __attribute__ ((__diagnose_if__ (1, msg, "warning")))
550# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
551/* Verify the existence of the function. */
552# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
553extern rettype_gcc function parameters_and_attributes
554# else /* Unsupported. */
555# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
556_GL_WARN_EXTERN_C int _gl_warn_on_use
557# endif
558# endif
559#endif
560
561/* _GL_WARN_EXTERN_C declaration;
562 performs the declaration with C linkage. */
563#ifndef _GL_WARN_EXTERN_C
564# if defined __cplusplus
565# define _GL_WARN_EXTERN_C extern "C"
566# else
567# define _GL_WARN_EXTERN_C extern
568# endif
569#endif
570
571
572#if 1
573/* Converts an internet address from internal format to a printable,
574 presentable format.
575 AF is an internet address family, such as AF_INET or AF_INET6.
576 SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
577 (for AF_INET6).
578 DST points to a buffer having room for CNT bytes.
579 The printable representation of the address (in numeric form, not
580 surrounded by [...], no reverse DNS is done) is placed in DST, and
581 DST is returned. If an error occurs, the return value is NULL and
582 errno is set. If CNT bytes are not sufficient to hold the result,
583 the return value is NULL and errno is set to ENOSPC. A good value
584 for CNT is 46.
585
586 For more details, see the POSIX:2008 specification
587 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntop.html>. */
588# if 0
589# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
590# undef inet_ntop
591# define inet_ntop rpl_inet_ntop
592# endif
593_GL_FUNCDECL_RPL (inet_ntop, const char *,
594 (int af, const void *restrict src,
595 char *restrict dst, socklen_t cnt)
596 _GL_ARG_NONNULL ((2, 3)));
597_GL_CXXALIAS_RPL (inet_ntop, const char *,
598 (int af, const void *restrict src,
599 char *restrict dst, socklen_t cnt));
600# else
601# if !1
602_GL_FUNCDECL_SYS (inet_ntop, const char *,
603 (int af, const void *restrict src,
604 char *restrict dst, socklen_t cnt)
605 _GL_ARG_NONNULL ((2, 3)));
606# endif
607/* Need to cast, because on NonStop Kernel, the fourth parameter is
608 size_t cnt. */
609_GL_CXXALIAS_SYS_CAST (inet_ntop, const char *,
610 (int af, const void *restrict src,
611 char *restrict dst, socklen_t cnt));
612# endif
613# if __GLIBC__ >= 2
614_GL_CXXALIASWARN (inet_ntop);
615# endif
616#elif defined GNULIB_POSIXCHECK
617# undef inet_ntop
618# if HAVE_RAW_DECL_INET_NTOP
619_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
620 "use gnulib module inet_ntop for portability");
621# endif
622#endif
623
624#if 0
625# if 0
626# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
627# undef inet_pton
628# define inet_pton rpl_inet_pton
629# endif
630_GL_FUNCDECL_RPL (inet_pton, int,
631 (int af, const char *restrict src, void *restrict dst)
632 _GL_ARG_NONNULL ((2, 3)));
633_GL_CXXALIAS_RPL (inet_pton, int,
634 (int af, const char *restrict src, void *restrict dst));
635# else
636# if !1
637_GL_FUNCDECL_SYS (inet_pton, int,
638 (int af, const char *restrict src, void *restrict dst)
639 _GL_ARG_NONNULL ((2, 3)));
640# endif
641_GL_CXXALIAS_SYS (inet_pton, int,
642 (int af, const char *restrict src, void *restrict dst));
643# endif
644# if __GLIBC__ >= 2
645_GL_CXXALIASWARN (inet_pton);
646# endif
647#elif defined GNULIB_POSIXCHECK
648# undef inet_pton
649# if HAVE_RAW_DECL_INET_PTON
650_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
651 "use gnulib module inet_pton for portability");
652# endif
653#endif
654
655
656#endif /* _GL_ARPA_INET_H */
657#endif /* _GL_ARPA_INET_H */
diff --git a/gl/c++defs.h b/gl/c++defs.h
new file mode 100644
index 0000000..ad18155
--- /dev/null
+++ b/gl/c++defs.h
@@ -0,0 +1,331 @@
1/* C++ compatible function declaration macros.
2 Copyright (C) 2010-2022 Free Software Foundation, Inc.
3
4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU Lesser General Public License as published
6 by the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#ifndef _GL_CXXDEFS_H
18#define _GL_CXXDEFS_H
19
20/* Begin/end the GNULIB_NAMESPACE namespace. */
21#if defined __cplusplus && defined GNULIB_NAMESPACE
22# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
23# define _GL_END_NAMESPACE }
24#else
25# define _GL_BEGIN_NAMESPACE
26# define _GL_END_NAMESPACE
27#endif
28
29/* The three most frequent use cases of these macros are:
30
31 * For providing a substitute for a function that is missing on some
32 platforms, but is declared and works fine on the platforms on which
33 it exists:
34
35 #if @GNULIB_FOO@
36 # if !@HAVE_FOO@
37 _GL_FUNCDECL_SYS (foo, ...);
38 # endif
39 _GL_CXXALIAS_SYS (foo, ...);
40 _GL_CXXALIASWARN (foo);
41 #elif defined GNULIB_POSIXCHECK
42 ...
43 #endif
44
45 * For providing a replacement for a function that exists on all platforms,
46 but is broken/insufficient and needs to be replaced on some platforms:
47
48 #if @GNULIB_FOO@
49 # if @REPLACE_FOO@
50 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
51 # undef foo
52 # define foo rpl_foo
53 # endif
54 _GL_FUNCDECL_RPL (foo, ...);
55 _GL_CXXALIAS_RPL (foo, ...);
56 # else
57 _GL_CXXALIAS_SYS (foo, ...);
58 # endif
59 _GL_CXXALIASWARN (foo);
60 #elif defined GNULIB_POSIXCHECK
61 ...
62 #endif
63
64 * For providing a replacement for a function that exists on some platforms
65 but is broken/insufficient and needs to be replaced on some of them and
66 is additionally either missing or undeclared on some other platforms:
67
68 #if @GNULIB_FOO@
69 # if @REPLACE_FOO@
70 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
71 # undef foo
72 # define foo rpl_foo
73 # endif
74 _GL_FUNCDECL_RPL (foo, ...);
75 _GL_CXXALIAS_RPL (foo, ...);
76 # else
77 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
78 _GL_FUNCDECL_SYS (foo, ...);
79 # endif
80 _GL_CXXALIAS_SYS (foo, ...);
81 # endif
82 _GL_CXXALIASWARN (foo);
83 #elif defined GNULIB_POSIXCHECK
84 ...
85 #endif
86*/
87
88/* _GL_EXTERN_C declaration;
89 performs the declaration with C linkage. */
90#if defined __cplusplus
91# define _GL_EXTERN_C extern "C"
92#else
93# define _GL_EXTERN_C extern
94#endif
95
96/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
97 declares a replacement function, named rpl_func, with the given prototype,
98 consisting of return type, parameters, and attributes.
99 Example:
100 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
101 _GL_ARG_NONNULL ((1)));
102 */
103#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
104 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
105#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
106 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
107
108/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
109 declares the system function, named func, with the given prototype,
110 consisting of return type, parameters, and attributes.
111 Example:
112 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
113 _GL_ARG_NONNULL ((1)));
114 */
115#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
116 _GL_EXTERN_C rettype func parameters_and_attributes
117
118/* _GL_CXXALIAS_RPL (func, rettype, parameters);
119 declares a C++ alias called GNULIB_NAMESPACE::func
120 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
121 Example:
122 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
123
124 Wrapping rpl_func in an object with an inline conversion operator
125 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
126 actually used in the program. */
127#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
128 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
129#if defined __cplusplus && defined GNULIB_NAMESPACE
130# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
131 namespace GNULIB_NAMESPACE \
132 { \
133 static const struct _gl_ ## func ## _wrapper \
134 { \
135 typedef rettype (*type) parameters; \
136 \
137 inline operator type () const \
138 { \
139 return ::rpl_func; \
140 } \
141 } func = {}; \
142 } \
143 _GL_EXTERN_C int _gl_cxxalias_dummy
144#else
145# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
146 _GL_EXTERN_C int _gl_cxxalias_dummy
147#endif
148
149/* _GL_CXXALIAS_MDA (func, rettype, parameters);
150 is to be used when func is a Microsoft deprecated alias, on native Windows.
151 It declares a C++ alias called GNULIB_NAMESPACE::func
152 that redirects to _func, if GNULIB_NAMESPACE is defined.
153 Example:
154 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
155 */
156#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
157 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
158
159/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
160 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
161 except that the C function rpl_func may have a slightly different
162 declaration. A cast is used to silence the "invalid conversion" error
163 that would otherwise occur. */
164#if defined __cplusplus && defined GNULIB_NAMESPACE
165# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
166 namespace GNULIB_NAMESPACE \
167 { \
168 static const struct _gl_ ## func ## _wrapper \
169 { \
170 typedef rettype (*type) parameters; \
171 \
172 inline operator type () const \
173 { \
174 return reinterpret_cast<type>(::rpl_func); \
175 } \
176 } func = {}; \
177 } \
178 _GL_EXTERN_C int _gl_cxxalias_dummy
179#else
180# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
181 _GL_EXTERN_C int _gl_cxxalias_dummy
182#endif
183
184/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
185 is like _GL_CXXALIAS_MDA (func, rettype, parameters);
186 except that the C function func may have a slightly different declaration.
187 A cast is used to silence the "invalid conversion" error that would
188 otherwise occur. */
189#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
190 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
191
192/* _GL_CXXALIAS_SYS (func, rettype, parameters);
193 declares a C++ alias called GNULIB_NAMESPACE::func
194 that redirects to the system provided function func, if GNULIB_NAMESPACE
195 is defined.
196 Example:
197 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
198
199 Wrapping func in an object with an inline conversion operator
200 avoids a reference to func unless GNULIB_NAMESPACE::func is
201 actually used in the program. */
202#if defined __cplusplus && defined GNULIB_NAMESPACE
203# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
204 namespace GNULIB_NAMESPACE \
205 { \
206 static const struct _gl_ ## func ## _wrapper \
207 { \
208 typedef rettype (*type) parameters; \
209 \
210 inline operator type () const \
211 { \
212 return ::func; \
213 } \
214 } func = {}; \
215 } \
216 _GL_EXTERN_C int _gl_cxxalias_dummy
217#else
218# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
219 _GL_EXTERN_C int _gl_cxxalias_dummy
220#endif
221
222/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
223 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
224 except that the C function func may have a slightly different declaration.
225 A cast is used to silence the "invalid conversion" error that would
226 otherwise occur. */
227#if defined __cplusplus && defined GNULIB_NAMESPACE
228# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
229 namespace GNULIB_NAMESPACE \
230 { \
231 static const struct _gl_ ## func ## _wrapper \
232 { \
233 typedef rettype (*type) parameters; \
234 \
235 inline operator type () const \
236 { \
237 return reinterpret_cast<type>(::func); \
238 } \
239 } func = {}; \
240 } \
241 _GL_EXTERN_C int _gl_cxxalias_dummy
242#else
243# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
244 _GL_EXTERN_C int _gl_cxxalias_dummy
245#endif
246
247/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
248 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
249 except that the C function is picked among a set of overloaded functions,
250 namely the one with rettype2 and parameters2. Two consecutive casts
251 are used to silence the "cannot find a match" and "invalid conversion"
252 errors that would otherwise occur. */
253#if defined __cplusplus && defined GNULIB_NAMESPACE
254 /* The outer cast must be a reinterpret_cast.
255 The inner cast: When the function is defined as a set of overloaded
256 functions, it works as a static_cast<>, choosing the designated variant.
257 When the function is defined as a single variant, it works as a
258 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
259# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
260 namespace GNULIB_NAMESPACE \
261 { \
262 static const struct _gl_ ## func ## _wrapper \
263 { \
264 typedef rettype (*type) parameters; \
265 \
266 inline operator type () const \
267 { \
268 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
269 } \
270 } func = {}; \
271 } \
272 _GL_EXTERN_C int _gl_cxxalias_dummy
273#else
274# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
275 _GL_EXTERN_C int _gl_cxxalias_dummy
276#endif
277
278/* _GL_CXXALIASWARN (func);
279 causes a warning to be emitted when ::func is used but not when
280 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
281 variants. */
282#if defined __cplusplus && defined GNULIB_NAMESPACE
283# define _GL_CXXALIASWARN(func) \
284 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
285# define _GL_CXXALIASWARN_1(func,namespace) \
286 _GL_CXXALIASWARN_2 (func, namespace)
287/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
288 we enable the warning only when not optimizing. */
289# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
290# define _GL_CXXALIASWARN_2(func,namespace) \
291 _GL_WARN_ON_USE (func, \
292 "The symbol ::" #func " refers to the system function. " \
293 "Use " #namespace "::" #func " instead.")
294# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
295# define _GL_CXXALIASWARN_2(func,namespace) \
296 extern __typeof__ (func) func
297# else
298# define _GL_CXXALIASWARN_2(func,namespace) \
299 _GL_EXTERN_C int _gl_cxxalias_dummy
300# endif
301#else
302# define _GL_CXXALIASWARN(func) \
303 _GL_EXTERN_C int _gl_cxxalias_dummy
304#endif
305
306/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
307 causes a warning to be emitted when the given overloaded variant of ::func
308 is used but not when GNULIB_NAMESPACE::func is used. */
309#if defined __cplusplus && defined GNULIB_NAMESPACE
310# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
311 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
312 GNULIB_NAMESPACE)
313# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
314 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
315/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
316 we enable the warning only when not optimizing. */
317# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
318# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
319 _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
320 "The symbol ::" #func " refers to the system function. " \
321 "Use " #namespace "::" #func " instead.")
322# else
323# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
324 _GL_EXTERN_C int _gl_cxxalias_dummy
325# endif
326#else
327# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
328 _GL_EXTERN_C int _gl_cxxalias_dummy
329#endif
330
331#endif /* _GL_CXXDEFS_H */
diff --git a/gl/sys/socket.h b/gl/sys/socket.h
new file mode 100644
index 0000000..0519ccb
--- /dev/null
+++ b/gl/sys/socket.h
@@ -0,0 +1,1241 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Provide a sys/socket header file for systems lacking it (read: MinGW)
3 and for systems where it is incomplete.
4 Copyright (C) 2005-2022 Free Software Foundation, Inc.
5 Written by Simon Josefsson.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20/* This file is supposed to be used on platforms that lack <sys/socket.h>,
21 on platforms where <sys/socket.h> cannot be included standalone, and on
22 platforms where <sys/socket.h> does not provide all necessary definitions.
23 It is intended to provide definitions and prototypes needed by an
24 application. */
25
26#if __GNUC__ >= 3
27#pragma GCC system_header
28#endif
29
30
31#if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H
32/* Special invocation convention:
33 - On Cygwin 1.5.x we have a sequence of nested includes
34 <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>,
35 and the latter includes <sys/socket.h>. In this situation, the functions
36 are not yet declared, therefore we cannot provide the C++ aliases. */
37
38#include_next <sys/socket.h>
39
40#else
41/* Normal invocation convention. */
42
43#ifndef _GL_SYS_SOCKET_H
44
45#if 1
46
47# define _GL_ALREADY_INCLUDING_SYS_SOCKET_H
48
49/* On many platforms, <sys/socket.h> assumes prior inclusion of
50 <sys/types.h>. */
51# include <sys/types.h>
52
53/* On FreeBSD 6.4, <sys/socket.h> defines some macros that assume that NULL
54 is defined. */
55# include <stddef.h>
56
57/* The include_next requires a split double-inclusion guard. */
58# include_next <sys/socket.h>
59
60# undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H
61
62#endif
63
64#ifndef _GL_SYS_SOCKET_H
65#define _GL_SYS_SOCKET_H
66
67#ifndef _GL_INLINE_HEADER_BEGIN
68 #error "Please include config.h first."
69#endif
70_GL_INLINE_HEADER_BEGIN
71#ifndef _GL_SYS_SOCKET_INLINE
72# define _GL_SYS_SOCKET_INLINE _GL_INLINE
73#endif
74
75/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
76/* C++ compatible function declaration macros.
77 Copyright (C) 2010-2022 Free Software Foundation, Inc.
78
79 This program is free software: you can redistribute it and/or modify it
80 under the terms of the GNU Lesser General Public License as published
81 by the Free Software Foundation; either version 2 of the License, or
82 (at your option) any later version.
83
84 This program is distributed in the hope that it will be useful,
85 but WITHOUT ANY WARRANTY; without even the implied warranty of
86 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87 Lesser General Public License for more details.
88
89 You should have received a copy of the GNU Lesser General Public License
90 along with this program. If not, see <https://www.gnu.org/licenses/>. */
91
92#ifndef _GL_CXXDEFS_H
93#define _GL_CXXDEFS_H
94
95/* Begin/end the GNULIB_NAMESPACE namespace. */
96#if defined __cplusplus && defined GNULIB_NAMESPACE
97# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
98# define _GL_END_NAMESPACE }
99#else
100# define _GL_BEGIN_NAMESPACE
101# define _GL_END_NAMESPACE
102#endif
103
104/* The three most frequent use cases of these macros are:
105
106 * For providing a substitute for a function that is missing on some
107 platforms, but is declared and works fine on the platforms on which
108 it exists:
109
110 #if @GNULIB_FOO@
111 # if !@HAVE_FOO@
112 _GL_FUNCDECL_SYS (foo, ...);
113 # endif
114 _GL_CXXALIAS_SYS (foo, ...);
115 _GL_CXXALIASWARN (foo);
116 #elif defined GNULIB_POSIXCHECK
117 ...
118 #endif
119
120 * For providing a replacement for a function that exists on all platforms,
121 but is broken/insufficient and needs to be replaced on some platforms:
122
123 #if @GNULIB_FOO@
124 # if @REPLACE_FOO@
125 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
126 # undef foo
127 # define foo rpl_foo
128 # endif
129 _GL_FUNCDECL_RPL (foo, ...);
130 _GL_CXXALIAS_RPL (foo, ...);
131 # else
132 _GL_CXXALIAS_SYS (foo, ...);
133 # endif
134 _GL_CXXALIASWARN (foo);
135 #elif defined GNULIB_POSIXCHECK
136 ...
137 #endif
138
139 * For providing a replacement for a function that exists on some platforms
140 but is broken/insufficient and needs to be replaced on some of them and
141 is additionally either missing or undeclared on some other platforms:
142
143 #if @GNULIB_FOO@
144 # if @REPLACE_FOO@
145 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
146 # undef foo
147 # define foo rpl_foo
148 # endif
149 _GL_FUNCDECL_RPL (foo, ...);
150 _GL_CXXALIAS_RPL (foo, ...);
151 # else
152 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
153 _GL_FUNCDECL_SYS (foo, ...);
154 # endif
155 _GL_CXXALIAS_SYS (foo, ...);
156 # endif
157 _GL_CXXALIASWARN (foo);
158 #elif defined GNULIB_POSIXCHECK
159 ...
160 #endif
161*/
162
163/* _GL_EXTERN_C declaration;
164 performs the declaration with C linkage. */
165#if defined __cplusplus
166# define _GL_EXTERN_C extern "C"
167#else
168# define _GL_EXTERN_C extern
169#endif
170
171/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
172 declares a replacement function, named rpl_func, with the given prototype,
173 consisting of return type, parameters, and attributes.
174 Example:
175 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
176 _GL_ARG_NONNULL ((1)));
177 */
178#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
179 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
180#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
181 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
182
183/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
184 declares the system function, named func, with the given prototype,
185 consisting of return type, parameters, and attributes.
186 Example:
187 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
188 _GL_ARG_NONNULL ((1)));
189 */
190#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
191 _GL_EXTERN_C rettype func parameters_and_attributes
192
193/* _GL_CXXALIAS_RPL (func, rettype, parameters);
194 declares a C++ alias called GNULIB_NAMESPACE::func
195 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
196 Example:
197 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
198
199 Wrapping rpl_func in an object with an inline conversion operator
200 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
201 actually used in the program. */
202#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
203 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
204#if defined __cplusplus && defined GNULIB_NAMESPACE
205# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
206 namespace GNULIB_NAMESPACE \
207 { \
208 static const struct _gl_ ## func ## _wrapper \
209 { \
210 typedef rettype (*type) parameters; \
211 \
212 inline operator type () const \
213 { \
214 return ::rpl_func; \
215 } \
216 } func = {}; \
217 } \
218 _GL_EXTERN_C int _gl_cxxalias_dummy
219#else
220# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
221 _GL_EXTERN_C int _gl_cxxalias_dummy
222#endif
223
224/* _GL_CXXALIAS_MDA (func, rettype, parameters);
225 is to be used when func is a Microsoft deprecated alias, on native Windows.
226 It declares a C++ alias called GNULIB_NAMESPACE::func
227 that redirects to _func, if GNULIB_NAMESPACE is defined.
228 Example:
229 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
230 */
231#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
232 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
233
234/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
235 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
236 except that the C function rpl_func may have a slightly different
237 declaration. A cast is used to silence the "invalid conversion" error
238 that would otherwise occur. */
239#if defined __cplusplus && defined GNULIB_NAMESPACE
240# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
241 namespace GNULIB_NAMESPACE \
242 { \
243 static const struct _gl_ ## func ## _wrapper \
244 { \
245 typedef rettype (*type) parameters; \
246 \
247 inline operator type () const \
248 { \
249 return reinterpret_cast<type>(::rpl_func); \
250 } \
251 } func = {}; \
252 } \
253 _GL_EXTERN_C int _gl_cxxalias_dummy
254#else
255# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
256 _GL_EXTERN_C int _gl_cxxalias_dummy
257#endif
258
259/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
260 is like _GL_CXXALIAS_MDA (func, rettype, parameters);
261 except that the C function func may have a slightly different declaration.
262 A cast is used to silence the "invalid conversion" error that would
263 otherwise occur. */
264#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
265 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
266
267/* _GL_CXXALIAS_SYS (func, rettype, parameters);
268 declares a C++ alias called GNULIB_NAMESPACE::func
269 that redirects to the system provided function func, if GNULIB_NAMESPACE
270 is defined.
271 Example:
272 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
273
274 Wrapping func in an object with an inline conversion operator
275 avoids a reference to func unless GNULIB_NAMESPACE::func is
276 actually used in the program. */
277#if defined __cplusplus && defined GNULIB_NAMESPACE
278# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
279 namespace GNULIB_NAMESPACE \
280 { \
281 static const struct _gl_ ## func ## _wrapper \
282 { \
283 typedef rettype (*type) parameters; \
284 \
285 inline operator type () const \
286 { \
287 return ::func; \
288 } \
289 } func = {}; \
290 } \
291 _GL_EXTERN_C int _gl_cxxalias_dummy
292#else
293# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
294 _GL_EXTERN_C int _gl_cxxalias_dummy
295#endif
296
297/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
298 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
299 except that the C function func may have a slightly different declaration.
300 A cast is used to silence the "invalid conversion" error that would
301 otherwise occur. */
302#if defined __cplusplus && defined GNULIB_NAMESPACE
303# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
304 namespace GNULIB_NAMESPACE \
305 { \
306 static const struct _gl_ ## func ## _wrapper \
307 { \
308 typedef rettype (*type) parameters; \
309 \
310 inline operator type () const \
311 { \
312 return reinterpret_cast<type>(::func); \
313 } \
314 } func = {}; \
315 } \
316 _GL_EXTERN_C int _gl_cxxalias_dummy
317#else
318# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
319 _GL_EXTERN_C int _gl_cxxalias_dummy
320#endif
321
322/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
323 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
324 except that the C function is picked among a set of overloaded functions,
325 namely the one with rettype2 and parameters2. Two consecutive casts
326 are used to silence the "cannot find a match" and "invalid conversion"
327 errors that would otherwise occur. */
328#if defined __cplusplus && defined GNULIB_NAMESPACE
329 /* The outer cast must be a reinterpret_cast.
330 The inner cast: When the function is defined as a set of overloaded
331 functions, it works as a static_cast<>, choosing the designated variant.
332 When the function is defined as a single variant, it works as a
333 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
334# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
335 namespace GNULIB_NAMESPACE \
336 { \
337 static const struct _gl_ ## func ## _wrapper \
338 { \
339 typedef rettype (*type) parameters; \
340 \
341 inline operator type () const \
342 { \
343 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
344 } \
345 } func = {}; \
346 } \
347 _GL_EXTERN_C int _gl_cxxalias_dummy
348#else
349# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
350 _GL_EXTERN_C int _gl_cxxalias_dummy
351#endif
352
353/* _GL_CXXALIASWARN (func);
354 causes a warning to be emitted when ::func is used but not when
355 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
356 variants. */
357#if defined __cplusplus && defined GNULIB_NAMESPACE
358# define _GL_CXXALIASWARN(func) \
359 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
360# define _GL_CXXALIASWARN_1(func,namespace) \
361 _GL_CXXALIASWARN_2 (func, namespace)
362/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
363 we enable the warning only when not optimizing. */
364# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
365# define _GL_CXXALIASWARN_2(func,namespace) \
366 _GL_WARN_ON_USE (func, \
367 "The symbol ::" #func " refers to the system function. " \
368 "Use " #namespace "::" #func " instead.")
369# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
370# define _GL_CXXALIASWARN_2(func,namespace) \
371 extern __typeof__ (func) func
372# else
373# define _GL_CXXALIASWARN_2(func,namespace) \
374 _GL_EXTERN_C int _gl_cxxalias_dummy
375# endif
376#else
377# define _GL_CXXALIASWARN(func) \
378 _GL_EXTERN_C int _gl_cxxalias_dummy
379#endif
380
381/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
382 causes a warning to be emitted when the given overloaded variant of ::func
383 is used but not when GNULIB_NAMESPACE::func is used. */
384#if defined __cplusplus && defined GNULIB_NAMESPACE
385# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
386 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
387 GNULIB_NAMESPACE)
388# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
389 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
390/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
391 we enable the warning only when not optimizing. */
392# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
393# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
394 _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
395 "The symbol ::" #func " refers to the system function. " \
396 "Use " #namespace "::" #func " instead.")
397# else
398# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
399 _GL_EXTERN_C int _gl_cxxalias_dummy
400# endif
401#else
402# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
403 _GL_EXTERN_C int _gl_cxxalias_dummy
404#endif
405
406#endif /* _GL_CXXDEFS_H */
407
408/* The definition of _GL_ARG_NONNULL is copied here. */
409/* A C macro for declaring that specific arguments must not be NULL.
410 Copyright (C) 2009-2022 Free Software Foundation, Inc.
411
412 This program is free software: you can redistribute it and/or modify it
413 under the terms of the GNU Lesser General Public License as published
414 by the Free Software Foundation; either version 2 of the License, or
415 (at your option) any later version.
416
417 This program is distributed in the hope that it will be useful,
418 but WITHOUT ANY WARRANTY; without even the implied warranty of
419 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
420 Lesser General Public License for more details.
421
422 You should have received a copy of the GNU Lesser General Public License
423 along with this program. If not, see <https://www.gnu.org/licenses/>. */
424
425/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
426 that the values passed as arguments n, ..., m must be non-NULL pointers.
427 n = 1 stands for the first argument, n = 2 for the second argument etc. */
428#ifndef _GL_ARG_NONNULL
429# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
430# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
431# else
432# define _GL_ARG_NONNULL(params)
433# endif
434#endif
435
436/* The definition of _GL_WARN_ON_USE is copied here. */
437/* A C macro for emitting warnings if a function is used.
438 Copyright (C) 2010-2022 Free Software Foundation, Inc.
439
440 This program is free software: you can redistribute it and/or modify it
441 under the terms of the GNU Lesser General Public License as published
442 by the Free Software Foundation; either version 2 of the License, or
443 (at your option) any later version.
444
445 This program is distributed in the hope that it will be useful,
446 but WITHOUT ANY WARRANTY; without even the implied warranty of
447 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
448 Lesser General Public License for more details.
449
450 You should have received a copy of the GNU Lesser General Public License
451 along with this program. If not, see <https://www.gnu.org/licenses/>. */
452
453/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
454 for FUNCTION which will then trigger a compiler warning containing
455 the text of "literal string" anywhere that function is called, if
456 supported by the compiler. If the compiler does not support this
457 feature, the macro expands to an unused extern declaration.
458
459 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
460 attribute used in _GL_WARN_ON_USE. If the compiler does not support
461 this feature, it expands to empty.
462
463 These macros are useful for marking a function as a potential
464 portability trap, with the intent that "literal string" include
465 instructions on the replacement function that should be used
466 instead.
467 _GL_WARN_ON_USE is for functions with 'extern' linkage.
468 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
469 linkage.
470
471 However, one of the reasons that a function is a portability trap is
472 if it has the wrong signature. Declaring FUNCTION with a different
473 signature in C is a compilation error, so this macro must use the
474 same type as any existing declaration so that programs that avoid
475 the problematic FUNCTION do not fail to compile merely because they
476 included a header that poisoned the function. But this implies that
477 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
478 have a declaration. Use of this macro implies that there must not
479 be any other macro hiding the declaration of FUNCTION; but
480 undefining FUNCTION first is part of the poisoning process anyway
481 (although for symbols that are provided only via a macro, the result
482 is a compilation error rather than a warning containing
483 "literal string"). Also note that in C++, it is only safe to use if
484 FUNCTION has no overloads.
485
486 For an example, it is possible to poison 'getline' by:
487 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
488 [getline]) in configure.ac, which potentially defines
489 HAVE_RAW_DECL_GETLINE
490 - adding this code to a header that wraps the system <stdio.h>:
491 #undef getline
492 #if HAVE_RAW_DECL_GETLINE
493 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
494 "not universally present; use the gnulib module getline");
495 #endif
496
497 It is not possible to directly poison global variables. But it is
498 possible to write a wrapper accessor function, and poison that
499 (less common usage, like &environ, will cause a compilation error
500 rather than issue the nice warning, but the end result of informing
501 the developer about their portability problem is still achieved):
502 #if HAVE_RAW_DECL_ENVIRON
503 static char ***
504 rpl_environ (void) { return &environ; }
505 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
506 # undef environ
507 # define environ (*rpl_environ ())
508 #endif
509 or better (avoiding contradictory use of 'static' and 'extern'):
510 #if HAVE_RAW_DECL_ENVIRON
511 static char ***
512 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
513 rpl_environ (void) { return &environ; }
514 # undef environ
515 # define environ (*rpl_environ ())
516 #endif
517 */
518#ifndef _GL_WARN_ON_USE
519
520# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
521/* A compiler attribute is available in gcc versions 4.3.0 and later. */
522# define _GL_WARN_ON_USE(function, message) \
523_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
524# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
525 __attribute__ ((__warning__ (message)))
526# elif __clang_major__ >= 4
527/* Another compiler attribute is available in clang. */
528# define _GL_WARN_ON_USE(function, message) \
529_GL_WARN_EXTERN_C __typeof__ (function) function \
530 __attribute__ ((__diagnose_if__ (1, message, "warning")))
531# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
532 __attribute__ ((__diagnose_if__ (1, message, "warning")))
533# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
534/* Verify the existence of the function. */
535# define _GL_WARN_ON_USE(function, message) \
536_GL_WARN_EXTERN_C __typeof__ (function) function
537# define _GL_WARN_ON_USE_ATTRIBUTE(message)
538# else /* Unsupported. */
539# define _GL_WARN_ON_USE(function, message) \
540_GL_WARN_EXTERN_C int _gl_warn_on_use
541# define _GL_WARN_ON_USE_ATTRIBUTE(message)
542# endif
543#endif
544
545/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
546 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
547 function is declared with the given prototype, consisting of return type,
548 parameters, and attributes.
549 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
550 not work in this case. */
551#ifndef _GL_WARN_ON_USE_CXX
552# if !defined __cplusplus
553# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
554 _GL_WARN_ON_USE (function, msg)
555# else
556# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
557/* A compiler attribute is available in gcc versions 4.3.0 and later. */
558# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
559extern rettype_gcc function parameters_and_attributes \
560 __attribute__ ((__warning__ (msg)))
561# elif __clang_major__ >= 4
562/* Another compiler attribute is available in clang. */
563# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
564extern rettype_clang function parameters_and_attributes \
565 __attribute__ ((__diagnose_if__ (1, msg, "warning")))
566# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
567/* Verify the existence of the function. */
568# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
569extern rettype_gcc function parameters_and_attributes
570# else /* Unsupported. */
571# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
572_GL_WARN_EXTERN_C int _gl_warn_on_use
573# endif
574# endif
575#endif
576
577/* _GL_WARN_EXTERN_C declaration;
578 performs the declaration with C linkage. */
579#ifndef _GL_WARN_EXTERN_C
580# if defined __cplusplus
581# define _GL_WARN_EXTERN_C extern "C"
582# else
583# define _GL_WARN_EXTERN_C extern
584# endif
585#endif
586
587#if !1
588# if !GNULIB_defined_sa_family_t
589/* On OS/2 kLIBC, sa_family_t is unsigned char unless TCPV40HDRS is defined. */
590# if !defined __KLIBC__ || defined TCPV40HDRS
591typedef unsigned short sa_family_t;
592# else
593typedef unsigned char sa_family_t;
594# endif
595# define GNULIB_defined_sa_family_t 1
596# endif
597#endif
598
599#if 1
600/* Make the 'struct sockaddr_storage' field 'ss_family' visible on AIX 7.1. */
601# if !1
602# ifndef ss_family
603# define ss_family __ss_family
604# endif
605# endif
606#else
607# include <stdalign.h>
608/* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on
609 2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */
610# define __ss_aligntype unsigned long int
611# define _SS_SIZE 256
612# define _SS_PADSIZE \
613 (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype) \
614 ? sizeof (sa_family_t) \
615 : alignof (__ss_aligntype)) \
616 + sizeof (__ss_aligntype)))
617
618# if !GNULIB_defined_struct_sockaddr_storage
619struct sockaddr_storage
620{
621 sa_family_t ss_family; /* Address family, etc. */
622 __ss_aligntype __ss_align; /* Force desired alignment. */
623 char __ss_padding[_SS_PADSIZE];
624};
625# define GNULIB_defined_struct_sockaddr_storage 1
626# endif
627
628#endif
629
630/* Get struct iovec. */
631/* But avoid namespace pollution on glibc systems. */
632#if ! defined __GLIBC__
633# include <sys/uio.h>
634#endif
635
636#if 1
637
638/* A platform that has <sys/socket.h>. */
639
640/* For shutdown(). */
641# if !defined SHUT_RD
642# define SHUT_RD 0
643# endif
644# if !defined SHUT_WR
645# define SHUT_WR 1
646# endif
647# if !defined SHUT_RDWR
648# define SHUT_RDWR 2
649# endif
650
651# ifdef __VMS /* OpenVMS */
652# ifndef CMSG_SPACE
653# define CMSG_SPACE(length) _CMSG_SPACE(length)
654# endif
655# ifndef CMSG_LEN
656# define CMSG_LEN(length) _CMSG_LEN(length)
657# endif
658# endif
659
660#else
661
662# ifdef __CYGWIN__
663# error "Cygwin does have a sys/socket.h, doesn't it?!?"
664# endif
665
666/* A platform that lacks <sys/socket.h>.
667
668 Currently only MinGW is supported. See the gnulib manual regarding
669 Windows sockets. MinGW has the header files winsock2.h and
670 ws2tcpip.h that declare the sys/socket.h definitions we need. Note
671 that you can influence which definitions you get by setting the
672 WINVER symbol before including these two files. For example,
673 getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
674 symbol is set indirectly through WINVER). You can set this by
675 adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your
676 code may not run on older Windows releases then. My Windows 2000
677 box was not able to run the code, for example. The situation is
678 slightly confusing because
679 <https://docs.microsoft.com/en-us/windows/desktop/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>
680 suggests that getaddrinfo should be available on all Windows
681 releases. */
682
683# if 0
684# include <winsock2.h>
685# endif
686# if 0
687# include <ws2tcpip.h>
688# endif
689
690/* For shutdown(). */
691# if !defined SHUT_RD && defined SD_RECEIVE
692# define SHUT_RD SD_RECEIVE
693# endif
694# if !defined SHUT_WR && defined SD_SEND
695# define SHUT_WR SD_SEND
696# endif
697# if !defined SHUT_RDWR && defined SD_BOTH
698# define SHUT_RDWR SD_BOTH
699# endif
700
701# if 0
702/* Include headers needed by the emulation code. */
703# include <sys/types.h>
704# include <io.h>
705/* If these headers don't define socklen_t, <config.h> does. */
706# endif
707
708/* Rudimentary 'struct msghdr'; this works as long as you don't try to
709 access msg_control or msg_controllen. */
710struct msghdr {
711 void *msg_name;
712 socklen_t msg_namelen;
713 struct iovec *msg_iov;
714 int msg_iovlen;
715 int msg_flags;
716};
717
718#endif
719
720/* Ensure SO_REUSEPORT is defined. */
721/* For the subtle differences between SO_REUSEPORT and SO_REUSEADDR, see
722 https://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t
723 and https://lwn.net/Articles/542629/
724 */
725#ifndef SO_REUSEPORT
726# define SO_REUSEPORT SO_REUSEADDR
727#endif
728
729/* Fix some definitions from <winsock2.h>. */
730
731#if 0
732
733# if !GNULIB_defined_rpl_fd_isset
734
735/* Re-define FD_ISSET to avoid a WSA call while we are not using
736 network sockets. */
737_GL_SYS_SOCKET_INLINE int
738rpl_fd_isset (SOCKET fd, fd_set * set)
739{
740 u_int i;
741 if (set == NULL)
742 return 0;
743
744 for (i = 0; i < set->fd_count; i++)
745 if (set->fd_array[i] == fd)
746 return 1;
747
748 return 0;
749}
750
751# define GNULIB_defined_rpl_fd_isset 1
752# endif
753
754# undef FD_ISSET
755# define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
756
757#endif
758
759/* Hide some function declarations from <winsock2.h>. */
760
761#if 0
762# if !defined _GL_UNISTD_H
763# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
764# undef close
765# define close close_used_without_including_unistd_h
766# elif !defined __clang__
767 _GL_WARN_ON_USE (close,
768 "close() used without including <unistd.h>");
769# endif
770# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
771# undef gethostname
772# define gethostname gethostname_used_without_including_unistd_h
773# else
774 _GL_WARN_ON_USE (gethostname,
775 "gethostname() used without including <unistd.h>");
776# endif
777# endif
778# if !defined _GL_SYS_SELECT_H
779# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
780# undef select
781# define select select_used_without_including_sys_select_h
782# else
783 _GL_WARN_ON_USE (select,
784 "select() used without including <sys/select.h>");
785# endif
786# endif
787#endif
788
789/* Wrap everything else to use libc file descriptors for sockets. */
790
791#if 0
792# if 0
793# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
794# undef socket
795# define socket rpl_socket
796# endif
797_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol));
798_GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol));
799# else
800_GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol));
801# endif
802_GL_CXXALIASWARN (socket);
803#elif 0
804# undef socket
805# define socket socket_used_without_requesting_gnulib_module_socket
806#elif defined GNULIB_POSIXCHECK
807# undef socket
808# if HAVE_RAW_DECL_SOCKET
809_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
810 "use gnulib module socket for portability");
811# endif
812#endif
813
814#if 0
815# if 0
816# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
817# undef connect
818# define connect rpl_connect
819# endif
820_GL_FUNCDECL_RPL (connect, int,
821 (int fd, const struct sockaddr *addr, socklen_t addrlen)
822 _GL_ARG_NONNULL ((2)));
823_GL_CXXALIAS_RPL (connect, int,
824 (int fd, const struct sockaddr *addr, socklen_t addrlen));
825# else
826/* Need to cast, because on NonStop Kernel, the third parameter is
827 size_t addrlen. */
828_GL_CXXALIAS_SYS_CAST (connect, int,
829 (int fd,
830 const struct sockaddr *addr, socklen_t addrlen));
831# endif
832_GL_CXXALIASWARN (connect);
833#elif 0
834# undef connect
835# define connect socket_used_without_requesting_gnulib_module_connect
836#elif defined GNULIB_POSIXCHECK
837# undef connect
838# if HAVE_RAW_DECL_CONNECT
839_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
840 "use gnulib module connect for portability");
841# endif
842#endif
843
844#if 0
845# if 0
846# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
847# undef accept
848# define accept rpl_accept
849# endif
850_GL_FUNCDECL_RPL (accept, int,
851 (int fd,
852 struct sockaddr *restrict addr,
853 socklen_t *restrict addrlen));
854_GL_CXXALIAS_RPL (accept, int,
855 (int fd,
856 struct sockaddr *restrict addr,
857 socklen_t *restrict addrlen));
858# else
859/* Need to cast, because on Solaris 10 systems, the third parameter is
860 void *addrlen. */
861_GL_CXXALIAS_SYS_CAST (accept, int,
862 (int fd,
863 struct sockaddr *restrict addr,
864 socklen_t *restrict addrlen));
865# endif
866_GL_CXXALIASWARN (accept);
867#elif 0
868# undef accept
869# define accept accept_used_without_requesting_gnulib_module_accept
870#elif defined GNULIB_POSIXCHECK
871# undef accept
872# if HAVE_RAW_DECL_ACCEPT
873_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
874 "use gnulib module accept for portability");
875# endif
876#endif
877
878#if 0
879# if 0
880# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
881# undef bind
882# define bind rpl_bind
883# endif
884_GL_FUNCDECL_RPL (bind, int,
885 (int fd, const struct sockaddr *addr, socklen_t addrlen)
886 _GL_ARG_NONNULL ((2)));
887_GL_CXXALIAS_RPL (bind, int,
888 (int fd, const struct sockaddr *addr, socklen_t addrlen));
889# else
890/* Need to cast, because on NonStop Kernel, the third parameter is
891 size_t addrlen. */
892_GL_CXXALIAS_SYS_CAST (bind, int,
893 (int fd,
894 const struct sockaddr *addr, socklen_t addrlen));
895# endif
896_GL_CXXALIASWARN (bind);
897#elif 0
898# undef bind
899# define bind bind_used_without_requesting_gnulib_module_bind
900#elif defined GNULIB_POSIXCHECK
901# undef bind
902# if HAVE_RAW_DECL_BIND
903_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
904 "use gnulib module bind for portability");
905# endif
906#endif
907
908#if 0
909# if 0
910# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
911# undef getpeername
912# define getpeername rpl_getpeername
913# endif
914_GL_FUNCDECL_RPL (getpeername, int,
915 (int fd, struct sockaddr *restrict addr,
916 socklen_t *restrict addrlen)
917 _GL_ARG_NONNULL ((2, 3)));
918_GL_CXXALIAS_RPL (getpeername, int,
919 (int fd, struct sockaddr *restrict addr,
920 socklen_t *restrict addrlen));
921# else
922/* Need to cast, because on Solaris 10 systems, the third parameter is
923 void *addrlen. */
924_GL_CXXALIAS_SYS_CAST (getpeername, int,
925 (int fd, struct sockaddr *restrict addr,
926 socklen_t *restrict addrlen));
927# endif
928_GL_CXXALIASWARN (getpeername);
929#elif 0
930# undef getpeername
931# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
932#elif defined GNULIB_POSIXCHECK
933# undef getpeername
934# if HAVE_RAW_DECL_GETPEERNAME
935_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
936 "use gnulib module getpeername for portability");
937# endif
938#endif
939
940#if 0
941# if 0
942# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
943# undef getsockname
944# define getsockname rpl_getsockname
945# endif
946_GL_FUNCDECL_RPL (getsockname, int,
947 (int fd, struct sockaddr *restrict addr,
948 socklen_t *restrict addrlen)
949 _GL_ARG_NONNULL ((2, 3)));
950_GL_CXXALIAS_RPL (getsockname, int,
951 (int fd, struct sockaddr *restrict addr,
952 socklen_t *restrict addrlen));
953# else
954/* Need to cast, because on Solaris 10 systems, the third parameter is
955 void *addrlen. */
956_GL_CXXALIAS_SYS_CAST (getsockname, int,
957 (int fd, struct sockaddr *restrict addr,
958 socklen_t *restrict addrlen));
959# endif
960_GL_CXXALIASWARN (getsockname);
961#elif 0
962# undef getsockname
963# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
964#elif defined GNULIB_POSIXCHECK
965# undef getsockname
966# if HAVE_RAW_DECL_GETSOCKNAME
967_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
968 "use gnulib module getsockname for portability");
969# endif
970#endif
971
972#if 0
973# if 0
974# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
975# undef getsockopt
976# define getsockopt rpl_getsockopt
977# endif
978_GL_FUNCDECL_RPL (getsockopt, int,
979 (int fd, int level, int optname,
980 void *restrict optval, socklen_t *restrict optlen)
981 _GL_ARG_NONNULL ((4, 5)));
982_GL_CXXALIAS_RPL (getsockopt, int,
983 (int fd, int level, int optname,
984 void *restrict optval, socklen_t *restrict optlen));
985# else
986/* Need to cast, because on Solaris 10 systems, the fifth parameter is
987 void *optlen. */
988_GL_CXXALIAS_SYS_CAST (getsockopt, int,
989 (int fd, int level, int optname,
990 void *restrict optval, socklen_t *restrict optlen));
991# endif
992_GL_CXXALIASWARN (getsockopt);
993#elif 0
994# undef getsockopt
995# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
996#elif defined GNULIB_POSIXCHECK
997# undef getsockopt
998# if HAVE_RAW_DECL_GETSOCKOPT
999_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
1000 "use gnulib module getsockopt for portability");
1001# endif
1002#endif
1003
1004#if 0
1005# if 0
1006# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1007# undef listen
1008# define listen rpl_listen
1009# endif
1010_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog));
1011_GL_CXXALIAS_RPL (listen, int, (int fd, int backlog));
1012# else
1013_GL_CXXALIAS_SYS (listen, int, (int fd, int backlog));
1014# endif
1015_GL_CXXALIASWARN (listen);
1016#elif 0
1017# undef listen
1018# define listen listen_used_without_requesting_gnulib_module_listen
1019#elif defined GNULIB_POSIXCHECK
1020# undef listen
1021# if HAVE_RAW_DECL_LISTEN
1022_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
1023 "use gnulib module listen for portability");
1024# endif
1025#endif
1026
1027#if 0
1028# if 0
1029# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1030# undef recv
1031# define recv rpl_recv
1032# endif
1033_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)
1034 _GL_ARG_NONNULL ((2)));
1035_GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
1036# else
1037/* Need to cast, because on HP-UX 11.31 the return type may be
1038 int,
1039 depending on compiler options. */
1040_GL_CXXALIAS_SYS_CAST (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
1041# endif
1042_GL_CXXALIASWARN (recv);
1043#elif 0
1044# undef recv
1045# define recv recv_used_without_requesting_gnulib_module_recv
1046#elif defined GNULIB_POSIXCHECK
1047# undef recv
1048# if HAVE_RAW_DECL_RECV
1049_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
1050 "use gnulib module recv for portability");
1051# endif
1052#endif
1053
1054#if 0
1055# if 0
1056# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1057# undef send
1058# define send rpl_send
1059# endif
1060_GL_FUNCDECL_RPL (send, ssize_t,
1061 (int fd, const void *buf, size_t len, int flags)
1062 _GL_ARG_NONNULL ((2)));
1063_GL_CXXALIAS_RPL (send, ssize_t,
1064 (int fd, const void *buf, size_t len, int flags));
1065# else
1066/* Need to cast, because on HP-UX 11.31 the return type may be
1067 int,
1068 depending on compiler options. */
1069_GL_CXXALIAS_SYS_CAST (send, ssize_t,
1070 (int fd, const void *buf, size_t len, int flags));
1071# endif
1072_GL_CXXALIASWARN (send);
1073#elif 0
1074# undef send
1075# define send send_used_without_requesting_gnulib_module_send
1076#elif defined GNULIB_POSIXCHECK
1077# undef send
1078# if HAVE_RAW_DECL_SEND
1079_GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
1080 "use gnulib module send for portability");
1081# endif
1082#endif
1083
1084#if 0
1085# if 0
1086# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1087# undef recvfrom
1088# define recvfrom rpl_recvfrom
1089# endif
1090_GL_FUNCDECL_RPL (recvfrom, ssize_t,
1091 (int fd, void *restrict buf, size_t len, int flags,
1092 struct sockaddr *restrict from,
1093 socklen_t *restrict fromlen)
1094 _GL_ARG_NONNULL ((2)));
1095_GL_CXXALIAS_RPL (recvfrom, ssize_t,
1096 (int fd, void *restrict buf, size_t len, int flags,
1097 struct sockaddr *restrict from,
1098 socklen_t *restrict fromlen));
1099# else
1100/* Need to cast, because on Solaris 10 systems, the sixth parameter is
1101 void *fromlen. */
1102_GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
1103 (int fd, void *restrict buf, size_t len, int flags,
1104 struct sockaddr *restrict from,
1105 socklen_t *restrict fromlen));
1106# endif
1107_GL_CXXALIASWARN (recvfrom);
1108#elif 0
1109# undef recvfrom
1110# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
1111#elif defined GNULIB_POSIXCHECK
1112# undef recvfrom
1113# if HAVE_RAW_DECL_RECVFROM
1114_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
1115 "use gnulib module recvfrom for portability");
1116# endif
1117#endif
1118
1119#if 0
1120# if 0
1121# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1122# undef sendto
1123# define sendto rpl_sendto
1124# endif
1125_GL_FUNCDECL_RPL (sendto, ssize_t,
1126 (int fd, const void *buf, size_t len, int flags,
1127 const struct sockaddr *to, socklen_t tolen)
1128 _GL_ARG_NONNULL ((2)));
1129_GL_CXXALIAS_RPL (sendto, ssize_t,
1130 (int fd, const void *buf, size_t len, int flags,
1131 const struct sockaddr *to, socklen_t tolen));
1132# else
1133/* Need to cast, because on NonStop Kernel, the sixth parameter is
1134 size_t tolen. */
1135_GL_CXXALIAS_SYS_CAST (sendto, ssize_t,
1136 (int fd, const void *buf, size_t len, int flags,
1137 const struct sockaddr *to, socklen_t tolen));
1138# endif
1139_GL_CXXALIASWARN (sendto);
1140#elif 0
1141# undef sendto
1142# define sendto sendto_used_without_requesting_gnulib_module_sendto
1143#elif defined GNULIB_POSIXCHECK
1144# undef sendto
1145# if HAVE_RAW_DECL_SENDTO
1146_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
1147 "use gnulib module sendto for portability");
1148# endif
1149#endif
1150
1151#if 0
1152# if 0
1153# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1154# undef setsockopt
1155# define setsockopt rpl_setsockopt
1156# endif
1157_GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname,
1158 const void * optval, socklen_t optlen)
1159 _GL_ARG_NONNULL ((4)));
1160_GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname,
1161 const void * optval, socklen_t optlen));
1162# else
1163/* Need to cast, because on NonStop Kernel, the fifth parameter is
1164 size_t optlen. */
1165_GL_CXXALIAS_SYS_CAST (setsockopt, int,
1166 (int fd, int level, int optname,
1167 const void * optval, socklen_t optlen));
1168# endif
1169_GL_CXXALIASWARN (setsockopt);
1170#elif 0
1171# undef setsockopt
1172# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
1173#elif defined GNULIB_POSIXCHECK
1174# undef setsockopt
1175# if HAVE_RAW_DECL_SETSOCKOPT
1176_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
1177 "use gnulib module setsockopt for portability");
1178# endif
1179#endif
1180
1181#if 0
1182# if 0
1183# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1184# undef shutdown
1185# define shutdown rpl_shutdown
1186# endif
1187_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how));
1188_GL_CXXALIAS_RPL (shutdown, int, (int fd, int how));
1189# else
1190_GL_CXXALIAS_SYS (shutdown, int, (int fd, int how));
1191# endif
1192_GL_CXXALIASWARN (shutdown);
1193#elif 0
1194# undef shutdown
1195# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
1196#elif defined GNULIB_POSIXCHECK
1197# undef shutdown
1198# if HAVE_RAW_DECL_SHUTDOWN
1199_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
1200 "use gnulib module shutdown for portability");
1201# endif
1202#endif
1203
1204#if 0
1205/* Accept a connection on a socket, with specific opening flags.
1206 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
1207 and O_TEXT, O_BINARY (defined in "binary-io.h").
1208 See also the Linux man page at
1209 <https://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */
1210# if 1
1211# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1212# define accept4 rpl_accept4
1213# endif
1214_GL_FUNCDECL_RPL (accept4, int,
1215 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
1216 int flags));
1217_GL_CXXALIAS_RPL (accept4, int,
1218 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
1219 int flags));
1220# else
1221_GL_FUNCDECL_SYS (accept4, int,
1222 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
1223 int flags));
1224_GL_CXXALIAS_SYS (accept4, int,
1225 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
1226 int flags));
1227# endif
1228_GL_CXXALIASWARN (accept4);
1229#elif defined GNULIB_POSIXCHECK
1230# undef accept4
1231# if HAVE_RAW_DECL_ACCEPT4
1232_GL_WARN_ON_USE (accept4, "accept4 is unportable - "
1233 "use gnulib module accept4 for portability");
1234# endif
1235#endif
1236
1237_GL_INLINE_HEADER_END
1238
1239#endif /* _GL_SYS_SOCKET_H */
1240#endif /* _GL_SYS_SOCKET_H */
1241#endif
diff --git a/gl/sys/stat.h b/gl/sys/stat.h
new file mode 100644
index 0000000..8120383
--- /dev/null
+++ b/gl/sys/stat.h
@@ -0,0 +1,1461 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Provide a more complete sys/stat.h header file.
3 Copyright (C) 2005-2022 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
19
20/* This file is supposed to be used on platforms where <sys/stat.h> is
21 incomplete. It is intended to provide definitions and prototypes
22 needed by an application. Start with what the system provides. */
23
24#if __GNUC__ >= 3
25#pragma GCC system_header
26#endif
27
28
29#if defined __need_system_sys_stat_h
30/* Special invocation convention. */
31
32#include_next <sys/stat.h>
33
34#else
35/* Normal invocation convention. */
36
37#ifndef _GL_SYS_STAT_H
38
39/* Get nlink_t.
40 May also define off_t to a 64-bit type on native Windows. */
41#include <sys/types.h>
42
43/* Get struct timespec. */
44#include <time.h>
45
46/* The include_next requires a split double-inclusion guard. */
47#include_next <sys/stat.h>
48
49#ifndef _GL_SYS_STAT_H
50#define _GL_SYS_STAT_H
51
52/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
53/* C++ compatible function declaration macros.
54 Copyright (C) 2010-2022 Free Software Foundation, Inc.
55
56 This program is free software: you can redistribute it and/or modify it
57 under the terms of the GNU Lesser General Public License as published
58 by the Free Software Foundation; either version 2 of the License, or
59 (at your option) any later version.
60
61 This program is distributed in the hope that it will be useful,
62 but WITHOUT ANY WARRANTY; without even the implied warranty of
63 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
64 Lesser General Public License for more details.
65
66 You should have received a copy of the GNU Lesser General Public License
67 along with this program. If not, see <https://www.gnu.org/licenses/>. */
68
69#ifndef _GL_CXXDEFS_H
70#define _GL_CXXDEFS_H
71
72/* Begin/end the GNULIB_NAMESPACE namespace. */
73#if defined __cplusplus && defined GNULIB_NAMESPACE
74# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
75# define _GL_END_NAMESPACE }
76#else
77# define _GL_BEGIN_NAMESPACE
78# define _GL_END_NAMESPACE
79#endif
80
81/* The three most frequent use cases of these macros are:
82
83 * For providing a substitute for a function that is missing on some
84 platforms, but is declared and works fine on the platforms on which
85 it exists:
86
87 #if @GNULIB_FOO@
88 # if !@HAVE_FOO@
89 _GL_FUNCDECL_SYS (foo, ...);
90 # endif
91 _GL_CXXALIAS_SYS (foo, ...);
92 _GL_CXXALIASWARN (foo);
93 #elif defined GNULIB_POSIXCHECK
94 ...
95 #endif
96
97 * For providing a replacement for a function that exists on all platforms,
98 but is broken/insufficient and needs to be replaced on some platforms:
99
100 #if @GNULIB_FOO@
101 # if @REPLACE_FOO@
102 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
103 # undef foo
104 # define foo rpl_foo
105 # endif
106 _GL_FUNCDECL_RPL (foo, ...);
107 _GL_CXXALIAS_RPL (foo, ...);
108 # else
109 _GL_CXXALIAS_SYS (foo, ...);
110 # endif
111 _GL_CXXALIASWARN (foo);
112 #elif defined GNULIB_POSIXCHECK
113 ...
114 #endif
115
116 * For providing a replacement for a function that exists on some platforms
117 but is broken/insufficient and needs to be replaced on some of them and
118 is additionally either missing or undeclared on some other platforms:
119
120 #if @GNULIB_FOO@
121 # if @REPLACE_FOO@
122 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
123 # undef foo
124 # define foo rpl_foo
125 # endif
126 _GL_FUNCDECL_RPL (foo, ...);
127 _GL_CXXALIAS_RPL (foo, ...);
128 # else
129 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
130 _GL_FUNCDECL_SYS (foo, ...);
131 # endif
132 _GL_CXXALIAS_SYS (foo, ...);
133 # endif
134 _GL_CXXALIASWARN (foo);
135 #elif defined GNULIB_POSIXCHECK
136 ...
137 #endif
138*/
139
140/* _GL_EXTERN_C declaration;
141 performs the declaration with C linkage. */
142#if defined __cplusplus
143# define _GL_EXTERN_C extern "C"
144#else
145# define _GL_EXTERN_C extern
146#endif
147
148/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
149 declares a replacement function, named rpl_func, with the given prototype,
150 consisting of return type, parameters, and attributes.
151 Example:
152 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
153 _GL_ARG_NONNULL ((1)));
154 */
155#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
156 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
157#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
158 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
159
160/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
161 declares the system function, named func, with the given prototype,
162 consisting of return type, parameters, and attributes.
163 Example:
164 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
165 _GL_ARG_NONNULL ((1)));
166 */
167#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
168 _GL_EXTERN_C rettype func parameters_and_attributes
169
170/* _GL_CXXALIAS_RPL (func, rettype, parameters);
171 declares a C++ alias called GNULIB_NAMESPACE::func
172 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
173 Example:
174 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
175
176 Wrapping rpl_func in an object with an inline conversion operator
177 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
178 actually used in the program. */
179#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
180 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
181#if defined __cplusplus && defined GNULIB_NAMESPACE
182# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
183 namespace GNULIB_NAMESPACE \
184 { \
185 static const struct _gl_ ## func ## _wrapper \
186 { \
187 typedef rettype (*type) parameters; \
188 \
189 inline operator type () const \
190 { \
191 return ::rpl_func; \
192 } \
193 } func = {}; \
194 } \
195 _GL_EXTERN_C int _gl_cxxalias_dummy
196#else
197# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
198 _GL_EXTERN_C int _gl_cxxalias_dummy
199#endif
200
201/* _GL_CXXALIAS_MDA (func, rettype, parameters);
202 is to be used when func is a Microsoft deprecated alias, on native Windows.
203 It declares a C++ alias called GNULIB_NAMESPACE::func
204 that redirects to _func, if GNULIB_NAMESPACE is defined.
205 Example:
206 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
207 */
208#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
209 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
210
211/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
212 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
213 except that the C function rpl_func may have a slightly different
214 declaration. A cast is used to silence the "invalid conversion" error
215 that would otherwise occur. */
216#if defined __cplusplus && defined GNULIB_NAMESPACE
217# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
218 namespace GNULIB_NAMESPACE \
219 { \
220 static const struct _gl_ ## func ## _wrapper \
221 { \
222 typedef rettype (*type) parameters; \
223 \
224 inline operator type () const \
225 { \
226 return reinterpret_cast<type>(::rpl_func); \
227 } \
228 } func = {}; \
229 } \
230 _GL_EXTERN_C int _gl_cxxalias_dummy
231#else
232# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
233 _GL_EXTERN_C int _gl_cxxalias_dummy
234#endif
235
236/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
237 is like _GL_CXXALIAS_MDA (func, rettype, parameters);
238 except that the C function func may have a slightly different declaration.
239 A cast is used to silence the "invalid conversion" error that would
240 otherwise occur. */
241#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
242 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
243
244/* _GL_CXXALIAS_SYS (func, rettype, parameters);
245 declares a C++ alias called GNULIB_NAMESPACE::func
246 that redirects to the system provided function func, if GNULIB_NAMESPACE
247 is defined.
248 Example:
249 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
250
251 Wrapping func in an object with an inline conversion operator
252 avoids a reference to func unless GNULIB_NAMESPACE::func is
253 actually used in the program. */
254#if defined __cplusplus && defined GNULIB_NAMESPACE
255# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
256 namespace GNULIB_NAMESPACE \
257 { \
258 static const struct _gl_ ## func ## _wrapper \
259 { \
260 typedef rettype (*type) parameters; \
261 \
262 inline operator type () const \
263 { \
264 return ::func; \
265 } \
266 } func = {}; \
267 } \
268 _GL_EXTERN_C int _gl_cxxalias_dummy
269#else
270# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
271 _GL_EXTERN_C int _gl_cxxalias_dummy
272#endif
273
274/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
275 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
276 except that the C function func may have a slightly different declaration.
277 A cast is used to silence the "invalid conversion" error that would
278 otherwise occur. */
279#if defined __cplusplus && defined GNULIB_NAMESPACE
280# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
281 namespace GNULIB_NAMESPACE \
282 { \
283 static const struct _gl_ ## func ## _wrapper \
284 { \
285 typedef rettype (*type) parameters; \
286 \
287 inline operator type () const \
288 { \
289 return reinterpret_cast<type>(::func); \
290 } \
291 } func = {}; \
292 } \
293 _GL_EXTERN_C int _gl_cxxalias_dummy
294#else
295# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
296 _GL_EXTERN_C int _gl_cxxalias_dummy
297#endif
298
299/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
300 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
301 except that the C function is picked among a set of overloaded functions,
302 namely the one with rettype2 and parameters2. Two consecutive casts
303 are used to silence the "cannot find a match" and "invalid conversion"
304 errors that would otherwise occur. */
305#if defined __cplusplus && defined GNULIB_NAMESPACE
306 /* The outer cast must be a reinterpret_cast.
307 The inner cast: When the function is defined as a set of overloaded
308 functions, it works as a static_cast<>, choosing the designated variant.
309 When the function is defined as a single variant, it works as a
310 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
311# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
312 namespace GNULIB_NAMESPACE \
313 { \
314 static const struct _gl_ ## func ## _wrapper \
315 { \
316 typedef rettype (*type) parameters; \
317 \
318 inline operator type () const \
319 { \
320 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
321 } \
322 } func = {}; \
323 } \
324 _GL_EXTERN_C int _gl_cxxalias_dummy
325#else
326# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
327 _GL_EXTERN_C int _gl_cxxalias_dummy
328#endif
329
330/* _GL_CXXALIASWARN (func);
331 causes a warning to be emitted when ::func is used but not when
332 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
333 variants. */
334#if defined __cplusplus && defined GNULIB_NAMESPACE
335# define _GL_CXXALIASWARN(func) \
336 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
337# define _GL_CXXALIASWARN_1(func,namespace) \
338 _GL_CXXALIASWARN_2 (func, namespace)
339/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
340 we enable the warning only when not optimizing. */
341# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
342# define _GL_CXXALIASWARN_2(func,namespace) \
343 _GL_WARN_ON_USE (func, \
344 "The symbol ::" #func " refers to the system function. " \
345 "Use " #namespace "::" #func " instead.")
346# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
347# define _GL_CXXALIASWARN_2(func,namespace) \
348 extern __typeof__ (func) func
349# else
350# define _GL_CXXALIASWARN_2(func,namespace) \
351 _GL_EXTERN_C int _gl_cxxalias_dummy
352# endif
353#else
354# define _GL_CXXALIASWARN(func) \
355 _GL_EXTERN_C int _gl_cxxalias_dummy
356#endif
357
358/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
359 causes a warning to be emitted when the given overloaded variant of ::func
360 is used but not when GNULIB_NAMESPACE::func is used. */
361#if defined __cplusplus && defined GNULIB_NAMESPACE
362# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
363 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
364 GNULIB_NAMESPACE)
365# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
366 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
367/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
368 we enable the warning only when not optimizing. */
369# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
370# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
371 _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
372 "The symbol ::" #func " refers to the system function. " \
373 "Use " #namespace "::" #func " instead.")
374# else
375# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
376 _GL_EXTERN_C int _gl_cxxalias_dummy
377# endif
378#else
379# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
380 _GL_EXTERN_C int _gl_cxxalias_dummy
381#endif
382
383#endif /* _GL_CXXDEFS_H */
384
385/* The definition of _GL_ARG_NONNULL is copied here. */
386/* A C macro for declaring that specific arguments must not be NULL.
387 Copyright (C) 2009-2022 Free Software Foundation, Inc.
388
389 This program is free software: you can redistribute it and/or modify it
390 under the terms of the GNU Lesser General Public License as published
391 by the Free Software Foundation; either version 2 of the License, or
392 (at your option) any later version.
393
394 This program is distributed in the hope that it will be useful,
395 but WITHOUT ANY WARRANTY; without even the implied warranty of
396 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
397 Lesser General Public License for more details.
398
399 You should have received a copy of the GNU Lesser General Public License
400 along with this program. If not, see <https://www.gnu.org/licenses/>. */
401
402/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
403 that the values passed as arguments n, ..., m must be non-NULL pointers.
404 n = 1 stands for the first argument, n = 2 for the second argument etc. */
405#ifndef _GL_ARG_NONNULL
406# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
407# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
408# else
409# define _GL_ARG_NONNULL(params)
410# endif
411#endif
412
413/* The definition of _GL_WARN_ON_USE is copied here. */
414/* A C macro for emitting warnings if a function is used.
415 Copyright (C) 2010-2022 Free Software Foundation, Inc.
416
417 This program is free software: you can redistribute it and/or modify it
418 under the terms of the GNU Lesser General Public License as published
419 by the Free Software Foundation; either version 2 of the License, or
420 (at your option) any later version.
421
422 This program is distributed in the hope that it will be useful,
423 but WITHOUT ANY WARRANTY; without even the implied warranty of
424 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
425 Lesser General Public License for more details.
426
427 You should have received a copy of the GNU Lesser General Public License
428 along with this program. If not, see <https://www.gnu.org/licenses/>. */
429
430/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
431 for FUNCTION which will then trigger a compiler warning containing
432 the text of "literal string" anywhere that function is called, if
433 supported by the compiler. If the compiler does not support this
434 feature, the macro expands to an unused extern declaration.
435
436 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
437 attribute used in _GL_WARN_ON_USE. If the compiler does not support
438 this feature, it expands to empty.
439
440 These macros are useful for marking a function as a potential
441 portability trap, with the intent that "literal string" include
442 instructions on the replacement function that should be used
443 instead.
444 _GL_WARN_ON_USE is for functions with 'extern' linkage.
445 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
446 linkage.
447
448 However, one of the reasons that a function is a portability trap is
449 if it has the wrong signature. Declaring FUNCTION with a different
450 signature in C is a compilation error, so this macro must use the
451 same type as any existing declaration so that programs that avoid
452 the problematic FUNCTION do not fail to compile merely because they
453 included a header that poisoned the function. But this implies that
454 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
455 have a declaration. Use of this macro implies that there must not
456 be any other macro hiding the declaration of FUNCTION; but
457 undefining FUNCTION first is part of the poisoning process anyway
458 (although for symbols that are provided only via a macro, the result
459 is a compilation error rather than a warning containing
460 "literal string"). Also note that in C++, it is only safe to use if
461 FUNCTION has no overloads.
462
463 For an example, it is possible to poison 'getline' by:
464 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
465 [getline]) in configure.ac, which potentially defines
466 HAVE_RAW_DECL_GETLINE
467 - adding this code to a header that wraps the system <stdio.h>:
468 #undef getline
469 #if HAVE_RAW_DECL_GETLINE
470 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
471 "not universally present; use the gnulib module getline");
472 #endif
473
474 It is not possible to directly poison global variables. But it is
475 possible to write a wrapper accessor function, and poison that
476 (less common usage, like &environ, will cause a compilation error
477 rather than issue the nice warning, but the end result of informing
478 the developer about their portability problem is still achieved):
479 #if HAVE_RAW_DECL_ENVIRON
480 static char ***
481 rpl_environ (void) { return &environ; }
482 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
483 # undef environ
484 # define environ (*rpl_environ ())
485 #endif
486 or better (avoiding contradictory use of 'static' and 'extern'):
487 #if HAVE_RAW_DECL_ENVIRON
488 static char ***
489 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
490 rpl_environ (void) { return &environ; }
491 # undef environ
492 # define environ (*rpl_environ ())
493 #endif
494 */
495#ifndef _GL_WARN_ON_USE
496
497# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
498/* A compiler attribute is available in gcc versions 4.3.0 and later. */
499# define _GL_WARN_ON_USE(function, message) \
500_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
501# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
502 __attribute__ ((__warning__ (message)))
503# elif __clang_major__ >= 4
504/* Another compiler attribute is available in clang. */
505# define _GL_WARN_ON_USE(function, message) \
506_GL_WARN_EXTERN_C __typeof__ (function) function \
507 __attribute__ ((__diagnose_if__ (1, message, "warning")))
508# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
509 __attribute__ ((__diagnose_if__ (1, message, "warning")))
510# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
511/* Verify the existence of the function. */
512# define _GL_WARN_ON_USE(function, message) \
513_GL_WARN_EXTERN_C __typeof__ (function) function
514# define _GL_WARN_ON_USE_ATTRIBUTE(message)
515# else /* Unsupported. */
516# define _GL_WARN_ON_USE(function, message) \
517_GL_WARN_EXTERN_C int _gl_warn_on_use
518# define _GL_WARN_ON_USE_ATTRIBUTE(message)
519# endif
520#endif
521
522/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
523 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
524 function is declared with the given prototype, consisting of return type,
525 parameters, and attributes.
526 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
527 not work in this case. */
528#ifndef _GL_WARN_ON_USE_CXX
529# if !defined __cplusplus
530# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
531 _GL_WARN_ON_USE (function, msg)
532# else
533# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
534/* A compiler attribute is available in gcc versions 4.3.0 and later. */
535# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
536extern rettype_gcc function parameters_and_attributes \
537 __attribute__ ((__warning__ (msg)))
538# elif __clang_major__ >= 4
539/* Another compiler attribute is available in clang. */
540# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
541extern rettype_clang function parameters_and_attributes \
542 __attribute__ ((__diagnose_if__ (1, msg, "warning")))
543# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
544/* Verify the existence of the function. */
545# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
546extern rettype_gcc function parameters_and_attributes
547# else /* Unsupported. */
548# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
549_GL_WARN_EXTERN_C int _gl_warn_on_use
550# endif
551# endif
552#endif
553
554/* _GL_WARN_EXTERN_C declaration;
555 performs the declaration with C linkage. */
556#ifndef _GL_WARN_EXTERN_C
557# if defined __cplusplus
558# define _GL_WARN_EXTERN_C extern "C"
559# else
560# define _GL_WARN_EXTERN_C extern
561# endif
562#endif
563
564/* Before doing "#define mknod rpl_mknod" below, we need to include all
565 headers that may declare mknod(). OS/2 kLIBC declares mknod() in
566 <unistd.h>, not in <sys/stat.h>. */
567#ifdef __KLIBC__
568# include <unistd.h>
569#endif
570
571/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
572 headers that may declare mkdir(). Native Windows platforms declare mkdir
573 in <io.h> and/or <direct.h>, not in <sys/stat.h>. */
574#if defined _WIN32 && ! defined __CYGWIN__
575# include <io.h> /* mingw32, mingw64 */
576# include <direct.h> /* mingw64, MSVC 9 */
577#endif
578
579/* Native Windows platforms declare umask() in <io.h>. */
580#if 0 && (defined _WIN32 && ! defined __CYGWIN__)
581# include <io.h>
582#endif
583
584/* Large File Support on native Windows. */
585#if 0
586# define stat _stati64
587#endif
588
589/* Optionally, override 'struct stat' on native Windows. */
590#if 0
591
592# undef stat
593# if 1
594# define stat rpl_stat
595# else
596 /* Provoke a clear link error if stat() is used as a function and
597 module 'stat' is not in use. */
598# define stat stat_used_without_requesting_gnulib_module_stat
599# endif
600
601# if !GNULIB_defined_struct_stat
602struct stat
603{
604 dev_t st_dev;
605 ino_t st_ino;
606 mode_t st_mode;
607 nlink_t st_nlink;
608# if 0
609 uid_t st_uid;
610# else /* uid_t is not defined by default on native Windows. */
611 short st_uid;
612# endif
613# if 0
614 gid_t st_gid;
615# else /* gid_t is not defined by default on native Windows. */
616 short st_gid;
617# endif
618 dev_t st_rdev;
619 off_t st_size;
620# if 0
621 blksize_t st_blksize;
622 blkcnt_t st_blocks;
623# endif
624
625# if 0
626 struct timespec st_atim;
627 struct timespec st_mtim;
628 struct timespec st_ctim;
629# else
630 time_t st_atime;
631 time_t st_mtime;
632 time_t st_ctime;
633# endif
634};
635# if 0
636# define st_atime st_atim.tv_sec
637# define st_mtime st_mtim.tv_sec
638# define st_ctime st_ctim.tv_sec
639 /* Indicator, for gnulib internal purposes. */
640# define _GL_WINDOWS_STAT_TIMESPEC 1
641# endif
642# define GNULIB_defined_struct_stat 1
643# endif
644
645/* Other possible values of st_mode. */
646# if 0
647# define _S_IFBLK 0x6000
648# endif
649# if 0
650# define _S_IFLNK 0xA000
651# endif
652# if 0
653# define _S_IFSOCK 0xC000
654# endif
655
656#endif
657
658#ifndef S_IFIFO
659# ifdef _S_IFIFO
660# define S_IFIFO _S_IFIFO
661# endif
662#endif
663
664#ifndef S_IFMT
665# define S_IFMT 0170000
666#endif
667
668#if STAT_MACROS_BROKEN
669# undef S_ISBLK
670# undef S_ISCHR
671# undef S_ISDIR
672# undef S_ISFIFO
673# undef S_ISLNK
674# undef S_ISNAM
675# undef S_ISMPB
676# undef S_ISMPC
677# undef S_ISNWK
678# undef S_ISREG
679# undef S_ISSOCK
680#endif
681
682#ifndef S_ISBLK
683# ifdef S_IFBLK
684# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
685# else
686# define S_ISBLK(m) 0
687# endif
688#endif
689
690#ifndef S_ISCHR
691# ifdef S_IFCHR
692# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
693# else
694# define S_ISCHR(m) 0
695# endif
696#endif
697
698#ifndef S_ISDIR
699# ifdef S_IFDIR
700# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
701# else
702# define S_ISDIR(m) 0
703# endif
704#endif
705
706#ifndef S_ISDOOR /* Solaris 2.5 and up */
707# define S_ISDOOR(m) 0
708#endif
709
710#ifndef S_ISFIFO
711# ifdef S_IFIFO
712# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
713# else
714# define S_ISFIFO(m) 0
715# endif
716#endif
717
718#ifndef S_ISLNK
719# ifdef S_IFLNK
720# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
721# else
722# define S_ISLNK(m) 0
723# endif
724#endif
725
726#ifndef S_ISMPB /* V7 */
727# ifdef S_IFMPB
728# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
729# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
730# else
731# define S_ISMPB(m) 0
732# define S_ISMPC(m) 0
733# endif
734#endif
735
736#ifndef S_ISMPX /* AIX */
737# define S_ISMPX(m) 0
738#endif
739
740#ifndef S_ISNAM /* Xenix */
741# ifdef S_IFNAM
742# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
743# else
744# define S_ISNAM(m) 0
745# endif
746#endif
747
748#ifndef S_ISNWK /* HP/UX */
749# ifdef S_IFNWK
750# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
751# else
752# define S_ISNWK(m) 0
753# endif
754#endif
755
756#ifndef S_ISPORT /* Solaris 10 and up */
757# define S_ISPORT(m) 0
758#endif
759
760#ifndef S_ISREG
761# ifdef S_IFREG
762# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
763# else
764# define S_ISREG(m) 0
765# endif
766#endif
767
768#ifndef S_ISSOCK
769# ifdef S_IFSOCK
770# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
771# else
772# define S_ISSOCK(m) 0
773# endif
774#endif
775
776
777#ifndef S_TYPEISMQ
778# define S_TYPEISMQ(p) 0
779#endif
780
781#ifndef S_TYPEISTMO
782# define S_TYPEISTMO(p) 0
783#endif
784
785
786#ifndef S_TYPEISSEM
787# ifdef S_INSEM
788# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
789# else
790# define S_TYPEISSEM(p) 0
791# endif
792#endif
793
794#ifndef S_TYPEISSHM
795# ifdef S_INSHD
796# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
797# else
798# define S_TYPEISSHM(p) 0
799# endif
800#endif
801
802/* high performance ("contiguous data") */
803#ifndef S_ISCTG
804# define S_ISCTG(p) 0
805#endif
806
807/* Cray DMF (data migration facility): off line, with data */
808#ifndef S_ISOFD
809# define S_ISOFD(p) 0
810#endif
811
812/* Cray DMF (data migration facility): off line, with no data */
813#ifndef S_ISOFL
814# define S_ISOFL(p) 0
815#endif
816
817/* 4.4BSD whiteout */
818#ifndef S_ISWHT
819# define S_ISWHT(m) 0
820#endif
821
822/* If any of the following are undefined,
823 define them to their de facto standard values. */
824#if !S_ISUID
825# define S_ISUID 04000
826#endif
827#if !S_ISGID
828# define S_ISGID 02000
829#endif
830
831/* S_ISVTX is a common extension to POSIX. */
832#ifndef S_ISVTX
833# define S_ISVTX 01000
834#endif
835
836#if !S_IRUSR && S_IREAD
837# define S_IRUSR S_IREAD
838#endif
839#if !S_IRUSR
840# define S_IRUSR 00400
841#endif
842#if !S_IRGRP
843# define S_IRGRP (S_IRUSR >> 3)
844#endif
845#if !S_IROTH
846# define S_IROTH (S_IRUSR >> 6)
847#endif
848
849#if !S_IWUSR && S_IWRITE
850# define S_IWUSR S_IWRITE
851#endif
852#if !S_IWUSR
853# define S_IWUSR 00200
854#endif
855#if !S_IWGRP
856# define S_IWGRP (S_IWUSR >> 3)
857#endif
858#if !S_IWOTH
859# define S_IWOTH (S_IWUSR >> 6)
860#endif
861
862#if !S_IXUSR && S_IEXEC
863# define S_IXUSR S_IEXEC
864#endif
865#if !S_IXUSR
866# define S_IXUSR 00100
867#endif
868#if !S_IXGRP
869# define S_IXGRP (S_IXUSR >> 3)
870#endif
871#if !S_IXOTH
872# define S_IXOTH (S_IXUSR >> 6)
873#endif
874
875#if !S_IRWXU
876# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
877#endif
878#if !S_IRWXG
879# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
880#endif
881#if !S_IRWXO
882# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
883#endif
884
885/* Although S_IXUGO and S_IRWXUGO are not specified by POSIX and are
886 not implemented in GNU/Linux, some Gnulib-using apps use the macros. */
887#if !S_IXUGO
888# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
889#endif
890#ifndef S_IRWXUGO
891# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
892#endif
893
894/* Macros for futimens and utimensat. */
895#ifndef UTIME_NOW
896# define UTIME_NOW (-1)
897# define UTIME_OMIT (-2)
898#endif
899
900
901#if 0
902# if 0
903# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
904# undef chmod
905# define chmod rpl_chmod
906# endif
907_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode)
908 _GL_ARG_NONNULL ((1)));
909_GL_CXXALIAS_RPL (chmod, int, (const char *filename, mode_t mode));
910# elif defined _WIN32 && !defined __CYGWIN__
911# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
912# undef chmod
913# define chmod _chmod
914# endif
915/* Need to cast, because in mingw the last argument is 'int mode'. */
916_GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
917# else
918_GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
919# endif
920_GL_CXXALIASWARN (chmod);
921#elif defined GNULIB_POSIXCHECK
922# undef chmod
923# if HAVE_RAW_DECL_CHMOD
924_GL_WARN_ON_USE (chmod, "chmod has portability problems - "
925 "use gnulib module chmod for portability");
926# endif
927#elif 1
928/* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not
929 required. In C++ with GNULIB_NAMESPACE, avoid differences between
930 platforms by defining GNULIB_NAMESPACE::chmod always. */
931# if defined _WIN32 && !defined __CYGWIN__
932# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
933# undef chmod
934# define chmod _chmod
935# endif
936/* Need to cast, because in mingw the last argument is 'int mode'. */
937_GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
938# else
939_GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
940# endif
941_GL_CXXALIASWARN (chmod);
942#endif
943
944
945#if 0
946# if 0
947# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
948# undef fchmodat
949# define fchmodat rpl_fchmodat
950# endif
951_GL_FUNCDECL_RPL (fchmodat, int,
952 (int fd, char const *file, mode_t mode, int flag)
953 _GL_ARG_NONNULL ((2)));
954_GL_CXXALIAS_RPL (fchmodat, int,
955 (int fd, char const *file, mode_t mode, int flag));
956# else
957# if !1
958_GL_FUNCDECL_SYS (fchmodat, int,
959 (int fd, char const *file, mode_t mode, int flag)
960 _GL_ARG_NONNULL ((2)));
961# endif
962_GL_CXXALIAS_SYS (fchmodat, int,
963 (int fd, char const *file, mode_t mode, int flag));
964# endif
965_GL_CXXALIASWARN (fchmodat);
966#elif defined GNULIB_POSIXCHECK
967# undef fchmodat
968# if HAVE_RAW_DECL_FCHMODAT
969_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
970 "use gnulib module openat for portability");
971# endif
972#endif
973
974
975#if 1
976# if 0
977# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
978# undef fstat
979# define fstat rpl_fstat
980# endif
981_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
982_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
983# else
984_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
985# endif
986# if __GLIBC__ >= 2
987_GL_CXXALIASWARN (fstat);
988# endif
989#elif 0
990# undef fstat
991# define fstat fstat_used_without_requesting_gnulib_module_fstat
992#elif 0
993/* Above, we define stat to _stati64. */
994# define fstat _fstati64
995#elif defined GNULIB_POSIXCHECK
996# undef fstat
997# if HAVE_RAW_DECL_FSTAT
998_GL_WARN_ON_USE (fstat, "fstat has portability problems - "
999 "use gnulib module fstat for portability");
1000# endif
1001#endif
1002
1003
1004#if 0
1005# if 0
1006# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1007# undef fstatat
1008# define fstatat rpl_fstatat
1009# endif
1010_GL_FUNCDECL_RPL (fstatat, int,
1011 (int fd, char const *restrict name, struct stat *restrict st,
1012 int flags)
1013 _GL_ARG_NONNULL ((2, 3)));
1014_GL_CXXALIAS_RPL (fstatat, int,
1015 (int fd, char const *restrict name, struct stat *restrict st,
1016 int flags));
1017# else
1018# if !1
1019_GL_FUNCDECL_SYS (fstatat, int,
1020 (int fd, char const *restrict name, struct stat *restrict st,
1021 int flags)
1022 _GL_ARG_NONNULL ((2, 3)));
1023# endif
1024_GL_CXXALIAS_SYS (fstatat, int,
1025 (int fd, char const *restrict name, struct stat *restrict st,
1026 int flags));
1027# endif
1028_GL_CXXALIASWARN (fstatat);
1029#elif 0
1030# undef fstatat
1031# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
1032#elif defined GNULIB_POSIXCHECK
1033# undef fstatat
1034# if HAVE_RAW_DECL_FSTATAT
1035_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
1036 "use gnulib module openat for portability");
1037# endif
1038#endif
1039
1040
1041#if 0
1042/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
1043 implementation relies on futimesat, which on Solaris 10 makes an invocation
1044 to futimens that is meant to invoke the libc's futimens(), not gnulib's
1045 futimens(). */
1046# if 0 || (!1 && defined __sun)
1047# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1048# undef futimens
1049# define futimens rpl_futimens
1050# endif
1051_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
1052_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
1053# else
1054# if !1
1055_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
1056# endif
1057_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
1058# endif
1059# if 1
1060_GL_CXXALIASWARN (futimens);
1061# endif
1062#elif defined GNULIB_POSIXCHECK
1063# undef futimens
1064# if HAVE_RAW_DECL_FUTIMENS
1065_GL_WARN_ON_USE (futimens, "futimens is not portable - "
1066 "use gnulib module futimens for portability");
1067# endif
1068#endif
1069
1070
1071#if 0
1072# if !1
1073_GL_FUNCDECL_SYS (getumask, mode_t, (void));
1074# endif
1075_GL_CXXALIAS_SYS (getumask, mode_t, (void));
1076# if 1
1077_GL_CXXALIASWARN (getumask);
1078# endif
1079#elif defined GNULIB_POSIXCHECK
1080# undef getumask
1081# if HAVE_RAW_DECL_GETUMASK
1082_GL_WARN_ON_USE (getumask, "getumask is not portable - "
1083 "use gnulib module getumask for portability");
1084# endif
1085#endif
1086
1087
1088#if 0
1089/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
1090 denotes a symbolic link. */
1091# if !1 || defined __hpux
1092_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
1093 _GL_ARG_NONNULL ((1)));
1094# endif
1095_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
1096_GL_CXXALIASWARN (lchmod);
1097#elif defined GNULIB_POSIXCHECK
1098# undef lchmod
1099# if HAVE_RAW_DECL_LCHMOD
1100_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
1101 "use gnulib module lchmod for portability");
1102# endif
1103#endif
1104
1105
1106#if 0
1107# if ! 1
1108/* mingw does not support symlinks, therefore it does not have lstat. But
1109 without links, stat does just fine. */
1110# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1111# define lstat stat
1112# endif
1113_GL_CXXALIAS_RPL_1 (lstat, stat, int,
1114 (const char *restrict name, struct stat *restrict buf));
1115# elif 0
1116# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1117# undef lstat
1118# define lstat rpl_lstat
1119# endif
1120_GL_FUNCDECL_RPL (lstat, int,
1121 (const char *restrict name, struct stat *restrict buf)
1122 _GL_ARG_NONNULL ((1, 2)));
1123_GL_CXXALIAS_RPL (lstat, int,
1124 (const char *restrict name, struct stat *restrict buf));
1125# else
1126_GL_CXXALIAS_SYS (lstat, int,
1127 (const char *restrict name, struct stat *restrict buf));
1128# endif
1129# if 1
1130_GL_CXXALIASWARN (lstat);
1131# endif
1132#elif 0
1133# undef lstat
1134# define lstat lstat_used_without_requesting_gnulib_module_lstat
1135#elif defined GNULIB_POSIXCHECK
1136# undef lstat
1137# if HAVE_RAW_DECL_LSTAT
1138_GL_WARN_ON_USE (lstat, "lstat is unportable - "
1139 "use gnulib module lstat for portability");
1140# endif
1141#endif
1142
1143
1144#if 0
1145# if 0
1146# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1147# undef mkdir
1148# define mkdir rpl_mkdir
1149# endif
1150_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
1151 _GL_ARG_NONNULL ((1)));
1152_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
1153# elif defined _WIN32 && !defined __CYGWIN__
1154/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
1155 Additionally, it declares _mkdir (and depending on compile flags, an
1156 alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
1157 which are included above. */
1158# if !GNULIB_defined_rpl_mkdir
1159static int
1160rpl_mkdir (char const *name, mode_t mode)
1161{
1162 return _mkdir (name);
1163}
1164# define GNULIB_defined_rpl_mkdir 1
1165# endif
1166# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1167# undef mkdir
1168# define mkdir rpl_mkdir
1169# endif
1170_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
1171# else
1172_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
1173# endif
1174_GL_CXXALIASWARN (mkdir);
1175#elif defined GNULIB_POSIXCHECK
1176# undef mkdir
1177# if HAVE_RAW_DECL_MKDIR
1178_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - "
1179 "use gnulib module mkdir for portability");
1180# endif
1181#elif 1
1182/* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not
1183 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1184 platforms by defining GNULIB_NAMESPACE::mkdir always. */
1185# if defined _WIN32 && !defined __CYGWIN__
1186# if !GNULIB_defined_rpl_mkdir
1187static int
1188rpl_mkdir (char const *name, mode_t mode)
1189{
1190 return _mkdir (name);
1191}
1192# define GNULIB_defined_rpl_mkdir 1
1193# endif
1194# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1195# undef mkdir
1196# define mkdir rpl_mkdir
1197# endif
1198_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
1199# else
1200_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
1201# endif
1202_GL_CXXALIASWARN (mkdir);
1203#endif
1204
1205
1206#if 0
1207# if !1
1208_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
1209 _GL_ARG_NONNULL ((2)));
1210# endif
1211_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
1212_GL_CXXALIASWARN (mkdirat);
1213#elif defined GNULIB_POSIXCHECK
1214# undef mkdirat
1215# if HAVE_RAW_DECL_MKDIRAT
1216_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
1217 "use gnulib module openat for portability");
1218# endif
1219#endif
1220
1221
1222#if 0
1223# if 0
1224# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1225# undef mkfifo
1226# define mkfifo rpl_mkfifo
1227# endif
1228_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
1229 _GL_ARG_NONNULL ((1)));
1230_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
1231# else
1232# if !1
1233_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
1234 _GL_ARG_NONNULL ((1)));
1235# endif
1236_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
1237# endif
1238_GL_CXXALIASWARN (mkfifo);
1239#elif defined GNULIB_POSIXCHECK
1240# undef mkfifo
1241# if HAVE_RAW_DECL_MKFIFO
1242_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
1243 "use gnulib module mkfifo for portability");
1244# endif
1245#endif
1246
1247
1248#if 0
1249# if 0
1250# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1251# undef mkfifoat
1252# define mkfifoat rpl_mkfifoat
1253# endif
1254_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)
1255 _GL_ARG_NONNULL ((2)));
1256_GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode));
1257# else
1258# if !1
1259_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
1260 _GL_ARG_NONNULL ((2)));
1261# endif
1262_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
1263# endif
1264_GL_CXXALIASWARN (mkfifoat);
1265#elif defined GNULIB_POSIXCHECK
1266# undef mkfifoat
1267# if HAVE_RAW_DECL_MKFIFOAT
1268_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
1269 "use gnulib module mkfifoat for portability");
1270# endif
1271#endif
1272
1273
1274#if 0
1275# if 0
1276# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1277# undef mknod
1278# define mknod rpl_mknod
1279# endif
1280_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
1281 _GL_ARG_NONNULL ((1)));
1282_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
1283# else
1284# if !1
1285_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
1286 _GL_ARG_NONNULL ((1)));
1287# endif
1288/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
1289_GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
1290# endif
1291_GL_CXXALIASWARN (mknod);
1292#elif defined GNULIB_POSIXCHECK
1293# undef mknod
1294# if HAVE_RAW_DECL_MKNOD
1295_GL_WARN_ON_USE (mknod, "mknod is not portable - "
1296 "use gnulib module mknod for portability");
1297# endif
1298#endif
1299
1300
1301#if 0
1302# if 0
1303# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1304# undef mknodat
1305# define mknodat rpl_mknodat
1306# endif
1307_GL_FUNCDECL_RPL (mknodat, int,
1308 (int fd, char const *file, mode_t mode, dev_t dev)
1309 _GL_ARG_NONNULL ((2)));
1310_GL_CXXALIAS_RPL (mknodat, int,
1311 (int fd, char const *file, mode_t mode, dev_t dev));
1312# else
1313# if !1
1314_GL_FUNCDECL_SYS (mknodat, int,
1315 (int fd, char const *file, mode_t mode, dev_t dev)
1316 _GL_ARG_NONNULL ((2)));
1317# endif
1318_GL_CXXALIAS_SYS (mknodat, int,
1319 (int fd, char const *file, mode_t mode, dev_t dev));
1320# endif
1321_GL_CXXALIASWARN (mknodat);
1322#elif defined GNULIB_POSIXCHECK
1323# undef mknodat
1324# if HAVE_RAW_DECL_MKNODAT
1325_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
1326 "use gnulib module mkfifoat for portability");
1327# endif
1328#endif
1329
1330
1331#if 1
1332# if 0
1333# if !0
1334 /* We can't use the object-like #define stat rpl_stat, because of
1335 struct stat. This means that rpl_stat will not be used if the user
1336 does (stat)(a,b). Oh well. */
1337# if defined _AIX && defined stat && defined _LARGE_FILES
1338 /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
1339 so we have to replace stat64() instead of stat(). */
1340# undef stat64
1341# define stat64(name, st) rpl_stat (name, st)
1342# elif 0
1343 /* Above, we define stat to _stati64. */
1344# if defined __MINGW32__ && defined _stati64
1345# ifndef _USE_32BIT_TIME_T
1346 /* The system headers define _stati64 to _stat64. */
1347# undef _stat64
1348# define _stat64(name, st) rpl_stat (name, st)
1349# endif
1350# elif defined _MSC_VER && defined _stati64
1351# ifdef _USE_32BIT_TIME_T
1352 /* The system headers define _stati64 to _stat32i64. */
1353# undef _stat32i64
1354# define _stat32i64(name, st) rpl_stat (name, st)
1355# else
1356 /* The system headers define _stati64 to _stat64. */
1357# undef _stat64
1358# define _stat64(name, st) rpl_stat (name, st)
1359# endif
1360# else
1361# undef _stati64
1362# define _stati64(name, st) rpl_stat (name, st)
1363# endif
1364# elif defined __MINGW32__ && defined stat
1365# ifdef _USE_32BIT_TIME_T
1366 /* The system headers define stat to _stat32i64. */
1367# undef _stat32i64
1368# define _stat32i64(name, st) rpl_stat (name, st)
1369# else
1370 /* The system headers define stat to _stat64. */
1371# undef _stat64
1372# define _stat64(name, st) rpl_stat (name, st)
1373# endif
1374# elif defined _MSC_VER && defined stat
1375# ifdef _USE_32BIT_TIME_T
1376 /* The system headers define stat to _stat32. */
1377# undef _stat32
1378# define _stat32(name, st) rpl_stat (name, st)
1379# else
1380 /* The system headers define stat to _stat64i32. */
1381# undef _stat64i32
1382# define _stat64i32(name, st) rpl_stat (name, st)
1383# endif
1384# else /* !(_AIX || __MINGW32__ || _MSC_VER) */
1385# undef stat
1386# define stat(name, st) rpl_stat (name, st)
1387# endif /* !_LARGE_FILES */
1388# endif /* !0 */
1389_GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf)
1390 _GL_ARG_NONNULL ((1, 2));
1391# endif
1392#elif 0
1393/* see above:
1394 #define stat stat_used_without_requesting_gnulib_module_stat
1395 */
1396#elif defined GNULIB_POSIXCHECK
1397# undef stat
1398# if HAVE_RAW_DECL_STAT
1399_GL_WARN_ON_USE (stat, "stat is unportable - "
1400 "use gnulib module stat for portability");
1401# endif
1402#endif
1403
1404
1405#if 1
1406/* On native Windows, map 'umask' to '_umask', so that -loldnames is not
1407 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1408 platforms by defining GNULIB_NAMESPACE::umask always. */
1409# if defined _WIN32 && !defined __CYGWIN__
1410# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1411# undef umask
1412# define umask _umask
1413# endif
1414/* Need to cast, because in mingw the last argument is 'int mode'. */
1415_GL_CXXALIAS_MDA_CAST (umask, mode_t, (mode_t mask));
1416# else
1417_GL_CXXALIAS_SYS (umask, mode_t, (mode_t mask));
1418# endif
1419_GL_CXXALIASWARN (umask);
1420#endif
1421
1422
1423#if 0
1424/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
1425 implementation relies on futimesat, which on Solaris 10 makes an invocation
1426 to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
1427 utimensat(). */
1428# if 0 || (!1 && defined __sun)
1429# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1430# undef utimensat
1431# define utimensat rpl_utimensat
1432# endif
1433_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
1434 struct timespec const times[2], int flag)
1435 _GL_ARG_NONNULL ((2)));
1436_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
1437 struct timespec const times[2], int flag));
1438# else
1439# if !1
1440_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
1441 struct timespec const times[2], int flag)
1442 _GL_ARG_NONNULL ((2)));
1443# endif
1444_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
1445 struct timespec const times[2], int flag));
1446# endif
1447# if 1
1448_GL_CXXALIASWARN (utimensat);
1449# endif
1450#elif defined GNULIB_POSIXCHECK
1451# undef utimensat
1452# if HAVE_RAW_DECL_UTIMENSAT
1453_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
1454 "use gnulib module utimensat for portability");
1455# endif
1456#endif
1457
1458
1459#endif /* _GL_SYS_STAT_H */
1460#endif /* _GL_SYS_STAT_H */
1461#endif
diff --git a/gl/sys/types.h b/gl/sys/types.h
new file mode 100644
index 0000000..d720b9d
--- /dev/null
+++ b/gl/sys/types.h
@@ -0,0 +1,107 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Provide a more complete sys/types.h.
3
4 Copyright (C) 2011-2022 Free Software Foundation, Inc.
5
6 This file is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
10
11 This file is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18
19#if __GNUC__ >= 3
20#pragma GCC system_header
21#endif
22
23
24#if defined _WIN32 && !defined __CYGWIN__ \
25 && (defined __need_off_t || defined __need___off64_t \
26 || defined __need_ssize_t || defined __need_time_t)
27
28/* Special invocation convention inside mingw header files. */
29
30#include_next <sys/types.h>
31
32#else
33/* Normal invocation convention. */
34
35#ifndef _GL_SYS_TYPES_H
36
37/* The include_next requires a split double-inclusion guard. */
38# define _GL_INCLUDING_SYS_TYPES_H
39#include_next <sys/types.h>
40# undef _GL_INCLUDING_SYS_TYPES_H
41
42#ifndef _GL_SYS_TYPES_H
43#define _GL_SYS_TYPES_H
44
45/* Override off_t if Large File Support is requested on native Windows. */
46#if 0
47/* Same as int64_t in <stdint.h>. */
48# if defined _MSC_VER
49# define off_t __int64
50# else
51# define off_t long long int
52# endif
53/* Indicator, for gnulib internal purposes. */
54# define _GL_WINDOWS_64_BIT_OFF_T 1
55#endif
56
57/* Override dev_t and ino_t if distinguishable inodes support is requested
58 on native Windows. */
59#if 0
60
61# if 0 == 2
62/* Experimental, not useful in Windows 10. */
63
64/* Define dev_t to a 64-bit type. */
65# if !defined GNULIB_defined_dev_t
66typedef unsigned long long int rpl_dev_t;
67# undef dev_t
68# define dev_t rpl_dev_t
69# define GNULIB_defined_dev_t 1
70# endif
71
72/* Define ino_t to a 128-bit type. */
73# if !defined GNULIB_defined_ino_t
74/* MSVC does not have a 128-bit integer type.
75 GCC has a 128-bit integer type __int128, but only on 64-bit targets. */
76typedef struct { unsigned long long int _gl_ino[2]; } rpl_ino_t;
77# undef ino_t
78# define ino_t rpl_ino_t
79# define GNULIB_defined_ino_t 1
80# endif
81
82# else /* 0 == 1 */
83
84/* Define ino_t to a 64-bit type. */
85# if !defined GNULIB_defined_ino_t
86typedef unsigned long long int rpl_ino_t;
87# undef ino_t
88# define ino_t rpl_ino_t
89# define GNULIB_defined_ino_t 1
90# endif
91
92# endif
93
94/* Indicator, for gnulib internal purposes. */
95# define _GL_WINDOWS_STAT_INODES 0
96
97#endif
98
99/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */
100/* But avoid namespace pollution on glibc systems. */
101#if (defined _WIN32 && ! defined __CYGWIN__) && ! defined __GLIBC__
102# include <stddef.h>
103#endif
104
105#endif /* _GL_SYS_TYPES_H */
106#endif /* _GL_SYS_TYPES_H */
107#endif /* __need_XXX */
diff --git a/gl/sys/uio.h b/gl/sys/uio.h
new file mode 100644
index 0000000..21280cb
--- /dev/null
+++ b/gl/sys/uio.h
@@ -0,0 +1,64 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Substitute for <sys/uio.h>.
3 Copyright (C) 2011-2022 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18# if __GNUC__ >= 3
19#pragma GCC system_header
20# endif
21
22
23#ifndef _GL_SYS_UIO_H
24
25#if 1
26
27/* On OpenBSD 4.4, <sys/uio.h> assumes prior inclusion of <sys/types.h>. */
28# include <sys/types.h>
29
30/* The include_next requires a split double-inclusion guard. */
31# include_next <sys/uio.h>
32
33#endif
34
35#ifndef _GL_SYS_UIO_H
36#define _GL_SYS_UIO_H
37
38#if !1
39/* A platform that lacks <sys/uio.h>. */
40/* Get 'size_t' and 'ssize_t'. */
41# include <sys/types.h>
42
43# ifdef __cplusplus
44extern "C" {
45# endif
46
47# if !GNULIB_defined_struct_iovec
48/* All known platforms that lack <sys/uio.h> also lack any declaration
49 of struct iovec in any other header. */
50struct iovec {
51 void *iov_base;
52 size_t iov_len;
53};
54# define GNULIB_defined_struct_iovec 1
55# endif
56
57# ifdef __cplusplus
58}
59# endif
60
61#endif
62
63#endif /* _GL_SYS_UIO_H */
64#endif /* _GL_SYS_UIO_H */
diff --git a/gl/warn-on-use.h b/gl/warn-on-use.h
new file mode 100644
index 0000000..94f5b92
--- /dev/null
+++ b/gl/warn-on-use.h
@@ -0,0 +1,149 @@
1/* A C macro for emitting warnings if a function is used.
2 Copyright (C) 2010-2022 Free Software Foundation, Inc.
3
4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU Lesser General Public License as published
6 by the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
18 for FUNCTION which will then trigger a compiler warning containing
19 the text of "literal string" anywhere that function is called, if
20 supported by the compiler. If the compiler does not support this
21 feature, the macro expands to an unused extern declaration.
22
23 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
24 attribute used in _GL_WARN_ON_USE. If the compiler does not support
25 this feature, it expands to empty.
26
27 These macros are useful for marking a function as a potential
28 portability trap, with the intent that "literal string" include
29 instructions on the replacement function that should be used
30 instead.
31 _GL_WARN_ON_USE is for functions with 'extern' linkage.
32 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
33 linkage.
34
35 However, one of the reasons that a function is a portability trap is
36 if it has the wrong signature. Declaring FUNCTION with a different
37 signature in C is a compilation error, so this macro must use the
38 same type as any existing declaration so that programs that avoid
39 the problematic FUNCTION do not fail to compile merely because they
40 included a header that poisoned the function. But this implies that
41 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
42 have a declaration. Use of this macro implies that there must not
43 be any other macro hiding the declaration of FUNCTION; but
44 undefining FUNCTION first is part of the poisoning process anyway
45 (although for symbols that are provided only via a macro, the result
46 is a compilation error rather than a warning containing
47 "literal string"). Also note that in C++, it is only safe to use if
48 FUNCTION has no overloads.
49
50 For an example, it is possible to poison 'getline' by:
51 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
52 [getline]) in configure.ac, which potentially defines
53 HAVE_RAW_DECL_GETLINE
54 - adding this code to a header that wraps the system <stdio.h>:
55 #undef getline
56 #if HAVE_RAW_DECL_GETLINE
57 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
58 "not universally present; use the gnulib module getline");
59 #endif
60
61 It is not possible to directly poison global variables. But it is
62 possible to write a wrapper accessor function, and poison that
63 (less common usage, like &environ, will cause a compilation error
64 rather than issue the nice warning, but the end result of informing
65 the developer about their portability problem is still achieved):
66 #if HAVE_RAW_DECL_ENVIRON
67 static char ***
68 rpl_environ (void) { return &environ; }
69 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
70 # undef environ
71 # define environ (*rpl_environ ())
72 #endif
73 or better (avoiding contradictory use of 'static' and 'extern'):
74 #if HAVE_RAW_DECL_ENVIRON
75 static char ***
76 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
77 rpl_environ (void) { return &environ; }
78 # undef environ
79 # define environ (*rpl_environ ())
80 #endif
81 */
82#ifndef _GL_WARN_ON_USE
83
84# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
85/* A compiler attribute is available in gcc versions 4.3.0 and later. */
86# define _GL_WARN_ON_USE(function, message) \
87_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
88# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
89 __attribute__ ((__warning__ (message)))
90# elif __clang_major__ >= 4
91/* Another compiler attribute is available in clang. */
92# define _GL_WARN_ON_USE(function, message) \
93_GL_WARN_EXTERN_C __typeof__ (function) function \
94 __attribute__ ((__diagnose_if__ (1, message, "warning")))
95# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
96 __attribute__ ((__diagnose_if__ (1, message, "warning")))
97# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
98/* Verify the existence of the function. */
99# define _GL_WARN_ON_USE(function, message) \
100_GL_WARN_EXTERN_C __typeof__ (function) function
101# define _GL_WARN_ON_USE_ATTRIBUTE(message)
102# else /* Unsupported. */
103# define _GL_WARN_ON_USE(function, message) \
104_GL_WARN_EXTERN_C int _gl_warn_on_use
105# define _GL_WARN_ON_USE_ATTRIBUTE(message)
106# endif
107#endif
108
109/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
110 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
111 function is declared with the given prototype, consisting of return type,
112 parameters, and attributes.
113 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
114 not work in this case. */
115#ifndef _GL_WARN_ON_USE_CXX
116# if !defined __cplusplus
117# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
118 _GL_WARN_ON_USE (function, msg)
119# else
120# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
121/* A compiler attribute is available in gcc versions 4.3.0 and later. */
122# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
123extern rettype_gcc function parameters_and_attributes \
124 __attribute__ ((__warning__ (msg)))
125# elif __clang_major__ >= 4
126/* Another compiler attribute is available in clang. */
127# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
128extern rettype_clang function parameters_and_attributes \
129 __attribute__ ((__diagnose_if__ (1, msg, "warning")))
130# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
131/* Verify the existence of the function. */
132# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
133extern rettype_gcc function parameters_and_attributes
134# else /* Unsupported. */
135# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
136_GL_WARN_EXTERN_C int _gl_warn_on_use
137# endif
138# endif
139#endif
140
141/* _GL_WARN_EXTERN_C declaration;
142 performs the declaration with C linkage. */
143#ifndef _GL_WARN_EXTERN_C
144# if defined __cplusplus
145# define _GL_WARN_EXTERN_C extern "C"
146# else
147# define _GL_WARN_EXTERN_C extern
148# endif
149#endif