mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-26 16:51:01 +08:00
re PR c/16833 (-fno-builtin prevents automatic format checks for standard functions)
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. From-SVN: r87957
This commit is contained in:
parent
2115046880
commit
e6e931b7c5
@ -1,3 +1,11 @@
|
||||
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
|
||||
|
@ -1764,10 +1764,11 @@ start with the third argument, so the correct parameters for the format
|
||||
attribute are 2 and 3.
|
||||
|
||||
@opindex ffreestanding
|
||||
@opindex fno-builtin
|
||||
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
|
||||
@ -1824,7 +1825,8 @@ type function whose operands are a call to one of your own function.
|
||||
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
|
||||
|
@ -1173,7 +1173,14 @@ instructions that adjust the stack directly, and calls to @code{memcpy}
|
||||
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
|
||||
@ -2161,6 +2168,8 @@ messages.
|
||||
|
||||
@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
|
||||
@ -2168,6 +2177,10 @@ sense. This includes standard functions, and others specified by format
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user