From: Paolo Carlini Date: Mon, 17 Oct 2011 17:44:42 +0000 (+0000) Subject: re PR c++/50757 (Cannot turn off -Wnonnull when using C++) X-Git-Tag: releases/gcc-4.7.0~3042 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ef12edb597a61bc12b65afed5c00ca71bf49605c;p=thirdparty%2Fgcc.git re PR c++/50757 (Cannot turn off -Wnonnull when using C++) /gcc 2011-10-17 Paolo Carlini PR c++/50757 * c-family/c.opt ([Wnonnull]): Add C++ and Objective-C++. * doc/invoke.texi: Update. /testsuite 2011-10-17 Paolo Carlini PR c++/50757 * g++.dg/warn/format7.C: New. * obj-c++.dg/warn7.mm: Likewise. From-SVN: r180101 --- diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 8e06c51c0eba..bfc1a7c922ce 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -510,7 +510,7 @@ C++ ObjC++ Var(warn_nonvdtor) Warning Warn about non-virtual destructors Wnonnull -C ObjC Var(warn_nonnull) Warning +C ObjC C++ ObjC++ Var(warn_nonnull) Warning Warn about NULL being passed to argument slots marked as requiring non-NULL Wnormalized= diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 3b71cb18592d..ac50a3158d62 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -3223,7 +3223,7 @@ Enable @option{-Wformat} plus format checks not included in @option{-Wformat}. Currently equivalent to @samp{-Wformat -Wformat-nonliteral -Wformat-security -Wformat-y2k}. -@item -Wnonnull @r{(C and Objective-C only)} +@item -Wnonnull @opindex Wnonnull @opindex Wno-nonnull Warn about passing a null pointer for arguments marked as diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4dc4e786dcaf..b67d0f5e8ae7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-10-17 Paolo Carlini + + PR c++/50757 + * g++.dg/warn/format7.C: New. + * obj-c++.dg/warn7.mm: Likewise. + 2011-10-17 Richard Guenther PR tree-optimization/50729 diff --git a/gcc/testsuite/g++.dg/warn/format7.C b/gcc/testsuite/g++.dg/warn/format7.C new file mode 100644 index 000000000000..6e84069eec52 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/format7.C @@ -0,0 +1,10 @@ +// PR c++/50757 +// { dg-options "-Wformat -Wno-nonnull" } + +extern void *f (void *__s) __attribute__ ((__nonnull__ (1))); + +int main() +{ + void* const s = 0; + f(s); +} diff --git a/gcc/testsuite/obj-c++.dg/warn7.mm b/gcc/testsuite/obj-c++.dg/warn7.mm new file mode 100644 index 000000000000..6e84069eec52 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/warn7.mm @@ -0,0 +1,10 @@ +// PR c++/50757 +// { dg-options "-Wformat -Wno-nonnull" } + +extern void *f (void *__s) __attribute__ ((__nonnull__ (1))); + +int main() +{ + void* const s = 0; + f(s); +}