re PR c++/53210 (warning for data member initialized with itself should be in -Wall)
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 13 Sep 2012 23:04:04 +0000 (23:04 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 13 Sep 2012 23:04:04 +0000 (23:04 +0000)
2012-09-13  Paolo Carlini  <paolo.carlini@oracle.com>
    Manuel López-Ibáñez  <manu@gcc.gnu.org>

PR c++/53210
* doc/invoke.texi ([Winit-self]): Document as enabled by -Wall
in C++.

/c-family
2012-09-13  Paolo Carlini  <paolo.carlini@oracle.com>
    Manuel López-Ibáñez  <manu@gcc.gnu.org>

PR c++/53210
* c.opt ([Winit-self]): Enabled by -Wall in C++.

/cp
2012-09-13  Paolo Carlini  <paolo.carlini@oracle.com>
    Manuel López-Ibáñez  <manu@gcc.gnu.org>

PR c++/53210
* init.c (perform_member_init): Use OPT_Winit_self instead of
OPT_Wuninitialized.

/testsuite
2012-09-13  Paolo Carlini  <paolo.carlini@oracle.com>
    Manuel López-Ibáñez  <manu@gcc.gnu.org>

PR c++/53210
* g++.dg/warn/Winit-self.C: New.

Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org>
From-SVN: r191284

gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c.opt
gcc/cp/ChangeLog
gcc/cp/init.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Winit-self.C [new file with mode: 0644]

index 865369528b59b306bafa432852a7476c71f3f783..e8f13001302a0d1c5a8d90ebf6ffdbff1dcfc760 100644 (file)
@@ -1,3 +1,10 @@
+2012-09-13  Paolo Carlini  <paolo.carlini@oracle.com>
+           Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       PR c++/53210
+       * doc/invoke.texi ([Winit-self]): Document as enabled by -Wall
+       in C++.
+
 2012-09-13  Eric Botcazou  <ebotcazou@adacore.com>
 
        * config/sparc/predicates.md (input_operand): Do not consider TImode
index 642ff7dc8d5a944379731c0b071d7189a2d31d98..8b3cd2ae549f01e8e1d6e75adfff4d2dc4cba614 100644 (file)
@@ -1,3 +1,9 @@
+2012-09-13  Paolo Carlini  <paolo.carlini@oracle.com>
+           Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       PR c++/53210
+       * c.opt ([Winit-self]): Enabled by -Wall in C++.
+
 2012-08-23  Arnaud Charlet  <charlet@adacore.com>
 
        * c-ada-spec.c (dump_generic_ada_node): Fix handling of name_only
index 914d110597d612242972d27ac0773f6151e5af68..39d70ada0de92c50308ea591734611e50632ff8f 100644 (file)
@@ -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
index 4a9f5c3c2a2ad59d06f9efb742ff674e977d93eb..21256df040356dbd1241f9f2ea0297025806ca58 100644 (file)
@@ -1,3 +1,10 @@
+2012-09-13  Paolo Carlini  <paolo.carlini@oracle.com>
+           Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       PR c++/53210
+       * init.c (perform_member_init): Use OPT_Winit_self instead of
+       OPT_Wuninitialized.
+
 2012-09-13  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * typeck.c (build_indirect_ref, build_function_call,
index e5abec706cd02467652a1e554231c95cc5d6c792..d097443af55a1f4b23de297bf97a53c9e17cb099 100644 (file)
@@ -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);
     }
 
index 0a9226a313bdc9d42dbdf9f10b08ce9811909972..61bca25c70e267d26c8bad005231ba4c3298b8e1 100644 (file)
@@ -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
index 95def4c16cb076ad05f37a563b309762fe3d9669..54f9cf9942322c753a5b28dbb031aea295f9806f 100644 (file)
@@ -1,3 +1,9 @@
+2012-09-13  Paolo Carlini  <paolo.carlini@oracle.com>
+           Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       PR c++/53210
+       * g++.dg/warn/Wuninitialized-self.C: New.
+
 2012-09-13  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..60a7274
--- /dev/null
@@ -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;
+};