1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* A GNU-like <iconv.h>.
4 Copyright (C) 2007-2014 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/>. */
22 #pragma GCC system_header
26 /* The include_next requires a split double-inclusion guard. */
27 #include_next <iconv.h>
32 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
36 /* The three most frequent use cases of these macros are:
38 * For providing a substitute for a function that is missing on some
39 platforms, but is declared and works fine on the platforms on which
44 _GL_FUNCDECL_SYS (foo, ...);
46 _GL_CXXALIAS_SYS (foo, ...);
47 _GL_CXXALIASWARN (foo);
48 #elif defined GNULIB_POSIXCHECK
52 * For providing a replacement for a function that exists on all platforms,
53 but is broken/insufficient and needs to be replaced on some platforms:
57 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
61 _GL_FUNCDECL_RPL (foo, ...);
62 _GL_CXXALIAS_RPL (foo, ...);
64 _GL_CXXALIAS_SYS (foo, ...);
66 _GL_CXXALIASWARN (foo);
67 #elif defined GNULIB_POSIXCHECK
71 * For providing a replacement for a function that exists on some platforms
72 but is broken/insufficient and needs to be replaced on some of them and
73 is additionally either missing or undeclared on some other platforms:
77 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
81 _GL_FUNCDECL_RPL (foo, ...);
82 _GL_CXXALIAS_RPL (foo, ...);
84 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
85 _GL_FUNCDECL_SYS (foo, ...);
87 _GL_CXXALIAS_SYS (foo, ...);
89 _GL_CXXALIASWARN (foo);
90 #elif defined GNULIB_POSIXCHECK
95 /* _GL_EXTERN_C declaration;
96 performs the declaration with C linkage. */
97 #if defined __cplusplus
98 # define _GL_EXTERN_C extern "C"
100 # define _GL_EXTERN_C extern
103 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
104 declares a replacement function, named rpl_func, with the given prototype,
105 consisting of return type, parameters, and attributes.
107 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
108 _GL_ARG_NONNULL ((1)));
110 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
111 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
112 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
113 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
115 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
116 declares the system function, named func, with the given prototype,
117 consisting of return type, parameters, and attributes.
119 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
120 _GL_ARG_NONNULL ((1)));
122 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
123 _GL_EXTERN_C rettype func parameters_and_attributes
125 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
126 declares a C++ alias called GNULIB_NAMESPACE::func
127 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
129 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
131 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
132 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
133 #if defined __cplusplus && defined GNULIB_NAMESPACE
134 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
135 namespace GNULIB_NAMESPACE \
137 rettype (*const func) parameters = ::rpl_func; \
139 _GL_EXTERN_C int _gl_cxxalias_dummy
141 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
142 _GL_EXTERN_C int _gl_cxxalias_dummy
145 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
146 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
147 except that the C function rpl_func may have a slightly different
148 declaration. A cast is used to silence the "invalid conversion" error
149 that would otherwise occur. */
150 #if defined __cplusplus && defined GNULIB_NAMESPACE
151 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
152 namespace GNULIB_NAMESPACE \
154 rettype (*const func) parameters = \
155 reinterpret_cast<rettype(*)parameters>(::rpl_func); \
157 _GL_EXTERN_C int _gl_cxxalias_dummy
159 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
160 _GL_EXTERN_C int _gl_cxxalias_dummy
163 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
164 declares a C++ alias called GNULIB_NAMESPACE::func
165 that redirects to the system provided function func, if GNULIB_NAMESPACE
168 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
170 #if defined __cplusplus && defined GNULIB_NAMESPACE
171 /* If we were to write
172 rettype (*const func) parameters = ::func;
173 like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
174 better (remove an indirection through a 'static' pointer variable),
175 but then the _GL_CXXALIASWARN macro below would cause a warning not only
176 for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */
177 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
178 namespace GNULIB_NAMESPACE \
180 static rettype (*func) parameters = ::func; \
182 _GL_EXTERN_C int _gl_cxxalias_dummy
184 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
185 _GL_EXTERN_C int _gl_cxxalias_dummy
188 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
189 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
190 except that the C function func may have a slightly different declaration.
191 A cast is used to silence the "invalid conversion" error that would
193 #if defined __cplusplus && defined GNULIB_NAMESPACE
194 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
195 namespace GNULIB_NAMESPACE \
197 static rettype (*func) parameters = \
198 reinterpret_cast<rettype(*)parameters>(::func); \
200 _GL_EXTERN_C int _gl_cxxalias_dummy
202 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
203 _GL_EXTERN_C int _gl_cxxalias_dummy
206 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
207 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
208 except that the C function is picked among a set of overloaded functions,
209 namely the one with rettype2 and parameters2. Two consecutive casts
210 are used to silence the "cannot find a match" and "invalid conversion"
211 errors that would otherwise occur. */
212 #if defined __cplusplus && defined GNULIB_NAMESPACE
213 /* The outer cast must be a reinterpret_cast.
214 The inner cast: When the function is defined as a set of overloaded
215 functions, it works as a static_cast<>, choosing the designated variant.
216 When the function is defined as a single variant, it works as a
217 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
218 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
219 namespace GNULIB_NAMESPACE \
221 static rettype (*func) parameters = \
222 reinterpret_cast<rettype(*)parameters>( \
223 (rettype2(*)parameters2)(::func)); \
225 _GL_EXTERN_C int _gl_cxxalias_dummy
227 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
228 _GL_EXTERN_C int _gl_cxxalias_dummy
231 /* _GL_CXXALIASWARN (func);
232 causes a warning to be emitted when ::func is used but not when
233 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
235 #if defined __cplusplus && defined GNULIB_NAMESPACE
236 # define _GL_CXXALIASWARN(func) \
237 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
238 # define _GL_CXXALIASWARN_1(func,namespace) \
239 _GL_CXXALIASWARN_2 (func, namespace)
240 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
241 we enable the warning only when not optimizing. */
243 # define _GL_CXXALIASWARN_2(func,namespace) \
244 _GL_WARN_ON_USE (func, \
245 "The symbol ::" #func " refers to the system function. " \
246 "Use " #namespace "::" #func " instead.")
247 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
248 # define _GL_CXXALIASWARN_2(func,namespace) \
249 extern __typeof__ (func) func
251 # define _GL_CXXALIASWARN_2(func,namespace) \
252 _GL_EXTERN_C int _gl_cxxalias_dummy
255 # define _GL_CXXALIASWARN(func) \
256 _GL_EXTERN_C int _gl_cxxalias_dummy
259 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
260 causes a warning to be emitted when the given overloaded variant of ::func
261 is used but not when GNULIB_NAMESPACE::func is used. */
262 #if defined __cplusplus && defined GNULIB_NAMESPACE
263 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
264 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
266 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
267 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
268 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
269 we enable the warning only when not optimizing. */
271 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
272 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
273 "The symbol ::" #func " refers to the system function. " \
274 "Use " #namespace "::" #func " instead.")
275 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
276 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
277 extern __typeof__ (func) func
279 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
280 _GL_EXTERN_C int _gl_cxxalias_dummy
283 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
284 _GL_EXTERN_C int _gl_cxxalias_dummy
287 #endif /* _GL_CXXDEFS_H */
289 /* The definition of _GL_ARG_NONNULL is copied here. */
290 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
291 that the values passed as arguments n, ..., m must be non-NULL pointers.
292 n = 1 stands for the first argument, n = 2 for the second argument etc. */
293 #ifndef _GL_ARG_NONNULL
294 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
295 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
297 # define _GL_ARG_NONNULL(params)
301 /* The definition of _GL_WARN_ON_USE is copied here. */
302 #ifndef _GL_WARN_ON_USE
304 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
305 /* A compiler attribute is available in gcc versions 4.3.0 and later. */
306 # define _GL_WARN_ON_USE(function, message) \
307 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
308 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
309 /* Verify the existence of the function. */
310 # define _GL_WARN_ON_USE(function, message) \
311 extern __typeof__ (function) function
312 # else /* Unsupported. */
313 # define _GL_WARN_ON_USE(function, message) \
314 _GL_WARN_EXTERN_C int _gl_warn_on_use
318 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
319 is like _GL_WARN_ON_USE (function, "string"), except that the function is
320 declared with the given prototype, consisting of return type, parameters,
322 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
323 not work in this case. */
324 #ifndef _GL_WARN_ON_USE_CXX
325 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
326 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
327 extern rettype function parameters_and_attributes \
328 __attribute__ ((__warning__ (msg)))
329 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
330 /* Verify the existence of the function. */
331 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
332 extern rettype function parameters_and_attributes
333 # else /* Unsupported. */
334 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
335 _GL_WARN_EXTERN_C int _gl_warn_on_use
339 /* _GL_WARN_EXTERN_C declaration;
340 performs the declaration with C linkage. */
341 #ifndef _GL_WARN_EXTERN_C
342 # if defined __cplusplus
343 # define _GL_WARN_EXTERN_C extern "C"
345 # define _GL_WARN_EXTERN_C extern
352 /* An iconv_open wrapper that supports the IANA standardized encoding names
353 ("ISO-8859-1" etc.) as far as possible. */
354 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
355 # define iconv_open rpl_iconv_open
357 _GL_FUNCDECL_RPL (iconv_open, iconv_t,
358 (const char *tocode, const char *fromcode)
359 _GL_ARG_NONNULL ((1, 2)));
360 _GL_CXXALIAS_RPL (iconv_open, iconv_t,
361 (const char *tocode, const char *fromcode));
363 _GL_CXXALIAS_SYS (iconv_open, iconv_t,
364 (const char *tocode, const char *fromcode));
366 _GL_CXXALIASWARN (iconv_open);
370 /* Special constants for supporting UTF-{16,32}{BE,LE} encodings.
372 # define _ICONV_UTF8_UTF16BE (iconv_t)(-161)
373 # define _ICONV_UTF8_UTF16LE (iconv_t)(-162)
374 # define _ICONV_UTF8_UTF32BE (iconv_t)(-163)
375 # define _ICONV_UTF8_UTF32LE (iconv_t)(-164)
376 # define _ICONV_UTF16BE_UTF8 (iconv_t)(-165)
377 # define _ICONV_UTF16LE_UTF8 (iconv_t)(-166)
378 # define _ICONV_UTF32BE_UTF8 (iconv_t)(-167)
379 # define _ICONV_UTF32LE_UTF8 (iconv_t)(-168)
384 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
385 # define iconv rpl_iconv
387 _GL_FUNCDECL_RPL (iconv, size_t,
389 const char **inbuf, size_t *inbytesleft,
390 char **outbuf, size_t *outbytesleft));
391 _GL_CXXALIAS_RPL (iconv, size_t,
393 const char **inbuf, size_t *inbytesleft,
394 char **outbuf, size_t *outbytesleft));
396 _GL_CXXALIAS_SYS (iconv, size_t,
398 const char **inbuf, size_t *inbytesleft,
399 char **outbuf, size_t *outbytesleft));
401 _GL_CXXALIASWARN (iconv);
409 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
410 # define iconv_close rpl_iconv_close
412 _GL_FUNCDECL_RPL (iconv_close, int, (iconv_t cd));
413 _GL_CXXALIAS_RPL (iconv_close, int, (iconv_t cd));
415 _GL_CXXALIAS_SYS (iconv_close, int, (iconv_t cd));
417 _GL_CXXALIASWARN (iconv_close);
421 #endif /* _GL_ICONV_H */
422 #endif /* _GL_ICONV_H */