GDBserver

glob.h
Go to the documentation of this file.
1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* glob.h -- Find a path matching a pattern.
3
4 Copyright (C) 2005-2007, 2009-2016 Free Software Foundation, Inc.
5
6 Written by Derek Price <derek@ximbiot.com> & Paul Eggert <eggert@CS.UCLA.EDU>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, see <http://www.gnu.org/licenses/>. */
20
21 #ifndef _GL_GLOB_H
22 #define _GL_GLOB_H
23
24 #if 1
25 # include <sys/cdefs.h>
26 #endif
27
28 #include <stddef.h>
29
30 /* On some systems, such as AIX 5.1, <sys/stat.h> does a "#define stat stat64".
31 Make sure this definition is seen before glob-libc.h defines types that
32 rely on 'struct stat'. */
33 #include <sys/stat.h>
34
35 #ifndef __BEGIN_DECLS
36 # ifdef __cplusplus
37 # define __BEGIN_DECLS extern "C" {
38 # define __END_DECLS }
39 # else
40 # define __BEGIN_DECLS
41 # define __END_DECLS
42 # endif
43 #endif
44 #ifndef __THROW
45 # define __THROW
46 #endif
47 #ifndef __THROWNL
48 # define __THROWNL
49 #endif
50
51 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
52 #ifndef _GL_CXXDEFS_H
53 #define _GL_CXXDEFS_H
54
55 /* Begin/end the GNULIB_NAMESPACE namespace. */
56 #if defined __cplusplus && defined GNULIB_NAMESPACE
57 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
58 # define _GL_END_NAMESPACE }
59 #else
60 # define _GL_BEGIN_NAMESPACE
61 # define _GL_END_NAMESPACE
62 #endif
63
64 /* The three most frequent use cases of these macros are:
65
66 * For providing a substitute for a function that is missing on some
67 platforms, but is declared and works fine on the platforms on which
68 it exists:
69
70 #if @GNULIB_FOO@
71 # if !@HAVE_FOO@
72 _GL_FUNCDECL_SYS (foo, ...);
73 # endif
74 _GL_CXXALIAS_SYS (foo, ...);
75 _GL_CXXALIASWARN (foo);
76 #elif defined GNULIB_POSIXCHECK
77 ...
78 #endif
79
80 * For providing a replacement for a function that exists on all platforms,
81 but is broken/insufficient and needs to be replaced on some platforms:
82
83 #if @GNULIB_FOO@
84 # if @REPLACE_FOO@
85 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
86 # undef foo
87 # define foo rpl_foo
88 # endif
89 _GL_FUNCDECL_RPL (foo, ...);
90 _GL_CXXALIAS_RPL (foo, ...);
91 # else
92 _GL_CXXALIAS_SYS (foo, ...);
93 # endif
94 _GL_CXXALIASWARN (foo);
95 #elif defined GNULIB_POSIXCHECK
96 ...
97 #endif
98
99 * For providing a replacement for a function that exists on some platforms
100 but is broken/insufficient and needs to be replaced on some of them and
101 is additionally either missing or undeclared on some other platforms:
102
103 #if @GNULIB_FOO@
104 # if @REPLACE_FOO@
105 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
106 # undef foo
107 # define foo rpl_foo
108 # endif
109 _GL_FUNCDECL_RPL (foo, ...);
110 _GL_CXXALIAS_RPL (foo, ...);
111 # else
112 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
113 _GL_FUNCDECL_SYS (foo, ...);
114 # endif
115 _GL_CXXALIAS_SYS (foo, ...);
116 # endif
117 _GL_CXXALIASWARN (foo);
118 #elif defined GNULIB_POSIXCHECK
119 ...
120 #endif
121 */
122
123 /* _GL_EXTERN_C declaration;
124 performs the declaration with C linkage. */
125 #if defined __cplusplus
126 # define _GL_EXTERN_C extern "C"
127 #else
128 # define _GL_EXTERN_C extern
129 #endif
130
131 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
132 declares a replacement function, named rpl_func, with the given prototype,
133 consisting of return type, parameters, and attributes.
134 Example:
135 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
136 _GL_ARG_NONNULL ((1)));
137 */
138 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
139 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
140 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
141 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
142
143 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
144 declares the system function, named func, with the given prototype,
145 consisting of return type, parameters, and attributes.
146 Example:
147 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
148 _GL_ARG_NONNULL ((1)));
149 */
150 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
151 _GL_EXTERN_C rettype func parameters_and_attributes
152
153 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
154 declares a C++ alias called GNULIB_NAMESPACE::func
155 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
156 Example:
157 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
158
159 Wrapping rpl_func in an object with an inline conversion operator
160 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
161 actually used in the program. */
162 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
163 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
164 #if defined __cplusplus && defined GNULIB_NAMESPACE
165 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
166 namespace GNULIB_NAMESPACE \
167 { \
168 static const struct _gl_ ## func ## _wrapper \
169 { \
170 typedef rettype (*type) parameters; \
171 inline type rpl () const { return ::rpl_func; } \
172 inline operator type () const { return rpl (); } \
173 } func = {}; \
174 } \
175 _GL_EXTERN_C int _gl_cxxalias_dummy
176 #else
177 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
178 _GL_EXTERN_C int _gl_cxxalias_dummy
179 #endif
180
181 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
182 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
183 except that the C function rpl_func may have a slightly different
184 declaration. A cast is used to silence the "invalid conversion" error
185 that would otherwise occur. */
186 #if defined __cplusplus && defined GNULIB_NAMESPACE
187 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
188 namespace GNULIB_NAMESPACE \
189 { \
190 static const struct _gl_ ## func ## _wrapper \
191 { \
192 typedef rettype (*type) parameters; \
193 inline type rpl () const \
194 { return reinterpret_cast<type>(::rpl_func); } \
195 inline operator type () const { return rpl (); } \
196 } func = {}; \
197 } \
198 _GL_EXTERN_C int _gl_cxxalias_dummy
199 #else
200 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
201 _GL_EXTERN_C int _gl_cxxalias_dummy
202 #endif
203
204 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
205 declares a C++ alias called GNULIB_NAMESPACE::func
206 that redirects to the system provided function func, if GNULIB_NAMESPACE
207 is defined.
208 Example:
209 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
210
211 Wrapping func in an object with an inline conversion operator
212 avoids a reference to func unless GNULIB_NAMESPACE::func is
213 actually used in the program. */
214 #if defined __cplusplus && defined GNULIB_NAMESPACE
215 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
216 namespace GNULIB_NAMESPACE \
217 { \
218 static const struct _gl_ ## func ## _wrapper \
219 { \
220 typedef rettype (*type) parameters; \
221 inline type rpl () const { return ::func; } \
222 inline operator type () const { return rpl (); } \
223 } func = {}; \
224 } \
225 _GL_EXTERN_C int _gl_cxxalias_dummy
226 #else
227 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
228 _GL_EXTERN_C int _gl_cxxalias_dummy
229 #endif
230
231 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
232 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
233 except that the C function func may have a slightly different declaration.
234 A cast is used to silence the "invalid conversion" error that would
235 otherwise occur. */
236 #if defined __cplusplus && defined GNULIB_NAMESPACE
237 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
238 namespace GNULIB_NAMESPACE \
239 { \
240 static const struct _gl_ ## func ## _wrapper \
241 { \
242 typedef rettype (*type) parameters; \
243 inline type rpl () const \
244 { return reinterpret_cast<type>(::func); } \
245 inline operator type () const { return rpl (); }\
246 } func = {}; \
247 } \
248 _GL_EXTERN_C int _gl_cxxalias_dummy
249 #else
250 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
251 _GL_EXTERN_C int _gl_cxxalias_dummy
252 #endif
253
254 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
255 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
256 except that the C function is picked among a set of overloaded functions,
257 namely the one with rettype2 and parameters2. Two consecutive casts
258 are used to silence the "cannot find a match" and "invalid conversion"
259 errors that would otherwise occur. */
260 #if defined __cplusplus && defined GNULIB_NAMESPACE
261 /* The outer cast must be a reinterpret_cast.
262 The inner cast: When the function is defined as a set of overloaded
263 functions, it works as a static_cast<>, choosing the designated variant.
264 When the function is defined as a single variant, it works as a
265 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
266 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
267 namespace GNULIB_NAMESPACE \
268 { \
269 static const struct _gl_ ## func ## _wrapper \
270 { \
271 typedef rettype (*type) parameters; \
272 \
273 inline type rpl () const \
274 { return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); }\
275 \
276 inline operator type () const { return rpl (); } \
277 } func = {}; \
278 } \
279 _GL_EXTERN_C int _gl_cxxalias_dummy
280 #else
281 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
282 _GL_EXTERN_C int _gl_cxxalias_dummy
283 #endif
284
285 /* _GL_CXXALIASWARN (func);
286 causes a warning to be emitted when ::func is used but not when
287 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
288 variants. */
289 #if defined __cplusplus && defined GNULIB_NAMESPACE
290 # define _GL_CXXALIASWARN(func) \
291 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
292 # define _GL_CXXALIASWARN_1(func,namespace) \
293 _GL_CXXALIASWARN_2 (func, namespace)
294 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
295 we enable the warning only when not optimizing. */
296 # if !__OPTIMIZE__
297 # define _GL_CXXALIASWARN_2(func,namespace) \
298 _GL_WARN_ON_USE (func, \
299 "The symbol ::" #func " refers to the system function. " \
300 "Use " #namespace "::" #func " instead.")
301 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
302 # define _GL_CXXALIASWARN_2(func,namespace) \
303 extern __typeof__ (func) func
304 # else
305 # define _GL_CXXALIASWARN_2(func,namespace) \
306 _GL_EXTERN_C int _gl_cxxalias_dummy
307 # endif
308 #else
309 # define _GL_CXXALIASWARN(func) \
310 _GL_EXTERN_C int _gl_cxxalias_dummy
311 #endif
312
313 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
314 causes a warning to be emitted when the given overloaded variant of ::func
315 is used but not when GNULIB_NAMESPACE::func is used. */
316 #if defined __cplusplus && defined GNULIB_NAMESPACE
317 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
318 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
319 GNULIB_NAMESPACE)
320 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
321 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
322 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
323 we enable the warning only when not optimizing. */
324 # if !__OPTIMIZE__
325 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
326 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
327 "The symbol ::" #func " refers to the system function. " \
328 "Use " #namespace "::" #func " instead.")
329 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
330 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
331 extern __typeof__ (func) func
332 # else
333 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
334 _GL_EXTERN_C int _gl_cxxalias_dummy
335 # endif
336 #else
337 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
338 _GL_EXTERN_C int _gl_cxxalias_dummy
339 #endif
340
341 #endif /* _GL_CXXDEFS_H */
342
343 /* The definition of _GL_ARG_NONNULL is copied here. */
344 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
345 that the values passed as arguments n, ..., m must be non-NULL pointers.
346 n = 1 stands for the first argument, n = 2 for the second argument etc. */
347 #ifndef _GL_ARG_NONNULL
348 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
349 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
350 # else
351 # define _GL_ARG_NONNULL(params)
352 # endif
353 #endif
354
355 /* The definition of _GL_WARN_ON_USE is copied here. */
356 #ifndef _GL_WARN_ON_USE
357
358 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
359 /* A compiler attribute is available in gcc versions 4.3.0 and later. */
360 # define _GL_WARN_ON_USE(function, message) \
361 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
362 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
363 /* Verify the existence of the function. */
364 # define _GL_WARN_ON_USE(function, message) \
365 extern __typeof__ (function) function
366 # else /* Unsupported. */
367 # define _GL_WARN_ON_USE(function, message) \
368 _GL_WARN_EXTERN_C int _gl_warn_on_use
369 # endif
370 #endif
371
372 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
373 is like _GL_WARN_ON_USE (function, "string"), except that the function is
374 declared with the given prototype, consisting of return type, parameters,
375 and attributes.
376 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
377 not work in this case. */
378 #ifndef _GL_WARN_ON_USE_CXX
379 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
380 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
381 extern rettype function parameters_and_attributes \
382 __attribute__ ((__warning__ (msg)))
383 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
384 /* Verify the existence of the function. */
385 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
386 extern rettype function parameters_and_attributes
387 # else /* Unsupported. */
388 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
389 _GL_WARN_EXTERN_C int _gl_warn_on_use
390 # endif
391 #endif
392
393 /* _GL_WARN_EXTERN_C declaration;
394 performs the declaration with C linkage. */
395 #ifndef _GL_WARN_EXTERN_C
396 # if defined __cplusplus
397 # define _GL_WARN_EXTERN_C extern "C"
398 # else
399 # define _GL_WARN_EXTERN_C extern
400 # endif
401 #endif
402
403 #ifndef __size_t
404 # define __size_t size_t
405 #endif
406 #ifndef __USE_GNU
407 # define __USE_GNU 1
408 #endif
409
410
411 #define glob rpl_glob
412 #define globfree rpl_globfree
413 #define glob_pattern_p rpl_glob_pattern_p
414
415 #define __GLOB_GNULIB 1
416
417 /* Now the standard GNU C Library header should work. */
418 #include "glob-libc.h"
419
420 __BEGIN_DECLS
421 typedef int (*_gl_glob_errfunc_fn) (const char *, int);
422 __END_DECLS
423
424 #if defined __cplusplus && defined GNULIB_NAMESPACE
425 # undef glob
426 # undef globfree
427 # undef glob_pattern_p
428 _GL_CXXALIAS_RPL (glob, int, (const char *_Restrict_ __pattern, int __flags,
429 _gl_glob_errfunc_fn __errfunc,
430 glob_t *_Restrict_ __pglob));
431 _GL_CXXALIAS_RPL (globfree, void, (glob_t *__pglob));
432 _GL_CXXALIAS_RPL (glob_pattern_p, int, (const char *__pattern, int __quote));
433 # if 0 /* The C function name is rpl_glob, not glob. */
434 _GL_CXXALIASWARN (glob);
435 _GL_CXXALIASWARN (globfree);
436 _GL_CXXALIASWARN (glob_pattern_p);
437 # endif
438 #endif
439
440 #endif /* _GL_GLOB_H */
__BEGIN_DECLS
#define __BEGIN_DECLS
Definition: glob.h:40
stat.h
glob_pattern_p
#define glob_pattern_p
Definition: glob.h:413
_GL_CXXALIAS_RPL
#define _GL_CXXALIAS_RPL(func, rettype, parameters)
Definition: glob.h:162
__END_DECLS
#define __END_DECLS
Definition: glob.h:41
glob
#define glob
Definition: glob.h:411
globfree
#define globfree
Definition: glob.h:412
_GL_CXXALIASWARN
#define _GL_CXXALIASWARN(func)
Definition: glob.h:309
_gl_glob_errfunc_fn
__BEGIN_DECLS typedef int(* _gl_glob_errfunc_fn)(const char *, int)
Definition: glob.h:421