stdio.in.h 38 KB

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