1*49678444Schristos /* This file is automatically generated. DO NOT EDIT! */ 2*49678444Schristos /* Generated from: NetBSD: mknative-gdb,v 1.12 2020/09/17 16:54:31 christos Exp */ 3*49678444Schristos /* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp */ 4*49678444Schristos 5*49678444Schristos /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 6*49678444Schristos /* Like <fcntl.h>, but with non-working flags defined to 0. 7*49678444Schristos 8*49678444Schristos Copyright (C) 2006-2020 Free Software Foundation, Inc. 9*49678444Schristos 10*49678444Schristos This program is free software: you can redistribute it and/or modify 11*49678444Schristos it under the terms of the GNU General Public License as published by 12*49678444Schristos the Free Software Foundation; either version 3 of the License, or 13*49678444Schristos (at your option) any later version. 14*49678444Schristos 15*49678444Schristos This program is distributed in the hope that it will be useful, 16*49678444Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 17*49678444Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*49678444Schristos GNU General Public License for more details. 19*49678444Schristos 20*49678444Schristos You should have received a copy of the GNU General Public License 21*49678444Schristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 22*49678444Schristos 23*49678444Schristos /* written by Paul Eggert */ 24*49678444Schristos 25*49678444Schristos #if __GNUC__ >= 3 26*49678444Schristos #pragma GCC system_header 27*49678444Schristos #endif 28*49678444Schristos 29*49678444Schristos 30*49678444Schristos #if defined __need_system_fcntl_h 31*49678444Schristos /* Special invocation convention. */ 32*49678444Schristos 33*49678444Schristos /* Needed before <sys/stat.h>. 34*49678444Schristos May also define off_t to a 64-bit type on native Windows. */ 35*49678444Schristos #include <sys/types.h> 36*49678444Schristos /* On some systems other than glibc, <sys/stat.h> is a prerequisite of 37*49678444Schristos <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. 38*49678444Schristos But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an 39*49678444Schristos extern "C" { ... } block, which leads to errors in C++ mode with the 40*49678444Schristos overridden <sys/stat.h> from gnulib. These errors are known to be gone 41*49678444Schristos with g++ version >= 4.3. */ 42*49678444Schristos #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))) 43*49678444Schristos # include <sys/stat.h> 44*49678444Schristos #endif 45*49678444Schristos #include_next <fcntl.h> 46*49678444Schristos 47*49678444Schristos /* Native Windows platforms declare open(), creat() in <io.h>. */ 48*49678444Schristos #if (0 || 1 || defined GNULIB_POSIXCHECK) \ 49*49678444Schristos && (defined _WIN32 && ! defined __CYGWIN__) 50*49678444Schristos # include <io.h> 51*49678444Schristos #endif 52*49678444Schristos 53*49678444Schristos #else 54*49678444Schristos /* Normal invocation convention. */ 55*49678444Schristos 56*49678444Schristos #ifndef _GL_FCNTL_H 57*49678444Schristos 58*49678444Schristos /* Needed before <sys/stat.h>. 59*49678444Schristos May also define off_t to a 64-bit type on native Windows. */ 60*49678444Schristos #include <sys/types.h> 61*49678444Schristos /* On some systems other than glibc, <sys/stat.h> is a prerequisite of 62*49678444Schristos <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. 63*49678444Schristos But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an 64*49678444Schristos extern "C" { ... } block, which leads to errors in C++ mode with the 65*49678444Schristos overridden <sys/stat.h> from gnulib. These errors are known to be gone 66*49678444Schristos with g++ version >= 4.3. */ 67*49678444Schristos #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))) 68*49678444Schristos # include <sys/stat.h> 69*49678444Schristos #endif 70*49678444Schristos /* The include_next requires a split double-inclusion guard. */ 71*49678444Schristos #include_next <fcntl.h> 72*49678444Schristos 73*49678444Schristos /* Native Windows platforms declare open(), creat() in <io.h>. */ 74*49678444Schristos #if (0 || 1 || defined GNULIB_POSIXCHECK) \ 75*49678444Schristos && (defined _WIN32 && ! defined __CYGWIN__) 76*49678444Schristos # include <io.h> 77*49678444Schristos #endif 78*49678444Schristos 79*49678444Schristos #ifndef _GL_FCNTL_H 80*49678444Schristos #define _GL_FCNTL_H 81*49678444Schristos 82*49678444Schristos #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */ 83*49678444Schristos # include <unistd.h> 84*49678444Schristos #endif 85*49678444Schristos 86*49678444Schristos 87*49678444Schristos /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 88*49678444Schristos /* C++ compatible function declaration macros. 89*49678444Schristos Copyright (C) 2010-2020 Free Software Foundation, Inc. 90*49678444Schristos 91*49678444Schristos This program is free software: you can redistribute it and/or modify it 92*49678444Schristos under the terms of the GNU General Public License as published 93*49678444Schristos by the Free Software Foundation; either version 3 of the License, or 94*49678444Schristos (at your option) any later version. 95*49678444Schristos 96*49678444Schristos This program is distributed in the hope that it will be useful, 97*49678444Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 98*49678444Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 99*49678444Schristos General Public License for more details. 100*49678444Schristos 101*49678444Schristos You should have received a copy of the GNU General Public License 102*49678444Schristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 103*49678444Schristos 104*49678444Schristos #ifndef _GL_CXXDEFS_H 105*49678444Schristos #define _GL_CXXDEFS_H 106*49678444Schristos 107*49678444Schristos /* Begin/end the GNULIB_NAMESPACE namespace. */ 108*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 109*49678444Schristos # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 110*49678444Schristos # define _GL_END_NAMESPACE } 111*49678444Schristos #else 112*49678444Schristos # define _GL_BEGIN_NAMESPACE 113*49678444Schristos # define _GL_END_NAMESPACE 114*49678444Schristos #endif 115*49678444Schristos 116*49678444Schristos /* The three most frequent use cases of these macros are: 117*49678444Schristos 118*49678444Schristos * For providing a substitute for a function that is missing on some 119*49678444Schristos platforms, but is declared and works fine on the platforms on which 120*49678444Schristos it exists: 121*49678444Schristos 122*49678444Schristos #if @GNULIB_FOO@ 123*49678444Schristos # if !@HAVE_FOO@ 124*49678444Schristos _GL_FUNCDECL_SYS (foo, ...); 125*49678444Schristos # endif 126*49678444Schristos _GL_CXXALIAS_SYS (foo, ...); 127*49678444Schristos _GL_CXXALIASWARN (foo); 128*49678444Schristos #elif defined GNULIB_POSIXCHECK 129*49678444Schristos ... 130*49678444Schristos #endif 131*49678444Schristos 132*49678444Schristos * For providing a replacement for a function that exists on all platforms, 133*49678444Schristos but is broken/insufficient and needs to be replaced on some platforms: 134*49678444Schristos 135*49678444Schristos #if @GNULIB_FOO@ 136*49678444Schristos # if @REPLACE_FOO@ 137*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 138*49678444Schristos # undef foo 139*49678444Schristos # define foo rpl_foo 140*49678444Schristos # endif 141*49678444Schristos _GL_FUNCDECL_RPL (foo, ...); 142*49678444Schristos _GL_CXXALIAS_RPL (foo, ...); 143*49678444Schristos # else 144*49678444Schristos _GL_CXXALIAS_SYS (foo, ...); 145*49678444Schristos # endif 146*49678444Schristos _GL_CXXALIASWARN (foo); 147*49678444Schristos #elif defined GNULIB_POSIXCHECK 148*49678444Schristos ... 149*49678444Schristos #endif 150*49678444Schristos 151*49678444Schristos * For providing a replacement for a function that exists on some platforms 152*49678444Schristos but is broken/insufficient and needs to be replaced on some of them and 153*49678444Schristos is additionally either missing or undeclared on some other platforms: 154*49678444Schristos 155*49678444Schristos #if @GNULIB_FOO@ 156*49678444Schristos # if @REPLACE_FOO@ 157*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 158*49678444Schristos # undef foo 159*49678444Schristos # define foo rpl_foo 160*49678444Schristos # endif 161*49678444Schristos _GL_FUNCDECL_RPL (foo, ...); 162*49678444Schristos _GL_CXXALIAS_RPL (foo, ...); 163*49678444Schristos # else 164*49678444Schristos # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 165*49678444Schristos _GL_FUNCDECL_SYS (foo, ...); 166*49678444Schristos # endif 167*49678444Schristos _GL_CXXALIAS_SYS (foo, ...); 168*49678444Schristos # endif 169*49678444Schristos _GL_CXXALIASWARN (foo); 170*49678444Schristos #elif defined GNULIB_POSIXCHECK 171*49678444Schristos ... 172*49678444Schristos #endif 173*49678444Schristos */ 174*49678444Schristos 175*49678444Schristos /* _GL_EXTERN_C declaration; 176*49678444Schristos performs the declaration with C linkage. */ 177*49678444Schristos #if defined __cplusplus 178*49678444Schristos # define _GL_EXTERN_C extern "C" 179*49678444Schristos #else 180*49678444Schristos # define _GL_EXTERN_C extern 181*49678444Schristos #endif 182*49678444Schristos 183*49678444Schristos /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 184*49678444Schristos declares a replacement function, named rpl_func, with the given prototype, 185*49678444Schristos consisting of return type, parameters, and attributes. 186*49678444Schristos Example: 187*49678444Schristos _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 188*49678444Schristos _GL_ARG_NONNULL ((1))); 189*49678444Schristos */ 190*49678444Schristos #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 191*49678444Schristos _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 192*49678444Schristos #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 193*49678444Schristos _GL_EXTERN_C rettype rpl_func parameters_and_attributes 194*49678444Schristos 195*49678444Schristos /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 196*49678444Schristos declares the system function, named func, with the given prototype, 197*49678444Schristos consisting of return type, parameters, and attributes. 198*49678444Schristos Example: 199*49678444Schristos _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 200*49678444Schristos _GL_ARG_NONNULL ((1))); 201*49678444Schristos */ 202*49678444Schristos #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 203*49678444Schristos _GL_EXTERN_C rettype func parameters_and_attributes 204*49678444Schristos 205*49678444Schristos /* _GL_CXXALIAS_RPL (func, rettype, parameters); 206*49678444Schristos declares a C++ alias called GNULIB_NAMESPACE::func 207*49678444Schristos that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 208*49678444Schristos Example: 209*49678444Schristos _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 210*49678444Schristos 211*49678444Schristos Wrapping rpl_func in an object with an inline conversion operator 212*49678444Schristos avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 213*49678444Schristos actually used in the program. */ 214*49678444Schristos #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 215*49678444Schristos _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 216*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 217*49678444Schristos # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 218*49678444Schristos namespace GNULIB_NAMESPACE \ 219*49678444Schristos { \ 220*49678444Schristos static const struct _gl_ ## func ## _wrapper \ 221*49678444Schristos { \ 222*49678444Schristos typedef rettype (*type) parameters; \ 223*49678444Schristos \ 224*49678444Schristos inline operator type () const \ 225*49678444Schristos { \ 226*49678444Schristos return ::rpl_func; \ 227*49678444Schristos } \ 228*49678444Schristos } func = {}; \ 229*49678444Schristos } \ 230*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 231*49678444Schristos #else 232*49678444Schristos # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 233*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 234*49678444Schristos #endif 235*49678444Schristos 236*49678444Schristos /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 237*49678444Schristos is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 238*49678444Schristos except that the C function rpl_func may have a slightly different 239*49678444Schristos declaration. A cast is used to silence the "invalid conversion" error 240*49678444Schristos that would otherwise occur. */ 241*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 242*49678444Schristos # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 243*49678444Schristos namespace GNULIB_NAMESPACE \ 244*49678444Schristos { \ 245*49678444Schristos static const struct _gl_ ## func ## _wrapper \ 246*49678444Schristos { \ 247*49678444Schristos typedef rettype (*type) parameters; \ 248*49678444Schristos \ 249*49678444Schristos inline operator type () const \ 250*49678444Schristos { \ 251*49678444Schristos return reinterpret_cast<type>(::rpl_func); \ 252*49678444Schristos } \ 253*49678444Schristos } func = {}; \ 254*49678444Schristos } \ 255*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 256*49678444Schristos #else 257*49678444Schristos # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 258*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 259*49678444Schristos #endif 260*49678444Schristos 261*49678444Schristos /* _GL_CXXALIAS_SYS (func, rettype, parameters); 262*49678444Schristos declares a C++ alias called GNULIB_NAMESPACE::func 263*49678444Schristos that redirects to the system provided function func, if GNULIB_NAMESPACE 264*49678444Schristos is defined. 265*49678444Schristos Example: 266*49678444Schristos _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 267*49678444Schristos 268*49678444Schristos Wrapping func in an object with an inline conversion operator 269*49678444Schristos avoids a reference to func unless GNULIB_NAMESPACE::func is 270*49678444Schristos actually used in the program. */ 271*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 272*49678444Schristos # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 273*49678444Schristos namespace GNULIB_NAMESPACE \ 274*49678444Schristos { \ 275*49678444Schristos static const struct _gl_ ## func ## _wrapper \ 276*49678444Schristos { \ 277*49678444Schristos typedef rettype (*type) parameters; \ 278*49678444Schristos \ 279*49678444Schristos inline operator type () const \ 280*49678444Schristos { \ 281*49678444Schristos return ::func; \ 282*49678444Schristos } \ 283*49678444Schristos } func = {}; \ 284*49678444Schristos } \ 285*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 286*49678444Schristos #else 287*49678444Schristos # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 288*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 289*49678444Schristos #endif 290*49678444Schristos 291*49678444Schristos /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 292*49678444Schristos is like _GL_CXXALIAS_SYS (func, rettype, parameters); 293*49678444Schristos except that the C function func may have a slightly different declaration. 294*49678444Schristos A cast is used to silence the "invalid conversion" error that would 295*49678444Schristos otherwise occur. */ 296*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 297*49678444Schristos # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 298*49678444Schristos namespace GNULIB_NAMESPACE \ 299*49678444Schristos { \ 300*49678444Schristos static const struct _gl_ ## func ## _wrapper \ 301*49678444Schristos { \ 302*49678444Schristos typedef rettype (*type) parameters; \ 303*49678444Schristos \ 304*49678444Schristos inline operator type () const \ 305*49678444Schristos { \ 306*49678444Schristos return reinterpret_cast<type>(::func); \ 307*49678444Schristos } \ 308*49678444Schristos } func = {}; \ 309*49678444Schristos } \ 310*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 311*49678444Schristos #else 312*49678444Schristos # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 313*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 314*49678444Schristos #endif 315*49678444Schristos 316*49678444Schristos /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 317*49678444Schristos is like _GL_CXXALIAS_SYS (func, rettype, parameters); 318*49678444Schristos except that the C function is picked among a set of overloaded functions, 319*49678444Schristos namely the one with rettype2 and parameters2. Two consecutive casts 320*49678444Schristos are used to silence the "cannot find a match" and "invalid conversion" 321*49678444Schristos errors that would otherwise occur. */ 322*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 323*49678444Schristos /* The outer cast must be a reinterpret_cast. 324*49678444Schristos The inner cast: When the function is defined as a set of overloaded 325*49678444Schristos functions, it works as a static_cast<>, choosing the designated variant. 326*49678444Schristos When the function is defined as a single variant, it works as a 327*49678444Schristos reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 328*49678444Schristos # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 329*49678444Schristos namespace GNULIB_NAMESPACE \ 330*49678444Schristos { \ 331*49678444Schristos static const struct _gl_ ## func ## _wrapper \ 332*49678444Schristos { \ 333*49678444Schristos typedef rettype (*type) parameters; \ 334*49678444Schristos \ 335*49678444Schristos inline operator type () const \ 336*49678444Schristos { \ 337*49678444Schristos return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 338*49678444Schristos } \ 339*49678444Schristos } func = {}; \ 340*49678444Schristos } \ 341*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 342*49678444Schristos #else 343*49678444Schristos # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 344*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 345*49678444Schristos #endif 346*49678444Schristos 347*49678444Schristos /* _GL_CXXALIASWARN (func); 348*49678444Schristos causes a warning to be emitted when ::func is used but not when 349*49678444Schristos GNULIB_NAMESPACE::func is used. func must be defined without overloaded 350*49678444Schristos variants. */ 351*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 352*49678444Schristos # define _GL_CXXALIASWARN(func) \ 353*49678444Schristos _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 354*49678444Schristos # define _GL_CXXALIASWARN_1(func,namespace) \ 355*49678444Schristos _GL_CXXALIASWARN_2 (func, namespace) 356*49678444Schristos /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 357*49678444Schristos we enable the warning only when not optimizing. */ 358*49678444Schristos # if !__OPTIMIZE__ 359*49678444Schristos # define _GL_CXXALIASWARN_2(func,namespace) \ 360*49678444Schristos _GL_WARN_ON_USE (func, \ 361*49678444Schristos "The symbol ::" #func " refers to the system function. " \ 362*49678444Schristos "Use " #namespace "::" #func " instead.") 363*49678444Schristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 364*49678444Schristos # define _GL_CXXALIASWARN_2(func,namespace) \ 365*49678444Schristos extern __typeof__ (func) func 366*49678444Schristos # else 367*49678444Schristos # define _GL_CXXALIASWARN_2(func,namespace) \ 368*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 369*49678444Schristos # endif 370*49678444Schristos #else 371*49678444Schristos # define _GL_CXXALIASWARN(func) \ 372*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 373*49678444Schristos #endif 374*49678444Schristos 375*49678444Schristos /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 376*49678444Schristos causes a warning to be emitted when the given overloaded variant of ::func 377*49678444Schristos is used but not when GNULIB_NAMESPACE::func is used. */ 378*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 379*49678444Schristos # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 380*49678444Schristos _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 381*49678444Schristos GNULIB_NAMESPACE) 382*49678444Schristos # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 383*49678444Schristos _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 384*49678444Schristos /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 385*49678444Schristos we enable the warning only when not optimizing. */ 386*49678444Schristos # if !__OPTIMIZE__ 387*49678444Schristos # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 388*49678444Schristos _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 389*49678444Schristos "The symbol ::" #func " refers to the system function. " \ 390*49678444Schristos "Use " #namespace "::" #func " instead.") 391*49678444Schristos # else 392*49678444Schristos # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 393*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 394*49678444Schristos # endif 395*49678444Schristos #else 396*49678444Schristos # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 397*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 398*49678444Schristos #endif 399*49678444Schristos 400*49678444Schristos #endif /* _GL_CXXDEFS_H */ 401*49678444Schristos 402*49678444Schristos /* The definition of _GL_ARG_NONNULL is copied here. */ 403*49678444Schristos /* A C macro for declaring that specific arguments must not be NULL. 404*49678444Schristos Copyright (C) 2009-2020 Free Software Foundation, Inc. 405*49678444Schristos 406*49678444Schristos This program is free software: you can redistribute it and/or modify it 407*49678444Schristos under the terms of the GNU General Public License as published 408*49678444Schristos by the Free Software Foundation; either version 3 of the License, or 409*49678444Schristos (at your option) any later version. 410*49678444Schristos 411*49678444Schristos This program is distributed in the hope that it will be useful, 412*49678444Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 413*49678444Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 414*49678444Schristos General Public License for more details. 415*49678444Schristos 416*49678444Schristos You should have received a copy of the GNU General Public License 417*49678444Schristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 418*49678444Schristos 419*49678444Schristos /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 420*49678444Schristos that the values passed as arguments n, ..., m must be non-NULL pointers. 421*49678444Schristos n = 1 stands for the first argument, n = 2 for the second argument etc. */ 422*49678444Schristos #ifndef _GL_ARG_NONNULL 423*49678444Schristos # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 424*49678444Schristos # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 425*49678444Schristos # else 426*49678444Schristos # define _GL_ARG_NONNULL(params) 427*49678444Schristos # endif 428*49678444Schristos #endif 429*49678444Schristos 430*49678444Schristos /* The definition of _GL_WARN_ON_USE is copied here. */ 431*49678444Schristos /* A C macro for emitting warnings if a function is used. 432*49678444Schristos Copyright (C) 2010-2020 Free Software Foundation, Inc. 433*49678444Schristos 434*49678444Schristos This program is free software: you can redistribute it and/or modify it 435*49678444Schristos under the terms of the GNU General Public License as published 436*49678444Schristos by the Free Software Foundation; either version 3 of the License, or 437*49678444Schristos (at your option) any later version. 438*49678444Schristos 439*49678444Schristos This program is distributed in the hope that it will be useful, 440*49678444Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 441*49678444Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 442*49678444Schristos General Public License for more details. 443*49678444Schristos 444*49678444Schristos You should have received a copy of the GNU General Public License 445*49678444Schristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 446*49678444Schristos 447*49678444Schristos /* _GL_WARN_ON_USE (function, "literal string") issues a declaration 448*49678444Schristos for FUNCTION which will then trigger a compiler warning containing 449*49678444Schristos the text of "literal string" anywhere that function is called, if 450*49678444Schristos supported by the compiler. If the compiler does not support this 451*49678444Schristos feature, the macro expands to an unused extern declaration. 452*49678444Schristos 453*49678444Schristos _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 454*49678444Schristos attribute used in _GL_WARN_ON_USE. If the compiler does not support 455*49678444Schristos this feature, it expands to empty. 456*49678444Schristos 457*49678444Schristos These macros are useful for marking a function as a potential 458*49678444Schristos portability trap, with the intent that "literal string" include 459*49678444Schristos instructions on the replacement function that should be used 460*49678444Schristos instead. 461*49678444Schristos _GL_WARN_ON_USE is for functions with 'extern' linkage. 462*49678444Schristos _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 463*49678444Schristos linkage. 464*49678444Schristos 465*49678444Schristos However, one of the reasons that a function is a portability trap is 466*49678444Schristos if it has the wrong signature. Declaring FUNCTION with a different 467*49678444Schristos signature in C is a compilation error, so this macro must use the 468*49678444Schristos same type as any existing declaration so that programs that avoid 469*49678444Schristos the problematic FUNCTION do not fail to compile merely because they 470*49678444Schristos included a header that poisoned the function. But this implies that 471*49678444Schristos _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 472*49678444Schristos have a declaration. Use of this macro implies that there must not 473*49678444Schristos be any other macro hiding the declaration of FUNCTION; but 474*49678444Schristos undefining FUNCTION first is part of the poisoning process anyway 475*49678444Schristos (although for symbols that are provided only via a macro, the result 476*49678444Schristos is a compilation error rather than a warning containing 477*49678444Schristos "literal string"). Also note that in C++, it is only safe to use if 478*49678444Schristos FUNCTION has no overloads. 479*49678444Schristos 480*49678444Schristos For an example, it is possible to poison 'getline' by: 481*49678444Schristos - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 482*49678444Schristos [getline]) in configure.ac, which potentially defines 483*49678444Schristos HAVE_RAW_DECL_GETLINE 484*49678444Schristos - adding this code to a header that wraps the system <stdio.h>: 485*49678444Schristos #undef getline 486*49678444Schristos #if HAVE_RAW_DECL_GETLINE 487*49678444Schristos _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 488*49678444Schristos "not universally present; use the gnulib module getline"); 489*49678444Schristos #endif 490*49678444Schristos 491*49678444Schristos It is not possible to directly poison global variables. But it is 492*49678444Schristos possible to write a wrapper accessor function, and poison that 493*49678444Schristos (less common usage, like &environ, will cause a compilation error 494*49678444Schristos rather than issue the nice warning, but the end result of informing 495*49678444Schristos the developer about their portability problem is still achieved): 496*49678444Schristos #if HAVE_RAW_DECL_ENVIRON 497*49678444Schristos static char *** 498*49678444Schristos rpl_environ (void) { return &environ; } 499*49678444Schristos _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 500*49678444Schristos # undef environ 501*49678444Schristos # define environ (*rpl_environ ()) 502*49678444Schristos #endif 503*49678444Schristos or better (avoiding contradictory use of 'static' and 'extern'): 504*49678444Schristos #if HAVE_RAW_DECL_ENVIRON 505*49678444Schristos static char *** 506*49678444Schristos _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 507*49678444Schristos rpl_environ (void) { return &environ; } 508*49678444Schristos # undef environ 509*49678444Schristos # define environ (*rpl_environ ()) 510*49678444Schristos #endif 511*49678444Schristos */ 512*49678444Schristos #ifndef _GL_WARN_ON_USE 513*49678444Schristos 514*49678444Schristos # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 515*49678444Schristos /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 516*49678444Schristos # define _GL_WARN_ON_USE(function, message) \ 517*49678444Schristos extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 518*49678444Schristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 519*49678444Schristos __attribute__ ((__warning__ (message))) 520*49678444Schristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 521*49678444Schristos /* Verify the existence of the function. */ 522*49678444Schristos # define _GL_WARN_ON_USE(function, message) \ 523*49678444Schristos extern __typeof__ (function) function 524*49678444Schristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) 525*49678444Schristos # else /* Unsupported. */ 526*49678444Schristos # define _GL_WARN_ON_USE(function, message) \ 527*49678444Schristos _GL_WARN_EXTERN_C int _gl_warn_on_use 528*49678444Schristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) 529*49678444Schristos # endif 530*49678444Schristos #endif 531*49678444Schristos 532*49678444Schristos /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 533*49678444Schristos is like _GL_WARN_ON_USE (function, "string"), except that in C++ mode the 534*49678444Schristos function is declared with the given prototype, consisting of return type, 535*49678444Schristos parameters, and attributes. 536*49678444Schristos This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 537*49678444Schristos not work in this case. */ 538*49678444Schristos #ifndef _GL_WARN_ON_USE_CXX 539*49678444Schristos # if !defined __cplusplus 540*49678444Schristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 541*49678444Schristos _GL_WARN_ON_USE (function, msg) 542*49678444Schristos # else 543*49678444Schristos # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 544*49678444Schristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 545*49678444Schristos extern rettype function parameters_and_attributes \ 546*49678444Schristos __attribute__ ((__warning__ (msg))) 547*49678444Schristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 548*49678444Schristos /* Verify the existence of the function. */ 549*49678444Schristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 550*49678444Schristos extern rettype function parameters_and_attributes 551*49678444Schristos # else /* Unsupported. */ 552*49678444Schristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 553*49678444Schristos _GL_WARN_EXTERN_C int _gl_warn_on_use 554*49678444Schristos # endif 555*49678444Schristos # endif 556*49678444Schristos #endif 557*49678444Schristos 558*49678444Schristos /* _GL_WARN_EXTERN_C declaration; 559*49678444Schristos performs the declaration with C linkage. */ 560*49678444Schristos #ifndef _GL_WARN_EXTERN_C 561*49678444Schristos # if defined __cplusplus 562*49678444Schristos # define _GL_WARN_EXTERN_C extern "C" 563*49678444Schristos # else 564*49678444Schristos # define _GL_WARN_EXTERN_C extern 565*49678444Schristos # endif 566*49678444Schristos #endif 567*49678444Schristos 568*49678444Schristos 569*49678444Schristos /* Declare overridden functions. */ 570*49678444Schristos 571*49678444Schristos #if 0 572*49678444Schristos # if 0 573*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 574*49678444Schristos # undef creat 575*49678444Schristos # define creat rpl_creat 576*49678444Schristos # endif 577*49678444Schristos _GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode) 578*49678444Schristos _GL_ARG_NONNULL ((1))); 579*49678444Schristos _GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode)); 580*49678444Schristos # else 581*49678444Schristos _GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode)); 582*49678444Schristos # endif 583*49678444Schristos _GL_CXXALIASWARN (creat); 584*49678444Schristos #elif defined GNULIB_POSIXCHECK 585*49678444Schristos # undef creat 586*49678444Schristos /* Assume creat is always declared. */ 587*49678444Schristos _GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - " 588*49678444Schristos "use gnulib module creat for portability"); 589*49678444Schristos #endif 590*49678444Schristos 591*49678444Schristos #if 1 592*49678444Schristos # if 0 593*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 594*49678444Schristos # undef fcntl 595*49678444Schristos # define fcntl rpl_fcntl 596*49678444Schristos # endif 597*49678444Schristos _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...)); 598*49678444Schristos _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...)); 599*49678444Schristos # if !GNULIB_defined_rpl_fcntl 600*49678444Schristos # define GNULIB_defined_rpl_fcntl 1 601*49678444Schristos # endif 602*49678444Schristos # else 603*49678444Schristos # if !1 604*49678444Schristos _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...)); 605*49678444Schristos # if !GNULIB_defined_fcntl 606*49678444Schristos # define GNULIB_defined_fcntl 1 607*49678444Schristos # endif 608*49678444Schristos # endif 609*49678444Schristos _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...)); 610*49678444Schristos # endif 611*49678444Schristos _GL_CXXALIASWARN (fcntl); 612*49678444Schristos #elif defined GNULIB_POSIXCHECK 613*49678444Schristos # undef fcntl 614*49678444Schristos # if HAVE_RAW_DECL_FCNTL 615*49678444Schristos _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - " 616*49678444Schristos "use gnulib module fcntl for portability"); 617*49678444Schristos # endif 618*49678444Schristos #endif 619*49678444Schristos 620*49678444Schristos #if 1 621*49678444Schristos # if 0 622*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 623*49678444Schristos # undef open 624*49678444Schristos # define open rpl_open 625*49678444Schristos # endif 626*49678444Schristos _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 627*49678444Schristos _GL_ARG_NONNULL ((1))); 628*49678444Schristos _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 629*49678444Schristos # else 630*49678444Schristos _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 631*49678444Schristos # endif 632*49678444Schristos /* On HP-UX 11, in C++ mode, open() is defined as an inline function with a 633*49678444Schristos default argument. _GL_CXXALIASWARN does not work in this case. */ 634*49678444Schristos # if !defined __hpux 635*49678444Schristos _GL_CXXALIASWARN (open); 636*49678444Schristos # endif 637*49678444Schristos #elif defined GNULIB_POSIXCHECK 638*49678444Schristos # undef open 639*49678444Schristos /* Assume open is always declared. */ 640*49678444Schristos _GL_WARN_ON_USE (open, "open is not always POSIX compliant - " 641*49678444Schristos "use gnulib module open for portability"); 642*49678444Schristos #endif 643*49678444Schristos 644*49678444Schristos #if 1 645*49678444Schristos # if 0 646*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 647*49678444Schristos # undef openat 648*49678444Schristos # define openat rpl_openat 649*49678444Schristos # endif 650*49678444Schristos _GL_FUNCDECL_RPL (openat, int, 651*49678444Schristos (int fd, char const *file, int flags, /* mode_t mode */ ...) 652*49678444Schristos _GL_ARG_NONNULL ((2))); 653*49678444Schristos _GL_CXXALIAS_RPL (openat, int, 654*49678444Schristos (int fd, char const *file, int flags, /* mode_t mode */ ...)); 655*49678444Schristos # else 656*49678444Schristos # if !1 657*49678444Schristos _GL_FUNCDECL_SYS (openat, int, 658*49678444Schristos (int fd, char const *file, int flags, /* mode_t mode */ ...) 659*49678444Schristos _GL_ARG_NONNULL ((2))); 660*49678444Schristos # endif 661*49678444Schristos _GL_CXXALIAS_SYS (openat, int, 662*49678444Schristos (int fd, char const *file, int flags, /* mode_t mode */ ...)); 663*49678444Schristos # endif 664*49678444Schristos _GL_CXXALIASWARN (openat); 665*49678444Schristos #elif defined GNULIB_POSIXCHECK 666*49678444Schristos # undef openat 667*49678444Schristos # if HAVE_RAW_DECL_OPENAT 668*49678444Schristos _GL_WARN_ON_USE (openat, "openat is not portable - " 669*49678444Schristos "use gnulib module openat for portability"); 670*49678444Schristos # endif 671*49678444Schristos #endif 672*49678444Schristos 673*49678444Schristos 674*49678444Schristos /* Fix up the FD_* macros, only known to be missing on mingw. */ 675*49678444Schristos 676*49678444Schristos #ifndef FD_CLOEXEC 677*49678444Schristos # define FD_CLOEXEC 1 678*49678444Schristos #endif 679*49678444Schristos 680*49678444Schristos /* Fix up the supported F_* macros. Intentionally leave other F_* 681*49678444Schristos macros undefined. Only known to be missing on mingw. */ 682*49678444Schristos 683*49678444Schristos #ifndef F_DUPFD_CLOEXEC 684*49678444Schristos # define F_DUPFD_CLOEXEC 0x40000000 685*49678444Schristos /* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise. */ 686*49678444Schristos # define GNULIB_defined_F_DUPFD_CLOEXEC 1 687*49678444Schristos #else 688*49678444Schristos # define GNULIB_defined_F_DUPFD_CLOEXEC 0 689*49678444Schristos #endif 690*49678444Schristos 691*49678444Schristos #ifndef F_DUPFD 692*49678444Schristos # define F_DUPFD 1 693*49678444Schristos #endif 694*49678444Schristos 695*49678444Schristos #ifndef F_GETFD 696*49678444Schristos # define F_GETFD 2 697*49678444Schristos #endif 698*49678444Schristos 699*49678444Schristos /* Fix up the O_* macros. */ 700*49678444Schristos 701*49678444Schristos /* AIX 7.1 with XL C 12.1 defines O_CLOEXEC, O_NOFOLLOW, and O_TTY_INIT 702*49678444Schristos to values outside 'int' range, so omit these misdefinitions. 703*49678444Schristos But avoid namespace pollution on non-AIX systems. */ 704*49678444Schristos #ifdef _AIX 705*49678444Schristos # include <limits.h> 706*49678444Schristos # if defined O_CLOEXEC && ! (INT_MIN <= O_CLOEXEC && O_CLOEXEC <= INT_MAX) 707*49678444Schristos # undef O_CLOEXEC 708*49678444Schristos # endif 709*49678444Schristos # if defined O_NOFOLLOW && ! (INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX) 710*49678444Schristos # undef O_NOFOLLOW 711*49678444Schristos # endif 712*49678444Schristos # if defined O_TTY_INIT && ! (INT_MIN <= O_TTY_INIT && O_TTY_INIT <= INT_MAX) 713*49678444Schristos # undef O_TTY_INIT 714*49678444Schristos # endif 715*49678444Schristos #endif 716*49678444Schristos 717*49678444Schristos #if !defined O_DIRECT && defined O_DIRECTIO 718*49678444Schristos /* Tru64 spells it 'O_DIRECTIO'. */ 719*49678444Schristos # define O_DIRECT O_DIRECTIO 720*49678444Schristos #endif 721*49678444Schristos 722*49678444Schristos #if !defined O_CLOEXEC && defined O_NOINHERIT 723*49678444Schristos /* Mingw spells it 'O_NOINHERIT'. */ 724*49678444Schristos # define O_CLOEXEC O_NOINHERIT 725*49678444Schristos #endif 726*49678444Schristos 727*49678444Schristos #ifndef O_CLOEXEC 728*49678444Schristos # define O_CLOEXEC 0x40000000 /* Try to not collide with system O_* flags. */ 729*49678444Schristos # define GNULIB_defined_O_CLOEXEC 1 730*49678444Schristos #else 731*49678444Schristos # define GNULIB_defined_O_CLOEXEC 0 732*49678444Schristos #endif 733*49678444Schristos 734*49678444Schristos #ifndef O_DIRECT 735*49678444Schristos # define O_DIRECT 0 736*49678444Schristos #endif 737*49678444Schristos 738*49678444Schristos #ifndef O_DIRECTORY 739*49678444Schristos # define O_DIRECTORY 0 740*49678444Schristos #endif 741*49678444Schristos 742*49678444Schristos #ifndef O_DSYNC 743*49678444Schristos # define O_DSYNC 0 744*49678444Schristos #endif 745*49678444Schristos 746*49678444Schristos #ifndef O_EXEC 747*49678444Schristos # define O_EXEC O_RDONLY /* This is often close enough in older systems. */ 748*49678444Schristos #endif 749*49678444Schristos 750*49678444Schristos #ifndef O_IGNORE_CTTY 751*49678444Schristos # define O_IGNORE_CTTY 0 752*49678444Schristos #endif 753*49678444Schristos 754*49678444Schristos #ifndef O_NDELAY 755*49678444Schristos # define O_NDELAY 0 756*49678444Schristos #endif 757*49678444Schristos 758*49678444Schristos #ifndef O_NOATIME 759*49678444Schristos # define O_NOATIME 0 760*49678444Schristos #endif 761*49678444Schristos 762*49678444Schristos #ifndef O_NONBLOCK 763*49678444Schristos # define O_NONBLOCK O_NDELAY 764*49678444Schristos #endif 765*49678444Schristos 766*49678444Schristos /* If the gnulib module 'nonblocking' is in use, guarantee a working non-zero 767*49678444Schristos value of O_NONBLOCK. Otherwise, O_NONBLOCK is defined (above) to O_NDELAY 768*49678444Schristos or to 0 as fallback. */ 769*49678444Schristos #if 0 770*49678444Schristos # if O_NONBLOCK 771*49678444Schristos # define GNULIB_defined_O_NONBLOCK 0 772*49678444Schristos # else 773*49678444Schristos # define GNULIB_defined_O_NONBLOCK 1 774*49678444Schristos # undef O_NONBLOCK 775*49678444Schristos # define O_NONBLOCK 0x40000000 776*49678444Schristos # endif 777*49678444Schristos #endif 778*49678444Schristos 779*49678444Schristos #ifndef O_NOCTTY 780*49678444Schristos # define O_NOCTTY 0 781*49678444Schristos #endif 782*49678444Schristos 783*49678444Schristos #ifndef O_NOFOLLOW 784*49678444Schristos # define O_NOFOLLOW 0 785*49678444Schristos #endif 786*49678444Schristos 787*49678444Schristos #ifndef O_NOLINK 788*49678444Schristos # define O_NOLINK 0 789*49678444Schristos #endif 790*49678444Schristos 791*49678444Schristos #ifndef O_NOLINKS 792*49678444Schristos # define O_NOLINKS 0 793*49678444Schristos #endif 794*49678444Schristos 795*49678444Schristos #ifndef O_NOTRANS 796*49678444Schristos # define O_NOTRANS 0 797*49678444Schristos #endif 798*49678444Schristos 799*49678444Schristos #ifndef O_RSYNC 800*49678444Schristos # define O_RSYNC 0 801*49678444Schristos #endif 802*49678444Schristos 803*49678444Schristos #ifndef O_SEARCH 804*49678444Schristos # define O_SEARCH O_RDONLY /* This is often close enough in older systems. */ 805*49678444Schristos #endif 806*49678444Schristos 807*49678444Schristos #ifndef O_SYNC 808*49678444Schristos # define O_SYNC 0 809*49678444Schristos #endif 810*49678444Schristos 811*49678444Schristos #ifndef O_TTY_INIT 812*49678444Schristos # define O_TTY_INIT 0 813*49678444Schristos #endif 814*49678444Schristos 815*49678444Schristos #if ~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) 816*49678444Schristos # undef O_ACCMODE 817*49678444Schristos # define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) 818*49678444Schristos #endif 819*49678444Schristos 820*49678444Schristos /* For systems that distinguish between text and binary I/O. 821*49678444Schristos O_BINARY is usually declared in fcntl.h */ 822*49678444Schristos #if !defined O_BINARY && defined _O_BINARY 823*49678444Schristos /* For MSC-compatible compilers. */ 824*49678444Schristos # define O_BINARY _O_BINARY 825*49678444Schristos # define O_TEXT _O_TEXT 826*49678444Schristos #endif 827*49678444Schristos 828*49678444Schristos #if defined __BEOS__ || defined __HAIKU__ 829*49678444Schristos /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */ 830*49678444Schristos # undef O_BINARY 831*49678444Schristos # undef O_TEXT 832*49678444Schristos #endif 833*49678444Schristos 834*49678444Schristos #ifndef O_BINARY 835*49678444Schristos # define O_BINARY 0 836*49678444Schristos # define O_TEXT 0 837*49678444Schristos #endif 838*49678444Schristos 839*49678444Schristos /* Fix up the AT_* macros. */ 840*49678444Schristos 841*49678444Schristos /* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its 842*49678444Schristos value exceeds INT_MAX, so its use as an int doesn't conform to the 843*49678444Schristos C standard, and GCC and Sun C complain in some cases. If the bug 844*49678444Schristos is present, undef AT_FDCWD here, so it can be redefined below. */ 845*49678444Schristos #if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553 846*49678444Schristos # undef AT_FDCWD 847*49678444Schristos #endif 848*49678444Schristos 849*49678444Schristos /* Use the same bit pattern as Solaris 9, but with the proper 850*49678444Schristos signedness. The bit pattern is important, in case this actually is 851*49678444Schristos Solaris with the above workaround. */ 852*49678444Schristos #ifndef AT_FDCWD 853*49678444Schristos # define AT_FDCWD (-3041965) 854*49678444Schristos #endif 855*49678444Schristos 856*49678444Schristos /* Use the same values as Solaris 9. This shouldn't matter, but 857*49678444Schristos there's no real reason to differ. */ 858*49678444Schristos #ifndef AT_SYMLINK_NOFOLLOW 859*49678444Schristos # define AT_SYMLINK_NOFOLLOW 4096 860*49678444Schristos #endif 861*49678444Schristos 862*49678444Schristos #ifndef AT_REMOVEDIR 863*49678444Schristos # define AT_REMOVEDIR 1 864*49678444Schristos #endif 865*49678444Schristos 866*49678444Schristos /* Solaris 9 lacks these two, so just pick unique values. */ 867*49678444Schristos #ifndef AT_SYMLINK_FOLLOW 868*49678444Schristos # define AT_SYMLINK_FOLLOW 2 869*49678444Schristos #endif 870*49678444Schristos 871*49678444Schristos #ifndef AT_EACCESS 872*49678444Schristos # define AT_EACCESS 4 873*49678444Schristos #endif 874*49678444Schristos 875*49678444Schristos 876*49678444Schristos #endif /* _GL_FCNTL_H */ 877*49678444Schristos #endif /* _GL_FCNTL_H */ 878*49678444Schristos #endif 879