diff options
author | Paolo Carlini <paolo@gcc.gnu.org> | 2011-10-14 09:14:26 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2011-10-14 09:14:26 +0000 |
commit | 4fbbcd7fa9eb75ae668d932a0cd4197205288414 (patch) | |
tree | dabedefa3815bafa2ebc01317267c53e592b6202 /gcc | |
parent | 80f8fdf10b9f16d11ada4dfd86dee229e0c5307e (diff) | |
download | gcc-4fbbcd7fa9eb75ae668d932a0cd4197205288414.zip gcc-4fbbcd7fa9eb75ae668d932a0cd4197205288414.tar.gz gcc-4fbbcd7fa9eb75ae668d932a0cd4197205288414.tar.bz2 |
re PR c++/17212 (-W(no)format-zero-length does not work with C++)
/gcc
2011-10-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/17212
* c-family/c.opt ([Wformat-zero-length]): Add C++ and Objective-C++.
* doc/invoke.texi: Update.
/testsuite
2011-10-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/17212
* g++.dg/warn/format6.C: New.
* obj-c++.dg/warn6.mm: Likewise.
From-SVN: r179963
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-family/c.opt | 2 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/format6.C | 7 | ||||
-rw-r--r-- | gcc/testsuite/obj-c++.dg/warn6.mm | 7 |
4 files changed, 16 insertions, 2 deletions
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 79287c4..a1b25ba 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -396,7 +396,7 @@ C ObjC C++ ObjC++ Var(warn_format_y2k) Warning Warn about strftime formats yielding 2-digit years Wformat-zero-length -C ObjC Var(warn_format_zero_length) Warning +C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning Warn about zero-length formats Wformat= diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 4df10ab7..dcdae47 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -3190,7 +3190,7 @@ 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 -Wno-format-zero-length @r{(C and Objective-C only)} +@item -Wno-format-zero-length @r{(C, C++, Objective-C and Objective-C++ only)} @opindex Wno-format-zero-length @opindex Wformat-zero-length If @option{-Wformat} is specified, do not warn about zero-length formats. diff --git a/gcc/testsuite/g++.dg/warn/format6.C b/gcc/testsuite/g++.dg/warn/format6.C new file mode 100644 index 0000000..a74f802 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/format6.C @@ -0,0 +1,7 @@ +// PR c++/17212 +// { dg-options "-Wformat -Wno-format-zero-length" } + +void f() +{ + __builtin_printf(""); +} diff --git a/gcc/testsuite/obj-c++.dg/warn6.mm b/gcc/testsuite/obj-c++.dg/warn6.mm new file mode 100644 index 0000000..a74f802 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/warn6.mm @@ -0,0 +1,7 @@ +// PR c++/17212 +// { dg-options "-Wformat -Wno-format-zero-length" } + +void f() +{ + __builtin_printf(""); +} |