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