stdio.in.h 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057
  1. /* A GNU-like <stdio.h>.
  2. Copyright (C) 2004, 2007-2010 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  14. #if __GNUC__ >= 3
  15. @PRAGMA_SYSTEM_HEADER@
  16. #endif
  17. #if defined __need_FILE || defined __need___FILE
  18. /* Special invocation convention inside glibc header files. */
  19. #@INCLUDE_NEXT@ @NEXT_STDIO_H@
  20. #else
  21. /* Normal invocation convention. */
  22. #ifndef _GL_STDIO_H
  23. /* The include_next requires a split double-inclusion guard. */
  24. #@INCLUDE_NEXT@ @NEXT_STDIO_H@
  25. #ifndef _GL_STDIO_H
  26. #define _GL_STDIO_H
  27. /* Get va_list. Needed on many systems, including glibc 2.8. */
  28. #include <stdarg.h>
  29. #include <stddef.h>
  30. /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8. */
  31. #include <sys/types.h>
  32. #ifndef __attribute__
  33. /* The __attribute__ feature is available in gcc versions 2.5 and later.
  34. The __-protected variants of the attributes 'format' and 'printf' are
  35. accepted by gcc versions 2.6.4 (effectively 2.7) and later.
  36. We enable __attribute__ only if these are supported too, because
  37. gnulib and libintl do '#define printf __printf__' when they override
  38. the 'printf' function. */
  39. # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
  40. # define __attribute__(Spec) /* empty */
  41. # endif
  42. #endif
  43. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  44. /* The definition of _GL_ARG_NONNULL is copied here. */
  45. /* The definition of _GL_WARN_ON_USE is copied here. */
  46. #if @GNULIB_DPRINTF@
  47. # if @REPLACE_DPRINTF@
  48. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  49. # define dprintf rpl_dprintf
  50. # endif
  51. _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...)
  52. __attribute__ ((__format__ (__printf__, 2, 3)))
  53. _GL_ARG_NONNULL ((2)));
  54. _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...));
  55. # else
  56. # if !@HAVE_DPRINTF@
  57. _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...)
  58. __attribute__ ((__format__ (__printf__, 2, 3)))
  59. _GL_ARG_NONNULL ((2)));
  60. # endif
  61. _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...));
  62. # endif
  63. _GL_CXXALIASWARN (dprintf);
  64. #elif defined GNULIB_POSIXCHECK
  65. # undef dprintf
  66. # if HAVE_RAW_DECL_DPRINTF
  67. _GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
  68. "use gnulib module dprintf for portability");
  69. # endif
  70. #endif
  71. #if @GNULIB_FCLOSE@
  72. /* Close STREAM and its underlying file descriptor. */
  73. # if @REPLACE_FCLOSE@
  74. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  75. # define fclose rpl_fclose
  76. # endif
  77. _GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
  78. _GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
  79. # else
  80. _GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
  81. # endif
  82. _GL_CXXALIASWARN (fclose);
  83. #elif defined GNULIB_POSIXCHECK
  84. # undef fclose
  85. /* Assume fclose is always declared. */
  86. _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
  87. "use gnulib module fclose for portable POSIX compliance");
  88. #endif
  89. #if @GNULIB_FFLUSH@
  90. /* Flush all pending data on STREAM according to POSIX rules. Both
  91. output and seekable input streams are supported.
  92. Note! LOSS OF DATA can occur if fflush is applied on an input stream
  93. that is _not_seekable_ or on an update stream that is _not_seekable_
  94. and in which the most recent operation was input. Seekability can
  95. be tested with lseek(fileno(fp),0,SEEK_CUR). */
  96. # if @REPLACE_FFLUSH@
  97. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  98. # define fflush rpl_fflush
  99. # endif
  100. _GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
  101. _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
  102. # else
  103. _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
  104. # endif
  105. _GL_CXXALIASWARN (fflush);
  106. #elif defined GNULIB_POSIXCHECK
  107. # undef fflush
  108. /* Assume fflush is always declared. */
  109. _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
  110. "use gnulib module fflush for portable POSIX compliance");
  111. #endif
  112. /* It is very rare that the developer ever has full control of stdin,
  113. so any use of gets warrants an unconditional warning. Assume it is
  114. always declared, since it is required by C89. */
  115. #undef gets
  116. _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
  117. #if @GNULIB_FOPEN@
  118. # if @REPLACE_FOPEN@
  119. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  120. # undef fopen
  121. # define fopen rpl_fopen
  122. # endif
  123. _GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode)
  124. _GL_ARG_NONNULL ((1, 2)));
  125. _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
  126. # else
  127. _GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
  128. # endif
  129. _GL_CXXALIASWARN (fopen);
  130. #elif defined GNULIB_POSIXCHECK
  131. # undef fopen
  132. /* Assume fopen is always declared. */
  133. _GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
  134. "use gnulib module fopen for portability");
  135. #endif
  136. #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
  137. # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
  138. || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
  139. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  140. # define fprintf rpl_fprintf
  141. # endif
  142. # define GNULIB_overrides_fprintf 1
  143. _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
  144. __attribute__ ((__format__ (__printf__, 2, 3)))
  145. _GL_ARG_NONNULL ((1, 2)));
  146. _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
  147. # else
  148. _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
  149. # endif
  150. _GL_CXXALIASWARN (fprintf);
  151. #endif
  152. #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
  153. # if !GNULIB_overrides_fprintf
  154. # undef fprintf
  155. # endif
  156. /* Assume fprintf is always declared. */
  157. _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
  158. "use gnulib module fprintf-posix for portable "
  159. "POSIX compliance");
  160. #endif
  161. #if @GNULIB_FPURGE@
  162. /* Discard all pending buffered I/O data on STREAM.
  163. STREAM must not be wide-character oriented.
  164. When discarding pending output, the file position is set back to where it
  165. was before the write calls. When discarding pending input, the file
  166. position is advanced to match the end of the previously read input.
  167. Return 0 if successful. Upon error, return -1 and set errno. */
  168. # if @REPLACE_FPURGE@
  169. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  170. # define fpurge rpl_fpurge
  171. # endif
  172. _GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
  173. _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
  174. # else
  175. # if !@HAVE_DECL_FPURGE@
  176. _GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
  177. # endif
  178. _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
  179. # endif
  180. _GL_CXXALIASWARN (fpurge);
  181. #elif defined GNULIB_POSIXCHECK
  182. # undef fpurge
  183. # if HAVE_RAW_DECL_FPURGE
  184. _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
  185. "use gnulib module fpurge for portability");
  186. # endif
  187. #endif
  188. #if @GNULIB_FPUTC@
  189. # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
  190. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  191. # undef fputc
  192. # define fputc rpl_fputc
  193. # endif
  194. _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
  195. _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
  196. # else
  197. _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
  198. # endif
  199. _GL_CXXALIASWARN (fputc);
  200. #endif
  201. #if @GNULIB_FPUTS@
  202. # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
  203. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  204. # undef fputs
  205. # define fputs rpl_fputs
  206. # endif
  207. _GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream)
  208. _GL_ARG_NONNULL ((1, 2)));
  209. _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
  210. # else
  211. _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
  212. # endif
  213. _GL_CXXALIASWARN (fputs);
  214. #endif
  215. #if @GNULIB_FREOPEN@
  216. # if @REPLACE_FREOPEN@
  217. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  218. # undef freopen
  219. # define freopen rpl_freopen
  220. # endif
  221. _GL_FUNCDECL_RPL (freopen, FILE *,
  222. (const char *filename, const char *mode, FILE *stream)
  223. _GL_ARG_NONNULL ((2, 3)));
  224. _GL_CXXALIAS_RPL (freopen, FILE *,
  225. (const char *filename, const char *mode, FILE *stream));
  226. # else
  227. _GL_CXXALIAS_SYS (freopen, FILE *,
  228. (const char *filename, const char *mode, FILE *stream));
  229. # endif
  230. _GL_CXXALIASWARN (freopen);
  231. #elif defined GNULIB_POSIXCHECK
  232. # undef freopen
  233. /* Assume freopen is always declared. */
  234. _GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - "
  235. "use gnulib module freopen for portability");
  236. #endif
  237. /* Set up the following warnings, based on which modules are in use.
  238. GNU Coding Standards discourage the use of fseek, since it imposes
  239. an arbitrary limitation on some 32-bit hosts. Remember that the
  240. fseek module depends on the fseeko module, so we only have three
  241. cases to consider:
  242. 1. The developer is not using either module. Issue a warning under
  243. GNULIB_POSIXCHECK for both functions, to remind them that both
  244. functions have bugs on some systems. _GL_NO_LARGE_FILES has no
  245. impact on this warning.
  246. 2. The developer is using both modules. They may be unaware of the
  247. arbitrary limitations of fseek, so issue a warning under
  248. GNULIB_POSIXCHECK. On the other hand, they may be using both
  249. modules intentionally, so the developer can define
  250. _GL_NO_LARGE_FILES in the compilation units where the use of fseek
  251. is safe, to silence the warning.
  252. 3. The developer is using the fseeko module, but not fseek. Gnulib
  253. guarantees that fseek will still work around platform bugs in that
  254. case, but we presume that the developer is aware of the pitfalls of
  255. fseek and was trying to avoid it, so issue a warning even when
  256. GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be
  257. defined to silence the warning in particular compilation units.
  258. In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
  259. fseek gets defined as a macro, it is recommended that the developer
  260. uses the fseek module, even if he is not calling the fseek function.
  261. Most gnulib clients that perform stream operations should fall into
  262. category 3. */
  263. #if @GNULIB_FSEEK@
  264. # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
  265. # define _GL_FSEEK_WARN /* Category 2, above. */
  266. # undef fseek
  267. # endif
  268. # if @REPLACE_FSEEK@
  269. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  270. # undef fseek
  271. # define fseek rpl_fseek
  272. # endif
  273. _GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
  274. _GL_ARG_NONNULL ((1)));
  275. _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
  276. # else
  277. _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
  278. # endif
  279. _GL_CXXALIASWARN (fseek);
  280. #endif
  281. #if @GNULIB_FSEEKO@
  282. # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
  283. # define _GL_FSEEK_WARN /* Category 3, above. */
  284. # undef fseek
  285. # endif
  286. # if @REPLACE_FSEEKO@
  287. /* Provide an fseeko function that is aware of a preceding fflush(), and which
  288. detects pipes. */
  289. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  290. # undef fseeko
  291. # define fseeko rpl_fseeko
  292. # endif
  293. _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
  294. _GL_ARG_NONNULL ((1)));
  295. _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
  296. # else
  297. # if ! @HAVE_FSEEKO@
  298. _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
  299. _GL_ARG_NONNULL ((1)));
  300. # endif
  301. _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
  302. # endif
  303. _GL_CXXALIASWARN (fseeko);
  304. # if (@REPLACE_FSEEKO@ || !@HAVE_FSEEKO@) && !@GNULIB_FSEEK@
  305. /* Provide an fseek function that is consistent with fseeko. */
  306. /* In order to avoid that fseek gets defined as a macro here, the
  307. developer can request the 'fseek' module. */
  308. # undef fseek
  309. # define fseek rpl_fseek
  310. static inline int _GL_ARG_NONNULL ((1))
  311. rpl_fseek (FILE *fp, long offset, int whence)
  312. {
  313. # if @REPLACE_FSEEKO@
  314. return rpl_fseeko (fp, offset, whence);
  315. # else
  316. return fseeko (fp, offset, whence);
  317. # endif
  318. }
  319. # endif
  320. #elif defined GNULIB_POSIXCHECK
  321. # define _GL_FSEEK_WARN /* Category 1, above. */
  322. # undef fseek
  323. # undef fseeko
  324. # if HAVE_RAW_DECL_FSEEKO
  325. _GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
  326. "use gnulib module fseeko for portability");
  327. # endif
  328. #endif
  329. #ifdef _GL_FSEEK_WARN
  330. # undef _GL_FSEEK_WARN
  331. /* Here, either fseek is undefined (but C89 guarantees that it is
  332. declared), or it is defined as rpl_fseek (declared above). */
  333. _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
  334. "on 32-bit platforms - "
  335. "use fseeko function for handling of large files");
  336. #endif
  337. /* ftell, ftello. See the comments on fseek/fseeko. */
  338. #if @GNULIB_FTELL@
  339. # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
  340. # define _GL_FTELL_WARN /* Category 2, above. */
  341. # undef ftell
  342. # endif
  343. # if @REPLACE_FTELL@
  344. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  345. # undef ftell
  346. # define ftell rpl_ftell
  347. # endif
  348. _GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
  349. _GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
  350. # else
  351. _GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
  352. # endif
  353. _GL_CXXALIASWARN (ftell);
  354. #endif
  355. #if @GNULIB_FTELLO@
  356. # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
  357. # define _GL_FTELL_WARN /* Category 3, above. */
  358. # undef ftell
  359. # endif
  360. # if @REPLACE_FTELLO@
  361. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  362. # undef ftello
  363. # define ftello rpl_ftello
  364. # endif
  365. _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
  366. _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
  367. # else
  368. # if ! @HAVE_FTELLO@
  369. _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
  370. # endif
  371. _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
  372. # endif
  373. _GL_CXXALIASWARN (ftello);
  374. # if (@REPLACE_FTELLO@ || !@HAVE_FTELLO@) && !@GNULIB_FTELL@
  375. /* Provide an ftell function that is consistent with ftello. */
  376. /* In order to avoid that ftell gets defined as a macro here, the
  377. developer can request the 'ftell' module. */
  378. # undef ftell
  379. # define ftell rpl_ftell
  380. static inline long _GL_ARG_NONNULL ((1))
  381. rpl_ftell (FILE *f)
  382. {
  383. # if @REPLACE_FTELLO@
  384. return rpl_ftello (f);
  385. # else
  386. return ftello (f);
  387. # endif
  388. }
  389. # endif
  390. #elif defined GNULIB_POSIXCHECK
  391. # define _GL_FTELL_WARN /* Category 1, above. */
  392. # undef ftell
  393. # undef ftello
  394. # if HAVE_RAW_DECL_FTELLO
  395. _GL_WARN_ON_USE (ftello, "ftello is unportable - "
  396. "use gnulib module ftello for portability");
  397. # endif
  398. #endif
  399. #ifdef _GL_FTELL_WARN
  400. # undef _GL_FTELL_WARN
  401. /* Here, either ftell is undefined (but C89 guarantees that it is
  402. declared), or it is defined as rpl_ftell (declared above). */
  403. _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
  404. "on 32-bit platforms - "
  405. "use ftello function for handling of large files");
  406. #endif
  407. #if @GNULIB_FWRITE@
  408. # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
  409. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  410. # undef fwrite
  411. # define fwrite rpl_fwrite
  412. # endif
  413. _GL_FUNCDECL_RPL (fwrite, size_t,
  414. (const void *ptr, size_t s, size_t n, FILE *stream)
  415. _GL_ARG_NONNULL ((1, 4)));
  416. _GL_CXXALIAS_RPL (fwrite, size_t,
  417. (const void *ptr, size_t s, size_t n, FILE *stream));
  418. # else
  419. _GL_CXXALIAS_SYS (fwrite, size_t,
  420. (const void *ptr, size_t s, size_t n, FILE *stream));
  421. # endif
  422. _GL_CXXALIASWARN (fwrite);
  423. #endif
  424. #if @GNULIB_GETDELIM@
  425. /* Read input, up to (and including) the next occurrence of DELIMITER, from
  426. STREAM, store it in *LINEPTR (and NUL-terminate it).
  427. *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
  428. bytes of space. It is realloc'd as necessary.
  429. Return the number of bytes read and stored at *LINEPTR (not including the
  430. NUL terminator), or -1 on error or EOF. */
  431. # if @REPLACE_GETDELIM@
  432. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  433. # undef getdelim
  434. # define getdelim rpl_getdelim
  435. # endif
  436. _GL_FUNCDECL_RPL (getdelim, ssize_t,
  437. (char **lineptr, size_t *linesize, int delimiter,
  438. FILE *stream)
  439. _GL_ARG_NONNULL ((1, 2, 4)));
  440. _GL_CXXALIAS_RPL (getdelim, ssize_t,
  441. (char **lineptr, size_t *linesize, int delimiter,
  442. FILE *stream));
  443. # else
  444. # if !@HAVE_DECL_GETDELIM@
  445. _GL_FUNCDECL_SYS (getdelim, ssize_t,
  446. (char **lineptr, size_t *linesize, int delimiter,
  447. FILE *stream)
  448. _GL_ARG_NONNULL ((1, 2, 4)));
  449. # endif
  450. _GL_CXXALIAS_SYS (getdelim, ssize_t,
  451. (char **lineptr, size_t *linesize, int delimiter,
  452. FILE *stream));
  453. # endif
  454. _GL_CXXALIASWARN (getdelim);
  455. #elif defined GNULIB_POSIXCHECK
  456. # undef getdelim
  457. # if HAVE_RAW_DECL_GETDELIM
  458. _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
  459. "use gnulib module getdelim for portability");
  460. # endif
  461. #endif
  462. #if @GNULIB_GETLINE@
  463. /* Read a line, up to (and including) the next newline, from STREAM, store it
  464. in *LINEPTR (and NUL-terminate it).
  465. *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
  466. bytes of space. It is realloc'd as necessary.
  467. Return the number of bytes read and stored at *LINEPTR (not including the
  468. NUL terminator), or -1 on error or EOF. */
  469. # if @REPLACE_GETLINE@
  470. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  471. # undef getline
  472. # define getline rpl_getline
  473. # endif
  474. _GL_FUNCDECL_RPL (getline, ssize_t,
  475. (char **lineptr, size_t *linesize, FILE *stream)
  476. _GL_ARG_NONNULL ((1, 2, 3)));
  477. _GL_CXXALIAS_RPL (getline, ssize_t,
  478. (char **lineptr, size_t *linesize, FILE *stream));
  479. # else
  480. # if !@HAVE_DECL_GETLINE@
  481. _GL_FUNCDECL_SYS (getline, ssize_t,
  482. (char **lineptr, size_t *linesize, FILE *stream)
  483. _GL_ARG_NONNULL ((1, 2, 3)));
  484. # endif
  485. _GL_CXXALIAS_SYS (getline, ssize_t,
  486. (char **lineptr, size_t *linesize, FILE *stream));
  487. # endif
  488. # if @HAVE_DECL_GETLINE@
  489. _GL_CXXALIASWARN (getline);
  490. # endif
  491. #elif defined GNULIB_POSIXCHECK
  492. # undef getline
  493. # if HAVE_RAW_DECL_GETLINE
  494. _GL_WARN_ON_USE (getline, "getline is unportable - "
  495. "use gnulib module getline for portability");
  496. # endif
  497. #endif
  498. #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
  499. struct obstack;
  500. /* Grow an obstack with formatted output. Return the number of
  501. bytes added to OBS. No trailing nul byte is added, and the
  502. object should be closed with obstack_finish before use. Upon
  503. memory allocation error, call obstack_alloc_failed_handler. Upon
  504. other error, return -1. */
  505. # if @REPLACE_OBSTACK_PRINTF@
  506. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  507. # define obstack_printf rpl_obstack_printf
  508. # endif
  509. _GL_FUNCDECL_RPL (obstack_printf, int,
  510. (struct obstack *obs, const char *format, ...)
  511. __attribute__ ((__format__ (__printf__, 2, 3)))
  512. _GL_ARG_NONNULL ((1, 2)));
  513. _GL_CXXALIAS_RPL (obstack_printf, int,
  514. (struct obstack *obs, const char *format, ...));
  515. # else
  516. # if !@HAVE_DECL_OBSTACK_PRINTF@
  517. _GL_FUNCDECL_SYS (obstack_printf, int,
  518. (struct obstack *obs, const char *format, ...)
  519. __attribute__ ((__format__ (__printf__, 2, 3)))
  520. _GL_ARG_NONNULL ((1, 2)));
  521. # endif
  522. _GL_CXXALIAS_SYS (obstack_printf, int,
  523. (struct obstack *obs, const char *format, ...));
  524. # endif
  525. _GL_CXXALIASWARN (obstack_printf);
  526. # if @REPLACE_OBSTACK_PRINTF@
  527. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  528. # define obstack_vprintf rpl_obstack_vprintf
  529. # endif
  530. _GL_FUNCDECL_RPL (obstack_vprintf, int,
  531. (struct obstack *obs, const char *format, va_list args)
  532. __attribute__ ((__format__ (__printf__, 2, 0)))
  533. _GL_ARG_NONNULL ((1, 2)));
  534. _GL_CXXALIAS_RPL (obstack_vprintf, int,
  535. (struct obstack *obs, const char *format, va_list args));
  536. # else
  537. # if !@HAVE_DECL_OBSTACK_PRINTF@
  538. _GL_FUNCDECL_SYS (obstack_vprintf, int,
  539. (struct obstack *obs, const char *format, va_list args)
  540. __attribute__ ((__format__ (__printf__, 2, 0)))
  541. _GL_ARG_NONNULL ((1, 2)));
  542. # endif
  543. _GL_CXXALIAS_SYS (obstack_vprintf, int,
  544. (struct obstack *obs, const char *format, va_list args));
  545. # endif
  546. _GL_CXXALIASWARN (obstack_vprintf);
  547. #endif
  548. #if @GNULIB_PERROR@
  549. /* Print a message to standard error, describing the value of ERRNO,
  550. (if STRING is not NULL and not empty) prefixed with STRING and ": ",
  551. and terminated with a newline. */
  552. # if @REPLACE_PERROR@
  553. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  554. # define perror rpl_perror
  555. # endif
  556. _GL_FUNCDECL_RPL (perror, void, (const char *string));
  557. _GL_CXXALIAS_RPL (perror, void, (const char *string));
  558. # else
  559. _GL_CXXALIAS_SYS (perror, void, (const char *string));
  560. # endif
  561. _GL_CXXALIASWARN (perror);
  562. #elif defined GNULIB_POSIXCHECK
  563. # undef perror
  564. /* Assume perror is always declared. */
  565. _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
  566. "use gnulib module perror for portability");
  567. #endif
  568. #if @GNULIB_POPEN@
  569. # if @REPLACE_POPEN@
  570. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  571. # undef popen
  572. # define popen rpl_popen
  573. # endif
  574. _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
  575. _GL_ARG_NONNULL ((1, 2)));
  576. _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
  577. # else
  578. _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
  579. # endif
  580. _GL_CXXALIASWARN (popen);
  581. #elif defined GNULIB_POSIXCHECK
  582. # undef popen
  583. # if HAVE_RAW_DECL_POPEN
  584. _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
  585. "use gnulib module popen or pipe for more portability");
  586. # endif
  587. #endif
  588. #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
  589. # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
  590. || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
  591. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  592. /* Don't break __attribute__((format(printf,M,N))). */
  593. # define printf __printf__
  594. # endif
  595. # define GNULIB_overrides_printf 1
  596. _GL_FUNCDECL_RPL_1 (__printf__, int,
  597. (const char *format, ...)
  598. __attribute__ ((__format__ (__printf__, 1, 2)))
  599. _GL_ARG_NONNULL ((1)));
  600. _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
  601. # else
  602. _GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
  603. # endif
  604. _GL_CXXALIASWARN (printf);
  605. #endif
  606. #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
  607. # if !GNULIB_overrides_printf
  608. # undef printf
  609. # endif
  610. /* Assume printf is always declared. */
  611. _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
  612. "use gnulib module printf-posix for portable "
  613. "POSIX compliance");
  614. #endif
  615. #if @GNULIB_PUTC@
  616. # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
  617. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  618. # undef putc
  619. # define putc rpl_fputc
  620. # endif
  621. _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
  622. _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
  623. # else
  624. _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
  625. # endif
  626. _GL_CXXALIASWARN (putc);
  627. #endif
  628. #if @GNULIB_PUTCHAR@
  629. # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
  630. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  631. # undef putchar
  632. # define putchar rpl_putchar
  633. # endif
  634. _GL_FUNCDECL_RPL (putchar, int, (int c));
  635. _GL_CXXALIAS_RPL (putchar, int, (int c));
  636. # else
  637. _GL_CXXALIAS_SYS (putchar, int, (int c));
  638. # endif
  639. _GL_CXXALIASWARN (putchar);
  640. #endif
  641. #if @GNULIB_PUTS@
  642. # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
  643. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  644. # undef puts
  645. # define puts rpl_puts
  646. # endif
  647. _GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
  648. _GL_CXXALIAS_RPL (puts, int, (const char *string));
  649. # else
  650. _GL_CXXALIAS_SYS (puts, int, (const char *string));
  651. # endif
  652. _GL_CXXALIASWARN (puts);
  653. #endif
  654. #if @GNULIB_REMOVE@
  655. # if @REPLACE_REMOVE@
  656. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  657. # undef remove
  658. # define remove rpl_remove
  659. # endif
  660. _GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
  661. _GL_CXXALIAS_RPL (remove, int, (const char *name));
  662. # else
  663. _GL_CXXALIAS_SYS (remove, int, (const char *name));
  664. # endif
  665. _GL_CXXALIASWARN (remove);
  666. #elif defined GNULIB_POSIXCHECK
  667. # undef remove
  668. /* Assume remove is always declared. */
  669. _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
  670. "use gnulib module remove for more portability");
  671. #endif
  672. #if @GNULIB_RENAME@
  673. # if @REPLACE_RENAME@
  674. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  675. # undef rename
  676. # define rename rpl_rename
  677. # endif
  678. _GL_FUNCDECL_RPL (rename, int,
  679. (const char *old_filename, const char *new_filename)
  680. _GL_ARG_NONNULL ((1, 2)));
  681. _GL_CXXALIAS_RPL (rename, int,
  682. (const char *old_filename, const char *new_filename));
  683. # else
  684. _GL_CXXALIAS_SYS (rename, int,
  685. (const char *old_filename, const char *new_filename));
  686. # endif
  687. _GL_CXXALIASWARN (rename);
  688. #elif defined GNULIB_POSIXCHECK
  689. # undef rename
  690. /* Assume rename is always declared. */
  691. _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
  692. "use gnulib module rename for more portability");
  693. #endif
  694. #if @GNULIB_RENAMEAT@
  695. # if @REPLACE_RENAMEAT@
  696. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  697. # undef renameat
  698. # define renameat rpl_renameat
  699. # endif
  700. _GL_FUNCDECL_RPL (renameat, int,
  701. (int fd1, char const *file1, int fd2, char const *file2)
  702. _GL_ARG_NONNULL ((2, 4)));
  703. _GL_CXXALIAS_RPL (renameat, int,
  704. (int fd1, char const *file1, int fd2, char const *file2));
  705. # else
  706. # if !@HAVE_RENAMEAT@
  707. _GL_FUNCDECL_SYS (renameat, int,
  708. (int fd1, char const *file1, int fd2, char const *file2)
  709. _GL_ARG_NONNULL ((2, 4)));
  710. # endif
  711. _GL_CXXALIAS_SYS (renameat, int,
  712. (int fd1, char const *file1, int fd2, char const *file2));
  713. # endif
  714. _GL_CXXALIASWARN (renameat);
  715. #elif defined GNULIB_POSIXCHECK
  716. # undef renameat
  717. # if HAVE_RAW_DECL_RENAMEAT
  718. _GL_WARN_ON_USE (renameat, "renameat is not portable - "
  719. "use gnulib module renameat for portability");
  720. # endif
  721. #endif
  722. #if @GNULIB_SNPRINTF@
  723. # if @REPLACE_SNPRINTF@
  724. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  725. # define snprintf rpl_snprintf
  726. # endif
  727. _GL_FUNCDECL_RPL (snprintf, int,
  728. (char *str, size_t size, const char *format, ...)
  729. __attribute__ ((__format__ (__printf__, 3, 4)))
  730. _GL_ARG_NONNULL ((3)));
  731. _GL_CXXALIAS_RPL (snprintf, int,
  732. (char *str, size_t size, const char *format, ...));
  733. # else
  734. # if !@HAVE_DECL_SNPRINTF@
  735. _GL_FUNCDECL_SYS (snprintf, int,
  736. (char *str, size_t size, const char *format, ...)
  737. __attribute__ ((__format__ (__printf__, 3, 4)))
  738. _GL_ARG_NONNULL ((3)));
  739. # endif
  740. _GL_CXXALIAS_SYS (snprintf, int,
  741. (char *str, size_t size, const char *format, ...));
  742. # endif
  743. _GL_CXXALIASWARN (snprintf);
  744. #elif defined GNULIB_POSIXCHECK
  745. # undef snprintf
  746. # if HAVE_RAW_DECL_SNPRINTF
  747. _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
  748. "use gnulib module snprintf for portability");
  749. # endif
  750. #endif
  751. /* Some people would argue that sprintf should be handled like gets
  752. (for example, OpenBSD issues a link warning for both functions),
  753. since both can cause security holes due to buffer overruns.
  754. However, we believe that sprintf can be used safely, and is more
  755. efficient than snprintf in those safe cases; and as proof of our
  756. belief, we use sprintf in several gnulib modules. So this header
  757. intentionally avoids adding a warning to sprintf except when
  758. GNULIB_POSIXCHECK is defined. */
  759. #if @GNULIB_SPRINTF_POSIX@
  760. # if @REPLACE_SPRINTF@
  761. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  762. # define sprintf rpl_sprintf
  763. # endif
  764. _GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...)
  765. __attribute__ ((__format__ (__printf__, 2, 3)))
  766. _GL_ARG_NONNULL ((1, 2)));
  767. _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
  768. # else
  769. _GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
  770. # endif
  771. _GL_CXXALIASWARN (sprintf);
  772. #elif defined GNULIB_POSIXCHECK
  773. # undef sprintf
  774. /* Assume sprintf is always declared. */
  775. _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
  776. "use gnulib module sprintf-posix for portable "
  777. "POSIX compliance");
  778. #endif
  779. #if @GNULIB_TMPFILE@
  780. # if @REPLACE_TMPFILE@
  781. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  782. # define tmpfile rpl_tmpfile
  783. # endif
  784. _GL_FUNCDECL_RPL (tmpfile, FILE *, (void));
  785. _GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
  786. # else
  787. _GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
  788. # endif
  789. _GL_CXXALIASWARN (tmpfile);
  790. #elif defined GNULIB_POSIXCHECK
  791. # undef tmpfile
  792. # if HAVE_RAW_DECL_TMPFILE
  793. _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
  794. "use gnulib module tmpfile for portability");
  795. # endif
  796. #endif
  797. #if @GNULIB_VASPRINTF@
  798. /* Write formatted output to a string dynamically allocated with malloc().
  799. If the memory allocation succeeds, store the address of the string in
  800. *RESULT and return the number of resulting bytes, excluding the trailing
  801. NUL. Upon memory allocation error, or some other error, return -1. */
  802. # if @REPLACE_VASPRINTF@
  803. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  804. # define asprintf rpl_asprintf
  805. # endif
  806. _GL_FUNCDECL_RPL (asprintf, int,
  807. (char **result, const char *format, ...)
  808. __attribute__ ((__format__ (__printf__, 2, 3)))
  809. _GL_ARG_NONNULL ((1, 2)));
  810. _GL_CXXALIAS_RPL (asprintf, int,
  811. (char **result, const char *format, ...));
  812. # else
  813. # if !@HAVE_VASPRINTF@
  814. _GL_FUNCDECL_SYS (asprintf, int,
  815. (char **result, const char *format, ...)
  816. __attribute__ ((__format__ (__printf__, 2, 3)))
  817. _GL_ARG_NONNULL ((1, 2)));
  818. # endif
  819. _GL_CXXALIAS_SYS (asprintf, int,
  820. (char **result, const char *format, ...));
  821. # endif
  822. _GL_CXXALIASWARN (asprintf);
  823. # if @REPLACE_VASPRINTF@
  824. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  825. # define vasprintf rpl_vasprintf
  826. # endif
  827. _GL_FUNCDECL_RPL (vasprintf, int,
  828. (char **result, const char *format, va_list args)
  829. __attribute__ ((__format__ (__printf__, 2, 0)))
  830. _GL_ARG_NONNULL ((1, 2)));
  831. _GL_CXXALIAS_RPL (vasprintf, int,
  832. (char **result, const char *format, va_list args));
  833. # else
  834. # if !@HAVE_VASPRINTF@
  835. _GL_FUNCDECL_SYS (vasprintf, int,
  836. (char **result, const char *format, va_list args)
  837. __attribute__ ((__format__ (__printf__, 2, 0)))
  838. _GL_ARG_NONNULL ((1, 2)));
  839. # endif
  840. _GL_CXXALIAS_SYS (vasprintf, int,
  841. (char **result, const char *format, va_list args));
  842. # endif
  843. _GL_CXXALIASWARN (vasprintf);
  844. #endif
  845. #if @GNULIB_VDPRINTF@
  846. # if @REPLACE_VDPRINTF@
  847. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  848. # define vdprintf rpl_vdprintf
  849. # endif
  850. _GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args)
  851. __attribute__ ((__format__ (__printf__, 2, 0)))
  852. _GL_ARG_NONNULL ((2)));
  853. _GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args));
  854. # else
  855. # if !@HAVE_VDPRINTF@
  856. _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args)
  857. __attribute__ ((__format__ (__printf__, 2, 0)))
  858. _GL_ARG_NONNULL ((2)));
  859. # endif
  860. /* Need to cast, because on Solaris, the third parameter will likely be
  861. __va_list args. */
  862. _GL_CXXALIAS_SYS_CAST (vdprintf, int,
  863. (int fd, const char *format, va_list args));
  864. # endif
  865. _GL_CXXALIASWARN (vdprintf);
  866. #elif defined GNULIB_POSIXCHECK
  867. # undef vdprintf
  868. # if HAVE_RAW_DECL_VDPRINTF
  869. _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
  870. "use gnulib module vdprintf for portability");
  871. # endif
  872. #endif
  873. #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
  874. # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
  875. || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
  876. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  877. # define vfprintf rpl_vfprintf
  878. # endif
  879. # define GNULIB_overrides_vfprintf 1
  880. _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
  881. __attribute__ ((__format__ (__printf__, 2, 0)))
  882. _GL_ARG_NONNULL ((1, 2)));
  883. _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
  884. # else
  885. /* Need to cast, because on Solaris, the third parameter is
  886. __va_list args
  887. and GCC's fixincludes did not change this to __gnuc_va_list. */
  888. _GL_CXXALIAS_SYS_CAST (vfprintf, int,
  889. (FILE *fp, const char *format, va_list args));
  890. # endif
  891. _GL_CXXALIASWARN (vfprintf);
  892. #endif
  893. #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
  894. # if !GNULIB_overrides_vfprintf
  895. # undef vfprintf
  896. # endif
  897. /* Assume vfprintf is always declared. */
  898. _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
  899. "use gnulib module vfprintf-posix for portable "
  900. "POSIX compliance");
  901. #endif
  902. #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
  903. # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
  904. || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
  905. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  906. # define vprintf rpl_vprintf
  907. # endif
  908. # define GNULIB_overrides_vprintf 1
  909. _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
  910. __attribute__ ((__format__ (__printf__, 1, 0)))
  911. _GL_ARG_NONNULL ((1)));
  912. _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
  913. # else
  914. /* Need to cast, because on Solaris, the second parameter is
  915. __va_list args
  916. and GCC's fixincludes did not change this to __gnuc_va_list. */
  917. _GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
  918. # endif
  919. _GL_CXXALIASWARN (vprintf);
  920. #endif
  921. #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
  922. # if !GNULIB_overrides_vprintf
  923. # undef vprintf
  924. # endif
  925. /* Assume vprintf is always declared. */
  926. _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
  927. "use gnulib module vprintf-posix for portable "
  928. "POSIX compliance");
  929. #endif
  930. #if @GNULIB_VSNPRINTF@
  931. # if @REPLACE_VSNPRINTF@
  932. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  933. # define vsnprintf rpl_vsnprintf
  934. # endif
  935. _GL_FUNCDECL_RPL (vsnprintf, int,
  936. (char *str, size_t size, const char *format, va_list args)
  937. __attribute__ ((__format__ (__printf__, 3, 0)))
  938. _GL_ARG_NONNULL ((3)));
  939. _GL_CXXALIAS_RPL (vsnprintf, int,
  940. (char *str, size_t size, const char *format, va_list args));
  941. # else
  942. # if !@HAVE_DECL_VSNPRINTF@
  943. _GL_FUNCDECL_SYS (vsnprintf, int,
  944. (char *str, size_t size, const char *format, va_list args)
  945. __attribute__ ((__format__ (__printf__, 3, 0)))
  946. _GL_ARG_NONNULL ((3)));
  947. # endif
  948. _GL_CXXALIAS_SYS (vsnprintf, int,
  949. (char *str, size_t size, const char *format, va_list args));
  950. # endif
  951. _GL_CXXALIASWARN (vsnprintf);
  952. #elif defined GNULIB_POSIXCHECK
  953. # undef vsnprintf
  954. # if HAVE_RAW_DECL_VSNPRINTF
  955. _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
  956. "use gnulib module vsnprintf for portability");
  957. # endif
  958. #endif
  959. #if @GNULIB_VSPRINTF_POSIX@
  960. # if @REPLACE_VSPRINTF@
  961. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  962. # define vsprintf rpl_vsprintf
  963. # endif
  964. _GL_FUNCDECL_RPL (vsprintf, int,
  965. (char *str, const char *format, va_list args)
  966. __attribute__ ((__format__ (__printf__, 2, 0)))
  967. _GL_ARG_NONNULL ((1, 2)));
  968. _GL_CXXALIAS_RPL (vsprintf, int,
  969. (char *str, const char *format, va_list args));
  970. # else
  971. /* Need to cast, because on Solaris, the third parameter is
  972. __va_list args
  973. and GCC's fixincludes did not change this to __gnuc_va_list. */
  974. _GL_CXXALIAS_SYS_CAST (vsprintf, int,
  975. (char *str, const char *format, va_list args));
  976. # endif
  977. _GL_CXXALIASWARN (vsprintf);
  978. #elif defined GNULIB_POSIXCHECK
  979. # undef vsprintf
  980. /* Assume vsprintf is always declared. */
  981. _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
  982. "use gnulib module vsprintf-posix for portable "
  983. "POSIX compliance");
  984. #endif
  985. #endif /* _GL_STDIO_H */
  986. #endif /* _GL_STDIO_H */
  987. #endif