individual conversions for information about the particular options that
they use.
+With the @samp{-Wformat} option, the GNU C compiler checks calls to
+@code{printf} and related functions. It examines the format string and
+verifies that the correct number and types of arguments are supplied.
+There is also a GNU C syntax to tell the compiler that a function you
+write uses a @code{printf}-style format string.
+@xref{Function Attributes, , Declaring Attributes of Functions,
+gcc.info, Using GNU CC}, for more information.
+
@node Table of Output Conversions
@subsection Table of Output Conversions
@cindex output conversions, for @code{printf}
This function is similar to @code{printf} except that, instead of taking
a variable number of arguments directly, it takes an argument list
pointer @var{ap}.
-
@end deftypefun
@comment stdio.h
#include <stdarg.h>
void
-eprintf (char *template, ...)
+eprintf (const char *template, ...)
@{
va_list ap;
extern char *program_invocation_short_name;
eprintf ("file `%s' does not exist\n", filename);
@end smallexample
+In GNU C, there is a special construct you can use to let the compiler
+know that a function uses a @code{printf}-style format string. Then it
+can check the number and types of arguments in each call to the
+function, and warn you when they do not match the format string.
+For example, take this declaration of @code{eprintf}:
+
+@smallexample
+void eprintf (const char *template, ...)
+ __attribute__ ((format (printf, 1, 2)));
+@end smallexample
+
+@noindent
+This tells the compiler that @code{eprintf} uses a format string like
+@code{printf} (as opposed to @code{scanf}; @pxref{Formatted Input});
+the format string appears as the first argument;
+and the arguments to satisfy the format begin with the second.
+@xref{Function Attributes, , Declaring Attributes of Functions,
+gcc.info, Using GNU CC}, for more information.
+
@node Parsing a Template String
@subsection Parsing a Template String
@cindex parsing a template string
individual conversions for information about the particular options that
they allow.
+With the @samp{-Wformat} option, the GNU C compiler checks calls to
+@code{scanf} and related functions. It examines the format string and
+verifies that the correct number and types of arguments are supplied.
+There is also a GNU C syntax to tell the compiler that a function you
+write uses a @code{scanf}-style format string.
+@xref{Function Attributes, , Declaring Attributes of Functions,
+gcc.info, Using GNU CC}, for more information.
+
@node Table of Input Conversions
@subsection Table of Input Conversions
@cindex input conversions, for @code{scanf}
specified directly as for @code{vscanf}.
@end deftypefun
+In GNU C, there is a special construct you can use to let the compiler
+know that a function uses a @code{scanf}-style format string. Then it
+can check the number and types of arguments in each call to the
+function, and warn you when they do not match the format string.
+@xref{Function Attributes, , Declaring Attributes of Functions,
+gcc.info, Using GNU CC}, for details.
+
@node Block Input/Output
@section Block Input/Output