1 /* This file is automatically generated.  DO NOT EDIT! */
2 /* Generated from: NetBSD: mknative-gdb,v 1.12 2020/09/17 16:54:31 christos Exp  */
3 /* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp  */
4 
5 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
6 /* A GNU-like <dirent.h>.
7    Copyright (C) 2006-2020 Free Software Foundation, Inc.
8 
9    This program is free software: you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
21 
22 #ifndef _GL_DIRENT_H
23 
24 #if __GNUC__ >= 3
25 #pragma GCC system_header
26 #endif
27 
28 
29 /* The include_next requires a split double-inclusion guard.  */
30 #if 1
31 # include_next <dirent.h>
32 #endif
33 
34 #ifndef _GL_DIRENT_H
35 #define _GL_DIRENT_H
36 
37 /* Get ino_t.  Needed on some systems, including glibc 2.8.  */
38 #include <sys/types.h>
39 
40 #if !1
41 /* Define types DIR and 'struct dirent'.  */
42 # if !GNULIB_defined_struct_dirent
43 struct dirent
44 {
45   char d_type;
46   char d_name[1];
47 };
48 /* Possible values for 'd_type'.  */
49 #  define DT_UNKNOWN 0
50 #  define DT_FIFO    1          /* FIFO */
51 #  define DT_CHR     2          /* character device */
52 #  define DT_DIR     4          /* directory */
53 #  define DT_BLK     6          /* block device */
54 #  define DT_REG     8          /* regular file */
55 #  define DT_LNK    10          /* symbolic link */
56 #  define DT_SOCK   12          /* socket */
57 #  define DT_WHT    14          /* whiteout */
58 typedef struct gl_directory DIR;
59 #  define GNULIB_defined_struct_dirent 1
60 # endif
61 #endif
62 
63 /* The __attribute__ feature is available in gcc versions 2.5 and later.
64    The attribute __pure__ was added in gcc 2.96.  */
65 #ifndef _GL_ATTRIBUTE_PURE
66 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
67 #  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
68 # else
69 #  define _GL_ATTRIBUTE_PURE /* empty */
70 # endif
71 #endif
72 
73 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
74 /* C++ compatible function declaration macros.
75    Copyright (C) 2010-2020 Free Software Foundation, Inc.
76 
77    This program is free software: you can redistribute it and/or modify it
78    under the terms of the GNU General Public License as published
79    by the Free Software Foundation; either version 3 of the License, or
80    (at your option) any later version.
81 
82    This program is distributed in the hope that it will be useful,
83    but WITHOUT ANY WARRANTY; without even the implied warranty of
84    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
85    General Public License for more details.
86 
87    You should have received a copy of the GNU General Public License
88    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
89 
90 #ifndef _GL_CXXDEFS_H
91 #define _GL_CXXDEFS_H
92 
93 /* Begin/end the GNULIB_NAMESPACE namespace.  */
94 #if defined __cplusplus && defined GNULIB_NAMESPACE
95 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
96 # define _GL_END_NAMESPACE }
97 #else
98 # define _GL_BEGIN_NAMESPACE
99 # define _GL_END_NAMESPACE
100 #endif
101 
102 /* The three most frequent use cases of these macros are:
103 
104    * For providing a substitute for a function that is missing on some
105      platforms, but is declared and works fine on the platforms on which
106      it exists:
107 
108        #if @GNULIB_FOO@
109        # if !@HAVE_FOO@
110        _GL_FUNCDECL_SYS (foo, ...);
111        # endif
112        _GL_CXXALIAS_SYS (foo, ...);
113        _GL_CXXALIASWARN (foo);
114        #elif defined GNULIB_POSIXCHECK
115        ...
116        #endif
117 
118    * For providing a replacement for a function that exists on all platforms,
119      but is broken/insufficient and needs to be replaced on some platforms:
120 
121        #if @GNULIB_FOO@
122        # if @REPLACE_FOO@
123        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
124        #   undef foo
125        #   define foo rpl_foo
126        #  endif
127        _GL_FUNCDECL_RPL (foo, ...);
128        _GL_CXXALIAS_RPL (foo, ...);
129        # else
130        _GL_CXXALIAS_SYS (foo, ...);
131        # endif
132        _GL_CXXALIASWARN (foo);
133        #elif defined GNULIB_POSIXCHECK
134        ...
135        #endif
136 
137    * For providing a replacement for a function that exists on some platforms
138      but is broken/insufficient and needs to be replaced on some of them and
139      is additionally either missing or undeclared on some other platforms:
140 
141        #if @GNULIB_FOO@
142        # if @REPLACE_FOO@
143        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
144        #   undef foo
145        #   define foo rpl_foo
146        #  endif
147        _GL_FUNCDECL_RPL (foo, ...);
148        _GL_CXXALIAS_RPL (foo, ...);
149        # else
150        #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
151        _GL_FUNCDECL_SYS (foo, ...);
152        #  endif
153        _GL_CXXALIAS_SYS (foo, ...);
154        # endif
155        _GL_CXXALIASWARN (foo);
156        #elif defined GNULIB_POSIXCHECK
157        ...
158        #endif
159 */
160 
161 /* _GL_EXTERN_C declaration;
162    performs the declaration with C linkage.  */
163 #if defined __cplusplus
164 # define _GL_EXTERN_C extern "C"
165 #else
166 # define _GL_EXTERN_C extern
167 #endif
168 
169 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
170    declares a replacement function, named rpl_func, with the given prototype,
171    consisting of return type, parameters, and attributes.
172    Example:
173      _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
174                                   _GL_ARG_NONNULL ((1)));
175  */
176 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
177   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
178 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
179   _GL_EXTERN_C rettype rpl_func parameters_and_attributes
180 
181 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
182    declares the system function, named func, with the given prototype,
183    consisting of return type, parameters, and attributes.
184    Example:
185      _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
186                                   _GL_ARG_NONNULL ((1)));
187  */
188 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
189   _GL_EXTERN_C rettype func parameters_and_attributes
190 
191 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
192    declares a C++ alias called GNULIB_NAMESPACE::func
193    that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
194    Example:
195      _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
196 
197    Wrapping rpl_func in an object with an inline conversion operator
198    avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
199    actually used in the program.  */
200 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
201   _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
202 #if defined __cplusplus && defined GNULIB_NAMESPACE
203 # define _GL_CXXALIAS_RPL_1(func,rpl_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 ::rpl_func;                                  \
213         }                                                     \
214       } func = {};                                            \
215     }                                                         \
216     _GL_EXTERN_C int _gl_cxxalias_dummy
217 #else
218 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
219     _GL_EXTERN_C int _gl_cxxalias_dummy
220 #endif
221 
222 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
223    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
224    except that the C function rpl_func may have a slightly different
225    declaration.  A cast is used to silence the "invalid conversion" error
226    that would otherwise occur.  */
227 #if defined __cplusplus && defined GNULIB_NAMESPACE
228 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_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>(::rpl_func);               \
238         }                                                          \
239       } func = {};                                                 \
240     }                                                              \
241     _GL_EXTERN_C int _gl_cxxalias_dummy
242 #else
243 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
244     _GL_EXTERN_C int _gl_cxxalias_dummy
245 #endif
246 
247 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
248    declares a C++ alias called GNULIB_NAMESPACE::func
249    that redirects to the system provided function func, if GNULIB_NAMESPACE
250    is defined.
251    Example:
252      _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
253 
254    Wrapping func in an object with an inline conversion operator
255    avoids a reference to func unless GNULIB_NAMESPACE::func is
256    actually used in the program.  */
257 #if defined __cplusplus && defined GNULIB_NAMESPACE
258 # define _GL_CXXALIAS_SYS(func,rettype,parameters)            \
259     namespace GNULIB_NAMESPACE                                \
260     {                                                         \
261       static const struct _gl_ ## func ## _wrapper            \
262       {                                                       \
263         typedef rettype (*type) parameters;                   \
264                                                               \
265         inline operator type () const                         \
266         {                                                     \
267           return ::func;                                      \
268         }                                                     \
269       } func = {};                                            \
270     }                                                         \
271     _GL_EXTERN_C int _gl_cxxalias_dummy
272 #else
273 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
274     _GL_EXTERN_C int _gl_cxxalias_dummy
275 #endif
276 
277 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
278    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
279    except that the C function func may have a slightly different declaration.
280    A cast is used to silence the "invalid conversion" error that would
281    otherwise occur.  */
282 #if defined __cplusplus && defined GNULIB_NAMESPACE
283 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
284     namespace GNULIB_NAMESPACE                          \
285     {                                                   \
286       static const struct _gl_ ## func ## _wrapper      \
287       {                                                 \
288         typedef rettype (*type) parameters;             \
289                                                         \
290         inline operator type () const                   \
291         {                                               \
292           return reinterpret_cast<type>(::func);        \
293         }                                               \
294       } func = {};                                      \
295     }                                                   \
296     _GL_EXTERN_C int _gl_cxxalias_dummy
297 #else
298 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
299     _GL_EXTERN_C int _gl_cxxalias_dummy
300 #endif
301 
302 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
303    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
304    except that the C function is picked among a set of overloaded functions,
305    namely the one with rettype2 and parameters2.  Two consecutive casts
306    are used to silence the "cannot find a match" and "invalid conversion"
307    errors that would otherwise occur.  */
308 #if defined __cplusplus && defined GNULIB_NAMESPACE
309   /* The outer cast must be a reinterpret_cast.
310      The inner cast: When the function is defined as a set of overloaded
311      functions, it works as a static_cast<>, choosing the designated variant.
312      When the function is defined as a single variant, it works as a
313      reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
314 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
315     namespace GNULIB_NAMESPACE                                                \
316     {                                                                         \
317       static const struct _gl_ ## func ## _wrapper                            \
318       {                                                                       \
319         typedef rettype (*type) parameters;                                   \
320                                                                               \
321         inline operator type () const                                         \
322         {                                                                     \
323           return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
324         }                                                                     \
325       } func = {};                                                            \
326     }                                                                         \
327     _GL_EXTERN_C int _gl_cxxalias_dummy
328 #else
329 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
330     _GL_EXTERN_C int _gl_cxxalias_dummy
331 #endif
332 
333 /* _GL_CXXALIASWARN (func);
334    causes a warning to be emitted when ::func is used but not when
335    GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
336    variants.  */
337 #if defined __cplusplus && defined GNULIB_NAMESPACE
338 # define _GL_CXXALIASWARN(func) \
339    _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
340 # define _GL_CXXALIASWARN_1(func,namespace) \
341    _GL_CXXALIASWARN_2 (func, namespace)
342 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
343    we enable the warning only when not optimizing.  */
344 # if !__OPTIMIZE__
345 #  define _GL_CXXALIASWARN_2(func,namespace) \
346     _GL_WARN_ON_USE (func, \
347                      "The symbol ::" #func " refers to the system function. " \
348                      "Use " #namespace "::" #func " instead.")
349 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
350 #  define _GL_CXXALIASWARN_2(func,namespace) \
351      extern __typeof__ (func) func
352 # else
353 #  define _GL_CXXALIASWARN_2(func,namespace) \
354      _GL_EXTERN_C int _gl_cxxalias_dummy
355 # endif
356 #else
357 # define _GL_CXXALIASWARN(func) \
358     _GL_EXTERN_C int _gl_cxxalias_dummy
359 #endif
360 
361 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
362    causes a warning to be emitted when the given overloaded variant of ::func
363    is used but not when GNULIB_NAMESPACE::func is used.  */
364 #if defined __cplusplus && defined GNULIB_NAMESPACE
365 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
366    _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
367                         GNULIB_NAMESPACE)
368 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
369    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
370 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
371    we enable the warning only when not optimizing.  */
372 # if !__OPTIMIZE__
373 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
374     _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
375                          "The symbol ::" #func " refers to the system function. " \
376                          "Use " #namespace "::" #func " instead.")
377 # else
378 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
379      _GL_EXTERN_C int _gl_cxxalias_dummy
380 # endif
381 #else
382 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
383     _GL_EXTERN_C int _gl_cxxalias_dummy
384 #endif
385 
386 #endif /* _GL_CXXDEFS_H */
387 
388 /* The definition of _GL_ARG_NONNULL is copied here.  */
389 /* A C macro for declaring that specific arguments must not be NULL.
390    Copyright (C) 2009-2020 Free Software Foundation, Inc.
391 
392    This program is free software: you can redistribute it and/or modify it
393    under the terms of the GNU General Public License as published
394    by the Free Software Foundation; either version 3 of the License, or
395    (at your option) any later version.
396 
397    This program is distributed in the hope that it will be useful,
398    but WITHOUT ANY WARRANTY; without even the implied warranty of
399    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
400    General Public License for more details.
401 
402    You should have received a copy of the GNU General Public License
403    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
404 
405 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
406    that the values passed as arguments n, ..., m must be non-NULL pointers.
407    n = 1 stands for the first argument, n = 2 for the second argument etc.  */
408 #ifndef _GL_ARG_NONNULL
409 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
410 #  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
411 # else
412 #  define _GL_ARG_NONNULL(params)
413 # endif
414 #endif
415 
416 /* The definition of _GL_WARN_ON_USE is copied here.  */
417 /* A C macro for emitting warnings if a function is used.
418    Copyright (C) 2010-2020 Free Software Foundation, Inc.
419 
420    This program is free software: you can redistribute it and/or modify it
421    under the terms of the GNU General Public License as published
422    by the Free Software Foundation; either version 3 of the License, or
423    (at your option) any later version.
424 
425    This program is distributed in the hope that it will be useful,
426    but WITHOUT ANY WARRANTY; without even the implied warranty of
427    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
428    General Public License for more details.
429 
430    You should have received a copy of the GNU General Public License
431    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
432 
433 /* _GL_WARN_ON_USE (function, "literal string") issues a declaration
434    for FUNCTION which will then trigger a compiler warning containing
435    the text of "literal string" anywhere that function is called, if
436    supported by the compiler.  If the compiler does not support this
437    feature, the macro expands to an unused extern declaration.
438 
439    _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
440    attribute used in _GL_WARN_ON_USE.  If the compiler does not support
441    this feature, it expands to empty.
442 
443    These macros are useful for marking a function as a potential
444    portability trap, with the intent that "literal string" include
445    instructions on the replacement function that should be used
446    instead.
447    _GL_WARN_ON_USE is for functions with 'extern' linkage.
448    _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
449    linkage.
450 
451    However, one of the reasons that a function is a portability trap is
452    if it has the wrong signature.  Declaring FUNCTION with a different
453    signature in C is a compilation error, so this macro must use the
454    same type as any existing declaration so that programs that avoid
455    the problematic FUNCTION do not fail to compile merely because they
456    included a header that poisoned the function.  But this implies that
457    _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
458    have a declaration.  Use of this macro implies that there must not
459    be any other macro hiding the declaration of FUNCTION; but
460    undefining FUNCTION first is part of the poisoning process anyway
461    (although for symbols that are provided only via a macro, the result
462    is a compilation error rather than a warning containing
463    "literal string").  Also note that in C++, it is only safe to use if
464    FUNCTION has no overloads.
465 
466    For an example, it is possible to poison 'getline' by:
467    - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
468      [getline]) in configure.ac, which potentially defines
469      HAVE_RAW_DECL_GETLINE
470    - adding this code to a header that wraps the system <stdio.h>:
471      #undef getline
472      #if HAVE_RAW_DECL_GETLINE
473      _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
474        "not universally present; use the gnulib module getline");
475      #endif
476 
477    It is not possible to directly poison global variables.  But it is
478    possible to write a wrapper accessor function, and poison that
479    (less common usage, like &environ, will cause a compilation error
480    rather than issue the nice warning, but the end result of informing
481    the developer about their portability problem is still achieved):
482      #if HAVE_RAW_DECL_ENVIRON
483      static char ***
484      rpl_environ (void) { return &environ; }
485      _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
486      # undef environ
487      # define environ (*rpl_environ ())
488      #endif
489    or better (avoiding contradictory use of 'static' and 'extern'):
490      #if HAVE_RAW_DECL_ENVIRON
491      static char ***
492      _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
493      rpl_environ (void) { return &environ; }
494      # undef environ
495      # define environ (*rpl_environ ())
496      #endif
497    */
498 #ifndef _GL_WARN_ON_USE
499 
500 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
501 /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
502 #  define _GL_WARN_ON_USE(function, message) \
503 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
504 #  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
505   __attribute__ ((__warning__ (message)))
506 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
507 /* Verify the existence of the function.  */
508 #  define _GL_WARN_ON_USE(function, message) \
509 extern __typeof__ (function) function
510 #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
511 # else /* Unsupported.  */
512 #  define _GL_WARN_ON_USE(function, message) \
513 _GL_WARN_EXTERN_C int _gl_warn_on_use
514 #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
515 # endif
516 #endif
517 
518 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
519    is like _GL_WARN_ON_USE (function, "string"), except that in C++ mode the
520    function is declared with the given prototype, consisting of return type,
521    parameters, and attributes.
522    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
523    not work in this case.  */
524 #ifndef _GL_WARN_ON_USE_CXX
525 # if !defined __cplusplus
526 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
527      _GL_WARN_ON_USE (function, msg)
528 # else
529 #  if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
530 #   define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
531 extern rettype function parameters_and_attributes \
532      __attribute__ ((__warning__ (msg)))
533 #  elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
534 /* Verify the existence of the function.  */
535 #   define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
536 extern rettype function parameters_and_attributes
537 #  else /* Unsupported.  */
538 #   define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
539 _GL_WARN_EXTERN_C int _gl_warn_on_use
540 #  endif
541 # endif
542 #endif
543 
544 /* _GL_WARN_EXTERN_C declaration;
545    performs the declaration with C linkage.  */
546 #ifndef _GL_WARN_EXTERN_C
547 # if defined __cplusplus
548 #  define _GL_WARN_EXTERN_C extern "C"
549 # else
550 #  define _GL_WARN_EXTERN_C extern
551 # endif
552 #endif
553 
554 
555 /* Declare overridden functions.  */
556 
557 #if 1
558 # if 0
559 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
560 #   undef opendir
561 #   define opendir rpl_opendir
562 #   define GNULIB_defined_opendir 1
563 #  endif
564 _GL_FUNCDECL_RPL (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)));
565 _GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name));
566 # else
567 #  if !1
568 _GL_FUNCDECL_SYS (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)));
569 #  endif
570 _GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name));
571 # endif
572 _GL_CXXALIASWARN (opendir);
573 #elif defined GNULIB_POSIXCHECK
574 # undef opendir
575 # if HAVE_RAW_DECL_OPENDIR
576 _GL_WARN_ON_USE (opendir, "opendir is not portable - "
577                  "use gnulib module opendir for portability");
578 # endif
579 #endif
580 
581 #if 1
582 # if !1
583 _GL_FUNCDECL_SYS (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1)));
584 # endif
585 _GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp));
586 _GL_CXXALIASWARN (readdir);
587 #elif defined GNULIB_POSIXCHECK
588 # undef readdir
589 # if HAVE_RAW_DECL_READDIR
590 _GL_WARN_ON_USE (readdir, "readdir is not portable - "
591                  "use gnulib module readdir for portability");
592 # endif
593 #endif
594 
595 #if 1
596 # if !1
597 _GL_FUNCDECL_SYS (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1)));
598 # endif
599 _GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp));
600 _GL_CXXALIASWARN (rewinddir);
601 #elif defined GNULIB_POSIXCHECK
602 # undef rewinddir
603 # if HAVE_RAW_DECL_REWINDDIR
604 _GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - "
605                  "use gnulib module rewinddir for portability");
606 # endif
607 #endif
608 
609 #if 1
610 # if 0
611 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
612 #   undef closedir
613 #   define closedir rpl_closedir
614 #   define GNULIB_defined_closedir 1
615 #  endif
616 _GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
617 _GL_CXXALIAS_RPL (closedir, int, (DIR *dirp));
618 # else
619 #  if !1
620 _GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
621 #  endif
622 _GL_CXXALIAS_SYS (closedir, int, (DIR *dirp));
623 # endif
624 _GL_CXXALIASWARN (closedir);
625 #elif defined GNULIB_POSIXCHECK
626 # undef closedir
627 # if HAVE_RAW_DECL_CLOSEDIR
628 _GL_WARN_ON_USE (closedir, "closedir is not portable - "
629                  "use gnulib module closedir for portability");
630 # endif
631 #endif
632 
633 #if 1
634 /* Return the file descriptor associated with the given directory stream,
635    or -1 if none exists.  */
636 # if 0
637 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
638 #   undef dirfd
639 #   define dirfd rpl_dirfd
640 #  endif
641 _GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
642 _GL_CXXALIAS_RPL (dirfd, int, (DIR *));
643 
644 #  ifdef __KLIBC__
645 /* Gnulib internal hooks needed to maintain the dirfd metadata.  */
646 _GL_EXTERN_C int _gl_register_dirp_fd (int fd, DIR *dirp)
647      _GL_ARG_NONNULL ((2));
648 _GL_EXTERN_C void _gl_unregister_dirp_fd (int fd);
649 #  endif
650 # else
651 #  if defined __cplusplus && defined GNULIB_NAMESPACE && defined dirfd
652     /* dirfd is defined as a macro and not as a function.
653        Turn it into a function and get rid of the macro.  */
654 static inline int (dirfd) (DIR *dp) { return dirfd (dp); }
655 #   undef dirfd
656 #  endif
657 #  if !(1 || defined dirfd)
658 _GL_FUNCDECL_SYS (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
659 #  endif
660 _GL_CXXALIAS_SYS (dirfd, int, (DIR *));
661 # endif
662 _GL_CXXALIASWARN (dirfd);
663 #elif defined GNULIB_POSIXCHECK
664 # undef dirfd
665 # if HAVE_RAW_DECL_DIRFD
666 _GL_WARN_ON_USE (dirfd, "dirfd is unportable - "
667                  "use gnulib module dirfd for portability");
668 # endif
669 #endif
670 
671 #if 1
672 /* Open a directory stream visiting the given directory file
673    descriptor.  Return NULL and set errno if fd is not visiting a
674    directory.  On success, this function consumes fd (it will be
675    implicitly closed either by this function or by a subsequent
676    closedir).  */
677 # if 0
678 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
679 #   undef fdopendir
680 #   define fdopendir rpl_fdopendir
681 #  endif
682 _GL_FUNCDECL_RPL (fdopendir, DIR *, (int fd));
683 _GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd));
684 # else
685 #  if !1 || !1
686 _GL_FUNCDECL_SYS (fdopendir, DIR *, (int fd));
687 #  endif
688 _GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd));
689 # endif
690 _GL_CXXALIASWARN (fdopendir);
691 #elif defined GNULIB_POSIXCHECK
692 # undef fdopendir
693 # if HAVE_RAW_DECL_FDOPENDIR
694 _GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - "
695                  "use gnulib module fdopendir for portability");
696 # endif
697 #endif
698 
699 #if 0
700 /* Scan the directory DIR, calling FILTER on each directory entry.
701    Entries for which FILTER returns nonzero are individually malloc'd,
702    sorted using qsort with CMP, and collected in a malloc'd array in
703    *NAMELIST.  Returns the number of entries selected, or -1 on error.  */
704 # if !1
705 _GL_FUNCDECL_SYS (scandir, int,
706                   (const char *dir, struct dirent ***namelist,
707                    int (*filter) (const struct dirent *),
708                    int (*cmp) (const struct dirent **, const struct dirent **))
709                   _GL_ARG_NONNULL ((1, 2, 4)));
710 # endif
711 /* Need to cast, because on glibc systems, the fourth parameter is
712                         int (*cmp) (const void *, const void *).  */
713 _GL_CXXALIAS_SYS_CAST (scandir, int,
714                        (const char *dir, struct dirent ***namelist,
715                         int (*filter) (const struct dirent *),
716                         int (*cmp) (const struct dirent **, const struct dirent **)));
717 _GL_CXXALIASWARN (scandir);
718 #elif defined GNULIB_POSIXCHECK
719 # undef scandir
720 # if HAVE_RAW_DECL_SCANDIR
721 _GL_WARN_ON_USE (scandir, "scandir is unportable - "
722                  "use gnulib module scandir for portability");
723 # endif
724 #endif
725 
726 #if 0
727 /* Compare two 'struct dirent' entries alphabetically.  */
728 # if !1
729 _GL_FUNCDECL_SYS (alphasort, int,
730                   (const struct dirent **, const struct dirent **)
731                   _GL_ATTRIBUTE_PURE
732                   _GL_ARG_NONNULL ((1, 2)));
733 # endif
734 /* Need to cast, because on glibc systems, the parameters are
735                        (const void *, const void *).  */
736 _GL_CXXALIAS_SYS_CAST (alphasort, int,
737                        (const struct dirent **, const struct dirent **));
738 _GL_CXXALIASWARN (alphasort);
739 #elif defined GNULIB_POSIXCHECK
740 # undef alphasort
741 # if HAVE_RAW_DECL_ALPHASORT
742 _GL_WARN_ON_USE (alphasort, "alphasort is unportable - "
743                  "use gnulib module alphasort for portability");
744 # endif
745 #endif
746 
747 
748 #endif /* _GL_DIRENT_H */
749 #endif /* _GL_DIRENT_H */
750