diff options
author | Joseph Myers <jsm28@cam.ac.uk> | 2001-11-25 18:54:12 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2001-11-25 18:54:12 +0000 |
commit | 7e5fb12fc598f17425138d7b45c9724c374b1539 (patch) | |
tree | 64f1447d44d75dece4a7f5012528ee7b1f4ed583 /gcc/doc/invoke.texi | |
parent | a6253d46c5baa987b12af721d78988806867cea8 (diff) | |
download | gcc-7e5fb12fc598f17425138d7b45c9724c374b1539.tar.gz |
c-format.c (FMT_FLAG_DOLLAR_GAP_POINTER_OK): New.
* c-format.c (FMT_FLAG_DOLLAR_GAP_POINTER_OK): New.
(format_types): Use it for scanf.
(dollar_arguments_pointer_p): New.
(init_dollar_format_checking): Store details of which arguments
are pointers.
(maybe_read_dollar_number): Reallocate dollar_arguments_pointer_p.
(finish_dollar_format_checking): Take extra parameter
pointer_gap_ok. Treat unused arguments differently if
pointer_gap_ok and the unused arguments are pointers.
(check_format_info_main): Pass extra argument to
finish_dollar_format_checking.
* doc/invoke.texi (-Wno-format-extra-args): Document behavior when
unused arguments are present between used arguments with operand
numbers.
testsuite:
* gcc.dg/format/strfmon-1.c: Update comments. Adjust examples
from Austin Group draft 7.
* gcc.dg/format/xopen-1.c: Update comments. Add tests for gaps in
scanf format arguments.
* gcc.dg/format/no-exargs-2.c: New test.
From-SVN: r47327
Diffstat (limited to 'gcc/doc/invoke.texi')
-rw-r--r-- | gcc/doc/invoke.texi | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index bf05c075bfd..21b785324ed 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1849,6 +1849,14 @@ If @option{-Wformat} is specified, do not warn about excess arguments to a @code{printf} or @code{scanf} format function. The C standard specifies that such arguments are ignored. +Where the unused arguments lie between used arguments that are +specified with @samp{$} operand number specifications, normally +warnings are still given, since the implementation could not know what +type to pass to @code{va_arg} to skip the unused arguments. However, +in the case of @code{scanf} formats, this option will suppress the +warning if the unused arguments are all pointers, since the Single +Unix Specification says that such unused arguments are allowed. + @item -Wformat-nonliteral @opindex Wformat-nonliteral If @option{-Wformat} is specified, also warn if the format string is not a |