stdio.in.h 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378
  1. /* A GNU-like <stdio.h>.
  2. Copyright (C) 2004, 2007-2017 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, see <http://www.gnu.org/licenses/>. */
  13. #if __GNUC__ >= 3
  14. @PRAGMA_SYSTEM_HEADER@
  15. #endif
  16. @PRAGMA_COLUMNS@
  17. #if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H
  18. /* Special invocation convention:
  19. - Inside glibc header files.
  20. - On OSF/1 5.1 we have a sequence of nested includes
  21. <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> ->
  22. <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>.
  23. In this situation, the functions are not yet declared, therefore we cannot
  24. provide the C++ aliases. */
  25. #@INCLUDE_NEXT@ @NEXT_STDIO_H@
  26. #else
  27. /* Normal invocation convention. */
  28. #ifndef _@GUARD_PREFIX@_STDIO_H
  29. #define _GL_ALREADY_INCLUDING_STDIO_H
  30. /* The include_next requires a split double-inclusion guard. */
  31. #@INCLUDE_NEXT@ @NEXT_STDIO_H@
  32. #undef _GL_ALREADY_INCLUDING_STDIO_H
  33. #ifndef _@GUARD_PREFIX@_STDIO_H
  34. #define _@GUARD_PREFIX@_STDIO_H
  35. /* Get va_list. Needed on many systems, including glibc 2.8. */
  36. #include <stdarg.h>
  37. #include <stddef.h>
  38. /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8
  39. and eglibc 2.11.2.
  40. May also define off_t to a 64-bit type on native Windows. */
  41. #include <sys/types.h>
  42. /* The __attribute__ feature is available in gcc versions 2.5 and later.
  43. The __-protected variants of the attributes 'format' and 'printf' are
  44. accepted by gcc versions 2.6.4 (effectively 2.7) and later.
  45. We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
  46. gnulib and libintl do '#define printf __printf__' when they override
  47. the 'printf' function. */
  48. #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
  49. # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
  50. #else
  51. # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
  52. #endif
  53. /* _GL_ATTRIBUTE_FORMAT_PRINTF
  54. indicates to GCC that the function takes a format string and arguments,
  55. where the format string directives are the ones standardized by ISO C99
  56. and POSIX. */
  57. #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
  58. # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
  59. _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
  60. #else
  61. # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
  62. _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
  63. #endif
  64. /* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF,
  65. except that it indicates to GCC that the supported format string directives
  66. are the ones of the system printf(), rather than the ones standardized by
  67. ISO C99 and POSIX. */
  68. #if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
  69. # define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
  70. _GL_ATTRIBUTE_FORMAT_PRINTF (formatstring_parameter, first_argument)
  71. #else
  72. # define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
  73. _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
  74. #endif
  75. /* _GL_ATTRIBUTE_FORMAT_SCANF
  76. indicates to GCC that the function takes a format string and arguments,
  77. where the format string directives are the ones standardized by ISO C99
  78. and POSIX. */
  79. #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
  80. # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
  81. _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument))
  82. #else
  83. # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
  84. _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
  85. #endif
  86. /* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF,
  87. except that it indicates to GCC that the supported format string directives
  88. are the ones of the system scanf(), rather than the ones standardized by
  89. ISO C99 and POSIX. */
  90. #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
  91. _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
  92. /* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */
  93. /* But in any case avoid namespace pollution on glibc systems. */
  94. #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \
  95. && ! defined __GLIBC__
  96. # include <unistd.h>
  97. #endif
  98. /* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>. We must include
  99. it before we #define perror rpl_perror. */
  100. /* But in any case avoid namespace pollution on glibc systems. */
  101. #if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \
  102. && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
  103. && ! defined __GLIBC__
  104. # include <stdlib.h>
  105. #endif
  106. /* MSVC declares 'remove' in <io.h>, not in <stdio.h>. We must include
  107. it before we #define remove rpl_remove. */
  108. /* MSVC declares 'rename' in <io.h>, not in <stdio.h>. We must include
  109. it before we #define rename rpl_rename. */
  110. /* But in any case avoid namespace pollution on glibc systems. */
  111. #if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \
  112. && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
  113. && ! defined __GLIBC__
  114. # include <io.h>
  115. #endif
  116. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  117. /* The definition of _GL_ARG_NONNULL is copied here. */
  118. /* The definition of _GL_WARN_ON_USE is copied here. */
  119. /* Macros for stringification. */
  120. #define _GL_STDIO_STRINGIZE(token) #token
  121. #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
  122. /* When also using extern inline, suppress the use of static inline in
  123. standard headers of problematic Apple configurations, as Libc at
  124. least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
  125. <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
  126. Perhaps Apple will fix this some day. */
  127. #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
  128. && defined __GNUC__ && defined __STDC__)
  129. # undef putc_unlocked
  130. #endif
  131. #if @GNULIB_DPRINTF@
  132. # if @REPLACE_DPRINTF@
  133. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  134. # define dprintf rpl_dprintf
  135. # endif
  136. _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...)
  137. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
  138. _GL_ARG_NONNULL ((2)));
  139. _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...));
  140. # else
  141. # if !@HAVE_DPRINTF@
  142. _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...)
  143. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
  144. _GL_ARG_NONNULL ((2)));
  145. # endif
  146. _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...));
  147. # endif
  148. _GL_CXXALIASWARN (dprintf);
  149. #elif defined GNULIB_POSIXCHECK
  150. # undef dprintf
  151. # if HAVE_RAW_DECL_DPRINTF
  152. _GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
  153. "use gnulib module dprintf for portability");
  154. # endif
  155. #endif
  156. #if @GNULIB_FCLOSE@
  157. /* Close STREAM and its underlying file descriptor. */
  158. # if @REPLACE_FCLOSE@
  159. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  160. # define fclose rpl_fclose
  161. # endif
  162. _GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
  163. _GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
  164. # else
  165. _GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
  166. # endif
  167. _GL_CXXALIASWARN (fclose);
  168. #elif defined GNULIB_POSIXCHECK
  169. # undef fclose
  170. /* Assume fclose is always declared. */
  171. _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
  172. "use gnulib module fclose for portable POSIX compliance");
  173. #endif
  174. #if @GNULIB_FDOPEN@
  175. # if @REPLACE_FDOPEN@
  176. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  177. # undef fdopen
  178. # define fdopen rpl_fdopen
  179. # endif
  180. _GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode)
  181. _GL_ARG_NONNULL ((2)));
  182. _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
  183. # else
  184. _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
  185. # endif
  186. _GL_CXXALIASWARN (fdopen);
  187. #elif defined GNULIB_POSIXCHECK
  188. # undef fdopen
  189. /* Assume fdopen is always declared. */
  190. _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
  191. "use gnulib module fdopen for portability");
  192. #endif
  193. #if @GNULIB_FFLUSH@
  194. /* Flush all pending data on STREAM according to POSIX rules. Both
  195. output and seekable input streams are supported.
  196. Note! LOSS OF DATA can occur if fflush is applied on an input stream
  197. that is _not_seekable_ or on an update stream that is _not_seekable_
  198. and in which the most recent operation was input. Seekability can
  199. be tested with lseek(fileno(fp),0,SEEK_CUR). */
  200. # if @REPLACE_FFLUSH@
  201. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  202. # define fflush rpl_fflush
  203. # endif
  204. _GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
  205. _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
  206. # else
  207. _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
  208. # endif
  209. _GL_CXXALIASWARN (fflush);
  210. #elif defined GNULIB_POSIXCHECK
  211. # undef fflush
  212. /* Assume fflush is always declared. */
  213. _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
  214. "use gnulib module fflush for portable POSIX compliance");
  215. #endif
  216. #if @GNULIB_FGETC@
  217. # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
  218. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  219. # undef fgetc
  220. # define fgetc rpl_fgetc
  221. # endif
  222. _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
  223. _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
  224. # else
  225. _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
  226. # endif
  227. _GL_CXXALIASWARN (fgetc);
  228. #endif
  229. #if @GNULIB_FGETS@
  230. # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
  231. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  232. # undef fgets
  233. # define fgets rpl_fgets
  234. # endif
  235. _GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream)
  236. _GL_ARG_NONNULL ((1, 3)));
  237. _GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream));
  238. # else
  239. _GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream));
  240. # endif
  241. _GL_CXXALIASWARN (fgets);
  242. #endif
  243. #if @GNULIB_FOPEN@
  244. # if @REPLACE_FOPEN@
  245. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  246. # undef fopen
  247. # define fopen rpl_fopen
  248. # endif
  249. _GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode)
  250. _GL_ARG_NONNULL ((1, 2)));
  251. _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
  252. # else
  253. _GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
  254. # endif
  255. _GL_CXXALIASWARN (fopen);
  256. #elif defined GNULIB_POSIXCHECK
  257. # undef fopen
  258. /* Assume fopen is always declared. */
  259. _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - "
  260. "use gnulib module fopen for portability");
  261. #endif
  262. #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
  263. # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
  264. || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
  265. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  266. # define fprintf rpl_fprintf
  267. # endif
  268. # define GNULIB_overrides_fprintf 1
  269. # if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
  270. _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
  271. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
  272. _GL_ARG_NONNULL ((1, 2)));
  273. # else
  274. _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
  275. _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
  276. _GL_ARG_NONNULL ((1, 2)));
  277. # endif
  278. _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
  279. # else
  280. _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
  281. # endif
  282. _GL_CXXALIASWARN (fprintf);
  283. #endif
  284. #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
  285. # if !GNULIB_overrides_fprintf
  286. # undef fprintf
  287. # endif
  288. /* Assume fprintf is always declared. */
  289. _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
  290. "use gnulib module fprintf-posix for portable "
  291. "POSIX compliance");
  292. #endif
  293. #if @GNULIB_FPURGE@
  294. /* Discard all pending buffered I/O data on STREAM.
  295. STREAM must not be wide-character oriented.
  296. When discarding pending output, the file position is set back to where it
  297. was before the write calls. When discarding pending input, the file
  298. position is advanced to match the end of the previously read input.
  299. Return 0 if successful. Upon error, return -1 and set errno. */
  300. # if @REPLACE_FPURGE@
  301. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  302. # define fpurge rpl_fpurge
  303. # endif
  304. _GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
  305. _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
  306. # else
  307. # if !@HAVE_DECL_FPURGE@
  308. _GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
  309. # endif
  310. _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
  311. # endif
  312. _GL_CXXALIASWARN (fpurge);
  313. #elif defined GNULIB_POSIXCHECK
  314. # undef fpurge
  315. # if HAVE_RAW_DECL_FPURGE
  316. _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
  317. "use gnulib module fpurge for portability");
  318. # endif
  319. #endif
  320. #if @GNULIB_FPUTC@
  321. # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
  322. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  323. # undef fputc
  324. # define fputc rpl_fputc
  325. # endif
  326. _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
  327. _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
  328. # else
  329. _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
  330. # endif
  331. _GL_CXXALIASWARN (fputc);
  332. #endif
  333. #if @GNULIB_FPUTS@
  334. # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
  335. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  336. # undef fputs
  337. # define fputs rpl_fputs
  338. # endif
  339. _GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream)
  340. _GL_ARG_NONNULL ((1, 2)));
  341. _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
  342. # else
  343. _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
  344. # endif
  345. _GL_CXXALIASWARN (fputs);
  346. #endif
  347. #if @GNULIB_FREAD@
  348. # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
  349. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  350. # undef fread
  351. # define fread rpl_fread
  352. # endif
  353. _GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)
  354. _GL_ARG_NONNULL ((4)));
  355. _GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
  356. # else
  357. _GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
  358. # endif
  359. _GL_CXXALIASWARN (fread);
  360. #endif
  361. #if @GNULIB_FREOPEN@
  362. # if @REPLACE_FREOPEN@
  363. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  364. # undef freopen
  365. # define freopen rpl_freopen
  366. # endif
  367. _GL_FUNCDECL_RPL (freopen, FILE *,
  368. (const char *filename, const char *mode, FILE *stream)
  369. _GL_ARG_NONNULL ((2, 3)));
  370. _GL_CXXALIAS_RPL (freopen, FILE *,
  371. (const char *filename, const char *mode, FILE *stream));
  372. # else
  373. _GL_CXXALIAS_SYS (freopen, FILE *,
  374. (const char *filename, const char *mode, FILE *stream));
  375. # endif
  376. _GL_CXXALIASWARN (freopen);
  377. #elif defined GNULIB_POSIXCHECK
  378. # undef freopen
  379. /* Assume freopen is always declared. */
  380. _GL_WARN_ON_USE (freopen,
  381. "freopen on native Windows platforms is not POSIX compliant - "
  382. "use gnulib module freopen for portability");
  383. #endif
  384. #if @GNULIB_FSCANF@
  385. # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
  386. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  387. # undef fscanf
  388. # define fscanf rpl_fscanf
  389. # endif
  390. _GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...)
  391. _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
  392. _GL_ARG_NONNULL ((1, 2)));
  393. _GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...));
  394. # else
  395. _GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...));
  396. # endif
  397. _GL_CXXALIASWARN (fscanf);
  398. #endif
  399. /* Set up the following warnings, based on which modules are in use.
  400. GNU Coding Standards discourage the use of fseek, since it imposes
  401. an arbitrary limitation on some 32-bit hosts. Remember that the
  402. fseek module depends on the fseeko module, so we only have three
  403. cases to consider:
  404. 1. The developer is not using either module. Issue a warning under
  405. GNULIB_POSIXCHECK for both functions, to remind them that both
  406. functions have bugs on some systems. _GL_NO_LARGE_FILES has no
  407. impact on this warning.
  408. 2. The developer is using both modules. They may be unaware of the
  409. arbitrary limitations of fseek, so issue a warning under
  410. GNULIB_POSIXCHECK. On the other hand, they may be using both
  411. modules intentionally, so the developer can define
  412. _GL_NO_LARGE_FILES in the compilation units where the use of fseek
  413. is safe, to silence the warning.
  414. 3. The developer is using the fseeko module, but not fseek. Gnulib
  415. guarantees that fseek will still work around platform bugs in that
  416. case, but we presume that the developer is aware of the pitfalls of
  417. fseek and was trying to avoid it, so issue a warning even when
  418. GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be
  419. defined to silence the warning in particular compilation units.
  420. In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
  421. fseek gets defined as a macro, it is recommended that the developer
  422. uses the fseek module, even if he is not calling the fseek function.
  423. Most gnulib clients that perform stream operations should fall into
  424. category 3. */
  425. #if @GNULIB_FSEEK@
  426. # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
  427. # define _GL_FSEEK_WARN /* Category 2, above. */
  428. # undef fseek
  429. # endif
  430. # if @REPLACE_FSEEK@
  431. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  432. # undef fseek
  433. # define fseek rpl_fseek
  434. # endif
  435. _GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
  436. _GL_ARG_NONNULL ((1)));
  437. _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
  438. # else
  439. _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
  440. # endif
  441. _GL_CXXALIASWARN (fseek);
  442. #endif
  443. #if @GNULIB_FSEEKO@
  444. # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
  445. # define _GL_FSEEK_WARN /* Category 3, above. */
  446. # undef fseek
  447. # endif
  448. # if @REPLACE_FSEEKO@
  449. /* Provide an fseeko function that is aware of a preceding fflush(), and which
  450. detects pipes. */
  451. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  452. # undef fseeko
  453. # define fseeko rpl_fseeko
  454. # endif
  455. _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
  456. _GL_ARG_NONNULL ((1)));
  457. _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
  458. # else
  459. # if ! @HAVE_DECL_FSEEKO@
  460. _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
  461. _GL_ARG_NONNULL ((1)));
  462. # endif
  463. _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
  464. # endif
  465. _GL_CXXALIASWARN (fseeko);
  466. #elif defined GNULIB_POSIXCHECK
  467. # define _GL_FSEEK_WARN /* Category 1, above. */
  468. # undef fseek
  469. # undef fseeko
  470. # if HAVE_RAW_DECL_FSEEKO
  471. _GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
  472. "use gnulib module fseeko for portability");
  473. # endif
  474. #endif
  475. #ifdef _GL_FSEEK_WARN
  476. # undef _GL_FSEEK_WARN
  477. /* Here, either fseek is undefined (but C89 guarantees that it is
  478. declared), or it is defined as rpl_fseek (declared above). */
  479. _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
  480. "on 32-bit platforms - "
  481. "use fseeko function for handling of large files");
  482. #endif
  483. /* ftell, ftello. See the comments on fseek/fseeko. */
  484. #if @GNULIB_FTELL@
  485. # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
  486. # define _GL_FTELL_WARN /* Category 2, above. */
  487. # undef ftell
  488. # endif
  489. # if @REPLACE_FTELL@
  490. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  491. # undef ftell
  492. # define ftell rpl_ftell
  493. # endif
  494. _GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
  495. _GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
  496. # else
  497. _GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
  498. # endif
  499. _GL_CXXALIASWARN (ftell);
  500. #endif
  501. #if @GNULIB_FTELLO@
  502. # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
  503. # define _GL_FTELL_WARN /* Category 3, above. */
  504. # undef ftell
  505. # endif
  506. # if @REPLACE_FTELLO@
  507. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  508. # undef ftello
  509. # define ftello rpl_ftello
  510. # endif
  511. _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
  512. _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
  513. # else
  514. # if ! @HAVE_DECL_FTELLO@
  515. _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
  516. # endif
  517. _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
  518. # endif
  519. _GL_CXXALIASWARN (ftello);
  520. #elif defined GNULIB_POSIXCHECK
  521. # define _GL_FTELL_WARN /* Category 1, above. */
  522. # undef ftell
  523. # undef ftello
  524. # if HAVE_RAW_DECL_FTELLO
  525. _GL_WARN_ON_USE (ftello, "ftello is unportable - "
  526. "use gnulib module ftello for portability");
  527. # endif
  528. #endif
  529. #ifdef _GL_FTELL_WARN
  530. # undef _GL_FTELL_WARN
  531. /* Here, either ftell is undefined (but C89 guarantees that it is
  532. declared), or it is defined as rpl_ftell (declared above). */
  533. _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
  534. "on 32-bit platforms - "
  535. "use ftello function for handling of large files");
  536. #endif
  537. #if @GNULIB_FWRITE@
  538. # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
  539. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  540. # undef fwrite
  541. # define fwrite rpl_fwrite
  542. # endif
  543. _GL_FUNCDECL_RPL (fwrite, size_t,
  544. (const void *ptr, size_t s, size_t n, FILE *stream)
  545. _GL_ARG_NONNULL ((1, 4)));
  546. _GL_CXXALIAS_RPL (fwrite, size_t,
  547. (const void *ptr, size_t s, size_t n, FILE *stream));
  548. # else
  549. _GL_CXXALIAS_SYS (fwrite, size_t,
  550. (const void *ptr, size_t s, size_t n, FILE *stream));
  551. /* Work around bug 11959 when fortifying glibc 2.4 through 2.15
  552. <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
  553. which sometimes causes an unwanted diagnostic for fwrite calls.
  554. This affects only function declaration attributes under certain
  555. versions of gcc and clang, and is not needed for C++. */
  556. # if (0 < __USE_FORTIFY_LEVEL \
  557. && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
  558. && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \
  559. && !defined __cplusplus)
  560. # undef fwrite
  561. # undef fwrite_unlocked
  562. extern size_t __REDIRECT (rpl_fwrite,
  563. (const void *__restrict, size_t, size_t,
  564. FILE *__restrict),
  565. fwrite);
  566. extern size_t __REDIRECT (rpl_fwrite_unlocked,
  567. (const void *__restrict, size_t, size_t,
  568. FILE *__restrict),
  569. fwrite_unlocked);
  570. # define fwrite rpl_fwrite
  571. # define fwrite_unlocked rpl_fwrite_unlocked
  572. # endif
  573. # endif
  574. _GL_CXXALIASWARN (fwrite);
  575. #endif
  576. #if @GNULIB_GETC@
  577. # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
  578. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  579. # undef getc
  580. # define getc rpl_fgetc
  581. # endif
  582. _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
  583. _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
  584. # else
  585. _GL_CXXALIAS_SYS (getc, int, (FILE *stream));
  586. # endif
  587. _GL_CXXALIASWARN (getc);
  588. #endif
  589. #if @GNULIB_GETCHAR@
  590. # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
  591. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  592. # undef getchar
  593. # define getchar rpl_getchar
  594. # endif
  595. _GL_FUNCDECL_RPL (getchar, int, (void));
  596. _GL_CXXALIAS_RPL (getchar, int, (void));
  597. # else
  598. _GL_CXXALIAS_SYS (getchar, int, (void));
  599. # endif
  600. _GL_CXXALIASWARN (getchar);
  601. #endif
  602. #if @GNULIB_GETDELIM@
  603. /* Read input, up to (and including) the next occurrence of DELIMITER, from
  604. STREAM, store it in *LINEPTR (and NUL-terminate it).
  605. *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
  606. bytes of space. It is realloc'd as necessary.
  607. Return the number of bytes read and stored at *LINEPTR (not including the
  608. NUL terminator), or -1 on error or EOF. */
  609. # if @REPLACE_GETDELIM@
  610. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  611. # undef getdelim
  612. # define getdelim rpl_getdelim
  613. # endif
  614. _GL_FUNCDECL_RPL (getdelim, ssize_t,
  615. (char **lineptr, size_t *linesize, int delimiter,
  616. FILE *stream)
  617. _GL_ARG_NONNULL ((1, 2, 4)));
  618. _GL_CXXALIAS_RPL (getdelim, ssize_t,
  619. (char **lineptr, size_t *linesize, int delimiter,
  620. FILE *stream));
  621. # else
  622. # if !@HAVE_DECL_GETDELIM@
  623. _GL_FUNCDECL_SYS (getdelim, ssize_t,
  624. (char **lineptr, size_t *linesize, int delimiter,
  625. FILE *stream)
  626. _GL_ARG_NONNULL ((1, 2, 4)));
  627. # endif
  628. _GL_CXXALIAS_SYS (getdelim, ssize_t,
  629. (char **lineptr, size_t *linesize, int delimiter,
  630. FILE *stream));
  631. # endif
  632. _GL_CXXALIASWARN (getdelim);
  633. #elif defined GNULIB_POSIXCHECK
  634. # undef getdelim
  635. # if HAVE_RAW_DECL_GETDELIM
  636. _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
  637. "use gnulib module getdelim for portability");
  638. # endif
  639. #endif
  640. #if @GNULIB_GETLINE@
  641. /* Read a line, up to (and including) the next newline, from STREAM, store it
  642. in *LINEPTR (and NUL-terminate it).
  643. *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
  644. bytes of space. It is realloc'd as necessary.
  645. Return the number of bytes read and stored at *LINEPTR (not including the
  646. NUL terminator), or -1 on error or EOF. */
  647. # if @REPLACE_GETLINE@
  648. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  649. # undef getline
  650. # define getline rpl_getline
  651. # endif
  652. _GL_FUNCDECL_RPL (getline, ssize_t,
  653. (char **lineptr, size_t *linesize, FILE *stream)
  654. _GL_ARG_NONNULL ((1, 2, 3)));
  655. _GL_CXXALIAS_RPL (getline, ssize_t,
  656. (char **lineptr, size_t *linesize, FILE *stream));
  657. # else
  658. # if !@HAVE_DECL_GETLINE@
  659. _GL_FUNCDECL_SYS (getline, ssize_t,
  660. (char **lineptr, size_t *linesize, FILE *stream)
  661. _GL_ARG_NONNULL ((1, 2, 3)));
  662. # endif
  663. _GL_CXXALIAS_SYS (getline, ssize_t,
  664. (char **lineptr, size_t *linesize, FILE *stream));
  665. # endif
  666. # if @HAVE_DECL_GETLINE@
  667. _GL_CXXALIASWARN (getline);
  668. # endif
  669. #elif defined GNULIB_POSIXCHECK
  670. # undef getline
  671. # if HAVE_RAW_DECL_GETLINE
  672. _GL_WARN_ON_USE (getline, "getline is unportable - "
  673. "use gnulib module getline for portability");
  674. # endif
  675. #endif
  676. /* It is very rare that the developer ever has full control of stdin,
  677. so any use of gets warrants an unconditional warning; besides, C11
  678. removed it. */
  679. #undef gets
  680. #if HAVE_RAW_DECL_GETS && !defined __cplusplus
  681. _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
  682. #endif
  683. #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
  684. struct obstack;
  685. /* Grow an obstack with formatted output. Return the number of
  686. bytes added to OBS. No trailing nul byte is added, and the
  687. object should be closed with obstack_finish before use. Upon
  688. memory allocation error, call obstack_alloc_failed_handler. Upon
  689. other error, return -1. */
  690. # if @REPLACE_OBSTACK_PRINTF@
  691. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  692. # define obstack_printf rpl_obstack_printf
  693. # endif
  694. _GL_FUNCDECL_RPL (obstack_printf, int,
  695. (struct obstack *obs, const char *format, ...)
  696. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
  697. _GL_ARG_NONNULL ((1, 2)));
  698. _GL_CXXALIAS_RPL (obstack_printf, int,
  699. (struct obstack *obs, const char *format, ...));
  700. # else
  701. # if !@HAVE_DECL_OBSTACK_PRINTF@
  702. _GL_FUNCDECL_SYS (obstack_printf, int,
  703. (struct obstack *obs, const char *format, ...)
  704. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
  705. _GL_ARG_NONNULL ((1, 2)));
  706. # endif
  707. _GL_CXXALIAS_SYS (obstack_printf, int,
  708. (struct obstack *obs, const char *format, ...));
  709. # endif
  710. _GL_CXXALIASWARN (obstack_printf);
  711. # if @REPLACE_OBSTACK_PRINTF@
  712. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  713. # define obstack_vprintf rpl_obstack_vprintf
  714. # endif
  715. _GL_FUNCDECL_RPL (obstack_vprintf, int,
  716. (struct obstack *obs, const char *format, va_list args)
  717. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
  718. _GL_ARG_NONNULL ((1, 2)));
  719. _GL_CXXALIAS_RPL (obstack_vprintf, int,
  720. (struct obstack *obs, const char *format, va_list args));
  721. # else
  722. # if !@HAVE_DECL_OBSTACK_PRINTF@
  723. _GL_FUNCDECL_SYS (obstack_vprintf, int,
  724. (struct obstack *obs, const char *format, va_list args)
  725. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
  726. _GL_ARG_NONNULL ((1, 2)));
  727. # endif
  728. _GL_CXXALIAS_SYS (obstack_vprintf, int,
  729. (struct obstack *obs, const char *format, va_list args));
  730. # endif
  731. _GL_CXXALIASWARN (obstack_vprintf);
  732. #endif
  733. #if @GNULIB_PCLOSE@
  734. # if !@HAVE_PCLOSE@
  735. _GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
  736. # endif
  737. _GL_CXXALIAS_SYS (pclose, int, (FILE *stream));
  738. _GL_CXXALIASWARN (pclose);
  739. #elif defined GNULIB_POSIXCHECK
  740. # undef pclose
  741. # if HAVE_RAW_DECL_PCLOSE
  742. _GL_WARN_ON_USE (pclose, "pclose is unportable - "
  743. "use gnulib module pclose for more portability");
  744. # endif
  745. #endif
  746. #if @GNULIB_PERROR@
  747. /* Print a message to standard error, describing the value of ERRNO,
  748. (if STRING is not NULL and not empty) prefixed with STRING and ": ",
  749. and terminated with a newline. */
  750. # if @REPLACE_PERROR@
  751. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  752. # define perror rpl_perror
  753. # endif
  754. _GL_FUNCDECL_RPL (perror, void, (const char *string));
  755. _GL_CXXALIAS_RPL (perror, void, (const char *string));
  756. # else
  757. _GL_CXXALIAS_SYS (perror, void, (const char *string));
  758. # endif
  759. _GL_CXXALIASWARN (perror);
  760. #elif defined GNULIB_POSIXCHECK
  761. # undef perror
  762. /* Assume perror is always declared. */
  763. _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
  764. "use gnulib module perror for portability");
  765. #endif
  766. #if @GNULIB_POPEN@
  767. # if @REPLACE_POPEN@
  768. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  769. # undef popen
  770. # define popen rpl_popen
  771. # endif
  772. _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
  773. _GL_ARG_NONNULL ((1, 2)));
  774. _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
  775. # else
  776. # if !@HAVE_POPEN@
  777. _GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode)
  778. _GL_ARG_NONNULL ((1, 2)));
  779. # endif
  780. _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
  781. # endif
  782. _GL_CXXALIASWARN (popen);
  783. #elif defined GNULIB_POSIXCHECK
  784. # undef popen
  785. # if HAVE_RAW_DECL_POPEN
  786. _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
  787. "use gnulib module popen or pipe for more portability");
  788. # endif
  789. #endif
  790. #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
  791. # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
  792. || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
  793. # if defined __GNUC__
  794. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  795. /* Don't break __attribute__((format(printf,M,N))). */
  796. # define printf __printf__
  797. # endif
  798. # if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
  799. _GL_FUNCDECL_RPL_1 (__printf__, int,
  800. (const char *format, ...)
  801. __asm__ (@ASM_SYMBOL_PREFIX@
  802. _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
  803. _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
  804. _GL_ARG_NONNULL ((1)));
  805. # else
  806. _GL_FUNCDECL_RPL_1 (__printf__, int,
  807. (const char *format, ...)
  808. __asm__ (@ASM_SYMBOL_PREFIX@
  809. _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
  810. _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
  811. _GL_ARG_NONNULL ((1)));
  812. # endif
  813. _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
  814. # else
  815. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  816. # define printf rpl_printf
  817. # endif
  818. _GL_FUNCDECL_RPL (printf, int,
  819. (const char *format, ...)
  820. _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
  821. _GL_ARG_NONNULL ((1)));
  822. _GL_CXXALIAS_RPL (printf, int, (const char *format, ...));
  823. # endif
  824. # define GNULIB_overrides_printf 1
  825. # else
  826. _GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
  827. # endif
  828. _GL_CXXALIASWARN (printf);
  829. #endif
  830. #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
  831. # if !GNULIB_overrides_printf
  832. # undef printf
  833. # endif
  834. /* Assume printf is always declared. */
  835. _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
  836. "use gnulib module printf-posix for portable "
  837. "POSIX compliance");
  838. #endif
  839. #if @GNULIB_PUTC@
  840. # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
  841. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  842. # undef putc
  843. # define putc rpl_fputc
  844. # endif
  845. _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
  846. _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
  847. # else
  848. _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
  849. # endif
  850. _GL_CXXALIASWARN (putc);
  851. #endif
  852. #if @GNULIB_PUTCHAR@
  853. # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
  854. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  855. # undef putchar
  856. # define putchar rpl_putchar
  857. # endif
  858. _GL_FUNCDECL_RPL (putchar, int, (int c));
  859. _GL_CXXALIAS_RPL (putchar, int, (int c));
  860. # else
  861. _GL_CXXALIAS_SYS (putchar, int, (int c));
  862. # endif
  863. _GL_CXXALIASWARN (putchar);
  864. #endif
  865. #if @GNULIB_PUTS@
  866. # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
  867. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  868. # undef puts
  869. # define puts rpl_puts
  870. # endif
  871. _GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
  872. _GL_CXXALIAS_RPL (puts, int, (const char *string));
  873. # else
  874. _GL_CXXALIAS_SYS (puts, int, (const char *string));
  875. # endif
  876. _GL_CXXALIASWARN (puts);
  877. #endif
  878. #if @GNULIB_REMOVE@
  879. # if @REPLACE_REMOVE@
  880. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  881. # undef remove
  882. # define remove rpl_remove
  883. # endif
  884. _GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
  885. _GL_CXXALIAS_RPL (remove, int, (const char *name));
  886. # else
  887. _GL_CXXALIAS_SYS (remove, int, (const char *name));
  888. # endif
  889. _GL_CXXALIASWARN (remove);
  890. #elif defined GNULIB_POSIXCHECK
  891. # undef remove
  892. /* Assume remove is always declared. */
  893. _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
  894. "use gnulib module remove for more portability");
  895. #endif
  896. #if @GNULIB_RENAME@
  897. # if @REPLACE_RENAME@
  898. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  899. # undef rename
  900. # define rename rpl_rename
  901. # endif
  902. _GL_FUNCDECL_RPL (rename, int,
  903. (const char *old_filename, const char *new_filename)
  904. _GL_ARG_NONNULL ((1, 2)));
  905. _GL_CXXALIAS_RPL (rename, int,
  906. (const char *old_filename, const char *new_filename));
  907. # else
  908. _GL_CXXALIAS_SYS (rename, int,
  909. (const char *old_filename, const char *new_filename));
  910. # endif
  911. _GL_CXXALIASWARN (rename);
  912. #elif defined GNULIB_POSIXCHECK
  913. # undef rename
  914. /* Assume rename is always declared. */
  915. _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
  916. "use gnulib module rename for more portability");
  917. #endif
  918. #if @GNULIB_RENAMEAT@
  919. # if @REPLACE_RENAMEAT@
  920. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  921. # undef renameat
  922. # define renameat rpl_renameat
  923. # endif
  924. _GL_FUNCDECL_RPL (renameat, int,
  925. (int fd1, char const *file1, int fd2, char const *file2)
  926. _GL_ARG_NONNULL ((2, 4)));
  927. _GL_CXXALIAS_RPL (renameat, int,
  928. (int fd1, char const *file1, int fd2, char const *file2));
  929. # else
  930. # if !@HAVE_RENAMEAT@
  931. _GL_FUNCDECL_SYS (renameat, int,
  932. (int fd1, char const *file1, int fd2, char const *file2)
  933. _GL_ARG_NONNULL ((2, 4)));
  934. # endif
  935. _GL_CXXALIAS_SYS (renameat, int,
  936. (int fd1, char const *file1, int fd2, char const *file2));
  937. # endif
  938. _GL_CXXALIASWARN (renameat);
  939. #elif defined GNULIB_POSIXCHECK
  940. # undef renameat
  941. # if HAVE_RAW_DECL_RENAMEAT
  942. _GL_WARN_ON_USE (renameat, "renameat is not portable - "
  943. "use gnulib module renameat for portability");
  944. # endif
  945. #endif
  946. #if @GNULIB_SCANF@
  947. # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
  948. # if defined __GNUC__
  949. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  950. # undef scanf
  951. /* Don't break __attribute__((format(scanf,M,N))). */
  952. # define scanf __scanf__
  953. # endif
  954. _GL_FUNCDECL_RPL_1 (__scanf__, int,
  955. (const char *format, ...)
  956. __asm__ (@ASM_SYMBOL_PREFIX@
  957. _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
  958. _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
  959. _GL_ARG_NONNULL ((1)));
  960. _GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...));
  961. # else
  962. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  963. # undef scanf
  964. # define scanf rpl_scanf
  965. # endif
  966. _GL_FUNCDECL_RPL (scanf, int, (const char *format, ...)
  967. _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
  968. _GL_ARG_NONNULL ((1)));
  969. _GL_CXXALIAS_RPL (scanf, int, (const char *format, ...));
  970. # endif
  971. # else
  972. _GL_CXXALIAS_SYS (scanf, int, (const char *format, ...));
  973. # endif
  974. _GL_CXXALIASWARN (scanf);
  975. #endif
  976. #if @GNULIB_SNPRINTF@
  977. # if @REPLACE_SNPRINTF@
  978. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  979. # define snprintf rpl_snprintf
  980. # endif
  981. _GL_FUNCDECL_RPL (snprintf, int,
  982. (char *str, size_t size, const char *format, ...)
  983. _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
  984. _GL_ARG_NONNULL ((3)));
  985. _GL_CXXALIAS_RPL (snprintf, int,
  986. (char *str, size_t size, const char *format, ...));
  987. # else
  988. # if !@HAVE_DECL_SNPRINTF@
  989. _GL_FUNCDECL_SYS (snprintf, int,
  990. (char *str, size_t size, const char *format, ...)
  991. _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
  992. _GL_ARG_NONNULL ((3)));
  993. # endif
  994. _GL_CXXALIAS_SYS (snprintf, int,
  995. (char *str, size_t size, const char *format, ...));
  996. # endif
  997. _GL_CXXALIASWARN (snprintf);
  998. #elif defined GNULIB_POSIXCHECK
  999. # undef snprintf
  1000. # if HAVE_RAW_DECL_SNPRINTF
  1001. _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
  1002. "use gnulib module snprintf for portability");
  1003. # endif
  1004. #endif
  1005. /* Some people would argue that all sprintf uses should be warned about
  1006. (for example, OpenBSD issues a link warning for it),
  1007. since it can cause security holes due to buffer overruns.
  1008. However, we believe that sprintf can be used safely, and is more
  1009. efficient than snprintf in those safe cases; and as proof of our
  1010. belief, we use sprintf in several gnulib modules. So this header
  1011. intentionally avoids adding a warning to sprintf except when
  1012. GNULIB_POSIXCHECK is defined. */
  1013. #if @GNULIB_SPRINTF_POSIX@
  1014. # if @REPLACE_SPRINTF@
  1015. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1016. # define sprintf rpl_sprintf
  1017. # endif
  1018. _GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...)
  1019. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
  1020. _GL_ARG_NONNULL ((1, 2)));
  1021. _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
  1022. # else
  1023. _GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
  1024. # endif
  1025. _GL_CXXALIASWARN (sprintf);
  1026. #elif defined GNULIB_POSIXCHECK
  1027. # undef sprintf
  1028. /* Assume sprintf is always declared. */
  1029. _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
  1030. "use gnulib module sprintf-posix for portable "
  1031. "POSIX compliance");
  1032. #endif
  1033. #if @GNULIB_TMPFILE@
  1034. # if @REPLACE_TMPFILE@
  1035. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1036. # define tmpfile rpl_tmpfile
  1037. # endif
  1038. _GL_FUNCDECL_RPL (tmpfile, FILE *, (void));
  1039. _GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
  1040. # else
  1041. _GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
  1042. # endif
  1043. _GL_CXXALIASWARN (tmpfile);
  1044. #elif defined GNULIB_POSIXCHECK
  1045. # undef tmpfile
  1046. # if HAVE_RAW_DECL_TMPFILE
  1047. _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
  1048. "use gnulib module tmpfile for portability");
  1049. # endif
  1050. #endif
  1051. #if @GNULIB_VASPRINTF@
  1052. /* Write formatted output to a string dynamically allocated with malloc().
  1053. If the memory allocation succeeds, store the address of the string in
  1054. *RESULT and return the number of resulting bytes, excluding the trailing
  1055. NUL. Upon memory allocation error, or some other error, return -1. */
  1056. # if @REPLACE_VASPRINTF@
  1057. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1058. # define asprintf rpl_asprintf
  1059. # endif
  1060. _GL_FUNCDECL_RPL (asprintf, int,
  1061. (char **result, const char *format, ...)
  1062. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
  1063. _GL_ARG_NONNULL ((1, 2)));
  1064. _GL_CXXALIAS_RPL (asprintf, int,
  1065. (char **result, const char *format, ...));
  1066. # else
  1067. # if !@HAVE_VASPRINTF@
  1068. _GL_FUNCDECL_SYS (asprintf, int,
  1069. (char **result, const char *format, ...)
  1070. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
  1071. _GL_ARG_NONNULL ((1, 2)));
  1072. # endif
  1073. _GL_CXXALIAS_SYS (asprintf, int,
  1074. (char **result, const char *format, ...));
  1075. # endif
  1076. _GL_CXXALIASWARN (asprintf);
  1077. # if @REPLACE_VASPRINTF@
  1078. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1079. # define vasprintf rpl_vasprintf
  1080. # endif
  1081. _GL_FUNCDECL_RPL (vasprintf, int,
  1082. (char **result, const char *format, va_list args)
  1083. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
  1084. _GL_ARG_NONNULL ((1, 2)));
  1085. _GL_CXXALIAS_RPL (vasprintf, int,
  1086. (char **result, const char *format, va_list args));
  1087. # else
  1088. # if !@HAVE_VASPRINTF@
  1089. _GL_FUNCDECL_SYS (vasprintf, int,
  1090. (char **result, const char *format, va_list args)
  1091. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
  1092. _GL_ARG_NONNULL ((1, 2)));
  1093. # endif
  1094. _GL_CXXALIAS_SYS (vasprintf, int,
  1095. (char **result, const char *format, va_list args));
  1096. # endif
  1097. _GL_CXXALIASWARN (vasprintf);
  1098. #endif
  1099. #if @GNULIB_VDPRINTF@
  1100. # if @REPLACE_VDPRINTF@
  1101. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1102. # define vdprintf rpl_vdprintf
  1103. # endif
  1104. _GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args)
  1105. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
  1106. _GL_ARG_NONNULL ((2)));
  1107. _GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args));
  1108. # else
  1109. # if !@HAVE_VDPRINTF@
  1110. _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args)
  1111. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
  1112. _GL_ARG_NONNULL ((2)));
  1113. # endif
  1114. /* Need to cast, because on Solaris, the third parameter will likely be
  1115. __va_list args. */
  1116. _GL_CXXALIAS_SYS_CAST (vdprintf, int,
  1117. (int fd, const char *format, va_list args));
  1118. # endif
  1119. _GL_CXXALIASWARN (vdprintf);
  1120. #elif defined GNULIB_POSIXCHECK
  1121. # undef vdprintf
  1122. # if HAVE_RAW_DECL_VDPRINTF
  1123. _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
  1124. "use gnulib module vdprintf for portability");
  1125. # endif
  1126. #endif
  1127. #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
  1128. # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
  1129. || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
  1130. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1131. # define vfprintf rpl_vfprintf
  1132. # endif
  1133. # define GNULIB_overrides_vfprintf 1
  1134. # if @GNULIB_VFPRINTF_POSIX@
  1135. _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
  1136. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
  1137. _GL_ARG_NONNULL ((1, 2)));
  1138. # else
  1139. _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
  1140. _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
  1141. _GL_ARG_NONNULL ((1, 2)));
  1142. # endif
  1143. _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
  1144. # else
  1145. /* Need to cast, because on Solaris, the third parameter is
  1146. __va_list args
  1147. and GCC's fixincludes did not change this to __gnuc_va_list. */
  1148. _GL_CXXALIAS_SYS_CAST (vfprintf, int,
  1149. (FILE *fp, const char *format, va_list args));
  1150. # endif
  1151. _GL_CXXALIASWARN (vfprintf);
  1152. #endif
  1153. #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
  1154. # if !GNULIB_overrides_vfprintf
  1155. # undef vfprintf
  1156. # endif
  1157. /* Assume vfprintf is always declared. */
  1158. _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
  1159. "use gnulib module vfprintf-posix for portable "
  1160. "POSIX compliance");
  1161. #endif
  1162. #if @GNULIB_VFSCANF@
  1163. # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
  1164. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1165. # undef vfscanf
  1166. # define vfscanf rpl_vfscanf
  1167. # endif
  1168. _GL_FUNCDECL_RPL (vfscanf, int,
  1169. (FILE *stream, const char *format, va_list args)
  1170. _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
  1171. _GL_ARG_NONNULL ((1, 2)));
  1172. _GL_CXXALIAS_RPL (vfscanf, int,
  1173. (FILE *stream, const char *format, va_list args));
  1174. # else
  1175. _GL_CXXALIAS_SYS (vfscanf, int,
  1176. (FILE *stream, const char *format, va_list args));
  1177. # endif
  1178. _GL_CXXALIASWARN (vfscanf);
  1179. #endif
  1180. #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
  1181. # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
  1182. || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
  1183. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1184. # define vprintf rpl_vprintf
  1185. # endif
  1186. # define GNULIB_overrides_vprintf 1
  1187. # if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
  1188. _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
  1189. _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0)
  1190. _GL_ARG_NONNULL ((1)));
  1191. # else
  1192. _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
  1193. _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
  1194. _GL_ARG_NONNULL ((1)));
  1195. # endif
  1196. _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
  1197. # else
  1198. /* Need to cast, because on Solaris, the second parameter is
  1199. __va_list args
  1200. and GCC's fixincludes did not change this to __gnuc_va_list. */
  1201. _GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
  1202. # endif
  1203. _GL_CXXALIASWARN (vprintf);
  1204. #endif
  1205. #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
  1206. # if !GNULIB_overrides_vprintf
  1207. # undef vprintf
  1208. # endif
  1209. /* Assume vprintf is always declared. */
  1210. _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
  1211. "use gnulib module vprintf-posix for portable "
  1212. "POSIX compliance");
  1213. #endif
  1214. #if @GNULIB_VSCANF@
  1215. # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
  1216. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1217. # undef vscanf
  1218. # define vscanf rpl_vscanf
  1219. # endif
  1220. _GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args)
  1221. _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
  1222. _GL_ARG_NONNULL ((1)));
  1223. _GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args));
  1224. # else
  1225. _GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args));
  1226. # endif
  1227. _GL_CXXALIASWARN (vscanf);
  1228. #endif
  1229. #if @GNULIB_VSNPRINTF@
  1230. # if @REPLACE_VSNPRINTF@
  1231. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1232. # define vsnprintf rpl_vsnprintf
  1233. # endif
  1234. _GL_FUNCDECL_RPL (vsnprintf, int,
  1235. (char *str, size_t size, const char *format, va_list args)
  1236. _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
  1237. _GL_ARG_NONNULL ((3)));
  1238. _GL_CXXALIAS_RPL (vsnprintf, int,
  1239. (char *str, size_t size, const char *format, va_list args));
  1240. # else
  1241. # if !@HAVE_DECL_VSNPRINTF@
  1242. _GL_FUNCDECL_SYS (vsnprintf, int,
  1243. (char *str, size_t size, const char *format, va_list args)
  1244. _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
  1245. _GL_ARG_NONNULL ((3)));
  1246. # endif
  1247. _GL_CXXALIAS_SYS (vsnprintf, int,
  1248. (char *str, size_t size, const char *format, va_list args));
  1249. # endif
  1250. _GL_CXXALIASWARN (vsnprintf);
  1251. #elif defined GNULIB_POSIXCHECK
  1252. # undef vsnprintf
  1253. # if HAVE_RAW_DECL_VSNPRINTF
  1254. _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
  1255. "use gnulib module vsnprintf for portability");
  1256. # endif
  1257. #endif
  1258. #if @GNULIB_VSPRINTF_POSIX@
  1259. # if @REPLACE_VSPRINTF@
  1260. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1261. # define vsprintf rpl_vsprintf
  1262. # endif
  1263. _GL_FUNCDECL_RPL (vsprintf, int,
  1264. (char *str, const char *format, va_list args)
  1265. _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
  1266. _GL_ARG_NONNULL ((1, 2)));
  1267. _GL_CXXALIAS_RPL (vsprintf, int,
  1268. (char *str, const char *format, va_list args));
  1269. # else
  1270. /* Need to cast, because on Solaris, the third parameter is
  1271. __va_list args
  1272. and GCC's fixincludes did not change this to __gnuc_va_list. */
  1273. _GL_CXXALIAS_SYS_CAST (vsprintf, int,
  1274. (char *str, const char *format, va_list args));
  1275. # endif
  1276. _GL_CXXALIASWARN (vsprintf);
  1277. #elif defined GNULIB_POSIXCHECK
  1278. # undef vsprintf
  1279. /* Assume vsprintf is always declared. */
  1280. _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
  1281. "use gnulib module vsprintf-posix for portable "
  1282. "POSIX compliance");
  1283. #endif
  1284. #endif /* _@GUARD_PREFIX@_STDIO_H */
  1285. #endif /* _@GUARD_PREFIX@_STDIO_H */
  1286. #endif