From: Paolo Carlini Date: Thu, 13 Sep 2012 23:04:04 +0000 (+0000) Subject: re PR c++/53210 (warning for data member initialized with itself should be in -Wall) X-Git-Tag: misc/gccgo-go1_1_2~891 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ccb505dad0cb34b316c3169fe7f4cd74ab02865;p=thirdparty%2Fgcc.git re PR c++/53210 (warning for data member initialized with itself should be in -Wall) 2012-09-13 Paolo Carlini Manuel López-Ibáñez PR c++/53210 * doc/invoke.texi ([Winit-self]): Document as enabled by -Wall in C++. /c-family 2012-09-13 Paolo Carlini Manuel López-Ibáñez PR c++/53210 * c.opt ([Winit-self]): Enabled by -Wall in C++. /cp 2012-09-13 Paolo Carlini Manuel López-Ibáñez PR c++/53210 * init.c (perform_member_init): Use OPT_Winit_self instead of OPT_Wuninitialized. /testsuite 2012-09-13 Paolo Carlini Manuel López-Ibáñez PR c++/53210 * g++.dg/warn/Winit-self.C: New. Co-Authored-By: Manuel López-Ibáñez From-SVN: r191284 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 865369528b59..e8f13001302a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2012-09-13 Paolo Carlini + Manuel López-Ibáñez + + PR c++/53210 + * doc/invoke.texi ([Winit-self]): Document as enabled by -Wall + in C++. + 2012-09-13 Eric Botcazou * config/sparc/predicates.md (input_operand): Do not consider TImode diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 642ff7dc8d5a..8b3cd2ae549f 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2012-09-13 Paolo Carlini + Manuel López-Ibáñez + + PR c++/53210 + * c.opt ([Winit-self]): Enabled by -Wall in C++. + 2012-08-23 Arnaud Charlet * c-ada-spec.c (dump_generic_ada_node): Fix handling of name_only diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 914d110597d6..39d70ada0de9 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -408,7 +408,7 @@ C C++ Var(warn_ignored_qualifiers) Warning EnabledBy(Wextra) Warn whenever type qualifiers are ignored. Winit-self -C ObjC C++ ObjC++ Var(warn_init_self) Warning +C ObjC C++ ObjC++ Var(warn_init_self) Warning LangEnabledBy(C++ ObjC++,Wall) Warn about variables which are initialized to themselves Wimplicit diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4a9f5c3c2a2a..21256df04035 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2012-09-13 Paolo Carlini + Manuel López-Ibáñez + + PR c++/53210 + * init.c (perform_member_init): Use OPT_Winit_self instead of + OPT_Wuninitialized. + 2012-09-13 Paolo Carlini * typeck.c (build_indirect_ref, build_function_call, diff --git a/gcc/cp/init.c b/gcc/cp/init.c index e5abec706cd0..d097443af55a 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -578,7 +578,7 @@ perform_member_init (tree member, tree init) if (TREE_CODE (val) == COMPONENT_REF && TREE_OPERAND (val, 1) == member && TREE_OPERAND (val, 0) == current_class_ref) warning_at (DECL_SOURCE_LOCATION (current_function_decl), - OPT_Wuninitialized, "%qD is initialized with itself", + OPT_Winit_self, "%qD is initialized with itself", member); } diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 0a9226a313bd..61bca25c70e2 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -3348,6 +3348,8 @@ int f() @end group @end smallexample +This warning is enabled by @option{-Wall} in C++. + @item -Wimplicit-int @r{(C and Objective-C only)} @opindex Wimplicit-int @opindex Wno-implicit-int diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 95def4c16cb0..54f9cf994232 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2012-09-13 Paolo Carlini + Manuel López-Ibáñez + + PR c++/53210 + * g++.dg/warn/Wuninitialized-self.C: New. + 2012-09-13 Jakub Jelinek PR c/54559 diff --git a/gcc/testsuite/g++.dg/warn/Winit-self.C b/gcc/testsuite/g++.dg/warn/Winit-self.C new file mode 100644 index 000000000000..60a72741661b --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Winit-self.C @@ -0,0 +1,8 @@ +// PR c++/53210 +// { dg-options "-Wall" } + +struct S +{ + S(int i) : j(j) { } // { dg-warning "is initialized with itself" } + int j; +};