diff options
author | Jason Thorpe <thorpej@wasabisystems.com> | 2002-05-18 19:02:03 +0000 |
---|---|---|
committer | Jason Thorpe <thorpej@gcc.gnu.org> | 2002-05-18 19:02:03 +0000 |
commit | e964a55607b3cd9e45a45d3331c6f163df7519f5 (patch) | |
tree | c6b8df55dea21cfdbf9d6f73c35e548d165992b2 /gcc/testsuite/gcc.dg/format | |
parent | d92b44865fab81d50fc2db997387f92448d7611a (diff) | |
download | gcc-e964a55607b3cd9e45a45d3331c6f163df7519f5.zip gcc-e964a55607b3cd9e45a45d3331c6f163df7519f5.tar.gz gcc-e964a55607b3cd9e45a45d3331c6f163df7519f5.tar.bz2 |
c-common.c (c_common_post_options): Warn if -Wformat-zero-length is used without -Wformat.
* c-common.c (c_common_post_options): Warn if -Wformat-zero-length
is used without -Wformat.
* c-common.h (warn_format_zero_length): Declare extern.
* c-decl.c (warn_options): Add "format-zero-length".
* c-format.c (warn_format_zero_length): Declare.
(set_Wformat): Set warn_format_zero_length for -Wformat.
(check_format_info): Only warn about zero-length formats if
warn_format_zero_length is true. Include the format type
name in the warning message.
* doc/invoke.texi: Document -Wformat-zero-length.
* testsuite/gcc.dg/format/zero-length-1.c: New test.
From-SVN: r53592
Diffstat (limited to 'gcc/testsuite/gcc.dg/format')
-rw-r--r-- | gcc/testsuite/gcc.dg/format/zero-length-1.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/format/zero-length-1.c b/gcc/testsuite/gcc.dg/format/zero-length-1.c new file mode 100644 index 0000000..4cf37f3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/zero-length-1.c @@ -0,0 +1,15 @@ +/* Test the -Wno-format-zero-length option, which suppresses warnings + about zero-length formats. */ +/* Origin: Jason Thorpe <thorpej@wasabisystems.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wno-format-zero-length" } */ + +#include "format.h" + +void +foo (void) +{ + /* See ISO/IEC 9899:1990 (E) subclause 7.9.6.1 (pages 131-134). */ + /* Zero-length format strings are allowed. */ + printf (""); +} |