1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* A GNU-like <dirent.h>.
3    Copyright (C) 2006-2020 Free Software Foundation, Inc.
4 
5    This program is free software: you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9 
10    This program 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 General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
17 
18 #ifndef _GL_DIRENT_H
19 
20 #if __GNUC__ >= 3
21 #pragma GCC system_header
22 #endif
23 
24 
25 /* The include_next requires a split double-inclusion guard.  */
26 #if 1
27 # include_next <dirent.h>
28 #endif
29 
30 #ifndef _GL_DIRENT_H
31 #define _GL_DIRENT_H
32 
33 /* Get ino_t.  Needed on some systems, including glibc 2.8.  */
34 #include <sys/types.h>
35 
36 #if !1
37 /* Define types DIR and 'struct dirent'.  */
38 # if !GNULIB_defined_struct_dirent
39 struct dirent
40 {
41   char d_type;
42   char d_name[1];
43 };
44 /* Possible values for 'd_type'.  */
45 #  define DT_UNKNOWN 0
46 #  define DT_FIFO    1          /* FIFO */
47 #  define DT_CHR     2          /* character device */
48 #  define DT_DIR     4          /* directory */
49 #  define DT_BLK     6          /* block device */
50 #  define DT_REG     8          /* regular file */
51 #  define DT_LNK    10          /* symbolic link */
52 #  define DT_SOCK   12          /* socket */
53 #  define DT_WHT    14          /* whiteout */
54 typedef struct gl_directory DIR;
55 #  define GNULIB_defined_struct_dirent 1
56 # endif
57 #endif
58 
59 /* The __attribute__ feature is available in gcc versions 2.5 and later.
60    The attribute __pure__ was added in gcc 2.96.  */
61 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
62 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
63 #else
64 # define _GL_ATTRIBUTE_PURE /* empty */
65 #endif
66 
67 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
68 /* C++ compatible function declaration macros.
69    Copyright (C) 2010-2020 Free Software Foundation, Inc.
70 
71    This program is free software: you can redistribute it and/or modify it
72    under the terms of the GNU General Public License as published
73    by the Free Software Foundation; either version 3 of the License, or
74    (at your option) any later version.
75 
76    This program is distributed in the hope that it will be useful,
77    but WITHOUT ANY WARRANTY; without even the implied warranty of
78    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
79    General Public License for more details.
80 
81    You should have received a copy of the GNU General Public License
82    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
83 
84 #ifndef _GL_CXXDEFS_H
85 #define _GL_CXXDEFS_H
86 
87 /* Begin/end the GNULIB_NAMESPACE namespace.  */
88 #if defined __cplusplus && defined GNULIB_NAMESPACE
89 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
90 # define _GL_END_NAMESPACE }
91 #else
92 # define _GL_BEGIN_NAMESPACE
93 # define _GL_END_NAMESPACE
94 #endif
95 
96 /* The three most frequent use cases of these macros are:
97 
98    * For providing a substitute for a function that is missing on some
99      platforms, but is declared and works fine on the platforms on which
100      it exists:
101 
102        #if @GNULIB_FOO@
103        # if !@HAVE_FOO@
104        _GL_FUNCDECL_SYS (foo, ...);
105        # endif
106        _GL_CXXALIAS_SYS (foo, ...);
107        _GL_CXXALIASWARN (foo);
108        #elif defined GNULIB_POSIXCHECK
109        ...
110        #endif
111 
112    * For providing a replacement for a function that exists on all platforms,
113      but is broken/insufficient and needs to be replaced on some platforms:
114 
115        #if @GNULIB_FOO@
116        # if @REPLACE_FOO@
117        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
118        #   undef foo
119        #   define foo rpl_foo
120        #  endif
121        _GL_FUNCDECL_RPL (foo, ...);
122        _GL_CXXALIAS_RPL (foo, ...);
123        # else
124        _GL_CXXALIAS_SYS (foo, ...);
125        # endif
126        _GL_CXXALIASWARN (foo);
127        #elif defined GNULIB_POSIXCHECK
128        ...
129        #endif
130 
131    * For providing a replacement for a function that exists on some platforms
132      but is broken/insufficient and needs to be replaced on some of them and
133      is additionally either missing or undeclared on some other platforms:
134 
135        #if @GNULIB_FOO@
136        # if @REPLACE_FOO@
137        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
138        #   undef foo
139        #   define foo rpl_foo
140        #  endif
141        _GL_FUNCDECL_RPL (foo, ...);
142        _GL_CXXALIAS_RPL (foo, ...);
143        # else
144        #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
145        _GL_FUNCDECL_SYS (foo, ...);
146        #  endif
147        _GL_CXXALIAS_SYS (foo, ...);
148        # endif
149        _GL_CXXALIASWARN (foo);
150        #elif defined GNULIB_POSIXCHECK
151        ...
152        #endif
153 */
154 
155 /* _GL_EXTERN_C declaration;
156    performs the declaration with C linkage.  */
157 #if defined __cplusplus
158 # define _GL_EXTERN_C extern "C"
159 #else
160 # define _GL_EXTERN_C extern
161 #endif
162 
163 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
164    declares a replacement function, named rpl_func, with the given prototype,
165    consisting of return type, parameters, and attributes.
166    Example:
167      _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
168                                   _GL_ARG_NONNULL ((1)));
169  */
170 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
171   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
172 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
173   _GL_EXTERN_C rettype rpl_func parameters_and_attributes
174 
175 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
176    declares the system function, named func, with the given prototype,
177    consisting of return type, parameters, and attributes.
178    Example:
179      _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
180                                   _GL_ARG_NONNULL ((1)));
181  */
182 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
183   _GL_EXTERN_C rettype func parameters_and_attributes
184 
185 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
186    declares a C++ alias called GNULIB_NAMESPACE::func
187    that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
188    Example:
189      _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
190 
191    Wrapping rpl_func in an object with an inline conversion operator
192    avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
193    actually used in the program.  */
194 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
195   _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
196 #if defined __cplusplus && defined GNULIB_NAMESPACE
197 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
198     namespace GNULIB_NAMESPACE                                \
199     {                                                         \
200       static const struct _gl_ ## func ## _wrapper            \
201       {                                                       \
202         typedef rettype (*type) parameters;                   \
203                                                               \
204         inline operator type () const                         \
205         {                                                     \
206           return ::rpl_func;                                  \
207         }                                                     \
208       } func = {};                                            \
209     }                                                         \
210     _GL_EXTERN_C int _gl_cxxalias_dummy
211 #else
212 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
213     _GL_EXTERN_C int _gl_cxxalias_dummy
214 #endif
215 
216 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
217    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
218    except that the C function rpl_func may have a slightly different
219    declaration.  A cast is used to silence the "invalid conversion" error
220    that would otherwise occur.  */
221 #if defined __cplusplus && defined GNULIB_NAMESPACE
222 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
223     namespace GNULIB_NAMESPACE                                     \
224     {                                                              \
225       static const struct _gl_ ## func ## _wrapper                 \
226       {                                                            \
227         typedef rettype (*type) parameters;                        \
228                                                                    \
229         inline operator type () const                              \
230         {                                                          \
231           return reinterpret_cast<type>(::rpl_func);               \
232         }                                                          \
233       } func = {};                                                 \
234     }                                                              \
235     _GL_EXTERN_C int _gl_cxxalias_dummy
236 #else
237 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
238     _GL_EXTERN_C int _gl_cxxalias_dummy
239 #endif
240 
241 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
242    declares a C++ alias called GNULIB_NAMESPACE::func
243    that redirects to the system provided function func, if GNULIB_NAMESPACE
244    is defined.
245    Example:
246      _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
247 
248    Wrapping func in an object with an inline conversion operator
249    avoids a reference to func unless GNULIB_NAMESPACE::func is
250    actually used in the program.  */
251 #if defined __cplusplus && defined GNULIB_NAMESPACE
252 # define _GL_CXXALIAS_SYS(func,rettype,parameters)            \
253     namespace GNULIB_NAMESPACE                                \
254     {                                                         \
255       static const struct _gl_ ## func ## _wrapper            \
256       {                                                       \
257         typedef rettype (*type) parameters;                   \
258                                                               \
259         inline operator type () const                         \
260         {                                                     \
261           return ::func;                                      \
262         }                                                     \
263       } func = {};                                            \
264     }                                                         \
265     _GL_EXTERN_C int _gl_cxxalias_dummy
266 #else
267 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
268     _GL_EXTERN_C int _gl_cxxalias_dummy
269 #endif
270 
271 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
272    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
273    except that the C function func may have a slightly different declaration.
274    A cast is used to silence the "invalid conversion" error that would
275    otherwise occur.  */
276 #if defined __cplusplus && defined GNULIB_NAMESPACE
277 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
278     namespace GNULIB_NAMESPACE                          \
279     {                                                   \
280       static const struct _gl_ ## func ## _wrapper      \
281       {                                                 \
282         typedef rettype (*type) parameters;             \
283                                                         \
284         inline operator type () const                   \
285         {                                               \
286           return reinterpret_cast<type>(::func);        \
287         }                                               \
288       } func = {};                                      \
289     }                                                   \
290     _GL_EXTERN_C int _gl_cxxalias_dummy
291 #else
292 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
293     _GL_EXTERN_C int _gl_cxxalias_dummy
294 #endif
295 
296 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
297    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
298    except that the C function is picked among a set of overloaded functions,
299    namely the one with rettype2 and parameters2.  Two consecutive casts
300    are used to silence the "cannot find a match" and "invalid conversion"
301    errors that would otherwise occur.  */
302 #if defined __cplusplus && defined GNULIB_NAMESPACE
303   /* The outer cast must be a reinterpret_cast.
304      The inner cast: When the function is defined as a set of overloaded
305      functions, it works as a static_cast<>, choosing the designated variant.
306      When the function is defined as a single variant, it works as a
307      reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
308 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
309     namespace GNULIB_NAMESPACE                                                \
310     {                                                                         \
311       static const struct _gl_ ## func ## _wrapper                            \
312       {                                                                       \
313         typedef rettype (*type) parameters;                                   \
314                                                                               \
315         inline operator type () const                                         \
316         {                                                                     \
317           return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
318         }                                                                     \
319       } func = {};                                                            \
320     }                                                                         \
321     _GL_EXTERN_C int _gl_cxxalias_dummy
322 #else
323 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
324     _GL_EXTERN_C int _gl_cxxalias_dummy
325 #endif
326 
327 /* _GL_CXXALIASWARN (func);
328    causes a warning to be emitted when ::func is used but not when
329    GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
330    variants.  */
331 #if defined __cplusplus && defined GNULIB_NAMESPACE
332 # define _GL_CXXALIASWARN(func) \
333    _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
334 # define _GL_CXXALIASWARN_1(func,namespace) \
335    _GL_CXXALIASWARN_2 (func, namespace)
336 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
337    we enable the warning only when not optimizing.  */
338 # if !__OPTIMIZE__
339 #  define _GL_CXXALIASWARN_2(func,namespace) \
340     _GL_WARN_ON_USE (func, \
341                      "The symbol ::" #func " refers to the system function. " \
342                      "Use " #namespace "::" #func " instead.")
343 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
344 #  define _GL_CXXALIASWARN_2(func,namespace) \
345      extern __typeof__ (func) func
346 # else
347 #  define _GL_CXXALIASWARN_2(func,namespace) \
348      _GL_EXTERN_C int _gl_cxxalias_dummy
349 # endif
350 #else
351 # define _GL_CXXALIASWARN(func) \
352     _GL_EXTERN_C int _gl_cxxalias_dummy
353 #endif
354 
355 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
356    causes a warning to be emitted when the given overloaded variant of ::func
357    is used but not when GNULIB_NAMESPACE::func is used.  */
358 #if defined __cplusplus && defined GNULIB_NAMESPACE
359 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
360    _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
361                         GNULIB_NAMESPACE)
362 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
363    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
364 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
365    we enable the warning only when not optimizing.  */
366 # if !__OPTIMIZE__
367 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
368     _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
369                          "The symbol ::" #func " refers to the system function. " \
370                          "Use " #namespace "::" #func " instead.")
371 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
372 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
373      extern __typeof__ (func) func
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-2020 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 General Public License as published
391    by the Free Software Foundation; either version 3 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    General Public License for more details.
398 
399    You should have received a copy of the GNU 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_MINOR__ >= 3) || __GNUC__ > 3
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-2020 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 General Public License as published
419    by the Free Software Foundation; either version 3 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    General Public License for more details.
426 
427    You should have received a copy of the GNU 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 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
501 #  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
502   __attribute__ ((__warning__ (message)))
503 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
504 /* Verify the existence of the function.  */
505 #  define _GL_WARN_ON_USE(function, message) \
506 extern __typeof__ (function) function
507 #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
508 # else /* Unsupported.  */
509 #  define _GL_WARN_ON_USE(function, message) \
510 _GL_WARN_EXTERN_C int _gl_warn_on_use
511 #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
512 # endif
513 #endif
514 
515 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
516    is like _GL_WARN_ON_USE (function, "string"), except that the function is
517    declared with the given prototype, consisting of return type, parameters,
518    and attributes.
519    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
520    not work in this case.  */
521 #ifndef _GL_WARN_ON_USE_CXX
522 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
523 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
524 extern rettype function parameters_and_attributes \
525      __attribute__ ((__warning__ (msg)))
526 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
527 /* Verify the existence of the function.  */
528 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
529 extern rettype function parameters_and_attributes
530 # else /* Unsupported.  */
531 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
532 _GL_WARN_EXTERN_C int _gl_warn_on_use
533 # endif
534 #endif
535 
536 /* _GL_WARN_EXTERN_C declaration;
537    performs the declaration with C linkage.  */
538 #ifndef _GL_WARN_EXTERN_C
539 # if defined __cplusplus
540 #  define _GL_WARN_EXTERN_C extern "C"
541 # else
542 #  define _GL_WARN_EXTERN_C extern
543 # endif
544 #endif
545 
546 
547 /* Declare overridden functions.  */
548 
549 #if 1
550 # if 0
551 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
552 #   undef opendir
553 #   define opendir rpl_opendir
554 #   define GNULIB_defined_opendir 1
555 #  endif
556 _GL_FUNCDECL_RPL (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)));
557 _GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name));
558 # else
559 #  if !1
560 _GL_FUNCDECL_SYS (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)));
561 #  endif
562 _GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name));
563 # endif
564 _GL_CXXALIASWARN (opendir);
565 #elif defined GNULIB_POSIXCHECK
566 # undef opendir
567 # if HAVE_RAW_DECL_OPENDIR
568 _GL_WARN_ON_USE (opendir, "opendir is not portable - "
569                  "use gnulib module opendir for portability");
570 # endif
571 #endif
572 
573 #if 1
574 # if !1
575 _GL_FUNCDECL_SYS (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1)));
576 # endif
577 _GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp));
578 _GL_CXXALIASWARN (readdir);
579 #elif defined GNULIB_POSIXCHECK
580 # undef readdir
581 # if HAVE_RAW_DECL_READDIR
582 _GL_WARN_ON_USE (readdir, "readdir is not portable - "
583                  "use gnulib module readdir for portability");
584 # endif
585 #endif
586 
587 #if 0
588 # if !1
589 _GL_FUNCDECL_SYS (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1)));
590 # endif
591 _GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp));
592 _GL_CXXALIASWARN (rewinddir);
593 #elif defined GNULIB_POSIXCHECK
594 # undef rewinddir
595 # if HAVE_RAW_DECL_REWINDDIR
596 _GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - "
597                  "use gnulib module rewinddir for portability");
598 # endif
599 #endif
600 
601 #if 1
602 # if 0
603 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
604 #   undef closedir
605 #   define closedir rpl_closedir
606 #   define GNULIB_defined_closedir 1
607 #  endif
608 _GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
609 _GL_CXXALIAS_RPL (closedir, int, (DIR *dirp));
610 # else
611 #  if !1
612 _GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
613 #  endif
614 _GL_CXXALIAS_SYS (closedir, int, (DIR *dirp));
615 # endif
616 _GL_CXXALIASWARN (closedir);
617 #elif defined GNULIB_POSIXCHECK
618 # undef closedir
619 # if HAVE_RAW_DECL_CLOSEDIR
620 _GL_WARN_ON_USE (closedir, "closedir is not portable - "
621                  "use gnulib module closedir for portability");
622 # endif
623 #endif
624 
625 #if 1
626 /* Return the file descriptor associated with the given directory stream,
627    or -1 if none exists.  */
628 # if 0
629 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
630 #   undef dirfd
631 #   define dirfd rpl_dirfd
632 #  endif
633 _GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
634 _GL_CXXALIAS_RPL (dirfd, int, (DIR *));
635 
636 #  ifdef __KLIBC__
637 /* Gnulib internal hooks needed to maintain the dirfd metadata.  */
638 _GL_EXTERN_C int _gl_register_dirp_fd (int fd, DIR *dirp)
639      _GL_ARG_NONNULL ((2));
640 _GL_EXTERN_C void _gl_unregister_dirp_fd (int fd);
641 #  endif
642 # else
643 #  if defined __cplusplus && defined GNULIB_NAMESPACE && defined dirfd
644     /* dirfd is defined as a macro and not as a function.
645        Turn it into a function and get rid of the macro.  */
646 static inline int (dirfd) (DIR *dp) { return dirfd (dp); }
647 #   undef dirfd
648 #  endif
649 #  if !(1 || defined dirfd)
650 _GL_FUNCDECL_SYS (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
651 #  endif
652 _GL_CXXALIAS_SYS (dirfd, int, (DIR *));
653 # endif
654 _GL_CXXALIASWARN (dirfd);
655 #elif defined GNULIB_POSIXCHECK
656 # undef dirfd
657 # if HAVE_RAW_DECL_DIRFD
658 _GL_WARN_ON_USE (dirfd, "dirfd is unportable - "
659                  "use gnulib module dirfd for portability");
660 # endif
661 #endif
662 
663 #if 1
664 /* Open a directory stream visiting the given directory file
665    descriptor.  Return NULL and set errno if fd is not visiting a
666    directory.  On success, this function consumes fd (it will be
667    implicitly closed either by this function or by a subsequent
668    closedir).  */
669 # if 0
670 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
671 #   undef fdopendir
672 #   define fdopendir rpl_fdopendir
673 #  endif
674 _GL_FUNCDECL_RPL (fdopendir, DIR *, (int fd));
675 _GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd));
676 # else
677 #  if !1 || !1
678 _GL_FUNCDECL_SYS (fdopendir, DIR *, (int fd));
679 #  endif
680 _GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd));
681 # endif
682 _GL_CXXALIASWARN (fdopendir);
683 #elif defined GNULIB_POSIXCHECK
684 # undef fdopendir
685 # if HAVE_RAW_DECL_FDOPENDIR
686 _GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - "
687                  "use gnulib module fdopendir for portability");
688 # endif
689 #endif
690 
691 #if 0
692 /* Scan the directory DIR, calling FILTER on each directory entry.
693    Entries for which FILTER returns nonzero are individually malloc'd,
694    sorted using qsort with CMP, and collected in a malloc'd array in
695    *NAMELIST.  Returns the number of entries selected, or -1 on error.  */
696 # if !1
697 _GL_FUNCDECL_SYS (scandir, int,
698                   (const char *dir, struct dirent ***namelist,
699                    int (*filter) (const struct dirent *),
700                    int (*cmp) (const struct dirent **, const struct dirent **))
701                   _GL_ARG_NONNULL ((1, 2, 4)));
702 # endif
703 /* Need to cast, because on glibc systems, the fourth parameter is
704                         int (*cmp) (const void *, const void *).  */
705 _GL_CXXALIAS_SYS_CAST (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_CXXALIASWARN (scandir);
710 #elif defined GNULIB_POSIXCHECK
711 # undef scandir
712 # if HAVE_RAW_DECL_SCANDIR
713 _GL_WARN_ON_USE (scandir, "scandir is unportable - "
714                  "use gnulib module scandir for portability");
715 # endif
716 #endif
717 
718 #if 0
719 /* Compare two 'struct dirent' entries alphabetically.  */
720 # if !1
721 _GL_FUNCDECL_SYS (alphasort, int,
722                   (const struct dirent **, const struct dirent **)
723                   _GL_ATTRIBUTE_PURE
724                   _GL_ARG_NONNULL ((1, 2)));
725 # endif
726 /* Need to cast, because on glibc systems, the parameters are
727                        (const void *, const void *).  */
728 _GL_CXXALIAS_SYS_CAST (alphasort, int,
729                        (const struct dirent **, const struct dirent **));
730 _GL_CXXALIASWARN (alphasort);
731 #elif defined GNULIB_POSIXCHECK
732 # undef alphasort
733 # if HAVE_RAW_DECL_ALPHASORT
734 _GL_WARN_ON_USE (alphasort, "alphasort is unportable - "
735                  "use gnulib module alphasort for portability");
736 # endif
737 #endif
738 
739 
740 #endif /* _GL_DIRENT_H */
741 #endif /* _GL_DIRENT_H */
742