iconv.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
  2. /* A GNU-like <iconv.h>.
  3. Copyright (C) 2007-2022 Free Software Foundation, Inc.
  4. This file is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as
  6. published by the Free Software Foundation; either version 2.1 of the
  7. License, or (at your option) any later version.
  8. This file is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License
  13. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  14. #ifndef _GL_LGL_ICONV_H
  15. #if __GNUC__ >= 3
  16. #pragma GCC system_header
  17. #endif
  18. /* The include_next requires a split double-inclusion guard. */
  19. #include_next <iconv.h>
  20. #ifndef _GL_LGL_ICONV_H
  21. #define _GL_LGL_ICONV_H
  22. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  23. /* C++ compatible function declaration macros.
  24. Copyright (C) 2010-2022 Free Software Foundation, Inc.
  25. This program is free software: you can redistribute it and/or modify it
  26. under the terms of the GNU Lesser General Public License as published
  27. by the Free Software Foundation; either version 2 of the License, or
  28. (at your option) any later version.
  29. This program is distributed in the hope that it will be useful,
  30. but WITHOUT ANY WARRANTY; without even the implied warranty of
  31. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  32. Lesser General Public License for more details.
  33. You should have received a copy of the GNU Lesser General Public License
  34. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  35. #ifndef _GL_CXXDEFS_H
  36. #define _GL_CXXDEFS_H
  37. /* Begin/end the GNULIB_NAMESPACE namespace. */
  38. #if defined __cplusplus && defined GNULIB_NAMESPACE
  39. # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
  40. # define _GL_END_NAMESPACE }
  41. #else
  42. # define _GL_BEGIN_NAMESPACE
  43. # define _GL_END_NAMESPACE
  44. #endif
  45. /* 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
  48. it exists:
  49. #if @GNULIB_FOO@
  50. # if !@HAVE_FOO@
  51. _GL_FUNCDECL_SYS (foo, ...);
  52. # endif
  53. _GL_CXXALIAS_SYS (foo, ...);
  54. _GL_CXXALIASWARN (foo);
  55. #elif defined GNULIB_POSIXCHECK
  56. ...
  57. #endif
  58. * For providing a replacement for a function that exists on all platforms,
  59. but is broken/insufficient and needs to be replaced on some platforms:
  60. #if @GNULIB_FOO@
  61. # if @REPLACE_FOO@
  62. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  63. # undef foo
  64. # define foo rpl_foo
  65. # endif
  66. _GL_FUNCDECL_RPL (foo, ...);
  67. _GL_CXXALIAS_RPL (foo, ...);
  68. # else
  69. _GL_CXXALIAS_SYS (foo, ...);
  70. # endif
  71. _GL_CXXALIASWARN (foo);
  72. #elif defined GNULIB_POSIXCHECK
  73. ...
  74. #endif
  75. * For providing a replacement for a function that exists on some platforms
  76. but is broken/insufficient and needs to be replaced on some of them and
  77. is additionally either missing or undeclared on some other platforms:
  78. #if @GNULIB_FOO@
  79. # if @REPLACE_FOO@
  80. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  81. # undef foo
  82. # define foo rpl_foo
  83. # endif
  84. _GL_FUNCDECL_RPL (foo, ...);
  85. _GL_CXXALIAS_RPL (foo, ...);
  86. # else
  87. # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
  88. _GL_FUNCDECL_SYS (foo, ...);
  89. # endif
  90. _GL_CXXALIAS_SYS (foo, ...);
  91. # endif
  92. _GL_CXXALIASWARN (foo);
  93. #elif defined GNULIB_POSIXCHECK
  94. ...
  95. #endif
  96. */
  97. /* _GL_EXTERN_C declaration;
  98. performs the declaration with C linkage. */
  99. #if defined __cplusplus
  100. # define _GL_EXTERN_C extern "C"
  101. #else
  102. # define _GL_EXTERN_C extern
  103. #endif
  104. /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
  105. declares a replacement function, named rpl_func, with the given prototype,
  106. consisting of return type, parameters, and attributes.
  107. Example:
  108. _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
  109. _GL_ARG_NONNULL ((1)));
  110. */
  111. #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
  112. _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
  113. #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
  114. _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.
  118. Example:
  119. _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
  120. _GL_ARG_NONNULL ((1)));
  121. */
  122. #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
  123. _GL_EXTERN_C rettype func parameters_and_attributes
  124. /* _GL_CXXALIAS_RPL (func, rettype, parameters);
  125. declares a C++ alias called GNULIB_NAMESPACE::func
  126. that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
  127. Example:
  128. _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
  129. Wrapping rpl_func in an object with an inline conversion operator
  130. avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
  131. actually used in the program. */
  132. #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
  133. _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
  134. #if defined __cplusplus && defined GNULIB_NAMESPACE
  135. # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
  136. namespace GNULIB_NAMESPACE \
  137. { \
  138. static const struct _gl_ ## func ## _wrapper \
  139. { \
  140. typedef rettype (*type) parameters; \
  141. \
  142. inline operator type () const \
  143. { \
  144. return ::rpl_func; \
  145. } \
  146. } func = {}; \
  147. } \
  148. _GL_EXTERN_C int _gl_cxxalias_dummy
  149. #else
  150. # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
  151. _GL_EXTERN_C int _gl_cxxalias_dummy
  152. #endif
  153. /* _GL_CXXALIAS_MDA (func, rettype, parameters);
  154. is to be used when func is a Microsoft deprecated alias, on native Windows.
  155. It declares a C++ alias called GNULIB_NAMESPACE::func
  156. that redirects to _func, if GNULIB_NAMESPACE is defined.
  157. Example:
  158. _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
  159. */
  160. #define _GL_CXXALIAS_MDA(func,rettype,parameters) \
  161. _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
  162. /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
  163. is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
  164. except that the C function rpl_func may have a slightly different
  165. declaration. A cast is used to silence the "invalid conversion" error
  166. that would otherwise occur. */
  167. #if defined __cplusplus && defined GNULIB_NAMESPACE
  168. # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
  169. namespace GNULIB_NAMESPACE \
  170. { \
  171. static const struct _gl_ ## func ## _wrapper \
  172. { \
  173. typedef rettype (*type) parameters; \
  174. \
  175. inline operator type () const \
  176. { \
  177. return reinterpret_cast<type>(::rpl_func); \
  178. } \
  179. } func = {}; \
  180. } \
  181. _GL_EXTERN_C int _gl_cxxalias_dummy
  182. #else
  183. # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
  184. _GL_EXTERN_C int _gl_cxxalias_dummy
  185. #endif
  186. /* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
  187. is like _GL_CXXALIAS_MDA (func, rettype, parameters);
  188. except that the C function func may have a slightly different declaration.
  189. A cast is used to silence the "invalid conversion" error that would
  190. otherwise occur. */
  191. #define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
  192. _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
  193. /* _GL_CXXALIAS_SYS (func, rettype, parameters);
  194. declares a C++ alias called GNULIB_NAMESPACE::func
  195. that redirects to the system provided function func, if GNULIB_NAMESPACE
  196. is defined.
  197. Example:
  198. _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
  199. Wrapping func in an object with an inline conversion operator
  200. avoids a reference to func unless GNULIB_NAMESPACE::func is
  201. actually used in the program. */
  202. #if defined __cplusplus && defined GNULIB_NAMESPACE
  203. # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
  204. namespace GNULIB_NAMESPACE \
  205. { \
  206. static const struct _gl_ ## func ## _wrapper \
  207. { \
  208. typedef rettype (*type) parameters; \
  209. \
  210. inline operator type () const \
  211. { \
  212. return ::func; \
  213. } \
  214. } func = {}; \
  215. } \
  216. _GL_EXTERN_C int _gl_cxxalias_dummy
  217. #else
  218. # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
  219. _GL_EXTERN_C int _gl_cxxalias_dummy
  220. #endif
  221. /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
  222. is like _GL_CXXALIAS_SYS (func, rettype, parameters);
  223. except that the C function func may have a slightly different declaration.
  224. A cast is used to silence the "invalid conversion" error that would
  225. otherwise occur. */
  226. #if defined __cplusplus && defined GNULIB_NAMESPACE
  227. # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
  228. namespace GNULIB_NAMESPACE \
  229. { \
  230. static const struct _gl_ ## func ## _wrapper \
  231. { \
  232. typedef rettype (*type) parameters; \
  233. \
  234. inline operator type () const \
  235. { \
  236. return reinterpret_cast<type>(::func); \
  237. } \
  238. } func = {}; \
  239. } \
  240. _GL_EXTERN_C int _gl_cxxalias_dummy
  241. #else
  242. # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
  243. _GL_EXTERN_C int _gl_cxxalias_dummy
  244. #endif
  245. /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
  246. is like _GL_CXXALIAS_SYS (func, rettype, parameters);
  247. except that the C function is picked among a set of overloaded functions,
  248. namely the one with rettype2 and parameters2. Two consecutive casts
  249. are used to silence the "cannot find a match" and "invalid conversion"
  250. errors that would otherwise occur. */
  251. #if defined __cplusplus && defined GNULIB_NAMESPACE
  252. /* The outer cast must be a reinterpret_cast.
  253. The inner cast: When the function is defined as a set of overloaded
  254. functions, it works as a static_cast<>, choosing the designated variant.
  255. When the function is defined as a single variant, it works as a
  256. reinterpret_cast<>. The parenthesized cast syntax works both ways. */
  257. # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
  258. namespace GNULIB_NAMESPACE \
  259. { \
  260. static const struct _gl_ ## func ## _wrapper \
  261. { \
  262. typedef rettype (*type) parameters; \
  263. \
  264. inline operator type () const \
  265. { \
  266. return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
  267. } \
  268. } func = {}; \
  269. } \
  270. _GL_EXTERN_C int _gl_cxxalias_dummy
  271. #else
  272. # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
  273. _GL_EXTERN_C int _gl_cxxalias_dummy
  274. #endif
  275. /* _GL_CXXALIASWARN (func);
  276. causes a warning to be emitted when ::func is used but not when
  277. GNULIB_NAMESPACE::func is used. func must be defined without overloaded
  278. variants. */
  279. #if defined __cplusplus && defined GNULIB_NAMESPACE
  280. # define _GL_CXXALIASWARN(func) \
  281. _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
  282. # define _GL_CXXALIASWARN_1(func,namespace) \
  283. _GL_CXXALIASWARN_2 (func, namespace)
  284. /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
  285. we enable the warning only when not optimizing. */
  286. # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
  287. # define _GL_CXXALIASWARN_2(func,namespace) \
  288. _GL_WARN_ON_USE (func, \
  289. "The symbol ::" #func " refers to the system function. " \
  290. "Use " #namespace "::" #func " instead.")
  291. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  292. # define _GL_CXXALIASWARN_2(func,namespace) \
  293. extern __typeof__ (func) func
  294. # else
  295. # define _GL_CXXALIASWARN_2(func,namespace) \
  296. _GL_EXTERN_C int _gl_cxxalias_dummy
  297. # endif
  298. #else
  299. # define _GL_CXXALIASWARN(func) \
  300. _GL_EXTERN_C int _gl_cxxalias_dummy
  301. #endif
  302. /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
  303. causes a warning to be emitted when the given overloaded variant of ::func
  304. is used but not when GNULIB_NAMESPACE::func is used. */
  305. #if defined __cplusplus && defined GNULIB_NAMESPACE
  306. # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
  307. _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
  308. GNULIB_NAMESPACE)
  309. # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
  310. _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
  311. /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
  312. we enable the warning only when not optimizing. */
  313. # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
  314. # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
  315. _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
  316. "The symbol ::" #func " refers to the system function. " \
  317. "Use " #namespace "::" #func " instead.")
  318. # else
  319. # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
  320. _GL_EXTERN_C int _gl_cxxalias_dummy
  321. # endif
  322. #else
  323. # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
  324. _GL_EXTERN_C int _gl_cxxalias_dummy
  325. #endif
  326. #endif /* _GL_CXXDEFS_H */
  327. /* The definition of _GL_ARG_NONNULL is copied here. */
  328. /* A C macro for declaring that specific arguments must not be NULL.
  329. Copyright (C) 2009-2022 Free Software Foundation, Inc.
  330. This program is free software: you can redistribute it and/or modify it
  331. under the terms of the GNU Lesser General Public License as published
  332. by the Free Software Foundation; either version 2 of the License, or
  333. (at your option) any later version.
  334. This program is distributed in the hope that it will be useful,
  335. but WITHOUT ANY WARRANTY; without even the implied warranty of
  336. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  337. Lesser General Public License for more details.
  338. You should have received a copy of the GNU Lesser General Public License
  339. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  340. /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
  341. that the values passed as arguments n, ..., m must be non-NULL pointers.
  342. n = 1 stands for the first argument, n = 2 for the second argument etc. */
  343. #ifndef _GL_ARG_NONNULL
  344. # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
  345. # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
  346. # else
  347. # define _GL_ARG_NONNULL(params)
  348. # endif
  349. #endif
  350. /* The definition of _GL_WARN_ON_USE is copied here. */
  351. /* A C macro for emitting warnings if a function is used.
  352. Copyright (C) 2010-2022 Free Software Foundation, Inc.
  353. This program is free software: you can redistribute it and/or modify it
  354. under the terms of the GNU Lesser General Public License as published
  355. by the Free Software Foundation; either version 2 of the License, or
  356. (at your option) any later version.
  357. This program is distributed in the hope that it will be useful,
  358. but WITHOUT ANY WARRANTY; without even the implied warranty of
  359. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  360. Lesser General Public License for more details.
  361. You should have received a copy of the GNU Lesser General Public License
  362. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  363. /* _GL_WARN_ON_USE (function, "literal string") issues a declaration
  364. for FUNCTION which will then trigger a compiler warning containing
  365. the text of "literal string" anywhere that function is called, if
  366. supported by the compiler. If the compiler does not support this
  367. feature, the macro expands to an unused extern declaration.
  368. _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
  369. attribute used in _GL_WARN_ON_USE. If the compiler does not support
  370. this feature, it expands to empty.
  371. These macros are useful for marking a function as a potential
  372. portability trap, with the intent that "literal string" include
  373. instructions on the replacement function that should be used
  374. instead.
  375. _GL_WARN_ON_USE is for functions with 'extern' linkage.
  376. _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
  377. linkage.
  378. However, one of the reasons that a function is a portability trap is
  379. if it has the wrong signature. Declaring FUNCTION with a different
  380. signature in C is a compilation error, so this macro must use the
  381. same type as any existing declaration so that programs that avoid
  382. the problematic FUNCTION do not fail to compile merely because they
  383. included a header that poisoned the function. But this implies that
  384. _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
  385. have a declaration. Use of this macro implies that there must not
  386. be any other macro hiding the declaration of FUNCTION; but
  387. undefining FUNCTION first is part of the poisoning process anyway
  388. (although for symbols that are provided only via a macro, the result
  389. is a compilation error rather than a warning containing
  390. "literal string"). Also note that in C++, it is only safe to use if
  391. FUNCTION has no overloads.
  392. For an example, it is possible to poison 'getline' by:
  393. - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
  394. [getline]) in configure.ac, which potentially defines
  395. HAVE_RAW_DECL_GETLINE
  396. - adding this code to a header that wraps the system <stdio.h>:
  397. #undef getline
  398. #if HAVE_RAW_DECL_GETLINE
  399. _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
  400. "not universally present; use the gnulib module getline");
  401. #endif
  402. It is not possible to directly poison global variables. But it is
  403. possible to write a wrapper accessor function, and poison that
  404. (less common usage, like &environ, will cause a compilation error
  405. rather than issue the nice warning, but the end result of informing
  406. the developer about their portability problem is still achieved):
  407. #if HAVE_RAW_DECL_ENVIRON
  408. static char ***
  409. rpl_environ (void) { return &environ; }
  410. _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
  411. # undef environ
  412. # define environ (*rpl_environ ())
  413. #endif
  414. or better (avoiding contradictory use of 'static' and 'extern'):
  415. #if HAVE_RAW_DECL_ENVIRON
  416. static char ***
  417. _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
  418. rpl_environ (void) { return &environ; }
  419. # undef environ
  420. # define environ (*rpl_environ ())
  421. #endif
  422. */
  423. #ifndef _GL_WARN_ON_USE
  424. # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
  425. /* A compiler attribute is available in gcc versions 4.3.0 and later. */
  426. # define _GL_WARN_ON_USE(function, message) \
  427. _GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
  428. # define _GL_WARN_ON_USE_ATTRIBUTE(message) \
  429. __attribute__ ((__warning__ (message)))
  430. # elif __clang_major__ >= 4
  431. /* Another compiler attribute is available in clang. */
  432. # define _GL_WARN_ON_USE(function, message) \
  433. _GL_WARN_EXTERN_C __typeof__ (function) function \
  434. __attribute__ ((__diagnose_if__ (1, message, "warning")))
  435. # define _GL_WARN_ON_USE_ATTRIBUTE(message) \
  436. __attribute__ ((__diagnose_if__ (1, message, "warning")))
  437. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  438. /* Verify the existence of the function. */
  439. # define _GL_WARN_ON_USE(function, message) \
  440. _GL_WARN_EXTERN_C __typeof__ (function) function
  441. # define _GL_WARN_ON_USE_ATTRIBUTE(message)
  442. # else /* Unsupported. */
  443. # define _GL_WARN_ON_USE(function, message) \
  444. _GL_WARN_EXTERN_C int _gl_warn_on_use
  445. # define _GL_WARN_ON_USE_ATTRIBUTE(message)
  446. # endif
  447. #endif
  448. /* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
  449. is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
  450. function is declared with the given prototype, consisting of return type,
  451. parameters, and attributes.
  452. This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
  453. not work in this case. */
  454. #ifndef _GL_WARN_ON_USE_CXX
  455. # if !defined __cplusplus
  456. # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
  457. _GL_WARN_ON_USE (function, msg)
  458. # else
  459. # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
  460. /* A compiler attribute is available in gcc versions 4.3.0 and later. */
  461. # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
  462. extern rettype_gcc function parameters_and_attributes \
  463. __attribute__ ((__warning__ (msg)))
  464. # elif __clang_major__ >= 4
  465. /* Another compiler attribute is available in clang. */
  466. # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
  467. extern rettype_clang function parameters_and_attributes \
  468. __attribute__ ((__diagnose_if__ (1, msg, "warning")))
  469. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  470. /* Verify the existence of the function. */
  471. # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
  472. extern rettype_gcc function parameters_and_attributes
  473. # else /* Unsupported. */
  474. # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
  475. _GL_WARN_EXTERN_C int _gl_warn_on_use
  476. # endif
  477. # endif
  478. #endif
  479. /* _GL_WARN_EXTERN_C declaration;
  480. performs the declaration with C linkage. */
  481. #ifndef _GL_WARN_EXTERN_C
  482. # if defined __cplusplus
  483. # define _GL_WARN_EXTERN_C extern "C"
  484. # else
  485. # define _GL_WARN_EXTERN_C extern
  486. # endif
  487. #endif
  488. #if 1
  489. # if 0
  490. /* An iconv_open wrapper that supports the IANA standardized encoding names
  491. ("ISO-8859-1" etc.) as far as possible. */
  492. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  493. # define iconv_open rpl_iconv_open
  494. # endif
  495. _GL_FUNCDECL_RPL (iconv_open, iconv_t,
  496. (const char *tocode, const char *fromcode)
  497. _GL_ARG_NONNULL ((1, 2)));
  498. _GL_CXXALIAS_RPL (iconv_open, iconv_t,
  499. (const char *tocode, const char *fromcode));
  500. # else
  501. _GL_CXXALIAS_SYS (iconv_open, iconv_t,
  502. (const char *tocode, const char *fromcode));
  503. # endif
  504. _GL_CXXALIASWARN (iconv_open);
  505. #elif defined GNULIB_POSIXCHECK
  506. # undef iconv_open
  507. # if HAVE_RAW_DECL_ICONV_OPEN
  508. _GL_WARN_ON_USE (iconv_open, "iconv_open is not working correctly everywhere - "
  509. "use gnulib module iconv for portability");
  510. # endif
  511. #endif
  512. #if 0
  513. /* Special constants for supporting UTF-{16,32}{BE,LE} encodings.
  514. Not public. */
  515. # define _ICONV_UTF8_UTF16BE (iconv_t)(-161)
  516. # define _ICONV_UTF8_UTF16LE (iconv_t)(-162)
  517. # define _ICONV_UTF8_UTF32BE (iconv_t)(-163)
  518. # define _ICONV_UTF8_UTF32LE (iconv_t)(-164)
  519. # define _ICONV_UTF16BE_UTF8 (iconv_t)(-165)
  520. # define _ICONV_UTF16LE_UTF8 (iconv_t)(-166)
  521. # define _ICONV_UTF32BE_UTF8 (iconv_t)(-167)
  522. # define _ICONV_UTF32LE_UTF8 (iconv_t)(-168)
  523. #endif
  524. #if 1
  525. # if 0
  526. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  527. # define iconv rpl_iconv
  528. # endif
  529. _GL_FUNCDECL_RPL (iconv, size_t,
  530. (iconv_t cd,
  531. char **restrict inbuf,
  532. size_t *restrict inbytesleft,
  533. char **restrict outbuf, size_t *restrict outbytesleft));
  534. _GL_CXXALIAS_RPL (iconv, size_t,
  535. (iconv_t cd,
  536. char **restrict inbuf,
  537. size_t *restrict inbytesleft,
  538. char **restrict outbuf, size_t *restrict outbytesleft));
  539. # else
  540. /* Need to cast, because on some versions of Solaris, ICONV_CONST does
  541. not have the right value for C++. */
  542. _GL_CXXALIAS_SYS_CAST (iconv, size_t,
  543. (iconv_t cd,
  544. char **restrict inbuf,
  545. size_t *restrict inbytesleft,
  546. char **restrict outbuf, size_t *restrict outbytesleft));
  547. # endif
  548. _GL_CXXALIASWARN (iconv);
  549. # ifndef ICONV_CONST
  550. # define ICONV_CONST
  551. # endif
  552. #elif defined GNULIB_POSIXCHECK
  553. # undef iconv
  554. # if HAVE_RAW_DECL_ICONV
  555. _GL_WARN_ON_USE (iconv, "iconv is not working correctly everywhere - "
  556. "use gnulib module iconv for portability");
  557. # endif
  558. #endif
  559. #if 1
  560. # if 0
  561. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  562. # define iconv_close rpl_iconv_close
  563. # endif
  564. _GL_FUNCDECL_RPL (iconv_close, int, (iconv_t cd));
  565. _GL_CXXALIAS_RPL (iconv_close, int, (iconv_t cd));
  566. # else
  567. _GL_CXXALIAS_SYS (iconv_close, int, (iconv_t cd));
  568. # endif
  569. _GL_CXXALIASWARN (iconv_close);
  570. #endif
  571. #endif /* _GL_LGL_ICONV_H */
  572. #endif /* _GL_LGL_ICONV_H */