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