1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* A substitute for ISO C99 <ctype.h>, for platforms on which it is incomplete.
4 Copyright (C) 2009-2015 Free Software Foundation, Inc.
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)
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.
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/>. */
19 /* Written by Bruno Haible. */
22 * ISO C 99 <ctype.h> for platforms on which it is incomplete.
23 * <http://www.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html>
29 #pragma GCC system_header
33 /* Include the original <ctype.h>. */
34 /* The include_next requires a split double-inclusion guard. */
35 #include_next <ctype.h>
40 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
44 /* The three most frequent use cases of these macros are:
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
52 _GL_FUNCDECL_SYS (foo, ...);
54 _GL_CXXALIAS_SYS (foo, ...);
55 _GL_CXXALIASWARN (foo);
56 #elif defined GNULIB_POSIXCHECK
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:
65 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
69 _GL_FUNCDECL_RPL (foo, ...);
70 _GL_CXXALIAS_RPL (foo, ...);
72 _GL_CXXALIAS_SYS (foo, ...);
74 _GL_CXXALIASWARN (foo);
75 #elif defined GNULIB_POSIXCHECK
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:
85 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
89 _GL_FUNCDECL_RPL (foo, ...);
90 _GL_CXXALIAS_RPL (foo, ...);
92 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
93 _GL_FUNCDECL_SYS (foo, ...);
95 _GL_CXXALIAS_SYS (foo, ...);
97 _GL_CXXALIASWARN (foo);
98 #elif defined GNULIB_POSIXCHECK
103 /* _GL_EXTERN_C declaration;
104 performs the declaration with C linkage. */
105 #if defined __cplusplus
106 # define _GL_EXTERN_C extern "C"
108 # define _GL_EXTERN_C extern
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.
115 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
116 _GL_ARG_NONNULL ((1)));
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
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.
127 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
128 _GL_ARG_NONNULL ((1)));
130 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
131 _GL_EXTERN_C rettype func parameters_and_attributes
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.
137 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
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 \
145 rettype (*const func) parameters = ::rpl_func; \
147 _GL_EXTERN_C int _gl_cxxalias_dummy
149 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
150 _GL_EXTERN_C int _gl_cxxalias_dummy
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 \
162 rettype (*const func) parameters = \
163 reinterpret_cast<rettype(*)parameters>(::rpl_func); \
165 _GL_EXTERN_C int _gl_cxxalias_dummy
167 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
168 _GL_EXTERN_C int _gl_cxxalias_dummy
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
176 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
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 \
188 static rettype (*func) parameters = ::func; \
190 _GL_EXTERN_C int _gl_cxxalias_dummy
192 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
193 _GL_EXTERN_C int _gl_cxxalias_dummy
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
201 #if defined __cplusplus && defined GNULIB_NAMESPACE
202 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
203 namespace GNULIB_NAMESPACE \
205 static rettype (*func) parameters = \
206 reinterpret_cast<rettype(*)parameters>(::func); \
208 _GL_EXTERN_C int _gl_cxxalias_dummy
210 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
211 _GL_EXTERN_C int _gl_cxxalias_dummy
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 \
229 static rettype (*func) parameters = \
230 reinterpret_cast<rettype(*)parameters>( \
231 (rettype2(*)parameters2)(::func)); \
233 _GL_EXTERN_C int _gl_cxxalias_dummy
235 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
236 _GL_EXTERN_C int _gl_cxxalias_dummy
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
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. */
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
259 # define _GL_CXXALIASWARN_2(func,namespace) \
260 _GL_EXTERN_C int _gl_cxxalias_dummy
263 # define _GL_CXXALIASWARN(func) \
264 _GL_EXTERN_C int _gl_cxxalias_dummy
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, \
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. */
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
287 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
288 _GL_EXTERN_C int _gl_cxxalias_dummy
291 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
292 _GL_EXTERN_C int _gl_cxxalias_dummy
295 #endif /* _GL_CXXDEFS_H */
297 /* The definition of _GL_WARN_ON_USE is copied here. */
298 #ifndef _GL_WARN_ON_USE
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
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,
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
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"
341 # define _GL_WARN_EXTERN_C extern
345 /* Return non-zero if c is a blank, i.e. a space or tab character. */
348 _GL_EXTERN_C int isblank (int c);
350 #elif defined GNULIB_POSIXCHECK
352 # if HAVE_RAW_DECL_ISBLANK
353 _GL_WARN_ON_USE (isblank, "isblank is unportable - "
354 "use gnulib module isblank for portability");
358 #endif /* _GL_CTYPE_H */
359 #endif /* _GL_CTYPE_H */