1 /* A GNU-like <stdio.h>.
3 Copyright (C) 2004, 2007 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 This program 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
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 #if defined __need_FILE || defined __need___FILE
20 /* Special invocation convention inside glibc header files. */
22 #include @ABSOLUTE_STDIO_H@
25 /* Normal invocation convention. */
29 #include @ABSOLUTE_STDIO_H@
35 /* This feature is available in gcc versions 2.5 and later. */
36 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
37 # define __attribute__(Spec) /* empty */
39 /* The __-protected variants of `format' and `printf' attributes
40 are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
41 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
42 # define __format__ format
43 # define __printf__ printf
48 /* The definition of GL_LINK_WARNING is copied here. */
56 #if @GNULIB_FPRINTF_POSIX@
57 # if @REPLACE_FPRINTF@
58 # define fprintf rpl_fprintf
59 extern int fprintf (FILE *fp, const char *format, ...)
60 __attribute__ ((__format__ (__printf__, 2, 3)));
62 #elif defined GNULIB_POSIXCHECK
65 (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
66 "use gnulib module fprintf-posix for portable " \
67 "POSIX compliance"), \
71 #if @GNULIB_VFPRINTF_POSIX@
72 # if @REPLACE_VFPRINTF@
73 # define vfprintf rpl_vfprintf
74 extern int vfprintf (FILE *fp, const char *format, va_list args)
75 __attribute__ ((__format__ (__printf__, 2, 0)));
77 #elif defined GNULIB_POSIXCHECK
79 # define vfprintf(s,f,a) \
80 (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
81 "use gnulib module vfprintf-posix for portable " \
82 "POSIX compliance"), \
86 #if @GNULIB_PRINTF_POSIX@
88 /* Don't break __attribute__((format(printf,M,N))). */
89 # define printf __printf__
90 extern int printf (const char *format, ...)
91 __attribute__ ((__format__ (__printf__, 1, 2)));
93 #elif defined GNULIB_POSIXCHECK
96 (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
97 "use gnulib module printf-posix for portable " \
98 "POSIX compliance"), \
100 /* Don't break __attribute__((format(printf,M,N))). */
101 # define format(kind,m,n) format (__##kind##__, m, n)
102 # define __format__(kind,m,n) __format__ (__##kind##__, m, n)
103 # define ____printf____ __printf__
104 # define ____scanf____ __scanf__
105 # define ____strftime____ __strftime__
106 # define ____strfmon____ __strfmon__
109 #if @GNULIB_VPRINTF_POSIX@
110 # if @REPLACE_VPRINTF@
111 # define vprintf rpl_vprintf
112 extern int vprintf (const char *format, va_list args)
113 __attribute__ ((__format__ (__printf__, 1, 0)));
115 #elif defined GNULIB_POSIXCHECK
117 # define vprintf(f,a) \
118 (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
119 "use gnulib module vprintf-posix for portable " \
120 "POSIX compliance"), \
124 #if @GNULIB_SNPRINTF@
125 # if @REPLACE_SNPRINTF@
126 # define snprintf rpl_snprintf
128 # if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
129 extern int snprintf (char *str, size_t size, const char *format, ...)
130 __attribute__ ((__format__ (__printf__, 3, 4)));
132 #elif defined GNULIB_POSIXCHECK
135 (GL_LINK_WARNING ("snprintf is unportable - " \
136 "use gnulib module snprintf for portability"), \
140 #if @GNULIB_VSNPRINTF@
141 # if @REPLACE_VSNPRINTF@
142 # define vsnprintf rpl_vsnprintf
144 # if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
145 extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
146 __attribute__ ((__format__ (__printf__, 3, 0)));
148 #elif defined GNULIB_POSIXCHECK
150 # define vsnprintf(b,s,f,a) \
151 (GL_LINK_WARNING ("vsnprintf is unportable - " \
152 "use gnulib module vsnprintf for portability"), \
153 vsnprintf (b, s, f, a))
156 #if @GNULIB_SPRINTF_POSIX@
157 # if @REPLACE_SPRINTF@
158 # define sprintf rpl_sprintf
159 extern int sprintf (char *str, const char *format, ...)
160 __attribute__ ((__format__ (__printf__, 2, 3)));
162 #elif defined GNULIB_POSIXCHECK
165 (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
166 "use gnulib module sprintf-posix for portable " \
167 "POSIX compliance"), \
171 #if @GNULIB_VSPRINTF_POSIX@
172 # if @REPLACE_VSPRINTF@
173 # define vsprintf rpl_vsprintf
174 extern int vsprintf (char *str, const char *format, va_list args)
175 __attribute__ ((__format__ (__printf__, 2, 0)));
177 #elif defined GNULIB_POSIXCHECK
179 # define vsprintf(b,f,a) \
180 (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
181 "use gnulib module vsprintf-posix for portable " \
182 "POSIX compliance"), \
191 #endif /* _GL_STDIO_H */