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