iconv.h 27 KB

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