00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _GL_DIRENT_H
00021
00022 #if __GNUC__ >= 3
00023 #pragma GCC system_header
00024 #endif
00025
00026
00027
00028 #include_next <dirent.h>
00029
00030 #ifndef _GL_DIRENT_H
00031 #define _GL_DIRENT_H
00032
00033
00034 #include <sys/types.h>
00035
00036
00037 #ifndef _GL_CXXDEFS_H
00038 #define _GL_CXXDEFS_H
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 #if defined __cplusplus
00102 # define _GL_EXTERN_C extern "C"
00103 #else
00104 # define _GL_EXTERN_C extern
00105 #endif
00106
00107
00108
00109
00110
00111
00112
00113
00114 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
00115 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
00116 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
00117 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
00118
00119
00120
00121
00122
00123
00124
00125
00126 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
00127 _GL_EXTERN_C rettype func parameters_and_attributes
00128
00129
00130
00131
00132
00133
00134
00135 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
00136 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
00137 #if defined __cplusplus && defined GNULIB_NAMESPACE
00138 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
00139 namespace GNULIB_NAMESPACE \
00140 { \
00141 rettype (*const func) parameters = ::rpl_func; \
00142 } \
00143 _GL_EXTERN_C int _gl_cxxalias_dummy
00144 #else
00145 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
00146 _GL_EXTERN_C int _gl_cxxalias_dummy
00147 #endif
00148
00149
00150
00151
00152
00153
00154 #if defined __cplusplus && defined GNULIB_NAMESPACE
00155 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
00156 namespace GNULIB_NAMESPACE \
00157 { \
00158 rettype (*const func) parameters = \
00159 reinterpret_cast<rettype(*)parameters>(::rpl_func); \
00160 } \
00161 _GL_EXTERN_C int _gl_cxxalias_dummy
00162 #else
00163 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
00164 _GL_EXTERN_C int _gl_cxxalias_dummy
00165 #endif
00166
00167
00168
00169
00170
00171
00172
00173
00174 #if defined __cplusplus && defined GNULIB_NAMESPACE
00175
00176
00177
00178
00179
00180
00181 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
00182 namespace GNULIB_NAMESPACE \
00183 { \
00184 static rettype (*func) parameters = ::func; \
00185 } \
00186 _GL_EXTERN_C int _gl_cxxalias_dummy
00187 #else
00188 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
00189 _GL_EXTERN_C int _gl_cxxalias_dummy
00190 #endif
00191
00192
00193
00194
00195
00196
00197 #if defined __cplusplus && defined GNULIB_NAMESPACE
00198 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
00199 namespace GNULIB_NAMESPACE \
00200 { \
00201 static rettype (*func) parameters = \
00202 reinterpret_cast<rettype(*)parameters>(::func); \
00203 } \
00204 _GL_EXTERN_C int _gl_cxxalias_dummy
00205 #else
00206 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
00207 _GL_EXTERN_C int _gl_cxxalias_dummy
00208 #endif
00209
00210
00211
00212
00213
00214
00215
00216 #if defined __cplusplus && defined GNULIB_NAMESPACE
00217
00218
00219
00220
00221
00222 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
00223 namespace GNULIB_NAMESPACE \
00224 { \
00225 static rettype (*func) parameters = \
00226 reinterpret_cast<rettype(*)parameters>( \
00227 (rettype2(*)parameters2)(::func)); \
00228 } \
00229 _GL_EXTERN_C int _gl_cxxalias_dummy
00230 #else
00231 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
00232 _GL_EXTERN_C int _gl_cxxalias_dummy
00233 #endif
00234
00235
00236
00237
00238
00239 #if defined __cplusplus && defined GNULIB_NAMESPACE
00240 # define _GL_CXXALIASWARN(func) \
00241 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
00242 # define _GL_CXXALIASWARN_1(func,namespace) \
00243 _GL_CXXALIASWARN_2 (func, namespace)
00244
00245
00246 # if !__OPTIMIZE__
00247 # define _GL_CXXALIASWARN_2(func,namespace) \
00248 _GL_WARN_ON_USE (func, \
00249 "The symbol ::" #func " refers to the system function. " \
00250 "Use " #namespace "::" #func " instead.")
00251 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
00252 # define _GL_CXXALIASWARN_2(func,namespace) \
00253 extern __typeof__ (func) func
00254 # else
00255 # define _GL_CXXALIASWARN_2(func,namespace) \
00256 _GL_EXTERN_C int _gl_cxxalias_dummy
00257 # endif
00258 #else
00259 # define _GL_CXXALIASWARN(func) \
00260 _GL_EXTERN_C int _gl_cxxalias_dummy
00261 #endif
00262
00263
00264
00265
00266 #if defined __cplusplus && defined GNULIB_NAMESPACE
00267 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
00268 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
00269 GNULIB_NAMESPACE)
00270 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
00271 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
00272
00273
00274 # if !__OPTIMIZE__
00275 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
00276 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
00277 "The symbol ::" #func " refers to the system function. " \
00278 "Use " #namespace "::" #func " instead.")
00279 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
00280 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
00281 extern __typeof__ (func) func
00282 # else
00283 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
00284 _GL_EXTERN_C int _gl_cxxalias_dummy
00285 # endif
00286 #else
00287 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
00288 _GL_EXTERN_C int _gl_cxxalias_dummy
00289 #endif
00290
00291 #endif
00292
00293
00294
00295
00296
00297 #ifndef _GL_ARG_NONNULL
00298 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
00299 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
00300 # else
00301 # define _GL_ARG_NONNULL(params)
00302 # endif
00303 #endif
00304
00305
00306 #ifndef _GL_WARN_ON_USE
00307
00308 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
00309
00310 # define _GL_WARN_ON_USE(function, message) \
00311 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
00312 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
00313
00314 # define _GL_WARN_ON_USE(function, message) \
00315 extern __typeof__ (function) function
00316 # else
00317 # define _GL_WARN_ON_USE(function, message) \
00318 _GL_WARN_EXTERN_C int _gl_warn_on_use
00319 # endif
00320 #endif
00321
00322
00323
00324
00325
00326
00327
00328 #ifndef _GL_WARN_ON_USE_CXX
00329 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
00330 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
00331 extern rettype function parameters_and_attributes \
00332 __attribute__ ((__warning__ (msg)))
00333 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
00334
00335 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
00336 extern rettype function parameters_and_attributes
00337 # else
00338 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
00339 _GL_WARN_EXTERN_C int _gl_warn_on_use
00340 # endif
00341 #endif
00342
00343
00344
00345 #ifndef _GL_WARN_EXTERN_C
00346 # if defined __cplusplus
00347 # define _GL_WARN_EXTERN_C extern "C"
00348 # else
00349 # define _GL_WARN_EXTERN_C extern
00350 # endif
00351 #endif
00352
00353
00354
00355
00356 #if 0
00357 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00358 # define closedir rpl_closedir
00359 # endif
00360 _GL_FUNCDECL_RPL (closedir, int, (DIR *) _GL_ARG_NONNULL ((1)));
00361 _GL_CXXALIAS_RPL (closedir, int, (DIR *));
00362 #else
00363 _GL_CXXALIAS_SYS (closedir, int, (DIR *));
00364 #endif
00365 _GL_CXXALIASWARN (closedir);
00366
00367 #if 1
00368
00369
00370 # if 0
00371 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00372 # undef dirfd
00373 # define dirfd rpl_dirfd
00374 # endif
00375 _GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
00376 _GL_CXXALIAS_RPL (dirfd, int, (DIR *));
00377 # else
00378 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined dirfd
00379
00380
00381 static inline int (dirfd) (DIR *dp) { return dirfd (dp); }
00382 # undef dirfd
00383 # endif
00384 # if !(1 || defined dirfd)
00385 _GL_FUNCDECL_SYS (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
00386 # endif
00387 _GL_CXXALIAS_SYS (dirfd, int, (DIR *));
00388 # endif
00389 _GL_CXXALIASWARN (dirfd);
00390 #elif defined GNULIB_POSIXCHECK
00391 # undef dirfd
00392 # if HAVE_RAW_DECL_DIRFD
00393 _GL_WARN_ON_USE (dirfd, "dirfd is unportable - "
00394 "use gnulib module dirfd for portability");
00395 # endif
00396 #endif
00397
00398 #if 1
00399
00400
00401
00402
00403
00404 # if 0
00405 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00406 # undef fdopendir
00407 # define fdopendir rpl_fdopendir
00408 # endif
00409 _GL_FUNCDECL_RPL (fdopendir, DIR *, (int fd));
00410 _GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd));
00411 # else
00412 # if !1 || !1
00413 _GL_FUNCDECL_SYS (fdopendir, DIR *, (int fd));
00414 # endif
00415 _GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd));
00416 # endif
00417 _GL_CXXALIASWARN (fdopendir);
00418 #elif defined GNULIB_POSIXCHECK
00419 # undef fdopendir
00420 # if HAVE_RAW_DECL_FDOPENDIR
00421 _GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - "
00422 "use gnulib module fdopendir for portability");
00423 # endif
00424 #endif
00425
00426 #if 0
00427 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00428 # define opendir rpl_opendir
00429 # endif
00430 _GL_FUNCDECL_RPL (opendir, DIR *, (const char *) _GL_ARG_NONNULL ((1)));
00431 _GL_CXXALIAS_RPL (opendir, DIR *, (const char *));
00432 #else
00433 _GL_CXXALIAS_SYS (opendir, DIR *, (const char *));
00434 #endif
00435 _GL_CXXALIASWARN (opendir);
00436
00437 #if 0
00438
00439
00440
00441
00442 # if !1
00443 _GL_FUNCDECL_SYS (scandir, int,
00444 (const char *dir, struct dirent ***namelist,
00445 int (*filter) (const struct dirent *),
00446 int (*cmp) (const struct dirent **, const struct dirent **))
00447 _GL_ARG_NONNULL ((1, 2, 4)));
00448 # endif
00449
00450
00451 _GL_CXXALIAS_SYS_CAST (scandir, int,
00452 (const char *dir, struct dirent ***namelist,
00453 int (*filter) (const struct dirent *),
00454 int (*cmp) (const struct dirent **, const struct dirent **)));
00455 _GL_CXXALIASWARN (scandir);
00456 #elif defined GNULIB_POSIXCHECK
00457 # undef scandir
00458 # if HAVE_RAW_DECL_SCANDIR
00459 _GL_WARN_ON_USE (scandir, "scandir is unportable - "
00460 "use gnulib module scandir for portability");
00461 # endif
00462 #endif
00463
00464 #if 0
00465
00466 # if !1
00467 _GL_FUNCDECL_SYS (alphasort, int,
00468 (const struct dirent **, const struct dirent **)
00469 _GL_ARG_NONNULL ((1, 2)));
00470 # endif
00471
00472
00473 _GL_CXXALIAS_SYS_CAST (alphasort, int,
00474 (const struct dirent **, const struct dirent **));
00475 _GL_CXXALIASWARN (alphasort);
00476 #elif defined GNULIB_POSIXCHECK
00477 # undef alphasort
00478 # if HAVE_RAW_DECL_ALPHASORT
00479 _GL_WARN_ON_USE (alphasort, "alphasort is unportable - "
00480 "use gnulib module alphasort for portability");
00481 # endif
00482 #endif
00483
00484
00485 #endif
00486 #endif