21 #pragma GCC system_header
27 # include_next <dirent.h>
38 # if !GNULIB_defined_struct_dirent
54 typedef struct gl_directory DIR;
55 # define GNULIB_defined_struct_dirent 1
61 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
62 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
64 # define _GL_ATTRIBUTE_PURE
132 #if defined __cplusplus
133 # define _GL_EXTERN_C extern "C"
135 # define _GL_EXTERN_C extern
145 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
146 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
147 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
148 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
157 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
158 _GL_EXTERN_C rettype func parameters_and_attributes
166 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
167 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
168 #if defined __cplusplus && defined GNULIB_NAMESPACE
169 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
170 namespace GNULIB_NAMESPACE \
172 rettype (*const func) parameters = ::rpl_func; \
174 _GL_EXTERN_C int _gl_cxxalias_dummy
176 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
177 _GL_EXTERN_C int _gl_cxxalias_dummy
185 #if defined __cplusplus && defined GNULIB_NAMESPACE
186 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
187 namespace GNULIB_NAMESPACE \
189 rettype (*const func) parameters = \
190 reinterpret_cast<rettype(*)parameters>(::rpl_func); \
192 _GL_EXTERN_C int _gl_cxxalias_dummy
194 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
195 _GL_EXTERN_C int _gl_cxxalias_dummy
205 #if defined __cplusplus && defined GNULIB_NAMESPACE
212 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
213 namespace GNULIB_NAMESPACE \
215 static rettype (*func) parameters = ::func; \
217 _GL_EXTERN_C int _gl_cxxalias_dummy
219 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
220 _GL_EXTERN_C int _gl_cxxalias_dummy
228 #if defined __cplusplus && defined GNULIB_NAMESPACE
229 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
230 namespace GNULIB_NAMESPACE \
232 static rettype (*func) parameters = \
233 reinterpret_cast<rettype(*)parameters>(::func); \
235 _GL_EXTERN_C int _gl_cxxalias_dummy
237 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
238 _GL_EXTERN_C int _gl_cxxalias_dummy
247 #if defined __cplusplus && defined GNULIB_NAMESPACE
253 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
254 namespace GNULIB_NAMESPACE \
256 static rettype (*func) parameters = \
257 reinterpret_cast<rettype(*)parameters>( \
258 (rettype2(*)parameters2)(::func)); \
260 _GL_EXTERN_C int _gl_cxxalias_dummy
262 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
263 _GL_EXTERN_C int _gl_cxxalias_dummy
270 #if defined __cplusplus && defined GNULIB_NAMESPACE
271 # define _GL_CXXALIASWARN(func) \
272 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
273 # define _GL_CXXALIASWARN_1(func,namespace) \
274 _GL_CXXALIASWARN_2 (func, namespace)
278 # define _GL_CXXALIASWARN_2(func,namespace) \
279 _GL_WARN_ON_USE (func, \
280 "The symbol ::" #func " refers to the system function. " \
281 "Use " #namespace "::" #func " instead.")
282 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
283 # define _GL_CXXALIASWARN_2(func,namespace) \
284 extern __typeof__ (func) func
286 # define _GL_CXXALIASWARN_2(func,namespace) \
287 _GL_EXTERN_C int _gl_cxxalias_dummy
290 # define _GL_CXXALIASWARN(func) \
291 _GL_EXTERN_C int _gl_cxxalias_dummy
297 #if defined __cplusplus && defined GNULIB_NAMESPACE
298 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
299 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
301 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
302 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
306 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
307 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
308 "The symbol ::" #func " refers to the system function. " \
309 "Use " #namespace "::" #func " instead.")
310 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
311 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
312 extern __typeof__ (func) func
314 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
315 _GL_EXTERN_C int _gl_cxxalias_dummy
318 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
319 _GL_EXTERN_C int _gl_cxxalias_dummy
328 #ifndef _GL_ARG_NONNULL
329 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
330 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
332 # define _GL_ARG_NONNULL(params)
337 #ifndef _GL_WARN_ON_USE
339 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
341 # define _GL_WARN_ON_USE(function, message) \
342 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
343 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
345 # define _GL_WARN_ON_USE(function, message) \
346 extern __typeof__ (function) function
348 # define _GL_WARN_ON_USE(function, message) \
349 _GL_WARN_EXTERN_C int _gl_warn_on_use
359 #ifndef _GL_WARN_ON_USE_CXX
360 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
361 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
362 extern rettype function parameters_and_attributes \
363 __attribute__ ((__warning__ (msg)))
364 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
366 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
367 extern rettype function parameters_and_attributes
369 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
370 _GL_WARN_EXTERN_C int _gl_warn_on_use
376 #ifndef _GL_WARN_EXTERN_C
377 # if defined __cplusplus
378 # define _GL_WARN_EXTERN_C extern "C"
380 # define _GL_WARN_EXTERN_C extern
389 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
391 # define opendir rpl_opendir
402 #elif defined GNULIB_POSIXCHECK
404 # if HAVE_RAW_DECL_OPENDIR
406 "use gnulib module opendir for portability");
416 #elif defined GNULIB_POSIXCHECK
418 # if HAVE_RAW_DECL_READDIR
420 "use gnulib module readdir for portability");
430 #elif defined GNULIB_POSIXCHECK
432 # if HAVE_RAW_DECL_REWINDDIR
434 "use gnulib module rewinddir for portability");
440 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
442 # define closedir rpl_closedir
453 #elif defined GNULIB_POSIXCHECK
455 # if HAVE_RAW_DECL_CLOSEDIR
457 "use gnulib module closedir for portability");
465 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
467 # define dirfd rpl_dirfd
472 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined dirfd
475 static inline int (dirfd) (DIR *dp) {
return dirfd (dp); }
478 # if !(1 || defined dirfd)
484 #elif defined GNULIB_POSIXCHECK
486 # if HAVE_RAW_DECL_DIRFD
488 "use gnulib module dirfd for portability");
499 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
501 # define fdopendir rpl_fdopendir
512 #elif defined GNULIB_POSIXCHECK
514 # if HAVE_RAW_DECL_FDOPENDIR
516 "use gnulib module fdopendir for portability");
527 (
const char *dir,
struct dirent ***namelist,
528 int (*filter) (
const struct dirent *),
529 int (*cmp) (
const struct dirent **,
const struct dirent **))
535 (
const char *dir,
struct dirent ***namelist,
536 int (*filter) (
const struct dirent *),
537 int (*cmp) (
const struct dirent **,
const struct dirent **)));
539 #elif defined GNULIB_POSIXCHECK
541 # if HAVE_RAW_DECL_SCANDIR
543 "use gnulib module scandir for portability");
551 (
const struct dirent **,
const struct dirent **)
558 (
const struct dirent **,
const struct dirent **));
560 #elif defined GNULIB_POSIXCHECK
562 # if HAVE_RAW_DECL_ALPHASORT
564 "use gnulib module alphasort for portability");
#define _GL_CXXALIASWARN(func)
#define _GL_CXXALIAS_SYS(func, rettype, parameters)
#define _GL_ATTRIBUTE_PURE
#define _GL_CXXALIAS_RPL(func, rettype, parameters)
#define _GL_WARN_ON_USE(function, message)
#define _GL_ARG_NONNULL(params)
#define _GL_CXXALIAS_SYS_CAST(func, rettype, parameters)
#define _GL_FUNCDECL_SYS(func, rettype, parameters_and_attributes)
#define _GL_FUNCDECL_RPL(func, rettype, parameters_and_attributes)