diff options
author | Joseph Myers <jsm@polyomino.org.uk> | 2004-09-23 17:11:24 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2004-09-23 17:11:24 +0100 |
commit | e6e931b7c534a23faeb47e8ce039de500cb6ccd3 (patch) | |
tree | 22ca0403abd4aa5f3d57ae2b15d82f09f3000b39 | |
parent | 211504688018ec18bc9659c2a61ede4c88d53941 (diff) | |
download | gcc-e6e931b7c534a23faeb47e8ce039de500cb6ccd3.zip gcc-e6e931b7c534a23faeb47e8ce039de500cb6ccd3.tar.gz gcc-e6e931b7c534a23faeb47e8ce039de500cb6ccd3.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/doc/extend.texi | 6 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 15 |
3 files changed, 26 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 93ad667..3c44c68 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index af5b9d1..a407663 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -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 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index fae30188..e86677d 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -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 |