grep(1): Upgrade version 2.20 => 2.22
[dragonfly.git] / gnu / usr.bin / grep / libgreputils / ctype.h
1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* A substitute for ISO C99 <ctype.h>, for platforms on which it is incomplete.
3
4    Copyright (C) 2009-2015 Free Software Foundation, Inc.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3, or (at your option)
9    any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, see <http://www.gnu.org/licenses/>.  */
18
19 /* Written by Bruno Haible.  */
20
21 /*
22  * ISO C 99 <ctype.h> for platforms on which it is incomplete.
23  * <http://www.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html>
24  */
25
26 #ifndef _GL_CTYPE_H
27
28 #if __GNUC__ >= 3
29 #pragma GCC system_header
30 #endif
31
32
33 /* Include the original <ctype.h>.  */
34 /* The include_next requires a split double-inclusion guard.  */
35 #include_next <ctype.h>
36
37 #ifndef _GL_CTYPE_H
38 #define _GL_CTYPE_H
39
40 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
41 #ifndef _GL_CXXDEFS_H
42 #define _GL_CXXDEFS_H
43
44 /* The three most frequent use cases of these macros are:
45
46    * For providing a substitute for a function that is missing on some
47      platforms, but is declared and works fine on the platforms on which
48      it exists:
49
50        #if @GNULIB_FOO@
51        # if !@HAVE_FOO@
52        _GL_FUNCDECL_SYS (foo, ...);
53        # endif
54        _GL_CXXALIAS_SYS (foo, ...);
55        _GL_CXXALIASWARN (foo);
56        #elif defined GNULIB_POSIXCHECK
57        ...
58        #endif
59
60    * For providing a replacement for a function that exists on all platforms,
61      but is broken/insufficient and needs to be replaced on some platforms:
62
63        #if @GNULIB_FOO@
64        # if @REPLACE_FOO@
65        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
66        #   undef foo
67        #   define foo rpl_foo
68        #  endif
69        _GL_FUNCDECL_RPL (foo, ...);
70        _GL_CXXALIAS_RPL (foo, ...);
71        # else
72        _GL_CXXALIAS_SYS (foo, ...);
73        # endif
74        _GL_CXXALIASWARN (foo);
75        #elif defined GNULIB_POSIXCHECK
76        ...
77        #endif
78
79    * For providing a replacement for a function that exists on some platforms
80      but is broken/insufficient and needs to be replaced on some of them and
81      is additionally either missing or undeclared on some other 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        #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
93        _GL_FUNCDECL_SYS (foo, ...);
94        #  endif
95        _GL_CXXALIAS_SYS (foo, ...);
96        # endif
97        _GL_CXXALIASWARN (foo);
98        #elif defined GNULIB_POSIXCHECK
99        ...
100        #endif
101 */
102
103 /* _GL_EXTERN_C declaration;
104    performs the declaration with C linkage.  */
105 #if defined __cplusplus
106 # define _GL_EXTERN_C extern "C"
107 #else
108 # define _GL_EXTERN_C extern
109 #endif
110
111 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
112    declares a replacement function, named rpl_func, with the given prototype,
113    consisting of return type, parameters, and attributes.
114    Example:
115      _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
116                                   _GL_ARG_NONNULL ((1)));
117  */
118 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
119   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
120 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
121   _GL_EXTERN_C rettype rpl_func parameters_and_attributes
122
123 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
124    declares the system function, named func, with the given prototype,
125    consisting of return type, parameters, and attributes.
126    Example:
127      _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
128                                   _GL_ARG_NONNULL ((1)));
129  */
130 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
131   _GL_EXTERN_C rettype func parameters_and_attributes
132
133 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
134    declares a C++ alias called GNULIB_NAMESPACE::func
135    that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
136    Example:
137      _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
138  */
139 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
140   _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
141 #if defined __cplusplus && defined GNULIB_NAMESPACE
142 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
143     namespace GNULIB_NAMESPACE                                \
144     {                                                         \
145       rettype (*const func) parameters = ::rpl_func;          \
146     }                                                         \
147     _GL_EXTERN_C int _gl_cxxalias_dummy
148 #else
149 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
150     _GL_EXTERN_C int _gl_cxxalias_dummy
151 #endif
152
153 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
154    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
155    except that the C function rpl_func may have a slightly different
156    declaration.  A cast is used to silence the "invalid conversion" error
157    that would otherwise occur.  */
158 #if defined __cplusplus && defined GNULIB_NAMESPACE
159 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
160     namespace GNULIB_NAMESPACE                                     \
161     {                                                              \
162       rettype (*const func) parameters =                           \
163         reinterpret_cast<rettype(*)parameters>(::rpl_func);        \
164     }                                                              \
165     _GL_EXTERN_C int _gl_cxxalias_dummy
166 #else
167 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
168     _GL_EXTERN_C int _gl_cxxalias_dummy
169 #endif
170
171 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
172    declares a C++ alias called GNULIB_NAMESPACE::func
173    that redirects to the system provided function func, if GNULIB_NAMESPACE
174    is defined.
175    Example:
176      _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
177  */
178 #if defined __cplusplus && defined GNULIB_NAMESPACE
179   /* If we were to write
180        rettype (*const func) parameters = ::func;
181      like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
182      better (remove an indirection through a 'static' pointer variable),
183      but then the _GL_CXXALIASWARN macro below would cause a warning not only
184      for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
185 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
186     namespace GNULIB_NAMESPACE                     \
187     {                                              \
188       static rettype (*func) parameters = ::func;  \
189     }                                              \
190     _GL_EXTERN_C int _gl_cxxalias_dummy
191 #else
192 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
193     _GL_EXTERN_C int _gl_cxxalias_dummy
194 #endif
195
196 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
197    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
198    except that the C function func may have a slightly different declaration.
199    A cast is used to silence the "invalid conversion" error that would
200    otherwise occur.  */
201 #if defined __cplusplus && defined GNULIB_NAMESPACE
202 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
203     namespace GNULIB_NAMESPACE                          \
204     {                                                   \
205       static rettype (*func) parameters =               \
206         reinterpret_cast<rettype(*)parameters>(::func); \
207     }                                                   \
208     _GL_EXTERN_C int _gl_cxxalias_dummy
209 #else
210 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
211     _GL_EXTERN_C int _gl_cxxalias_dummy
212 #endif
213
214 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
215    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
216    except that the C function is picked among a set of overloaded functions,
217    namely the one with rettype2 and parameters2.  Two consecutive casts
218    are used to silence the "cannot find a match" and "invalid conversion"
219    errors that would otherwise occur.  */
220 #if defined __cplusplus && defined GNULIB_NAMESPACE
221   /* The outer cast must be a reinterpret_cast.
222      The inner cast: When the function is defined as a set of overloaded
223      functions, it works as a static_cast<>, choosing the designated variant.
224      When the function is defined as a single variant, it works as a
225      reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
226 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
227     namespace GNULIB_NAMESPACE                                                \
228     {                                                                         \
229       static rettype (*func) parameters =                                     \
230         reinterpret_cast<rettype(*)parameters>(                               \
231           (rettype2(*)parameters2)(::func));                                  \
232     }                                                                         \
233     _GL_EXTERN_C int _gl_cxxalias_dummy
234 #else
235 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
236     _GL_EXTERN_C int _gl_cxxalias_dummy
237 #endif
238
239 /* _GL_CXXALIASWARN (func);
240    causes a warning to be emitted when ::func is used but not when
241    GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
242    variants.  */
243 #if defined __cplusplus && defined GNULIB_NAMESPACE
244 # define _GL_CXXALIASWARN(func) \
245    _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
246 # define _GL_CXXALIASWARN_1(func,namespace) \
247    _GL_CXXALIASWARN_2 (func, namespace)
248 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
249    we enable the warning only when not optimizing.  */
250 # if !__OPTIMIZE__
251 #  define _GL_CXXALIASWARN_2(func,namespace) \
252     _GL_WARN_ON_USE (func, \
253                      "The symbol ::" #func " refers to the system function. " \
254                      "Use " #namespace "::" #func " instead.")
255 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
256 #  define _GL_CXXALIASWARN_2(func,namespace) \
257      extern __typeof__ (func) func
258 # else
259 #  define _GL_CXXALIASWARN_2(func,namespace) \
260      _GL_EXTERN_C int _gl_cxxalias_dummy
261 # endif
262 #else
263 # define _GL_CXXALIASWARN(func) \
264     _GL_EXTERN_C int _gl_cxxalias_dummy
265 #endif
266
267 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
268    causes a warning to be emitted when the given overloaded variant of ::func
269    is used but not when GNULIB_NAMESPACE::func is used.  */
270 #if defined __cplusplus && defined GNULIB_NAMESPACE
271 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
272    _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
273                         GNULIB_NAMESPACE)
274 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
275    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
276 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
277    we enable the warning only when not optimizing.  */
278 # if !__OPTIMIZE__
279 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
280     _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
281                          "The symbol ::" #func " refers to the system function. " \
282                          "Use " #namespace "::" #func " instead.")
283 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
284 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
285      extern __typeof__ (func) func
286 # else
287 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
288      _GL_EXTERN_C int _gl_cxxalias_dummy
289 # endif
290 #else
291 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
292     _GL_EXTERN_C int _gl_cxxalias_dummy
293 #endif
294
295 #endif /* _GL_CXXDEFS_H */
296
297 /* The definition of _GL_WARN_ON_USE is copied here.  */
298 #ifndef _GL_WARN_ON_USE
299
300 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
301 /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
302 #  define _GL_WARN_ON_USE(function, message) \
303 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
304 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
305 /* Verify the existence of the function.  */
306 #  define _GL_WARN_ON_USE(function, message) \
307 extern __typeof__ (function) function
308 # else /* Unsupported.  */
309 #  define _GL_WARN_ON_USE(function, message) \
310 _GL_WARN_EXTERN_C int _gl_warn_on_use
311 # endif
312 #endif
313
314 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
315    is like _GL_WARN_ON_USE (function, "string"), except that the function is
316    declared with the given prototype, consisting of return type, parameters,
317    and attributes.
318    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
319    not work in this case.  */
320 #ifndef _GL_WARN_ON_USE_CXX
321 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
322 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
323 extern rettype function parameters_and_attributes \
324      __attribute__ ((__warning__ (msg)))
325 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
326 /* Verify the existence of the function.  */
327 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
328 extern rettype function parameters_and_attributes
329 # else /* Unsupported.  */
330 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
331 _GL_WARN_EXTERN_C int _gl_warn_on_use
332 # endif
333 #endif
334
335 /* _GL_WARN_EXTERN_C declaration;
336    performs the declaration with C linkage.  */
337 #ifndef _GL_WARN_EXTERN_C
338 # if defined __cplusplus
339 #  define _GL_WARN_EXTERN_C extern "C"
340 # else
341 #  define _GL_WARN_EXTERN_C extern
342 # endif
343 #endif
344
345 /* Return non-zero if c is a blank, i.e. a space or tab character.  */
346 #if 1
347 # if !1
348 _GL_EXTERN_C int isblank (int c);
349 # endif
350 #elif defined GNULIB_POSIXCHECK
351 # undef isblank
352 # if HAVE_RAW_DECL_ISBLANK
353 _GL_WARN_ON_USE (isblank, "isblank is unportable - "
354                  "use gnulib module isblank for portability");
355 # endif
356 #endif
357
358 #endif /* _GL_CTYPE_H */
359 #endif /* _GL_CTYPE_H */