(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / libio / bits / stdio2.h
blobacf07ea91bdbafc83ce0bc1c4b221f8df994a6c0
1 /* Checking macros for stdio functions.
2 Copyright (C) 2004 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifndef _STDIO_H
21 # error "Never include <bits/stdio2.h> directly; use <stdio.h> instead."
22 #endif
24 extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
25 __const char *__restrict __format, ...) __THROW;
26 extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
27 __const char *__restrict __format,
28 _G_va_list __ap) __THROW;
30 #define sprintf(str, ...) \
31 __builtin___sprintf_chk (str, __USE_FORTIFY_LEVEL - 1, __bos (str), \
32 __VA_ARGS__)
33 #define vsprintf(str, fmt, ap) \
34 __builtin___vsprintf_chk (str, __USE_FORTIFY_LEVEL - 1, __bos (str), fmt, ap)
36 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
38 extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
39 size_t __slen, __const char *__restrict __format,
40 ...) __THROW;
41 extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
42 size_t __slen, __const char *__restrict __format,
43 _G_va_list __ap) __THROW;
45 # define snprintf(str, len, ...) \
46 __builtin___snprintf_chk (str, len, __USE_FORTIFY_LEVEL - 1, __bos (str), \
47 __VA_ARGS__)
48 # define vsnprintf(str, len, fmt, ap) \
49 __builtin___vsnprintf_chk (str, len, __USE_FORTIFY_LEVEL - 1, __bos (str), \
50 fmt, ap)
52 #endif
54 #if __USE_FORTIFY_LEVEL > 1
56 extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
57 __const char *__restrict __format, ...);
58 extern int __printf_chk (int __flag, __const char *__restrict __format, ...);
59 extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
60 __const char *__restrict __format, _G_va_list __ap);
61 extern int __vprintf_chk (int __flag, __const char *__restrict __format,
62 _G_va_list __ap);
64 # define printf(...) \
65 __printf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
66 # define fprintf(stream, ...) \
67 __fprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
68 # define vprintf(format, ap) \
69 __vprintf_chk (__USE_FORTIFY_LEVEL - 1, format, ap)
70 # define vfprintf(stream, format, ap) \
71 __vfprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, format, ap)
73 #endif
75 extern char *__gets_chk (char *__str, size_t);
76 #define gets(__str) \
77 ((__bos (__str) == (size_t) -1) \
78 ? (gets) (__str) : __gets_chk (__str, __bos (__str)))