* doc/extend.texi, doc/invoke.texi: Document interaction of
-fno-builtin with format checks. Note that built-in functions
have effects beyond generating code that avoids calls to those
functions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87957
138bc75d-0d04-0410-961f-
82ee72b054a4
+2004-09-23 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ PR c/16833
+ * doc/extend.texi, doc/invoke.texi: Document interaction of
+ -fno-builtin with format checks. Note that built-in functions
+ have effects beyond generating code that avoids calls to those
+ functions.
+
2004-09-23 Frank Ch. Eigler <fche@redhat.com>
PR tree-optimization/17533
2004-09-23 Frank Ch. Eigler <fche@redhat.com>
PR tree-optimization/17533
attribute are 2 and 3.
@opindex ffreestanding
attribute are 2 and 3.
@opindex ffreestanding
The @code{format} attribute allows you to identify your own functions
which take format strings as arguments, so that GCC can check the
calls to these functions for errors. The compiler always (unless
The @code{format} attribute allows you to identify your own functions
which take format strings as arguments, so that GCC can check the
calls to these functions for errors. The compiler always (unless
-@option{-ffreestanding} is used) checks formats
+@option{-ffreestanding} or @option{-fno-builtin} is used) checks formats
for the standard library functions @code{printf}, @code{fprintf},
@code{sprintf}, @code{scanf}, @code{fscanf}, @code{sscanf}, @code{strftime},
@code{vprintf}, @code{vfprintf} and @code{vsprintf} whenever such
for the standard library functions @code{printf}, @code{fprintf},
@code{sprintf}, @code{scanf}, @code{fscanf}, @code{sscanf}, @code{strftime},
@code{vprintf}, @code{vfprintf} and @code{vsprintf} whenever such
The compiler always treats @code{gettext}, @code{dgettext}, and
@code{dcgettext} in this manner except when strict ISO C support is
requested by @option{-ansi} or an appropriate @option{-std} option, or
The compiler always treats @code{gettext}, @code{dgettext}, and
@code{dcgettext} in this manner except when strict ISO C support is
requested by @option{-ansi} or an appropriate @option{-std} option, or
-@option{-ffreestanding} is used. @xref{C Dialect Options,,Options
+@option{-ffreestanding} or @option{-fno-builtin}
+is used. @xref{C Dialect Options,,Options
Controlling C Dialect}.
@item function_vector
Controlling C Dialect}.
@item function_vector
may become inline copy loops. The resulting code is often both smaller
and faster, but since the function calls no longer appear as such, you
cannot set a breakpoint on those calls, nor can you change the behavior
may become inline copy loops. The resulting code is often both smaller
and faster, but since the function calls no longer appear as such, you
cannot set a breakpoint on those calls, nor can you change the behavior
-of the functions by linking with a different library.
+of the functions by linking with a different library. In addition,
+when a function is recognized as a built-in function, GCC may use
+information about that function to warn about problems with calls to
+that function, or to generate more efficient code, even if the
+resulting code still contains calls to that function. For example,
+warnings are given with @option{-Wformat} for bad calls to
+@code{printf}, when @code{printf} is built in, and @code{strlen} is
+known not to modify global memory.
With the @option{-fno-builtin-@var{function}} option
only the built-in function @var{function} is
With the @option{-fno-builtin-@var{function}} option
only the built-in function @var{function} is
@item -Wformat
@opindex Wformat
@item -Wformat
@opindex Wformat
+@opindex ffreestanding
+@opindex fno-builtin
Check calls to @code{printf} and @code{scanf}, etc., to make sure that
the arguments supplied have types appropriate to the format string
specified, and that the conversions specified in the format string make
Check calls to @code{printf} and @code{scanf}, etc., to make sure that
the arguments supplied have types appropriate to the format string
specified, and that the conversions specified in the format string make
attributes (@pxref{Function Attributes}), in the @code{printf},
@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
not in the C standard) families (or other target-specific families).
attributes (@pxref{Function Attributes}), in the @code{printf},
@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
not in the C standard) families (or other target-specific families).
+Which functions are checked without format attributes having been
+specified depends on the standard version selected, and such checks of
+functions without the attribute specified are disabled by
+@option{-ffreestanding} or @option{-fno-builtin}.
The formats are checked against the format features supported by GNU
libc version 2.2. These include all ISO C90 and C99 features, as well
The formats are checked against the format features supported by GNU
libc version 2.2. These include all ISO C90 and C99 features, as well