stdio2-decl.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /* Checking macros for stdio functions. Declarations only.
  2. Copyright (C) 2004-2026 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #ifndef _BITS_STDIO2_DEC_H
  16. #define _BITS_STDIO2_DEC_H 1
  17. #ifndef _STDIO_H
  18. # error "Never include <bits/stdio2-decl.h> directly; use <stdio.h> instead."
  19. #endif
  20. extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
  21. const char *__restrict __format, ...) __THROW
  22. __attr_access ((__write_only__, 1, 3));
  23. extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
  24. const char *__restrict __format,
  25. __gnuc_va_list __ap) __THROW
  26. __attr_access ((__write_only__, 1, 3));
  27. #if defined __USE_ISOC99 || defined __USE_UNIX98
  28. extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
  29. size_t __slen, const char *__restrict __format,
  30. ...) __THROW
  31. __attr_access ((__write_only__, 1, 2));
  32. extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
  33. size_t __slen, const char *__restrict __format,
  34. __gnuc_va_list __ap) __THROW
  35. __attr_access ((__write_only__, 1, 2));
  36. #endif
  37. #if __USE_FORTIFY_LEVEL > 1
  38. extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
  39. const char *__restrict __format, ...)
  40. __nonnull ((1));
  41. extern int __printf_chk (int __flag, const char *__restrict __format, ...);
  42. extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
  43. const char *__restrict __format,
  44. __gnuc_va_list __ap) __nonnull ((1));
  45. extern int __vprintf_chk (int __flag, const char *__restrict __format,
  46. __gnuc_va_list __ap);
  47. # ifdef __USE_XOPEN2K8
  48. extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
  49. ...) __attribute__ ((__format__ (__printf__, 3, 4)));
  50. extern int __vdprintf_chk (int __fd, int __flag,
  51. const char *__restrict __fmt, __gnuc_va_list __arg)
  52. __attribute__ ((__format__ (__printf__, 3, 0)));
  53. # endif
  54. # ifdef __USE_GNU
  55. extern int __asprintf_chk (char **__restrict __ptr, int __flag,
  56. const char *__restrict __fmt, ...)
  57. __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur;
  58. extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
  59. const char *__restrict __fmt, __gnuc_va_list __arg)
  60. __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
  61. extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
  62. int __flag, const char *__restrict __format,
  63. ...)
  64. __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
  65. extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
  66. int __flag,
  67. const char *__restrict __format,
  68. __gnuc_va_list __args)
  69. __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
  70. # endif
  71. #endif
  72. #if __GLIBC_USE (DEPRECATED_GETS)
  73. extern char *__REDIRECT (__gets_warn, (char *__str), gets)
  74. __wur __warnattr ("please use fgets or getline instead, gets can't "
  75. "specify buffer size");
  76. extern char *__gets_chk (char *__str, size_t) __wur;
  77. #endif
  78. extern char *__REDIRECT (__fgets_alias,
  79. (char *__restrict __s, int __n,
  80. FILE *__restrict __stream), fgets)
  81. __wur __attr_access ((__write_only__, 1, 2));
  82. extern char *__REDIRECT (__fgets_chk_warn,
  83. (char *__restrict __s, size_t __size, int __n,
  84. FILE *__restrict __stream), __fgets_chk)
  85. __wur __warnattr ("fgets called with bigger size than length "
  86. "of destination buffer");
  87. extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n,
  88. FILE *__restrict __stream)
  89. __wur __attr_access ((__write_only__, 1, 3)) __nonnull ((4));
  90. extern size_t __REDIRECT (__fread_alias,
  91. (void *__restrict __ptr, size_t __size,
  92. size_t __n, FILE *__restrict __stream),
  93. fread) __wur;
  94. extern size_t __REDIRECT (__fread_chk_warn,
  95. (void *__restrict __ptr, size_t __ptrlen,
  96. size_t __size, size_t __n,
  97. FILE *__restrict __stream),
  98. __fread_chk)
  99. __wur __warnattr ("fread called with bigger size * nmemb than length "
  100. "of destination buffer");
  101. extern size_t __fread_chk (void *__restrict __ptr, size_t __ptrlen,
  102. size_t __size, size_t __n,
  103. FILE *__restrict __stream) __wur __nonnull ((5));
  104. #ifdef __USE_GNU
  105. extern char *__REDIRECT_FORTIFY (__fgets_unlocked_alias,
  106. (char *__restrict __s, int __n,
  107. FILE *__restrict __stream), fgets_unlocked)
  108. __wur __attr_access ((__write_only__, 1, 2));
  109. extern char *__REDIRECT (__fgets_unlocked_chk_warn,
  110. (char *__restrict __s, size_t __size, int __n,
  111. FILE *__restrict __stream), __fgets_unlocked_chk)
  112. __wur __warnattr ("fgets_unlocked called with bigger size than length "
  113. "of destination buffer");
  114. extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size,
  115. int __n, FILE *__restrict __stream)
  116. __wur __attr_access ((__write_only__, 1, 3)) __nonnull ((4));
  117. #endif
  118. #ifdef __USE_MISC
  119. # undef fread_unlocked
  120. extern size_t __REDIRECT (__fread_unlocked_alias,
  121. (void *__restrict __ptr, size_t __size,
  122. size_t __n, FILE *__restrict __stream),
  123. fread_unlocked) __wur;
  124. extern size_t __REDIRECT (__fread_unlocked_chk_warn,
  125. (void *__restrict __ptr, size_t __ptrlen,
  126. size_t __size, size_t __n,
  127. FILE *__restrict __stream),
  128. __fread_unlocked_chk)
  129. __wur __warnattr ("fread_unlocked called with bigger size * nmemb than "
  130. "length of destination buffer");
  131. extern size_t __fread_unlocked_chk (void *__restrict __ptr, size_t __ptrlen,
  132. size_t __size, size_t __n,
  133. FILE *__restrict __stream)
  134. __wur __nonnull ((5));
  135. #endif
  136. #endif /* bits/stdio2-decl.h. */