1238384Sjkim/* This file is automatically generated.  DO NOT EDIT! */
2238384Sjkim/* Generated from: NetBSD: mknative-gdb,v 1.12 2020/09/17 16:54:31 christos Exp  */
3238384Sjkim/* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp  */
4238384Sjkim
5238384Sjkim/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
6238384Sjkim/* A GNU-like <dirent.h>.
7238384Sjkim   Copyright (C) 2006-2020 Free Software Foundation, Inc.
8238384Sjkim
9238384Sjkim   This program is free software: you can redistribute it and/or modify
10238384Sjkim   it under the terms of the GNU General Public License as published by
11238384Sjkim   the Free Software Foundation; either version 3 of the License, or
12238384Sjkim   (at your option) any later version.
13238384Sjkim
14238384Sjkim   This program is distributed in the hope that it will be useful,
15238384Sjkim   but WITHOUT ANY WARRANTY; without even the implied warranty of
16238384Sjkim   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17238384Sjkim   GNU General Public License for more details.
18238384Sjkim
19238384Sjkim   You should have received a copy of the GNU General Public License
20238384Sjkim   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
21238384Sjkim
22238384Sjkim#ifndef _GL_DIRENT_H
23238384Sjkim
24238384Sjkim#if __GNUC__ >= 3
25238384Sjkim#pragma GCC system_header
26238384Sjkim#endif
27238384Sjkim
28238384Sjkim
29238384Sjkim/* The include_next requires a split double-inclusion guard.  */
30238384Sjkim#if 1
31238384Sjkim# include_next <dirent.h>
32238384Sjkim#endif
33238384Sjkim
34238384Sjkim#ifndef _GL_DIRENT_H
35238384Sjkim#define _GL_DIRENT_H
36238384Sjkim
37238384Sjkim/* Get ino_t.  Needed on some systems, including glibc 2.8.  */
38238384Sjkim#include <sys/types.h>
39238384Sjkim
40238384Sjkim#if !1
41238384Sjkim/* Define types DIR and 'struct dirent'.  */
42238384Sjkim# if !GNULIB_defined_struct_dirent
43238384Sjkimstruct dirent
44238384Sjkim{
45238384Sjkim  char d_type;
46238384Sjkim  char d_name[1];
47238384Sjkim};
48238384Sjkim/* Possible values for 'd_type'.  */
49238384Sjkim#  define DT_UNKNOWN 0
50238384Sjkim#  define DT_FIFO    1          /* FIFO */
51238384Sjkim#  define DT_CHR     2          /* character device */
52238384Sjkim#  define DT_DIR     4          /* directory */
53238384Sjkim#  define DT_BLK     6          /* block device */
54238384Sjkim#  define DT_REG     8          /* regular file */
55238384Sjkim#  define DT_LNK    10          /* symbolic link */
56238384Sjkim#  define DT_SOCK   12          /* socket */
57238384Sjkim#  define DT_WHT    14          /* whiteout */
58238384Sjkimtypedef struct gl_directory DIR;
59238384Sjkim#  define GNULIB_defined_struct_dirent 1
60238384Sjkim# endif
61238384Sjkim#endif
62238384Sjkim
63238384Sjkim/* The __attribute__ feature is available in gcc versions 2.5 and later.
64238384Sjkim   The attribute __pure__ was added in gcc 2.96.  */
65238384Sjkim#ifndef _GL_ATTRIBUTE_PURE
66238384Sjkim# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
67238384Sjkim#  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
68238384Sjkim# else
69238384Sjkim#  define _GL_ATTRIBUTE_PURE /* empty */
70238384Sjkim# endif
71238384Sjkim#endif
72238384Sjkim
73238384Sjkim/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
74238384Sjkim/* C++ compatible function declaration macros.
75238384Sjkim   Copyright (C) 2010-2020 Free Software Foundation, Inc.
76238384Sjkim
77238384Sjkim   This program is free software: you can redistribute it and/or modify it
78238384Sjkim   under the terms of the GNU General Public License as published
79238384Sjkim   by the Free Software Foundation; either version 3 of the License, or
80238384Sjkim   (at your option) any later version.
81238384Sjkim
82238384Sjkim   This program is distributed in the hope that it will be useful,
83238384Sjkim   but WITHOUT ANY WARRANTY; without even the implied warranty of
84238384Sjkim   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
85238384Sjkim   General Public License for more details.
86238384Sjkim
87238384Sjkim   You should have received a copy of the GNU General Public License
88238384Sjkim   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
89238384Sjkim
90238384Sjkim#ifndef _GL_CXXDEFS_H
91238384Sjkim#define _GL_CXXDEFS_H
92238384Sjkim
93238384Sjkim/* Begin/end the GNULIB_NAMESPACE namespace.  */
94238384Sjkim#if defined __cplusplus && defined GNULIB_NAMESPACE
95238384Sjkim# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
96238384Sjkim# define _GL_END_NAMESPACE }
97238384Sjkim#else
98238384Sjkim# define _GL_BEGIN_NAMESPACE
99238384Sjkim# define _GL_END_NAMESPACE
100238384Sjkim#endif
101238384Sjkim
102238384Sjkim/* The three most frequent use cases of these macros are:
103238384Sjkim
104238384Sjkim   * For providing a substitute for a function that is missing on some
105238384Sjkim     platforms, but is declared and works fine on the platforms on which
106238384Sjkim     it exists:
107238384Sjkim
108238384Sjkim       #if @GNULIB_FOO@
109238384Sjkim       # if !@HAVE_FOO@
110238384Sjkim       _GL_FUNCDECL_SYS (foo, ...);
111238384Sjkim       # endif
112238384Sjkim       _GL_CXXALIAS_SYS (foo, ...);
113238384Sjkim       _GL_CXXALIASWARN (foo);
114238384Sjkim       #elif defined GNULIB_POSIXCHECK
115238384Sjkim       ...
116238384Sjkim       #endif
117238384Sjkim
118238384Sjkim   * For providing a replacement for a function that exists on all platforms,
119238384Sjkim     but is broken/insufficient and needs to be replaced on some platforms:
120238384Sjkim
121238384Sjkim       #if @GNULIB_FOO@
122238384Sjkim       # if @REPLACE_FOO@
123238384Sjkim       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
124238384Sjkim       #   undef foo
125238384Sjkim       #   define foo rpl_foo
126238384Sjkim       #  endif
127238384Sjkim       _GL_FUNCDECL_RPL (foo, ...);
128238384Sjkim       _GL_CXXALIAS_RPL (foo, ...);
129238384Sjkim       # else
130238384Sjkim       _GL_CXXALIAS_SYS (foo, ...);
131238384Sjkim       # endif
132238384Sjkim       _GL_CXXALIASWARN (foo);
133238384Sjkim       #elif defined GNULIB_POSIXCHECK
134238384Sjkim       ...
135238384Sjkim       #endif
136238384Sjkim
137238384Sjkim   * For providing a replacement for a function that exists on some platforms
138238384Sjkim     but is broken/insufficient and needs to be replaced on some of them and
139238384Sjkim     is additionally either missing or undeclared on some other platforms:
140238384Sjkim
141238384Sjkim       #if @GNULIB_FOO@
142238384Sjkim       # if @REPLACE_FOO@
143238384Sjkim       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
144238384Sjkim       #   undef foo
145238384Sjkim       #   define foo rpl_foo
146238384Sjkim       #  endif
147238384Sjkim       _GL_FUNCDECL_RPL (foo, ...);
148238384Sjkim       _GL_CXXALIAS_RPL (foo, ...);
149238384Sjkim       # else
150238384Sjkim       #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
151238384Sjkim       _GL_FUNCDECL_SYS (foo, ...);
152238384Sjkim       #  endif
153238384Sjkim       _GL_CXXALIAS_SYS (foo, ...);
154238384Sjkim       # endif
155238384Sjkim       _GL_CXXALIASWARN (foo);
156238384Sjkim       #elif defined GNULIB_POSIXCHECK
157238384Sjkim       ...
158238384Sjkim       #endif
159238384Sjkim*/
160238384Sjkim
161238384Sjkim/* _GL_EXTERN_C declaration;
162238384Sjkim   performs the declaration with C linkage.  */
163238384Sjkim#if defined __cplusplus
164238384Sjkim# define _GL_EXTERN_C extern "C"
165238384Sjkim#else
166238384Sjkim# define _GL_EXTERN_C extern
167238384Sjkim#endif
168238384Sjkim
169238384Sjkim/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
170238384Sjkim   declares a replacement function, named rpl_func, with the given prototype,
171238384Sjkim   consisting of return type, parameters, and attributes.
172238384Sjkim   Example:
173238384Sjkim     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
174238384Sjkim                                  _GL_ARG_NONNULL ((1)));
175238384Sjkim */
176238384Sjkim#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
177238384Sjkim  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
178238384Sjkim#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
179238384Sjkim  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
180238384Sjkim
181238384Sjkim/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
182238384Sjkim   declares the system function, named func, with the given prototype,
183238384Sjkim   consisting of return type, parameters, and attributes.
184238384Sjkim   Example:
185238384Sjkim     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
186238384Sjkim                                  _GL_ARG_NONNULL ((1)));
187238384Sjkim */
188238384Sjkim#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
189238384Sjkim  _GL_EXTERN_C rettype func parameters_and_attributes
190238384Sjkim
191238384Sjkim/* _GL_CXXALIAS_RPL (func, rettype, parameters);
192238384Sjkim   declares a C++ alias called GNULIB_NAMESPACE::func
193238384Sjkim   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
194238384Sjkim   Example:
195238384Sjkim     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
196238384Sjkim
197238384Sjkim   Wrapping rpl_func in an object with an inline conversion operator
198238384Sjkim   avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
199238384Sjkim   actually used in the program.  */
200238384Sjkim#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
201238384Sjkim  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
202238384Sjkim#if defined __cplusplus && defined GNULIB_NAMESPACE
203238384Sjkim# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
204238384Sjkim    namespace GNULIB_NAMESPACE                                \
205238384Sjkim    {                                                         \
206238384Sjkim      static const struct _gl_ ## func ## _wrapper            \
207238384Sjkim      {                                                       \
208238384Sjkim        typedef rettype (*type) parameters;                   \
209238384Sjkim                                                              \
210238384Sjkim        inline operator type () const                         \
211238384Sjkim        {                                                     \
212238384Sjkim          return ::rpl_func;                                  \
213238384Sjkim        }                                                     \
214238384Sjkim      } func = {};                                            \
215238384Sjkim    }                                                         \
216238384Sjkim    _GL_EXTERN_C int _gl_cxxalias_dummy
217238384Sjkim#else
218238384Sjkim# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
219238384Sjkim    _GL_EXTERN_C int _gl_cxxalias_dummy
220238384Sjkim#endif
221238384Sjkim
222/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
223   is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
224   except that the C function rpl_func may have a slightly different
225   declaration.  A cast is used to silence the "invalid conversion" error
226   that would otherwise occur.  */
227#if defined __cplusplus && defined GNULIB_NAMESPACE
228# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
229    namespace GNULIB_NAMESPACE                                     \
230    {                                                              \
231      static const struct _gl_ ## func ## _wrapper                 \
232      {                                                            \
233        typedef rettype (*type) parameters;                        \
234                                                                   \
235        inline operator type () const                              \
236        {                                                          \
237          return reinterpret_cast<type>(::rpl_func);               \
238        }                                                          \
239      } func = {};                                                 \
240    }                                                              \
241    _GL_EXTERN_C int _gl_cxxalias_dummy
242#else
243# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
244    _GL_EXTERN_C int _gl_cxxalias_dummy
245#endif
246
247/* _GL_CXXALIAS_SYS (func, rettype, parameters);
248   declares a C++ alias called GNULIB_NAMESPACE::func
249   that redirects to the system provided function func, if GNULIB_NAMESPACE
250   is defined.
251   Example:
252     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
253
254   Wrapping func in an object with an inline conversion operator
255   avoids a reference to func unless GNULIB_NAMESPACE::func is
256   actually used in the program.  */
257#if defined __cplusplus && defined GNULIB_NAMESPACE
258# define _GL_CXXALIAS_SYS(func,rettype,parameters)            \
259    namespace GNULIB_NAMESPACE                                \
260    {                                                         \
261      static const struct _gl_ ## func ## _wrapper            \
262      {                                                       \
263        typedef rettype (*type) parameters;                   \
264                                                              \
265        inline operator type () const                         \
266        {                                                     \
267          return ::func;                                      \
268        }                                                     \
269      } func = {};                                            \
270    }                                                         \
271    _GL_EXTERN_C int _gl_cxxalias_dummy
272#else
273# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
274    _GL_EXTERN_C int _gl_cxxalias_dummy
275#endif
276
277/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
278   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
279   except that the C function func may have a slightly different declaration.
280   A cast is used to silence the "invalid conversion" error that would
281   otherwise occur.  */
282#if defined __cplusplus && defined GNULIB_NAMESPACE
283# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
284    namespace GNULIB_NAMESPACE                          \
285    {                                                   \
286      static const struct _gl_ ## func ## _wrapper      \
287      {                                                 \
288        typedef rettype (*type) parameters;             \
289                                                        \
290        inline operator type () const                   \
291        {                                               \
292          return reinterpret_cast<type>(::func);        \
293        }                                               \
294      } func = {};                                      \
295    }                                                   \
296    _GL_EXTERN_C int _gl_cxxalias_dummy
297#else
298# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
299    _GL_EXTERN_C int _gl_cxxalias_dummy
300#endif
301
302/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
303   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
304   except that the C function is picked among a set of overloaded functions,
305   namely the one with rettype2 and parameters2.  Two consecutive casts
306   are used to silence the "cannot find a match" and "invalid conversion"
307   errors that would otherwise occur.  */
308#if defined __cplusplus && defined GNULIB_NAMESPACE
309  /* The outer cast must be a reinterpret_cast.
310     The inner cast: When the function is defined as a set of overloaded
311     functions, it works as a static_cast<>, choosing the designated variant.
312     When the function is defined as a single variant, it works as a
313     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
314# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
315    namespace GNULIB_NAMESPACE                                                \
316    {                                                                         \
317      static const struct _gl_ ## func ## _wrapper                            \
318      {                                                                       \
319        typedef rettype (*type) parameters;                                   \
320                                                                              \
321        inline operator type () const                                         \
322        {                                                                     \
323          return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
324        }                                                                     \
325      } func = {};                                                            \
326    }                                                                         \
327    _GL_EXTERN_C int _gl_cxxalias_dummy
328#else
329# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
330    _GL_EXTERN_C int _gl_cxxalias_dummy
331#endif
332
333/* _GL_CXXALIASWARN (func);
334   causes a warning to be emitted when ::func is used but not when
335   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
336   variants.  */
337#if defined __cplusplus && defined GNULIB_NAMESPACE
338# define _GL_CXXALIASWARN(func) \
339   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
340# define _GL_CXXALIASWARN_1(func,namespace) \
341   _GL_CXXALIASWARN_2 (func, namespace)
342/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
343   we enable the warning only when not optimizing.  */
344# if !__OPTIMIZE__
345#  define _GL_CXXALIASWARN_2(func,namespace) \
346    _GL_WARN_ON_USE (func, \
347                     "The symbol ::" #func " refers to the system function. " \
348                     "Use " #namespace "::" #func " instead.")
349# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
350#  define _GL_CXXALIASWARN_2(func,namespace) \
351     extern __typeof__ (func) func
352# else
353#  define _GL_CXXALIASWARN_2(func,namespace) \
354     _GL_EXTERN_C int _gl_cxxalias_dummy
355# endif
356#else
357# define _GL_CXXALIASWARN(func) \
358    _GL_EXTERN_C int _gl_cxxalias_dummy
359#endif
360
361/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
362   causes a warning to be emitted when the given overloaded variant of ::func
363   is used but not when GNULIB_NAMESPACE::func is used.  */
364#if defined __cplusplus && defined GNULIB_NAMESPACE
365# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
366   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
367                        GNULIB_NAMESPACE)
368# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
369   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
370/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
371   we enable the warning only when not optimizing.  */
372# if !__OPTIMIZE__
373#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
374    _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
375                         "The symbol ::" #func " refers to the system function. " \
376                         "Use " #namespace "::" #func " instead.")
377# else
378#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
379     _GL_EXTERN_C int _gl_cxxalias_dummy
380# endif
381#else
382# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
383    _GL_EXTERN_C int _gl_cxxalias_dummy
384#endif
385
386#endif /* _GL_CXXDEFS_H */
387
388/* The definition of _GL_ARG_NONNULL is copied here.  */
389/* A C macro for declaring that specific arguments must not be NULL.
390   Copyright (C) 2009-2020 Free Software Foundation, Inc.
391
392   This program is free software: you can redistribute it and/or modify it
393   under the terms of the GNU General Public License as published
394   by the Free Software Foundation; either version 3 of the License, or
395   (at your option) any later version.
396
397   This program is distributed in the hope that it will be useful,
398   but WITHOUT ANY WARRANTY; without even the implied warranty of
399   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
400   General Public License for more details.
401
402   You should have received a copy of the GNU General Public License
403   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
404
405/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
406   that the values passed as arguments n, ..., m must be non-NULL pointers.
407   n = 1 stands for the first argument, n = 2 for the second argument etc.  */
408#ifndef _GL_ARG_NONNULL
409# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
410#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
411# else
412#  define _GL_ARG_NONNULL(params)
413# endif
414#endif
415
416/* The definition of _GL_WARN_ON_USE is copied here.  */
417/* A C macro for emitting warnings if a function is used.
418   Copyright (C) 2010-2020 Free Software Foundation, Inc.
419
420   This program is free software: you can redistribute it and/or modify it
421   under the terms of the GNU General Public License as published
422   by the Free Software Foundation; either version 3 of the License, or
423   (at your option) any later version.
424
425   This program is distributed in the hope that it will be useful,
426   but WITHOUT ANY WARRANTY; without even the implied warranty of
427   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
428   General Public License for more details.
429
430   You should have received a copy of the GNU General Public License
431   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
432
433/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
434   for FUNCTION which will then trigger a compiler warning containing
435   the text of "literal string" anywhere that function is called, if
436   supported by the compiler.  If the compiler does not support this
437   feature, the macro expands to an unused extern declaration.
438
439   _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
440   attribute used in _GL_WARN_ON_USE.  If the compiler does not support
441   this feature, it expands to empty.
442
443   These macros are useful for marking a function as a potential
444   portability trap, with the intent that "literal string" include
445   instructions on the replacement function that should be used
446   instead.
447   _GL_WARN_ON_USE is for functions with 'extern' linkage.
448   _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
449   linkage.
450
451   However, one of the reasons that a function is a portability trap is
452   if it has the wrong signature.  Declaring FUNCTION with a different
453   signature in C is a compilation error, so this macro must use the
454   same type as any existing declaration so that programs that avoid
455   the problematic FUNCTION do not fail to compile merely because they
456   included a header that poisoned the function.  But this implies that
457   _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
458   have a declaration.  Use of this macro implies that there must not
459   be any other macro hiding the declaration of FUNCTION; but
460   undefining FUNCTION first is part of the poisoning process anyway
461   (although for symbols that are provided only via a macro, the result
462   is a compilation error rather than a warning containing
463   "literal string").  Also note that in C++, it is only safe to use if
464   FUNCTION has no overloads.
465
466   For an example, it is possible to poison 'getline' by:
467   - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
468     [getline]) in configure.ac, which potentially defines
469     HAVE_RAW_DECL_GETLINE
470   - adding this code to a header that wraps the system <stdio.h>:
471     #undef getline
472     #if HAVE_RAW_DECL_GETLINE
473     _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
474       "not universally present; use the gnulib module getline");
475     #endif
476
477   It is not possible to directly poison global variables.  But it is
478   possible to write a wrapper accessor function, and poison that
479   (less common usage, like &environ, will cause a compilation error
480   rather than issue the nice warning, but the end result of informing
481   the developer about their portability problem is still achieved):
482     #if HAVE_RAW_DECL_ENVIRON
483     static char ***
484     rpl_environ (void) { return &environ; }
485     _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
486     # undef environ
487     # define environ (*rpl_environ ())
488     #endif
489   or better (avoiding contradictory use of 'static' and 'extern'):
490     #if HAVE_RAW_DECL_ENVIRON
491     static char ***
492     _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
493     rpl_environ (void) { return &environ; }
494     # undef environ
495     # define environ (*rpl_environ ())
496     #endif
497   */
498#ifndef _GL_WARN_ON_USE
499
500# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
501/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
502#  define _GL_WARN_ON_USE(function, message) \
503extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
504#  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
505  __attribute__ ((__warning__ (message)))
506# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
507/* Verify the existence of the function.  */
508#  define _GL_WARN_ON_USE(function, message) \
509extern __typeof__ (function) function
510#  define _GL_WARN_ON_USE_ATTRIBUTE(message)
511# else /* Unsupported.  */
512#  define _GL_WARN_ON_USE(function, message) \
513_GL_WARN_EXTERN_C int _gl_warn_on_use
514#  define _GL_WARN_ON_USE_ATTRIBUTE(message)
515# endif
516#endif
517
518/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
519   is like _GL_WARN_ON_USE (function, "string"), except that in C++ mode the
520   function is declared with the given prototype, consisting of return type,
521   parameters, and attributes.
522   This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
523   not work in this case.  */
524#ifndef _GL_WARN_ON_USE_CXX
525# if !defined __cplusplus
526#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
527     _GL_WARN_ON_USE (function, msg)
528# else
529#  if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
530#   define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
531extern rettype function parameters_and_attributes \
532     __attribute__ ((__warning__ (msg)))
533#  elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
534/* Verify the existence of the function.  */
535#   define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
536extern rettype function parameters_and_attributes
537#  else /* Unsupported.  */
538#   define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
539_GL_WARN_EXTERN_C int _gl_warn_on_use
540#  endif
541# endif
542#endif
543
544/* _GL_WARN_EXTERN_C declaration;
545   performs the declaration with C linkage.  */
546#ifndef _GL_WARN_EXTERN_C
547# if defined __cplusplus
548#  define _GL_WARN_EXTERN_C extern "C"
549# else
550#  define _GL_WARN_EXTERN_C extern
551# endif
552#endif
553
554
555/* Declare overridden functions.  */
556
557#if 1
558# if 0
559#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
560#   undef opendir
561#   define opendir rpl_opendir
562#   define GNULIB_defined_opendir 1
563#  endif
564_GL_FUNCDECL_RPL (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)));
565_GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name));
566# else
567#  if !1
568_GL_FUNCDECL_SYS (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)));
569#  endif
570_GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name));
571# endif
572_GL_CXXALIASWARN (opendir);
573#elif defined GNULIB_POSIXCHECK
574# undef opendir
575# if HAVE_RAW_DECL_OPENDIR
576_GL_WARN_ON_USE (opendir, "opendir is not portable - "
577                 "use gnulib module opendir for portability");
578# endif
579#endif
580
581#if 1
582# if !1
583_GL_FUNCDECL_SYS (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1)));
584# endif
585_GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp));
586_GL_CXXALIASWARN (readdir);
587#elif defined GNULIB_POSIXCHECK
588# undef readdir
589# if HAVE_RAW_DECL_READDIR
590_GL_WARN_ON_USE (readdir, "readdir is not portable - "
591                 "use gnulib module readdir for portability");
592# endif
593#endif
594
595#if 1
596# if !1
597_GL_FUNCDECL_SYS (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1)));
598# endif
599_GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp));
600_GL_CXXALIASWARN (rewinddir);
601#elif defined GNULIB_POSIXCHECK
602# undef rewinddir
603# if HAVE_RAW_DECL_REWINDDIR
604_GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - "
605                 "use gnulib module rewinddir for portability");
606# endif
607#endif
608
609#if 1
610# if 0
611#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
612#   undef closedir
613#   define closedir rpl_closedir
614#   define GNULIB_defined_closedir 1
615#  endif
616_GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
617_GL_CXXALIAS_RPL (closedir, int, (DIR *dirp));
618# else
619#  if !1
620_GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
621#  endif
622_GL_CXXALIAS_SYS (closedir, int, (DIR *dirp));
623# endif
624_GL_CXXALIASWARN (closedir);
625#elif defined GNULIB_POSIXCHECK
626# undef closedir
627# if HAVE_RAW_DECL_CLOSEDIR
628_GL_WARN_ON_USE (closedir, "closedir is not portable - "
629                 "use gnulib module closedir for portability");
630# endif
631#endif
632
633#if 1
634/* Return the file descriptor associated with the given directory stream,
635   or -1 if none exists.  */
636# if 0
637#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
638#   undef dirfd
639#   define dirfd rpl_dirfd
640#  endif
641_GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
642_GL_CXXALIAS_RPL (dirfd, int, (DIR *));
643
644#  ifdef __KLIBC__
645/* Gnulib internal hooks needed to maintain the dirfd metadata.  */
646_GL_EXTERN_C int _gl_register_dirp_fd (int fd, DIR *dirp)
647     _GL_ARG_NONNULL ((2));
648_GL_EXTERN_C void _gl_unregister_dirp_fd (int fd);
649#  endif
650# else
651#  if defined __cplusplus && defined GNULIB_NAMESPACE && defined dirfd
652    /* dirfd is defined as a macro and not as a function.
653       Turn it into a function and get rid of the macro.  */
654static inline int (dirfd) (DIR *dp) { return dirfd (dp); }
655#   undef dirfd
656#  endif
657#  if !(1 || defined dirfd)
658_GL_FUNCDECL_SYS (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
659#  endif
660_GL_CXXALIAS_SYS (dirfd, int, (DIR *));
661# endif
662_GL_CXXALIASWARN (dirfd);
663#elif defined GNULIB_POSIXCHECK
664# undef dirfd
665# if HAVE_RAW_DECL_DIRFD
666_GL_WARN_ON_USE (dirfd, "dirfd is unportable - "
667                 "use gnulib module dirfd for portability");
668# endif
669#endif
670
671#if 1
672/* Open a directory stream visiting the given directory file
673   descriptor.  Return NULL and set errno if fd is not visiting a
674   directory.  On success, this function consumes fd (it will be
675   implicitly closed either by this function or by a subsequent
676   closedir).  */
677# if 0
678#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
679#   undef fdopendir
680#   define fdopendir rpl_fdopendir
681#  endif
682_GL_FUNCDECL_RPL (fdopendir, DIR *, (int fd));
683_GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd));
684# else
685#  if !1 || !1
686_GL_FUNCDECL_SYS (fdopendir, DIR *, (int fd));
687#  endif
688_GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd));
689# endif
690_GL_CXXALIASWARN (fdopendir);
691#elif defined GNULIB_POSIXCHECK
692# undef fdopendir
693# if HAVE_RAW_DECL_FDOPENDIR
694_GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - "
695                 "use gnulib module fdopendir for portability");
696# endif
697#endif
698
699#if 0
700/* Scan the directory DIR, calling FILTER on each directory entry.
701   Entries for which FILTER returns nonzero are individually malloc'd,
702   sorted using qsort with CMP, and collected in a malloc'd array in
703   *NAMELIST.  Returns the number of entries selected, or -1 on error.  */
704# if !1
705_GL_FUNCDECL_SYS (scandir, int,
706                  (const char *dir, struct dirent ***namelist,
707                   int (*filter) (const struct dirent *),
708                   int (*cmp) (const struct dirent **, const struct dirent **))
709                  _GL_ARG_NONNULL ((1, 2, 4)));
710# endif
711/* Need to cast, because on glibc systems, the fourth parameter is
712                        int (*cmp) (const void *, const void *).  */
713_GL_CXXALIAS_SYS_CAST (scandir, int,
714                       (const char *dir, struct dirent ***namelist,
715                        int (*filter) (const struct dirent *),
716                        int (*cmp) (const struct dirent **, const struct dirent **)));
717_GL_CXXALIASWARN (scandir);
718#elif defined GNULIB_POSIXCHECK
719# undef scandir
720# if HAVE_RAW_DECL_SCANDIR
721_GL_WARN_ON_USE (scandir, "scandir is unportable - "
722                 "use gnulib module scandir for portability");
723# endif
724#endif
725
726#if 0
727/* Compare two 'struct dirent' entries alphabetically.  */
728# if !1
729_GL_FUNCDECL_SYS (alphasort, int,
730                  (const struct dirent **, const struct dirent **)
731                  _GL_ATTRIBUTE_PURE
732                  _GL_ARG_NONNULL ((1, 2)));
733# endif
734/* Need to cast, because on glibc systems, the parameters are
735                       (const void *, const void *).  */
736_GL_CXXALIAS_SYS_CAST (alphasort, int,
737                       (const struct dirent **, const struct dirent **));
738_GL_CXXALIASWARN (alphasort);
739#elif defined GNULIB_POSIXCHECK
740# undef alphasort
741# if HAVE_RAW_DECL_ALPHASORT
742_GL_WARN_ON_USE (alphasort, "alphasort is unportable - "
743                 "use gnulib module alphasort for portability");
744# endif
745#endif
746
747
748#endif /* _GL_DIRENT_H */
749#endif /* _GL_DIRENT_H */
750